Alfresco任务完成

时间:2018-03-01 18:03:40

标签: alfresco activiti

我有以下表格: enter image description here

选项2没问题,但选项1不是....

选项1的目的是将文档从我的主小面板移动到(新)"待定" dashlet。 当需要的信息丢失(并且用户不知道)时使用它,因此他们无法完全填写表格(即,他们需要将其保存为草稿)。 当他们准备完成表单时,我们重新打开文档(来自"待定"小面板),完全填写表单并使用选项2.

目前,当我点击选项1按钮时,文档将移动到我的待处理小面板,但作为已完成的任务....

这就是我的尝试:

enter image description here

我的XML:

<?xml version="1.0" encoding="UTF-8"?>

<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:tns="http://activiti.org/bpmn20" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://activiti.org/bpmn20" id="review-definitions" name="">
  <process id="activitiValidationDocumed" name="Validation Documed" isExecutable="true" isClosed="false" processType="None">
    <extensionElements>
      <activiti:executionListener event="start" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
        <activiti:field name="script">
          <activiti:string><![CDATA[execution.setVariable('wf_approveCount', 100);
                        execution.setVariable('wf_actualPercent', 100);
                        execution.setVariable('wf_reviewerCount', bpm_assignees.size());
                        execution.setVariable('wf_requiredPercent', wf_requiredApprovePercent);]]></activiti:string>
        </activiti:field>
      </activiti:executionListener>
    </extensionElements>
    <startEvent id="start" activiti:formKey="wf:submitParallelReviewTask"></startEvent>
    <sequenceFlow id="flow1" sourceRef="start" targetRef="validationSecretaire"></sequenceFlow>
    <userTask id="validationSecretaire" name="Validation secrétaire" activiti:assignee="${reviewAssignee.properties.userName}" activiti:formKey="wfvd:activitiReviewTask">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
                        if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;

logger.system.out("task.getVariable(reviewAssignee) onCreate : "+task.getVariable("reviewAssignee"));]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[<import resource="classpath:alfresco/extension/workflows/js/validation-documed.js">

mainValidationSecretaire();]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
      <multiInstanceLoopCharacteristics isSequential="false" activiti:collection="bpm_assignees" activiti:elementVariable="reviewAssignee">
        <completionCondition>${wf_actualPercent &gt;= wf_requiredApprovePercent}</completionCondition>
      </multiInstanceLoopCharacteristics>
    </userTask>
    <sequenceFlow id="flow2" sourceRef="validationSecretaire" targetRef="reviewDecision"></sequenceFlow>
    <exclusiveGateway id="reviewDecision" name="Review Decision"></exclusiveGateway>
    <sequenceFlow id="flow3" sourceRef="reviewDecision" targetRef="validationMedecin">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${execution.getVariable('wfvd_reviewOutcomeMed') == 'DEMANDE'}]]></conditionExpression>
    </sequenceFlow>
    <userTask id="validationMedecin" name="Validation Médecin" activiti:assignee="${wfvd_medecin.properties.userName}" activiti:formKey="wfvd:activitiReviewTaskMedecin">
      <documentation>The document was reviewed and approved.</documentation>
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[<import resource="classpath:alfresco/extension/workflows/js/validation-documed.js">
if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
                        if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;

OncreateValidationMedecin();]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[<import resource="classpath:alfresco/extension/workflows/js/validation-documed.js">

mainValidationMedecin();]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <endEvent id="end"></endEvent>
    <sequenceFlow id="flow6" sourceRef="reviewDecision" targetRef="end"></sequenceFlow>
    <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow7" sourceRef="validationMedecin" targetRef="exclusivegateway1"></sequenceFlow>
    <sequenceFlow id="flow8" sourceRef="exclusivegateway1" targetRef="end">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${execution.getVariable('wfvd_reviewOutcomeMedecinDpe') == 'DPE'}]]></conditionExpression>
    </sequenceFlow>
    <userTask id="validationRefusSecretaire" name="Validation refus secrétaire" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="wfvd:activitiReviewTaskRefusSecretaire">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
                        if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;

