From: Marcos G. T. <ad...@gm...> - 2013-10-07 21:48:06
|
Hi again, I can't undersand the use of: "$sql = mb_substr($sql, 0, strrpos($sql,' OR')) . ')';" in this part of the code, but I guess the author want to cut the last "OR " generated and replace it with a single ')'. Therefore, my code submitted works for this purpose, but avoindig this code from the beginning. If my observation is correct, I suggest that this "quick solution" replaces the previous one. Saludos cordiales. (greetings!) 2013/10/7, Rafael Chacón <raf...@gm...>: > Tim Schofield and Ing Marcos R Garcia Trejo: > > Thanks for your help. > > > Web-erp-developers mailing list: > > Now, I use webERP version 4.11.0; I updated to it last week-end. Previous > version was 4.10.0 and no similar problem was observed. My results: > > 1. Yes, "$sql = mb_substr($sql, 0, strrpos($sql,' OR')) . ')';" is the line > 64 of includes/FreightCalculation.inc. > > 2. I added in table "freightcosts" a line with kgrate=0 for shipper "N/A" > ("do not apply shipper"), and I got the same problem. > > 3. I tried to "Place Order" (.../weberp/DeliveryDetails.php) for > "Service/Labour" items, and I got the same problem. > > 4. I tried to "Place Order" (.../weberp/DeliveryDetails.php) for > "Service/Labour" items with Marcos Garcia Trejos' quick solution (but not > the definitive), and I got SUCCESS Report : Order Number 113 has been > entered. > > 5. I tried to "Place Order" (.../weberp/DeliveryDetails.php) for > "Manufactured" and "Purchased" items with Marcos Garcia Trejos' quick > solution (but not the definitive), and I got SUCCESS Report : Order Number > 114 has been entered. > > Regards, > > Rafael Chacón > Verdorama > > > 2013/10/5 Marcos Garcia Trejo <ad...@gm...> > >> I don't know which version you have, but the last in the sourceforge, the >> file includes/FreightCalculation.inc has the ofender code: >> =========== CODE ================== >> // if there is some details of the address besides the country >> $sql .= " AND ("; >> if ($BrAddCountry != >> $CountriesArray[$_SESSION['CountryOfOperation']]){ >> /* For international shipments empty destination >> (ANY) >> is allowed */ >> $sql = $sql . " destination = '' OR"; >> >> } >> $sql = mb_substr($sql, 0, strrpos($sql,' OR')) . ')'; >> } >> >> $CalcFreightCostResult = DB_query($sql,$db); >> =========== \CODE =============== >> >> I guess a quick solution (but not the definitive) was to replace this >> part >> by: >> // if there is some details of the address besides the >> country >> $sql .= " AND ("; >> $OR=""; >> foreach ($FindCity as $City) { >> $sql = $sql . $OR ." destination LIKE '" . >> ucwords($City) . "%'"; >> $OR= " OR"; >> } >> if ($BrAddCountry != >> $CountriesArray[$_SESSION['CountryOfOperation']]){ >> /* For international shipments empty destination >> (ANY) >> is allowed */ >> $sql = $sql . $OR. " destination = ''"; >> } >> // $sql = mb_substr($sql, 0, strrpos($sql,' OR')) . ')'; >> $sql .=")"; >> } >> >> $CalcFreightCostResult = DB_query($sql,$db); >> ================= /code ============= >> This form avoids the las " OR" in the sql >> >> >> 2013/10/5 Rafael Chacón <raf...@gm...> >> >>> Hi, >>> >>> Someone has an idea of where to look for to correct this problem? >>> >>> >>> on: http://www..../weberp/DeliveryDetails.php?identifier=1380990638 >>> >>> >>> Error de Base de Datos 1064 : >>> You have an error in your SQL syntax; check the manual that corresponds >>> to your MySQL server version for the right syntax to use near ')' at line >>> 10 >>> >>> Fallo de SQL : El SQL que falló fue >>> SELECT shipperid, kgrate * 4 AS kgcost, cubrate * 0 AS cubcost, >>> fixedprice, minimumchg FROM freightcosts WHERE locationfrom = 'CURRI' >>> AND >>> destinationcountry = 'Costa Rica' AND maxkgs > 4 AND maxcub >0 AND ( >>> destination LIKE '400m%' OR destination LIKE 'Oeste%' OR destination >>> LIKE >>> 'Y%' OR destination LIKE '400m%' OR destination LIKE 'Norte%' OR >>> destination LIKE 'Urbanización%' OR destination LIKE 'La%' OR >>> destination >>> LIKE 'Favorita%' OR destination LIKE 'San%' OR destination LIKE 'José,%' >>> OR >>> destination LIKE 'San%' OR destination LIKE 'José,%' OR destination LIKE >>> 'Pavas%' OR destination LIKE '10109%' OR destination = '' OR) >>> >>> Regards, Rafael. >>> >>> >>> ------------------------------------------------------------------------------ >>> October Webinars: Code for Performance >>> Free Intel webinars can help you accelerate application performance. >>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most >>> from >>> the latest Intel processors and coprocessors. See abstracts and register >>> > >>> >>> http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk >>> _______________________________________________ >>> Web-erp-developers mailing list >>> Web...@li... >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >> >> >> -- >> Ing Marcos R Garcia Trejo >> (52) 9991-513412 >> Laboratorio de Ingeniería y Procesos Costeros (LIPC) >> Unidad Académica Sisal, UNAM >> MGa...@ii... >> Tel 52 988 931 1000 >> >> >> ------------------------------------------------------------------------------ >> October Webinars: Code for Performance >> Free Intel webinars can help you accelerate application performance. >> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most >> from >> the latest Intel processors and coprocessors. See abstracts and register >> > >> http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk >> _______________________________________________ >> Web-erp-developers mailing list >> Web...@li... >> https://lists.sourceforge.net/lists/listinfo/web-erp-developers >> >> > -- Ing Marcos R Garcia Trejo (52) 9991-513412 Laboratorio de Ingeniería y Procesos Costeros (LIPC) Unidad Académica Sisal, UNAM MGa...@ii... Tel 52 988 931 1000 |