/** * Get list for Cases * * @access public * @param array $dataList, Data for list * @return array * * @author Brayan Pereyra (Cochalo) <*****@*****.**> * @copyright Colosa - Bolivia */ public function getList($listName = 'inbox', $dataList = array(), $total = false) { 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"); } $userUid = $dataList["userId"]; $filters["paged"] = isset( $dataList["paged"] ) ? $dataList["paged"] : true; $filters['count'] = isset( $dataList['count'] ) ? $dataList['count'] : true; $filters["category"] = isset( $dataList["category"] ) ? $dataList["category"] : ""; $filters["process"] = isset( $dataList["process"] ) ? $dataList["process"] : ""; $filters["search"] = isset( $dataList["search"] ) ? $dataList["search"] : ""; $filters["filter"] = isset( $dataList["filter"] ) ? $dataList["filter"] : ""; $filters["dateFrom"] = (!empty( $dataList["dateFrom"] )) ? substr( $dataList["dateFrom"], 0, 10 ) : ""; $filters["dateTo"] = (!empty( $dataList["dateTo"] )) ? substr( $dataList["dateTo"], 0, 10 ) : ""; $filters["start"] = isset( $dataList["start"] ) ? $dataList["start"] : "0"; $filters["limit"] = isset( $dataList["limit"] ) ? $dataList["limit"] : "25"; $filters["sort"] = isset( $dataList["sort"] ) ? $dataList["sort"] : ""; $filters["dir"] = isset( $dataList["dir"] ) ? $dataList["dir"] : "DESC"; $filters["action"] = isset( $dataList["action"] ) ? $dataList["action"] : ""; // Select list switch ($listName) { case 'inbox': $list = new \ListInbox(); $listpeer = 'ListInboxPeer'; break; case 'participated_history': $list = new \ListParticipatedHistory(); $listpeer = 'ListParticipatedHistoryPeer'; break; case 'participated_last': $list = new \ListParticipatedLast(); $listpeer = 'ListParticipatedLastPeer'; break; case 'completed': $list = new \ListCompleted(); $listpeer = 'ListCompletedPeer'; break; case 'paused': $list = new \ListPaused(); $listpeer = 'ListPausedPeer'; break; case 'canceled': $list = new \ListCanceled(); $listpeer = 'ListCanceledPeer'; break; case 'my_inbox': $list = new \ListMyInbox(); $listpeer = 'ListMyInboxPeer'; break; case 'unassigned': $list = new \ListUnassigned(); $listpeer = 'ListUnassignedPeer'; break; } // Validate filters $filters["start"] = (int)$filters["start"]; $filters["start"] = abs($filters["start"]); if ($filters["start"] != 0) { $filters["start"]+1; } $filters["limit"] = (int)$filters["limit"]; $filters["limit"] = abs($filters["limit"]); if ($filters["limit"] == 0) { G::LoadClass("configuration"); $conf = new \Configurations(); $generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', ''); if (isset($generalConfCasesList['casesListRowNumber'])) { $filters["limit"] = (int)$generalConfCasesList['casesListRowNumber']; } else { $filters["limit"] = 25; } } else { $filters["limit"] = (int)$filters["limit"]; } $filters["sort"] = G::toUpper($filters["sort"]); $columnsList = $listpeer::getFieldNames(\BasePeer::TYPE_FIELDNAME); if (!(in_array($filters["sort"], $columnsList))) { $filters["sort"] = ''; } $filters["dir"] = G::toUpper($filters["dir"]); if (!($filters["dir"] == 'DESC' || $filters["dir"] == 'ASC')) { $filters["dir"] = 'DESC'; } if ($filters["process"] != '') { Validator::proUid($filters["process"], '$pro_uid'); } if ($filters["category"] != '') { Validator::catUid($filters["category"], '$cat_uid'); } if ($filters["dateFrom"] != '') { Validator::isDate($filters["dateFrom"], 'Y-m-d', '$date_from'); } if ($filters["dateTo"] != '') { Validator::isDate($filters["dateTo"], 'Y-m-d', '$date_to'); } if ($total) { $total = $list->countTotal($userUid, $filters); return $total; } $result = $list->loadList($userUid, $filters); if (!empty($result)) { foreach ($result as &$value) { if (isset($value['DEL_PREVIOUS_USR_UID'])) { $value['PREVIOUS_USR_UID'] = $value['DEL_PREVIOUS_USR_UID']; $value['PREVIOUS_USR_USERNAME'] = $value['DEL_PREVIOUS_USR_USERNAME']; $value['PREVIOUS_USR_FIRSTNAME'] = $value['DEL_PREVIOUS_USR_FIRSTNAME']; $value['PREVIOUS_USR_LASTNAME'] = $value['DEL_PREVIOUS_USR_LASTNAME']; } if (isset($value['DEL_DUE_DATE'])) { $value['DEL_TASK_DUE_DATE'] = $value['DEL_DUE_DATE']; } if (isset($value['APP_PAUSED_DATE'])) { $value['APP_UPDATE_DATE'] = $value['APP_PAUSED_DATE']; } if (isset($value['DEL_CURRENT_USR_USERNAME'])) { $value['USR_USERNAME'] = $value['DEL_CURRENT_USR_USERNAME']; $value['USR_FIRSTNAME'] = $value['DEL_CURRENT_USR_FIRSTNAME']; $value['USR_LASTNAME'] = $value['DEL_CURRENT_USR_LASTNAME']; $value['APP_UPDATE_DATE'] = $value['DEL_DELEGATE_DATE']; } if (isset($value['APP_STATUS'])) { $value['APP_STATUS_LABEL'] = G::LoadTranslation( "ID_{$value['APP_STATUS']}" ); } //$value = array_change_key_case($value, CASE_LOWER); } } $response = array(); if ($filters["paged"]) { $filtersData = array(); $filtersData['start'] = $filters["start"]; $filtersData['limit'] = $filters["limit"]; $filtersData['sort'] = G::toLower($filters["sort"]); $filtersData['dir'] = G::toLower($filters["dir"]); $filtersData['cat_uid'] = $filters["category"]; $filtersData['pro_uid'] = $filters["process"]; $filtersData['search'] = $filters["search"]; $filtersData['date_from'] = $filters["dateFrom"]; $filtersData['date_to'] = $filters["dateTo"]; $response['filters'] = $filtersData; $response['data'] = $result; $filtersData['action'] = $filters["action"]; $response['totalCount'] = $list->countTotal($userUid, $filtersData); } else { $response = $result; } return $response; }
public function getTriggerWebBotProcess($proUid, $action) { require_once "classes/model/Triggers.php"; if (!isset($proUid) && $proUid == '' || !isset($action) && $action == '') { return false; } $action = G::toUpper($action); $webBotTrigger = ''; switch ($action) { case 'OPEN': $var = ProcessPeer::PRO_TRI_OPEN; break; case 'DELETED': $var = ProcessPeer::PRO_TRI_DELETED; break; case 'CANCELED': $var = ProcessPeer::PRO_TRI_CANCELED; break; case 'PAUSED': $var = ProcessPeer::PRO_TRI_PAUSED; break; case 'REASSIGNED': $var = ProcessPeer::PRO_TRI_REASSIGNED; break; case "UNPAUSE": $var = ProcessPeer::PRO_TRI_UNPAUSED; break; } $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn($var); $oCriteria->addSelectColumn(TriggersPeer::TRI_WEBBOT); $oCriteria->addJoin($var, TriggersPeer::TRI_UID, Criteria::LEFT_JOIN); $oCriteria->add(ProcessPeer::PRO_UID, $proUid); $oDataSet = ProcessPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro')); $oDataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC); if ($oDataSet->next()) { $row = $oDataSet->getRow(); $webBotTrigger = $row['TRI_WEBBOT']; } return $webBotTrigger; }
/** * Get list All dashboards * * @access public * @param array $options, Data for list * @return array * * @author Marco Antonio Nina <*****@*****.**> * @copyright Colosa - Bolivia */ public function getListDashboards($options = array()) { Validator::isArray($options, '$options'); G::LoadClass("dashboards"); $dir = isset( $options["dir"] ) ? $options["dir"] : "DESC"; $sort = isset( $options["sort"] ) ? $options["sort"] : "DASHBOARD.DAS_TITLE"; $start = isset( $options["start"] ) ? $options["start"] : "0"; $limit = isset( $options["limit"] ) ? $options["limit"] : ""; $search = isset( $options["search"] ) ? $options["search"] : ""; $paged = isset( $options["paged"] ) ? $options["paged"] : true; $type = "extjs"; $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(); $configList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', ''); if (isset($configList['casesListRowNumber'])) { $limit = (int)$configList['casesListRowNumber']; } else { $limit = 25; } } else { $limit = (int)$limit; } if ($sort != 'DASHBOARD.DAS_TITLE') { $sort = G::toUpper($sort); $columnsAppCacheView = DashboardPeer::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'; } $dashboards = new \Dashboards(); $result = $dashboards->getListDashboards($start, $limit, $sort, $dir, $search); 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['search'] = $search; $response['data'] = $result['data']; } return $response; }
$_SESSION['PMDEBUGGER'] = false; } //cleaning debug variables if (!isset($_GET['breakpoint'])) { if (isset($_SESSION['TRIGGER_DEBUG']['info'])) { unset($_SESSION['TRIGGER_DEBUG']['info']); } if (!isset($_SESSION['_NO_EXECUTE_TRIGGERS_'])) { $_SESSION['TRIGGER_DEBUG']['ERRORS'] = array(); } $_SESSION['TRIGGER_DEBUG']['DATA'] = array(); $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = array(); $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = array(); $triggers = $oCase->loadTriggers($_SESSION['TASK'], $_GET['TYPE'], $_GET['UID'], 'BEFORE'); $_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] = count($triggers); $_SESSION['TRIGGER_DEBUG']['TIME'] = G::toUpper(G::loadTranslation('ID_BEFORE')); if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) { $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = $oCase->getTriggerNames($triggers); $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = $triggers; } if (!isset($_SESSION['_NO_EXECUTE_TRIGGERS_'])) { //Execute before triggers - Start $Fields['APP_DATA'] = $oCase->ExecuteTriggers($_SESSION['TASK'], $_GET['TYPE'], $_GET['UID'], 'BEFORE', $Fields['APP_DATA']); $Fields['DEL_INDEX'] = $_SESSION['INDEX']; $Fields['TAS_UID'] = $_SESSION['TASK']; //Execute before triggers - End } else { unset($_SESSION['_NO_EXECUTE_TRIGGERS_']); $Fields['DEL_INDEX'] = $_SESSION['INDEX']; $Fields['TAS_UID'] = $_SESSION['TASK']; }
public function verifyCaseTracker($case, $pin) { //CASE INSENSITIVE pin $pin = G::toUpper($pin); $pin = G::encryptOld($pin); $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(ApplicationPeer::APP_UID); $oCriteria->addSelectColumn(ApplicationPeer::APP_PIN); $oCriteria->addSelectColumn(ApplicationPeer::PRO_UID); $oCriteria->addSelectColumn(ApplicationPeer::APP_NUMBER); $oCriteria->addSelectColumn(ApplicationPeer::APP_PROC_CODE); //$oCriteria->add(ApplicationPeer::APP_NUMBER, $case); $oCriteria->add(ApplicationPeer::APP_PROC_CODE, $case); $oDataset = DynaformPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $aRow = $oDataset->getRow(); $sw = 0; if (is_array($aRow)) { $PRO_UID = $aRow['PRO_UID']; $APP_UID = $aRow['APP_UID']; $PIN = $aRow['APP_PIN']; } else { $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(ApplicationPeer::APP_UID); $oCriteria->addSelectColumn(ApplicationPeer::APP_PIN); $oCriteria->addSelectColumn(ApplicationPeer::PRO_UID); $oCriteria->addSelectColumn(ApplicationPeer::APP_NUMBER); $oCriteria->addSelectColumn(ApplicationPeer::APP_PROC_CODE); $oCriteria->add(ApplicationPeer::APP_NUMBER, $case); $oDataseti = DynaformPeer::doSelectRS($oCriteria); $oDataseti->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataseti->next(); $aRowi = $oDataseti->getRow(); if (is_array($aRowi)) { $PRO_UID = $aRowi['PRO_UID']; $APP_UID = $aRowi['APP_UID']; $PIN = $aRowi['APP_PIN']; } else { $sw = 1; } } $s = 0; if ($sw == 1) { //it isn't a case return -1; } else { $s++; } if ($PIN != $pin) { //the pin isn't correct return -2; } else { $s++; } $res = array(); $res['PRO_UID'] = $PRO_UID; $res['APP_UID'] = $APP_UID; if ($s == 2) { return $res; } }
$conf = new Configurations(); $generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', ''); if (isset($generalConfCasesList['casesListRowNumber'])) { $filters['limit'] = (int) $generalConfCasesList['casesListRowNumber']; } else { $filters['limit'] = 25; } } else { $filters['limit'] = (int) $filters['limit']; } $filters['sort'] = G::toUpper($filters['sort']); $columnsList = $listpeer::getFieldNames(BasePeer::TYPE_FIELDNAME); if (!in_array($filters['sort'], $columnsList)) { $filters['sort'] = ''; } $filters['dir'] = G::toUpper($filters['dir']); if (!($filters['dir'] == 'DESC' || $filters['dir'] == 'ASC')) { $filters['dir'] = 'DESC'; } $result = $list->loadList($userUid, $filters, function (array $record) { try { if (isset($record["DEL_PREVIOUS_USR_UID"])) { if ($record["DEL_PREVIOUS_USR_UID"] == "") { $appDelegation = AppDelegationPeer::retrieveByPK($record["APP_UID"], $record["DEL_INDEX"]); if (!is_null($appDelegation)) { $appDelegationPrevious = AppDelegationPeer::retrieveByPK($record["APP_UID"], $appDelegation->getDelPrevious()); if (!is_null($appDelegationPrevious)) { $taskPrevious = TaskPeer::retrieveByPK($appDelegationPrevious->getTasUid()); if (!is_null($taskPrevious)) { switch ($taskPrevious->getTasType()) { case "SCRIPT-TASK":
/** * @covers G::toUpper * @todo Implement testToUpper(). */ public function testToUpper() { $name = 'brayan'; $this->assertEquals('BRAYAN', G::toUpper($name)); }
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 = isset($_SESSION['_CODE_']) ? $_SESSION['_CODE_'] : null; 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'] = G::toUpper(G::loadTranslation('ID_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 (isset($_SESSION['TRIGGER_DEBUG']['ISSET']) && $_SESSION['TRIGGER_DEBUG']['ISSET']) { $_SESSION['TRIGGER_DEBUG']['TIME'] = G::toUpper(G::loadTranslation('ID_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; }
echo $response; break; case 'saveNewGroup': G::LoadClass('groups'); $newGroup['GRP_UID'] = ''; $newGroup['GRP_STATUS'] = G::toUpper($_POST['status']); $newGroup['GRP_TITLE'] = trim($_POST['name']); unset($newGroup['GRP_UID']); $group = new Groupwf(); $group->create($newGroup); echo '{success: true}'; break; case 'saveEditGroup': G::LoadClass('groups'); $editGroup['GRP_UID'] = $_POST['grp_uid']; $editGroup['GRP_STATUS'] = G::toUpper($_POST['status']); $editGroup['GRP_TITLE'] = trim($_POST['name']); $group = new Groupwf(); $group->update($editGroup); echo '{success: true}'; break; case 'deleteGroup': G::LoadClass('groups'); $group = new Groupwf(); if (!isset($_POST['GRP_UID'])) { return; } $group->remove(urldecode($_POST['GRP_UID'])); require_once 'classes/model/TaskUser.php'; $oProcess = new TaskUser(); $oCriteria = new Criteria('workflow');
unset($appFields['APP_PIN']); $oCase->updateCase($_SESSION['APPLICATION'], $appFields); //Save data //derivate case $oDerivation = new Derivation(); $aCurrentDerivation = array('APP_UID' => $_SESSION['APPLICATION'], 'DEL_INDEX' => $_SESSION['INDEX'], 'APP_STATUS' => $sStatus, 'TAS_UID' => $_SESSION['TASK'], 'ROU_TYPE' => $_POST['form']['ROU_TYPE']); $oDerivation->derivate($aCurrentDerivation, $_POST['form']['TASKS']); $appFields = $oCase->loadCase($_SESSION['APPLICATION']); //refresh appFields, because in derivations should change some values $triggers = $oCase->loadTriggers($_SESSION['TASK'], 'ASSIGN_TASK', -2, 'AFTER'); //load the triggers after derivation if (sizeof($triggers) > 0) { $appFields['APP_DATA'] = $oCase->ExecuteTriggers($_SESSION['TASK'], 'ASSIGN_TASK', -2, 'AFTER', $appFields['APP_DATA']); //Execute triggers after derivation $_SESSION['TRIGGER_DEBUG']['info'][1]['NUM_TRIGGERS'] = sizeof($triggers); $_SESSION['TRIGGER_DEBUG']['info'][1]['TIME'] = G::toUpper(G::loadTranslation('ID_AFTER')); $_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_NAMES'] = $oCase->getTriggerNames($triggers); $_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_VALUES'] = $triggers; } unset($appFields['APP_STATUS']); unset($appFields['APP_PROC_STATUS']); unset($appFields['APP_PROC_CODE']); unset($appFields['APP_PIN']); $oCase->updateCase($_SESSION['APPLICATION'], $appFields); // Send notifications - Start $oUser = new Users(); $aUser = $oUser->load($_SESSION['USER_LOGGED']); if (trim($aUser['USR_EMAIL']) == '') { $aUser['USR_EMAIL'] = 'info@' . $_SERVER['HTTP_HOST']; } $sFromName = '"' . $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . '" <' . $aUser['USR_EMAIL'] . '>';
/** * * @method * * Returns a string converted into all UPPERCASE letters. * * @name upperCase * @label Upper Case * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#upperCase.28.29 * * @param string(32) | $sText | Text To Convert | A string to convert to UPPERCASE letters. * @return string | $TextC | Text Converted | Returns a string with the text converted into upper case letters. * */ function upperCase($sText) { return G::toUpper($sText); }
public function dashCalculateDate ($iniDate, $duration, $formatDuration, $calendarData = array()) { if ( G::toUpper($formatDuration) == 'DAYS' ) { $duration = $duration*$calendarData['HOURS_FOR_DAY']; } if ( G::toUpper($formatDuration) == 'MINUTES' ) { $duration = $duration/60; } $hoursDuration = (float)$duration; $newDate = $iniDate; while ($hoursDuration > 0) { $newDate = $this->dashGetIniDate($newDate, $calendarData); $rangeWorkHour = $this->dashGetRangeWorkHours($newDate, $calendarData['BUSINESS_DAY']); $onlyDate = (date('Y-m-d',strtotime($newDate))) . ' ' . $rangeWorkHour['END']; if ( (((float)$hoursDuration) >= ((float)$rangeWorkHour['TOTAL'])) || ((strtotime($onlyDate) - strtotime($newDate)) < (((float)$hoursDuration)*3600)) ) { $secondRes = (float)(strtotime($onlyDate) - strtotime($newDate)); $newDate = $onlyDate; $hoursDuration -= (float)($secondRes/3600); } else { $newDate = date('Y-m-d H:i:s', strtotime('+' . (((float)$hoursDuration)*3600) . ' seconds', strtotime($newDate))); $hoursDuration = 0; } } return $newDate; }
} $aData['USR_AUTH_USER_DN'] = $aUser['sDN']; $sUserUID = $RBAC->createUser($aData, 'PROCESSMAKER_OPERATOR'); $aData['USR_STATUS'] = 'ACTIVE'; $aData['USR_UID'] = $sUserUID; $aData['USR_PASSWORD'] = md5($sUserUID); //fake :p $aData['USR_ROLE'] = 'PROCESSMAKER_OPERATOR'; if (count($aAttributes)) { foreach ($aAttributes as $value) { if (isset($aUser[$value['attributeUser']])) { $aData[$value['attributeUser']] = str_replace("*", "'", $aUser[$value['attributeUser']]); if ($value['attributeUser'] == 'USR_STATUS') { $evalValue = $aData[$value['attributeUser']]; $statusValue = 'INACTIVE'; if (is_string($evalValue) && G::toUpper($evalValue) == 'ACTIVE') { $statusValue = 'ACTIVE'; } if (is_bool($evalValue) && $evalValue == true) { $statusValue = 'ACTIVE'; } if ((is_float($evalValue) || is_int($evalValue) || is_integer($evalValue) || is_numeric($evalValue)) && (int) $evalValue != 0) { $statusValue = 'ACTIVE'; } $aData[$value['attributeUser']] = $statusValue; } } } } require_once 'classes/model/Users.php'; $oUser = new Users();
/** * 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; }
public function calculateDate($iniDate, $duration, $formatDuration, $calendarData = array()) { $calendarData = count($calendarData) ? $calendarData : $this->pmCalendarData; $this->pmCalendarData = $calendarData; if (G::toUpper($formatDuration) == 'DAYS') { $duration = $duration * $this->pmCalendarData['HOURS_FOR_DAY']; } /* $log = array(); $titles = array(); $titles[] = 'HOURS'; $titles[] = 'DATE'; $titles[] = '**DAY'; $titles[] = '**RANGE'; $titles[] = '**HOURS RANGE'; $titles[] = '**SUM HOURS'; $titles[] = '**NEXT DATE'; $log[] = $titles; $dataLog = array(); $dataLog[] = $duration; $dataLog[] = $iniDate; $dataLog[] = '-----'; $dataLog[] = '-----'; $dataLog[] = '-----'; $dataLog[] = '-----'; $dataLog[] = '-----'; $log[] = $dataLog; */ $hoursDuration = (double) $duration; $newDate = $iniDate; while ($hoursDuration > 0) { //$dataLog = array(); $newDate = $this->getIniDate($newDate); //$dataLog[] = $hoursDuration; //$dataLog[] = $newDate; $rangeWorkHour = $this->getRangeWorkHours($newDate, $calendarData['BUSINESS_DAY']); $onlyDate = date('Y-m-d', strtotime($newDate)) . ' ' . $rangeWorkHour['END']; //$dataLog[] = date('l',strtotime($newDate)); //$dataLog[] = $rangeWorkHour['START'] . ' / ' . $rangeWorkHour['END']; //$dataLog[] = $rangeWorkHour['TOTAL']; if ((double) $hoursDuration >= (double) $rangeWorkHour['TOTAL'] || strtotime($onlyDate) - strtotime($newDate) < (double) $hoursDuration * 3600) { $secondRes = (double) (strtotime($onlyDate) - strtotime($newDate)); $newDate = $onlyDate; $hoursDuration -= (double) ($secondRes / 3600); //$dataLog[] = (float)($secondRes/3600); } else { $newDate = date('Y-m-d H:i:s', strtotime('+' . (double) $hoursDuration * 3600 . ' seconds', strtotime($newDate))); //$dataLog[] = (float)($hoursDuration); $hoursDuration = 0; } //$dataLog[] = $newDate; //$log[] = $dataLog; } //$this->showLog($log); $result['DUE_DATE'] = $newDate; $result['DUE_DATE_SECONDS'] = strtotime($newDate); return $result; }
/** * Validate Table Name * @var string $rep_tab_name. Name for report table * * @author Brayan Pereyra (Cochalo) <*****@*****.**> * @copyright Colosa - Bolivia * * @return string */ public function validateTabName($rep_tab_name, $reportFlag = false) { $rep_tab_name = trim($rep_tab_name); $nametype = $reportFlag == false ? 'pmt_tab_name' : 'rep_tab_name'; if (strpos($rep_tab_name, ' ') || strlen($rep_tab_name) < 4) { throw new \Exception("The property {$nametype}: '{$rep_tab_name}' is incorrect."); } $rep_tab_name = G::toUpper($rep_tab_name); if (substr($rep_tab_name, 0, 4) != 'PMT_') { $rep_tab_name = 'PMT_' . $rep_tab_name; } return $rep_tab_name; }