Author: nmalin
Date: Thu Jan 15 00:37:06 2015
New Revision: 1651912

URL: http://svn.apache.org/r1651912
Log:
Convert old simple CRUD service on BillingAccount to entity-auto (OFBIZ-5963).
Clean service definition with using auto-fields-entity and clean 
editBillingAccount screen :
    display correctly the customer billing party
    hidden billingAccountId and contactMechId on create process
    add new service createBillingAccountAndRole (the screen present the partyId 
field but didn't propage the value on billingAccountRole)

Removed:
    
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/BillingServices.xml
Modified:
    ofbiz/trunk/applications/accounting/servicedef/services_billing.xml
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
    ofbiz/trunk/applications/accounting/widget/BillingAccountForms.xml
    ofbiz/trunk/applications/accounting/widget/BillingAccountScreens.xml

Modified: ofbiz/trunk/applications/accounting/servicedef/services_billing.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_billing.xml?rev=1651912&r1=1651911&r2=1651912&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_billing.xml 
(original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_billing.xml Thu Jan 
15 00:37:06 2015
@@ -25,83 +25,63 @@ under the License.
     <version>1.0</version>
 
     <!-- Billing Account Services -->
-    <service name="createBillingAccount" engine="simple"
-            
location="component://accounting/script/org/ofbiz/accounting/payment/BillingServices.xml"
 invoke="createBillingAccount">
+    <service name="createBillingAccount" default-entity-name="BillingAccount" 
engine="entity-auto" invoke="create" auth="true">
         <description>Create a Billing Account</description>
         <permission-service service-name="acctgBillingAcctCheck" 
main-action="CREATE"/>
-        <attribute name="accountLimit" type="BigDecimal" mode="IN" 
optional="true"/>
-        <attribute name="accountCurrencyUomId" type="String" mode="IN" 
optional="true"/>
-        <attribute name="description" type="String" mode="IN" optional="true"/>
-        <attribute name="contactMechId" type="String" mode="IN" 
optional="true"/>
-        <attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/>
-        <attribute name="thruDate" type="Timestamp" mode="IN" optional="true"/>
-        <attribute name="roleTypeId" type="String" mode="IN" optional="true"/>
-        <attribute name="partyId" type="String" mode="IN" optional="true"/>
-        <attribute name="billingAccountId" type="String" mode="OUT" 
optional="false"/>
+        <auto-attributes include="pk" mode="OUT" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
     </service>
-    <service name="updateBillingAccount" engine="simple"
-            
location="component://accounting/script/org/ofbiz/accounting/payment/BillingServices.xml"
 invoke="updateBillingAccount">
+    <service name="updateBillingAccount" default-entity-name="BillingAccount" 
engine="entity-auto" invoke="update" auth="true">
         <description>Update a Billing Account</description>
         <permission-service service-name="acctgBillingAcctCheck" 
main-action="UPDATE"/>
-        <attribute name="billingAccountId" type="String" mode="IN" 
optional="false"/>
-        <attribute name="accountLimit" type="BigDecimal" mode="IN" 
optional="true"/>
-        <attribute name="accountCurrencyUomId" type="String" mode="IN" 
optional="true"/>
-        <attribute name="description" type="String" mode="IN" optional="true"/>
-        <attribute name="contactMechId" type="String" mode="IN" 
optional="true"/>
-        <attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/>
-        <attribute name="thruDate" type="Timestamp" mode="IN" optional="true"/>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
     </service>
-    <service name="createBillingAccountRole" engine="simple"
-            
location="component://accounting/script/org/ofbiz/accounting/payment/BillingServices.xml"
 invoke="createBillingAccountRole">
+    <service name="createBillingAccountRole" 
default-entity-name="BillingAccountRole" engine="entity-auto" invoke="create" 
auth="true">
         <description>Create a Billing Account Role</description>
         <permission-service service-name="acctgBillingAcctCheck" 
main-action="CREATE"/>
-        <attribute name="billingAccountId" type="String" mode="IN" 
optional="false"/>
-        <attribute name="partyId" type="String" mode="IN" optional="false"/>
-        <attribute name="roleTypeId" type="String" mode="IN" optional="false"/>
-        <attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/>
-        <attribute name="thruDate" type="Timestamp" mode="IN" optional="true"/>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+        <override name="fromDate" optional="true"/>
     </service>
-    <service name="updateBillingAccountRole" engine="simple"
-            
location="component://accounting/script/org/ofbiz/accounting/payment/BillingServices.xml"
 invoke="updateBillingAccountRole">
+    <service name="updateBillingAccountRole" 
default-entity-name="BillingAccountRole" engine="entity-auto" invoke="update" 
auth="true">
         <description>Update a Billing Account Role</description>
         <permission-service service-name="acctgBillingAcctCheck" 
main-action="UPDATE"/>
-        <attribute name="billingAccountId" type="String" mode="IN" 
optional="false"/>
-        <attribute name="partyId" type="String" mode="IN" optional="false"/>
-        <attribute name="roleTypeId" type="String" mode="IN" optional="false"/>
-        <attribute name="fromDate" type="Timestamp" mode="IN" 
optional="false"/>
-        <attribute name="thruDate" type="Timestamp" mode="IN" 
optional="false"/>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
     </service>
-    <service name="removeBillingAccountRole" engine="simple" 
default-entity-name="BillingAccountRole"
-            
location="component://accounting/script/org/ofbiz/accounting/payment/BillingServices.xml"
 invoke="removeBillingAccountRole">
+    <service name="removeBillingAccountRole" 
default-entity-name="BillingAccountRole" engine="entity-auto" invoke="delete" 
auth="true">
         <description>Remove a Billing Account Role</description>
         <permission-service service-name="acctgBillingAcctCheck" 
main-action="DELETE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
-    <service name="createBillingAccountTerm" engine="simple"
-            
location="component://accounting/script/org/ofbiz/accounting/payment/BillingServices.xml"
 invoke="createBillingAccountTerm">
+    <service name="createBillingAccountAndRole" engine="group" auth="true">
+        <group>
+            <invoke name="createBillingAccount" mode="sync" 
result-to-context="true"/>
+            <invoke name="createBillingAccountRole" mode="sync" 
parameters="optional"/>
+        </group>
+        <override name="billingAccountId" optional="true"/>
+    </service>
+    <service name="createBillingAccountTerm" 
default-entity-name="BillingAccountTerm" engine="entity-auto" invoke="create" 
auth="true">
         <description>Create a Billing Account Term</description>
         <permission-service service-name="acctgBillingAcctCheck" 
main-action="CREATE"/>
-        <attribute name="billingAccountId" type="String" mode="IN" 
optional="false"/>
-        <attribute name="termTypeId" type="String" mode="IN" optional="false"/>
-        <attribute name="termValue" type="BigDecimal" mode="IN" 
optional="false"/>
-        <attribute name="uomId" type="String" mode="IN" optional="true"/>
-        <attribute name="billingAccountTermId" type="String" mode="OUT" 
optional="false"/>
+        <auto-attributes include="pk" mode="OUT" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+        <override name="termTypeId" optional="false"/>
+        <override name="billingAccountId" optional="false"/>
     </service>
-    <service name="updateBillingAccountTerm" engine="simple"
-            
location="component://accounting/script/org/ofbiz/accounting/payment/BillingServices.xml"
 invoke="updateBillingAccountTerm">
+    <service name="updateBillingAccountTerm" 
default-entity-name="BillingAccountTerm" engine="entity-auto" invoke="update" 
auth="true">
         <description>Update a Billing Account Term</description>
         <permission-service service-name="acctgBillingAcctCheck" 
main-action="UPDATE"/>
-        <attribute name="billingAccountTermId" type="String" mode="IN" 
optional="false"/>
-        <attribute name="billingAccountId" type="String" mode="IN" 
optional="true"/>
-        <attribute name="termTypeId" type="String" mode="IN" optional="true"/>
-        <attribute name="termValue" type="BigDecimal" mode="IN" 
optional="true"/>
-        <attribute name="uomId" type="String" mode="IN" optional="true"/>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+        <override name="termTypeId" optional="false"/>
+        <override name="billingAccountId" optional="false"/>
     </service>
-    <service name="removeBillingAccountTerm" engine="simple"
-            
location="component://accounting/script/org/ofbiz/accounting/payment/BillingServices.xml"
 invoke="removeBillingAccountTerm">
+    <service name="removeBillingAccountTerm" 
default-entity-name="BillingAccountTerm" engine="entity-auto" invoke="delete" 
auth="true">
         <description>Remove a Billing Account Term</description>
         <permission-service service-name="acctgBillingAcctCheck" 
main-action="DELETE"/>
-        <attribute name="billingAccountTermId" type="String" mode="IN" 
optional="false"/>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
     <service name="calcBillingAccountBalance" engine="java"
             location="org.ofbiz.accounting.payment.BillingAccountWorker" 
invoke="calcBillingAccountBalance">

Modified: 
ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml?rev=1651912&r1=1651911&r2=1651912&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml 
(original)
+++ 
ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml 
Thu Jan 15 00:37:06 2015
@@ -62,6 +62,12 @@ under the License.
         <response name="success" type="view" value="EditBillingAccount"/>
         <response name="error" type="view" value="EditBillingAccount"/>
     </request-map>
+    <request-map uri="createBillingAccountAndRole">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="createBillingAccountAndRole"/>
+        <response name="success" type="view" value="EditBillingAccount"/>
+        <response name="error" type="view" value="EditBillingAccount"/>
+    </request-map>
     <request-map uri="updateBillingAccount">
         <security https="true" auth="true"/>
         <event type="service" invoke="updateBillingAccount"/>

Modified: ofbiz/trunk/applications/accounting/widget/BillingAccountForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/BillingAccountForms.xml?rev=1651912&r1=1651911&r2=1651912&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/BillingAccountForms.xml 
(original)
+++ ofbiz/trunk/applications/accounting/widget/BillingAccountForms.xml Thu Jan 
15 00:37:06 2015
@@ -28,8 +28,6 @@ under the License.
                 <field-map field-name="inputFields" from-field="parameters"/>
                 <field-map field-name="entityName" value="BillingAccount"/>
                 <field-map field-name="orderBy" value="billingAccountId"/>
-                <field-map field-name="viewIndex" from-field="viewIndex"/>
-                <field-map field-name="viewSize" from-field="viewSize"/>
             </service>
         </actions>
         <field name="billingAccountId" widget-style="buttontext">
@@ -87,10 +85,10 @@ under the License.
             <set field="paidInvoice" value="${groovy: 
org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId).compareTo(java.math.BigDecimal.ZERO)==0}"
 type="Boolean"/>
             <set field="amountToApply" value="${groovy:
                 import java.text.NumberFormat;
