/** * post Note Action * * @param string $httpData->appUid (optional, if it is not passed try use $_SESSION['APPLICATION']) * @return array containg the case notes */ function postNote($httpData) { require_once "classes/model/AppNotes.php"; //extract(getExtJSParams()); if (isset($httpData->appUid) && trim($httpData->appUid) != "") { $appUid = $httpData->appUid; } else { $appUid = $_SESSION['APPLICATION']; } if (!isset($appUid)) { throw new Exception('Can\'t resolve the Apllication ID for this request.'); } $usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ""; $noteContent = addslashes($httpData->noteText); //Disabling the controller response because we handle a special behavior $this->setSendResponse(false); //Add note case $appNote = new AppNotes(); $response = $appNote->addCaseNote($appUid, $usrUid, $noteContent, intval($httpData->swSendMail)); //Send the response to client @ini_set("implicit_flush", 1); ob_start(); echo G::json_encode($response); @ob_flush(); @flush(); @ob_end_flush(); ob_implicit_flush(1); }
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); }
function postNote() { extract(getExtJSParams()); if (isset($_REQUEST['appUid']) && trim($_REQUEST['appUid']) != "") { $appUid = $_REQUEST['appUid']; } else { $appUid = $_SESSION['APPLICATION']; } $usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ""; require_once "classes/model/AppNotes.php"; $noteContent = addslashes($_POST['noteText']); $appNotes = new AppNotes(); $response = $appNotes->postNewNote($appUid, $usrUid, $noteContent); sendJsonResultGeneric($response, $callback); }
/** * post Note Action * @param string $httpData->appUid (optional, if it is not passed try use $_SESSION['APPLICATION']) * @return array containg the case notes */ function postNote($httpData) { //extract(getExtJSParams()); if (isset($httpData->appUid) && trim($httpData->appUid) != "") { $appUid = $httpData->appUid; } else { $appUid = $_SESSION['APPLICATION']; } if (!isset($appUid)) { throw new Exception('Can\'t resolve the Apllication ID for this request.'); } $usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ""; require_once "classes/model/AppNotes.php"; $appNotes = new AppNotes(); $noteContent = addslashes($httpData->noteText); $result = $appNotes->postNewNote($appUid, $usrUid, $noteContent, false); // Disabling the controller response because we handle a special behavior $this->setSendResponse(false); //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); //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); }
/** * Get Case Notes * * @param string $app_uid {@min 1}{@max 32} * @param string $start {@from path} * @param string $limit {@from path} * @param string $sort {@from path} * @param string $dir {@from path} * @param string $usr_uid {@from path} * @param string $date_from {@from path} * @param string $date_to {@from path} * @param string $search {@from path} * @return array * * @copyright Colosa - Bolivia * * @url GET /case/:app_uid/notes */ public function doGetCaseNotes( $app_uid, $start = 0, $limit = 25, $sort = 'APP_CACHE_VIEW.APP_NUMBER', $dir = 'DESC', $usr_uid = '', $date_from = '', $date_to = '', $search = '' ) { try { $dataList['start'] = $start; $dataList['limit'] = $limit; $dataList['sort'] = $sort; $dataList['dir'] = $dir; $dataList['user'] = $usr_uid; $dataList['dateFrom'] = $date_from; $dataList['dateTo'] = $date_to; $dataList['search'] = $search; $appNotes = new \AppNotes(); $response = $appNotes->getNotesList( $app_uid, '', $start, $limit ); $response = $this->parserDataNotes($response['array']['notes']); return $response; } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } }
public function getAppsData($type, $start = null, $limit = null, $user = null, $filter = null, $search = null, $process = null, $status = null, $dateFrom = null, $dateTo = null, $callback = null, $dir = null, $sort = "APP_CACHE_VIEW.APP_NUMBER", $category = null) { require_once "classes/model/AppNotes.php"; G::LoadClass('applications'); $apps = new Applications(); $appNotes = new AppNotes(); $start = empty($start) ? $this->appListStart : $start; $limit = empty($limit) ? $this->appListLimit : $limit; $notesStart = 0; $notesLimit = 4; switch ($user) { case 'CURRENT_USER': $user = $this->userID; break; case 'ALL': $user = null; break; case null: $user = $this->userID; break; default: //$user = $this->userID; break; } $cases = $apps->getAll($user, $start, $limit, $type, $filter, $search, $process, $status, $type, $dateFrom, $dateTo, $callback, $dir, $sort, $category); // formating & complitting apps data with 'Notes' foreach ($cases['data'] as $i => $row) { // Formatting $appTitle = str_replace('#', '', $row['APP_TITLE']); if (is_numeric($appTitle)) { $cases['data'][$i]['APP_TITLE'] = G::LoadTranslation('ID_CASE') . ' ' . $appTitle; } if (isset($row['DEL_DELEGATE_DATE'])) { $cases['data'][$i]['DEL_DELEGATE_DATE'] = G::getformatedDate($row['DEL_DELEGATE_DATE'], 'M d, yyyy - h:i:s'); } if (isset($row['APP_DEL_PREVIOUS_USER'])) { $cases['data'][$i]['APP_DEL_PREVIOUS_USER'] = ucwords($row['APP_DEL_PREVIOUS_USER']); } // Completting with Notes $notes = $appNotes->getNotesList($row['APP_UID'], '', $notesStart, $notesLimit); $notes = $notes['array']; $cases['data'][$i]['NOTES_COUNT'] = $notes['totalCount']; $cases['data'][$i]['NOTES_LIST'] = $notes['notes']; } return $cases; }
$oCase = new Cases(); $oCase->reactivateCase($sApplicationUID, $iIndex, $_SESSION['USER_LOGGED']); break; case 'showPauseCaseInput': //echo '<input type=button onclick="close_pauseCase()" value="Cancel">'; $aFields = array(); $G_PUBLISH = new Publisher(); $aFields['TIME_STAMP'] = G::getformatedDate(date('Y-m-d'), 'M d, yyyy', SYS_LANG); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_UnpauseDateInput', '', $aFields); G::RenderPage('publish', 'raw'); break; case 'pauseCase': // Save the note pause reason if ($_POST['NOTE_REASON'] != '') { require_once "classes/model/AppNotes.php"; $appNotes = new AppNotes(); $noteContent = addslashes($_POST['NOTE_REASON']); $result = $appNotes->postNewNote($_POST['APP_UID'], $_SESSION['USER_LOGGED'], $noteContent, $_POST['NOTIFY_PAUSE']); } // End save $unpauseDate = $_POST['unpausedate'] . ' ' . $_REQUEST['unpauseTime']; $oCase = new Cases(); if (isset($_POST['APP_UID']) && isset($_POST['DEL_INDEX'])) { $APP_UID = $_POST['APP_UID']; $DEL_INDEX = $_POST['DEL_INDEX']; } elseif (isset($_POST['sApplicationUID']) && isset($_POST['iIndex'])) { $APP_UID = $_POST['sApplicationUID']; $DEL_INDEX = $_POST['iIndex']; } else { $APP_UID = $_SESSION['APPLICATION']; $DEL_INDEX = $_SESSION['INDEX'];
/** * 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; } }
public function pauseCase() { try { $unpauseDate = $_REQUEST['unpauseDate'] . ' ' . $_REQUEST['unpauseTime']; $oCase = new Cases(); if (isset($_POST['APP_UID']) && isset($_POST['DEL_INDEX'])) { $APP_UID = $_POST['APP_UID']; $DEL_INDEX = $_POST['DEL_INDEX']; } elseif (isset($_POST['sApplicationUID']) && isset($_POST['iIndex'])) { $APP_UID = $_POST['sApplicationUID']; $DEL_INDEX = $_POST['iIndex']; } else { $APP_UID = $_SESSION['APPLICATION']; $DEL_INDEX = $_SESSION['INDEX']; } // Save the note pause reason if ($_REQUEST['NOTE_REASON'] != '') { require_once "classes/model/AppNotes.php"; $appNotes = new AppNotes(); $noteContent = addslashes($_REQUEST['NOTE_REASON']); $appNotes->postNewNote($APP_UID, $_SESSION['USER_LOGGED'], $noteContent, $_REQUEST['NOTIFY_PAUSE']); } // End save $oCase->pauseCase($APP_UID, $DEL_INDEX, $_SESSION['USER_LOGGED'], $unpauseDate); $app = new Application(); $caseData = $app->load($APP_UID); $data['APP_NUMBER'] = $caseData['APP_NUMBER']; $data['UNPAUSE_DATE'] = $unpauseDate; $result->success = true; $result->msg = G::LoadTranslation('ID_CASE_PAUSED_SUCCESSFULLY', SYS_LANG, $data); } catch (Exception $e) { $result->success = false; $result->msg = $e->getMessage(); } echo G::json_encode($result); }
/** * post Note Action * * @param string $httpData->appUid (optional, if it is not passed try use $_SESSION['APPLICATION']) * @return array containg the case notes */ function postNote($httpData) { //require_once ("classes/model/AppNotes.php"); //extract(getExtJSParams()); if (isset($httpData->appUid) && trim($httpData->appUid) != "") { $appUid = $httpData->appUid; } else { $appUid = $_SESSION['APPLICATION']; } if (!isset($appUid)) { throw new Exception(G::LoadTranslation("ID_CANT_RESOLVE_APPLICATION")); } $usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ""; $noteContent = addslashes($httpData->noteText); //Disabling the controller response because we handle a special behavior $this->setSendResponse(false); //Add note case $appNote = new AppNotes(); try { $response = $appNote->addCaseNote($appUid, $usrUid, $noteContent, intval($httpData->swSendMail)); } catch (Exception $error) { $response = new stdclass(); $response->success = 'success'; $response->message = G::LoadTranslation('ID_ERROR_SEND_NOTIFICATIONS'); $response->message .= '<br /><br />' . $error->getMessage() . '<br /><br />'; $response->message .= G::LoadTranslation('ID_CONTACT_ADMIN'); die(G::json_encode($response)); } //Send the response to client @ini_set("implicit_flush", 1); ob_start(); if (!isset($_SESSION['USER_LOGGED'])) { $response = new stdclass(); $response->message = G::LoadTranslation('ID_LOGIN_AGAIN'); $response->lostSession = true; print G::json_encode($response); die; } echo G::json_encode($response); @ob_flush(); @flush(); @ob_end_flush(); ob_implicit_flush(1); }
public function getAppsData ( $type, $start = null, $limit = null, $user = null, $filter = null, $search = null, $process = null, $status = null, $dateFrom = null, $dateTo = null, $callback = null, $dir = null, $sort = "APP_CACHE_VIEW.APP_NUMBER", $category = null) { require_once ("classes/model/AppNotes.php"); $appNotes = new AppNotes(); $start = empty( $start ) ? $this->appListStart : $start; $limit = empty( $limit ) ? $this->appListLimit : $limit; $notesStart = 0; $notesLimit = 4; switch ($user) { case 'CURRENT_USER': $user = $this->userID; break; case 'ALL': $user = null; break; case null: $user = $this->userID; break; default: //$user = $this->userID; break; } $solrEnabled = false; if (( $type == "todo" || $type == "draft" || $type == "paused" || $type == "sent" || $type == "selfservice" || $type == "unassigned" || $type == "search" ) && (($solrConf = System::solrEnv()) !== false) ) { G::LoadClass("AppSolr"); $ApplicationSolrIndex = new AppSolr( $solrConf["solr_enabled"], $solrConf["solr_host"], $solrConf["solr_instance"] ); if ($ApplicationSolrIndex->isSolrEnabled() && $solrConf['solr_enabled'] == true) { //Check if there are missing records to reindex and reindex them $ApplicationSolrIndex->synchronizePendingApplications(); $solrEnabled = true; } else{ $solrEnabled = false; } } if ($solrEnabled) { $cases = $ApplicationSolrIndex->getAppGridData( $user, $start, $limit, $type, $filter, $search, $process, $status, '', $dateFrom, $dateTo, $callback, $dir, $sort, $category ); } else { G::LoadClass( 'applications' ); $apps = new Applications(); $cases = $apps->getAll( $user, $start, $limit, $type, $filter, $search, $process, $status, '', $dateFrom, $dateTo, $callback, $dir, $sort, $category, false ); } // formating & complitting apps data with 'Notes' foreach ($cases['data'] as $i => $row) { // Formatting $appTitle = str_replace( '#', '', $row['APP_TITLE'] ); if (is_numeric( $appTitle )) { $cases['data'][$i]['APP_TITLE'] = G::LoadTranslation( 'ID_CASE' ) . ' ' . $appTitle; } if (isset( $row['DEL_DELEGATE_DATE'] )) { G::LoadClass( "configuration" ); $conf = new Configurations(); $generalConfCasesList = $conf->getConfiguration( 'ENVIRONMENT_SETTINGS', '' ); $cases['data'][$i]['DEL_DELEGATE_DATE'] = ''; if (defined('SYS_SYS')) { if (isset( $generalConfCasesList['casesListDateFormat'] ) && ! empty( $generalConfCasesList['casesListDateFormat'] )) { $cases['data'][$i]['DEL_DELEGATE_DATE'] = $conf->getSystemDate($row['DEL_DELEGATE_DATE'], 'casesListDateFormat'); } } if ($cases['data'][$i]['DEL_DELEGATE_DATE'] == '') { $cases['data'][$i]['DEL_DELEGATE_DATE'] = $conf->getSystemDate($row['DEL_DELEGATE_DATE']); } } if (isset( $row['APP_DEL_PREVIOUS_USER'] )) { $cases['data'][$i]['APP_DEL_PREVIOUS_USER'] = ucwords( $row['APP_DEL_PREVIOUS_USER'] ); } // Completting with Notes $notes = $appNotes->getNotesList( $row['APP_UID'], '', $notesStart, $notesLimit ); $notes = $notes['array']; $cases['data'][$i]['NOTES_COUNT'] = $notes['totalCount']; $cases['data'][$i]['NOTES_LIST'] = $notes['notes']; } return $cases; }
public function getAppsData($type, $start = null, $limit = null) { require_once "classes/model/AppNotes.php"; G::LoadClass('applications'); $apps = new Applications(); $appNotes = new AppNotes(); $start = empty($start) ? $this->appListStart : $start; $limit = empty($limit) ? $this->appListLimit : $limit; $notesStart = 0; $notesLimit = 4; $cases = $apps->getAll($this->userID, $start, $limit, $type); //g::pr($cases['data']); die; // formating & complitting apps data with 'Notes' foreach ($cases['data'] as $i => $row) { // Formatting $appTitle = str_replace('#', '', $row['APP_TITLE']); if (is_numeric($appTitle)) { $cases['data'][$i]['APP_TITLE'] = G::LoadTranslation('ID_CASE') . ' ' . $appTitle; } if (isset($row['DEL_DELEGATE_DATE'])) { $cases['data'][$i]['DEL_DELEGATE_DATE'] = G::getformatedDate($row['DEL_DELEGATE_DATE'], 'M d, yyyy - h:i:s'); } if (isset($row['APP_DEL_PREVIOUS_USER'])) { $cases['data'][$i]['APP_DEL_PREVIOUS_USER'] = ucwords($row['APP_DEL_PREVIOUS_USER']); } // Completting with Notes $notes = $appNotes->getNotesList($row['APP_UID'], '', $notesStart, $notesLimit); $notes = $notes['array']; $cases['data'][$i]['NOTES_COUNT'] = $notes['totalCount']; $cases['data'][$i]['NOTES_LIST'] = $notes['notes']; } return $cases; }
/** * */ public function pauseCase($usr_uid, $app_uid, $request_data) { $result = new \stdclass(); try { $unpauseDate = $request_data['unpauseDate'] . ' '. $request_data['unpauseTime']; $oCase = new \Cases(); $iDelIndex = $oCase->getCurrentDelegation( $app_uid, $usr_uid ); // Save the note pause reason if ($request_data['noteContent'] != '') { $request_data['noteContent'] = G::LoadTranslation('ID_CASE_PAUSE_LABEL_NOTE') . ' ' . $request_data['noteContent']; $appNotes = new \AppNotes(); $noteContent = addslashes($request_data['noteContent']); $appNotes->postNewNote($app_uid, $usr_uid, $noteContent, $request_data['notifyUser']); } // End save $oCase->pauseCase($app_uid, $iDelIndex, $usr_uid, $unpauseDate); $app = new \Application(); $caseData = $app->load($app_uid); $data['APP_NUMBER'] = $caseData['APP_NUMBER']; $data['UNPAUSE_DATE'] = $unpauseDate; $result->success = true; $result->msg = G::LoadTranslation('ID_CASE_PAUSED_SUCCESSFULLY', SYS_LANG, $data); } catch (\Exception $e) { throw $e; } return $result; }
/** * Save new case note * * @access public * @param string $app_uid, Uid for case * @param array $app_data, Data for case variables * * @author Brayan Pereyra (Cochalo) <*****@*****.**> * @copyright Colosa - Bolivia */ public function saveCaseNote($app_uid, $usr_uid, $note_content, $send_mail = false) { Validator::isString($app_uid, '$app_uid'); Validator::appUid($app_uid, '$app_uid'); Validator::isString($usr_uid, '$usr_uid'); Validator::usrUid($usr_uid, '$usr_uid'); Validator::isString($note_content, '$note_content'); if (strlen($note_content) > 500) { throw (new \Exception(\G::LoadTranslation("ID_INVALID_MAX_PERMITTED", array($note_content,'500')))); } Validator::isBoolean($send_mail, '$send_mail'); $case = new \Cases(); $caseLoad = $case->loadCase($app_uid); $pro_uid = $caseLoad['PRO_UID']; $tas_uid = \AppDelegation::getCurrentTask($app_uid); $respView = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'VIEW' ); $respBlock = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'BLOCK' ); if ($respView['CASES_NOTES'] == 0 && $respBlock['CASES_NOTES'] == 0) { throw (new \Exception(\G::LoadTranslation("ID_CASES_NOTES_NO_PERMISSIONS"))); } $note_content = addslashes($note_content); $appNote = new \AppNotes(); $appNote->addCaseNote($app_uid, $usr_uid, $note_content, intval($send_mail)); }