function FupdateAPPDATATYPO3($APP_UID, $new = 0) { $_SESSION["PM_RUN_OUTSIDE_MAIN_APP"] = true; G::LoadClass("case"); $caseInstance = new Cases(); $newFields = $caseInstance->loadCase($APP_UID); $newFields['APP_DATA']['FLAGTYPO3'] = 'On'; $newFields['APP_DATA']['FLAG_ACTIONTYPO3'] = 'actionCreateCase'; if ($_REQUEST['redirect']) { $newFields['APP_DATA']['FLAG_REDIRECT_PAGE'] = urldecode($_REQUEST['redirect']); } if ($new == 1) { $newFields['APP_DATA']['NUM_DOSSIER'] = $newFields['APP_NUMBER']; } PMFSendVariables($APP_UID, $newFields['APP_DATA']); $caseInstance->updateCase($APP_UID, $newFields); }
function executeCaseSelfService() { try { global $sFilter; if ($sFilter != "" && strpos($sFilter, "unassigned-case") === false) { return false; } $criteria = new Criteria("workflow"); //SELECT $criteria->addSelectColumn(AppCacheViewPeer::APP_UID); $criteria->addSelectColumn(AppCacheViewPeer::DEL_INDEX); $criteria->addSelectColumn(AppCacheViewPeer::DEL_DELEGATE_DATE); $criteria->addSelectColumn(AppCacheViewPeer::APP_NUMBER); $criteria->addSelectColumn(AppCacheViewPeer::PRO_UID); $criteria->addSelectColumn(TaskPeer::TAS_UID); $criteria->addSelectColumn(TaskPeer::TAS_SELFSERVICE_TIME); $criteria->addSelectColumn(TaskPeer::TAS_SELFSERVICE_TIME_UNIT); $criteria->addSelectColumn(TaskPeer::TAS_SELFSERVICE_TRIGGER_UID); //FROM $condition = array(); $condition[] = array(AppCacheViewPeer::TAS_UID, TaskPeer::TAS_UID); $condition[] = array(TaskPeer::TAS_SELFSERVICE_TIMEOUT, 1); $criteria->addJoinMC($condition, Criteria::LEFT_JOIN); //WHERE $criteria->add(AppCacheViewPeer::USR_UID, ""); $criteria->add(AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN"); //QUERY $rsCriteria = AppCacheViewPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); setExecutionMessage("Unassigned case"); saveLog("unassignedCase", "action", "Unassigned case", "c"); $date = new dates(); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $appcacheAppUid = $row["APP_UID"]; $appcacheDelIndex = $row["DEL_INDEX"]; $appcacheDelDelegateDate = $row["DEL_DELEGATE_DATE"]; $appcacheAppNumber = $row["APP_NUMBER"]; $appcacheProUid = $row["PRO_UID"]; $taskUid = $row["TAS_UID"]; $taskSelfServiceTime = intval($row["TAS_SELFSERVICE_TIME"]); $taskSelfServiceTimeUnit = $row["TAS_SELFSERVICE_TIME_UNIT"]; $taskSelfServiceTriggerUid = $row["TAS_SELFSERVICE_TRIGGER_UID"]; $dueDate = $date->calculateDate($appcacheDelDelegateDate, $taskSelfServiceTime, $taskSelfServiceTimeUnit, 1); if (time() > $dueDate["DUE_DATE_SECONDS"]) { $sessProcess = null; $sessProcessSw = 0; //Load data $case = new Cases(); $appFields = $case->loadCase($appcacheAppUid); $appFields["APP_DATA"]["APPLICATION"] = $appcacheAppUid; if (isset($_SESSION["PROCESS"])) { $sessProcess = $_SESSION["PROCESS"]; $sessProcessSw = 1; } $_SESSION["PROCESS"] = $appFields["PRO_UID"]; //Execute trigger $criteriaTgr = new Criteria(); $criteriaTgr->add(TriggersPeer::TRI_UID, $taskSelfServiceTriggerUid); $rsCriteriaTgr = TriggersPeer::doSelectRS($criteriaTgr); $rsCriteriaTgr->setFetchmode(ResultSet::FETCHMODE_ASSOC); if ($rsCriteriaTgr->next()) { $row = $rsCriteriaTgr->getRow(); if (is_array($row) && $row["TRI_TYPE"] == "SCRIPT") { $arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron"))); $arrayCron["processcTimeProcess"] = 60; //Minutes $arrayCron["processcTimeStart"] = time(); @file_put_contents(PATH_DATA . "cron", serialize($arrayCron)); //Trigger global $oPMScript; $oPMScript = new PMScript(); $oPMScript->setFields($appFields["APP_DATA"]); $oPMScript->setScript($row["TRI_WEBBOT"]); $oPMScript->execute(); $appFields["APP_DATA"] = array_merge($appFields["APP_DATA"], $oPMScript->aFields); $case->updateCase($appFields["APP_UID"], $appFields); saveLog("unassignedCase", "action", "OK Executed tigger to the case {$appcacheAppNumber}"); } } unset($_SESSION["PROCESS"]); if ($sessProcessSw == 1) { $_SESSION["PROCESS"] = $sessProcess; } } } setExecutionResultMessage("DONE"); } catch (Exception $e) { setExecutionResultMessage("WITH ERRORS", "error"); eprintln(" '-" . $e->getMessage(), "red"); saveLog("unassignedCase", "error", "Error in unassigned case: " . $e->getMessage()); } }
if ($aGields['OUT_DOC_GENERATE'] == 'BOTH' || $aGields['OUT_DOC_GENERATE'] == '') { $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_ViewOutputDocument1', '', G::array_merges($aOD, $aFields), ''); } if ($aGields['OUT_DOC_GENERATE'] == 'DOC') { $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_ViewOutputDocument2', '', G::array_merges($aOD, $aFields), ''); } if ($aGields['OUT_DOC_GENERATE'] == 'PDF') { $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_ViewOutputDocument3', '', G::array_merges($aOD, $aFields), ''); } break; } break; case 'ASSIGN_TASK': $oDerivation = new Derivation(); $oProcess = new Process(); $aData = $oCase->loadCase($_SESSION['APPLICATION']); $aFields['PROCESS'] = $oProcess->load($_SESSION['PROCESS']); $aFields['PREVIOUS_PAGE'] = $aPreviousStep['PAGE']; $aFields['PREVIOUS_PAGE_LABEL'] = G::LoadTranslation('ID_PREVIOUS_STEP'); $aFields['ASSIGN_TASK'] = G::LoadTranslation('ID_ASSIGN_TASK'); $aFields['END_OF_PROCESS'] = G::LoadTranslation('ID_END_OF_PROCESS'); $aFields['NEXT_TASK_LABEL'] = G::LoadTranslation('ID_NEXT_TASK'); $aFields['EMPLOYEE'] = G::LoadTranslation('ID_EMPLOYEE'); $aFields['LAST_EMPLOYEE'] = G::LoadTranslation('ID_LAST_EMPLOYEE'); $aFields['OPTION_LABEL'] = G::LoadTranslation('ID_OPTION'); $aFields['CONTINUE'] = G::LoadTranslation('ID_CONTINUE'); $aFields['FINISH'] = G::LoadTranslation('ID_FINISH'); $aFields['CONTINUE_WITH_OPTION'] = G::LoadTranslation('ID_CONTINUE_WITH_OPTION'); $aFields['FINISH_WITH_OPTION'] = G::LoadTranslation('ID_FINISH_WITH_OPTION'); $aFields['TAS_TIMING_TITLE'] = 'Timing Control'; $aFields['TAS_DURATION'] = 'Task Duration';
function verifyIsCaseChild ($sApplicationUID, $delIndex = 0) { //Obtain the related row in the table SUB_APPLICATION $oCriteria = new Criteria( 'workflow' ); $oCriteria->add( SubApplicationPeer::APP_UID, $sApplicationUID ); $oDataset = SubApplicationPeer::doSelectRS( $oCriteria ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->next(); $aSA = $oDataset->getRow(); if ($aSA) { //Obtain the related row in the table SUB_PROCESS $oCase = new Cases(); $aParentCase = $oCase->loadCase( $aSA['APP_PARENT'], $aSA['DEL_INDEX_PARENT'] ); $oCriteria = new Criteria( 'workflow' ); $oCriteria->add( SubProcessPeer::PRO_PARENT, $aParentCase['PRO_UID'] ); $oCriteria->add( SubProcessPeer::TAS_PARENT, $aParentCase['TAS_UID'] ); $oDataset = SubProcessPeer::doSelectRS( $oCriteria ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->next(); $aSP = $oDataset->getRow(); if ($aSP['SP_SYNCHRONOUS'] == 1) { $appFields = $oCase->loadCase($sApplicationUID, $delIndex); //Copy case variables to parent case $aFields = unserialize( $aSP['SP_VARIABLES_IN'] ); $aNewFields = array (); foreach ($aFields as $sOriginField => $sTargetField) { $sOriginField = str_replace( '@', '', $sOriginField ); $sOriginField = str_replace( '#', '', $sOriginField ); $sOriginField = str_replace( '%', '', $sOriginField ); $sOriginField = str_replace( '?', '', $sOriginField ); $sOriginField = str_replace( '$', '', $sOriginField ); $sOriginField = str_replace( '=', '', $sOriginField ); $sTargetField = str_replace( '@', '', $sTargetField ); $sTargetField = str_replace( '#', '', $sTargetField ); $sTargetField = str_replace( '%', '', $sTargetField ); $sTargetField = str_replace( '?', '', $sTargetField ); $sTargetField = str_replace( '$', '', $sTargetField ); $sTargetField = str_replace( '=', '', $sTargetField ); $aNewFields[$sTargetField] = isset( $appFields['APP_DATA'][$sOriginField] ) ? $appFields['APP_DATA'][$sOriginField] : ''; if(isset($aParentCase['APP_DATA'][$sTargetField.'_label'])){ $aNewFields[$sTargetField.'_label'] = isset( $appFields['APP_DATA'][$sOriginField.'_label'] ) ? $appFields['APP_DATA'][$sOriginField.'_label'] : ''; } } $aParentCase['APP_DATA'] = array_merge( $aParentCase['APP_DATA'], $aNewFields ); $oCase->updateCase( $aSA['APP_PARENT'], $aParentCase ); /*----------------------------------********---------------------------------*/ //Update table SUB_APPLICATION $oSubApplication = new SubApplication(); $oSubApplication->update( array ('APP_UID' => $sApplicationUID,'APP_PARENT' => $aSA['APP_PARENT'],'DEL_INDEX_PARENT' => $aSA['DEL_INDEX_PARENT'],'DEL_THREAD_PARENT' => $aSA['DEL_THREAD_PARENT'],'SA_STATUS' => 'FINISHED','SA_VALUES_IN' => serialize( $aNewFields ),'SA_FINISH_DATE' => date( 'Y-m-d H:i:s' ) ) ); //Derive the parent case $aDeriveTasks = $this->prepareInformation( array ('USER_UID' => - 1,'APP_UID' => $aSA['APP_PARENT'],'DEL_INDEX' => $aSA['DEL_INDEX_PARENT'] ) ); if (isset( $aDeriveTasks[1] )) { if ($aDeriveTasks[1]['ROU_TYPE'] != 'SELECT') { $nextDelegations2 = array (); foreach ($aDeriveTasks as $aDeriveTask) { if (! isset( $aDeriveTask['NEXT_TASK']['USER_ASSIGNED']['USR_UID'] )) { $selectedUser = $aDeriveTask['NEXT_TASK']['USER_ASSIGNED'][0]; unset( $aDeriveTask['NEXT_TASK']['USER_ASSIGNED'] ); $aDeriveTask['NEXT_TASK']['USER_ASSIGNED'] = $selectedUser; $myLabels = array ($aDeriveTask['NEXT_TASK']['TAS_TITLE'],$aParentCase['APP_NUMBER'],$selectedUser['USR_USERNAME'],$selectedUser['USR_FIRSTNAME'],$selectedUser['USR_LASTNAME'] ); G::SendTemporalMessage( 'ID_TASK_WAS_ASSIGNED_TO_USER', 'warning', 'labels', 10, null, $myLabels ); } $nextDelegations2[] = array ('TAS_UID' => $aDeriveTask['NEXT_TASK']['TAS_UID'],'USR_UID' => $aDeriveTask['NEXT_TASK']['USER_ASSIGNED']['USR_UID'],'TAS_ASSIGN_TYPE' => $aDeriveTask['NEXT_TASK']['TAS_ASSIGN_TYPE'],'TAS_DEF_PROC_CODE' => $aDeriveTask['NEXT_TASK']['TAS_DEF_PROC_CODE'],'DEL_PRIORITY' => 3,'TAS_PARENT' => $aDeriveTask['NEXT_TASK']['TAS_PARENT'] ); } $currentDelegation2 = array ('APP_UID' => $aSA['APP_PARENT'],'DEL_INDEX' => $aSA['DEL_INDEX_PARENT'],'APP_STATUS' => 'TO_DO','TAS_UID' => $aParentCase['TAS_UID'],'ROU_TYPE' => $aDeriveTasks[1]['ROU_TYPE'] ); $this->derivate( $currentDelegation2, $nextDelegations2 ); if($delIndex > 0 ) { // Send notifications - Start $oUser = new Users(); $aUser = $oUser->load($appFields["CURRENT_USER_UID"]); $sFromName = $aUser["USR_FIRSTNAME"] . " " . $aUser["USR_LASTNAME"] . ($aUser["USR_EMAIL"] != "" ? " <" . $aUser["USR_EMAIL"] . ">" : ""); try { $oCase->sendNotifications($appFields["TAS_UID"], $nextDelegations2, $appFields["APP_DATA"], $sApplicationUID, $delIndex, $sFromName); } catch (Exception $e) { G::SendTemporalMessage(G::loadTranslation("ID_NOTIFICATION_ERROR") . " - " . $e->getMessage(), "warning", "string", null, "100%"); } // Send notifications - End } } } } } }
/** * Get data of Cases InputDocument * * @param string $applicationUid * @param string $taskUid * @param string $appDocComment * @param string $inputDocumentUid * @param string $userUid * * return array Return an array with data of an InputDocument */ public function addCasesInputDocument($applicationUid, $taskUid, $appDocComment, $inputDocumentUid, $userUid) { try { if ((isset( $_FILES['form'] )) && ($_FILES['form']['error'] != 0)) { $code = $_FILES['form']['error']; switch ($code) { case UPLOAD_ERR_INI_SIZE: $message = \G::LoadTranslation( 'ID_UPLOAD_ERR_INI_SIZE' ); break; case UPLOAD_ERR_FORM_SIZE: $message = \G::LoadTranslation( 'ID_UPLOAD_ERR_FORM_SIZE' ); break; case UPLOAD_ERR_PARTIAL: $message = \G::LoadTranslation( 'ID_UPLOAD_ERR_PARTIAL' ); break; case UPLOAD_ERR_NO_FILE: $message = \G::LoadTranslation( 'ID_UPLOAD_ERR_NO_FILE' ); break; case UPLOAD_ERR_NO_TMP_DIR: $message = \G::LoadTranslation( 'ID_UPLOAD_ERR_NO_TMP_DIR' ); break; case UPLOAD_ERR_CANT_WRITE: $message = \G::LoadTranslation( 'ID_UPLOAD_ERR_CANT_WRITE' ); break; case UPLOAD_ERR_EXTENSION: $message = \G::LoadTranslation( 'ID_UPLOAD_ERR_EXTENSION' ); break; default: $message = \G::LoadTranslation( 'ID_UPLOAD_ERR_UNKNOWN' ); break; } \G::SendMessageText( $message, "ERROR" ); $backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] ); \G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] ); die(); } \G::LoadClass("case"); $appDocUid = \G::generateUniqueID(); $docVersion = ''; $appDocType = 'INPUT'; $case = new \Cases(); $delIndex = \AppDelegation::getCurrentIndex($applicationUid); $case->thisIsTheCurrentUser($applicationUid, $delIndex, $userUid, "REDIRECT", "casesListExtJs"); //Load the fields $arrayField = $case->loadCase($applicationUid); $arrayField["APP_DATA"] = array_merge($arrayField["APP_DATA"], \G::getSystemConstants()); //Triggers $arrayTrigger = $case->loadTriggers($taskUid, "INPUT_DOCUMENT", $inputDocumentUid, "AFTER"); //Add Input Document if (empty($_FILES)) { throw new \Exception(\G::LoadTranslation("ID_CASES_INPUT_FILENAME_DOES_NOT_EXIST")); } if (!$_FILES["form"]["error"]) { $_FILES["form"]["error"] = 0; } if (isset($_FILES) && isset($_FILES["form"]) && count($_FILES["form"]) > 0) { $appDocUid = $case->addInputDocument($inputDocumentUid, $appDocUid, $docVersion, $appDocType, $appDocComment, '', $applicationUid, $delIndex, $taskUid, $userUid, "xmlform", $_FILES["form"]["name"], $_FILES["form"]["error"], $_FILES["form"]["tmp_name"]); } //Trigger - Execute after - Start $arrayField["APP_DATA"] = $case->executeTriggers ($taskUid, "INPUT_DOCUMENT", $inputDocumentUid, "AFTER", $arrayField["APP_DATA"]); //Trigger - Execute after - End //Save data $arrayData = array(); $arrayData["APP_NUMBER"] = $arrayField["APP_NUMBER"]; //$arrayData["APP_PROC_STATUS"] = $arrayField["APP_PROC_STATUS"]; $arrayData["APP_DATA"] = $arrayField["APP_DATA"]; $arrayData["DEL_INDEX"] = $delIndex; $arrayData["TAS_UID"] = $taskUid; $case->updateCase($applicationUid, $arrayData); return($this->getCasesInputDocument($applicationUid, $userUid, $appDocUid)); } catch (\Exception $e) { throw $e; } }
/** * ClaimCase * * @param string $userId * @param string $guid * @param string $delIndex * @return $result will return an object */ public function claimCase($userId, $guid, $delIndex) { try { G::LoadClass('case'); $oCase = new Cases(); $oCase->loadCase($guid); $oCase->setCatchUser($guid, $delIndex, $userId); $result = new wsResponse(0, G::LoadTranslation("ID_COMMAND_EXECUTED_SUCCESSFULLY")); return $result; } catch (Exception $e) { $result = new wsResponse(100, $e->getMessage()); return $result; } }
/** * get the case summary data * * @param string $httpData->appUid * @param string $httpData->delIndex * @return array containg the case summary data */ function getSummary($httpData) { $labels = array(); $form = new Form('cases/cases_Resume', PATH_XMLFORM, SYS_LANG); G::LoadClass('case'); $case = new Cases(); foreach ($form->fields as $fieldName => $field) { $labels[$fieldName] = $field->label; } if (isset($_SESSION['_applicationFields']) && $_SESSION['_processData']) { $applicationFields = $_SESSION['_applicationFields']; unset($_SESSION['_applicationFields']); $processData = $_SESSION['_processData']; unset($_SESSION['_processData']); } else { if ($httpData->action == 'sent') { // Get the last valid delegation for participated list $criteria = new Criteria(); $criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); $criteria->add(AppDelegationPeer::APP_UID, $httpData->appUid); $criteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL); $criteria->addDescendingOrderByColumn(AppDelegationPeer::DEL_INDEX); if (AppDelegationPeer::doCount($criteria) > 0) { $dataset = AppDelegationPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); $row = $dataset->getRow(); $httpData->delIndex = $row['DEL_INDEX']; } } $applicationFields = $case->loadCase($httpData->appUid, $httpData->delIndex); $process = new Process(); $processData = $process->load($applicationFields['PRO_UID']); } $data = array(); $task = new Task(); $taskData = $task->load($applicationFields['TAS_UID']); $currentUser = $applicationFields['CURRENT_USER'] != '' ? $applicationFields['CURRENT_USER'] : '******' . G::LoadTranslation('ID_UNASSIGNED') . ']'; $data[] = array('label' => $labels['PRO_TITLE'], 'value' => $processData['PRO_TITLE'], 'section' => $labels['TITLE1']); $data[] = array('label' => $labels['TITLE'], 'value' => $applicationFields['TITLE'], 'section' => $labels['TITLE1']); $data[] = array('label' => $labels['APP_NUMBER'], 'value' => $applicationFields['APP_NUMBER'], 'section' => $labels['TITLE1']); $data[] = array('label' => $labels['STATUS'], 'value' => $applicationFields['STATUS'], 'section' => $labels['TITLE1']); $data[] = array('label' => $labels['APP_UID'], 'value' => $applicationFields['APP_UID'], 'section' => $labels['TITLE1']); $data[] = array('label' => $labels['CREATOR'], 'value' => $applicationFields['CREATOR'], 'section' => $labels['TITLE1']); $data[] = array('label' => $labels['CREATE_DATE'], 'value' => $applicationFields['CREATE_DATE'], 'section' => $labels['TITLE1']); $data[] = array('label' => $labels['UPDATE_DATE'], 'value' => $applicationFields['UPDATE_DATE'], 'section' => $labels['TITLE1']); $data[] = array('label' => $labels['DESCRIPTION'], 'value' => $applicationFields['DESCRIPTION'], 'section' => $labels['TITLE1']); // note added by krlos pacha carlos[at]colosa[dot]com //getting this field if it doesn't exist. Related 7994 bug $taskData['TAS_TITLE'] = array_key_exists('TAS_TITLE', $taskData) ? $taskData['TAS_TITLE'] : Content::Load("TAS_TITLE", "", $applicationFields['TAS_UID'], SYS_LANG); $data[] = array('label' => $labels['TAS_TITLE'], 'value' => $taskData['TAS_TITLE'], 'section' => $labels['TITLE2']); $data[] = array('label' => $labels['CURRENT_USER'], 'value' => $currentUser, 'section' => $labels['TITLE2']); $data[] = array('label' => $labels['DEL_DELEGATE_DATE'], 'value' => $applicationFields['DEL_DELEGATE_DATE'], 'section' => $labels['TITLE2']); $data[] = array('label' => $labels['DEL_INIT_DATE'], 'value' => $applicationFields['DEL_INIT_DATE'], 'section' => $labels['TITLE2']); $data[] = array('label' => $labels['DEL_TASK_DUE_DATE'], 'value' => $applicationFields['DEL_TASK_DUE_DATE'], 'section' => $labels['TITLE2']); $data[] = array('label' => $labels['DEL_FINISH_DATE'], 'value' => $applicationFields['DEL_FINISH_DATE'], 'section' => $labels['TITLE2']); //$data[] = array('label'=>$labels['DYN_UID'] , 'value' => $processData['PRO_DYNAFORMS']['PROCESS'];, 'section'=>$labels['DYN_UID']); return $data; }
$backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']); G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]); die; } G::LoadClass("case"); $inputDocumentUid = $_GET["UID"]; //$_POST["form"]["DOC_UID"] $appDocUid = $_POST["form"]["APP_DOC_UID"]; $docVersion = intval($_POST["form"]["docVersion"]); $appDocType = $_POST["form"]["APP_DOC_TYPE"]; $appDocComment = isset($_POST["form"]["APP_DOC_COMMENT"]) ? $_POST["form"]["APP_DOC_COMMENT"] : ""; $actionType = $_POST["form"]["actionType"]; $case = new Cases(); $case->thisIsTheCurrentUser($_SESSION["APPLICATION"], $_SESSION["INDEX"], $_SESSION["USER_LOGGED"], "REDIRECT", "casesListExtJs"); //Load the fields $arrayField = $case->loadCase($_SESSION["APPLICATION"]); $arrayField["APP_DATA"] = array_merge($arrayField["APP_DATA"], G::getSystemConstants()); //Triggers $arrayTrigger = $case->loadTriggers($_SESSION["TASK"], "INPUT_DOCUMENT", $inputDocumentUid, "AFTER"); //Trigger debug routines //Cleaning debug variables $_SESSION["TRIGGER_DEBUG"]["ERRORS"] = array(); $_SESSION["TRIGGER_DEBUG"]["DATA"] = array(); $_SESSION["TRIGGER_DEBUG"]["TRIGGERS_NAMES"] = array(); $_SESSION["TRIGGER_DEBUG"]["TRIGGERS_VALUES"] = array(); $_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] = count($arrayTrigger); $_SESSION["TRIGGER_DEBUG"]["TIME"] = "AFTER"; if ($_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] > 0) { $_SESSION["TRIGGER_DEBUG"]["TRIGGERS_NAMES"] = $case->getTriggerNames($arrayTrigger); $_SESSION["TRIGGER_DEBUG"]["TRIGGERS_VALUES"] = $arrayTrigger; }
public function getCompleteDocumentInfo ($appUid, $appDocUid, $docVersion, $docUid, $usrId) { //require_once ("classes/model/AppDocument.php"); //require_once ("classes/model/InputDocument.php"); //require_once ("classes/model/OutputDocument.php"); //require_once ("classes/model/Users.php"); //**** start get Doc Info $oApp = new Application(); $oAppDocument = new AppDocument(); G::LoadClass( 'case' ); $oCase = new Cases(); G::LoadClass( 'process' ); $oProcess = new Process(); if (($oApp->exists( $appUid )) || ($appUid == "00000000000000000000000000000000")) { if ($appUid == "00000000000000000000000000000000") { //External Files $row1 = $oAppDocument->load( $appDocUid, $docVersion ); $row2 = array ('PRO_TITLE' => G::LoadTranslation( 'ID_NOT_PROCESS_RELATED' )); $row3 = array ('APP_TITLE' => G::LoadTranslation( 'ID_NOT_PROCESS_RELATED' )); } else { $row1 = $oAppDocument->load( $appDocUid, $docVersion ); $row2 = $oCase->loadCase( $appUid ); $row3 = $oProcess->Load( $row2['PRO_UID'] ); } $lastVersion = $oAppDocument->getLastAppDocVersion( $appDocUid, $appUid ); switch ($row1['APP_DOC_TYPE']) { case "OUTPUT": $oOutputDocument = new OutputDocument(); $row4 = array(); $swOutDocExists = 0; if ($oOutputDocument->OutputExists($docUid)) { $row4 = $oOutputDocument->load($docUid); $swOutDocExists = 1; } if ($swOutDocExists == 0) { $swpdf = 0; $swdoc = 0; $info = pathinfo($oAppDocument->getAppDocFilename()); $version = (!empty($docVersion))? "_" . $docVersion : "_1"; $outDocPath = PATH_DOCUMENT . G::getPathFromUID($row1["APP_UID"]) . PATH_SEP . "outdocs" . PATH_SEP; if (file_exists($outDocPath . $appDocUid . $version . ".pdf") || file_exists($outDocPath . $info["basename"] . $version . ".pdf") || file_exists($outDocPath . $info["basename"] . ".pdf") ) { $swpdf = 1; } if (file_exists($outDocPath . $appDocUid . $version . ".doc") || file_exists($outDocPath . $info["basename"] . $version . ".doc") || file_exists($outDocPath . $info["basename"] . ".doc") ) { $swdoc = 1; } if ($swpdf == 1 && $swdoc == 1) { $row4["OUT_DOC_GENERATE"] = "BOTH"; } else { if ($swpdf == 1) { $row4["OUT_DOC_GENERATE"] = "PDF"; } else { if ($swdoc == 1) { $row4["OUT_DOC_GENERATE"] = "DOC"; } else { $row4["OUT_DOC_GENERATE"] = "NOFILE"; } } } } $versioningEnabled = false; //$row4['OUT_DOC_VERSIONING']; //Only enabled for Input or Attached documents. Need to study the best way for Output docs. switch ($row4['OUT_DOC_GENERATE']) { case "PDF": $downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=pdf" . "&random=" . rand(); $downloadLink1 = ""; $downloadLabel = ".pdf"; $downloadLabel1 = ""; break; case "DOC": $downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=doc" . "&random=" . rand(); $downloadLink1 = ""; $downloadLabel = ".doc"; $downloadLabel1 = ""; break; case "BOTH": $downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=pdf" . "&random=" . rand(); $downloadLink1 = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=doc" . "&random=" . rand(); $downloadLabel = ".pdf"; $downloadLabel1 = ".doc"; break; case "NOFILE": $downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion; $downloadLink1 = ""; $downloadLabel = G::LoadTranslation("ID_DOWNLOAD"); $downloadLabel1 = ""; break; } if ($swOutDocExists == 0) { $row4 = array(); } break; case "INPUT": $oInputDocument = new InputDocument(); if ($docUid != - 1) { if ($oInputDocument->InputExists( $docUid )) { $row4 = $oInputDocument->load( $docUid ); $versioningEnabled = $row4['INP_DOC_VERSIONING']; } else { $row4 = array (); $versioningEnabled = false; } $downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion; $downloadLink1 = ""; $downloadLabel = G::LoadTranslation( 'ID_DOWNLOAD' ); $downloadLabel1 = ""; } else { $row4 = array (); $versioningEnabled = false; $downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion; $downloadLink1 = ""; $downloadLabel = G::LoadTranslation( 'ID_DOWNLOAD' ); $downloadLabel1 = ""; } if (! empty( $row1["APP_DOC_PLUGIN"] )) { $pluginRegistry = &PMPluginRegistry::getSingleton(); $pluginName = $row1["APP_DOC_PLUGIN"]; $fieldValue = ""; if (file_exists( PATH_PLUGINS . $pluginName . ".php" )) { $pluginDetail = $pluginRegistry->getPluginDetails( $pluginName . ".php" ); if ($pluginDetail) { if ($pluginDetail->enabled) { require_once (PATH_PLUGINS . $pluginName . ".php"); $pluginNameClass = $pluginName . "Plugin"; $objPluginClass = new $pluginNameClass( $pluginName ); if (isset( $objPluginClass->sMethodGetUrlDownload ) && ! empty( $objPluginClass->sMethodGetUrlDownload )) { if (file_exists( PATH_PLUGINS . $pluginName . PATH_SEP . "class." . $pluginName . ".php" )) { require_once (PATH_PLUGINS . $pluginName . PATH_SEP . "class." . $pluginName . ".php"); $pluginNameClass = $pluginName . "Class"; $objClass = new $pluginNameClass(); if (method_exists( $objClass, $objPluginClass->sMethodGetUrlDownload )) { eval( "\$url = \$objClass->" . $objPluginClass->sMethodGetUrlDownload . "(\"" . $row1["APP_DOC_UID"] . "\");" ); $downloadLink = $url; $fieldValue = $row1["APP_DOC_PLUGIN"]; } } } } } } $row1["APP_DOC_PLUGIN"] = $fieldValue; } break; default: $row4 = array (); $versioningEnabled = false; $downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion; $downloadLink1 = ""; $downloadLabel = G::LoadTranslation( 'ID_DOWNLOAD' ); $downloadLabel1 = ""; break; } $oUser = new Users(); if (($usrId != "-1") && ($oUser->userExists( $usrId ))) { $row5 = $oUser->load( $usrId ); } else { $row5['USR_USERNAME'] = "******"; } //Labels/Links $row6 = array (); $row6['DELETE_LABEL'] = G::LoadTranslation( 'ID_DELETE' ); $row6['DOWNLOAD_LABEL'] = $downloadLabel; $row6['DOWNLOAD_LINK'] = $downloadLink; $row6['DOWNLOAD_LABEL1'] = $downloadLabel1; $row6['DOWNLOAD_LINK1'] = $downloadLink1; //if(($docVersion>1)&&($row1['APP_DOC_TYPE']!="OUTPUT")){ if (($docVersion > 1)) { $row6['VERSIONHISTORY_LABEL'] = G::LoadTranslation( 'ID_VERSION_HISTORY' ); } if ($versioningEnabled) { $row6['NEWVERSION_LABEL'] = G::LoadTranslation( 'ID_NEW_VERSION' ); } $row6['APP_DOC_UID_VERSION'] = $appDocUid . "_" . $docVersion; if ($appUid == "00000000000000000000000000000000") { //External Files $row1['APP_DOC_TYPE'] = G::LoadTranslation( 'ID_EXTERNAL_FILE' ); } //**** End get docinfo $infoMerged = array_merge( $row1, $row2, $row3, $row4, $row5, $row6 ); $sUserUID = $_SESSION['USER_LOGGED']; $aObjectPermissions = array (); if (isset( $infoMerged['PRO_UID'] )) { $aObjectPermissions = $oCase->getAllObjects( $infoMerged['PRO_UID'], $infoMerged['APP_UID'], '', $sUserUID ); } if (! is_array( $aObjectPermissions )) { $aObjectPermissions = array ('DYNAFORMS' => array (- 1), 'INPUT_DOCUMENTS' => array (- 1), 'OUTPUT_DOCUMENTS' => array (- 1) ); } if (! isset( $aObjectPermissions['DYNAFORMS'] )) { $aObjectPermissions['DYNAFORMS'] = array (- 1); } else { if (! is_array( $aObjectPermissions['DYNAFORMS'] )) { $aObjectPermissions['DYNAFORMS'] = array (- 1); } } if (! isset( $aObjectPermissions['INPUT_DOCUMENTS'] )) { $aObjectPermissions['INPUT_DOCUMENTS'] = array (- 1); } else { if (! is_array( $aObjectPermissions['INPUT_DOCUMENTS'] )) { $aObjectPermissions['INPUT_DOCUMENTS'] = array (- 1); } } if (! isset( $aObjectPermissions['OUTPUT_DOCUMENTS'] )) { $aObjectPermissions['OUTPUT_DOCUMENTS'] = array (- 1); } else { if (! is_array( $aObjectPermissions['OUTPUT_DOCUMENTS'] )) { $aObjectPermissions['OUTPUT_DOCUMENTS'] = array (- 1); } } return array_merge( $infoMerged, $aObjectPermissions ); } }
/** * get the case summary data * @param string $httpData->appUid * @param string $httpData->delIndex * @return array containg the case summary data */ function getSummary($httpData) { $labels = array(); $form = new Form('cases/cases_Resume', PATH_XMLFORM, SYS_LANG); G::LoadClass('case'); $case = new Cases(); foreach ($form->fields as $fieldName => $field) { $labels[$fieldName] = $field->label; } if (isset($_SESSION['_applicationFields']) && $_SESSION['_processData']) { $applicationFields = $_SESSION['_applicationFields']; unset($_SESSION['_applicationFields']); $processData = $_SESSION['_processData']; unset($_SESSION['_processData']); } else { $applicationFields = $case->loadCase($httpData->appUid, $httpData->delIndex); $process = new Process(); $processData = $process->load($applicationFields['PRO_UID']); } $data = array(); $task = new Task(); $taskData = $task->load($applicationFields['TAS_UID']); $currentUser = $applicationFields['CURRENT_USER'] != '' ? $applicationFields['CURRENT_USER'] : '******' . G::LoadTranslation('ID_UNASSIGNED') . ']'; $data[] = array('label' => $labels['PRO_TITLE'], 'value' => $processData['PRO_TITLE'], 'section' => $labels['TITLE1']); $data[] = array('label' => $labels['TITLE'], 'value' => $applicationFields['TITLE'], 'section' => $labels['TITLE1']); $data[] = array('label' => $labels['APP_NUMBER'], 'value' => $applicationFields['APP_NUMBER'], 'section' => $labels['TITLE1']); $data[] = array('label' => $labels['STATUS'], 'value' => $applicationFields['STATUS'], 'section' => $labels['TITLE1']); $data[] = array('label' => $labels['APP_UID'], 'value' => $applicationFields['APP_UID'], 'section' => $labels['TITLE1']); $data[] = array('label' => $labels['CREATOR'], 'value' => $applicationFields['CREATOR'], 'section' => $labels['TITLE1']); $data[] = array('label' => $labels['CREATE_DATE'], 'value' => $applicationFields['CREATE_DATE'], 'section' => $labels['TITLE1']); $data[] = array('label' => $labels['UPDATE_DATE'], 'value' => $applicationFields['UPDATE_DATE'], 'section' => $labels['TITLE1']); // note added by krlos pacha carlos[at]colosa[dot]com //getting this field if it doesn't exist. Related 7994 bug $taskData['TAS_TITLE'] = array_key_exists('TAS_TITLE', $taskData) ? $taskData['TAS_TITLE'] : Content::Load("TAS_TITLE", "", $applicationFields['TAS_UID'], SYS_LANG); $data[] = array('label' => $labels['TAS_TITLE'], 'value' => $taskData['TAS_TITLE'], 'section' => $labels['TITLE2']); $data[] = array('label' => $labels['CURRENT_USER'], 'value' => $currentUser, 'section' => $labels['TITLE2']); $data[] = array('label' => $labels['DEL_DELEGATE_DATE'], 'value' => $applicationFields['DEL_DELEGATE_DATE'], 'section' => $labels['TITLE2']); $data[] = array('label' => $labels['DEL_INIT_DATE'], 'value' => $applicationFields['DEL_INIT_DATE'], 'section' => $labels['TITLE2']); $data[] = array('label' => $labels['DEL_TASK_DUE_DATE'], 'value' => $applicationFields['DEL_TASK_DUE_DATE'], 'section' => $labels['TITLE2']); $data[] = array('label' => $labels['DEL_FINISH_DATE'], 'value' => $applicationFields['DEL_FINISH_DATE'], 'section' => $labels['TITLE2']); //$data[] = array('label'=>$labels['DYN_UID'] , 'value' => $processData['PRO_DYNAFORMS']['PROCESS'];, 'section'=>$labels['DYN_UID']); return $data; }
if ($_REQUEST['ABER'] == '') { throw new Exception('The parameter ABER is empty.'); } if (!isset($_REQUEST['form'])) { $_REQUEST['form'] = array(); } $_REQUEST['APP_UID'] = G::decrypt($_REQUEST['APP_UID'], URL_KEY); $_REQUEST['DEL_INDEX'] = G::decrypt($_REQUEST['DEL_INDEX'], URL_KEY); $_REQUEST['ABER'] = G::decrypt($_REQUEST['ABER'], URL_KEY); G::LoadClass('case'); $case = new Cases(); $casesFields = $case->loadCase($_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX']); $casesFields['APP_DATA'] = array_merge($casesFields['APP_DATA'], $_REQUEST['form']); //Get user info $current_user_uid = null; $currentUsrName = null; $criteria = new Criteria("workflow"); $criteria->addSelectColumn(AppDelegationPeer::USR_UID); $criteria->add(AppDelegationPeer::APP_UID, $_REQUEST["APP_UID"]); $criteria->add(AppDelegationPeer::DEL_INDEX, $_REQUEST["DEL_INDEX"]); $rsSQL = AppDelegationPeer::doSelectRS($criteria); $rsSQL->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$_REQUEST['DEL_INDEX'] = ''; } if ($_REQUEST['APP_UID'] == '') { throw new Exception('The parameter APP_UID is empty.'); } if ($_REQUEST['DEL_INDEX'] == '') { throw new Exception('The parameter DEL_INDEX is empty.'); } $_REQUEST['APP_UID'] = G::decrypt(urldecode(utf8_encode($_REQUEST['APP_UID'])), URL_KEY); $_REQUEST['DEL_INDEX'] = G::decrypt(urldecode(utf8_encode($_REQUEST['DEL_INDEX'])), URL_KEY); $_REQUEST['FIELD'] = G::decrypt(urldecode(utf8_encode($_REQUEST['FIELD'])), URL_KEY); $_REQUEST['VALUE'] = G::decrypt(urldecode(utf8_encode($_REQUEST['VALUE'])), URL_KEY); $_REQUEST['ABER'] = G::decrypt(urldecode(utf8_encode($_REQUEST['ABER'])), URL_KEY); G::LoadClass('case'); $cases = new Cases(); $caseFieldsABE = $cases->loadCase($_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX']); if (is_null($caseFieldsABE['DEL_FINISH_DATE'])) { $dataField = array(); $dataField[$_REQUEST['FIELD']] = $_REQUEST['VALUE']; $caseFieldsABE['APP_DATA'] = array_merge($caseFieldsABE['APP_DATA'], $dataField); $dataResponses = array(); $dataResponses['ABE_REQ_UID'] = $_REQUEST['ABER']; $dataResponses['ABE_RES_CLIENT_IP'] = $_SERVER['REMOTE_ADDR']; $dataResponses['ABE_RES_DATA'] = serialize($_REQUEST['VALUE']); $dataResponses['ABE_RES_STATUS'] = 'PENDING'; $dataResponses['ABE_RES_MESSAGE'] = ''; try { require_once 'classes/model/AbeResponses.php'; $abeAbeResponsesInstance = new AbeResponses(); $dataResponses['ABE_RES_UID'] = $abeAbeResponsesInstance->createOrUpdate($dataResponses); } catch (Exception $error) {
<?php try { require_once "classes/model/Task.php"; require_once "classes/model/Users.php"; G::LoadClass('case'); G::LoadClass('derivation'); $oTask = new Task(); $TaskFields = $oTask->load($_POST['TASKS']); $aDerivation['NEXT_TASK'] = $TaskFields; $oDerivation = new Derivation(); $deriva = $oDerivation->getNextAssignedUser($aDerivation); $oCase = new Cases(); $aData = $oCase->startCase($_POST['TASKS'], $deriva['USR_UID']); $case = $oCase->loadCase($aData['APPLICATION'], 1); $Fields = array(); $Fields['APP_NUMBER'] = $case['APP_NUMBER']; $Fields['APP_PROC_STATUS'] = 'draft'; $Fields['APP_DATA'] = $_POST['form']; $Fields['DEL_INDEX'] = 1; $Fields['TAS_UID'] = $_POST['TASKS']; //$Fields = $oCase->loadCase($aData['APPLICATION'], 1); $oCase->updateCase($aData['APPLICATION'], $Fields); $s = 0; if (isset($_SERVER['HTTP_REFERER'])) { $dir = explode('?', $_SERVER['HTTP_REFERER']); if ($dir[1] == '__flag__=1') { $s = 1; } else { $dire = explode('&', $dir[1]); for ($i = 0; $i <= count($dire); $i++) {
/** * @method * * Returns a list or user. * * @name PMFGetUserEmailAddress * @label PMF Get User Email Address * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFGetUserEmailAddress.28.29 * * @param string(32) or Array | $id | Case ID | Id of the case. * @param string(32) | $APP_UID = null | Application ID | Id of the Application. * @param string(32) | $prefix = "usr" | prefix | Id of the task. * @return array | $aRecipient | Array of the Recipient | Return an Array of the Recipient. * */ function PMFGetUserEmailAddress($id, $APP_UID = null, $prefix = 'usr') { require_once 'classes/model/UsersPeer.php'; require_once 'classes/model/AppDelegation.php'; G::LoadClass('case'); if (is_string($id) && trim($id) == "") { return false; } if (is_array($id) && count($id) == 0) { return false; } //recipient to store the email addresses $aRecipient = array(); $aItems = array(); /* * First at all the $id user input can be by example erik@colosa.com * 2.this $id param can be a array by example Array('000000000001','000000000002') in this case $prefix is necessary * 3.this same param can be a array by example Array('usr|000000000001', 'usr|-1', 'grp|2245141479413131441') */ /* * The second thing is that the return type will be configurated depend of the input type (using $retType) */ if (is_array($id)) { $aItems = $id; $retType = 'array'; } else { $retType = 'string'; if (strpos($id, ",") !== false) { $aItems = explode(',', $id); } else { array_push($aItems, $id); } } foreach ($aItems as $sItem) { //cleaning for blank spaces into each array item $sItem = trim($sItem); if (strpos($sItem, "|") !== false) { // explode the parameter because always will be compose with pipe separator to indicate // the type (user or group) and the target mai list($sType, $sID) = explode('|', $sItem); $sType = trim($sType); $sID = trim($sID); } else { $sType = $prefix; $sID = $sItem; } switch ($sType) { case 'ext': if (G::emailAddress($sID)) { array_push($aRecipient, $sID); } break; case 'usr': if ($sID == '-1') { // -1: Curent user, load from user record if (isset($APP_UID)) { $oAppDelegation = new AppDelegation(); $aAppDel = $oAppDelegation->getLastDeleration($APP_UID); if (isset($aAppDel)) { $oUserRow = UsersPeer::retrieveByPK($aAppDel['USR_UID']); if (isset($oUserRow)) { $sID = $oUserRow->getUsrEmail(); } else { throw new Exception('User with ID ' . $oAppDelegation->getUsrUid() . 'doesn\'t exist'); } if (G::emailAddress($sID)) { array_push($aRecipient, $sID); } } } } else { $oUserRow = UsersPeer::retrieveByPK($sID); if ($oUserRow != null) { $sID = $oUserRow->getUsrEmail(); if (G::emailAddress($sID)) { array_push($aRecipient, $sID); } } } break; case 'grp': G::LoadClass('groups'); $oGroups = new Groups(); $oCriteria = $oGroups->getUsersGroupCriteria($sID); $oDataset = GroupwfPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($oDataset->next()) { $aGroup = $oDataset->getRow(); //to validate email address if (G::emailAddress($aGroup['USR_EMAIL'])) { array_push($aRecipient, $aGroup['USR_EMAIL']); } } break; case 'dyn': $oCase = new Cases(); $aFields = $oCase->loadCase($APP_UID); $aFields['APP_DATA'] = array_merge($aFields['APP_DATA'], G::getSystemConstants()); //to validate email address if (isset($aFields['APP_DATA'][$sID]) && G::emailAddress($aFields['APP_DATA'][$sID])) { array_push($aRecipient, $aFields['APP_DATA'][$sID]); } break; } } switch ($retType) { case 'array': return $aRecipient; break; case 'string': return implode(',', $aRecipient); break; default: return $aRecipient; } }
public function sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom = "") { try { require_once 'classes/model/Configuration.php'; $oConfiguration = new Configuration(); $sDelimiter = DBAdapter::getStringDelimiter(); $oCriteria = new Criteria('workflow'); $oCriteria->add(ConfigurationPeer::CFG_UID, 'Emails'); $oCriteria->add(ConfigurationPeer::OBJ_UID, ''); $oCriteria->add(ConfigurationPeer::PRO_UID, ''); $oCriteria->add(ConfigurationPeer::USR_UID, ''); $oCriteria->add(ConfigurationPeer::APP_UID, ''); if (ConfigurationPeer::doCount($oCriteria) == 0) { $oConfiguration->create(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => '', 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => '')); $aConfiguration = array(); } else { $aConfiguration = $oConfiguration->load('Emails', '', '', '', ''); if ($aConfiguration['CFG_VALUE'] != '') { $aConfiguration = unserialize($aConfiguration['CFG_VALUE']); $passwd = $aConfiguration['MESS_PASSWORD']; $passwdDec = G::decrypt($passwd, 'EMAILENCRYPT'); $auxPass = explode('hash:', $passwdDec); if (count($auxPass) > 1) { if (count($auxPass) == 2) { $passwd = $auxPass[1]; } else { array_shift($auxPass); $passwd = implode('', $auxPass); } } $aConfiguration['MESS_PASSWORD'] = $passwd; } else { $aConfiguration = array(); } } if (!isset($aConfiguration['MESS_ENABLED']) || $aConfiguration['MESS_ENABLED'] != '1') { return false; } $oUser = new Users(); $aUser = $oUser->load($usrUid); $authorName = ($aUser['USR_FIRSTNAME'] != '' || $aUser['USR_LASTNAME'] != '' ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>'; G::LoadClass('case'); $oCase = new Cases(); $aFields = $oCase->loadCase($appUid); $configNoteNotification['subject'] = G::LoadTranslation('ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION') . " @#APP_TITLE "; $configNoteNotification['body'] = G::LoadTranslation('ID_CASE') . ": @#APP_TITLE<br />" . G::LoadTranslation('ID_AUTHOR') . ": {$authorName}<br /><br />{$noteContent}"; /* if ($sFrom == '') { $sFrom = '"ProcessMaker"'; } */ if (isset($aConfiguration['MESS_FROM_NAME']) && $aConfiguration['MESS_FROM_NAME'] != '') { $sFrom = $aConfiguration['MESS_FROM_NAME']; } $hasEmailFrom = preg_match('/(.+)@(.+)\\.(.+)/', $sFrom, $match); if (!$hasEmailFrom || strpos($sFrom, $aConfiguration['MESS_ACCOUNT']) === false) { if ($aConfiguration['MESS_ENGINE'] != 'MAIL' && $aConfiguration['MESS_ACCOUNT'] != '') { $sFrom .= ' <' . $aConfiguration['MESS_ACCOUNT'] . '>'; } else { if ($aConfiguration['MESS_ENGINE'] == 'MAIL') { $sFrom .= ' <info@' . gethostbyaddr('127.0.0.1') . '>'; } else { if ($aConfiguration['MESS_SERVER'] != '') { if ($sAux = @gethostbyaddr($aConfiguration['MESS_SERVER'])) { $sFrom .= ' <info@' . $sAux . '>'; } else { $sFrom .= ' <info@' . $aConfiguration['MESS_SERVER'] . '>'; } } else { $sFrom .= ' <*****@*****.**>'; } } } } $sSubject = G::replaceDataField($configNoteNotification['subject'], $aFields); $sBody = nl2br(G::replaceDataField($configNoteNotification['body'], $aFields)); G::LoadClass('spool'); $oUser = new Users(); $recipientsArray = explode(",", $noteRecipients); foreach ($recipientsArray as $recipientUid) { $aUser = $oUser->load($recipientUid); $sTo = ($aUser['USR_FIRSTNAME'] != '' || $aUser['USR_LASTNAME'] != '' ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>'; $oSpool = new spoolRun(); if ($aConfiguration['MESS_RAUTH'] == false || is_string($aConfiguration['MESS_RAUTH']) && $aConfiguration['MESS_RAUTH'] == 'false') { $aConfiguration['MESS_RAUTH'] = 0; } else { $aConfiguration['MESS_RAUTH'] = 1; } $oSpool->setConfig(array('MESS_ENGINE' => $aConfiguration['MESS_ENGINE'], 'MESS_SERVER' => $aConfiguration['MESS_SERVER'], 'MESS_PORT' => $aConfiguration['MESS_PORT'], 'MESS_ACCOUNT' => $aConfiguration['MESS_ACCOUNT'], 'MESS_PASSWORD' => $aConfiguration['MESS_PASSWORD'], 'SMTPAuth' => $aConfiguration['MESS_RAUTH'] == '1' ? true : false, 'SMTPSecure' => isset($aConfiguration['SMTPSecure']) ? $aConfiguration['SMTPSecure'] : '')); $oSpool->create(array('msg_uid' => '', 'app_uid' => $appUid, 'del_index' => 0, 'app_msg_type' => 'DERIVATION', 'app_msg_subject' => $sSubject, 'app_msg_from' => $sFrom, 'app_msg_to' => $sTo, 'app_msg_body' => $sBody, 'app_msg_cc' => '', 'app_msg_bcc' => '', 'app_msg_attach' => '', 'app_msg_template' => '', 'app_msg_status' => 'pending')); if ($aConfiguration['MESS_BACKGROUND'] == '' || $aConfiguration['MESS_TRY_SEND_INMEDIATLY'] == '1') { $oSpool->sendMail(); } } //Send derivation notification - End } catch (Exception $oException) { throw $oException; } }
/** * Get data of Cases OutputDocument * * @param string $applicationUid * @param string $outputDocumentUid * @param string $userUid * * return object Return an object with data of an OutputDocument */ public function addCasesOutputDocument($applicationUid, $outputDocumentUid, $userUid) { try { $sApplication = $applicationUid; $index = \AppDelegation::getCurrentIndex($applicationUid); $sUserLogged = $userUid; $outputID = $outputDocumentUid; $g = new \G(); $g->sessionVarSave(); \G::LoadClass( 'case' ); $oCase = new \Cases(); $oCase->thisIsTheCurrentUser( $sApplication, $index, $sUserLogged, '', 'casesListExtJs' ); //require_once 'classes/model/OutputDocument.php'; $oOutputDocument = new \OutputDocument(); $aOD = $oOutputDocument->load( $outputID ); $Fields = $oCase->loadCase( $sApplication ); $sFilename = preg_replace( '[^A-Za-z0-9_]', '_', \G::replaceDataField( $aOD['OUT_DOC_FILENAME'], $Fields['APP_DATA'] ) ); require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "AppFolder.php"); require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "AppDocument.php"); //Get the Custom Folder ID (create if necessary) $oFolder = new \AppFolder(); $folderId = $oFolder->createFromPath( $aOD['OUT_DOC_DESTINATION_PATH'], $sApplication ); //Tags $fileTags = $oFolder->parseTags( $aOD['OUT_DOC_TAGS'], $sApplication ); //Get last Document Version and apply versioning if is enabled $oAppDocument = new \AppDocument(); $lastDocVersion = $oAppDocument->getLastDocVersion( $outputID, $sApplication ); $oCriteria = new \Criteria( 'workflow' ); $oCriteria->add( \AppDocumentPeer::APP_UID, $sApplication ); $oCriteria->add( \AppDocumentPeer::DOC_UID, $outputID ); $oCriteria->add( \AppDocumentPeer::DOC_VERSION, $lastDocVersion ); $oCriteria->add( \AppDocumentPeer::APP_DOC_TYPE, 'OUTPUT' ); $oDataset = \AppDocumentPeer::doSelectRS( $oCriteria ); $oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC ); $oDataset->next(); if (($aOD['OUT_DOC_VERSIONING']) && ($lastDocVersion != 0)) { //Create new Version of current output $lastDocVersion ++; if ($aRow = $oDataset->getRow()) { $aFields = array ('APP_DOC_UID' => $aRow['APP_DOC_UID'],'APP_UID' => $sApplication,'DEL_INDEX' => $index,'DOC_UID' => $outputID,'DOC_VERSION' => $lastDocVersion + 1,'USR_UID' => $sUserLogged,'APP_DOC_TYPE' => 'OUTPUT','APP_DOC_CREATE_DATE' => date( 'Y-m-d H:i:s' ),'APP_DOC_FILENAME' => $sFilename,'FOLDER_UID' => $folderId,'APP_DOC_TAGS' => $fileTags); $oAppDocument = new \AppDocument(); $oAppDocument->create( $aFields ); $sDocUID = $aRow['APP_DOC_UID']; } } else { ////No versioning so Update a current Output or Create new if no exist if ($aRow = $oDataset->getRow()) { //Update $aFields = array ('APP_DOC_UID' => $aRow['APP_DOC_UID'],'APP_UID' => $sApplication,'DEL_INDEX' => $index,'DOC_UID' => $outputID,'DOC_VERSION' => $lastDocVersion,'USR_UID' => $sUserLogged,'APP_DOC_TYPE' => 'OUTPUT','APP_DOC_CREATE_DATE' => date( 'Y-m-d H:i:s' ),'APP_DOC_FILENAME' => $sFilename,'FOLDER_UID' => $folderId,'APP_DOC_TAGS' => $fileTags ); $oAppDocument = new \AppDocument(); $oAppDocument->update( $aFields ); $sDocUID = $aRow['APP_DOC_UID']; } else { //we are creating the appdocument row //create if ($lastDocVersion == 0) { $lastDocVersion ++; } $aFields = array ('APP_UID' => $sApplication,'DEL_INDEX' => $index,'DOC_UID' => $outputID,'DOC_VERSION' => $lastDocVersion,'USR_UID' => $sUserLogged,'APP_DOC_TYPE' => 'OUTPUT','APP_DOC_CREATE_DATE' => date( 'Y-m-d H:i:s' ),'APP_DOC_FILENAME' => $sFilename,'FOLDER_UID' => $folderId,'APP_DOC_TAGS' => $fileTags ); $oAppDocument = new \AppDocument(); $aFields['APP_DOC_UID'] = $sDocUID = $oAppDocument->create( $aFields ); } } $sFilename = $aFields['APP_DOC_UID'] . "_" . $lastDocVersion; $pathOutput = PATH_DOCUMENT . \G::getPathFromUID($sApplication) . PATH_SEP . 'outdocs' . PATH_SEP; //G::pr($sFilename);die; \G::mk_dir( $pathOutput ); $aProperties = array (); if (! isset( $aOD['OUT_DOC_MEDIA'] )) { $aOD['OUT_DOC_MEDIA'] = 'Letter'; } if (! isset( $aOD['OUT_DOC_LEFT_MARGIN'] )) { $aOD['OUT_DOC_LEFT_MARGIN'] = '15'; } if (! isset( $aOD['OUT_DOC_RIGHT_MARGIN'] )) { $aOD['OUT_DOC_RIGHT_MARGIN'] = '15'; } if (! isset( $aOD['OUT_DOC_TOP_MARGIN'] )) { $aOD['OUT_DOC_TOP_MARGIN'] = '15'; } if (! isset( $aOD['OUT_DOC_BOTTOM_MARGIN'] )) { $aOD['OUT_DOC_BOTTOM_MARGIN'] = '15'; } $aProperties['media'] = $aOD['OUT_DOC_MEDIA']; $aProperties['margins'] = array ('left' => $aOD['OUT_DOC_LEFT_MARGIN'],'right' => $aOD['OUT_DOC_RIGHT_MARGIN'],'top' => $aOD['OUT_DOC_TOP_MARGIN'],'bottom' => $aOD['OUT_DOC_BOTTOM_MARGIN'] ); if (isset($aOD['OUT_DOC_REPORT_GENERATOR'])) { $aProperties['report_generator'] = $aOD['OUT_DOC_REPORT_GENERATOR']; } $this->generate( $outputID, $Fields['APP_DATA'], $pathOutput, $sFilename, $aOD['OUT_DOC_TEMPLATE'], (boolean) $aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'], $aProperties , $applicationUid); //Plugin Hook PM_UPLOAD_DOCUMENT for upload document //G::LoadClass('plugin'); $oPluginRegistry = & \PMPluginRegistry::getSingleton(); if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( 'uploadDocumentData' )) { $triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT ); $aFields['APP_DOC_PLUGIN'] = $triggerDetail->sNamespace; $oAppDocument1 = new \AppDocument(); $oAppDocument1->update( $aFields ); $sPathName = PATH_DOCUMENT . \G::getPathFromUID($sApplication) . PATH_SEP; $oData['APP_UID'] = $sApplication; $oData['ATTACHMENT_FOLDER'] = true; switch ($aOD['OUT_DOC_GENERATE']) { case "BOTH": $documentData = new \uploadDocumentData( $sApplication, $sUserLogged, $pathOutput . $sFilename . '.pdf', $sFilename . '.pdf', $sDocUID, $oAppDocument->getDocVersion() ); $documentData->sFileType = "PDF"; $documentData->bUseOutputFolder = true; $uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData ); if ($uploadReturn) { //Only delete if the file was saved correctly unlink( $pathOutput . $sFilename . '.pdf' ); } $documentData = new \uploadDocumentData( $sApplication, $sUserLogged, $pathOutput . $sFilename . '.doc', $sFilename . '.doc', $sDocUID, $oAppDocument->getDocVersion() ); $documentData->sFileType = "DOC"; $documentData->bUseOutputFolder = true; $uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData ); if ($uploadReturn) { //Only delete if the file was saved correctly unlink( $pathOutput . $sFilename . '.doc' ); } break; case "PDF": $documentData = new \uploadDocumentData( $sApplication, $sUserLogged, $pathOutput . $sFilename . '.pdf', $sFilename . '.pdf', $sDocUID, $oAppDocument->getDocVersion() ); $documentData->sFileType = "PDF"; $documentData->bUseOutputFolder = true; $uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData ); if ($uploadReturn) { //Only delete if the file was saved correctly unlink( $pathOutput . $sFilename . '.pdf' ); } break; case "DOC": $documentData = new \uploadDocumentData( $sApplication, $sUserLogged, $pathOutput . $sFilename . '.doc', $sFilename . '.doc', $sDocUID, $oAppDocument->getDocVersion() ); $documentData->sFileType = "DOC"; $documentData->bUseOutputFolder = true; $uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData ); if ($uploadReturn) { //Only delete if the file was saved correctly unlink( $pathOutput . $sFilename . '.doc' ); } break; } } $g->sessionVarRestore(); $oAppDocument = \AppDocumentPeer::retrieveByPK( $aFields['APP_DOC_UID'], $lastDocVersion); if ($oAppDocument->getAppDocStatus() == 'DELETED') { $oAppDocument->setAppDocStatus('ACTIVE'); $oAppDocument->save(); } $response = $this->getCasesOutputDocument($applicationUid, $userUid, $aFields['APP_DOC_UID']); return $response; } catch (\Exception $e) { throw $e; } }
function verifyIsCaseChild($sApplicationUID) { //Obtain the related row in the table SUB_APPLICATION $oCriteria = new Criteria('workflow'); $oCriteria->add(SubApplicationPeer::APP_UID, $sApplicationUID); $oDataset = SubApplicationPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $aSA = $oDataset->getRow(); if ($aSA) { //Obtain the related row in the table SUB_PROCESS $oCase = new Cases(); $aParentCase = $oCase->loadCase($aSA['APP_PARENT'], $aSA['DEL_INDEX_PARENT']); $oCriteria = new Criteria('workflow'); $oCriteria->add(SubProcessPeer::PRO_PARENT, $aParentCase['PRO_UID']); $oCriteria->add(SubProcessPeer::TAS_PARENT, $aParentCase['TAS_UID']); $oDataset = SubProcessPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $aSP = $oDataset->getRow(); if ($aSP['SP_SYNCHRONOUS'] == 1) { $appFields = $oCase->loadCase($sApplicationUID); //Copy case variables to parent case $aFields = unserialize($aSP['SP_VARIABLES_IN']); $aNewFields = array(); foreach ($aFields as $sOriginField => $sTargetField) { $sOriginField = str_replace('@', '', $sOriginField); $sOriginField = str_replace('#', '', $sOriginField); $sTargetField = str_replace('@', '', $sTargetField); $sTargetField = str_replace('#', '', $sTargetField); $aNewFields[$sTargetField] = isset($appFields['APP_DATA'][$sOriginField]) ? $appFields['APP_DATA'][$sOriginField] : ''; } $aParentCase['APP_DATA'] = array_merge($aParentCase['APP_DATA'], $aNewFields); $oCase->updateCase($aSA['APP_PARENT'], $aParentCase); //Update table SUB_APPLICATION $oSubApplication = new SubApplication(); $oSubApplication->update(array('APP_UID' => $sApplicationUID, 'APP_PARENT' => $aSA['APP_PARENT'], 'DEL_INDEX_PARENT' => $aSA['DEL_INDEX_PARENT'], 'DEL_THREAD_PARENT' => $aSA['DEL_THREAD_PARENT'], 'SA_STATUS' => 'FINISHED', 'SA_VALUES_IN' => serialize($aNewFields), 'SA_FINISH_DATE' => date('Y-m-d H:i:s'))); //Derive the parent case $aDeriveTasks = $this->prepareInformation(array('USER_UID' => -1, 'APP_UID' => $aSA['APP_PARENT'], 'DEL_INDEX' => $aSA['DEL_INDEX_PARENT'])); if (isset($aDeriveTasks[1])) { if ($aDeriveTasks[1]['ROU_TYPE'] != 'SELECT') { $nextDelegations2 = array(); foreach ($aDeriveTasks as $aDeriveTask) { if (!isset($aDeriveTask['NEXT_TASK']['USER_ASSIGNED']['USR_UID'])) { $selectedUser = $aDeriveTask['NEXT_TASK']['USER_ASSIGNED'][0]; unset($aDeriveTask['NEXT_TASK']['USER_ASSIGNED']); $aDeriveTask['NEXT_TASK']['USER_ASSIGNED'] = $selectedUser; $myLabels = array($aDeriveTask['NEXT_TASK']['TAS_TITLE'], $aParentCase['APP_NUMBER'], $selectedUser['USR_USERNAME'], $selectedUser['USR_FIRSTNAME'], $selectedUser['USR_LASTNAME']); G::SendTemporalMessage('ID_TASK_WAS_ASSIGNED_TO_USER', 'warning', 'labels', 10, null, $myLabels); } $nextDelegations2[] = array('TAS_UID' => $aDeriveTask['NEXT_TASK']['TAS_UID'], 'USR_UID' => $aDeriveTask['NEXT_TASK']['USER_ASSIGNED']['USR_UID'], 'TAS_ASSIGN_TYPE' => $aDeriveTask['NEXT_TASK']['TAS_ASSIGN_TYPE'], 'TAS_DEF_PROC_CODE' => $aDeriveTask['NEXT_TASK']['TAS_DEF_PROC_CODE'], 'DEL_PRIORITY' => 3, 'TAS_PARENT' => $aDeriveTask['NEXT_TASK']['TAS_PARENT']); } $currentDelegation2 = array('APP_UID' => $aSA['APP_PARENT'], 'DEL_INDEX' => $aSA['DEL_INDEX_PARENT'], 'APP_STATUS' => 'TO_DO', 'TAS_UID' => $aParentCase['TAS_UID'], 'ROU_TYPE' => $aDeriveTasks[1]['ROU_TYPE']); $this->derivate($currentDelegation2, $nextDelegations2); } } } } }
/** * Function render * @author Erik A. Ortiz. * @param $value * @param $owner * @return <String> */ function render($value = NULL, $owner = NULL) { if (!$this->sqlConnection) { $this->sqlConnection = 'workflow'; } //NOTE: string functions must be in G class if ($this->strTo === 'UPPER') { $value = strtoupper($value); } if ($this->strTo === 'LOWER') { $value = strtolower($value); } //if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value); $onkeypress = G::replaceDataField($this->onkeypress, $owner->values); if ($this->replaceTags == 1) { $value = G::replaceDataField($value, $owner->values); } $aProperties = array('value' => '""', 'size' => '"' . $this->size . '"'); $storeEntry = ''; if ($this->store_new_entry) { $storeEntry = 'onchange="storeEntry(this, \'' . $this->sqlConnection . '\', \'' . $this->table . '\', \'' . $this->primary_key . '\', \'' . $this->primary_key_type . '\', \'' . $this->field . '\')"'; } $formVariableValue = ''; $formVariableKeyValue = ''; G::LoadClass('case'); $oApp = new Cases(); if (isset($_SESSION['APPLICATION']) && ($_SESSION['APPLICATION'] != null && $oApp->loadCase($_SESSION['APPLICATION']) != null)) { $aFields = $oApp->loadCase($_SESSION['APPLICATION']); if (isset($aFields['APP_DATA'][$this->name . '_label'])) { $formVariableValue = $aFields['APP_DATA'][$this->name . '_label']; $formVariableKeyValue = $aFields['APP_DATA'][$this->name]; } } if ($this->mode === 'edit') { if ($this->readOnly) { return '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->htmlentities($value, ENT_COMPAT, 'utf-8') . '\' readOnly="readOnly" style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>'; } else { // $str = '<textarea '.$storeEntry.' class="module_app_input___gray" style="height:16px" rows=1 cols="'.$this->size.'" id="form[' . $this->name . ']" name="form[' . $this->name . ']" >'.$this->htmlentities($value, ENT_COMPAT, 'utf-8').'</textarea>'; if (strlen(trim($formVariableValue)) > 0) { $value = $formVariableValue; } $name = "'" . $this->name . "'"; $str = '<input type="text" ' . $storeEntry . ' class="module_app_input___gray" size="' . $this->size . '" id="form[' . $this->name . '_label]" name="form[' . $this->name . '_label]" value="' . $this->htmlentities($value, ENT_COMPAT, 'utf-8') . '" onblur="idSet(' . $name . ');"'; $str .= $this->NSDependentFields(true) . ' '; $str .= '/>'; $str .= '<input '; $str .= 'id="form[' . $this->name . ']" '; $str .= 'name="form[' . $this->name . ']" '; $str .= 'value="' . $this->htmlentities($formVariableKeyValue, ENT_COMPAT, 'utf-8') . '" '; $str .= 'type="hidden" />'; $str .= $this->renderHint(); if (trim($this->callback) != '') { $sCallBack = 'try{' . $this->callback . '}catch(e){alert("Suggest Widget call back error: "+e)}'; } else { $sCallBack = ''; } $hash = str_rot13(base64_encode($this->sql . '@|' . $this->sqlConnection)); // $sOptions = 'script:"'.$this->ajaxServer.'?request=suggest&json=true&limit='.$this->maxresults.'&hash='.$hash.'&dependentFields='. $this->dependentFields .'&field=" + getField(\''. $this->name .'\').value + "&",'; $sSQL = $this->sql; $nCount = preg_match_all('/\\@(?:([\\@\\%\\#\\!Qq])([a-zA-Z\\_]\\w*)|([a-zA-Z\\_][\\w\\-\\>\\:]*)\\(((?:[^\\\\\\)]*?)*)\\))/', $sSQL, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE); $sResult = array(); if ($nCount) { for ($i = 0; $i < $nCount; $i++) { if (isset($match[0][$i][0]) && isset($match[2][$i][0])) { $aResult[$match[0][$i][0]] = $match[2][$i][0]; } } } $depValues = ''; $i = 1; if (isset($aResult) && $aResult) { $sResult = '"' . implode('","', $aResult) . '"'; $aResultKeys = array_keys($aResult); $sResultKeys = str_rot13(base64_encode(implode('|', $aResultKeys))); foreach ($aResult as $key => $field) { $depValues .= 'getField(\'' . $field . '\').value'; if ($i++ < count($aResult)) { $depValues .= '+"|"+'; } } $depValues = '+' . $depValues . '+'; } else { $sResult = ''; $sResultKeys = ''; $depValues = '+'; } $sOptions = 'script: function (input) {var inputValue = base64_encode(getField(\'' . $this->name . '_label\').value); return "' . $this->ajaxServer . '?request=suggest&json=true&limit=' . $this->maxresults . '&hash=' . $hash . '&dependentFieldsKeys=' . $sResultKeys . '&dependentFieldsValue="' . $depValues . '"&input="+inputValue+"&inputEnconde64=enable"; },'; $sOptions .= 'json: true,'; $sOptions .= 'limit: ' . $this->maxresults . ','; // $sOptions .= 'varname: "input",'; $sOptions .= 'shownoresults: ' . ($this->shownoresults ? 'true' : 'false') . ','; $sOptions .= 'maxresults: ' . $this->maxresults . ','; $sOptions .= 'chache: true,'; $setValue = $this->savelabel == '1' ? 'obj.value' : 'obj.id'; $sOptions .= 'callback: function(obj){' . $sCallBack . '; getField("' . $this->name . '").value = obj.id; return false;}'; $str .= '<script type="text/javascript">'; $str .= 'var as_json = new bsn.AutoSuggest(\'form[' . $this->name . '_label]\', {' . $sOptions . '});'; $str .= '</script>'; return $str; } } else { return $this->htmlentities($formVariableValue, ENT_COMPAT, 'utf-8'); } }
require_once "classes/model/Step.php"; G::LoadClass("configuration"); G::LoadClass("case"); $oCase = new Cases(); $conf = new Configurations(); $oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher->addExtJsScript('app/main', true); $oHeadPublisher->addExtJsScript('cases/open', true); $oHeadPublisher->assign('FORMATS', $conf->getFormats()); $uri = ''; foreach ($_GET as $k => $v) { $uri .= $uri == '' ? "{$k}={$v}" : "&{$k}={$v}"; } //$case = $oCase->loadCase( $_GET['APP_UID'], $_GET['DEL_INDEX'] ); if (isset($_GET['action']) && $_GET['action'] == 'jump') { $case = $oCase->loadCase($_GET['APP_UID'], $_GET['DEL_INDEX'], $_GET['action']); } else { $case = $oCase->loadCase($_GET['APP_UID'], $_GET['DEL_INDEX']); } if (!isset($_GET['to_revise'])) { $script = 'cases_Open?'; } else { $script = 'cases_OpenToRevise?'; $delIndex = $_GET['DEL_INDEX']; $appUid = $_GET['APP_UID']; $oHeadPublisher->assign('treeToReviseTitle', G::loadtranslation('ID_STEP_LIST')); $casesPanelUrl = 'casesToReviseTreeContent?APP_UID=' . $appUid . '&DEL_INDEX=' . $delIndex; $oHeadPublisher->assign('casesPanelUrl', $casesPanelUrl); //translations echo "<div id='toReviseTree'></div>"; }
/** * Function render * * @author David S. Callizaya S. <*****@*****.**> * @access public * @param string value * @return string */ public function render($value = null, $owner = null, $rowId = null, $row = -1, $therow = -1) { $permission = false; $url = null; switch ($owner->type) { case "xmlform": $pmtype = $this->NSFieldType(); break; case "grid": $pmtype = $this->NSGridType(); break; } if (isset($_SESSION["APPLICATION"]) && isset($_SESSION["USER_LOGGED"]) && isset($_SESSION["TASK"]) && isset($this->input) && $this->input != null && $this->mode == "view") { require_once "classes/model/AppDocument.php"; G::LoadClass("case"); $case = new Cases(); $arrayField = $case->loadCase($_SESSION["APPLICATION"]); $arrayPermission = $case->getAllObjects($arrayField["PRO_UID"], $_SESSION["APPLICATION"], $_SESSION["TASK"], $_SESSION["USER_LOGGED"]); $criteria = new Criteria(); $criteria->add(AppDocumentPeer::APP_DOC_UID, $arrayPermission["INPUT_DOCUMENTS"], Criteria::IN); switch ($owner->type) { case "xmlform": break; case "grid": $criteria->add(AppDocumentPeer::APP_DOC_FIELDNAME, $owner->name . "_" . $row . "_" . $this->name); break; } $criteria->addDescendingOrderByColumn(AppDocumentPeer::APP_DOC_CREATE_DATE); $rsCriteria = AppDocumentPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); $sw = 0; while ($rsCriteria->next() && $sw == 0) { $row = $rsCriteria->getRow(); if ($row["DOC_UID"] == $this->input) { $permission = true; $url = (G::is_https() ? "https://" : "http://") . $_SERVER["HTTP_HOST"] . dirname($_SERVER["REQUEST_URI"]) . "/cases_ShowDocument?a=" . $row["APP_DOC_UID"] . "&v=" . $row["DOC_VERSION"]; $sw = 1; } } } $html1 = null; $html2 = null; $mode = $this->mode == "view" ? " disabled=\"disabled\"" : null; $styleDisplay = null; if ($this->mode == "view") { if ($permission) { $html1 = "<a href=\"" . $url . "\"" . ($owner->type == "grid" ? " class=\"tableOption\" style=\"color: #006699; text-decoration: none; font-weight: normal;\"" : null) . ">"; $html2 = "</a>"; } $html1 = $html1 . $value; $styleDisplay = "display: none;"; } $html = $html1 . "<input type=\"file\" " . $pmtype . " id=\"form" . $rowId . "[" . $this->name . "]\" name=\"form" . $rowId . "[" . $this->name . "]\" value=\"" . $value . "\" class=\"module_app_input___gray_file\" style=\"" . $styleDisplay . "\"" . $mode . " " . $this->NSRequiredValue() . " />" . $html2; if (isset($this->input) && $this->input != null) { require_once "classes/model/InputDocument.php"; try { $indoc = new InputDocument(); $aDoc = $indoc->load($this->input); $aDoc["INP_DOC_TITLE"] = isset($aDoc["INP_DOC_TITLE"]) ? $aDoc["INP_DOC_TITLE"] : null; $html = $html . "<label><img src=\"/images/inputdocument.gif\" width=\"22px\" width=\"22px\" alt=\"\" /><font size=\"1\">(" . trim($aDoc["INP_DOC_TITLE"]) . ")</font></label>"; } catch (Exception $e) { //Then the input document doesn"t exits, id referencial broken $html = $html . " <font color=\"red\"><img src=\"/images/alert_icon.gif\" width=\"16px\" width=\"16px\" alt=\"\" /><font size=\"1\">(" . G::loadTranslation("ID_INPUT_DOC_DOESNT_EXIST") . ")</font></font>"; } } $html = $html . $this->renderHint(); return $html; }
public function saveDataInTable($sUID, $aFields) { try { $aData = $this->load($sUID, true); $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; $sClassName = ($aData['ADD_TAB_CLASS_NAME'] != '' ? $aData['ADD_TAB_CLASS_NAME'] : $this->getPHPName($aData['ADD_TAB_NAME'])); // $oConnection = Propel::getConnection(FieldsPeer::DATABASE_NAME); $oConnection = Propel::getConnection($aData['DBS_UID']); $stmt = $oConnection->createStatement(); require_once $sPath . $sClassName . '.php'; $sKeys = ''; $keysAutoIncrement = 0; $keyUIDAutoIncrement = ''; foreach ($aData['FIELDS'] as $aField) { if ($aField['FLD_KEY'] == 1) { if ($aField['FLD_AUTO_INCREMENT'] == 1) { if ($keysAutoIncrement == 0) { $keyUIDAutoIncrement = $aField['FLD_NAME']; } $keysAutoIncrement++; } $vValue = $aFields[$aField['FLD_NAME']]; eval('$' . $aField['FLD_NAME'] . ' = $vValue;'); $sKeys .= '$' . $aField['FLD_NAME'] . ','; } } $sKeys = substr($sKeys, 0, -1); $oClass = new $sClassName; foreach ($aFields as $sKey => $sValue) { if (!preg_match("/\(?\)/", $sKey)) { eval('$oClass->set' . $this->getPHPName($sKey) . '($aFields["' . $sKey . '"]);'); } } if ($oClass->validate()) { $iResult = $oClass->save(); if ($keysAutoIncrement == 1 && $aFields[$keyUIDAutoIncrement] == '' && isset($_SESSION['APPLICATION']) && $_SESSION['APPLICATION'] != '') { G::LoadClass('case'); $oCaseKeyAuto = new Cases(); $newId = $oClass->getId(); $aFields = $oCaseKeyAuto->loadCase($_SESSION['APPLICATION']); $aFields['APP_DATA'][$keyUIDAutoIncrement] = $newId; if (isset($_POST['form'])) { $_POST['form'][$keyUIDAutoIncrement] = $newId; } $oCaseKeyAuto->updateCase($_SESSION['APPLICATION'], $aFields); } } return true; } catch (Exception $oError) { throw($oError); } }
die('<script type="text/javascript"> parent.location = "../cases/casesStartPage?action=startCase"; </script>'); } try { if ($_GET['APP_UID'] !== $_SESSION['APPLICATION']) { throw new Exception(G::LoadTranslation('ID_INVALID_APPLICATION_ID_MSG', array('<a href=\'' . $_SERVER['HTTP_REFERER'] . '\'>{1}</a>', G::LoadTranslation('ID_REOPEN')))); } $oForm = new Form($_SESSION["PROCESS"] . "/" . $_GET["UID"], PATH_DYNAFORM); $oForm->validatePost(); //Includes G::LoadClass("case"); //Load the variables $oCase = new Cases(); $oCase->thisIsTheCurrentUser($_SESSION["APPLICATION"], $_SESSION["INDEX"], $_SESSION["USER_LOGGED"], "REDIRECT", "casesListExtJs"); $Fields = $oCase->loadCase($_SESSION["APPLICATION"]); $Fields["APP_DATA"] = array_merge($Fields["APP_DATA"], G::getSystemConstants()); $Fields["APP_DATA"] = array_merge($Fields["APP_DATA"], $_POST["form"]); #here we must verify if is a debug session $trigger_debug_session = $_SESSION['TRIGGER_DEBUG']['ISSET']; #here we must verify if is a debugg session #trigger debug routines... //cleaning debug variables $_SESSION['TRIGGER_DEBUG']['ERRORS'] = array(); $_SESSION['TRIGGER_DEBUG']['DATA'] = array(); $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = array(); $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = array(); $triggers = $oCase->loadTriggers($_SESSION['TASK'], 'DYNAFORM', $_GET['UID'], 'AFTER'); $_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] = count($triggers); $_SESSION['TRIGGER_DEBUG']['TIME'] = 'AFTER'; if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) {
$_REQUEST['DEL_INDEX'] = ''; } if ($_REQUEST['APP_UID'] == '') { throw new Exception('The parameter APP_UID is empty.'); } if ($_REQUEST['DEL_INDEX'] == '') { throw new Exception('The parameter DEL_INDEX is empty.'); } G::LoadClass('case'); G::LoadClass('pmDynaform'); $cases = new Cases(); $caseFields = $cases->loadCase(G::decrypt($_REQUEST['APP_UID'], URL_KEY),G::decrypt($_REQUEST['DEL_INDEX'], URL_KEY)); // $criteria = new Criteria(); $criteria->addSelectColumn(DynaformPeer::DYN_CONTENT); $criteria->addSelectColumn(DynaformPeer::PRO_UID); $criteria->add(DynaformPeer::DYN_UID, G::decrypt($_REQUEST['DYN_UID'], URL_KEY)); $result = DynaformPeer::doSelectRS($criteria); $result->setFetchmode(ResultSet::FETCHMODE_ASSOC); $result->next(); $configuration = $result->getRow(); $action = 'ActionsByEmailDataFormPost.php?APP_UID=' . $_REQUEST['APP_UID'] . '&DEL_INDEX=' . $_REQUEST['DEL_INDEX'] . '&ABER=' . $_REQUEST['ABER']; $record['DYN_CONTENT'] = $configuration['DYN_CONTENT']; $record['PRO_UID'] = $configuration['PRO_UID']; $record['CURRENT_DYNAFORM'] = G::decrypt($_REQUEST['DYN_UID'], URL_KEY);
if ($input->type == 'file' && $input->input == $_GET['UID'] && !empty($aAppDataFields['APP_DATA'][$kInput])) { $aAppDataFields['APP_DATA'][$kInput] = $sOriginalName; $oCase->updateCase($_GET['APP_UID'], $aAppDataFields); } } unset($input); } } unset($value); } //End Update AppData with the current file uploaded } } //go to the next step if (!isset($_POST['form']['MORE'])) { $oCase = new Cases(); $aFields = $oCase->loadCase($_GET['APP_UID']); $aNextStep = $oCase->getNextSupervisorStep($aFields['PRO_UID'], $_GET['position'], 'INPUT_DOCUMENT'); G::header('location: ' . 'cases_StepToReviseInputs?type=INPUT_DOCUMENT&INP_DOC_UID=' . $aNextStep['UID'] . '&position=' . $aNextStep['POSITION'] . '&APP_UID=' . $_GET['APP_UID'] . '&DEL_INDEX='); die; } else { G::header('location: ' . $_SERVER['HTTP_REFERER']); die; } } catch (Exception $e) { /* Render Error page */ $aMessage['MESSAGE'] = $e->getMessage(); $G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage); G::RenderPage('publish'); }
public function sendActionsByEmail($data) { try { // Validations try { if (!is_object($data)) { throw new Exception('The parameter $data is null.'); } if (!isset($data->TAS_UID)) { throw new Exception('The parameter $data->TAS_UID is null.'); } if (!isset($data->APP_UID)) { throw new Exception('The parameter $data->APP_UID is null.'); } if (!isset($data->DEL_INDEX)) { throw new Exception('The parameter $data->DEL_INDEX is null.'); } if (!isset($data->USR_UID)) { throw new Exception('The parameter $data->USR_UID is null.'); } if ($data->TAS_UID == '') { throw new Exception('The parameter $data->TAS_UID is empty.'); } if ($data->APP_UID == '') { throw new Exception('The parameter $data->APP_UID is empty.'); } if ($data->DEL_INDEX == '') { throw new Exception('The parameter $data->DEL_INDEX is empty.'); } if ($data->USR_UID == '') { throw new Exception('The parameter $data->USR_UID is empty.'); } } catch(Exception $e) { echo $e->getMessage().' Please contact to your system administrator.'; die; } G::LoadClass('pmFunctions'); $emailSetup = getEmailConfiguration(); if (!empty($emailSetup)) { require_once 'classes/model/AbeConfiguration.php'; G::LoadClass('case'); $cases = new Cases(); $caseFields = $cases->loadCase($data->APP_UID); $criteria = new Criteria(); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID); $criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_TYPE); $criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_TEMPLATE); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_DYN_TYPE); $criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_EMAIL_FIELD); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_SUBJECT_FIELD); $criteria->addSelectColumn(DynaformPeer::DYN_CONTENT); $criteria->addJoin( AbeConfigurationPeer::DYN_UID, DynaformPeer::DYN_UID, Criteria::LEFT_JOIN ); $criteria->add(AbeConfigurationPeer::PRO_UID, $caseFields['PRO_UID']); $criteria->add(AbeConfigurationPeer::TAS_UID, $data->TAS_UID); $result = AbeConfigurationPeer::doSelectRS($criteria); $result->setFetchmode(ResultSet::FETCHMODE_ASSOC); $result->next(); if ($configuration = $result->getRow()) { $configuration['ABE_EMAIL_FIELD'] = str_replace('@@', '', $configuration['ABE_EMAIL_FIELD']); if ($configuration['ABE_EMAIL_FIELD'] != '' && isset($caseFields['APP_DATA'][$configuration['ABE_EMAIL_FIELD']])) { $email = trim($caseFields['APP_DATA'][$configuration['ABE_EMAIL_FIELD']]); } else { require_once 'classes/model/Users.php'; $userInstance = new Users(); $userInfo = $userInstance->getAllInformation($data->USR_UID); $email = $userInfo['mail']; } if ($email != '') { $subject = G::replaceDataField( $configuration['ABE_SUBJECT_FIELD'], $caseFields['APP_DATA'] ); if($subject == ''){ $subject = $caseFields['APP_TITLE']; } // Create require_once 'classes/model/AbeRequests.php'; $abeRequest = array(); $abeRequest['ABE_REQ_UID'] = ''; $abeRequest['ABE_UID'] = $configuration['ABE_UID']; $abeRequest['APP_UID'] = $data->APP_UID; $abeRequest['DEL_INDEX'] = $data->DEL_INDEX; $abeRequest['ABE_REQ_SENT_TO'] = $email; $abeRequest['ABE_REQ_SUBJECT'] = $subject; $abeRequest['ABE_REQ_BODY'] = ''; $abeRequest['ABE_REQ_ANSWERED'] = 0; $abeRequest['ABE_REQ_STATUS'] = 'PENDING'; try { $abeRequestsInstance = new AbeRequests(); $abeRequest['ABE_REQ_UID'] = $abeRequestsInstance->createOrUpdate($abeRequest); } catch (Exception $error) { throw $error; } if ($configuration['ABE_TYPE'] != '') { // Email $_SESSION['CURRENT_DYN_UID'] = $configuration['DYN_UID']; $scriptCode = ''; // foreach ($dynaform->fields as $fieldName => $field) { // if ($field->type == 'submit') { // unset($dynaform->fields[$fieldName]); // } // } $__ABE__ = ''; $link = (G::is_https() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/ActionsByEmail'; switch ($configuration['ABE_TYPE']) { case 'LINK': // $__ABE__ .= $dynaform->render(PATH_FEATURES . 'actionsByEmail/xmlform.html', $scriptCode) . '<br />'; $__ABE__ .= '<a href="' . $link . 'DataForm?APP_UID=' . G::encrypt($data->APP_UID, URL_KEY) . '&DEL_INDEX=' . G::encrypt($data->DEL_INDEX, URL_KEY) . '&DYN_UID=' . G::encrypt($configuration['DYN_UID'], URL_KEY) . '&ABER=' . G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY) . '" target="_blank">Please complete this form</a>'; break; // coment case 'FIELD': $variableService = new \ProcessMaker\Services\Api\Project\Variable(); $variables = $variableService->doGetVariables($caseFields['PRO_UID']); $field = new stdClass(); $field->label = 'Test'; $field->type = 'dropdown'; $field->options = array(); $actionField = str_replace('@@', '', $configuration['ABE_ACTION_FIELD']); $dynaform = $configuration['DYN_UID']; $variables = G::json_decode($configuration['DYN_CONTENT'], true); if(isset($variables['items'][0]['items'])){ $fields = $variables['items'][0]['items']; foreach ($fields as $key => $value) { foreach($value as $var){ G::pr($var); if(isset($var['variable'])){ if ($var['variable'] == $actionField) { $field->label = $var['label']; $field->type = $var['type']; $values = $var['options']; foreach ($values as $val){ $field->options[$val['value']] = $val['value']; } } } } } } G::LoadClass('pmDynaform'); $obj = new pmDynaform($configuration['DYN_UID']); $configuration['CURRENT_DYNAFORM'] = $configuration['DYN_UID']; $file = $obj->printPmDynaformAbe($configuration); $__ABE__ .= $file; $__ABE__ .= '<strong>' . $field->label . '</strong><br /><table align="left" border="0"><tr>'; switch ($field->type) { case 'dropdown': case 'radiogroup': $index = 1; $__ABE__.='<br /><td><table align="left" cellpadding="2"><tr>'; foreach ($field->options as $optValue => $optName) { $__ABE__ .= '<td align="center"><a style="text-decoration: none; color: #000; background-color: #E5E5E5; '; $__ABE__ .= 'filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#EFEFEF, endColorstr=#BCBCBC); '; $__ABE__ .= 'background-image: -webkit-gradient(linear, left top, left bottom, from(#EFEFEF), #BCBCBC); '; $__ABE__ .= 'background-image: -webkit-linear-gradient(top, #EFEFEF, #BCBCBC); '; $__ABE__ .= 'background-image: -moz-linear-gradient(top, #EFEFEF, #BCBCBC); background-image: -ms-linear-gradient(top, #EFEFEF, #BCBCBC); '; $__ABE__ .= 'background-image: -o-linear-gradient(top, #EFEFEF, #BCBCBC); border: 1px solid #AAAAAA; '; $__ABE__ .= 'border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); '; $__ABE__ .= 'font-family: Arial,serif; font-size: 9pt; font-weight: 400; line-height: 14px; margin: 2px 0; padding: 2px 7px; '; $__ABE__ .= 'text-decoration: none; text-transform: capitalize;" href="' .urldecode(urlencode($link)). '?ACTION='.G::encrypt('processABE', URL_KEY).'&APP_UID='; $__ABE__ .= G::encrypt($data->APP_UID, URL_KEY) . '&DEL_INDEX=' . G::encrypt($data->DEL_INDEX, URL_KEY); $__ABE__ .= '&FIELD=' . G::encrypt($actionField, URL_KEY) . '&VALUE=' . G::encrypt($optValue, URL_KEY); $__ABE__ .= '&ABER=' . G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY) . '" target="_blank" >' . $optName; $__ABE__ .= '</a></td>' . (($index % 5 == 0) ? '</tr><tr>' : ' '); $index++; } $__ABE__.='</tr></table></td>'; break; case 'yesno': $__ABE__ .= '<td align="center"><a href="' . $link . 'dataField?APP_UID=' . urlencode(G::encrypt($data->APP_UID, URL_KEY)) . '&DEL_INDEX=' . urlencode(G::encrypt($data->DEL_INDEX, URL_KEY)). '&FIELD=' . urlencode(G::encrypt($actionField, URL_KEY)) . '&VALUE=' . urlencode(G::encrypt(1, URL_KEY)) . '&ABER=' . urlencode(G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY)) . '" target="_blank">' . G::LoadTranslation('ID_YES_VALUE') . '</a></td>'; $__ABE__ .= '<td align="center"><a href="' . $link . 'dataField?APP_UID=' . urlencode(G::encrypt($data->APP_UID, URL_KEY)) . '&DEL_INDEX=' . urlencode(G::encrypt($data->DEL_INDEX, URL_KEY)) . '&FIELD=' . urlencode(G::encrypt($actionField, URL_KEY)) . '&VALUE=' . urlencode(G::encrypt(0, URL_KEY)) . '&ABER=' . urlencode(G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY)) . '" target="_blank">' . G::LoadTranslation('ID_NO_VALUE') . '</a></td>'; break; case 'checkbox': $__ABE__ .= '<td align="center"><a href="' . $link . 'dataField?APP_UID=' . G::encrypt($data->APP_UID, URL_KEY) . '&DEL_INDEX=' . G::encrypt($data->DEL_INDEX, URL_KEY) . '&FIELD=' . G::encrypt($actionField, URL_KEY) . '&VALUE=' . G::encrypt($field->value, URL_KEY) . '&ABER=' . G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY) . '" target="_blank">Check</a></td>'; $__ABE__ .= '<td align="center"><a href="' . $link . 'dataField?APP_UID=' . G::encrypt($data->APP_UID, URL_KEY) . '&DEL_INDEX=' . G::encrypt($data->DEL_INDEX, URL_KEY) . '&FIELD=' . G::encrypt($actionField, URL_KEY) . '&VALUE=' . G::encrypt($field->value, URL_KEY) . '&ABER=' . G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY) . '" target="_blank">Uncheck</a></td>'; break; } $__ABE__ .= '</tr></table>'; break; } $__ABE__ = preg_replace('/\<img src=\"\/js\/maborak\/core\/images\/(.+?)\>/', '' , $__ABE__); $__ABE__ = preg_replace('/\<input\b[^>]*\/>/', '' , $__ABE__); $__ABE__ = preg_replace('/<select\b[^>]*>(.*?)<\/select>/is', "", $__ABE__); $__ABE__ = preg_replace('/align=\"center\"/', '' , $__ABE__); $__ABE__ = preg_replace('/class="tableGrid_view" /', 'class="tableGrid_view" width="100%" ', $__ABE__); $caseFields['APP_DATA']['__ABE__'] = $__ABE__; G::LoadClass("Users"); $user = new Users(); $userDetails = $user->loadDetails($data->PREVIOUS_USR_UID); $emailFrom = $userDetails["USR_EMAIL"]; G::LoadClass('wsBase'); $wsBaseInstance = new wsBase(); $result = $wsBaseInstance->sendMessage($data->APP_UID, $emailFrom, $email, '', '', $subject, $configuration['ABE_TEMPLATE'], $caseFields['APP_DATA'], ''); $abeRequest['ABE_REQ_STATUS'] = ($result->status_code == 0 ? 'SENT' : 'ERROR'); $body = ''; $messageSent = executeQuery('SELECT `APP_MSG_BODY` FROM `APP_MESSAGE` ORDER BY `APP_MSG_SEND_DATE` DESC LIMIT 1'); if (!empty($messageSent) && is_array($messageSent)) { $body = $messageSent[1]['APP_MSG_BODY']; } $abeRequest['ABE_REQ_BODY'] = $body; // Update try { $abeRequestsInstance = new AbeRequests(); $abeRequestsInstance->createOrUpdate($abeRequest); } catch (Exception $error) { throw $error; } } } } } } catch (Exception $error) { throw $error; } }
public function getActionOptions() { $APP_UID = $_SESSION['APPLICATION']; $c = new Criteria('workflow'); $c->clearSelectColumns(); $c->addSelectColumn(AppThreadPeer::APP_THREAD_PARENT); $c->add(AppThreadPeer::APP_UID, $APP_UID); $c->add(AppThreadPeer::APP_THREAD_STATUS, 'OPEN'); $cant = AppThreadPeer::doCount($c); $oCase = new Cases(); $aFields = $oCase->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX']); global $RBAC; $options = array(); switch ($aFields['APP_STATUS']) { case 'DRAFT': if (!AppDelay::isPaused($_SESSION['APPLICATION'], $_SESSION['INDEX'])) { $options[] = array('text' => G::LoadTranslation('ID_PAUSED_CASE'), 'fn' => 'setUnpauseCaseDate'); } else { $options[] = array('text' => G::LoadTranslation('ID_UNPAUSE'), 'fn' => 'unpauseCase'); } $options[] = array('text' => G::LoadTranslation('ID_DELETE'), 'fn' => 'deleteCase'); if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1) { $options[] = array('text' => G::LoadTranslation('ID_REASSIGN'), 'fn' => 'getUsersToReassign'); } break; case 'TO_DO': if (!AppDelay::isPaused($_SESSION['APPLICATION'], $_SESSION['INDEX'])) { $options[] = array('text' => G::LoadTranslation('ID_PAUSED_CASE'), 'fn' => 'setUnpauseCaseDate'); if ($cant == 1) { if ($RBAC->userCanAccess('PM_CANCELCASE') == 1) { $options[] = array('text' => G::LoadTranslation('ID_CANCEL'), 'fn' => 'cancelCase'); } else { $options[] = array('text' => G::LoadTranslation('ID_CANCEL'), 'fn' => 'cancelCase', 'hide' => 'hiden'); } } } else { $options[] = array('text' => G::LoadTranslation('ID_UNPAUSE'), 'fn' => 'unpauseCase'); } if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1) { $options[] = array('text' => G::LoadTranslation('ID_REASSIGN'), 'fn' => 'getUsersToReassign'); } break; case 'CANCELLED': $options[] = array('text' => G::LoadTranslation('ID_REACTIVATE'), 'fn' => 'reactivateCase'); break; } if ($_SESSION['TASK'] != '-1') { $oTask = new Task(); $aTask = $oTask->load($_SESSION['TASK']); if ($aTask['TAS_TYPE'] == 'ADHOC') { $options[] = array('text' => G::LoadTranslation('ID_ADHOC_ASSIGNMENT'), 'fn' => 'adhocAssignmentUsers'); } } return $options; }
$aFields['FILE2'] = 'cases_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=pdf&random=' . rand(); $G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_ViewAnyOutputDocument', '', G::array_merges($aOD, $aFields), ''); G::RenderPage('publish', 'raw'); break; case 'showDynaformList': $oCase = new Cases(); global $G_PUBLISH; $G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent('propeltable', 'paged-table', 'cases/cases_AllDynaformsList', $oCase->getallDynaformsCriteria($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['TASK'], $_SESSION['USER_LOGGED'])); G::RenderPage('publish', 'raw'); break; case 'showDynaform': $G_PUBLISH = new Publisher(); $oCase = new Cases(); $Fields = $oCase->loadCase($_SESSION['APPLICATION']); $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = ''; $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = ''; $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP'] = '#'; $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_ACTION'] = 'return false;'; if (isset($_POST['DYN_UID'])) { $_SESSION['DYN_UID_PRINT'] = $_POST['DYN_UID']; } else { $_SESSION['DYN_UID_PRINT'] = $_REQUEST['DYN_UID']; } if (!isset($_SESSION['CURRENT_DYN_UID'])) { $_SESSION['CURRENT_DYN_UID'] = $_POST['DYN_UID'] ? $_POST['DYN_UID'] : $_REQUEST['DYN_UID']; } $G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_REQUEST['DYN_UID'], '', $Fields['APP_DATA'], '', '', 'view'); G::RenderPage('publish', 'blank'); break;
function createAppEvents($PRO_UID, $APP_UID, $DEL_INDEX, $TAS_UID) { $aRows = array(); $aEventsRows = $this->getBy($PRO_UID, array('TAS_UID' => $TAS_UID)); if ($aEventsRows !== false) { $aRows = array_merge($aRows, $aEventsRows); } $aEventsRows = $this->getBy($PRO_UID, array('EVN_TAS_UID_FROM' => $TAS_UID)); if ($aEventsRows !== false) { $aRows = array_merge($aRows, $aEventsRows); } foreach ($aRows as $aData) { // if the events has a condition if (trim($aData['EVN_CONDITIONS']) != '') { G::LoadClass('case'); $oCase = new Cases(); $aFields = $oCase->loadCase($APP_UID); $Fields = $aFields['APP_DATA']; $conditionContents = trim($aData['EVN_CONDITIONS']); //$sContent = G::unhtmlentities($sContent); $iAux = 0; $iOcurrences = preg_match_all('/\\@(?:([\\>])([a-zA-Z\\_]\\w*)|([a-zA-Z\\_][\\w\\-\\>\\:]*)\\(((?:[^\\\\\\)]*(?:[\\\\][\\w\\W])?)*)\\))((?:\\s*\\[[\'"]?\\w+[\'"]?\\])+)?/', $conditionContents, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE); if ($iOcurrences) { for ($i = 0; $i < $iOcurrences; $i++) { preg_match_all('/@>' . $aMatch[2][$i][0] . '([\\w\\W]*)' . '@<' . $aMatch[2][$i][0] . '/', $conditionContents, $aMatch2, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE); $sGridName = $aMatch[2][$i][0]; $sStringToRepeat = $aMatch2[1][0][0]; if (isset($Fields[$sGridName])) { if (is_array($Fields[$sGridName])) { $sAux = ''; foreach ($Fields[$sGridName] as $aRow) { $sAux .= G::replaceDataField($sStringToRepeat, $aRow); } } } $conditionContents = str_replace('@>' . $sGridName . $sStringToRepeat . '@<' . $sGridName, $sAux, $conditionContents); } } $sCondition = G::replaceDataField($conditionContents, $Fields); $evalConditionResult = false; $sCond = 'try{ $evalConditionResult=(' . $sCondition . ')? true: false; } catch(Exception $e){$evalConditionResult=false;}'; @eval($sCond); if (!$evalConditionResult) { continue; } } $appEventData['APP_UID'] = $APP_UID; $appEventData['DEL_INDEX'] = $DEL_INDEX; $appEventData['EVN_UID'] = $aData['EVN_UID']; $appEventData['APP_EVN_ACTION_DATE'] = $this->toCalculateTime($aData); $appEventData['APP_EVN_ATTEMPTS'] = 3; $appEventData['APP_EVN_LAST_EXECUTION_DATE'] = null; $appEventData['APP_EVN_STATUS'] = 'OPEN'; $oAppEvent = new AppEvent(); $oAppEvent->create($appEventData); } }
//if the application exists but the if (is_null( $_GET['DEL_INDEX'] )) { G::SendMessageText( G::LoadTranslation( 'ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER' ), 'info' ); G::header( 'location: casesListExtJs' ); exit(); } //wrong implemented, need refactored //$participated = $oCase->userParticipatedInCase($_GET['APP_UID'], $_SESSION['USER_LOGGED']); ??????? } $sAppUid = $_GET['APP_UID']; $iDelIndex = $_GET['DEL_INDEX']; $_action = isset( $_GET['action'] ) ? $_GET['action'] : ''; //loading application data $aFields = $oCase->loadCase( $sAppUid, $iDelIndex ); // g::pr($aFields); // die; if (!isset($_SESSION['CURRENT_TASK'])) { $_SESSION['CURRENT_TASK'] = $aFields['TAS_UID']; } else if ($_SESSION['CURRENT_TASK'] == '') { $_SESSION['CURRENT_TASK'] = $aFields['TAS_UID']; } switch ($aFields['APP_STATUS']) { case 'DRAFT': case 'TO_DO': //check if the case is in pause, check a valid record in table APP_DELAY if (AppDelay::isPaused( $sAppUid, $iDelIndex )) { //the case is paused show only the resume $_SESSION['APPLICATION'] = $sAppUid; $_SESSION['INDEX'] = $iDelIndex;
if ($sUser != '') { $c++; $oCase->reassignCase($_POST['APPLICATIONS'][$sKey], $_POST['INDEXES'][$sKey], $_POST['USR_UID'], $sUser); $aCases[] = $_POST['APPLICATIONS'][$sKey]; $aUsers[] = $sUser; } } } } G::LoadClass('case'); $oCase = new Cases(); require_once 'classes/model/Users.php'; $oUser = new Users(); $sText = ''; foreach ($aCases as $sKey => $sCase) { $aCase = $oCase->loadCase($sCase); $aUser = $oUser->load($aUsers[$sKey]); $sText .= $aCase['TITLE'] . ' => ' . $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' (' . $aUser['USR_USERNAME'] . ')' . '<br />'; } $G_MAIN_MENU = 'processmaker'; $G_SUB_MENU = 'users'; $G_ID_MENU_SELECTED = 'USERS'; $G_ID_SUB_MENU_SELECTED = 'USERS'; $G_PUBLISH = new Publisher(); $aMessage['USR_UID'] = $_POST['USR_UID']; $aMessage['MESSAGE'] = $sText; if ($_POST['CONT'] != $c) { $aMessage['EVA'] = G::LoadTranslation('ID_CASESREASSIGN'); } else { $aMessage['EVA'] = ''; }