Thanks Marco,
As you suggested, I backported at r767457.
Jacques
From: <mrisal...@apache.org>
Author: mrisaliti
Date: Tue Apr 21 20:08:05 2009
New Revision: 767279
URL: http://svn.apache.org/viewvc?rev=767279&view=rev
Log:
Support of BigDecimal to WebPos (OFBIZ-2313)
Modified:
ofbiz/trunk/specialpurpose/webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml
ofbiz/trunk/specialpurpose/webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml
ofbiz/trunk/specialpurpose/webpos/servicedef/services_manager.xml
ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/actions/cart/MicroCart.groovy
Modified:
ofbiz/trunk/specialpurpose/webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml?rev=767279&r1=767278&r2=767279&view=diff
==============================================================================
---
ofbiz/trunk/specialpurpose/webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml
(original)
+++
ofbiz/trunk/specialpurpose/webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml
Tue Apr 21 20:08:05 2009
@@ -362,10 +362,10 @@
</call-class-method>
<if-compare field="isDouble" operator="equals" value="true">
<set from-field="parameters.sku" field="sku" type="String"/>
- <set from-field="parameters.price" field="price"
type="Double"/>
+ <set from-field="parameters.price" field="price"
type="BigDecimal"/>
<call-object-method obj-field="webPosTransaction"
method-name="modifyPrice">
<field field="sku" type="String"/>
- <field field="price" type="double"/>
+ <field field="price" type="BigDecimal"/>
</call-object-method>
<check-errors/>
<call-object-method obj-field="webPosTransaction"
method-name="calcTax"/>
Modified:
ofbiz/trunk/specialpurpose/webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml?rev=767279&r1=767278&r2=767279&view=diff
==============================================================================
---
ofbiz/trunk/specialpurpose/webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml
(original)
+++
ofbiz/trunk/specialpurpose/webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml
Tue Apr 21 20:08:05 2009
@@ -56,7 +56,7 @@
<set field="authCode" value=""/>
<call-object-method obj-field="webPosTransaction"
method-name="addPayment">
<field field="paymentType" type="String"/>
- <field field="amount" type="double"/>
+ <field field="amount" type="BigDecimal"/>
<field field="refNum" type="String"/>
<field field="authCode" type="String"/>
</call-object-method>
@@ -329,7 +329,7 @@
<if-not-empty field="paymentId">
<call-object-method obj-field="webPosTransaction"
method-name="addPayment">
<field field="paymentId" type="String"/>
- <field field="amount" type="double"/>
+ <field field="amount"
type="BigDecimal"/>
</call-object-method>
<check-errors/>
<if-not-empty field="parameters.track2">
Modified: ofbiz/trunk/specialpurpose/webpos/servicedef/services_manager.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/webpos/servicedef/services_manager.xml?rev=767279&r1=767278&r2=767279&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/webpos/servicedef/services_manager.xml (original)
+++ ofbiz/trunk/specialpurpose/webpos/servicedef/services_manager.xml Tue Apr
21 20:08:05 2009
@@ -25,17 +25,17 @@
<service name="openTerminal" engine="simple" auth="false"
location="component://webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml"
invoke="openTerminal">
<description>Open Terminal</description>
- <attribute name="startingDrawerAmount" type="Double" mode="IN"
optional="false"/>
+ <attribute name="startingDrawerAmount" type="BigDecimal" mode="IN"
optional="false"/>
</service>
<service name="closeTerminal" engine="simple" auth="false"
location="component://webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml"
invoke="closeTerminal">
<description>Close Terminal</description>
- <attribute name="endingDrawerCashAmount" type="Double" mode="IN"
optional="false"/>
- <attribute name="endingDrawerCheckAmount" type="Double" mode="IN"
optional="false"/>
- <attribute name="endingDrawerCcAmount" type="Double" mode="IN"
optional="false"/>
- <attribute name="endingDrawerGcAmount" type="Double" mode="IN"
optional="false"/>
- <attribute name="endingDrawerOtherAmount" type="Double" mode="IN"
optional="false"/>
+ <attribute name="endingDrawerCashAmount" type="BigDecimal" mode="IN"
optional="false"/>
+ <attribute name="endingDrawerCheckAmount" type="BigDecimal" mode="IN"
optional="false"/>
+ <attribute name="endingDrawerCcAmount" type="BigDecimal" mode="IN"
optional="false"/>
+ <attribute name="endingDrawerGcAmount" type="BigDecimal" mode="IN"
optional="false"/>
+ <attribute name="endingDrawerOtherAmount" type="BigDecimal" mode="IN"
optional="false"/>
</service>
<service name="voidOrder" engine="simple" auth="false"
@@ -53,7 +53,7 @@
location="component://webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml"
invoke="paidOutAndIn">
<description>Paid Out and In</description>
<attribute name="type" type="String" mode="IN"
optional="false"/>
- <attribute name="amountInOut" type="Double" mode="IN"
optional="false"/>
+ <attribute name="amountInOut" type="BigDecimal" mode="IN"
optional="false"/>
<attribute name="reasonInOut" type="String" mode="IN"
optional="false"/>
<attribute name="reasonCommentInOut" type="String" mode="IN"
optional="false"/>
</service>
@@ -62,6 +62,6 @@
location="component://webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml"
invoke="modifyPrice">
<description>Modify Price</description>
<attribute name="sku" type="String" mode="IN" optional="false"/>
- <attribute name="price" type="Double" mode="IN" optional="false"/>
+ <attribute name="price" type="BigDecimal" mode="IN" optional="false"/>
</service>
</services>
\ No newline at end of file
Modified:
ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/actions/cart/MicroCart.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/actions/cart/MicroCart.groovy?rev=767279&r1=767278&r2=767279&view=diff
==============================================================================
---
ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/actions/cart/MicroCart.groovy
(original)
+++
ofbiz/trunk/specialpurpose/webpos/webapp/webpos/WEB-INF/actions/cart/MicroCart.groovy
Tue Apr 21 20:08:05 2009
@@ -36,10 +36,10 @@
shoppingCart = null;
}
-context.cashAmount = 0;
-context.checkAmount = 0;
-context.giftAmount = 0;
-context.creditAmount = 0;
+context.cashAmount = BigDecimal.ZERO;
+context.checkAmount = BigDecimal.ZERO;
+context.giftAmount = BigDecimal.ZERO;
+context.creditAmount = BigDecimal.ZERO;
// Get the Cart and Prepare Size
if (shoppingCart) {
@@ -48,21 +48,21 @@
for (i = 0; i < payments; i++) {
paymentInfo = shoppingCart.getPaymentInfo(i);
if (paymentInfo.amount != null) {
- amount = paymentInfo.amount.doubleValue();
+ amount = paymentInfo.amount;
if (paymentInfo.paymentMethodTypeId != null) {
if ("CASH".equals(paymentInfo.paymentMethodTypeId)) {
- context.cashAmount = (context.cashAmount) ?
context.cashAmount + amount : amount;
+ context.cashAmount = new
BigDecimal((context.cashAmount).add(amount));
}
else if
("PERSONAL_CHECK".equals(paymentInfo.paymentMethodTypeId)) {
- context.checkAmount = (context.checkAmount) ?
context.checkAmount + amount : amount;
+ context.checkAmount = new
BigDecimal((context.checkAmount).add(amount));
requestParameters.refNumCheck = paymentInfo.refNum[0];
}
else if ("GIFT_CARD".equals(paymentInfo.paymentMethodTypeId)) {
- context.giftAmount = (context.giftAmount) ?
context.giftAmount + amount : amount;
+ context.giftAmount = new
BigDecimal((context.giftAmount).add(amount));
requestParameters.refNumGift = paymentInfo.refNum[0];
}
else if ("CREDIT_CARD".equals(paymentInfo.paymentMethodTypeId))
{
- context.creditAmount = (context.creditAmount) ?
context.creditAmount + amount : amount;
+ context.creditAmount = new
BigDecimal((context.creditAmount).add(amount));
requestParameters.refNumCredit = paymentInfo.refNum[0];
print("paymentInfo "+paymentInfo);
}