task.setVariable("bpm_workflowDescription",execution.getVariable("bpm_workflowDescription"));
task.setVariable("bpm_priority",execution.getVariable("bpm_priority"));]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[<import resource="classpath:alfresco/extension/workflows/js/validation-documed.js">

mainValidationSecretaire();]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow9" sourceRef="exclusivegateway1" targetRef="validationRefusSecretaire">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${wfvd_reviewOutcomeMedecinReturn == 'RETOUR'}]]></conditionExpression>
    </sequenceFlow>
    <exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow10" sourceRef="validationRefusSecretaire" targetRef="exclusivegateway2"></sequenceFlow>
    <sequenceFlow id="flow11" sourceRef="exclusivegateway2" targetRef="validationMedecin">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${execution.getVariable("wfvd_reviewOutcomeMed") == 'DEMANDE'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow12" sourceRef="exclusivegateway2" targetRef="end"></sequenceFlow>
    <sequenceFlow id="flow13" sourceRef="reviewDecision" targetRef="validationSecretaire">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${execution.getVariable('wfvd_reviewOutcomeMed') == 'EA'}]]></conditionExpression>
    </sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_activitiValidationDocumed">
    <bpmndi:BPMNPlane bpmnElement="activitiValidationDocumed" id="BPMNPlane_activitiValidationDocumed">
      <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
        <omgdc:Bounds height="35.0" width="35.0" x="255.0" y="210.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="validationSecretaire" id="BPMNShape_validationSecretaire">
        <omgdc:Bounds height="55.0" width="105.0" x="330.0" y="200.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="reviewDecision" id="BPMNShape_reviewDecision">
        <omgdc:Bounds height="40.0" width="40.0" x="475.0" y="207.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="validationMedecin" id="BPMNShape_validationMedecin">
        <omgdc:Bounds height="55.0" width="105.0" x="645.0" y="200.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
        <omgdc:Bounds height="35.0" width="35.0" x="965.0" y="210.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
        <omgdc:Bounds height="40.0" width="40.0" x="849.0" y="207.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="validationRefusSecretaire" id="BPMNShape_validationRefusSecretaire">
        <omgdc:Bounds height="61.0" width="105.0" x="817.0" y="112.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway2" id="BPMNShape_exclusivegateway2">
        <omgdc:Bounds height="40.0" width="40.0" x="849.0" y="49.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="290.0" y="227.0"></omgdi:waypoint>
        <omgdi:waypoint x="330.0" y="227.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="435.0" y="227.0"></omgdi:waypoint>
        <omgdi:waypoint x="475.0" y="227.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="515.0" y="227.0"></omgdi:waypoint>
        <omgdi:waypoint x="645.0" y="227.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
        <omgdi:waypoint x="495.0" y="247.0"></omgdi:waypoint>
        <omgdi:waypoint x="495.0" y="365.0"></omgdi:waypoint>
        <omgdi:waypoint x="730.0" y="365.0"></omgdi:waypoint>
        <omgdi:waypoint x="982.0" y="365.0"></omgdi:waypoint>
        <omgdi:waypoint x="982.0" y="245.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
        <omgdi:waypoint x="750.0" y="227.0"></omgdi:waypoint>
        <omgdi:waypoint x="849.0" y="227.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
        <omgdi:waypoint x="889.0" y="227.0"></omgdi:waypoint>
        <omgdi:waypoint x="965.0" y="227.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
        <omgdi:waypoint x="869.0" y="207.0"></omgdi:waypoint>
        <omgdi:waypoint x="869.0" y="173.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
        <omgdi:waypoint x="869.0" y="112.0"></omgdi:waypoint>
        <omgdi:waypoint x="869.0" y="89.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow11" id="BPMNEdge_flow11">
        <omgdi:waypoint x="849.0" y="69.0"></omgdi:waypoint>
        <omgdi:waypoint x="697.0" y="69.0"></omgdi:waypoint>
        <omgdi:waypoint x="697.0" y="200.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow12" id="BPMNEdge_flow12">
        <omgdi:waypoint x="889.0" y="69.0"></omgdi:waypoint>
        <omgdi:waypoint x="982.0" y="69.0"></omgdi:waypoint>
        <omgdi:waypoint x="982.0" y="210.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow13" id="BPMNEdge_flow13">
        <omgdi:waypoint x="495.0" y="207.0"></omgdi:waypoint>
        <omgdi:waypoint x="494.0" y="136.0"></omgdi:waypoint>
        <omgdi:waypoint x="439.0" y="136.0"></omgdi:waypoint>
        <omgdi:waypoint x="382.0" y="136.0"></omgdi:waypoint>
        <omgdi:waypoint x="382.0" y="200.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

