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 |