This is an automated email from the ASF dual-hosted git repository.

pawan pushed a commit to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release18.12 by this push:
     new b2a59b1  Fixed: Error in deleting Financial Account (OFBIZ-12153)
b2a59b1 is described below

commit b2a59b12a96e9dbbea72372bc062f5a8532dac24
Author: Pawan Verma <pawan.ve...@hotwaxsystems.com>
AuthorDate: Mon Mar 15 13:07:00 2021 +0530

    Fixed: Error in deleting Financial Account (OFBIZ-12153)
    
    1. Navigate to URL: accounting/control/FindFinAccount
    2. Click on Find button. List of fin account will be displayed.
    3. Click on delete button near available balance column.
    
    Thanks: Lalit Dashora for report, Sourabh Jain for the initial fix, Jacques 
for the test.
---
 applications/accounting/minilang/test/AutoAcctgFinAccountTests.xml    | 3 ++-
 applications/accounting/servicedef/services_finaccount.xml            | 2 +-
 applications/accounting/widget/FinAccountForms.xml                    | 2 +-
 .../main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java   | 4 +++-
 4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/applications/accounting/minilang/test/AutoAcctgFinAccountTests.xml 
b/applications/accounting/minilang/test/AutoAcctgFinAccountTests.xml
index b344f79..9347f34 100644
--- a/applications/accounting/minilang/test/AutoAcctgFinAccountTests.xml
+++ b/applications/accounting/minilang/test/AutoAcctgFinAccountTests.xml
@@ -70,7 +70,8 @@ under the License.
             <field-map field-name="finAccountId" value="1002"/>
         </entity-one>
         <assert>
-            <if-empty field="finAccount"/>
+            <not><if-empty field="finAccount"/></not>
+            <not><if-empty field="finAccount.thruDate"/></not>
         </assert>
         <check-errors/>
     </simple-method>
diff --git a/applications/accounting/servicedef/services_finaccount.xml 
b/applications/accounting/servicedef/services_finaccount.xml
index b1feeb1..f4c823c 100644
--- a/applications/accounting/servicedef/services_finaccount.xml
+++ b/applications/accounting/servicedef/services_finaccount.xml
@@ -48,7 +48,7 @@ under the License.
         <attribute name="replenishPaymentId" type="String" mode="OUT" 
optional="true"/>
         <attribute name="replenishLevel" type="BigDecimal" mode="OUT" 
optional="true"/>
     </service>
-    <service name="deleteFinAccount" default-entity-name="FinAccount" 
engine="entity-auto" invoke="delete">
+    <service name="deleteFinAccount" default-entity-name="FinAccount" 
engine="entity-auto" invoke="expire">
         <description>Delete a Financial Account</description>
         <auto-attributes mode="IN" optional="false" include="pk"/>
     </service>
diff --git a/applications/accounting/widget/FinAccountForms.xml 
b/applications/accounting/widget/FinAccountForms.xml
index efd67ec..bb9fcaa 100644
--- a/applications/accounting/widget/FinAccountForms.xml
+++ b/applications/accounting/widget/FinAccountForms.xml
@@ -73,7 +73,7 @@ under the License.
                 <parameter param-name="partyId" from-field="ownerPartyId"/>
             </hyperlink>
         </field>
-        <field name="deleteLink" title=" " widget-style="buttontext">
+        <field name="deleteLink" title=" " widget-style="buttontext" 
use-when="thruDate==null">
             <hyperlink description="${uiLabelMap.CommonDelete}" 
target="deleteFinAccount" also-hidden="false">
                 <parameter param-name="finAccountId"/>
             </hyperlink>
diff --git 
a/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java
 
b/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java
index 4529329..208ea7a 100644
--- 
a/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java
+++ 
b/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java
@@ -556,7 +556,9 @@ public final class EntityAutoEngine extends 
GenericAsyncEngine {
             if (parameters.get(fieldDateNameIn) == null) {
                 parameters.put(fieldDateNameIn, UtilDateTime.nowTimestamp());
             }
-        } else if (thruDatePresent && 
UtilValidate.isEmpty(lookedUpValue.getTimestamp("thruDate"))) {
+        }
+        // Expire thruDate fields
+        if (thruDatePresent && 
UtilValidate.isEmpty(lookedUpValue.getTimestamp("thruDate"))) {
             if (UtilValidate.isEmpty(parameters.get("thruDate"))) {
                 parameters.put("thruDate", UtilDateTime.nowTimestamp());
             }

Reply via email to