我刚刚添加了sequenceFlow id="flow13"

这是关联JS =&gt;调用mainValidationSecretaire()函数:

function getDocument(){
        var document;
    if (bpm_package != null) {

            document = bpm_package.children[0];

    }
    return document;
}

function mainValidationSecretaire()
{

    var document = getDocument();
    execution.setVariable('wfvd_medecin', task.getVariable('wfvd_medecin'));
    logger.log("validation-documed.js : wfvd_medecin: "+task.getVariable('wfvd_medecin'));

    var reviewOutcomeEnreg = task.getVariable('wfvd_reviewOutcomeEnreg'); 
    execution.setVariable('wfvd_reviewOutcomeEnreg', reviewOutcomeEnreg);
    //logger.log("validation-documed.js : wfvd_reviewOutcomeEnreg: "+task.getVariable('wfvd_reviewOutcomeEnreg'));

    var reviewOutcomeMed = task.getVariable('wfvd_reviewOutcomeMed'); 
    execution.setVariable('wfvd_reviewOutcomeMed', reviewOutcomeMed);
    //logger.log("validation-documed.js : wfvd_reviewOutcomeMed: "+task.getVariable('wfvd_reviewOutcomeMed'));

    var reviewOutcomeDpe = task.getVariable('wfvd_reviewOutcomeDpe'); 
    execution.setVariable('wfvd_reviewOutcomeDpe', reviewOutcomeDpe);
    //logger.log("validation-documed.js : wfvd_reviewOutcomeDpe: "+task.getVariable('wfvd_reviewOutcomeDpe'));

    var reviewOutcomeDel = task.getVariable('wfvd_reviewOutcomeDel'); 
    execution.setVariable('wfvd_reviewOutcomeDel', reviewOutcomeDel);
    //logger.log("validation-documed.js : wfvd_reviewOutcomeDel: "+task.getVariable('wfvd_reviewOutcomeDel'));

    execution.setVariable('wfvd_reviewAssignee', task.getVariable("reviewAssignee"));
    logger.log("validation-documed.js : reviewAssignee: "+task.getVariable('reviewAssignee'));

    if(task.getVariable("wfvd_reviewAssignee") != null){
        logger.log("validation-documed.js - wfvd_reviewAssignee userName = "+task.getVariable("wfvd_reviewAssignee").properties.userName);      
    }

    execution.setVariable('bpm_assignee', task.getVariable("bpm_assignee"));
    logger.log("validation-documed.js : bpm_assignee: "+task.getVariable('bpm_assignee'));

    if(task.getVariable('bpm_assignee') != null){
        logger.log("validation-documed.js - bpm_assignee userName= "+task.getVariable("bpm_assignee").properties.userName);
    }

    task.setVariable("wfvd_nomService",execution.getVariable("wfvd_nomService"));
    logger.log("validation-documed.js : wfvd_nomService: "+task.getVariable('wfvd_nomService'));

    task.setVariable("wfvd_retourMedecin",execution.getVariable("wfvd_retourMedecin"));
    logger.log("validation-documed.js : wfvd_retourMedecin: "+task.getVariable('wfvd_retourMedecin'));

    task.setVariable("wfvd_standBy",execution.getVariable("wfvd_standBy"));
    logger.log("validation-documed.js : wfvd_standBy: "+task.getVariable('wfvd_standBy'));

    var workflowDescription=execution.getVariable("bpm_workflowDescription");

    var taskDescription=task.getVariable("bpm_workflowDescription");
    logger.log("validation-documed.js : bpm_workflowDescription: "+taskDescription);


    var idPatient,nomPatient,PrenomPatient,dateNaissance;
    var patientSelectione = task.getVariable('wfvd_patients');
    logger.log("validation-documed.js : wfvd_patients: "+task.getVariable('wfvd_patients'));

    if(task.getVariable('wfvd_newPatient') == true)
    {

        idPatient = task.getVariable("wfvd_idPatient");
        nomPatient = task.getVariable("wfvd_nomPatient"); 
        PrenomPatient = task.getVariable("wfvd_prenomPatient");
        dateNaissance = task.getVariable("wfvd_dateNaissance");

        var nodePat = createPatient(idPatient,PrenomPatient,nomPatient,dateNaissance);
        execution.setVariable("wfvd_patients"     ,nodePat);
    }
    else
    {   
        logger.log("validation-documed.js mainValidationSecretaire - patientSelectione not null");
        idPatient =     patientSelectione.properties["os:idPatient"];
        logger.log("validation-documed.js mainValidationSecretaire - os:idPatient" +patientSelectione.properties["os:idPatient"]);
        nomPatient =    patientSelectione.properties["cm:lastName"]; 
        logger.log("validation-documed.js mainValidationSecretaire - cm:lastName" +patientSelectione.properties["cm:lastName"]);
        PrenomPatient = patientSelectione.properties["cm:firstName"];
        logger.log("validation-documed.js mainValidationSecretaire - cm:firstName" +patientSelectione.properties["cm:firstName"]);
        dateNaissance = patientSelectione.properties["os:dateNaissance"];
        logger.log("validation-documed.js mainValidationSecretaire - os:dateNaissance" +patientSelectione.properties["os:dateNaissance"]);
        execution.setVariable("wfvd_patients"     ,task.getVariable("wfvd_patients"));
        logger.log("validation-documed.js mainValidationSecretaire - wfvd_patients" +task.getVariable("wfvd_patients"));
    }


    execution.setVariable("wfvd_idPatient"    ,idPatient);
    execution.setVariable("wfvd_nomPatient"   ,nomPatient);
    execution.setVariable("wfvd_prenomPatient",PrenomPatient);
    execution.setVariable("wfvd_dateNaissance",dateNaissance);

    execution.setVariable("wfvd_dateDocument",task.getVariable("wfvd_dateDocument"));

    execution.setVariable("wfvd_typologie",task.getVariable("wfvd_typologie"));

    //logger.log("validation-documed.js mainValidationSecretaire - task.priority : " + task.priority);

    execution.setVariable("bpm_priority", task.priority);

   // logger.log("validation-documed.js mainValidationSecretaire - bpm_priority global : " + execution.getVariable("bpm_priority"));


    if(reviewOutcomeEnreg == "EA")
    {
        logger.log("validation-documed.js mainValidationSecretaire - mise en attente EA ");
        // anciennement VALIDER (=ARCHIVER)
       // onValidationDocumed();

        //var patient = people.getPerson(idPatient).nodeRef;

        execution.setVariable("wfvd_standBy","en attente");
        // initialisation des variables de la tâche avec les valeurs saisies dans le formulaire
        OncreateValidationMedecin();

        logger.log("comm secrétaire = " + task.getVariable('wfvd_commentaireSecretaire'));
        actionUtilsWorkflow.setCommentaire(document.nodeRef,"secretaire",task.getVariable('wfvd_commentaireSecretaire'));

        var taskDescription=execution.getVariable("bpm_workflowDescription");
        if(taskDescription.indexOf("En attente")===-1)
        execution.setVariable('bpm_workflowDescription',"En attente -"+execution.getVariable("bpm_workflowDescription"));

        // get variables

          var variables = task.getVariables();
          logger.log("recup variables : " +variables);
           for each(var itemKey in variables) {
               if (typeof variables[itemKey] !== 'function') {
                    logger.log("Key is: " + itemKey + ", value is: " + variables[itemKey]);   
               }                  
           }

    }

    if(reviewOutcomeMed == "DEMANDE"){
        logger.log("validation-documed.js mainValidationSecretaire - DEMANDE");

        actionUtilsWorkflow.setCommentaire(document.nodeRef,"secretaire",task.getVariable('wfvd_commentaireSecretaire'));
        execution.setVariable("wfvd_retourMedecin","");
        execution.setVariable("wfvd_standBy","");
    }

    if(reviewOutcomeDpe == "DPE")
    {
        logger.log("validation-documed.js DPE par secrétaire - Publication HL7 vers ARIA");

        onValidationDocumed();

        var patient = people.getPerson(idPatient).nodeRef;

        actionUtilsWorkflow.updateDocumed(document.nodeRef,patient,task.getVariable('wfvd_medecin').nodeRef,task.getVariable('wfvd_typologie'),true,task.getVariable("wfvd_dateDocument"));

        actionUtilsWorkflow.setCommentaire(document.nodeRef,"secretaire",task.getVariable('wfvd_commentaireSecretaire'));

        setInformationsToHl7(document.nodeRef,task.getVariable('wfvd_typologie'),task.getVariable("wfvd_dateDocument"));

    }

    if(reviewOutcomeDel == "SUPPRIMER"){
        //execution.setVariable("wfvd_retourMedecin","");
        //execution.setVariable("wfvd_standBy","");
        logger.log("validation-documed.js : Bouton supprimer, cliqué !");
    }

    if(reviewOutcomeEnreg != "EA"){

        // gestion des droits d'accèss sur le document.
        // Use Case : Si le médecin n'a pas les droits d'accès sur la dashlet "Courriers Entrants" dans laquelle est déposé le document
        // alors une exception sera mise en place , uniquement pour ce document. 

        actionUtilsWorkflow.setContributor(document.nodeRef, task.getVariable('wfvd_medecin').properties.userName);
    } 

}

