function postNote($httpData) { //extract(getExtJSParams()); $appUid = isset($httpData->appUid) ? $httpData->appUid : ''; $usrUid = isset($httpData->usrUid) ? $httpData->usrUid : ''; require_once "classes/model/AppNotes.php"; $appNotes = new AppNotes(); $noteContent = addslashes($httpData->noteText); $result = $appNotes->postNewNote($appUid, $usrUid, $noteContent, false); //return true; //die(); //send the response to client @ini_set('implicit_flush', 1); ob_start(); //echo G::json_encode($result); @ob_flush(); @flush(); @ob_end_flush(); ob_implicit_flush(1); //return true; //send notification in background $noteRecipientsList = array(); G::LoadClass('case'); $oCase = new Cases(); $p = $oCase->getUsersParticipatedInCase($appUid); foreach ($p['array'] as $key => $userParticipated) { $noteRecipientsList[] = $key; } $noteRecipients = implode(",", $noteRecipientsList); $appNotes->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { // check if user has permissions to createSecuences if (Yii::app()->user->checkAccess('createSecuences')) { // create secuences object $model = new Secuences(); // find case parent $cases = Cases::model()->findByPk((int) $_GET['owner']); // output message $returnMessage = null; // verify Secuences form exist if (isset($_POST['Secuences'])) { // set form elements to Secuences model attributes $model->attributes = $_POST['Secuences']; // validate and save if ($model->save()) { // save log $attributes = array('log_date' => date("Y-m-d G:i:s"), 'log_activity' => 'SecuenceCreated', 'log_resourceid' => $model->case_id, 'log_type' => Logs::LOG_CREATED, 'user_id' => Yii::app()->user->id, 'module_id' => 'cases', 'project_id' => $model->Cases->project_id); Logs::model()->saveLog($attributes); $returnMessage = Yii::t('secuences', 'successMessage'); // create new secuence model for clear inputs form $model = new Secuences(); } else { $returnMessage = Yii::t('secuences', 'errorMessage'); } } // output create page $this->render('create', array('model' => $model, 'types' => SecuenceTypes::model()->findAll(), 'cases' => $cases, 'returnMessage' => $returnMessage)); } else { throw new CHttpException(403, Yii::t('site', '403_Error')); } }
public function init() { $cases = Cases::all(); $aboutme = AboutMe::all(); $view = new View('Home', [], [], array('header', 'home'), [$cases, $aboutme]); $view->render(); }
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 deleteCase($params) { $ainfoCase = array(); try { $applicationUID = isset($_POST['APP_UID']) ? $_POST['APP_UID'] : $_SESSION['APPLICATION']; $app = new Application(); $caseData = $app->load($applicationUID); $data['APP_NUMBER'] = $caseData['APP_NUMBER']; $oCase = new Cases(); $oCase->removeCase($applicationUID); $this->success = true; $this->msg = G::LoadTranslation('ID_CASE_DELETED_SUCCESSFULLY', SYS_LANG, $data); } catch (Exception $e) { $this->success = false; $this->msg = $e->getMessage(); } }
/** * @return array * @access public * * @param string $msg_uid {@min 1}{@max 32} * @param string $app_uid {@min 1}{@max 32} * * @url GET /process/case/:app_uid/message/:msg_uid/view */ public function getViewMessages($app_uid, $msg_uid) { try { $oMobile = new \ProcessMaker\BusinessModel\Light\Tracker(); $Fields = \Cases::getHistoryMessagesTrackerView($app_uid, $msg_uid); $response = $oMobile->parserMessages($Fields); //$response = $oMobile->messages($pro_uid, $app_uid); } catch (\Exception $e) { throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } return $response; }
public function actionEditProcess() { try { $post = StringHelper::filterArrayString($_POST); $result = Cases::model()->edit($_POST); if ($result == 1) { Yii::app()->user->setFlash('success', 'Cập nhật dữ liệu thành công !'); $this->redirect(Yii::app()->createUrl('case/edit', array('id' => $post['id']))); } else { if ($result == 2) { Yii::app()->user->setFlash('error', 'Cập nhật dữ liệu thất bại !'); $this->redirect(Yii::app()->createUrl('case/edit', array('id' => $post['id']))); } else { Yii::app()->user->setFlash('error', 'Không tồn tại tài liệu !'); $this->redirect(Yii::app()->createUrl('case/edit', array('id' => $post['id']))); } } } catch (Exception $ex) { var_dump($ex->getMessage()); } }
/** * Generate data * * return void */ public function generateData() { try { G::LoadClass("case"); AppAssignSelfServiceValuePeer::doDeleteAll(); //Delete all records //Generate data $case = new Cases(); $criteria = new Criteria("workflow"); $criteria->addSelectColumn(AppDelegationPeer::APP_UID); $criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); $criteria->addSelectColumn(ApplicationPeer::APP_DATA); $criteria->addSelectColumn(AppDelegationPeer::PRO_UID); $criteria->addSelectColumn(TaskPeer::TAS_UID); $criteria->addSelectColumn(TaskPeer::TAS_GROUP_VARIABLE); $criteria->addJoin(AppDelegationPeer::APP_UID, ApplicationPeer::APP_UID, Criteria::LEFT_JOIN); $criteria->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN); $criteria->add(TaskPeer::TAS_ASSIGN_TYPE, "SELF_SERVICE", Criteria::EQUAL); $criteria->add(TaskPeer::TAS_GROUP_VARIABLE, "", Criteria::NOT_EQUAL); $criteria->add(AppDelegationPeer::USR_UID, "", Criteria::EQUAL); $criteria->add(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN", Criteria::EQUAL); $rsCriteria = AppDelegationPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $applicationData = $case->unserializeData($row["APP_DATA"]); $taskGroupVariable = trim($row["TAS_GROUP_VARIABLE"], " @#"); if ($taskGroupVariable != "" && isset($applicationData[$taskGroupVariable])) { $dataVariable = $applicationData[$taskGroupVariable]; $dataVariable = is_array($dataVariable) ? $dataVariable : trim($dataVariable); if (!empty($dataVariable)) { $this->create($row["APP_UID"], $row["DEL_INDEX"], array("PRO_UID" => $row["PRO_UID"], "TAS_UID" => $row["TAS_UID"], "GRP_UID" => serialize($dataVariable))); } } } } catch (Exception $e) { throw $e; } }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { if (Yii::app()->user->checkAccess('createValidations')) { $model = new Validations(); $cases = Cases::model()->findByPk($_GET['owner']); $returnMessage = null; if (isset($_POST['Validations'])) { $model->attributes = $_POST['Validations']; if ($model->save()) { // Guardar log $attributes = array('log_date' => date("Y-m-d G:i:s"), 'log_activity' => 'ValidationCreated', 'log_resourceid' => $model->case_id, 'log_type' => Logs::LOG_CREATED, 'user_id' => Yii::app()->user->id, 'module_id' => 'cases', 'project_id' => $model->Cases->project_id); Logs::model()->saveLog($attributes); //$this->redirect(Yii::app()->createUrl('secuences/create', array('owner'=>$cases->case_id))); $returnMessage = "Validation was succefully created."; $model = new Validations(); } } $this->render('create', array('model' => $model, 'cases' => $cases, 'returnMessage' => $returnMessage)); } else { throw new CHttpException(403, Yii::t('site', '403_Error')); } }
function startCase() { G::LoadClass('case'); G::LoadSystem('inputfilter'); $filter = new InputFilter(); $_POST = $filter->xssFilterHard($_POST); $_REQUEST = $filter->xssFilterHard($_REQUEST); $_SESSION = $filter->xssFilterHard($_SESSION); /* GET , POST & $_SESSION Vars */ /* unset any variable, because we are starting a new case */ if (isset($_SESSION['APPLICATION'])) { unset($_SESSION['APPLICATION']); } if (isset($_SESSION['PROCESS'])) { unset($_SESSION['PROCESS']); } if (isset($_SESSION['TASK'])) { unset($_SESSION['TASK']); } if (isset($_SESSION['INDEX'])) { unset($_SESSION['INDEX']); } if (isset($_SESSION['STEP_POSITION'])) { unset($_SESSION['STEP_POSITION']); } /* Process */ try { $oCase = new Cases(); lookinginforContentProcess($_POST['processId']); $aData = $oCase->startCase($_REQUEST['taskId'], $_SESSION['USER_LOGGED']); $aData = $filter->xssFilterHard($aData); $_SESSION['APPLICATION'] = $aData['APPLICATION']; $_SESSION['INDEX'] = $aData['INDEX']; $_SESSION['PROCESS'] = $aData['PROCESS']; $_SESSION['TASK'] = $_REQUEST['taskId']; $_SESSION['STEP_POSITION'] = 0; $_SESSION['CASES_REFRESH'] = true; /*----------------------------------********---------------------------------*/ $oCase = new Cases(); $aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']); $aNextStep['PAGE'] = 'open?APP_UID=' . $aData['APPLICATION'] . '&DEL_INDEX=' . $aData['INDEX'] . '&action=draft'; $_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep; $aData['openCase'] = $aNextStep; $aData['status'] = 'success'; print G::json_encode($aData); } catch (Exception $e) { $aData['status'] = 'failure'; $aData['message'] = $e->getMessage(); print_r(G::json_encode($aData)); } }
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); G::header( 'location: ../login/login' ); break; case - 1: default: G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); G::header( 'location: ../login/login' ); break; } } /* Includes */ require_once 'classes/model/AppDelay.php'; G::LoadClass( 'case' ); $oCase = new Cases(); //cleaning the case session data Cases::clearCaseSessionData(); try { //Loading data for a Jump request if (! isset( $_GET['APP_UID'] ) && isset( $_GET['APP_NUMBER'] )) { $_GET['APP_UID'] = $oCase->getApplicationUIDByNumber( $_GET['APP_NUMBER'] ); $_GET['DEL_INDEX'] = $oCase->getCurrentDelegation( $_GET['APP_UID'], $_SESSION['USER_LOGGED'] ); //if the application doesn't exist if (is_null( $_GET['APP_UID'] )) { G::SendMessageText( G::LoadTranslation( 'ID_CASE_DOES_NOT_EXISTS' ), 'info' ); G::header( 'location: casesListExtJs' ); exit();
//krumo($_POST); $G_PUBLISH = new Publisher(); $Fields['DOC_UID'] = $_POST['docID']; $Fields['APP_DOC_UID'] = $_POST['appDocId']; $G_PUBLISH->AddContent('propeltable', 'paged-table', 'cases/cases_InputdocsListHistory', $oCase->getInputDocumentsCriteria($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_POST['docID'], $_POST['appDocId']), array()); //$aFields //$G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', // '', $Fields, 'cases_SaveDocument?UID=' . $_POST['docID']); G::RenderPage('publish', 'raw'); break; case "getCountCasesFolder": //$json = new Services_JSON(); $aTypes = array('to_do', 'draft', 'cancelled', 'sent', 'paused', 'completed', 'selfservice', 'to_revise', 'to_reassign'); $aTypesID = array('to_do' => 'CASES_INBOX', 'draft' => 'CASES_DRAFT', 'cancelled' => 'CASES_CANCELLED', 'sent' => 'CASES_SENT', 'paused' => 'CASES_PAUSED', 'completed' => 'CASES_COMPLETED', 'selfservice' => 'CASES_SELFSERVICE', 'to_revise' => 'CASES_TO_REVISE', 'to_reassign' => 'CASES_TO_REASSIGN'); if (!isset($_POST['A'])) { $oCases = new Cases(); $aCount = $oCases->getAllConditionCasesCount($aTypes, true); echo Bootstrap::json_encode($aCount); } else { echo Bootstrap::json_encode($aTypesID); } break; case "previusJump": //require_once 'classes/model/Application.php'; $oCriteria = new Criteria('workflow'); $response = array("success" => true); $oCriteria->add(ApplicationPeer::APP_NUMBER, $_POST['appNumber']); $oDataset = ApplicationPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $aApplication = $oDataset->getRow();
G::header('location: ../login/login'); die; break; case -1: G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header('location: ../login/login'); die; break; } if (isset($_POST['form']['BTN_CANCEL'])) { header("Location: ../cases/main"); die; } /* Includes */ G::LoadClass('case'); $oCase = new Cases(); $sAppUid = $_SESSION['APPLICATION']; $iDelIndex = $_SESSION['INDEX']; $oAppDelegation = new AppDelegation(); $aDelegation = $oAppDelegation->load($sAppUid, $iDelIndex); //if there are no user in the delegation row, this case is still in selfservice if ($aDelegation['USR_UID'] == "") { $oCase->setCatchUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED']); } else { G::SendMessageText(G::LoadTranslation('ID_CASE_ALREADY_DERIVATED'), 'error'); } die('<script type="text/javascript"> if (window.parent.frames.length != 0) { parent.location = "open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=unassigned"; } else {
/** * Creates a new model. */ public function actionCreate() { // create Comments Object $model = new Comments(); // if Comments form exist if (isset($_POST['Comments'])) { // set form elements to Comments model attributes $model->attributes = $_POST['Comments']; $module = Modules::model()->find(array('condition' => 't.module_name = :module_name', 'params' => array(':module_name' => $model->module_id))); // set module_id finded to model $model->module_id = $module->module_id; $project = Yii::app()->user->getState('project_selected'); $model->project_id = $project; // validate and save if ($model->save()) { // create an instance of file uploaded $image = CUploadedFile::getInstancesByName('Comment'); // if file upload exist if (count($image > 0)) { // for each file uploaded for ($i = 0; $i < count($image); $i++) { // create an Document object $modeldocs = new Documents(); $modeldocs->image = $image[$i]; if (!$modeldocs->image->getError()) { // name is formed by date(day+month+year+hour+minutes+seconds+dayofyear+microtime()) $this->tmpFileName = str_replace(" ", "", date('dmYHis-z-') . microtime()); // set the extension file uploaded $extension = $modeldocs->image->getExtensionName(); // if no error saving file if ($modeldocs->image->saveAs(self::FOLDERIMAGES . $this->tmpFileName . '.' . $extension)) { $modeldocs->project_id = $project; $modeldocs->document_name = substr($modeldocs->image->getName(), 0, 30); $modeldocs->document_description = $model->comment_text; $modeldocs->document_path = self::FOLDERIMAGES . $this->tmpFileName . '.' . $extension; $modeldocs->document_revision = '1'; $modeldocs->document_uploadDate = date("Y-m-d"); $modeldocs->document_type = $modeldocs->image->getType(); $modeldocs->document_baseRevision = date('dmYHis'); $modeldocs->user_id = Yii::app()->user->id; $modeldocs->comment_id = $model->primaryKey; // save file uploaded as document if ($modeldocs->save()) { Yii::app()->user->setFlash('CommentMessageSuccess', $modeldocs->image->getName() . " " . Yii::t('comments', 'UploadOk')); } else { Yii::app()->user->setFlash('CommentMessage', $modeldocs->getErrors()); } } else { Yii::app()->user->setFlash('CommentMessage', $modeldocs->image->getName() . " " . Yii::t('comments', 'UploadError')); } } else { Yii::app()->user->setFlash('CommentMessage', $modeldocs->image->error . " " . Yii::t('comments', 'UploadCheckErrors')); } } } // save log $attributes = array('log_date' => date("Y-m-d G:i:s"), 'log_activity' => 'CommentPosted', 'log_resourceid' => $model->comment_resourceid, 'log_type' => Logs::LOG_COMMENTED, 'log_commentid' => $model->primaryKey, 'user_id' => Yii::app()->user->id, 'module_id' => $module->module_name, 'project_id' => $project); Logs::model()->saveLog($attributes); // find project managers to sent comment via mail $recipientsList = array(); $ProjectManagers = Projects::model()->findManagersByProject($project); $managersArray = array(); foreach ($ProjectManagers as $manager) { $managersArray['email'] = $manager->user_email; $managersArray['name'] = $manager->CompleteName; array_push($recipientsList, $managersArray); } // find task owners to send comment via mail if ($module->module_name == 'tasks') { $collaborators = Projects::model()->findAllUsersByProject($project); $ColaboratorsArray = array(); foreach ($collaborators as $colaborator) { $ColaboratorsArray['email'] = $colaborator->user_email; $ColaboratorsArray['name'] = $colaborator->CompleteName; // avoid to repeat email address if (!in_array($ColaboratorsArray, $recipientsList)) { array_push($recipientsList, $ColaboratorsArray); } } } // finding resource title switch ($module->module_name) { case "budgets": $resourceModelTitle = Budgets::model()->findByPk($model->comment_resourceid)->budget_title; break; case "invoices": $resourceModelTitle = Invoices::model()->findByPk($model->comment_resourceid)->invoice_number; break; case "expenses": $resourceModelTitle = Expenses::model()->findByPk($model->comment_resourceid)->expense_name; break; case "documents": $resourceModelTitle = Documents::model()->findByPk($model->comment_resourceid)->document_name; break; case "milestones": $resourceModelTitle = Milestones::model()->findByPk($model->comment_resourceid)->milestone_title; break; case "cases": $resourceModelTitle = Cases::model()->findByPk($model->comment_resourceid)->case_name; break; case "tasks": $resourceModelTitle = Tasks::model()->findByPk($model->comment_resourceid)->task_name; break; default: $resourceModelTitle = "{empty}"; break; } // get project information $project = Projects::model()->findByPk($project); // prepare template to send via email $str = $this->renderPartial('//templates/comments/created', array('model' => $model, 'projectName' => $project->project_name, 'userposted' => Yii::app()->user->CompleteName, 'resourceTitle' => $resourceModelTitle, 'moduleName' => Yii::t('modules', $module->module_name), 'applicationName' => Yii::app()->name, 'applicationUrl' => Yii::app()->createAbsoluteUrl($module->module_name . '/view', array('id' => $model->comment_resourceid))), true); Yii::import('application.extensions.phpMailer.yiiPhpMailer'); $mailer = new yiiPhpMailer(); $subject = Yii::t('email', 'CommentPosted') . " - " . $project->project_name . " - " . Yii::t('modules', $module->module_name); $mailer->pushMail($subject, $str, $recipientsList, Emails::PRIORITY_NORMAL); } else { Yii::app()->user->setFlash('CommentMessage', Yii::t('comments', 'RequiredComment')); } } $this->redirect(Yii::app()->createUrl($_GET['module'] . '/' . $_GET['action'], array('id' => $_GET['id'], '#' => 'comment-' . $model->primaryKey))); }
function handleFatalErrors($buffer) { G::LoadClass('case'); $oCase = new Cases(); if (preg_match('/(error<\\/b>:)(.+)(<br)/', $buffer, $regs)) { $err = preg_replace('/<.*?>/', '', $regs[2]); $aAux = explode(' in ', $err); $sCode = $_SESSION['_CODE_']; unset($_SESSION['_CODE_']); registerError(2, $aAux[0], 0, $sCode); if (strpos($_SERVER['REQUEST_URI'], '/cases/cases_Step') !== false) { if (strpos($_SERVER['REQUEST_URI'], '&ACTION=GENERATE') !== false) { $aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']); if ($_SESSION['TRIGGER_DEBUG']['ISSET']) { $_SESSION['TRIGGER_DEBUG']['TIME'] = 'AFTER'; $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE']; $aNextStep['PAGE'] = $aNextStep['PAGE'] . '&breakpoint=triggerdebug'; } global $oPMScript; if (isset($oPMScript) && isset($_SESSION['APPLICATION'])) { $oPMScript->aFields['__ERROR__'] = $aAux[0]; $oCase->updateCase($_SESSION['APPLICATION'], array('APP_DATA' => $oPMScript->aFields)); } G::header('Location: ' . $aNextStep['PAGE']); die; } $_SESSION['_NO_EXECUTE_TRIGGERS_'] = 1; global $oPMScript; if (isset($oPMScript) && isset($_SESSION['APPLICATION'])) { $oPMScript->aFields['__ERROR__'] = $aAux[0]; $oCase->updateCase($_SESSION['APPLICATION'], array('APP_DATA' => $oPMScript->aFields)); } G::header('Location: ' . $_SERVER['REQUEST_URI']); die; } else { $aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']); if ($_SESSION['TRIGGER_DEBUG']['ISSET']) { $_SESSION['TRIGGER_DEBUG']['TIME'] = 'AFTER'; $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE']; $aNextStep['PAGE'] = $aNextStep['PAGE'] . '&breakpoint=triggerdebug'; } if (strpos($aNextStep['PAGE'], 'TYPE=ASSIGN_TASK&UID=-1') !== false) { G::SendMessageText('Fatal error in trigger', 'error'); } global $oPMScript; if (isset($oPMScript) && isset($_SESSION['APPLICATION'])) { $oPMScript->aFields['__ERROR__'] = $aAux[0]; $oCase->updateCase($_SESSION['APPLICATION'], array('APP_DATA' => $oPMScript->aFields)); } G::header('Location: ' . $aNextStep['PAGE']); die; } } return $buffer; }
global $G_PUBLISH; $oHeadPublisher =& headPublisher::getSingleton(); G::loadClass('configuration'); $conf = new Configurations(); $oHeadPublisher->addExtJsScript('cases/casesGenerateDocumentPage', true); //adding a javascript file .js $oHeadPublisher->addContent('cases/casesGenerateDocumentPage'); //adding a html file .html. $oHeadPublisher->assign('pageSize', $conf->getEnvSetting('casesListRowNumber')); G::RenderPage('publish', 'extJs'); } if ($actionAjax == 'generateDocumentGrid_Ajax') { G::LoadClass('case'); G::LoadClass("BasePeer"); global $G_PUBLISH; $oCase = new Cases(); $aProcesses = array(); $G_PUBLISH = new Publisher(); $c = $oCase->getAllGeneratedDocumentsCriteria($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['TASK'], $_SESSION['USER_LOGGED']); if ($c->getDbName() == 'dbarray') { $rs = ArrayBasePeer::doSelectRs($c); } else { $rs = GulliverBasePeer::doSelectRs($c); } $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); $totalCount = 0; for ($j = 0; $j < $rs->getRecordCount(); $j++) { $result = $rs->getRow(); $result["FILEDOCEXIST"] = casesShowOuputDocumentExist($result["FILEDOC"]); $result["FILEPDFEXIST"] = casesShowOuputDocumentExist($result["FILEPDF"]);
/* GET , POST & $_SESSION Vars */ //$_SESSION['STEP_POSITION'] = (int)$_GET['POSITION']; /* Menues */ $G_MAIN_MENU = 'processmaker'; $G_SUB_MENU = 'cases'; $G_ID_MENU_SELECTED = 'CASES'; $G_ID_SUB_MENU_SELECTED = 'CASES_TO_REVISE'; /* Prepare page before to show */ $oTemplatePower = new TemplatePower( PATH_TPL . 'cases/cases_Step.html' ); $oTemplatePower->prepare(); $G_PUBLISH = new Publisher(); $oCase = new Cases(); $Fields = $oCase->loadCase( $_SESSION['APPLICATION'] ); $oHeadPublisher = & headPublisher::getSingleton(); $oHeadPublisher->addScriptCode( " if (typeof parent != 'undefined') { if (parent.showCaseNavigatorPanel) { parent.showCaseNavigatorPanel('{$Fields['APP_STATUS']}'); } }" ); // DEPRECATED this script call is marked for removal since almost all the interface is extJS based $oHeadPublisher->addScriptCode( ' var Cse = {}; Cse.panels = {}; var leimnud = new maborak(); leimnud.make();
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"); $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) {
/** * 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; } }
$pmDynaForm = new pmDynaform($Fields); if ($pmDynaForm->isResponsive()) { $pmDynaForm->printTracker(); } } else { $G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent("dynaform", "xmlform", $_SESSION["PROCESS"] . "/" . $_GET["CTO_UID_OBJ"], "", $Fields["APP_DATA"], "", "", "view"); G::RenderPage("publish"); } break; case 'INPUT_DOCUMENT': G::LoadClass('case'); $oCase = new Cases(); $c = $oCase->getAllUploadedDocumentsCriteriaTracker($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_GET['CTO_UID_OBJ']); $oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher->addScriptFile('/jscore/tracker/tracker.js'); $G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent('propeltable', 'paged-table', 'tracker/tracker_Inputdocs', $c); G::RenderPage('publish'); break; case 'OUTPUT_DOCUMENT': G::LoadClass('case'); $oCase = new Cases(); $c = $oCase->getAllGeneratedDocumentsCriteriaTracker($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_GET['CTO_UID_OBJ']); $oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher->addScriptFile('/jscore/tracker/tracker.js'); $G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent('propeltable', 'paged-table', 'tracker/tracker_Outputdocs', $c); G::RenderPage('publish'); break; }
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; } }
$_GET['APP_UID'] = $oCase->getApplicationUIDByNumber($_GET['APP_NUMBER']); $_GET['DEL_INDEX'] = $oCase->getCurrentDelegation($_GET['APP_UID'], $_SESSION['USER_LOGGED']); if (is_null($_GET['APP_UID'])) { throw new Exception(G::LoadTranslation('ID_CASE_DOES_NOT_EXISTS')); } if (is_null($_GET['DEL_INDEX'])) { throw new Exception(G::LoadTranslation('ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER')); } } else { throw new Exception("Application ID or Delegation Index is missing!. The System can't open the case."); } } 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']); }
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 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; }
* Here we throw the debug view */ if (isset($_GET['breakpoint'])) { $G_PUBLISH->AddContent('view', 'cases/showDebugFrameLoader'); $G_PUBLISH->AddContent('view', 'cases/showDebugFrameBreaker'); G::RenderPage('publish', 'blank'); exit; } #end trigger debug session....... //$oCase->thisIsTheCurrentUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'REDIRECT', 'cases_List'); //Save data - Start $oCase->updateCase($_SESSION['APPLICATION'], $Fields); //Save data - End //Obtain previous and next step - Start try { $oCase = new Cases(); $aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']); $aPreviousStep = $oCase->getPreviousStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']); } catch (Exception $e) { } //Obtain previous and next step - End try { //Add content content step - Start $oApp = ApplicationPeer::retrieveByPK($_SESSION['APPLICATION']); $array['APP_NUMBER'] = $APP_NUMBER; $sTitleCase = $oApp->getAppTitle(); $array['APP_TITLE'] = $sTitleCase; $array['CASE'] = G::LoadTranslation('ID_CASE'); $array['TITLE'] = G::LoadTranslation('ID_TITLE'); $noShowTitle = 0; if (isset($oProcessFieds['PRO_SHOW_MESSAGE'])) {
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); } }
public function startCase($httpData) { G::LoadClass('case'); $case = new Cases(); $aData = $case->startCase($httpData->id, $_SESSION['USER_LOGGED']); $_SESSION['APPLICATION'] = $aData['APPLICATION']; $_SESSION['INDEX'] = $aData['INDEX']; $_SESSION['PROCESS'] = $aData['PROCESS']; $_SESSION['TASK'] = $httpData->id; $_SESSION['STEP_POSITION'] = 0; $_SESSION['CASES_REFRESH'] = true; // Execute Events require_once 'classes/model/Event.php'; $event = new Event(); $event->createAppEvents($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['TASK']); $oCase = new Cases(); $aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']); //../cases/cases_Open?APP_UID={$APP.APP_UID}&DEL_INDEX={$APP.DEL_INDEX}&action=todo $aNextStep['PAGE'] = '../cases/cases_Open?APP_UID=' . $aData['APPLICATION'] . '&DEL_INDEX=' . $aData['INDEX'] . '&action=draft'; $_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep; $this->redirect($aNextStep['PAGE']); }
/** * 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; } }
if (isset($_SESSION['PROCESS'])) { unset($_SESSION['PROCESS']); } if (isset($_SESSION['TASK'])) { unset($_SESSION['TASK']); } if (isset($_SESSION['INDEX'])) { unset($_SESSION['INDEX']); } if (isset($_SESSION['STEP_POSITION'])) { unset($_SESSION['STEP_POSITION']); } /* Process */ try { $oCase = new Cases(); $aData = $oCase->startCase($_POST['form']['TAS_UID'], $_SESSION['USER_LOGGED']); $_SESSION['APPLICATION'] = $aData['APPLICATION']; $_SESSION['INDEX'] = $aData['INDEX']; $_SESSION['PROCESS'] = $aData['PROCESS']; $_SESSION['TASK'] = $_POST['form']['TAS_UID']; $_SESSION['STEP_POSITION'] = 0; $_SESSION['CASES_REFRESH'] = true; $oCase = new Cases(); $aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']); $_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep; G::header('location: ' . $aNextStep['PAGE']); } catch (Exception $e) { $_SESSION['G_MESSAGE'] = $e->getMessage(); $_SESSION['G_MESSAGE_TYPE'] = 'error'; G::header('location: cases_New'); }
if (!isset($_REQUEST['DEL_INDEX'])) { $_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'];