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

nmalin pushed a commit to branch release24.09
in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git


The following commit(s) were added to refs/heads/release24.09 by this push:
     new 907f0f50e Improved: slim down groovy scriptlet (OFBIZ-13146) Convert 
to groovy natural language or uel function (second pass)
907f0f50e is described below

commit 907f0f50ee0a518e508d4acb001a82f068cb0157
Author: Nicolas Malin <nicolas.ma...@nereide.fr>
AuthorDate: Thu Jan 2 11:35:38 2025 +0100

    Improved: slim down groovy scriptlet (OFBIZ-13146)
    Convert to groovy natural language or uel function (second pass)
---
 projectmgr/src/main/java/org/apache/ofbiz/project/Various.java | 7 +++++++
 projectmgr/widget/forms/TimeSheetForms.xml                     | 8 ++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/projectmgr/src/main/java/org/apache/ofbiz/project/Various.java 
b/projectmgr/src/main/java/org/apache/ofbiz/project/Various.java
index 2b469d68d..1a97ac820 100644
--- a/projectmgr/src/main/java/org/apache/ofbiz/project/Various.java
+++ b/projectmgr/src/main/java/org/apache/ofbiz/project/Various.java
@@ -88,6 +88,9 @@ public class Various {
         }
         return startDate;
     }
+    public static Timestamp getCompletionDate(GenericValue task, Timestamp 
startDate) {
+        return calculateCompletionDate(task, startDate);
+    }
 
     public static double calculateActualHours(Delegator delegator, String 
timesheetId) {
         double actualHours = 0.00;
@@ -107,4 +110,8 @@ public class Various {
         }
         return actualHours;
     }
+
+    public static double getActualHours(Delegator delegator, String 
timesheetId) {
+        return calculateActualHours(delegator, timesheetId);
+    }
 }
diff --git a/projectmgr/widget/forms/TimeSheetForms.xml 
b/projectmgr/widget/forms/TimeSheetForms.xml
index b7618c337..5d16a5e8e 100644
--- a/projectmgr/widget/forms/TimeSheetForms.xml
+++ b/projectmgr/widget/forms/TimeSheetForms.xml
@@ -85,7 +85,7 @@
         <field name="hours"><display/></field>
         <field name="comments" 
title="${uiLabelMap.CommonComments}"><display/></field>
         <field name="completeLink" 
title="${uiLabelMap.CommonStatustoComplete}" widget-style="buttontext">
-            <hyperlink 
description="${groovy:statusId.equals(&quot;TIMESHEET_IN_PROCESS&quot;)?complete:&quot;&quot;}"
 target="TimeSheetStatusToComplete" also-hidden="false">
+            <hyperlink description="${groovy:statusId == 
'TIMESHEET_IN_PROCESS' ? complete : ''}" target="TimeSheetStatusToComplete" 
also-hidden="false">
                 <parameter param-name="timesheetId"/>
                 <parameter param-name="statusId" value="TIMESHEET_COMPLETED"/>
             </hyperlink>
@@ -130,8 +130,8 @@
             <set field="complete" value="${uiLabelMap.ProjectMgrToComplete}"/>
         </actions>
         <row-actions>
-            <set field="actualHours" 
value="${groovy:org.apache.ofbiz.project.Various.calculateActualHours(delegator,
 timesheetId)}"/>
-            <set field="completeLink" 
value="${groovy:&quot;TIMESHEET_IN_PROCESS&quot;.equals(statusId)?complete:&quot;&quot;}"/>
+            <set field="actualHours" 
value="${groovy:org.apache.ofbiz.project.Various.getActualHours(delegator, 
timesheetId)}"/>
+            <set field="completeLink" value="${groovy:statusId == 
'TIMESHEET_IN_PROCESS' ? complete : ''}"/>
         </row-actions>
         <field name="timesheetId" 
title="${uiLabelMap.WorkEffortTimesheetTimesheetId}" widget-style="buttontext">
             <hyperlink description="${timesheetId}" target="Timesheet" 
also-hidden="false">
@@ -145,7 +145,7 @@
         <field name="thruDate" title="${uiLabelMap.CommonThruDate}"><display 
type="date"/></field>
         <!--field name="comments" 
title="${uiLabelMap.CommonComments}"><display/></field-->
         <field name="completeLink" 
title="${uiLabelMap.CommonStatustoComplete}" widget-style="buttontext">
-            <hyperlink 
description="${groovy:statusId.equals(&quot;TIMESHEET_IN_PROCESS&quot;)?complete:&quot;&quot;}"
 target="TimeSheetStatusToComplete">
+            <hyperlink description="${groovy:statusId == 
'TIMESHEET_IN_PROCESS' ? complete : ''}" target="TimeSheetStatusToComplete">
                 <parameter param-name="timesheetId"/>
                 <parameter param-name="statusId" value="TIMESHEET_COMPLETED"/>
             </hyperlink>

Reply via email to