public function getDefaultFields() { return array_merge( AppCacheViewPeer::getFieldNames(BasePeer::TYPE_FIELDNAME), array( "APP_DELAY_UID", "APP_THREAD_INDEX", "APP_DEL_INDEX", "APP_TYPE", "APP_DELEGATION_USER", "APP_ENABLE_ACTION_USER", "APP_ENABLE_ACTION_DATE", "APP_DISABLE_ACTION_USER", "APP_DISABLE_ACTION_DATE", "APP_AUTOMATIC_DISABLED_DATE" ) ); }
/** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = AppCacheViewPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setAppUid($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setDelIndex($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setDelLastIndex($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setAppNumber($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setAppStatus($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setUsrUid($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setPreviousUsrUid($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setTasUid($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setProUid($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setDelDelegateDate($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setDelInitDate($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setDelTaskDueDate($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { $this->setDelFinishDate($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { $this->setDelThreadStatus($arr[$keys[13]]); } if (array_key_exists($keys[14], $arr)) { $this->setAppThreadStatus($arr[$keys[14]]); } if (array_key_exists($keys[15], $arr)) { $this->setAppTitle($arr[$keys[15]]); } if (array_key_exists($keys[16], $arr)) { $this->setAppProTitle($arr[$keys[16]]); } if (array_key_exists($keys[17], $arr)) { $this->setAppTasTitle($arr[$keys[17]]); } if (array_key_exists($keys[18], $arr)) { $this->setAppCurrentUser($arr[$keys[18]]); } if (array_key_exists($keys[19], $arr)) { $this->setAppDelPreviousUser($arr[$keys[19]]); } if (array_key_exists($keys[20], $arr)) { $this->setDelPriority($arr[$keys[20]]); } if (array_key_exists($keys[21], $arr)) { $this->setDelDuration($arr[$keys[21]]); } if (array_key_exists($keys[22], $arr)) { $this->setDelQueueDuration($arr[$keys[22]]); } if (array_key_exists($keys[23], $arr)) { $this->setDelDelayDuration($arr[$keys[23]]); } if (array_key_exists($keys[24], $arr)) { $this->setDelStarted($arr[$keys[24]]); } if (array_key_exists($keys[25], $arr)) { $this->setDelFinished($arr[$keys[25]]); } if (array_key_exists($keys[26], $arr)) { $this->setDelDelayed($arr[$keys[26]]); } if (array_key_exists($keys[27], $arr)) { $this->setAppCreateDate($arr[$keys[27]]); } if (array_key_exists($keys[28], $arr)) { $this->setAppFinishDate($arr[$keys[28]]); } if (array_key_exists($keys[29], $arr)) { $this->setAppUpdateDate($arr[$keys[29]]); } if (array_key_exists($keys[30], $arr)) { $this->setAppOverduePercentage($arr[$keys[30]]); } }
/** * Get list for Cases * * @access public * @param array $dataList, Data for list * @return array * * @author Brayan Pereyra (Cochalo) <*****@*****.**> * @copyright Colosa - Bolivia */ public function getList($dataList = array()) { Validator::isArray($dataList, '$dataList'); if (!isset($dataList["userId"])) { throw (new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array('userId','')))); } else { Validator::usrUid($dataList["userId"], "userId"); } $user = new \ProcessMaker\BusinessModel\User(); if (!$user->checkPermission($dataList["userId"], "PM_ALLCASES")) { throw new \Exception(\G::LoadTranslation("ID_CASE_USER_NOT_HAVE_PERMISSION", array($dataList["userId"]))); } G::LoadClass("applications"); $solrEnabled = false; $userUid = $dataList["userId"]; $callback = isset( $dataList["callback"] ) ? $dataList["callback"] : "stcCallback1001"; $dir = isset( $dataList["dir"] ) ? $dataList["dir"] : "DESC"; $sort = isset( $dataList["sort"] ) ? $dataList["sort"] : "APP_CACHE_VIEW.APP_NUMBER"; $start = isset( $dataList["start"] ) ? $dataList["start"] : "0"; $limit = isset( $dataList["limit"] ) ? $dataList["limit"] : ""; $filter = isset( $dataList["filter"] ) ? $dataList["filter"] : ""; $process = isset( $dataList["process"] ) ? $dataList["process"] : ""; $category = isset( $dataList["category"] ) ? $dataList["category"] : ""; $status = isset( $dataList["status"] ) ? strtoupper( $dataList["status"] ) : ""; $user = isset( $dataList["user"] ) ? $dataList["user"] : ""; $search = isset( $dataList["search"] ) ? $dataList["search"] : ""; $action = isset( $dataList["action"] ) ? $dataList["action"] : "todo"; $paged = isset( $dataList["paged"] ) ? $dataList["paged"] : true; $type = "extjs"; $dateFrom = (!empty( $dataList["dateFrom"] )) ? substr( $dataList["dateFrom"], 0, 10 ) : ""; $dateTo = (!empty( $dataList["dateTo"] )) ? substr( $dataList["dateTo"], 0, 10 ) : ""; $first = isset( $dataList["first"] ) ? true :false; $valuesCorrect = array('todo', 'draft', 'paused', 'sent', 'selfservice', 'unassigned', 'search'); if (!in_array($action, $valuesCorrect)) { throw (new \Exception(\G::LoadTranslation("ID_INCORRECT_VALUE_ACTION"))); } $start = (int)$start; $start = abs($start); if ($start != 0) { $start--; } $limit = (int)$limit; $limit = abs($limit); if ($limit == 0) { G::LoadClass("configuration"); $conf = new \Configurations(); $generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', ''); if (isset($generalConfCasesList['casesListRowNumber'])) { $limit = (int)$generalConfCasesList['casesListRowNumber']; } else { $limit = 25; } } else { $limit = (int)$limit; } if ($sort != 'APP_CACHE_VIEW.APP_NUMBER') { $sort = G::toUpper($sort); $columnsAppCacheView = \AppCacheViewPeer::getFieldNames(\BasePeer::TYPE_FIELDNAME); if (!(in_array($sort, $columnsAppCacheView))) { $sort = 'APP_CACHE_VIEW.APP_NUMBER'; } } $dir = G::toUpper($dir); if (!($dir == 'DESC' || $dir == 'ASC')) { $dir = 'DESC'; } if ($process != '') { Validator::proUid($process, '$pro_uid'); } if ($category != '') { Validator::catUid($category, '$cat_uid'); } $status = G::toUpper($status); $listStatus = array('TO_DO', 'DRAFT', 'COMPLETED', 'CANCEL', 'OPEN', 'CLOSE'); if (!(in_array($status, $listStatus))) { $status = ''; } 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'); } if ($action == 'search' || $action == 'to_reassign') { $userUid = ($user == "CURRENT_USER") ? $userUid : $user; if ($first) { $result = array(); $result['totalCount'] = 0; $result['data'] = array(); return $result; } } if (( $action == "todo" || $action == "draft" || $action == "paused" || $action == "sent" || $action == "selfservice" || $action == "unassigned" || $action == "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; } } if ($solrEnabled) { $result = $ApplicationSolrIndex->getAppGridData( $userUid, $start, $limit, $action, $filter, $search, $process, $status, $type, $dateFrom, $dateTo, $callback, $dir, $sort, $category ); } else { G::LoadClass("applications"); $apps = new \Applications(); $result = $apps->getAll( $userUid, $start, $limit, $action, $filter, $search, $process, $status, $type, $dateFrom, $dateTo, $callback, $dir, (strpos($sort, ".") !== false)? $sort : "APP_CACHE_VIEW." . $sort, $category, true, $paged ); } if (!empty($result['data'])) { foreach ($result['data'] as &$value) { $value = array_change_key_case($value, CASE_LOWER); } } if ($paged == false) { $response = $result['data']; } else { $response['total'] = $result['totalCount']; $response['start'] = $start+1; $response['limit'] = $limit; $response['sort'] = G::toLower($sort); $response['dir'] = G::toLower($dir); $response['cat_uid'] = $category; $response['pro_uid'] = $process; $response['search'] = $search; if ($action == 'search') { $response['app_status'] = G::toLower($status); $response['usr_uid'] = $user; $response['date_from'] = $dateFrom; $response['date_to'] = $dateTo; } $response['data'] = $result['data']; } return $response; }