/** * Get Notes List * * @param int $httpData->start * @param int $httpData->limit * @param string $httpData->appUid (optionalif it is not passed try use $_SESSION['APPLICATION']) * @return array containg the case notes */ function getNotesList($httpData) { $appUid = null; if (isset($httpData->appUid) && trim($httpData->appUid) != "") { $appUid = $httpData->appUid; } else { if (isset($_SESSION['APPLICATION'])) { $appUid = $_SESSION['APPLICATION']; } } G::LoadClass('case'); $case = new Cases(); $caseLoad = ''; if (!isset($_SESSION['PROCESS']) && !isset($httpData->pro)) { $caseLoad = $case->loadCase($appUid); $httpData->pro = $caseLoad['PRO_UID']; } $proUid = !isset($httpData->pro) ? $_SESSION['PROCESS'] : $httpData->pro; $tasUid = !isset($httpData->tas) ? isset($_SESSION['TASK']) ? $_SESSION['TASK'] : '' : $httpData->tas; $usrUid = $_SESSION['USER_LOGGED']; $respView = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, 'VIEW'); $respBlock = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, 'BLOCK'); if ($respView['CASES_NOTES'] == 0 && $respBlock['CASES_NOTES'] == 0) { return array('totalCount' => 0, 'notes' => array(), 'noPerms' => 1); } require_once "classes/model/AppNotes.php"; if (!isset($appUid)) { throw new Exception('Can\'t resolve the Apllication ID for this request.'); } $usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ""; $appNotes = new AppNotes(); $response = $appNotes->getNotesList($appUid, '', $httpData->start, $httpData->limit); return $response['array']; }
/** * Get Notes List * * @param int $httpData->start * @param int $httpData->limit * @param string $httpData->appUid (optionalif it is not passed try use $_SESSION['APPLICATION']) * @return array containg the case notes */ function getNotesList($httpData) { if (!isset($_SESSION['USER_LOGGED'])) { $response = new stdclass(); $response->message = G::LoadTranslation('ID_LOGIN_AGAIN'); $response->lostSession = true; print G::json_encode($response); die; } $appUid = null; if (isset($httpData->appUid) && trim($httpData->appUid) != "") { $appUid = $httpData->appUid; } else { if (isset($_SESSION['APPLICATION'])) { $appUid = $_SESSION['APPLICATION']; } } G::LoadClass('case'); $case = new Cases(); $caseLoad = ''; if (!isset($_SESSION['PROCESS']) && !isset($httpData->pro)) { $caseLoad = $case->loadCase($appUid); $httpData->pro = $caseLoad['PRO_UID']; } if (!isset($httpData->pro) || empty($httpData->pro)) { $proUid = $_SESSION['PROCESS']; } else { $proUid = $httpData->pro; } if (!isset($httpData->tas) || empty($httpData->tas)) { $tasUid = $_SESSION['TASK']; } else { $tasUid = $httpData->tas; } //$proUid = (!isset($httpData->pro)) ? $_SESSION['PROCESS'] : $httpData->pro; //$tasUid = (!isset($httpData->tas)) ? ((isset($_SESSION['TASK'])) ? $_SESSION['TASK'] : '') : $httpData->tas; $usrUid = $_SESSION['USER_LOGGED']; $respView = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, 'VIEW'); $respBlock = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, 'BLOCK'); if ($respView['CASES_NOTES'] == 0 && $respBlock['CASES_NOTES'] == 0) { return array('totalCount' => 0, 'notes' => array(), 'noPerms' => 1); } //require_once ("classes/model/AppNotes.php"); if (!isset($appUid)) { throw new Exception(G::LoadTranslation('ID_RESOLVE_APPLICATION_ID')); } $usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ""; $appNotes = new AppNotes(); $response = $appNotes->getNotesList($appUid, '', $httpData->start, $httpData->limit); require_once "classes/model/Content.php"; $content = new Content(); $response['array']['appTitle'] = $content->load('APP_TITLE', '', $appUid, SYS_LANG); return $response['array']; }
/** * Add case note * * @param string caseUid : ID of the case. * @param string processUid : ID of the process. * @param string taskUid : ID of the task. * @param string userUid : The unique ID of the user who will add note case. * @param string note : Note of the case. * @param int sendMail : Optional parameter. If set to 1, will send an email to all participants in the case. * @return $result will return an object */ public function addCaseNote($caseUid, $processUid, $taskUid, $userUid, $note, $sendMail = 1) { try { if (empty($caseUid)) { $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " caseUid"); return $result; } if (empty($processUid)) { $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " processUid"); return $result; } if (empty($taskUid)) { $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " taskUid"); return $result; } if (empty($userUid)) { $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " userUid"); return $result; } if (empty($note)) { $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " note"); return $result; } $case = new Cases(); $respView = $case->getAllObjectsFrom($processUid, $caseUid, $taskUid, $userUid, "VIEW"); $respBlock = $case->getAllObjectsFrom($processUid, $caseUid, $taskUid, $userUid, "BLOCK"); if ($respView["CASES_NOTES"] == 0 && $respBlock["CASES_NOTES"] == 0) { $result = new wsResponse(100, G::LoadTranslation("ID_CASES_NOTES_NO_PERMISSIONS")); return $result; } //Add note case $appNote = new AppNotes(); $response = $appNote->addCaseNote($caseUid, $userUid, $note, $sendMail); //Response $result = new wsResponse(0, G::LoadTranslation("ID_COMMAND_EXECUTED_SUCCESSFULLY")); return $result; } catch (Exception $e) { $result = new wsResponse(100, $e->getMessage()); return $result; } }
G::LoadClass("BasePeer"); $dir = isset($_POST['dir']) ? $_POST['dir'] : 'ASC'; $sort = isset($_POST['sort']) ? $_POST['sort'] : ''; global $G_PUBLISH; $oCase = new Cases(); $oCase->dir = $dir; $oCase->sort = $sort; $appMessageArray = $oCase->getHistoryMessagesTrackerExt($_SESSION['APPLICATION'], true, $_REQUEST['start'], $_REQUEST['limit']); $appMessageCountArray = $oCase->getHistoryMessagesTrackerExt($_SESSION['APPLICATION'], true); $result = new stdClass(); $aProcesses = array(); $proUid = $_SESSION['PROCESS']; $appUid = $_SESSION['APPLICATION']; $tasUid = $_SESSION['TASK']; $usrUid = $_SESSION['USER_LOGGED']; $respBlock = $oCase->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, 'BLOCK'); $respView = $oCase->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, 'VIEW'); $respResend = $oCase->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, 'RESEND'); $delIndex = array(); $respMess = ""; if (count($respBlock["MSGS_HISTORY"]) > 0) { $respMess = $respBlock["MSGS_HISTORY"]["PERMISSION"]; if (isset($respBlock["MSGS_HISTORY"]["DEL_INDEX"])) { $delIndex = $respBlock["MSGS_HISTORY"]["DEL_INDEX"]; } } if (count($respView["MSGS_HISTORY"]) > 0) { $respMess = $respView["MSGS_HISTORY"]["PERMISSION"]; if (isset($respView["MSGS_HISTORY"]["DEL_INDEX"])) { $delIndex = $respView["MSGS_HISTORY"]["DEL_INDEX"]; }