/** * 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']; }
function getNotesList() { extract(getExtJSParams()); require_once "classes/model/AppNotes.php"; if (isset($_REQUEST['appUid']) && trim($_REQUEST['appUid']) != "") { $appUid = $_REQUEST['appUid']; } else { $appUid = $_SESSION['APPLICATION']; } $usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ""; $appNotes = new AppNotes(); $response = $appNotes->getNotesList($appUid, '', $start, $limit); sendJsonResultGeneric($response['array'], $callback); }
/** * 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) { require_once "classes/model/AppNotes.php"; $appUid = null; if (isset($httpData->appUid) && trim($httpData->appUid) != "") { $appUid = $httpData->appUid; } else { if (isset($_SESSION['APPLICATION'])) { $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'] : ""; $appNotes = new AppNotes(); $response = $appNotes->getNotesList($appUid, '', $httpData->start, $httpData->limit); return $response['array']; }
/** * 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; }
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; }
/** * Get Case Notes * * @access public * @param string $app_uid, Uid for case * @return array * * @author Brayan Pereyra (Cochalo) <*****@*****.**> * @copyright Colosa - Bolivia */ public function getCaseNotes($app_uid, $usr_uid, $data_get) { 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::isArray($data_get, '$data_get'); Validator::isArray($data_get, '$data_get'); $start = isset( $data_get["start"] ) ? $data_get["start"] : "0"; $limit = isset( $data_get["limit"] ) ? $data_get["limit"] : ""; $sort = isset( $data_get["sort"] ) ? $data_get["sort"] : "APP_NOTES.NOTE_DATE"; $dir = isset( $data_get["dir"] ) ? $data_get["dir"] : "DESC"; $user = isset( $data_get["user"] ) ? $data_get["user"] : ""; $dateFrom = (!empty( $data_get["dateFrom"] )) ? substr( $data_get["dateFrom"], 0, 10 ) : ""; $dateTo = (!empty( $data_get["dateTo"] )) ? substr( $data_get["dateTo"], 0, 10 ) : ""; $search = isset( $data_get["search"] ) ? $data_get["search"] : ""; $paged = isset( $data_get["paged"] ) ? $data_get["paged"] : true; $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"))); } if ($sort != 'APP_NOTE.NOTE_DATE') { $sort = G::toUpper($sort); $columnsAppCacheView = \AppNotesPeer::getFieldNames(\BasePeer::TYPE_FIELDNAME); if (!(in_array($sort, $columnsAppCacheView))) { $sort = 'APP_NOTES.NOTE_DATE'; } else { $sort = 'APP_NOTES.'.$sort; } } if ((int)$start == 1 || (int)$start == 0) { $start = 0; } $dir = G::toUpper($dir); if (!($dir == 'DESC' || $dir == 'ASC')) { $dir = 'DESC'; } if ($user != '') { Validator::usrUid($user, '$usr_uid'); } if ($dateFrom != '') { Validator::isDate($dateFrom, 'Y-m-d', '$date_from'); } if ($dateTo != '') { Validator::isDate($dateTo, 'Y-m-d', '$date_to'); } $appNote = new \AppNotes(); $note_data = $appNote->getNotesList($app_uid, $user, $start, $limit, $sort, $dir, $dateFrom, $dateTo, $search); $response = array(); if ($paged === true) { $response['total'] = $note_data['array']['totalCount']; $response['start'] = $start; $response['limit'] = $limit; $response['sort'] = $sort; $response['dir'] = $dir; $response['usr_uid'] = $user; $response['date_to'] = $dateTo; $response['date_from'] = $dateFrom; $response['search'] = $search; $response['data'] = array(); $con = 0; foreach ($note_data['array']['notes'] as $value) { $response['data'][$con]['app_uid'] = $value['APP_UID']; $response['data'][$con]['usr_uid'] = $value['USR_UID']; $response['data'][$con]['note_date'] = $value['NOTE_DATE']; $response['data'][$con]['note_content'] = $value['NOTE_CONTENT']; $con++; } } else { $con = 0; foreach ($note_data['array']['notes'] as $value) { $response[$con]['app_uid'] = $value['APP_UID']; $response[$con]['usr_uid'] = $value['USR_UID']; $response[$con]['note_date'] = $value['NOTE_DATE']; $response[$con]['note_content'] = $value['NOTE_CONTENT']; $con++; } } return $response; }