svn commit: r545590 - in /ofbiz/trunk/applications/accounting: src/org/ofbiz/accounting/invoice/InvoiceServices.java webapp/accounting/invoice/InvoiceForms.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r545590 - in /ofbiz/trunk/applications/accounting: src/org/ofbiz/accounting/invoice/InvoiceServices.java webapp/accounting/invoice/InvoiceForms.xml

jacopoc
Author: jacopoc
Date: Fri Jun  8 11:47:45 2007
New Revision: 545590

URL: http://svn.apache.org/viewvc?view=rev&rev=545590
Log:
Fixed code that was using InvoiceItem.uomId as the currency for the amount field instead of the uom for the quantity field.

Modified:
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
    ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?view=diff&rev=545590&r1=545589&r2=545590
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Fri Jun  8 11:47:45 2007
@@ -2439,9 +2439,7 @@
                 if (invoiceItem == null) {
                     errorMessageList.add(UtilProperties.getMessage(resource,"AccountingInvoiceItemNotFound",UtilMisc.toMap("invoiceId",invoiceId,"invoiceItemSeqId",invoiceItemSeqId),locale));
                 } else {
-                    if (invoiceItem.get("uomId") != null && payment.get("currencyUomId") != null && !invoiceItem.getString("uomId").equals(payment.getString("currencyUomId"))) {
-                        errorMessageList.add(UtilProperties.getMessage(resource,"AccountingInvoiceItemPaymentCurrencyProblem",UtilMisc.toMap("paymentCurrencyId",payment.getString("currencyUomId"),"itemCurrency",invoiceItem.getString("uomId")) ,locale));
-                    } else if (invoice.get("currencyUomId") != null && payment.get("currencyUomId") != null && !invoice.getString("currencyUomId").equals(payment.getString("currencyUomId"))) {
+                    if (invoice.get("currencyUomId") != null && payment.get("currencyUomId") != null && !invoice.getString("currencyUomId").equals(payment.getString("currencyUomId"))) {
                         errorMessageList.add(UtilProperties.getMessage(resource,"AccountingInvoicePaymentCurrencyProblem",UtilMisc.toMap("paymentCurrencyId",payment.getString("currencyUomId"),"itemCurrency",invoice.getString("currencyUomId")) ,locale));
                     }
                     
@@ -2458,13 +2456,7 @@
                     if (paymentApplicationId == null && amountApplied.compareTo(invoiceItemApplyAvailable) > 0) {
                         // new record
                         errorMessageList.add("Invoice(" + invoiceId + ") item(" + invoiceItemSeqId + ") has  " + invoiceItemApplyAvailable + " to apply but " + amountApplied + " is requested\n");
-                        String uomId = null;
-                        if (invoiceItem.getString("uomId") != null) {
-                            uomId = invoiceItem.getString("uomId");
-                        }
-                        else {
-                            uomId = invoice.getString("currencyUomId");
-                        }
+                        String uomId = invoice.getString("currencyUomId");
                         errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceItemLessRequested",
                                 UtilMisc.toMap("invoiceId",invoiceId, "invoiceItemSeqId", invoiceItemSeqId,
                                             "invoiceItemApplyAvailable",invoiceItemApplyAvailable,
@@ -2782,9 +2774,7 @@
 
                         // create application payment record but check currency
                         // first if supplied
-                        if (invoiceItem.get("uomId") != null && payment.get("currencyUomId") != null && !invoiceItem.getString("uomId").equals(payment.getString("currencyUomId"))) {
-                            errorMessageList.add("Payment currency (" + payment.getString("currencyUomId") + ") and invoice Item(" + invoiceItem.getString("invoiceItemSeqId") + ") currency(" + invoiceItem.getString("uomId") + ") not the same\n");
-                        } else if (invoice.get("currencyUomId") != null && payment.get("currencyUomId") != null && !invoice.getString("currencyUomId").equals( payment.getString("currencyUomId"))) {
+                        if (invoice.get("currencyUomId") != null && payment.get("currencyUomId") != null && !invoice.getString("currencyUomId").equals( payment.getString("currencyUomId"))) {
                             errorMessageList.add("Payment currency (" + payment.getString("currencyUomId") + ") and invoice currency(" + invoice.getString("currencyUomId") + ") not the same\n");
                         } else {
                             paymentApplication.set("paymentApplicationId", null);

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml?view=diff&rev=545590&r1=545589&r2=545590
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml Fri Jun  8 11:47:45 2007
@@ -132,14 +132,10 @@
         <field name="invoiceItemTypeId"><display-entity description="${description}" entity-name="InvoiceItemType"/></field>
         <field name="inventoryItemId" widget-area-style="align-text"><display/></field>
         <field name="quantity" widget-area-style="align-text"><display/></field>
-        <field name="amount" widget-area-style="align-text" use-when="uomId!=null"><display type="currency" currency="${uomId}"/></field>
-        <field name="amount" widget-area-style="align-text" use-when="uomId==null"><display type="currency" currency="${invoice.currencyUomId}"/></field>
-        <field name="total" use-when="uomId!=null"><display type="currency" currency="${uomId}"/></field>  <!-- this should not look like something you can modify, hence "tabletext" -->
-        <field name="total" use-when="uomId==null"><display type="currency" currency="${invoice.currencyUomId}"/></field>  <!-- this should not look like something you can modify, hence "tabletext" -->
+        <field name="amount" title="${uiLabelMap.AccountingUnitPrice}" widget-area-style="align-text"><display type="currency" currency="${invoice.currencyUomId}"/></field>
+        <field name="total"><display type="currency" currency="${invoice.currencyUomId}"/></field>
         <field name="productId" widget-style="linktext"><hyperlink target="/catalog/control/EditProduct?productId=${productId}" target-type="inter-app" description="${productId}"/></field>
         <field name="overrideGlAccountId" widget-area-style="align-text"><hyperlink target="GlAccountNavigate?glAccountId=${overrideGlAccountId}" description="${overrideGlAccountId}"/></field>
-        <field name="overrideGlAccountId"><hidden/></field>
-        <field name="uomId"><hidden/></field>
     </form>
     
     <form name="invoiceRoles" type="list" use-row-submit="true" title="" list-name="invoiceRoles" paginate-target="invoiceRoles">
@@ -287,9 +283,8 @@
        <field name="productId"><lookup target-form-name="LookupProduct" size="20"/></field>
        <field name="description"><text size="30"/></field>
        <!--field name="overrideGlAccountId"><text size="10"/></field-->
-       <field name="amount"><text size="7"/></field>
-       <field name="total" widget-area-style="align-text" use-when="uomId!=null"><display type="currency" currency="${uomId}"/></field>  <!-- this should not look like something you can modify, hence "tabletext" -->
-       <field name="total" widget-area-style="align-text" use-when="uomId==null"><display type="currency" currency="${invoice.currencyUomId}"/></field>  <!-- this should not look like something you can modify, hence "tabletext" -->
+       <field name="amount" title="${uiLabelMap.AccountingUnitPrice}"><text size="7"/></field>
+       <field name="total" widget-area-style="align-text"><display type="currency" currency="${invoice.currencyUomId}"/></field>  <!-- this should not look like something you can modify, hence "tabletext" -->
        <field name="uomId"><hidden/></field>
        <field name="taxableFlag"><hidden/></field>
        <field name="updateButton" title="${uiLabelMap.CommonUpdate}" widget-style="buttontext" ><submit button-type="text-link"/></field>
@@ -317,14 +312,14 @@
             <lookup target-form-name="LookupProductFeature"/>
         </field>
         <field position="1" name="quantity"><text size="10"/></field>
-        <field position="2" name="uomId"><!-- currency -->
-            <drop-down allow-empty="true" current="selected" no-current-selected-key="${invoice.currencyUomId}">
+        <field position="2" name="uomId">
+            <drop-down allow-empty="true">
                 <entity-options key-field-name="uomId" description="${abbreviation} - ${description}" entity-name="Uom">
                     <entity-order-by field-name="description"/>
                 </entity-options>            
             </drop-down>
         </field>
-        <field position="1" name="amount"><text size="10"/></field>
+        <field position="1" name="amount" title="${uiLabelMap.AccountingUnitPrice}"><text size="10"/></field>
         <field position="2" name="taxableFlag">
         <drop-down allow-empty="false" current="selected">
             <option key="Y" description="Yes"/>
@@ -351,8 +346,7 @@
         <field name="invoiceItemSeqId"><display/></field>
         <field name="productId"><display/></field>
         <field name="description"><display/></field>
-        <field name="total" use-when="uomId!=null"><display type="currency" currency="${uomId}"/></field>
-        <field name="total" use-when="uomId==null"><display type="currency" currency="${invoice.currencyUomId}"/></field>
+        <field name="total"><display type="currency" currency="${invoice.currencyUomId}"/></field>
         <field name="invoiceId"><hidden/></field>
         <field name="paymentId"><lookup target-form-name="LookupPayment"/></field>
         <field name="billingAccountId"><hidden/></field>