Author: jleroux Date: Fri Oct 18 21:14:31 2013 New Revision: 1533636 URL: http://svn.apache.org/r1533636 Log: "Applied fix from trunk for revision: 1524950" ------------------------------------------------------------------------ r1524950 | jleroux | 2013-09-20 10:52:08 +0200 (ven. 20 sept. 2013) | 16 lignes
For "If you clear the last packed item from from a shipment with two items and then complete the pack, you get the exception below" https://issues.apache.org/jira/browse/OFBIZ-5308 If you clear the last packed item from from a shipment with two items and then complete the pack, you get the exception below: Exception thrown while creating the "newEntity" ....ShipmentPackageContent ... Key ... is not present in table shipment_package This is happening because org.ofbiz.shipment.packing.PackingSession.clearLine() around line 600 is decrementing packageSeq from 1 to zero. This causes createPackages() to not generate any ShipmentPackages because of the for statement on packageSeq and therefore the subsequent exception. I fixed this by just commenting out the block starting with "if(line.packageSeq ==". I did not submit a patch because I do not fully understand the logic and do not have time now to learn it now. Hopefully the author will be better equipped to deal with it properly. Skip jleroux: the path's author (https://issues.apache.org/jira/browse/OFBIZ-2163) Karim Rahimpur did not answer. But by analogy with clearAllLines I decided that packageSeq should not be less than 1! ------------------------------------------------------------------------ Modified: ofbiz/branches/release12.04/ (props changed) ofbiz/branches/release12.04/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java Propchange: ofbiz/branches/release12.04/ ------------------------------------------------------------------------------ Merged /ofbiz/trunk:r1524950 Modified: ofbiz/branches/release12.04/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=1533636&r1=1533635&r2=1533636&view=diff ============================================================================== --- ofbiz/branches/release12.04/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java (original) +++ ofbiz/branches/release12.04/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java Fri Oct 18 21:14:31 2013 @@ -590,7 +590,7 @@ public class PackingSession implements j } this.packageWeights.put(line.packageSeq, packageWeight); } - if (line.packageSeq == packageSeq) { + if (line.packageSeq == packageSeq && packageSeq > 1) { packageSeq--; } }

