コード例 #1
0
$sWS_ROUNDROBIN = $oData->WS_ROUNDROBIN;
$sWE_USR = $oData->WE_USR;
$withWS = $sWE_TYPE == 'WS';
G::LoadClass("system");
try {
    $pathProcess = PATH_DATA_SITE . 'public' . PATH_SEP . $sPRO_UID . PATH_SEP;
    G::mk_dir($pathProcess, 0777);
    $oTask = new Task();
    $TaskFields = $oTask->load($sTASKS);
    $WE_EVN_UID = $oTask->getStartingEvent($sTASKS);
    if ($TaskFields['TAS_ASSIGN_TYPE'] != 'BALANCED') {
        throw new Exception("The task '" . $TaskFields['TAS_TITLE'] . "' doesn't have a valid assignment type. The task needs to have a 'Cyclical Assignment'.");
    }
    G::LoadClass('tasks');
    $oTask = new Tasks();
    $user = $oTask->assignUsertoTask($sTASKS);
    if ($user == 0) {
        throw new Exception(G::LoadTranslation('ID_TASK') . "'" . $TaskFields['TAS_TITLE'] . "'" . G::LoadTranslation('ID_NOT_HAVE_USERS'));
    }
    $http = G::is_https() ? "https://" : "http://";
    $sContent = '';
    $infoProcess = new Process();
    $resultProcess = $infoProcess->load($sPRO_UID);
    if ($withWS) {
        //creating sys.info;
        $SITE_PUBLIC_PATH = '';
        if (file_exists($SITE_PUBLIC_PATH . '')) {
        }
        //creating the first file
        require_once 'classes/model/Dynaform.php';
        $oDynaform = new Dynaform();
コード例 #2
0
ファイル: WebEntry.php プロジェクト: emildev35/processmaker
 /**
  * Validate the data if they are invalid (INSERT and UPDATE)
  *
  * @param string $webEntryUid Unique id of Web Entry
  * @param string $processUid  Unique id of Process
  * @param array  $arrayData   Data
  *
  * return void Throw exception if data has an invalid value
  */
 public function throwExceptionIfDataIsInvalid($webEntryUid, $processUid, array $arrayData)
 {
     try {
         //Set variables
         $arrayWebEntryData = $webEntryUid == "" ? array() : $this->getWebEntry($webEntryUid, true);
         $flagInsert = $webEntryUid == "" ? true : false;
         $arrayDataMain = array_merge($arrayWebEntryData, $arrayData);
         //Verify data - Field definition
         $process = new \ProcessMaker\BusinessModel\Process();
         $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, $flagInsert);
         if ($arrayDataMain["WE_METHOD"] == "WS") {
             $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayUserFieldDefinition, $this->arrayFieldNameForException, $flagInsert);
         }
         //Verify data
         if (isset($arrayData["WE_TITLE"])) {
             $this->throwExceptionIfExistsTitle($processUid, $arrayData["WE_TITLE"], $this->arrayFieldNameForException["webEntryTitle"], $webEntryUid);
         }
         if (isset($arrayData["TAS_UID"])) {
             $task = new \ProcessMaker\BusinessModel\Task();
             $task->throwExceptionIfNotExistsTask($processUid, $arrayData["TAS_UID"], $this->arrayFieldNameForException["taskUid"]);
         }
         if (isset($arrayData["DYN_UID"])) {
             $dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
             $dynaForm->throwExceptionIfNotExistsDynaForm($arrayData["DYN_UID"], $processUid, $this->arrayFieldNameForException["dynaFormUid"]);
         }
         if ($arrayDataMain["WE_METHOD"] == "WS" && isset($arrayData["USR_UID"])) {
             $process->throwExceptionIfNotExistsUser($arrayData["USR_UID"], $this->arrayFieldNameForException["userUid"]);
         }
         $task = new \Task();
         $arrayTaskData = $task->load($arrayDataMain["TAS_UID"]);
         if (isset($arrayData["TAS_UID"])) {
             if ($arrayTaskData["TAS_START"] == "FALSE") {
                 throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_IS_NOT_INITIAL_ACTIVITY", array($arrayTaskData["TAS_TITLE"])));
             }
             if ($arrayTaskData["TAS_ASSIGN_TYPE"] != "BALANCED") {
                 throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_ACTIVITY_DOES_NOT_HAVE_VALID_ASSIGNMENT_TYPE", array($arrayTaskData["TAS_TITLE"])));
             }
         }
         if ($arrayDataMain["WE_METHOD"] == "WS" && isset($arrayData["TAS_UID"])) {
             $task = new \Tasks();
             if ($task->assignUsertoTask($arrayData["TAS_UID"]) == 0) {
                 throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_DOES_NOT_HAVE_USERS", array($arrayTaskData["TAS_TITLE"])));
             }
         }
         if (isset($arrayData["DYN_UID"])) {
             $dynaForm = new \Dynaform();
             $arrayDynaFormData = $dynaForm->Load($arrayData["DYN_UID"]);
             $step = new \ProcessMaker\BusinessModel\Step();
             if (!$step->existsRecord($arrayDataMain["TAS_UID"], "DYNAFORM", $arrayData["DYN_UID"])) {
                 throw new \Exception(\G::LoadTranslation("ID_DYNAFORM_IS_NOT_ASSIGNED_TO_ACTIVITY", array($arrayDynaFormData["DYN_TITLE"], $arrayTaskData["TAS_TITLE"])));
             }
         }
         if ($arrayDataMain["WE_METHOD"] == "WS" && isset($arrayData["USR_UID"])) {
             $user = new \Users();
             $arrayUserData = $user->load($arrayData["USR_UID"]);
             //Verify if User is assigned to Task
             $projectUser = new \ProcessMaker\BusinessModel\ProjectUser();
             if (!$projectUser->userIsAssignedToTask($arrayData["USR_UID"], $arrayDataMain["TAS_UID"])) {
                 throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_HAVE_ACTIVITY_ASSIGNED", array($arrayUserData["USR_USERNAME"], $arrayTaskData["TAS_TITLE"])));
             }
         }
     } catch (\Exception $e) {
         throw $e;
     }
 }