svn commit: r1751543 - in /ofbiz/trunk/applications: accounting/minilang/invoice/InvoiceServices.xml accounting/servicedef/services_invoice.xml accounting/widget/InvoiceForms.xml datamodel/entitydef/accounting-entitymodel.xml

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

svn commit: r1751543 - in /ofbiz/trunk/applications: accounting/minilang/invoice/InvoiceServices.xml accounting/servicedef/services_invoice.xml accounting/widget/InvoiceForms.xml datamodel/entitydef/accounting-entitymodel.xml

nmalin
Author: nmalin
Date: Tue Jul  5 19:32:05 2016
New Revision: 1751543

URL: http://svn.apache.org/viewvc?rev=1751543&view=rev
Log:
Track userLogin on invoice status change, use EntityStatus concept related to issue OFBIZ-7611. Improvement follow by issue OFBIZ-7617. Thanks Nameet Jain for this proposal

Modified:
    ofbiz/trunk/applications/accounting/minilang/invoice/InvoiceServices.xml
    ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
    ofbiz/trunk/applications/accounting/widget/InvoiceForms.xml
    ofbiz/trunk/applications/datamodel/entitydef/accounting-entitymodel.xml

Modified: ofbiz/trunk/applications/accounting/minilang/invoice/InvoiceServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/minilang/invoice/InvoiceServices.xml?rev=1751543&r1=1751542&r2=1751543&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/minilang/invoice/InvoiceServices.xml (original)
+++ ofbiz/trunk/applications/accounting/minilang/invoice/InvoiceServices.xml Tue Jul  5 19:32:05 2016
@@ -179,11 +179,9 @@ under the License.
         <create-value value-field="newEntity"/>
 
         <!-- create new status entry, and set lastStatusUpdate date -->
-        <make-value value-field="newInvoiceStatus" entity-name="InvoiceStatus"/>
-        <set from-field="newEntity.invoiceId" field="newInvoiceStatus.invoiceId"/>
-        <set from-field="newEntity.statusId" field="newInvoiceStatus.statusId"/>
-        <set from-field="nowTimestamp" field="newInvoiceStatus.statusDate"/>
-        <create-value value-field="newInvoiceStatus"/>
+        <set field="createInvoiceStatusMap.invoiceId" from-field="newEntity.invoiceId" />
+        <set field="createInvoiceStatusMap.statusId" from-field="newEntity.statusId" />
+        <call-service service-name="createInvoiceStatus" in-map-name="createInvoiceStatusMap"/>
     </simple-method>
 
     <simple-method method-name="copyInvoice" short-description="Create a new Invoice from an existing invoice">
@@ -403,8 +401,6 @@ under the License.
             <if-compare field="invoice.statusId" operator="equals" value="INVOICE_PAID">
                 <set field="invoiceStatusMap.invoiceId" value="${paymentApplication.invoiceId}"/>
                 <set field="invoiceStatusMap.statusId" value="INVOICE_READY"/>
-                <now-timestamp field="nowTimestamp"/>
-                <set field="invoiceStatusMap.statusDate" from-field="nowTimestamp"/>
                 <call-service service-name="setInvoiceStatus" in-map-name="invoiceStatusMap"/>
             </if-compare>
             <check-errors/>
@@ -512,14 +508,10 @@ under the License.
                 <set from-field="parameters.statusId" field="invoice.statusId"/>
                 <store-value value-field="invoice"/>
 
-                <make-value value-field="newEntity" entity-name="InvoiceStatus"/>
-                <set-nonpk-fields map="parameters" value-field="newEntity"/>
-                <set-pk-fields map="parameters" value-field="newEntity"/>
-
-                <if-empty field="newEntity.statusDate">
-                    <now-timestamp field="newEntity.statusDate"/>
-                </if-empty>
-                <create-value value-field="newEntity"/>
+                <set field="createInvoiceStatusMap.invoiceId" from-field="invoice.invoiceId"/>
+                <set field="createInvoiceStatusMap.statusId" from-field="invoice.statusId"/>
+                <set field="createInvoiceStatusMap.statusDate" from-field="parameters.statusDate"/>
+                <call-service service-name="createInvoiceStatus" in-map-name="createInvoiceStatusMap"/>
 
                 <!-- if the invoice is a payrol invoice, create the payment in the not-paid status -->
                 <if-compare field="invoice.invoiceTypeId" operator="equals" value="PAYROL_INVOICE">

Modified: ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml?rev=1751543&r1=1751542&r2=1751543&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml Tue Jul  5 19:32:05 2016
@@ -134,6 +134,12 @@ under the License.
         <auto-attributes mode="IN" include="pk" optional="false"/>
     </service>
 
+    <service name="createInvoiceStatus" engine="entity-auto" default-entity-name="InvoiceStatus" invoke="create" auth="true">
+        <description>Create a Invoice Status Record</description>
+        <auto-attributes mode="IN" include="pk" optional="false"/>
+        <override name="statusDate" mode="IN" optional="true"/>
+    </service>
+
     <service name="createInvoiceRole" engine="simple" default-entity-name="InvoiceRole"
         location="component://accounting/minilang/invoice/InvoiceServices.xml" invoke="createInvoiceRole">
         <description>Create a new Invoice Role Record</description>

Modified: ofbiz/trunk/applications/accounting/widget/InvoiceForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/InvoiceForms.xml?rev=1751543&r1=1751542&r2=1751543&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/InvoiceForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/InvoiceForms.xml Tue Jul  5 19:32:05 2016
@@ -448,6 +448,7 @@ under the License.
         <field name="invoiceId"><hidden/></field>
         <field name="statusDate"><display description="${groovy:statusDate.toString().substring(0,10)}"/></field>
         <field name="statusId" title="${uiLabelMap.CommonStatus}"><display-entity entity-name="StatusItem"/></field>
+        <field name="changeByUserLoginId"><display /></field>
     </form>
 
     <form name="ListInvoiceTerms" list-name="invoiceTerms" target="" title="" type="list"

Modified: ofbiz/trunk/applications/datamodel/entitydef/accounting-entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/datamodel/entitydef/accounting-entitymodel.xml?rev=1751543&r1=1751542&r2=1751543&view=diff
==============================================================================
--- ofbiz/trunk/applications/datamodel/entitydef/accounting-entitymodel.xml (original)
+++ ofbiz/trunk/applications/datamodel/entitydef/accounting-entitymodel.xml Tue Jul  5 19:32:05 2016
@@ -1536,6 +1536,7 @@ under the License.
       <field name="statusId" type="id-ne"></field>
       <field name="invoiceId" type="id-ne"></field>
       <field name="statusDate" type="date-time"></field>
+      <field name="changeByUserLoginId" type="id-vlong"/>
       <prim-key field="statusId"/>
       <prim-key field="invoiceId"/>
       <prim-key field="statusDate"/>
@@ -1545,6 +1546,9 @@ under the License.
       <relation type="one" fk-name="INVCE_STS_INVCE" rel-entity-name="Invoice">
         <key-map field-name="invoiceId"/>
       </relation>
+      <relation type="one" fk-name="INV_STTS_USRLGN" title="ChangeBy" rel-entity-name="UserLogin">
+          <key-map field-name="changeByUserLoginId" rel-field-name="userLoginId"/>
+      </relation>
     </entity>
     <entity entity-name="InvoiceTerm"
             package-name="org.ofbiz.accounting.invoice"