function mainValidationMedecin()
{
    var document = getDocument();
    var idPatient,nomPatient,PrenomPatient,dateNaissance;
    var patientSelectione = task.getVariable('wfvd_patients');

    logger.log("validation-documed.js : reviewAssignee: "+task.getVariable('reviewAssignee'));
    if(task.getVariable("wfvd_reviewAssignee") != null){
        logger.log("validation-documed.js - wfvd_reviewAssignee userName = "+task.getVariable("wfvd_reviewAssignee").properties.userName);      
    }

    logger.log("validation-documed.js : bpm_assignee: "+task.getVariable('bpm_assignee'));
    if(task.getVariable('bpm_assignee') != null){
        logger.log("validation-documed.js - bpm_assignee userName= "+task.getVariable("bpm_assignee").properties.userName);
    }

    if(task.getVariable('wfvd_newPatient') == true)
    {

        idPatient = task.getVariable("wfvd_idPatient");
        nomPatient = task.getVariable("wfvd_nomPatient");
        PrenomPatient = task.getVariable("wfvd_prenomPatient");
        dateNaissance = task.getVariable("wfvd_dateNaissance");

        var nodePat = createPatient(idPatient,PrenomPatient,nomPatient,dateNaissance);
        execution.setVariable("wfvd_patients"     ,nodePat);
    }
    else
    {
        idPatient =     patientSelectione.properties["os:idPatient"];
        nomPatient =    patientSelectione.properties["cm:lastName"];
        PrenomPatient = patientSelectione.properties["cm:firstName"];
        dateNaissance = patientSelectione.properties["os:dateNaissance"];
        execution.setVariable("wfvd_patients"     ,task.getVariable("wfvd_patients"));
    }


    execution.setVariable("wfvd_idPatient"    ,idPatient);
    execution.setVariable("wfvd_nomPatient"   ,nomPatient);
    execution.setVariable("wfvd_prenomPatient",PrenomPatient);
    execution.setVariable("wfvd_dateNaissance",dateNaissance);

    execution.setVariable("wfvd_dateDocument",task.getVariable("wfvd_dateDocument"));
    execution.setVariable("wfvd_typologie",task.getVariable("wfvd_typologie"));

    execution.setVariable("bpm_priority", task.priority);

    var reviewOutcomeMedecinReturn = task.getVariable('wfvd_reviewOutcomeMedecinReturn');
    execution.setVariable('wfvd_reviewOutcomeMedecinReturn', reviewOutcomeMedecinReturn);

    var reviewOutcomeMedecinDpe = task.getVariable('wfvd_reviewOutcomeMedecinDpe');
    execution.setVariable('wfvd_reviewOutcomeMedecinDpe', reviewOutcomeMedecinDpe);

    // var reviewMedecin=execution.getVariable("wfvd_reviewOutcomeMedecin");
    // logger.log("Medecin Review Outcome: "+reviewMedecin);

    /*if(reviewOutcomeMedecin == "VALIDATION")
    {
        onValidationDocumed();

        var patient = people.getPerson(idPatient).nodeRef;

        logger.log("update Doc begin");

        actionUtilsWorkflow.updateDocumed(document.nodeRef,patient,task.getVariable('wfvd_medecin').nodeRef,task.getVariable('wfvd_typologie'),false,task.getVariable("wfvd_dateDocument"));

        logger.log("set Comm Dr");

        actionUtilsWorkflow.setCommentaire(document.nodeRef,"Medecin",task.getVariable('wfvd_commentaireMedecin'));

        execution.setVariable('wfvd_reviewOutcomeMedecin','Valider');
    }
*/
    if(reviewOutcomeMedecinDpe == "DPE")
    {
        logger.log("validation-documed.js : DPE par le médecin Publication HL7 vers ARIA");

        //
        onValidationDocumed();

        var patient = people.getPerson(idPatient).nodeRef;

        actionUtilsWorkflow.updateDocumed(document.nodeRef,patient,task.getVariable('wfvd_medecin').nodeRef,task.getVariable('wfvd_typologie'),true,task.getVariable("wfvd_dateDocument"));
        actionUtilsWorkflow.setCommentaire(document.nodeRef,"Medecin",task.getVariable('wfvd_commentaireMedecin'));


        setInformationsToHl7(document.nodeRef,task.getVariable('wfvd_typologie'),task.getVariable("wfvd_dateDocument"));

        execution.setVariable('wfvd_reviewOutcomeMedecinDpe','DPE');
    }

    if(reviewOutcomeMedecinReturn == "RETOUR")
    {
        logger.log("validation-documed.js - wfvd_reviewAssignee = "+task.getVariable("wfvd_reviewAssignee"));
        logger.log("validation-documed.js - bpm_assignee = "+task.getVariable("bpm_assignee"));

        if(task.getVariable("wfvd_reviewAssignee") != null)
        {
            execution.setVariable('bpm_assignee',task.getVariable("wfvd_reviewAssignee"));
        }
        else
        {
            execution.setVariable('bpm_assignee',task.getVariable("bpm_assignee"));
        }

        // sauvegarde commentaires medecin
        actionUtilsWorkflow.setCommentaire(document.nodeRef,"Medecin",task.getVariable('wfvd_commentaireMedecin'));

        execution.setVariable("wfvd_retourMedecin","retour medecins");

        // initialisation des variables de la tâche avec les valeurs saisies dans le formulaire
        OncreateValidationMedecin();

        // gestion du libellé
        var taskDescription=execution.getVariable("bpm_workflowDescription");
        logger.log("validation-documed.js : taskDescription: "+taskDescription);
        if(taskDescription.indexOf("Rejet médecin")===-1)
        execution.setVariable('bpm_workflowDescription',"Rejet médecin-"+execution.getVariable("bpm_workflowDescription"));
    }
 }


