svn commit: r1226393 - /ofbiz/trunk/applications/workeffort/script/isCalOwner.groovy

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

svn commit: r1226393 - /ofbiz/trunk/applications/workeffort/script/isCalOwner.groovy

adrianc
Author: adrianc
Date: Mon Jan  2 11:24:37 2012
New Revision: 1226393

URL: http://svn.apache.org/viewvc?rev=1226393&view=rev
Log:
Fixed a work effort calendar script that didn't work.

Modified:
    ofbiz/trunk/applications/workeffort/script/isCalOwner.groovy

Modified: ofbiz/trunk/applications/workeffort/script/isCalOwner.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/script/isCalOwner.groovy?rev=1226393&r1=1226392&r2=1226393&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/script/isCalOwner.groovy (original)
+++ ofbiz/trunk/applications/workeffort/script/isCalOwner.groovy Mon Jan  2 11:24:37 2012
@@ -17,16 +17,15 @@
  * under the License.
  */
 
-
+import java.util.*;
 import org.ofbiz.entity.util.*;
 
-
-partyAssign = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortPartyAssignment", ["workEffortId" : parameters.workEffortId, "partyId" : parameters.userLogin.partyId]));
-
-if (partyAssign) {
-    if (partyAssign.get(0).roleTypeId.equals("CAL_OWNER")) {
-        context.isCalOwner = new Boolean(true);
-    } else{
-        context.isCalOwner = new Boolean(false);
+boolean isCalOwner = false;
+List partyAssignments = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortPartyAssignment", ["workEffortId" : parameters.workEffortId, "partyId" : parameters.userLogin.partyId]));
+for (partyAssign in partyAssignments) {
+    if ("CAL_OWNER".equals(partyAssign.roleTypeId) || "CAL_DELEGATE".equals(partyAssign.roleTypeId)) {
+        isCalOwner = true;
+        break;
     }
 }
+context.isCalOwner = isCalOwner;