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

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


The following commit(s) were added to refs/heads/trunk by this push:
     new 1268ed3859 Fixed: codenarc issue introduce on commit 
55d33436d87950c7623536b70d297ca770ff5bc9
1268ed3859 is described below

commit 1268ed38596e3104bbb19d2567d758e71a42b39d
Author: Nicolas Malin <nicolas.ma...@nereide.fr>
AuthorDate: Thu Mar 28 11:29:14 2024 +0100

    Fixed: codenarc issue introduce on commit 
55d33436d87950c7623536b70d297ca770ff5bc9
---
 .../workeffort/workeffort/WorkEffortServicesScript.groovy | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git 
a/applications/workeffort/src/main/groovy/org/apache/ofbiz/workeffort/workeffort/workeffort/WorkEffortServicesScript.groovy
 
b/applications/workeffort/src/main/groovy/org/apache/ofbiz/workeffort/workeffort/workeffort/WorkEffortServicesScript.groovy
index f1b94f9d24..1c67a08be6 100644
--- 
a/applications/workeffort/src/main/groovy/org/apache/ofbiz/workeffort/workeffort/workeffort/WorkEffortServicesScript.groovy
+++ 
b/applications/workeffort/src/main/groovy/org/apache/ofbiz/workeffort/workeffort/workeffort/WorkEffortServicesScript.groovy
@@ -359,15 +359,15 @@ Map duplicateWorkEffort() {
     duplicateWorkEffort.workEffortId = workEffortId
 
     // Check the status to give to the new WorkEffort
-    if (!parameters.statusId) {
+    if (parameters.statusId) {
+        duplicateWorkEffort.currentStatusId = parameters.statusId
+    } else {
         GenericValue oldStatus = from('StatusItem').where(statusId: 
oldWorkEffort.currentStatusId).cache().queryOne()
         GenericValue firstStatus = from('StatusItem')
                 .where(statusTypeId: oldStatus.statusTypeId)
                 .orderBy('sequenceId')
                 .queryFirst()
         duplicateWorkEffort.currentStatusId = firstStatus.statusId
-    } else {
-        duplicateWorkEffort.currentStatusId = parameters.statusId
     }
 
     // Create the new WorkEffort from the old one and the status
@@ -406,10 +406,6 @@ Map duplicateWorkEffort() {
 
 /**
  * duplicate entity relation during a workEffort duplication process
- * @param relationEntityName
- * @param oldWorkEffortId
- * @param workEffortId
- * @param relationFieldName
  */
 void duplicateWorkEffortAssoc(String relationEntityName, String 
oldWorkEffortId,
                               String workEffortId, String relationFieldName = 
'workEffortId') {
@@ -477,7 +473,7 @@ Map assignPartyToWorkEffort() {
     Timestamp now = UtilDateTime.nowTimestamp()
     parameters.fromDate = parameters.fromDate ?: now
     Map result = run service: 'createWorkEffortPartyAssignment', with: [*: 
parameters,
-                                                                        
statusDatetime: parameters.statusId? now: null,
+                                                                        
statusDatetime: parameters.statusId ? now : null,
                                                                         
assignedByUserLoginId: userLogin.userLoginId]
     assignment = from('WorkEffortPartyAssignment').where(parameters).queryOne()
     if (parameters.statusId) {
@@ -506,7 +502,6 @@ Map updatePartyToWorkEffortAssignment() {
  * @return Success, error response otherwise.
  */
 Map quickAssignPartyToWorkEffort() {
-
     // add a party assignment for the creator of the event, use the list 
method and let the EE do the update or create...
     run service: 'ensurePartyRole', with: [partyId: 
parameters.quickAssignPartyId,
                                            roleTypeId: parameters.roleTypeId]
@@ -581,4 +576,4 @@ Map updateWorkEffortContactMech() {
         workEffortContactMech.store()
     }
     return success([contactMechId: newContactMechId, oldContactMechId: 
workEffortContactMech.contactMechId])
-}
\ No newline at end of file
+}

Reply via email to