Author: jleroux
Date: Sat Feb 23 05:59:27 2008 New Revision: 630437 URL: http://svn.apache.org/viewvc?rev=630437&view=rev Log: A slightly modified (i10n) patch from Chris Lombardi "POS: All payment types allow change to be made" (https://issues.apache.org/jira/browse/OFBIZ-1663) - OFBIZ-1663 Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.xml ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderUiLabels.xml?rev=630437&r1=630436&r2=630437&view=diff ============================================================================== --- ofbiz/trunk/applications/order/config/OrderUiLabels.xml (original) +++ ofbiz/trunk/applications/order/config/OrderUiLabels.xml Sat Feb 23 05:59:27 2008 @@ -11300,6 +11300,10 @@ <value xml:lang="zh_CN">请æå®åè´§åæ¥æä½ä¸ºæ¥æ</value> <value xml:lang="zh">请æåºææ©éè´§æ¥æã</value> </property> + <property key="checkhelper.change_returned_cannot_be_greater_than_cash"> + <value xml:lang="en">The change returned cannot be greater than the cash given.</value> + <value xml:lang="fr">La monnaie rendue ne peut être supérieure au paiement.</value> + </property> <property key="checkhelper.specify_if_shipBeforeDate_is_date"> <value xml:lang="de">Bitte geben Sie 'Auslieferung vor Datum' als Datum an.</value> <value xml:lang="en">Please specify a ship before date as a date.</value> 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=630437&r1=630436&r2=630437&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 Sat Feb 23 05:59:27 2008 @@ -1516,7 +1516,23 @@ errMsg = UtilProperties.getMessage(resource, "checkevents.payment_not_cover_this_order", (cart != null ? cart.getLocale() : Locale.getDefault())); return ServiceUtil.returnError(errMsg); } - + if (paymentMethods != null && paymentMethods.size() > 0 && requiredAmount < selectedPaymentTotal) { + double changeAmount = selectedPaymentTotal - requiredAmount; + if (!paymentTypes.contains("CASH")){ + Debug.logError("Change Amount : " + changeAmount + " / No cash.", module); + errMsg = UtilProperties.getMessage(resource, "checkhelper.change_returned_cannot_be_greater_than_cash", (cart != null ? cart.getLocale() : Locale.getDefault())); + return ServiceUtil.returnError(errMsg); + }else{ + int cashIndex = paymentTypes.indexOf("CASH"); + String cashId = (String) paymentTypes.get(cashIndex); + double cashAmount = cart.getPaymentAmount(cashId); + if (cashAmount < changeAmount){ + Debug.logError("Change Amount : " + changeAmount + " / Cash Amount : " + cashAmount, module); + errMsg = UtilProperties.getMessage(resource, "checkhelper.change_returned_cannot_be_greater_than_cash", (cart != null ? cart.getLocale() : Locale.getDefault())); + return ServiceUtil.returnError(errMsg); + } + } + } return ServiceUtil.returnSuccess(); } |
Free forum by Nabble | Edit this page |