From: Phil D. <ph...@lo...> - 2013-10-07 22:05:22
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/> <style type="text/css">.mceResizeHandle {position: absolute;border: 1px solid black;background: #FFF;width: 5px;height: 5px;z-index: 10000}.mceResizeHandle:hover {background: #000}img[data-mce-selected] {outline: 1px solid black}img.mceClonedResizable, table.mceClonedResizable {position: absolute;outline: 1px dashed black;opacity: .5;z-index: 10000} </style></head><body style=""> <div> Hi guys, </div> <div>   </div> <div> I think Marcos solution makes sense to me the extra OR on the end looks wrong - so some logic that truncates that. </div> <div>   </div> <div> $sql = mb_substr($sql, 0, strrpos($sql,' OR')) . ')'; </div> <div>   </div> <div> should do it... but I have yet to look into this in detail. </div> <div>   </div> <div> I think what the code was trying to do was to look for all possible destinations in the freight costs table with any part of the city/suburb matching a freight cost record so it was parsing out all components and doing an "OR" on each bit. </div> <div>   </div> <div> Probably not such a helpful response I will try to get into this later on. </div> <div>   </div> <div> Phil </div> <div>   </div> <div> > On October 8, 2013 at 10:47 AM Marcos Garcia Trejo <ad...@gm...> wrote: <br/>> <br/>> Hi again, <br/>> I can't undersand the use of: "$sql = mb_substr($sql, 0, <br/>> strrpos($sql,' OR')) . ')';" in this part of the code, but I guess <br/>> the author want to cut the last "OR " generated and replace it with a <br/>> single ')'. Therefore, my code submitted works for this purpose, but <br/>> avoindig this code from the beginning. <br/>> If my observation is correct, I suggest that this "quick solution" <br/>> replaces the previous one. <br/>> <br/>> Saludos cordiales. (greetings!) <br/>> <br/>> 2013/10/7, Rafael Chacón <raf...@gm...>: <br/>> > Tim Schofield and Ing Marcos R Garcia Trejo: <br/>> > <br/>> > Thanks for your help. <br/>> > <br/>> > <br/>> > Web-erp-developers mailing list: <br/>> > <br/>> > Now, I use webERP version 4.11.0; I updated to it last week-end. Previous <br/>> > version was 4.10.0 and no similar problem was observed. My results: <br/>> > <br/>> > 1. Yes, "$sql = mb_substr($sql, 0, strrpos($sql,' OR')) . ')';" is the line <br/>> > 64 of includes/FreightCalculation.inc. <br/>> > <br/>> > 2. I added in table "freightcosts" a line with kgrate=0 for shipper "N/A" <br/>> > ("do not apply shipper"), and I got the same problem. <br/>> > <br/>> > 3. I tried to "Place Order" (.../weberp/DeliveryDetails.php) for <br/>> > "Service/Labour" items, and I got the same problem. <br/>> > <br/>> > 4. I tried to "Place Order" (.../weberp/DeliveryDetails.php) for <br/>> > "Service/Labour" items with Marcos Garcia Trejos' quick solution (but not <br/>> > the definitive), and I got SUCCESS Report : Order Number 113 has been <br/>> > entered. <br/>> > <br/>> > 5. I tried to "Place Order" (.../weberp/DeliveryDetails.php) for <br/>> > "Manufactured" and "Purchased" items with Marcos Garcia Trejos' quick <br/>> > solution (but not the definitive), and I got SUCCESS Report : Order Number <br/>> > 114 has been entered. <br/>> > <br/>> > Regards, <br/>> > <br/>> > Rafael Chacón <br/>> > Verdorama <br/>> > <br/>> > <br/>> > 2013/10/5 Marcos Garcia Trejo <ad...@gm...> <br/>> > <br/>> >> I don't know which version you have, but the last in the sourceforge, the <br/>> >> file includes/FreightCalculation.inc has the ofender code: <br/>> >> =========== CODE ================== <br/>> >> // if there is some details of the address besides the country <br/>> >> $sql .= " AND ("; <br/>> >> if ($BrAddCountry != <br/>> >> $CountriesArray[$_SESSION['CountryOfOperation']]){ <br/>> >> /* For international shipments empty destination <br/>> >> (ANY) <br/>> >> is allowed */ <br/>> >> $sql = $sql . " destination = '' OR"; <br/>> >> <br/>> >> } <br/>> >> $sql = mb_substr($sql, 0, strrpos($sql,' OR')) . ')'; <br/>> >> } <br/>> >> <br/>> >> $CalcFreightCostResult = DB_query($sql,$db); <br/>> >> =========== \CODE =============== <br/>> >> <br/>> >> I guess a quick solution (but not the definitive) was to replace this <br/>> >> part <br/>> >> by: <br/>> >> // if there is some details of the address besides the <br/>> >> country <br/>> >> $sql .= " AND ("; <br/>> >> $OR=""; <br/>> >> foreach ($FindCity as $City) { <br/>> >> $sql = $sql . $OR ." destination LIKE '" . <br/>> >> ucwords($City) . "%'"; <br/>> >> $OR= " OR"; <br/>> >> } <br/>> >> if ($BrAddCountry != <br/>> >> $CountriesArray[$_SESSION['CountryOfOperation']]){ <br/>> >> /* For international shipments empty destination <br/>> >> (ANY) <br/>> >> is allowed */ <br/>> >> $sql = $sql . $OR. " destination = ''"; <br/>> >> } <br/>> >> // $sql = mb_substr($sql, 0, strrpos($sql,' OR')) . ')'; <br/>> >> $sql .=")"; <br/>> >> } <br/>> >> <br/>> >> $CalcFreightCostResult = DB_query($sql,$db); <br/>> >> ================= /code ============= <br/>> >> This form avoids the las " OR" in the sql <br/>> >> <br/>> >> <br/>> >> 2013/10/5 Rafael Chacón <raf...@gm...> <br/>> >> <br/>> >>> Hi, <br/>> >>> <br/>> >>> Someone has an idea of where to look for to correct this problem? <br/>> >>> <br/>> >>> <br/>> >>> on: http://www..../weberp/DeliveryDetails.php?identifier=1380990638 <br/>> >>> <br/>> >>> <br/>> >>> Error de Base de Datos 1064 : <br/>> >>> You have an error in your SQL syntax; check the manual that corresponds <br/>> >>> to your MySQL server version for the right syntax to use near ')' at line <br/>> >>> 10 <br/>> >>> <br/>> >>> Fallo de SQL : El SQL que falló fue <br/>> >>> SELECT shipperid, kgrate * 4 AS kgcost, cubrate * 0 AS cubcost, <br/>> >>> fixedprice, minimumchg FROM freightcosts WHERE locationfrom = 'CURRI' <br/>> >>> AND <br/>> >>> destinationcountry = 'Costa Rica' AND maxkgs > 4 AND maxcub >0 AND ( <br/>> >>> destination LIKE '400m%' OR destination LIKE 'Oeste%' OR destination <br/>> >>> LIKE <br/>> >>> 'Y%' OR destination LIKE '400m%' OR destination LIKE 'Norte%' OR <br/>> >>> destination LIKE 'Urbanización%' OR destination LIKE 'La%' OR <br/>> >>> destination <br/>> >>> LIKE 'Favorita%' OR destination LIKE 'San%' OR destination LIKE 'José,%' <br/>> >>> OR <br/>> >>> destination LIKE 'San%' OR destination LIKE 'José,%' OR destination LIKE <br/>> >>> 'Pavas%' OR destination LIKE '10109%' OR destination = '' OR) <br/>> >>> <br/>> >>> Regards, Rafael. <br/>> >>> <br/>> >>> <br/>> >>> ------------------------------------------------------------------------------ <br/>> >>> October Webinars: Code for Performance <br/>> >>> Free Intel webinars can help you accelerate application performance. <br/>> >>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most <br/>> >>> from <br/>> >>> the latest Intel processors and coprocessors. See abstracts and register <br/>> >>> > <br/>> >>> <br/>> >>> http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk <br/>> >>> _______________________________________________ <br/>> >>> Web-erp-developers mailing list <br/>> >>> Web...@li... <br/>> >>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers <br/>> >>> <br/>> >>> <br/>> >> <br/>> >> <br/>> >> -- <br/>> >> Ing Marcos R Garcia Trejo <br/>> >> (52) 9991-513412 <br/>> >> Laboratorio de Ingeniería y Procesos Costeros (LIPC) <br/>> >> Unidad Académica Sisal, UNAM <br/>> >> MGa...@ii... <br/>> >> Tel 52 988 931 1000 <br/>> >> <br/>> >> <br/>> >> ------------------------------------------------------------------------------ <br/>> >> October Webinars: Code for Performance <br/>> >> Free Intel webinars can help you accelerate application performance. <br/>> >> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most <br/>> >> from <br/>> >> the latest Intel processors and coprocessors. See abstracts and register <br/>> >> > <br/>> >> http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk <br/>> >> _______________________________________________ <br/>> >> Web-erp-developers mailing list <br/>> >> Web...@li... <br/>> >> https://lists.sourceforge.net/lists/listinfo/web-erp-developers <br/>> >> <br/>> >> <br/>> > <br/>> <br/>> <br/>> -- <br/>> Ing Marcos R Garcia Trejo <br/>> (52) 9991-513412 <br/>> Laboratorio de Ingeniería y Procesos Costeros (LIPC) <br/>> Unidad Académica Sisal, UNAM <br/>> MGa...@ii... <br/>> Tel 52 988 931 1000 <br/>> <br/>> ------------------------------------------------------------------------------ <br/>> October Webinars: Code for Performance <br/>> Free Intel webinars can help you accelerate application performance. <br/>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from <br/>> the latest Intel processors and coprocessors. See abstracts and register > <br/>> http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk <br/>> _______________________________________________ <br/>> Web-erp-developers mailing list <br/>> Web...@li... <br/>> https://lists.sourceforge.net/lists/listinfo/web-erp-developers </div> <div id="ox-signature"> Phil <br/> <br/>Ph: +64 (0)275 567890 <br/>Skype: daintree <br/>http://www.logicworks.co.nz </div> </body></html> |