function OncreateValidationMedecin()
{
    task.setVariable("wfvd_patients"     ,execution.getVariable("wfvd_patients"));
    task.setVariable("wfvd_idPatient"    ,execution.getVariable("wfvd_idPatient"));
    task.setVariable("wfvd_nomPatient"   ,execution.getVariable("wfvd_nomPatient"));
    task.setVariable("wfvd_prenomPatient",execution.getVariable("wfvd_prenomPatient"));
    task.setVariable("wfvd_dateNaissance",execution.getVariable("wfvd_dateNaissance"));

    task.setVariable("wfvd_dateDocument",execution.getVariable("wfvd_dateDocument"));

    task.setVariable("wfvd_typologie",execution.getVariable("wfvd_typologie"));

    task.priority = execution.getVariable("bpm_priority");
//    logger.log("task.priority DOC " + task.priority);

}

与选项1相关联的操作是 if(reviewOutcomeEnreg ==&#34; EA&#34;)测试。

我已经从mainValidationMedecin复制并更新了 if(reviewOutcomeMedecinReturn ==&#34; RETOUR&#34;)测试,该测试将文档从dashlet移动到另一个。

是否可以管理这样的文件?如果是这样,缺少什么?我无法在网上找到这样的工作流程图。

1 个答案:

答案 0 :(得分:0)

你可以找到点击了哪个按钮,你的结果按钮属性将是这样的

<property name="tm:taskOutComeA4R">
                <type>d:text</type>
                <default>Disbursement Continue</default>
                <constraints>
                    <constraint type="LIST">
                        <parameter name="allowedValues">
                            <list>
                                <value>Option1</value>
                                <value>Option2</value>
                            </list>
                        </parameter>
                    </constraint>
                </constraints>
            </property>

在完成任务事件获取按钮属性,如 tm:taskOutComeA4R 所以获取此属性并检查

if(task.getVariableLocal('tm_taskOutComeA4R') == 'Option1') 
                    {
                        logger.log('Code X'); 
                    }else{
               logger.log('Code Y');
          }

使用此功能,您可以找到单击的按钮以及要执行的代码。