-                
return(NumberFormat.getNumberInstance(context.get(&quot;locale&quot;)).format(org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId)));}"/>
+                
return(NumberFormat.getNumberInstance(locale).format(org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId)));}"/>
             <set field="total" value="${groovy:
                 import java.text.NumberFormat;
-                
return(NumberFormat.getNumberInstance(context.get(&quot;locale&quot;)).format(org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId)));}"/>
+                
return(NumberFormat.getNumberInstance(locale).format(org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId)));}"/>
         </row-actions>
         <field name="billingAccountId"><hidden/></field>
         <field name="invoiceId" widget-style="buttontext">
@@ -121,27 +119,23 @@ under the License.
         <actions>
             <set field="availableBalance" value="${groovy:billingAccount != 
null ? 
org.ofbiz.order.order.OrderReadHelper.getBillingAccountBalance(billingAccount) 
: 0}" type="BigDecimal"/>
         </actions>
-        <alt-target use-when="billingAccount==null" 
target="createBillingAccount"/>
+        <alt-target use-when="billingAccount==null" 
target="createBillingAccountAndRole"/>
         <auto-fields-service service-name="updateBillingAccount" 
map-name="billingAccount"/>
-
         <field name="description"><text size="60"/></field>
-
+        <field use-when="billingAccount==null" 
name="billingAccountId"><hidden/></field>
         <field use-when="billingAccount!=null" name="billingAccountId" 
