From: Rafael C. <raf...@gm...> - 2013-10-05 16:44:59
|
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. |
From: Marcos G. T. <ad...@gm...> - 2013-10-05 21:32:27
|
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 |
From: Rafael C. <raf...@gm...> - 2013-10-07 15:05:25
|
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 > > |
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 |
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> |
From: Phil D. <ph...@lo...> - 2013-10-09 06:37:05
|
This is tricky.... I wonder if replacing the line 64 in includes/FreightCalculation.inc with $sql = mb_substr($sql, 0, mb_strrpos($sql,' OR')) . ')'; might do it.. this should lop off the trailing OR and append a closing bracket to the $sql string - we were mixing multi-byte and non-multibyte functions. I don't have data to test this on though so if you could perhaps echo the $sql to see what it is producing Phil Phil Daintree Logic Works Ltd - +64 (0)275 567890 http://www.logicworks.co.nz On 08/10/13 04:05, Rafael Chacón wrote: > 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... > <mailto: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... > <mailto: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... > <mailto: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... <mailto: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... > <mailto:Web...@li...> > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > ------------------------------------------------------------------------------ > 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 |
From: Phil D. <ph...@lo...> - 2013-10-09 07:03:57
|
Hi Marcos, Sorry for delay in looking into this one... strrpos($sql,' OR') finds the right most or last occurence in left to right languages of ' OR' in the $sql string and returns the position as an index starting from 0 as the first character. mb_substr($sql, 0, strrpos($sql,' OR')) this returns the part of $sql from 0 to the point where ' OR' occurs in $sql I think this code should work - but we are mixing multi-byte string functions with the single byte string functions and might be that we should be using the multi-byte function mb_strrpos rather than single byte function strrpos as utf-8 characters are a couple of bytes per character. Phil Phil Daintree Logic Works Ltd - +64 (0)275 567890 http://www.logicworks.co.nz On 08/10/13 10:47, Marcos Garcia Trejo wrote: > 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 >>> >>> > |
From: Ricard A. <pak...@gm...> - 2013-10-11 10:37:53
|
Hi all: It was me who took over with this code, to make it work with the webSHOP. Funny thing, I have revision 6111 working real on my websSHOP and seems to work OK. I will take a look ASAP. Thanks for reporting Regards, Ricard 2013/10/9 Phil Daintree <ph...@lo...> > Hi Marcos, > > Sorry for delay in looking into this one... > > strrpos($sql,' OR') > > finds the right most or last occurence in left to right languages of ' > OR' in the $sql string and returns the position as an index starting > from 0 as the first character. > > mb_substr($sql, 0, strrpos($sql,' OR')) > > this returns the part of $sql from 0 to the point where ' OR' occurs in > $sql > > I think this code should work - but we are mixing multi-byte string > functions with the single byte string functions and might be that we > should be using the multi-byte function mb_strrpos rather than single > byte function strrpos as utf-8 characters are a couple of bytes per > character. > > Phil > > Phil Daintree > Logic Works Ltd - +64 (0)275 567890 > http://www.logicworks.co.nz > > On 08/10/13 10:47, Marcos Garcia Trejo wrote: > > 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 > >>> > >>> > > > > > > ------------------------------------------------------------------------------ > 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=60134071&iu=/4140/ostg.clktrk > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > |