<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:parallelreview">
<swimlane name="initiator"></swimlane>
<start-state name="start">
<task name="wf:submitParallelReviewTask" swimlane="initiator"/>
<transition name="" to="startreview"/>
</start-state>
<node name="startreview">
<action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
<foreach>#{bpm_assignees}</foreach>
<var>reviewer</var>
</action>
<event type="node-enter">
<script>
<variable name="wf_approveCount" access="write" />
<expression>
wf_approveCount = 0;
</expression>
</script>
</event>
<transition name="review" to="review" />
</node>
<task-node name="review">
<task name="wf:reviewTask">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<actor>#{reviewer}</actor>
</assignment>
</task>
<event type="node-enter">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var i = 0; i < bpm_package.children.length; i++)
{
bpm_package.children[i].setInheritsPermissions(false);
var permissions = bpm_package.children[i].permissions;
var acl=[];
for (var j=0; j < permissions.length; j++)
{
acl = permissions[j].split(";");
var perm=acl[2];
var grp=acl[1];
bpm_package.children[i].removePermission(perm,grp);
}
bpm_package.children[i].setPermission("Consumer", reviewer.properties["cm:userName"]);
}
var mail = actions.create("mail");
mail.parameters.to = "correo@correo.es";
mail.parameters.subject = "Notificacion de tarea asignada";
mail.parameters.from = "noreply@notasinternas.edu.gva.es";
mail.parameters.text = reviewer.properties["cm:userName"]+"No responda a este mensaje.Tiene una tarea ASIGNADA debe revisarla aqui http://notasinternas.edu.gva.es";
mail.execute(bpm_package);
</script>
</action>
</event>
<transition name="reject" to="endreview" />
<transition name="approve" to="endreview">
<script>
<variable name="wf_approveCount" access="read,write" />
<expression>
wf_approveCount = wf_approveCount +1;
</expression>
</script>
</transition>
</task-node>
<join name="endreview">
<transition to="isapproved" />
</join>
<decision name="isapproved">
<event type="node-enter">
<script>
<variable name="wf_reviewerCount" access="write"/>
<variable name="wf_requiredPercent" access="write"/>
<variable name="wf_actualPercent" access="write"/>
<expression>
wf_requiredPercent = wf_requiredApprovePercent;
wf_reviewerCount = bpm_assignees.size();
wf_actualPercent = ((wf_approveCount * 100) / wf_reviewerCount);
</expression>
</script>
</event>
<transition name="reject" to="rejected" />
<transition name="approve" to="approved">
<condition>#{wf_actualPercent >= wf_requiredApprovePercent}</condition>
</transition>
</decision>
<task-node name="rejected">
<transition to="end" />
</task-node>
<task-node name="approved">
<transition to="end" />
</task-node>
<end-state name="end"/>
</process-definition>
document.setInheritsPermissions(false);
var permissions = document.permissions;
var acl=[];
for (var j=0; j < permissions.length; j++)
{
acl = permissions[j].split(";");
var perm=acl[2];
var grp=acl[1];
document.removePermission(perm,grp);
}
document.setPermission("Consumer", "user1");
document.setPermission("Consumer", "user2");
document.save();
var mail = actions.create("mail");
mail.parameters.to="correo";
mail.parameters.subject = "Permisos";
mail.parameters.from = "noreply@notasiternas.edu.gva.es";
mail.parameters.text = "hola hola hola";
var doc=companyhome.childByNamePath("Data Dictionary/Email Templates/notify_user_email.ftl");
mail.execute(doc);
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.