tooltip="${uiLabelMap.CommonNotModifRecreat}"><display/></field>
-
-        <field use-when="partyId != null" name="partyId"><hidden/></field>
-        <field use-when="roleTypeId != null" 
name="roleTypeId"><hidden/></field>
-        <field name="partyId"  use-when="partyId == null" 
title="${uiLabelMap.AccountingPartyBilledTo}"><lookup 
target-form-name="LookupPartyName"/></field>
-        <field use-when="roleTypeId == null" name="roleTypeId"><hidden 
value="BILL_TO_CUSTOMER"/></field>
-
+        <field name="partyId" use-when="billingAccount != null" 
><display/></field>
+        <field name="partyId" use-when="billingAccount == null" 
title="${uiLabelMap.AccountingPartyBilledTo}" required-field="true"><lookup 
target-form-name="LookupPartyName"/></field>
+        <field name="roleTypeId"><hidden/></field>
         <field name="accountCurrencyUomId">
             <drop-down allow-empty="false" 
no-current-selected-key="${defaultOrganizationPartyCurrencyUomId}">
-                <entity-options key-field-name="uomId" 
description="${description} - ${abbreviation}" entity-name="Uom">
+                <entity-options key-field-name="uomId" 
description="${abbreviation} - ${description}" entity-name="Uom">
                     <entity-constraint name="uomTypeId" operator="equals" 
