Author: jleroux
Date: Tue Apr 8 07:08:28 2008 New Revision: 645932 URL: http://svn.apache.org/viewvc?rev=645932&view=rev Log: A patch from Bilgin Ibryam " Using a check in the POS causes an error in changing status" (https://issues.apache.org/jira/browse/OFBIZ-1706) - OFBIZ-1706 Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=645932&r1=645931&r2=645932&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Tue Apr 8 07:08:28 2008 @@ -1036,19 +1036,33 @@ } } else { // Get the paymentMethodTypeIds - this will need to change when ecom supports multiple payments - List cashCodBaExpr = UtilMisc.toList(new EntityExpr("paymentMethodTypeId", EntityOperator.EQUALS, "CASH"), + List cashCodPcBaExpr = UtilMisc.toList(new EntityExpr("paymentMethodTypeId", EntityOperator.EQUALS, "CASH"), new EntityExpr("paymentMethodTypeId", EntityOperator.EQUALS, "EXT_COD"), + new EntityExpr("paymentMethodTypeId", EntityOperator.EQUALS, "PERSONAL_CHECK"), new EntityExpr("paymentMethodTypeId", EntityOperator.EQUALS, "EXT_BILLACT")); - List cashCodBaPaymentPreferences = EntityUtil.filterByOr(allPaymentPreferences, cashCodBaExpr); + List cashCodPcBaPaymentPreferences = EntityUtil.filterByOr(allPaymentPreferences, cashCodPcBaExpr); - if (UtilValidate.isNotEmpty(cashCodBaPaymentPreferences) && + if (UtilValidate.isNotEmpty(cashCodPcBaPaymentPreferences) && UtilValidate.isNotEmpty(allPaymentPreferences) && - cashCodBaPaymentPreferences.size() == allPaymentPreferences.size()) { - // approve this as long as there are only CASH, COD and Billing Account types - boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold); - if (!ok) { - throw new GeneralException("Problem with order change; see above error"); + cashCodPcBaPaymentPreferences.size() == allPaymentPreferences.size()) { + + //if there are Check type, approve the order only if it is face to face + List checkPareferences = EntityUtil.filterByAnd(cashCodPcBaPaymentPreferences, UtilMisc.toMap("paymentMethodTypeId", "PERSONAL_CHECK")); + if (UtilValidate.isNotEmpty(checkPareferences)) { + if (faceToFace) { + boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold); + if (!ok) { + throw new GeneralException("Problem with order change; see above error"); + } + } + // approve this as long as there are only CASH, COD and Billing Account types + } else { + boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold); + if (!ok) { + throw new GeneralException("Problem with order change; see above error"); + } } + } else { // There is nothing to do, we just treat this as a success } |
Free forum by Nabble | Edit this page |