value="CURRENCY_MEASURE"/>
                     <entity-order-by field-name="description"/>
                 </entity-options>
             </drop-down>
         </field>
-        <field name="contactMechId" 
tooltip="${uiLabelMap.AccountingBillingContactMechIdMessage}">
+        <field name="contactMechId" 
tooltip="${uiLabelMap.AccountingBillingContactMechIdMessage}" 
use-when="billingAccount != null">
             <drop-down>
                 <entity-options entity-name="BillingAccountRoleAndAddress" 
description="[${partyId}][${contactMechId}] ${toName}, ${attnName}, 
${address1}, ${stateProvinceGeoId} ${postalCode}" 
key-field-name="contactMechId" filter-by-date="true">
                     <entity-constraint name="billingAccountId" 
env-name="billingAccountId"/>

Modified: ofbiz/trunk/applications/accounting/widget/BillingAccountScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/BillingAccountScreens.xml?rev=1651912&r1=1651911&r2=1651912&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/BillingAccountScreens.xml 
(original)
+++ ofbiz/trunk/applications/accounting/widget/BillingAccountScreens.xml Thu 
Jan 15 00:37:06 2015
@@ -126,8 +126,12 @@ under the License.
                 <property-to-field field="defaultCurrencyUomId" 
resource="general" property="currency.uom.id.default" default="USD"/>
                 <set field="billingAccountId" 
from-field="parameters.billingAccountId"/>
                 <entity-one entity-name="BillingAccount" 
value-field="billingAccount"/>
-                <set field="partyId" from-field="parameters.partyId"/>
-                <set field="roleTypeId" from-field="parameters.roleTypeId"/>
+                <entity-and entity-name="BillingAccountRole" 
list="billingAccountRolesCustomer" filter-by-date="true">
+                    <field-map field-name="billingAccountId" 
from-field="billingAccount.billingAccountId"/>
+                    <field-map field-name="roleTypeId" 
value="BILL_TO_CUSTOMER"/>
+                </entity-and>
+                <set field="partyId" from-field="parameters.partyId" 
default-value="${billingAccountRolesCustomer[0].partyId}"/>
+                <set field="roleTypeId" from-field="parameters.roleTypeId" 
default-value="BILL_TO_CUSTOMER"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonBillingAccountDecorator" 
location="${parameters.billingAccountDecoratorLocation}">


Reply via email to