From f6788b35d5b0a221476a6f57863f1fca46d6ab00 Mon Sep 17 00:00:00 2001 From: jennylee Date: Thu, 26 Mar 2015 18:14:51 -0400 Subject: [PATCH] Resolving conflicts --- workflow/engine/bin/cron_single.php | 127 +- workflow/engine/classes/class.calendar.php | 252 +- .../engine/classes/model/AppCacheView.php | 63 + .../engine/classes/model/AppDelegation.php | 1261 +++---- workflow/engine/classes/model/Application.php | 106 + .../model/map/ApplicationMapBuilder.php | 212 +- .../classes/model/map/UsersMapBuilder.php | 4 + .../classes/model/om/BaseApplication.php | 3087 +++++++++-------- .../classes/model/om/BaseApplicationPeer.php | 1299 +++---- .../engine/classes/model/om/BaseUsers.php | 111 +- workflow/engine/config/schema.xml | 214 ++ workflow/engine/data/mysql/insert.sql | 306 +- workflow/engine/menus/processmaker.php | 123 +- workflow/engine/menus/setup.php | 313 +- .../engine/src/ProcessMaker/Services/api.ini | 6 + 15 files changed, 4253 insertions(+), 3231 deletions(-) diff --git a/workflow/engine/bin/cron_single.php b/workflow/engine/bin/cron_single.php index 3ea41dd34..7e96db536 100755 --- a/workflow/engine/bin/cron_single.php +++ b/workflow/engine/bin/cron_single.php @@ -352,6 +352,9 @@ Bootstrap::registerClass('wsResponse', PATH_HOME . "engine/classes/clas Bootstrap::registerClass("PMLicensedFeatures", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.licensedFeatures.php"); Bootstrap::registerClass("AddonsManagerPeer", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "AddonsManagerPeer.php"); +/*----------------------------------********---------------------------------*/ +Bootstrap::registerClass('dashboards', PATH_HOME . "engine/classes/class.dashboards.php"); +/*----------------------------------********---------------------------------*/ $arrayClass = array("EmailServer", "ListInbox", "ListParticipatedHistory"); @@ -365,14 +368,33 @@ foreach ($arrayClass as $value) { G::LoadClass("serverConfiguration"); G::LoadClass("dates"); //Load Criteria +/*----------------------------------********---------------------------------*/ +global $dateInit; +global $dateFinish; +/*----------------------------------********---------------------------------*/ + if (!defined('SYS_SYS')) { - $sObject = $argv[1]; - $sNow = $argv[2]; + $sObject = $argv[1]; + $sNow = $argv[2]; $dateSystem = $argv[3]; - $sFilter = ''; + /*----------------------------------********---------------------------------*/ + $dateInit = null; + $dateFinish = null; + /*----------------------------------********---------------------------------*/ + $sFilter = ''; for ($i = 4; $i <= count($argv) - 1; $i++) { - $sFilter .= ' ' . $argv[$i]; + /*----------------------------------********---------------------------------*/ + if (strpos($argv[$i], "+init-date") !== false) { + $dateInit = substr($argv[$i],10); + } else if (strpos($argv[$i], "+finish-date") !== false) { + $dateFinish = substr($argv[$i], 12); + } else { + /*----------------------------------********---------------------------------*/ + $sFilter .= ' ' . $argv[$i]; + /*----------------------------------********---------------------------------*/ + } + /*----------------------------------********---------------------------------*/ } $oDirectory = dir(PATH_DB); @@ -470,7 +492,7 @@ if (!defined('SYS_SYS')) { } catch (Exception $e) { echo $e->getMessage(); - eprintln("Probelm in workspace: " . $sObject . " it was omitted.", "red"); + eprintln("Problem in workspace: " . $sObject . " it was omitted.", "red"); } eprintln(); @@ -502,11 +524,18 @@ function processWorkspace() resendEmails(); unpauseApplications(); calculateDuration(); + /*----------------------------------********---------------------------------*/ + calculateAppDuration(); + /*----------------------------------********---------------------------------*/ executeEvents($sLastExecution); executeScheduledCases(); executeUpdateAppTitle(); executeCaseSelfService(); executePlugins(); + /*----------------------------------********---------------------------------*/ + fillReportByUser(); + fillReportByProcess(); + /*----------------------------------********---------------------------------*/ } catch (Exception $oError) { saveLog("main", "error", "Error processing workspace : " . $oError->getMessage() . "\n"); } @@ -696,6 +725,31 @@ function calculateDuration() } } +/*----------------------------------********---------------------------------*/ +function calculateAppDuration() +{ + global $sFilter; + + if ($sFilter != '' && strpos($sFilter, 'calculateapp') === false) { + return false; + } + + setExecutionMessage("Calculating Duration by Application"); + + try { + $oApplication = new Application(); + $oApplication->calculateAppDuration(1); + + setExecutionResultMessage('DONE'); + saveLog('calculateDurationByApp', 'action', 'Calculating Duration by Application'); + } catch (Exception $oError) { + setExecutionResultMessage('WITH ERRORS', 'error'); + eprintln(" '-".$oError->getMessage(), 'red'); + saveLog('calculateDurationByApp', 'error', 'Error Calculating Duration: ' . $oError->getMessage()); + } +} +/*----------------------------------********---------------------------------*/ + function executeEvents($sLastExecution, $sNow=null) { global $sFilter; @@ -1038,3 +1092,66 @@ function setExecutionResultMessage($m, $t='') eprintln("[$m]", $c); } +/*----------------------------------********---------------------------------*/ +function fillReportByUser () +{ + try { + global $sFilter; + global $dateInit; + global $dateFinish; + + if (strpos($sFilter, 'report_by_user') === false) { + return false; + } + if ($dateInit == null) { + eprintln("You must enter the starting date.", "red"); + eprintln('Example: +init-date"YYYY-MM-DD HH:MM:SS" +finish-date"YYYY-MM-DD HH:MM:SS"', "red"); + return false; + } + + $dateFinish = ($dateFinish != null) ? $dateFinish : date("Y-m-d H:i:s"); + + $appcv = new AppCacheView(); + $appcv->setPathToAppCacheFiles( PATH_METHODS . 'setup' . PATH_SEP . 'setupSchemas' . PATH_SEP ); + setExecutionMessage("Calculating data to fill the 'User Reporting'..."); + $appcv->fillReportByUser($dateInit, $dateFinish); + setExecutionResultMessage("DONE"); + } catch (Exception $e) { + setExecutionResultMessage("WITH ERRORS", "error"); + eprintln(" '-" . $e->getMessage(), "red"); + saveLog("fillReportByUser", "error", "Error in fill report by user: " . $e->getMessage()); + } +} + +function fillReportByProcess () +{ + try { + global $sFilter; + global $dateInit; + global $dateFinish; + + if (strpos($sFilter, 'report_by_process') === false) { + return false; + } + + if ($dateInit == null) { + eprintln("You must enter the starting date.", "red"); + eprintln('Example: +init-date"YYYY-MM-DD HH:MM:SS" +finish-date"YYYY-MM-DD HH:MM:SS"', "red"); + return false; + } + + $dateFinish = ($dateFinish != null) ? $dateFinish : date("Y-m-d H:i:s"); + $appcv = new AppCacheView(); + $appcv->setPathToAppCacheFiles( PATH_METHODS . 'setup' . PATH_SEP . 'setupSchemas' . PATH_SEP ); + + setExecutionMessage("Calculating data to fill the 'Process Reporting'..."); + $appcv->fillReportByProcess($dateInit, $dateFinish); + setExecutionResultMessage("DONE"); + } catch (Exception $e) { + setExecutionResultMessage("WITH ERRORS", "error"); + eprintln(" '-" . $e->getMessage(), "red"); + saveLog("fillReportByProcess", "error", "Error in fill report by process: " . $e->getMessage()); + } +} +/*----------------------------------********---------------------------------*/ + diff --git a/workflow/engine/classes/class.calendar.php b/workflow/engine/classes/class.calendar.php index e6e28c5b9..7ec30c177 100755 --- a/workflow/engine/classes/class.calendar.php +++ b/workflow/engine/classes/class.calendar.php @@ -414,7 +414,7 @@ class calendar extends CalendarDefinition $hoursDuration -= (float)($secondRes/3600); //$dataLog[] = (float)($secondRes/3600); } else { - $newDate = date("Y-m-d H:i:s", strtotime("+" . round(((float)($hoursDuration)) * 3600) . " seconds", strtotime($newDate))); + $newDate = date('Y-m-d H:i:s', strtotime('+' . (((float)$hoursDuration)*3600) . ' seconds', strtotime($newDate))); //$dataLog[] = (float)($hoursDuration); $hoursDuration = 0; } @@ -796,5 +796,253 @@ class calendar extends CalendarDefinition return $return; } + + + + + /**************SLA classes***************/ + public function dashCalculateDate ($iniDate, $duration, $formatDuration, $calendarData = array()) + { + if ( G::toUpper($formatDuration) == 'DAYS' ) { + $duration = $duration*$calendarData['HOURS_FOR_DAY']; + } + + $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; + } + + //Calculate the duration betwen two dates with a calendar + public function dashCalculateDurationWithCalendar ($iniDate, $finDate = null, $calendarData = array()) + { + if ((is_null($finDate)) || ($finDate == '')) { + $finDate = date('Y-m-d H:i:s'); + } + + $secondDuration = 0.00; + + if ( (strtotime($iniDate)) < (strtotime($finDate)) ) { + $timeIniDate = strtotime($iniDate); + $timeFinDate = strtotime($finDate); + } elseif ( (strtotime($finDate)) < (strtotime($iniDate)) ) { + $timeIniDate = strtotime($finDate); + $timeFinDate = strtotime($iniDate); + $auxDate = $iniDate; + $iniDate = $finDate; + $finDate = $auxDate; + } else { + return $secondDuration; + } + + $finDate = $this->dashGetIniDate($finDate, $calendarData); + $newDate = $iniDate; + while ($timeIniDate < $timeFinDate) { + $newDate = $this->dashGetIniDate($newDate, $calendarData); + + $rangeWorkHour = $this->dashGetRangeWorkHours($newDate, $calendarData['BUSINESS_DAY']); + $onlyDate = (date('Y-m-d',strtotime($newDate))) . ' ' . $rangeWorkHour['END']; + + if ( (strtotime($finDate)) < (strtotime($onlyDate)) ) { + $secondRes = ( ((float)strtotime($finDate)) - ((float)strtotime($newDate)) ); + $timeIniDate = strtotime($finDate); + $secondDuration += (float)$secondRes; + } else { + $secondRes = ( ((float)strtotime($onlyDate)) - ((float)strtotime($newDate)) ); + $newDate = $onlyDate; + $timeIniDate = strtotime($onlyDate); + $secondDuration += (float)$secondRes; + } + } + return $secondDuration; + } + + public function dashGetIniDate ($iniDate, $calendarData = array()) + { + $flagIniDate = true; + + while ($flagIniDate) { + // 1 if it's a work day + $weekDay = date('w',strtotime($iniDate)); + if ( !(in_array($weekDay, $calendarData['CALENDAR_WORK_DAYS_A'])) ) { + $iniDate = date('Y-m-d'.' 00:00:00' , strtotime('+1 day', strtotime($iniDate))); + continue; + } + + // 2 if it's a holiday + $iniDateHolidayDay = $this->dashIs_holiday($iniDate, $calendarData['HOLIDAY']); + if ($iniDateHolidayDay) { + $iniDate = date('Y-m-d'.' 00:00:00' , strtotime('+1 day', strtotime($iniDate))); + continue; + } + + // 3 if it's work time + $workHours = $this->dashNextWorkHours($iniDate, $weekDay, $calendarData['BUSINESS_DAY']); + if ( !($workHours['STATUS']) ) { + $iniDate = date('Y-m-d'.' 00:00:00' , strtotime('+1 day', strtotime($iniDate))); + continue; + } else { + $iniDate = $workHours['DATE']; + } + $flagIniDate = false; + } + + return $iniDate; + } + + public function dashNextWorkHours ($date, $weekDay, $workHours = array()) + { + $auxIniDate = explode(' ', $date); + + $timeDate = $auxIniDate['1']; + $timeDate = (float)str_replace(':', '', ((strlen($timeDate) == 8) ? $timeDate : $timeDate.':00') ); + $nextWorkHours = array(); + + $workHoursDay = array(); + $tempWorkHoursDay = array(); + + foreach ($workHours as $value) { + if ($value['CALENDAR_BUSINESS_DAY'] == $weekDay) { + $rangeWorkHour = array(); + $timeStart = $value['CALENDAR_BUSINESS_START']; + $timeEnd = $value['CALENDAR_BUSINESS_END']; + $rangeWorkHour['START'] = ((strlen($timeStart) == 8) ? $timeStart : $timeStart.':00'); + $rangeWorkHour['END'] = ((strlen($timeEnd) == 8) ? $timeEnd : $timeEnd.':00'); + + $workHoursDay[] = $rangeWorkHour; + } + + if ($value['CALENDAR_BUSINESS_DAY'] == '7') { + $rangeWorkHour = array(); + $timeStart = $value['CALENDAR_BUSINESS_START']; + $timeEnd = $value['CALENDAR_BUSINESS_END']; + $rangeWorkHour['START'] = ((strlen($timeStart) == 8) ? $timeStart : $timeStart.':00'); + $rangeWorkHour['END'] = ((strlen($timeEnd) == 8) ? $timeEnd : $timeEnd.':00'); + + $tempWorkHoursDay[] = $rangeWorkHour; + } + } + + if ( !(count($workHoursDay)) ) { + $workHoursDay = $tempWorkHoursDay; + } + + $countHours = count($workHoursDay); + if ($countHours) { + for ($i = 1; $i < $countHours; $i++) { + for ($j = 0; $j < $countHours-$i; $j++) { + $dataft = (float)str_replace(':', '', $workHoursDay[$j]['START']); + $datasc = (float)str_replace(':', '', $workHoursDay[$j+1]['END']); + if ($dataft > $datasc) { + $aux = $workHoursDay[$j+1]; + $workHoursDay[$j+1] = $workHoursDay[$j]; + $workHoursDay[$j] = $aux; + } + } + } + + foreach ($workHoursDay as $value) { + $iniTime = (float)str_replace(':', '', ((strlen($value['START']) == 8) ? $value['START'] : $value['START'].':00')); + $finTime = (float)str_replace(':', '', ((strlen($value['END']) == 8) ? $value['END'] : $value['END'].':00')); + + if ( $timeDate <= $iniTime ) { + $nextWorkHours['STATUS'] = true; + $nextWorkHours['DATE'] = $auxIniDate['0'] . ' ' . ((strlen($value['START']) == 8) ? $value['START'] : $value['START'].':00'); + return $nextWorkHours; + } elseif ( ($iniTime <= $timeDate) && ($timeDate < $finTime) ) { + $nextWorkHours['STATUS'] = true; + $nextWorkHours['DATE'] = $date; + return $nextWorkHours; + } + } + } + + $nextWorkHours['STATUS'] = false; + return $nextWorkHours; + } + + public function dashIs_holiday ($date, $holidays = array()) + { + $auxIniDate = explode(' ', $date); + $iniDate = $auxIniDate['0']; + $iniDate = strtotime($iniDate); + + foreach ($holidays as $value) { + $holidayStartDate = strtotime(date('Y-m-d',strtotime($value['CALENDAR_HOLIDAY_START']))); + $holidayEndDate = strtotime(date('Y-m-d',strtotime($value['CALENDAR_HOLIDAY_END']))); + + if ( ($holidayStartDate <= $iniDate) && ($iniDate <= $holidayEndDate) ) { + return true; + } + } + return false; + } + + public function dashGetRangeWorkHours ($date, $workHours) + { + $auxIniDate = explode(' ', $date); + $timeDate = $auxIniDate['1']; + $timeDate = (float)str_replace(':', '', ((strlen($timeDate) == 8) ? $timeDate : $timeDate.':00') ); + $weekDay = date('w',strtotime($date)); + + $workHoursDay = array(); + $tempWorkHoursDay = array(); + + foreach ($workHours as $value) { + if ($value['CALENDAR_BUSINESS_DAY'] == $weekDay) { + $rangeWorkHour = array(); + $timeStart = $value['CALENDAR_BUSINESS_START']; + $timeEnd = $value['CALENDAR_BUSINESS_END']; + $rangeWorkHour['START'] = ((strlen($timeStart) == 8) ? $timeStart : $timeStart.':00'); + $rangeWorkHour['END'] = ((strlen($timeEnd) == 8) ? $timeEnd : $timeEnd.':00'); + + $workHoursDay[] = $rangeWorkHour; + } + + if ($value['CALENDAR_BUSINESS_DAY'] == '7') { + $rangeWorkHour = array(); + $timeStart = $value['CALENDAR_BUSINESS_START']; + $timeEnd = $value['CALENDAR_BUSINESS_END']; + $rangeWorkHour['START'] = ((strlen($timeStart) == 8) ? $timeStart : $timeStart.':00'); + $rangeWorkHour['END'] = ((strlen($timeEnd) == 8) ? $timeEnd : $timeEnd.':00'); + + $tempWorkHoursDay[] = $rangeWorkHour; + } + } + + if ( !(count($workHoursDay)) ) { + $workHoursDay = $tempWorkHoursDay; + } + + foreach ($workHoursDay as $value) { + $iniTime = (float)str_replace(':', '', $value['START']); + $finTime = (float)str_replace(':', '', $value['END']); + + if ( ($iniTime <= $timeDate) && ($timeDate <= $finTime) ) { + //pr($finTime .' menos '.$iniTime .' = '.($finTime-$iniTime)); + $value['TOTAL'] = (($finTime-$iniTime)/10000); + return $value; + } + } + return false; + } + } -?> +?> \ No newline at end of file diff --git a/workflow/engine/classes/model/AppCacheView.php b/workflow/engine/classes/model/AppCacheView.php index 71e0be44d..8e8624b11 100755 --- a/workflow/engine/classes/model/AppCacheView.php +++ b/workflow/engine/classes/model/AppCacheView.php @@ -1792,5 +1792,68 @@ class AppCacheView extends BaseAppCacheView $criteria->addSelectColumn(AppCacheViewPeer::APP_OVERDUE_PERCENTAGE); return $criteria; } + + /*----------------------------------********---------------------------------*/ + function fillReportByUser () + { + try { + global $sFilter; + global $dateInit; + global $dateFinish; + + if (strpos($sFilter, 'report_by_user') === false) { + return false; + } + if ($dateInit == null) { + eprintln("You must enter the starting date.", "red"); + eprintln('Example: +init-date"YYYY-MM-DD HH:MM:SS" +finish-date"YYYY-MM-DD HH:MM:SS"', "red"); + return false; + } + + $dateFinish = ($dateFinish != null) ? $dateFinish : date("Y-m-d H:i:s"); + + $appcv = new AppCacheView(); + $appcv->setPathToAppCacheFiles( PATH_METHODS . 'setup' . PATH_SEP . 'setupSchemas' . PATH_SEP ); + setExecutionMessage("Calculating data to fill the 'User Reporting'..."); + $appcv->fillReportByUser($dateInit, $dateFinish); + setExecutionResultMessage("DONE"); + } catch (Exception $e) { + setExecutionResultMessage("WITH ERRORS", "error"); + eprintln(" '-" . $e->getMessage(), "red"); + saveLog("fillReportByUser", "error", "Error in fill report by user: " . $e->getMessage()); + } + } + + function fillReportByProcess () + { + try { + global $sFilter; + global $dateInit; + global $dateFinish; + + if (strpos($sFilter, 'report_by_process') === false) { + return false; + } + + if ($dateInit == null) { + eprintln("You must enter the starting date.", "red"); + eprintln('Example: +init-date"YYYY-MM-DD HH:MM:SS" +finish-date"YYYY-MM-DD HH:MM:SS"', "red"); + return false; + } + + $dateFinish = ($dateFinish != null) ? $dateFinish : date("Y-m-d H:i:s"); + $appcv = new AppCacheView(); + $appcv->setPathToAppCacheFiles( PATH_METHODS . 'setup' . PATH_SEP . 'setupSchemas' . PATH_SEP ); + + setExecutionMessage("Calculating data to fill the 'Process Reporting'..."); + $appcv->fillReportByProcess($dateInit, $dateFinish); + setExecutionResultMessage("DONE"); + } catch (Exception $e) { + setExecutionResultMessage("WITH ERRORS", "error"); + eprintln(" '-" . $e->getMessage(), "red"); + saveLog("fillReportByProcess", "error", "Error in fill report by process: " . $e->getMessage()); + } + } + /*----------------------------------********---------------------------------*/ } diff --git a/workflow/engine/classes/model/AppDelegation.php b/workflow/engine/classes/model/AppDelegation.php index ae22e501b..bec999201 100755 --- a/workflow/engine/classes/model/AppDelegation.php +++ b/workflow/engine/classes/model/AppDelegation.php @@ -1,626 +1,635 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -//require_once 'classes/model/om/BaseAppDelegation.php'; -//require_once ("classes/model/HolidayPeer.php"); -//require_once ("classes/model/TaskPeer.php"); -//require_once ("classes/model/Task.php"); -//G::LoadClass( "dates" ); - -/** - * Skeleton subclass for representing a row from the 'APP_DELEGATION' table. - * - * - * - * You should add additional methods to this class to meet the - * application requirements. This class will only be generated as - * long as it does not already exist in the output directory. - * - * @package workflow.engine.classes.model - */ -class AppDelegation extends BaseAppDelegation -{ - - /** - * create an application delegation - * - * @param $sProUid process Uid - * @param $sAppUid Application Uid - * @param $sTasUid Task Uid - * @param $sUsrUid User Uid - * @param $iPriority delegation priority - * @param $isSubprocess is a subprocess inside a process? - * @return delegation index of the application delegation. - */ - public function createAppDelegation ($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sAppThread, $iPriority = 3, $isSubprocess = false, $sPrevious = -1, $sNextTasParam = null) - { - if (! isset( $sProUid ) || strlen( $sProUid ) == 0) { - throw (new Exception( 'Column "PRO_UID" cannot be null.' )); - } - - if (! isset( $sAppUid ) || strlen( $sAppUid ) == 0) { - throw (new Exception( 'Column "APP_UID" cannot be null.' )); - } - - if (! isset( $sTasUid ) || strlen( $sTasUid ) == 0) { - throw (new Exception( 'Column "TAS_UID" cannot be null.' )); - } - - if (! isset( $sUsrUid ) /*|| strlen($sUsrUid ) == 0*/ ) { - throw (new Exception( 'Column "USR_UID" cannot be null.' )); - } - - if (! isset( $sAppThread ) || strlen( $sAppThread ) == 0) { - throw (new Exception( 'Column "APP_THREAD" cannot be null.' )); - } - - //Get max DEL_INDEX - $criteria = new Criteria("workflow"); - $criteria->add(AppDelegationPeer::APP_UID, $sAppUid); - $criteria->add(AppDelegationPeer::DEL_LAST_INDEX, 1); - - $criteriaIndex = clone $criteria; - - $rs = AppDelegationPeer::doSelectRS($criteriaIndex); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - - $delIndex = 1; - $delPreviusUsrUid = ''; - if ($rs->next()) { - $row = $rs->getRow(); - - $delIndex = (isset($row["DEL_INDEX"]))? $row["DEL_INDEX"] + 1 : 1; - $delPreviusUsrUid = $row["USR_UID"]; - } else { - $criteriaDelIndex = new Criteria("workflow"); - - $criteriaDelIndex->addSelectColumn(AppDelegationPeer::DEL_INDEX); - $criteriaDelIndex->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE); - $criteriaDelIndex->add(AppDelegationPeer::APP_UID, $sAppUid); - $criteriaDelIndex->addDescendingOrderByColumn(AppDelegationPeer::DEL_DELEGATE_DATE); - - $rsCriteriaDelIndex = AppDelegationPeer::doSelectRS($criteriaDelIndex); - $rsCriteriaDelIndex->setFetchmode(ResultSet::FETCHMODE_ASSOC); - - if ($rsCriteriaDelIndex->next()) { - $row = $rsCriteriaDelIndex->getRow(); - - $delIndex = (isset($row["DEL_INDEX"]))? $row["DEL_INDEX"] + 1 : 1; - } - } - - //Update set - $criteriaUpdate = new Criteria('workflow'); - $criteriaUpdate->add(AppDelegationPeer::DEL_LAST_INDEX, 0); - BasePeer::doUpdate($criteria, $criteriaUpdate, Propel::getConnection('workflow')); - - $this->setAppUid( $sAppUid ); - $this->setProUid( $sProUid ); - $this->setTasUid( $sTasUid ); - $this->setDelIndex( $delIndex ); - $this->setDelLastIndex(1); - $this->setDelPrevious( $sPrevious == - 1 ? 0 : $sPrevious ); - $this->setUsrUid( $sUsrUid ); - $this->setDelType( 'NORMAL' ); - $this->setDelPriority( ($iPriority != '' ? $iPriority : '3') ); - $this->setDelThread( $sAppThread ); - $this->setDelThreadStatus( 'OPEN' ); - $this->setDelDelegateDate( 'now' ); - - //The function return an array now. By JHL - $delTaskDueDate = $this->calculateDueDate( $sNextTasParam ); - - $this->setDelTaskDueDate( $delTaskDueDate['DUE_DATE'] ); // Due date formatted - - if ((defined( "DEBUG_CALENDAR_LOG" )) && (DEBUG_CALENDAR_LOG)) { - $this->setDelData( $delTaskDueDate['DUE_DATE_LOG'] ); // Log of actions made by Calendar Engine - } else { - $this->setDelData( '' ); - } - - // this condition assures that an internal delegation like a subprocess dont have an initial date setted - if ($delIndex == 1 && ! $isSubprocess) { - //the first delegation, init date this should be now for draft applications, in other cases, should be null. - $this->setDelInitDate( 'now' ); - } - - if ($this->validate()) { - try { - $res = $this->save(); - } catch (PropelException $e) { - throw ($e); - } - } else { - // Something went wrong. We can now get the validationFailures and handle them. - $msg = ''; - $validationFailuresArray = $this->getValidationFailures(); - foreach ($validationFailuresArray as $objValidationFailure) { - $msg .= $objValidationFailure->getMessage() . "
"; - } - throw (new Exception( 'Failed Data validation. ' . $msg )); - } - - $delIndex = $this->getDelIndex(); - - // Hook for the trigger PM_CREATE_NEW_DELEGATION - if (defined( 'PM_CREATE_NEW_DELEGATION' )) { - $data = new stdclass(); - $data->TAS_UID = $sTasUid; - $data->APP_UID = $sAppUid; - $data->DEL_INDEX = $delIndex; - $data->USR_UID = $sUsrUid; - $oPluginRegistry = &PMPluginRegistry::getSingleton(); - $oPluginRegistry->executeTriggers(PM_CREATE_NEW_DELEGATION, $data); - - /*----------------------------------********---------------------------------*/ - // this section evaluates the actions by email trigger execution please - // modify this section carefully, the if evaluation checks if the license has been - // activated in order to send the mail according to the configuration table - if (PMLicensedFeatures - ::getSingleton() - ->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) { - G::LoadClass('actionsByEmail'); - $actionsByEmail = new actionsByEmailClass(); - $actionsByEmail->sendActionsByEmail($data); - } - /*----------------------------------********---------------------------------*/ - } - - return $delIndex; - } - - /** - * Load the Application Delegation row specified in [app_id] column value. - * - * @param string $AppUid the uid of the application - * @return array $Fields the fields - */ - - public function Load ($AppUid, $sDelIndex) - { - $con = Propel::getConnection( AppDelegationPeer::DATABASE_NAME ); - try { - $oAppDel = AppDelegationPeer::retrieveByPk( $AppUid, $sDelIndex ); - if (is_object( $oAppDel ) && get_class( $oAppDel ) == 'AppDelegation') { - $aFields = $oAppDel->toArray( BasePeer::TYPE_FIELDNAME ); - $this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME ); - return $aFields; - } else { - throw (new Exception( "The row '$AppUid, $sDelIndex' in table AppDelegation doesn't exist!" )); - } - } catch (Exception $oError) { - throw ($oError); - } - } - - /* Load the Application Delegation row specified in [app_id] column value. - * - * @param string $AppUid the uid of the application - * @return array $Fields the fields - */ - - public function LoadParallel ($AppUid) - { - $aCases = array(); - - $c = new Criteria( 'workflow' ); - $c->addSelectColumn( AppDelegationPeer::APP_UID ); - $c->addSelectColumn( AppDelegationPeer::DEL_INDEX ); - $c->addSelectColumn( AppDelegationPeer::PRO_UID ); - $c->addSelectColumn( AppDelegationPeer::TAS_UID ); - $c->addSelectColumn( AppDelegationPeer::USR_UID ); - $c->addSelectColumn( AppDelegationPeer::DEL_DELEGATE_DATE ); - $c->addSelectColumn( AppDelegationPeer::DEL_INIT_DATE ); - $c->addSelectColumn( AppDelegationPeer::DEL_TASK_DUE_DATE ); - $c->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE ); - - $c->add( AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN' ); - $c->add( AppDelegationPeer::APP_UID, $AppUid ); - $c->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX ); - $rs = AppDelegationPeer::doSelectRS( $c ); - $row= $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - - $rs->next(); - $row = $rs->getRow(); - - while (is_array($row)) { - $case = array(); - $case['TAS_UID'] = $row['TAS_UID']; - $case['USR_UID'] = $row['USR_UID']; - $case['DEL_INDEX'] = $row['DEL_INDEX']; - $case['TAS_UID'] = $row['TAS_UID']; - $case['DEL_DELEGATE_DATE'] = $row['DEL_DELEGATE_DATE']; - $case['DEL_INIT_DATE'] = $row['DEL_INIT_DATE']; - $case['DEL_TASK_DUE_DATE'] = $row['DEL_TASK_DUE_DATE']; - $case['DEL_FINISH_DATE'] = $row['DEL_FINISH_DATE']; - $aCases[] = $case; - $rs->next(); - $row = $rs->getRow(); - } - - return $aCases; - } - - /** - * Update the application row - * - * @param array $aData - * @return variant - * - */ - - public function update ($aData) - { - $con = Propel::getConnection( AppDelegationPeer::DATABASE_NAME ); - try { - $con->begin(); - $oApp = AppDelegationPeer::retrieveByPK( $aData['APP_UID'], $aData['DEL_INDEX'] ); - if (is_object( $oApp ) && get_class( $oApp ) == 'AppDelegation') { - $oApp->fromArray( $aData, BasePeer::TYPE_FIELDNAME ); - if ($oApp->validate()) { - $res = $oApp->save(); - $con->commit(); - return $res; - } else { - $msg = ''; - foreach ($this->getValidationFailures() as $objValidationFailure) { - $msg .= $objValidationFailure->getMessage() . "
"; - } - - throw (new PropelException( 'The row cannot be created!', new PropelException( $msg ) )); - } - } else { - $con->rollback(); - throw (new Exception( "This AppDelegation row doesn't exist!" )); - } - } catch (Exception $oError) { - throw ($oError); - } - } - - public function remove ($sApplicationUID, $iDelegationIndex) - { - $oConnection = Propel::getConnection( StepTriggerPeer::DATABASE_NAME ); - try { - $oConnection->begin(); - $oApp = AppDelegationPeer::retrieveByPK( $sApplicationUID, $iDelegationIndex ); - if (is_object( $oApp ) && get_class( $oApp ) == 'AppDelegation') { - $result = $oApp->delete(); - } - $oConnection->commit(); - return $result; - } catch (Exception $e) { - $oConnection->rollback(); - throw ($e); - } - } - - // TasTypeDay = 1 => working days - // TasTypeDay = 2 => calendar days - public function calculateDueDate ($sNextTasParam) - { - //Get Task properties - $task = TaskPeer::retrieveByPK( $this->getTasUid() ); - - $aData['TAS_UID'] = $this->getTasUid(); - //Added to allow User defined Timing Control at Run time from Derivation screen - if (isset( $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] ) && $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] == 'true') { - $aData['TAS_DURATION'] = $sNextTasParam['NEXT_TASK']['TAS_DURATION']; - $aData['TAS_TIMEUNIT'] = $sNextTasParam['NEXT_TASK']['TAS_TIMEUNIT']; - $aData['TAS_TYPE_DAY'] = $sNextTasParam['NEXT_TASK']['TAS_TYPE_DAY']; - - if (isset( $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'] ) && $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'] != '') { - $aCalendarUID = $sNextTasParam['NEXT_TASK']['TAS_CALENDAR']; - } else { - $aCalendarUID = ''; - } - - //Updating the task Table , so that user will see updated values in the assign screen in consequent cases - $oTask = new Task(); - $oTask->update( $aData ); - } else { - if (is_null( $task )) { - return 0; - } - $aData['TAS_DURATION'] = $task->getTasDuration(); - $aData['TAS_TIMEUNIT'] = $task->getTasTimeUnit(); - $aData['TAS_TYPE_DAY'] = $task->getTasTypeDay(); - $aCalendarUID = ''; - } - - //use the dates class to calculate dates - $calendar = new calendar(); - - if ($calendar->pmCalendarUid == '') { - $calendar->getCalendar(null, $task->getProUid(), $aData['TAS_UID']); - $calendar->getCalendarData(); - } - - $iDueDate = $calendar->calculateDate( $this->getDelDelegateDate(), $aData['TAS_DURATION'], $aData['TAS_TIMEUNIT'] //hours or days, ( we only accept this two types or maybe weeks - ); - - return $iDueDate; - } - - public function getDiffDate ($date1, $date2) - { - return ($date1 - $date2) / (24 * 60 * 60); //days - return ($date1 - $date2) / 3600; - } - - public function calculateDuration ($cron = 0) - { - try { - if ($cron == 1) { - $arrayCron = unserialize( trim( @file_get_contents( PATH_DATA . "cron" ) ) ); - $arrayCron["processcTimeStart"] = time(); - @file_put_contents( PATH_DATA . "cron", serialize( $arrayCron ) ); - } - - //patch rows with initdate = null and finish_date - $c = new Criteria(); - $c->clearSelectColumns(); - $c->addSelectColumn( AppDelegationPeer::APP_UID ); - $c->addSelectColumn( AppDelegationPeer::DEL_INDEX ); - $c->addSelectColumn( AppDelegationPeer::DEL_DELEGATE_DATE ); - $c->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE ); - $c->add( AppDelegationPeer::DEL_INIT_DATE, null, Criteria::ISNULL ); - $c->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNOTNULL ); - //$c->add(AppDelegationPeer::DEL_INDEX, 1); - - - $rs = AppDelegationPeer::doSelectRS( $c ); - $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $rs->next(); - $row = $rs->getRow(); - - while (is_array( $row )) { - $oAppDel = AppDelegationPeer::retrieveByPk( $row['APP_UID'], $row['DEL_INDEX'] ); - if (isset( $row['DEL_FINISH_DATE'] )) { - $oAppDel->setDelInitDate( $row['DEL_FINISH_DATE'] ); - } else { - $oAppDel->setDelInitDate( $row['DEL_INIT_DATE'] ); - } - $oAppDel->save(); - - $rs->next(); - $row = $rs->getRow(); - } - //walk in all rows with DEL_STARTED = 0 or DEL_FINISHED = 0 - - - $c = new Criteria( 'workflow' ); - $c->clearSelectColumns(); - $c->addSelectColumn( AppDelegationPeer::APP_UID ); - $c->addSelectColumn( AppDelegationPeer::DEL_INDEX ); - $c->addSelectColumn( AppDelegationPeer::DEL_DELEGATE_DATE ); - $c->addSelectColumn( AppDelegationPeer::DEL_INIT_DATE ); - $c->addSelectColumn( AppDelegationPeer::DEL_TASK_DUE_DATE ); - $c->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE ); - $c->addSelectColumn( AppDelegationPeer::DEL_DURATION ); - $c->addSelectColumn( AppDelegationPeer::DEL_QUEUE_DURATION ); - $c->addSelectColumn( AppDelegationPeer::DEL_DELAY_DURATION ); - $c->addSelectColumn( AppDelegationPeer::DEL_STARTED ); - $c->addSelectColumn( AppDelegationPeer::DEL_FINISHED ); - $c->addSelectColumn( AppDelegationPeer::DEL_DELAYED ); - $c->addSelectColumn( TaskPeer::TAS_DURATION ); - $c->addSelectColumn( TaskPeer::TAS_TIMEUNIT ); - $c->addSelectColumn( TaskPeer::TAS_TYPE_DAY ); - - $c->addJoin( AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN ); - //$c->add(AppDelegationPeer::DEL_INIT_DATE, NULL, Criteria::ISNULL); - //$c->add(AppDelegationPeer::APP_UID, '7694483844a37bfeb0931b1063501289'); - //$c->add(AppDelegationPeer::DEL_STARTED, 0); - - - $cton1 = $c->getNewCriterion( AppDelegationPeer::DEL_STARTED, 0 ); - $cton2 = $c->getNewCriterion( AppDelegationPeer::DEL_FINISHED, 0 ); - $cton1->addOR( $cton2 ); - $c->add( $cton1 ); - - $rs = AppDelegationPeer::doSelectRS( $c ); - $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $rs->next(); - $row = $rs->getRow(); - $i = 0; - //print ""; - //print ""; - - - $now = strtotime( 'now' ); - while (is_array( $row )) { - $fTaskDuration = $row['TAS_DURATION']; - $iDelegateDate = strtotime( $row['DEL_DELEGATE_DATE'] ); - $iInitDate = strtotime( $row['DEL_INIT_DATE'] ); - $iDueDate = strtotime( $row['DEL_TASK_DUE_DATE'] ); - $iFinishDate = strtotime( $row['DEL_FINISH_DATE'] ); - $isStarted = intval( $row['DEL_STARTED'] ); - $isFinished = intval( $row['DEL_FINISHED'] ); - $isDelayed = intval( $row['DEL_DELAYED'] ); - $queueDuration = $this->getDiffDate( $iInitDate, $iDelegateDate ); - $delDuration = 0; - $delayDuration = 0; - $overduePercentage = 0.0; - //get the object, - $oAppDel = AppDelegationPeer::retrieveByPk( $row['APP_UID'], $row['DEL_INDEX'] ); - - //if the task is not started - if ($isStarted == 0) { - if ($row['DEL_INIT_DATE'] != null && $row['DEL_INIT_DATE'] != '') { - $oAppDel->setDelStarted( 1 ); - $queueDuration = $this->getDiffDate( $iInitDate, $iDelegateDate ); - $oAppDel->setDelQueueDuration( $queueDuration ); - } else { - //the task was not started - $queueDuration = $this->getDiffDate( $now, $iDelegateDate ); - $oAppDel->setDelQueueDuration( $queueDuration ); - - //we are putting negative number if the task is not delayed, and positive number for the time the task is delayed - $delayDuration = $this->getDiffDate( $now, $iDueDate ); - $oAppDel->setDelDelayDuration( $delayDuration ); - if ($fTaskDuration != 0) { - $overduePercentage = $delayDuration / $fTaskDuration; - $oAppDel->setAppOverduePercentage( $overduePercentage ); - if ($iDueDate < $now) { - $oAppDel->setDelDelayed( 1 ); - } - } - } - } - - //if the task was not finished - if ($isFinished == 0) { - if ($row['DEL_FINISH_DATE'] != null && $row['DEL_FINISH_DATE'] != '') { - $oAppDel->setAppOverduePercentage( $overduePercentage ); - $oAppDel->setDelFinished( 1 ); - - $delDuration = $this->getDiffDate( $iFinishDate, $iInitDate ); - $oAppDel->setDelDuration( $delDuration ); - //calculate due date if correspond - if ($iDueDate < $iFinishDate) { - $oAppDel->setDelDelayed( 1 ); - $delayDuration = $this->getDiffDate( $iFinishDate, $iDueDate ); - } else { - $oAppDel->setDelDelayed( 0 ); - $delayDuration = 0; - } - } else { - //the task was not completed - if ($row['DEL_INIT_DATE'] != null && $row['DEL_INIT_DATE'] != '') { - $delDuration = $this->getDiffDate( $now, $iInitDate ); - } else { - $delDuration = $this->getDiffDate( $now, $iDelegateDate ); - } - $oAppDel->setDelDuration( $delDuration ); - - //we are putting negative number if the task is not delayed, and positive number for the time the task is delayed - $delayDuration = $this->getDiffDate( $now, $iDueDate ); - $oAppDel->setDelDelayDuration( $delayDuration ); - if ($fTaskDuration != 0) { - $overduePercentage = $delayDuration / $fTaskDuration; - $oAppDel->setAppOverduePercentage( $overduePercentage ); - if ($iDueDate < $now) { - $oAppDel->setDelDelayed( 1 ); - } - } - } - - } - - //and finally save the record - $RES = $oAppDel->save(); - $rs->next(); - $row = $rs->getRow(); - } - - if ($cron == 1) { - $arrayCron = unserialize( trim( @file_get_contents( PATH_DATA . "cron" ) ) ); - $arrayCron["processcTimeStart"] = time(); - @file_put_contents( PATH_DATA . "cron", serialize( $arrayCron ) ); - } - } catch (Exception $oError) { - error_log( $oError->getMessage() ); - } - } - - public function getLastDeleration ($APP_UID) - { - $c = new Criteria( 'workflow' ); - $c->addSelectColumn( AppDelegationPeer::APP_UID ); - $c->addSelectColumn( AppDelegationPeer::DEL_INDEX ); - $c->addSelectColumn( AppDelegationPeer::DEL_DELEGATE_DATE ); - $c->addSelectColumn( AppDelegationPeer::DEL_INIT_DATE ); - $c->addSelectColumn( AppDelegationPeer::DEL_TASK_DUE_DATE ); - $c->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE ); - $c->addSelectColumn( AppDelegationPeer::DEL_DURATION ); - $c->addSelectColumn( AppDelegationPeer::DEL_QUEUE_DURATION ); - $c->addSelectColumn( AppDelegationPeer::DEL_DELAY_DURATION ); - $c->addSelectColumn( AppDelegationPeer::DEL_STARTED ); - $c->addSelectColumn( AppDelegationPeer::DEL_FINISHED ); - $c->addSelectColumn( AppDelegationPeer::DEL_DELAYED ); - $c->addSelectColumn( AppDelegationPeer::USR_UID ); - - $c->add( AppDelegationPeer::APP_UID, $APP_UID ); - $c->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX ); - $rs = AppDelegationPeer::doSelectRS( $c ); - $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $rs->next(); - return $rs->getRow(); - } - - public function getCurrentIndex ($appUid) - { - $oCriteria = new Criteria(); - $oCriteria->addSelectColumn( AppDelegationPeer::DEL_INDEX ); - $oCriteria->add( AppDelegationPeer::APP_UID, $appUid ); - $oCriteria->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX ); - $oRuleSet = AppDelegationPeer::doSelectRS( $oCriteria ); - $oRuleSet->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $oRuleSet->next(); - $data = $oRuleSet->getRow(); - return (int)$data['DEL_INDEX']; - } - - public function getCurrentTask ($appUid) - { - $oCriteria = new Criteria(); - $oCriteria->addSelectColumn( AppDelegationPeer::TAS_UID ); - $oCriteria->add( AppDelegationPeer::APP_UID, $appUid ); - $oCriteria->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX ); - $oRuleSet = AppDelegationPeer::doSelectRS( $oCriteria ); - $oRuleSet->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $oRuleSet->next(); - $data = $oRuleSet->getRow(); - return $data['TAS_UID']; - } - - /** - * Verify if the current case is already routed. - * - * @param string $AppUid the uid of the application - * @return array $Fields the fields - */ - - public function alreadyRouted ($appUid, $sDelIndex) - { - $c = new Criteria("workflow"); - $c->clearSelectColumns(); - $c->addSelectColumn(AppDelegationPeer::APP_UID); - $c->add(AppDelegationPeer::APP_UID, $appUid); - $c->add(AppDelegationPeer::DEL_INDEX, $sDelIndex); - $c->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNOTNULL); - $result = AppDelegationPeer::doSelectRS($c); - $result->setFetchmode(ResultSet::FETCHMODE_ASSOC); - if($result->next()) { - return true; - } else { - return false; - } - } - -} - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + */ + +//require_once 'classes/model/om/BaseAppDelegation.php'; +//require_once ("classes/model/HolidayPeer.php"); +//require_once ("classes/model/TaskPeer.php"); +//require_once ("classes/model/Task.php"); +//G::LoadClass( "dates" ); + +/** + * Skeleton subclass for representing a row from the 'APP_DELEGATION' table. + * + * + * + * You should add additional methods to this class to meet the + * application requirements. This class will only be generated as + * long as it does not already exist in the output directory. + * + * @package workflow.engine.classes.model + */ +class AppDelegation extends BaseAppDelegation +{ + + /** + * create an application delegation + * + * @param $sProUid process Uid + * @param $sAppUid Application Uid + * @param $sTasUid Task Uid + * @param $sUsrUid User Uid + * @param $iPriority delegation priority + * @param $isSubprocess is a subprocess inside a process? + * @return delegation index of the application delegation. + */ + public function createAppDelegation ($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sAppThread, $iPriority = 3, $isSubprocess = false, $sPrevious = -1, $sNextTasParam = null) + { + if (! isset( $sProUid ) || strlen( $sProUid ) == 0) { + throw (new Exception( 'Column "PRO_UID" cannot be null.' )); + } + + if (! isset( $sAppUid ) || strlen( $sAppUid ) == 0) { + throw (new Exception( 'Column "APP_UID" cannot be null.' )); + } + + if (! isset( $sTasUid ) || strlen( $sTasUid ) == 0) { + throw (new Exception( 'Column "TAS_UID" cannot be null.' )); + } + + if (! isset( $sUsrUid ) /*|| strlen($sUsrUid ) == 0*/ ) { + throw (new Exception( 'Column "USR_UID" cannot be null.' )); + } + + if (! isset( $sAppThread ) || strlen( $sAppThread ) == 0) { + throw (new Exception( 'Column "APP_THREAD" cannot be null.' )); + } + + //Get max DEL_INDEX + $criteria = new Criteria("workflow"); + $criteria->add(AppDelegationPeer::APP_UID, $sAppUid); + $criteria->add(AppDelegationPeer::DEL_LAST_INDEX, 1); + + $criteriaIndex = clone $criteria; + + $rs = AppDelegationPeer::doSelectRS($criteriaIndex); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + $delIndex = 1; + $delPreviusUsrUid = ''; + if ($rs->next()) { + $row = $rs->getRow(); + + $delIndex = (isset($row["DEL_INDEX"]))? $row["DEL_INDEX"] + 1 : 1; + $delPreviusUsrUid = $row["USR_UID"]; + } else { + $criteriaDelIndex = new Criteria("workflow"); + + $criteriaDelIndex->addSelectColumn(AppDelegationPeer::DEL_INDEX); + $criteriaDelIndex->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE); + $criteriaDelIndex->add(AppDelegationPeer::APP_UID, $sAppUid); + $criteriaDelIndex->addDescendingOrderByColumn(AppDelegationPeer::DEL_DELEGATE_DATE); + + $rsCriteriaDelIndex = AppDelegationPeer::doSelectRS($criteriaDelIndex); + $rsCriteriaDelIndex->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + if ($rsCriteriaDelIndex->next()) { + $row = $rsCriteriaDelIndex->getRow(); + + $delIndex = (isset($row["DEL_INDEX"]))? $row["DEL_INDEX"] + 1 : 1; + } + } + + //Update set + $criteriaUpdate = new Criteria('workflow'); + $criteriaUpdate->add(AppDelegationPeer::DEL_LAST_INDEX, 0); + BasePeer::doUpdate($criteria, $criteriaUpdate, Propel::getConnection('workflow')); + + $this->setAppUid( $sAppUid ); + $this->setProUid( $sProUid ); + $this->setTasUid( $sTasUid ); + $this->setDelIndex( $delIndex ); + $this->setDelLastIndex(1); + $this->setDelPrevious( $sPrevious == - 1 ? 0 : $sPrevious ); + $this->setUsrUid( $sUsrUid ); + $this->setDelType( 'NORMAL' ); + $this->setDelPriority( ($iPriority != '' ? $iPriority : '3') ); + $this->setDelThread( $sAppThread ); + $this->setDelThreadStatus( 'OPEN' ); + $this->setDelDelegateDate( 'now' ); + + //The function return an array now. By JHL + $delTaskDueDate = $this->calculateDueDate( $sNextTasParam ); + + //$this->setDelTaskDueDate( $delTaskDueDate['DUE_DATE'] ); // Due date formatted + $this->setDelTaskDueDate( $delTaskDueDate ); + + if ((defined( "DEBUG_CALENDAR_LOG" )) && (DEBUG_CALENDAR_LOG)) { + //$this->setDelData( $delTaskDueDate['DUE_DATE_LOG'] ); // Log of actions made by Calendar Engine + $this->setDelData( $delTaskDueDate ); + } else { + $this->setDelData( '' ); + } + + // this condition assures that an internal delegation like a subprocess dont have an initial date setted + if ($delIndex == 1 && ! $isSubprocess) { + //the first delegation, init date this should be now for draft applications, in other cases, should be null. + $this->setDelInitDate( 'now' ); + } + + if ($this->validate()) { + try { + $res = $this->save(); + $inbox = new ListInbox(); + $inbox->newRow($this->toArray(BasePeer::TYPE_FIELDNAME), $delPreviusUsrUid); + } catch (PropelException $e) { + throw ($e); + } + } else { + // Something went wrong. We can now get the validationFailures and handle them. + $msg = ''; + $validationFailuresArray = $this->getValidationFailures(); + foreach ($validationFailuresArray as $objValidationFailure) { + $msg .= $objValidationFailure->getMessage() . "
"; + } + throw (new Exception( 'Failed Data validation. ' . $msg )); + } + + $delIndex = $this->getDelIndex(); + + // Hook for the trigger PM_CREATE_NEW_DELEGATION + if (defined( 'PM_CREATE_NEW_DELEGATION' )) { + $data = new stdclass(); + $data->TAS_UID = $sTasUid; + $data->APP_UID = $sAppUid; + $data->DEL_INDEX = $delIndex; + $data->USR_UID = $sUsrUid; + $oPluginRegistry = &PMPluginRegistry::getSingleton(); + $oPluginRegistry->executeTriggers( PM_CREATE_NEW_DELEGATION, $data ); + } + + return $delIndex; + } + + /** + * Load the Application Delegation row specified in [app_id] column value. + * + * @param string $AppUid the uid of the application + * @return array $Fields the fields + */ + + public function Load ($AppUid, $sDelIndex) + { + $con = Propel::getConnection( AppDelegationPeer::DATABASE_NAME ); + try { + $oAppDel = AppDelegationPeer::retrieveByPk( $AppUid, $sDelIndex ); + if (is_object( $oAppDel ) && get_class( $oAppDel ) == 'AppDelegation') { + $aFields = $oAppDel->toArray( BasePeer::TYPE_FIELDNAME ); + $this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME ); + return $aFields; + } else { + throw (new Exception( "The row '$AppUid, $sDelIndex' in table AppDelegation doesn't exist!" )); + } + } catch (Exception $oError) { + throw ($oError); + } + } + + /* Load the Application Delegation row specified in [app_id] column value. + * + * @param string $AppUid the uid of the application + * @return array $Fields the fields + */ + + public function LoadParallel ($AppUid) + { + $aCases = array(); + + $c = new Criteria( 'workflow' ); + $c->addSelectColumn( AppDelegationPeer::APP_UID ); + $c->addSelectColumn( AppDelegationPeer::DEL_INDEX ); + $c->addSelectColumn( AppDelegationPeer::PRO_UID ); + $c->addSelectColumn( AppDelegationPeer::TAS_UID ); + $c->addSelectColumn( AppDelegationPeer::USR_UID ); + + $c->add( AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN' ); + $c->add( AppDelegationPeer::APP_UID, $AppUid ); + $c->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX ); + $rs = AppDelegationPeer::doSelectRS( $c ); + $row= $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + + $rs->next(); + $row = $rs->getRow(); + + while (is_array($row)) { + $case = array(); + $case['TAS_UID'] = $row['TAS_UID']; + $case['USR_UID'] = $row['USR_UID']; + $aCases[] = $case; + $rs->next(); + $row = $rs->getRow(); + } + + return $aCases; + } + + /** + * Update the application row + * + * @param array $aData + * @return variant + * + */ + + public function update ($aData) + { + $con = Propel::getConnection( AppDelegationPeer::DATABASE_NAME ); + try { + $con->begin(); + $oApp = AppDelegationPeer::retrieveByPK( $aData['APP_UID'], $aData['DEL_INDEX'] ); + if (is_object( $oApp ) && get_class( $oApp ) == 'AppDelegation') { + $oApp->fromArray( $aData, BasePeer::TYPE_FIELDNAME ); + if ($oApp->validate()) { + $res = $oApp->save(); + $con->commit(); + return $res; + } else { + $msg = ''; + foreach ($this->getValidationFailures() as $objValidationFailure) { + $msg .= $objValidationFailure->getMessage() . "
"; + } + + throw (new PropelException( 'The row cannot be created!', new PropelException( $msg ) )); + } + } else { + $con->rollback(); + throw (new Exception( "This AppDelegation row doesn't exist!" )); + } + } catch (Exception $oError) { + throw ($oError); + } + } + + public function remove ($sApplicationUID, $iDelegationIndex) + { + $oConnection = Propel::getConnection( StepTriggerPeer::DATABASE_NAME ); + try { + $oConnection->begin(); + $oApp = AppDelegationPeer::retrieveByPK( $sApplicationUID, $iDelegationIndex ); + if (is_object( $oApp ) && get_class( $oApp ) == 'AppDelegation') { + $result = $oApp->delete(); + } + $oConnection->commit(); + return $result; + } catch (Exception $e) { + $oConnection->rollback(); + throw ($e); + } + } + + // TasTypeDay = 1 => working days + // TasTypeDay = 2 => calendar days + public function calculateDueDate ($sNextTasParam) + { + //Get Task properties + $task = TaskPeer::retrieveByPK( $this->getTasUid() ); + + $aData['TAS_UID'] = $this->getTasUid(); + //Added to allow User defined Timing Control at Run time from Derivation screen + if (isset( $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] ) && $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] == 'true') { + $aData['TAS_DURATION'] = $sNextTasParam['NEXT_TASK']['TAS_DURATION']; + $aData['TAS_TIMEUNIT'] = $sNextTasParam['NEXT_TASK']['TAS_TIMEUNIT']; + $aData['TAS_TYPE_DAY'] = $sNextTasParam['NEXT_TASK']['TAS_TYPE_DAY']; + + if (isset( $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'] ) && $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'] != '') { + $aCalendarUID = $sNextTasParam['NEXT_TASK']['TAS_CALENDAR']; + } else { + $aCalendarUID = ''; + } + + //Updating the task Table , so that user will see updated values in the assign screen in consequent cases + $oTask = new Task(); + $oTask->update( $aData ); + } else { + if (is_null( $task )) { + return 0; + } + $aData['TAS_DURATION'] = $task->getTasDuration(); + $aData['TAS_TIMEUNIT'] = $task->getTasTimeUnit(); + $aData['TAS_TYPE_DAY'] = $task->getTasTypeDay(); + $aCalendarUID = ''; + } + + //use the dates class to calculate dates + $calendar = new calendar(); + + if ($calendar->pmCalendarUid == '') { + $calendar->getCalendar(null, $task->getProUid(), $aData['TAS_UID']); + $calData = $calendar->getCalendarData(); + } + + /*$iDueDate = $calendar->calculateDate( $this->getDelDelegateDate(), $aData['TAS_DURATION'], $aData['TAS_TIMEUNIT'] //hours or days, ( we only accept this two types or maybe weeks + );*/ + $iDueDate = $calendar->dashCalculateDate($this->getDelDelegateDate(), $aData['TAS_DURATION'], $aData['TAS_TIMEUNIT'], $calData); + return $iDueDate; + } + + public function getDiffDate ($date1, $date2) + { + return ($date1 - $date2) / (24 * 60 * 60); //days + return ($date1 - $date2) / 3600; + } + + public function calculateDuration ($cron = 0) + { + try { + if ($cron == 1) { + $arrayCron = unserialize( trim( @file_get_contents( PATH_DATA . "cron" ) ) ); + $arrayCron["processcTimeStart"] = time(); + @file_put_contents( PATH_DATA . "cron", serialize( $arrayCron ) ); + } + + //patch rows with initdate = null and finish_date + $c = new Criteria(); + $c->clearSelectColumns(); + $c->addSelectColumn( AppDelegationPeer::APP_UID ); + $c->addSelectColumn( AppDelegationPeer::DEL_INDEX ); + $c->addSelectColumn( AppDelegationPeer::DEL_DELEGATE_DATE ); + $c->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE ); + $c->add( AppDelegationPeer::DEL_INIT_DATE, null, Criteria::ISNULL ); + $c->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNOTNULL ); + //$c->add(AppDelegationPeer::DEL_INDEX, 1); + + + $rs = AppDelegationPeer::doSelectRS( $c ); + $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $rs->next(); + $row = $rs->getRow(); + + while (is_array( $row )) { + $oAppDel = AppDelegationPeer::retrieveByPk( $row['APP_UID'], $row['DEL_INDEX'] ); + if (isset( $row['DEL_FINISH_DATE'] )) { + $oAppDel->setDelInitDate( $row['DEL_FINISH_DATE'] ); + } else { + $oAppDel->setDelInitDate( $row['DEL_INIT_DATE'] ); + } + $oAppDel->save(); + + $rs->next(); + $row = $rs->getRow(); + } + //walk in all rows with DEL_STARTED = 0 or DEL_FINISHED = 0 + + + $c = new Criteria( 'workflow' ); + $c->clearSelectColumns(); + $c->addSelectColumn( AppDelegationPeer::APP_UID ); + $c->addSelectColumn( AppDelegationPeer::DEL_INDEX ); + $c->addSelectColumn( AppDelegationPeer::USR_UID); + $c->addSelectColumn( AppDelegationPeer::PRO_UID); + $c->addSelectColumn( AppDelegationPeer::TAS_UID); + $c->addSelectColumn( AppDelegationPeer::DEL_DELEGATE_DATE ); + $c->addSelectColumn( AppDelegationPeer::DEL_INIT_DATE ); + $c->addSelectColumn( AppDelegationPeer::DEL_TASK_DUE_DATE ); + $c->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE ); + $c->addSelectColumn( AppDelegationPeer::DEL_DURATION ); + $c->addSelectColumn( AppDelegationPeer::DEL_QUEUE_DURATION ); + $c->addSelectColumn( AppDelegationPeer::DEL_DELAY_DURATION ); + $c->addSelectColumn( AppDelegationPeer::DEL_STARTED ); + $c->addSelectColumn( AppDelegationPeer::DEL_FINISHED ); + $c->addSelectColumn( AppDelegationPeer::DEL_DELAYED ); + $c->addSelectColumn( TaskPeer::TAS_DURATION ); + $c->addSelectColumn( TaskPeer::TAS_TIMEUNIT ); + $c->addSelectColumn( TaskPeer::TAS_TYPE_DAY ); + + $c->addJoin( AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN ); + //$c->add(AppDelegationPeer::DEL_INIT_DATE, NULL, Criteria::ISNULL); + //$c->add(AppDelegationPeer::APP_UID, '7694483844a37bfeb0931b1063501289'); + //$c->add(AppDelegationPeer::DEL_STARTED, 0); + + + $cton1 = $c->getNewCriterion( AppDelegationPeer::DEL_STARTED, 0 ); + $cton2 = $c->getNewCriterion( AppDelegationPeer::DEL_FINISHED, 0 ); + $cton1->addOR( $cton2 ); + $c->add( $cton1 ); + + $rs = AppDelegationPeer::doSelectRS( $c ); + $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $rs->next(); + $row = $rs->getRow(); + $i = 0; + //print "
iDelegateDate iInitDate iDueDate iFinishDate isStarted isFinished isDelayed queueDuration delDuration delayDuration
"; + //print ""; + + $calendar = new calendar(); + + $now = strtotime( 'now' ); + while (is_array( $row )) { + $fTaskDuration = $row['TAS_DURATION']; + $fTaskDurationUnit = $row['TAS_TIMEUNIT']; + $iDelegateDate = strtotime( $row['DEL_DELEGATE_DATE'] ); + $iInitDate = strtotime( $row['DEL_INIT_DATE'] ); + $iDueDate = strtotime( $row['DEL_TASK_DUE_DATE'] ); + $iFinishDate = strtotime( $row['DEL_FINISH_DATE'] ); + $isStarted = intval( $row['DEL_STARTED'] ); + $isFinished = intval( $row['DEL_FINISHED'] ); + $isDelayed = intval( $row['DEL_DELAYED'] ); + $queueDuration = $this->getDiffDate( $iInitDate, $iDelegateDate ); + $delDuration = 0; + $delayDuration = 0; + $overduePercentage = 0.0; + //get the object, + $oAppDel = AppDelegationPeer::retrieveByPk( $row['APP_UID'], $row['DEL_INDEX'] ); + + //getting the calendar + $calendar->getCalendar($row['USR_UID'], $row['PRO_UID'], $row['TAS_UID']); + $calData = $calendar->getCalendarData(); + + //Recalculating DueDate with the user calendar if it exist. It allways will take the derivation date like initial date. + $iDueDate = $calendar->dashCalculateDate($row['DEL_DELEGATE_DATE'], $fTaskDuration, $fTaskDurationUnit, $calData); + + //if the task is not started + if ($isStarted == 0) { + if ($row['DEL_INIT_DATE'] != null && $row['DEL_INIT_DATE'] != '') { + $oAppDel->setDelStarted( 1 ); + $queueDuration = $this->getDiffDate( $iInitDate, $iDelegateDate ); + $oAppDel->setDelQueueDuration( $queueDuration ); + } else { + //the task was not started + $queueDuration = $this->getDiffDate( $now, $iDelegateDate ); + $oAppDel->setDelQueueDuration( $queueDuration ); + + //we are putting negative number if the task is not delayed, and positive number for the time the task is delayed + //$delayDuration = $this->getDiffDate( $now, $iDueDate ); + $delayDuration = $calendar->dashCalculateDurationWithCalendar( $iDueDate, date("Y-m-d H:i:s"), $calData ); + $delayDuration = $delayDuration / (24 * 60 * 60); //Days + $oAppDel->setDelDelayDuration( $delayDuration ); + + if ($fTaskDuration != 0) { + $overduePercentage = $delayDuration / $fTaskDuration; + $oAppDel->setAppOverduePercentage( $overduePercentage ); + if ($iDueDate < $now) { + $oAppDel->setDelDelayed( 1 ); + } + } + } + } + + //if the task was not finished + if ($isFinished == 0) { + if ($row['DEL_FINISH_DATE'] != null && $row['DEL_FINISH_DATE'] != '') { + $oAppDel->setAppOverduePercentage( $overduePercentage ); + $oAppDel->setDelFinished( 1 ); + + //$delDuration = $this->getDiffDate( $iFinishDate, $iInitDate ); + $delDuration = $calendar->dashCalculateDurationWithCalendar($row['DEL_INIT_DATE'], $row['DEL_FINISH_DATE'], $calData ); + $delDuration = $delDuration / (24 * 60 * 60); //Saving the delDuration in days. The calculateDurationSLA func returns segs. + + $oAppDel->setDelDuration( $delDuration ); + //calculate due date if correspond + $dueDate = strtotime($iDueDate); + $finishDate = strtotime($iFinishDate); + if ($dueDate < $finishDate) { + $oAppDel->setDelDelayed( 1 ); + //$delayDuration = $this->getDiffDate( $iFinishDate, $iDueDate ); + $delayDuration = $calendar->dashCalculateDurationWithCalendar( $iDueDate, $row['DEL_FINISH_DATE'], $calData ); + $delayDuration = $delayDuration / (24 * 60 * 60); //Days + } else { + $oAppDel->setDelDelayed( 0 ); + $delayDuration = 0; + } + $oAppDel->setDelDelayDuration( $delayDuration ); + } else { + //the task was not completed + if ($row['DEL_INIT_DATE'] != null && $row['DEL_INIT_DATE'] != '') { + //$delDuration = $this->getDiffDate( $now, $iInitDate ); + $delDuration = $calendar->dashCalculateDurationWithCalendar($row['DEL_INIT_DATE'], date("Y-m-d H:i:s"), $calData ); + $delDuration = $delDuration / (24 * 60 * 60); //Saving the delDuration in days. The calculateDurationSLA func returns mins. + } else { + //$delDuration = $this->getDiffDate( $now, $iDelegateDate ); + $delDuration = $calendar->dashCalculateDurationWithCalendar($row['DEL_DELEGATE_DATE'], date("Y-m-d H:i:s"), $calData ); + $delDuration = $delDuration / (24 * 60 * 60); //Saving the delDuration in days. The calculateDurationSLA func returns mins. + } + $oAppDel->setDelDuration( $delDuration ); + + //we are putting negative number if the task is not delayed, and positive number for the time the task is delayed + //$delayDuration = $this->getDiffDate( $now, $iDueDate ); + $delayDuration = $calendar->dashCalculateDurationWithCalendar( $iDueDate, date("Y-m-d H:i:s"), $calData ); + $delayDuration = $delayDuration / (24 * 60 * 60); //Days + $oAppDel->setDelDelayDuration( $delayDuration ); + if ($fTaskDuration != 0) { + $overduePercentage = $delayDuration / $fTaskDuration; + $oAppDel->setAppOverduePercentage( $overduePercentage ); + if ($iDueDate < $now) { + $oAppDel->setDelDelayed( 1 ); + } + } + } + + } + //and finally save the record + $RES = $oAppDel->save(); + $rs->next(); + $row = $rs->getRow(); + } + + if ($cron == 1) { + $arrayCron = unserialize( trim( @file_get_contents( PATH_DATA . "cron" ) ) ); + $arrayCron["processcTimeStart"] = time(); + @file_put_contents( PATH_DATA . "cron", serialize( $arrayCron ) ); + } + } catch (Exception $oError) { + error_log( $oError->getMessage() ); + } + } + + public function getLastDeleration ($APP_UID) + { + $c = new Criteria( 'workflow' ); + $c->addSelectColumn( AppDelegationPeer::APP_UID ); + $c->addSelectColumn( AppDelegationPeer::DEL_INDEX ); + $c->addSelectColumn( AppDelegationPeer::DEL_DELEGATE_DATE ); + $c->addSelectColumn( AppDelegationPeer::DEL_INIT_DATE ); + $c->addSelectColumn( AppDelegationPeer::DEL_TASK_DUE_DATE ); + $c->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE ); + $c->addSelectColumn( AppDelegationPeer::DEL_DURATION ); + $c->addSelectColumn( AppDelegationPeer::DEL_QUEUE_DURATION ); + $c->addSelectColumn( AppDelegationPeer::DEL_DELAY_DURATION ); + $c->addSelectColumn( AppDelegationPeer::DEL_STARTED ); + $c->addSelectColumn( AppDelegationPeer::DEL_FINISHED ); + $c->addSelectColumn( AppDelegationPeer::DEL_DELAYED ); + $c->addSelectColumn( AppDelegationPeer::USR_UID ); + + $c->add( AppDelegationPeer::APP_UID, $APP_UID ); + $c->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX ); + $rs = AppDelegationPeer::doSelectRS( $c ); + $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $rs->next(); + return $rs->getRow(); + } + + public function getCurrentIndex ($appUid) + { + $oCriteria = new Criteria(); + $oCriteria->addSelectColumn( AppDelegationPeer::DEL_INDEX ); + $oCriteria->add( AppDelegationPeer::APP_UID, $appUid ); + $oCriteria->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX ); + $oRuleSet = AppDelegationPeer::doSelectRS( $oCriteria ); + $oRuleSet->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oRuleSet->next(); + $data = $oRuleSet->getRow(); + return (int)$data['DEL_INDEX']; + } + + public function getCurrentTask ($appUid) + { + $oCriteria = new Criteria(); + $oCriteria->addSelectColumn( AppDelegationPeer::TAS_UID ); + $oCriteria->add( AppDelegationPeer::APP_UID, $appUid ); + $oCriteria->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX ); + $oRuleSet = AppDelegationPeer::doSelectRS( $oCriteria ); + $oRuleSet->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oRuleSet->next(); + $data = $oRuleSet->getRow(); + return $data['TAS_UID']; + } + + /** + * Verify if the current case is already routed. + * + * @param string $AppUid the uid of the application + * @return array $Fields the fields + */ + + public function alreadyRouted ($appUid, $sDelIndex) + { + $c = new Criteria("workflow"); + $c->clearSelectColumns(); + $c->addSelectColumn(AppDelegationPeer::APP_UID); + $c->add(AppDelegationPeer::APP_UID, $appUid); + $c->add(AppDelegationPeer::DEL_INDEX, $sDelIndex); + $c->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNOTNULL); + $result = AppDelegationPeer::doSelectRS($c); + $result->setFetchmode(ResultSet::FETCHMODE_ASSOC); + if($result->next()) { + return true; + } else { + return false; + } + } + +} + diff --git a/workflow/engine/classes/model/Application.php b/workflow/engine/classes/model/Application.php index 6cd4d6379..2c08b541d 100755 --- a/workflow/engine/classes/model/Application.php +++ b/workflow/engine/classes/model/Application.php @@ -572,5 +572,111 @@ class Application extends BaseApplication return $this->getAppUid(); } + + /*----------------------------------********---------------------------------*/ + public function calculateAppDuration ($cron = 0) + { + try { + if ($cron == 1) { + $arrayCron = unserialize( trim( @file_get_contents( PATH_DATA . "cron" ) ) ); + $arrayCron["processcTimeStart"] = time(); + @file_put_contents( PATH_DATA . "cron", serialize( $arrayCron ) ); + } + + $calendar = new calendar(); + + $c = new Criteria( 'workflow' ); + $c->clearSelectColumns(); + $c->addSelectColumn( ApplicationPeer::APP_UID ); + $c->addSelectColumn( ApplicationPeer::APP_NUMBER ); + $c->addSelectColumn( ApplicationPeer::APP_STATUS ); + $c->addSelectColumn( ApplicationPeer::PRO_UID ); + $c->addSelectColumn( ApplicationPeer::APP_INIT_USER ); + $c->addSelectColumn( ApplicationPeer::APP_CUR_USER ); + $c->addSelectColumn( ApplicationPeer::APP_CREATE_DATE ); + $c->addSelectColumn( ApplicationPeer::APP_INIT_DATE ); + $c->addSelectColumn( ApplicationPeer::APP_FINISH_DATE ); + $c->addSelectColumn( ApplicationPeer::APP_UPDATE_DATE ); + $c->addSelectColumn( ApplicationPeer::APP_DURATION ); + $c->addSelectColumn( ApplicationPeer::APP_DELAY_DURATION ); + $c->addSelectColumn( ProcessPeer::PRO_TIME ); + $c->addSelectColumn( ProcessPeer::PRO_TIMEUNIT ); + + $c->addJoin( ApplicationPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN ); + + $rs = ApplicationPeer::doSelectRS( $c ); + $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $rs->next(); + $row = $rs->getRow(); + $i = 0; + + $now = strtotime( 'now' ); + while (is_array( $row )) { + $appNumber = $row['APP_NUMBER']; + $appStatus = $row['APP_STATUS']; + $appInitUser = $row['APP_INIT_USER']; + $appCurUser = $row['APP_CUR_USER']; + $appCreateDate = $row['APP_CREATE_DATE']; + $appInitDate = $row['APP_INIT_DATE']; + $appFinishDate = $row['APP_FINISH_DATE']; + $appUpdateDate = $row['APP_UPDATE_DATE']; + $appDuration = $row['APP_DURATION']; + $proTime = $row['PRO_TIME']; + $proTimeUnit = $row['PRO_TIMEUNIT']; + $proUid = $row['PRO_UID']; + + //get the object, + $oApp = ApplicationPeer::retrieveByPk( $row['APP_UID'] ); + + //getting the calendar + $calendar->getCalendar(null, $proUid); + $calData = $calendar->getCalendarData(); + + /*if(G::toUpper($proTimeUnit) != 'DAYS'){ //if it is not in days must be in mins. + $proTime = $proTime / (24 * 60 * 60); //converting to Days + }*/ + + $proDueDate = $calendar->dashCalculateDate($row['APP_INIT_DATE'], $proTime, $proTimeUnit, $calData); //date when the process has to finish + + if($appFinishDate == null){//When the process didnt finish yet. + //Duration + $appDuration = $calendar->dashCalculateDurationWithCalendar($appInitDate, date("Y-m-d H:i:s"), $calData ); + + + $appDuration = $appDuration / (24 * 60 * 60); //Saving the proDuration in days. The calculateDurationWithCalendar func returns segs. + $oApp->setAppDuration( $appDuration ); + + //Delay Duration + $delayDuration = $calendar->dashCalculateDurationWithCalendar( $proDueDate, date("Y-m-d H:i:s"), $calData );//it returns in mins + $delayDuration = $delayDuration / (24 * 60 * 60); //Days + $oApp->setAppDelayDuration( $delayDuration ); + } else { + //Duration + $appDuration = $calendar->dashCalculateDurationWithCalendar($appInitDate, $appFinishDate, $calData ); + $appDuration = $appDuration / (24 * 60 * 60); //Saving the proDuration in days. The calculateDurationWithCalendar func returns mins. + $oApp->setAppDuration( $appDuration ); + + //Delay Duration + $delayDuration = $calendar->dashCalculateDurationWithCalendar( $proDueDate, $appFinishDate, $calData ); + $delayDuration = $delayDuration / (24 * 60 * 60); //Days + $oApp->setAppDelayDuration( $delayDuration ); + } + + //and finally save the record + $RES = $oApp->save(); + $rs->next(); + $row = $rs->getRow(); + } + + if ($cron == 1) { + $arrayCron = unserialize( trim( @file_get_contents( PATH_DATA . "cron" ) ) ); + $arrayCron["processcTimeStart"] = time(); + @file_put_contents( PATH_DATA . "cron", serialize( $arrayCron ) ); + } + } catch (Exception $oError) { + error_log( $oError->getMessage() ); + } + } + /*----------------------------------********---------------------------------*/ } diff --git a/workflow/engine/classes/model/map/ApplicationMapBuilder.php b/workflow/engine/classes/model/map/ApplicationMapBuilder.php index bc0943397..03967c0eb 100755 --- a/workflow/engine/classes/model/map/ApplicationMapBuilder.php +++ b/workflow/engine/classes/model/map/ApplicationMapBuilder.php @@ -1,104 +1,108 @@ -dbMap !== null); - } - - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ - public function getDatabaseMap() - { - return $this->dbMap; - } - - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ - public function doBuild() - { - $this->dbMap = Propel::getDatabaseMap('workflow'); - - $tMap = $this->dbMap->addTable('APPLICATION'); - $tMap->setPhpName('Application'); - - $tMap->setUseIdGenerator(false); - - $tMap->addPrimaryKey('APP_UID', 'AppUid', 'string', CreoleTypes::VARCHAR, true, 32); - - $tMap->addColumn('APP_NUMBER', 'AppNumber', 'int', CreoleTypes::INTEGER, true, null); - - $tMap->addColumn('APP_PARENT', 'AppParent', 'string', CreoleTypes::VARCHAR, true, 32); - - $tMap->addColumn('APP_STATUS', 'AppStatus', 'string', CreoleTypes::VARCHAR, true, 100); - - $tMap->addColumn('PRO_UID', 'ProUid', 'string', CreoleTypes::VARCHAR, true, 32); - - $tMap->addColumn('APP_PROC_STATUS', 'AppProcStatus', 'string', CreoleTypes::VARCHAR, true, 100); - - $tMap->addColumn('APP_PROC_CODE', 'AppProcCode', 'string', CreoleTypes::VARCHAR, true, 100); - - $tMap->addColumn('APP_PARALLEL', 'AppParallel', 'string', CreoleTypes::VARCHAR, true, 32); - - $tMap->addColumn('APP_INIT_USER', 'AppInitUser', 'string', CreoleTypes::VARCHAR, true, 32); - - $tMap->addColumn('APP_CUR_USER', 'AppCurUser', 'string', CreoleTypes::VARCHAR, true, 32); - - $tMap->addColumn('APP_CREATE_DATE', 'AppCreateDate', 'int', CreoleTypes::TIMESTAMP, true, null); - - $tMap->addColumn('APP_INIT_DATE', 'AppInitDate', 'int', CreoleTypes::TIMESTAMP, true, null); - - $tMap->addColumn('APP_FINISH_DATE', 'AppFinishDate', 'int', CreoleTypes::TIMESTAMP, false, null); - - $tMap->addColumn('APP_UPDATE_DATE', 'AppUpdateDate', 'int', CreoleTypes::TIMESTAMP, true, null); - - $tMap->addColumn('APP_DATA', 'AppData', 'string', CreoleTypes::LONGVARCHAR, true, null); - - $tMap->addColumn('APP_PIN', 'AppPin', 'string', CreoleTypes::VARCHAR, true, 32); - - $tMap->addValidator('APP_STATUS', 'validValues', 'propel.validator.ValidValuesValidator', 'DRAFT|TO_DO|PAUSED|COMPLETED|CANCELLED', 'Please select a valid status.'); - - } // doBuild() - -} // ApplicationMapBuilder +dbMap !== null); + } + + /** + * Gets the databasemap this map builder built. + * + * @return the databasemap + */ + public function getDatabaseMap() + { + return $this->dbMap; + } + + /** + * The doBuild() method builds the DatabaseMap + * + * @return void + * @throws PropelException + */ + public function doBuild() + { + $this->dbMap = Propel::getDatabaseMap('workflow'); + + $tMap = $this->dbMap->addTable('APPLICATION'); + $tMap->setPhpName('Application'); + + $tMap->setUseIdGenerator(false); + + $tMap->addPrimaryKey('APP_UID', 'AppUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('APP_NUMBER', 'AppNumber', 'int', CreoleTypes::INTEGER, true, null); + + $tMap->addColumn('APP_PARENT', 'AppParent', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('APP_STATUS', 'AppStatus', 'string', CreoleTypes::VARCHAR, true, 100); + + $tMap->addColumn('PRO_UID', 'ProUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('APP_PROC_STATUS', 'AppProcStatus', 'string', CreoleTypes::VARCHAR, true, 100); + + $tMap->addColumn('APP_PROC_CODE', 'AppProcCode', 'string', CreoleTypes::VARCHAR, true, 100); + + $tMap->addColumn('APP_PARALLEL', 'AppParallel', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('APP_INIT_USER', 'AppInitUser', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('APP_CUR_USER', 'AppCurUser', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('APP_CREATE_DATE', 'AppCreateDate', 'int', CreoleTypes::TIMESTAMP, true, null); + + $tMap->addColumn('APP_INIT_DATE', 'AppInitDate', 'int', CreoleTypes::TIMESTAMP, true, null); + + $tMap->addColumn('APP_FINISH_DATE', 'AppFinishDate', 'int', CreoleTypes::TIMESTAMP, false, null); + + $tMap->addColumn('APP_UPDATE_DATE', 'AppUpdateDate', 'int', CreoleTypes::TIMESTAMP, true, null); + + $tMap->addColumn('APP_DATA', 'AppData', 'string', CreoleTypes::LONGVARCHAR, true, null); + + $tMap->addColumn('APP_PIN', 'AppPin', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('APP_DURATION', 'AppDuration', 'double', CreoleTypes::DOUBLE, false, null); + + $tMap->addColumn('APP_DELAY_DURATION', 'AppDelayDuration', 'double', CreoleTypes::DOUBLE, false, null); + + $tMap->addValidator('APP_STATUS', 'validValues', 'propel.validator.ValidValuesValidator', 'DRAFT|TO_DO|PAUSED|COMPLETED|CANCELLED', 'Please select a valid status.'); + + } // doBuild() + +} // ApplicationMapBuilder \ No newline at end of file diff --git a/workflow/engine/classes/model/map/UsersMapBuilder.php b/workflow/engine/classes/model/map/UsersMapBuilder.php index 7ebac9dcb..25f32a09f 100755 --- a/workflow/engine/classes/model/map/UsersMapBuilder.php +++ b/workflow/engine/classes/model/map/UsersMapBuilder.php @@ -130,6 +130,10 @@ class UsersMapBuilder $tMap->addColumn('USR_TOTAL_COMPLETED', 'UsrTotalCompleted', 'int', CreoleTypes::INTEGER, false, null); $tMap->addColumn('USR_TOTAL_UNASSIGNED', 'UsrTotalUnassigned', 'int', CreoleTypes::INTEGER, false, null); + + $tMap->addColumn('USR_COST_BY_HOUR', 'UsrCostByHour', 'double', CreoleTypes::DOUBLE, false, 11,2); + + $tMap->addColumn('USR_UNIT_COST', 'UsrUnitCost', 'string', CreoleTypes::VARCHAR, false, 50); $tMap->addValidator('USR_STATUS', 'validValues', 'propel.validator.ValidValuesValidator', 'ACTIVE|INACTIVE|VACATION|CLOSED', 'Please select a valid type.'); diff --git a/workflow/engine/classes/model/om/BaseApplication.php b/workflow/engine/classes/model/om/BaseApplication.php index 664e7410d..1a80250eb 100755 --- a/workflow/engine/classes/model/om/BaseApplication.php +++ b/workflow/engine/classes/model/om/BaseApplication.php @@ -1,1492 +1,1595 @@ -app_uid; - } - - /** - * Get the [app_number] column value. - * - * @return int - */ - public function getAppNumber() - { - - return $this->app_number; - } - - /** - * Get the [app_parent] column value. - * - * @return string - */ - public function getAppParent() - { - - return $this->app_parent; - } - - /** - * Get the [app_status] column value. - * - * @return string - */ - public function getAppStatus() - { - - return $this->app_status; - } - - /** - * Get the [pro_uid] column value. - * - * @return string - */ - public function getProUid() - { - - return $this->pro_uid; - } - - /** - * Get the [app_proc_status] column value. - * - * @return string - */ - public function getAppProcStatus() - { - - return $this->app_proc_status; - } - - /** - * Get the [app_proc_code] column value. - * - * @return string - */ - public function getAppProcCode() - { - - return $this->app_proc_code; - } - - /** - * Get the [app_parallel] column value. - * - * @return string - */ - public function getAppParallel() - { - - return $this->app_parallel; - } - - /** - * Get the [app_init_user] column value. - * - * @return string - */ - public function getAppInitUser() - { - - return $this->app_init_user; - } - - /** - * Get the [app_cur_user] column value. - * - * @return string - */ - public function getAppCurUser() - { - - return $this->app_cur_user; - } - - /** - * Get the [optionally formatted] [app_create_date] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ - public function getAppCreateDate($format = 'Y-m-d H:i:s') - { - - if ($this->app_create_date === null || $this->app_create_date === '') { - return null; - } elseif (!is_int($this->app_create_date)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->app_create_date); - if ($ts === -1 || $ts === false) { - throw new PropelException("Unable to parse value of [app_create_date] as date/time value: " . - var_export($this->app_create_date, true)); - } - } else { - $ts = $this->app_create_date; - } - if ($format === null) { - return $ts; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $ts); - } else { - return date($format, $ts); - } - } - - /** - * Get the [optionally formatted] [app_init_date] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ - public function getAppInitDate($format = 'Y-m-d H:i:s') - { - - if ($this->app_init_date === null || $this->app_init_date === '') { - return null; - } elseif (!is_int($this->app_init_date)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->app_init_date); - if ($ts === -1 || $ts === false) { - throw new PropelException("Unable to parse value of [app_init_date] as date/time value: " . - var_export($this->app_init_date, true)); - } - } else { - $ts = $this->app_init_date; - } - if ($format === null) { - return $ts; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $ts); - } else { - return date($format, $ts); - } - } - - /** - * Get the [optionally formatted] [app_finish_date] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ - public function getAppFinishDate($format = 'Y-m-d H:i:s') - { - - if ($this->app_finish_date === null || $this->app_finish_date === '') { - return null; - } elseif (!is_int($this->app_finish_date)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->app_finish_date); - if ($ts === -1 || $ts === false) { - throw new PropelException("Unable to parse value of [app_finish_date] as date/time value: " . - var_export($this->app_finish_date, true)); - } - } else { - $ts = $this->app_finish_date; - } - if ($format === null) { - return $ts; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $ts); - } else { - return date($format, $ts); - } - } - - /** - * Get the [optionally formatted] [app_update_date] column value. - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the integer unix timestamp will be returned. - * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). - * @throws PropelException - if unable to convert the date/time to timestamp. - */ - public function getAppUpdateDate($format = 'Y-m-d H:i:s') - { - - if ($this->app_update_date === null || $this->app_update_date === '') { - return null; - } elseif (!is_int($this->app_update_date)) { - // a non-timestamp value was set externally, so we convert it - $ts = strtotime($this->app_update_date); - if ($ts === -1 || $ts === false) { - throw new PropelException("Unable to parse value of [app_update_date] as date/time value: " . - var_export($this->app_update_date, true)); - } - } else { - $ts = $this->app_update_date; - } - if ($format === null) { - return $ts; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $ts); - } else { - return date($format, $ts); - } - } - - /** - * Get the [app_data] column value. - * - * @return string - */ - public function getAppData() - { - - return $this->app_data; - } - - /** - * Get the [app_pin] column value. - * - * @return string - */ - public function getAppPin() - { - - return $this->app_pin; - } - - /** - * Set the value of [app_uid] column. - * - * @param string $v new value - * @return void - */ - public function setAppUid($v) - { - - // Since the native PHP type for this column is string, - // we will cast the input to a string (if it is not). - if ($v !== null && !is_string($v)) { - $v = (string) $v; - } - - if ($this->app_uid !== $v || $v === '') { - $this->app_uid = $v; - $this->modifiedColumns[] = ApplicationPeer::APP_UID; - } - - } // setAppUid() - - /** - * Set the value of [app_number] column. - * - * @param int $v new value - * @return void - */ - public function setAppNumber($v) - { - - // Since the native PHP type for this column is integer, - // we will cast the input value to an int (if it is not). - if ($v !== null && !is_int($v) && is_numeric($v)) { - $v = (int) $v; - } - - if ($this->app_number !== $v || $v === 0) { - $this->app_number = $v; - $this->modifiedColumns[] = ApplicationPeer::APP_NUMBER; - } - - } // setAppNumber() - - /** - * Set the value of [app_parent] column. - * - * @param string $v new value - * @return void - */ - public function setAppParent($v) - { - - // Since the native PHP type for this column is string, - // we will cast the input to a string (if it is not). - if ($v !== null && !is_string($v)) { - $v = (string) $v; - } - - if ($this->app_parent !== $v || $v === '0') { - $this->app_parent = $v; - $this->modifiedColumns[] = ApplicationPeer::APP_PARENT; - } - - } // setAppParent() - - /** - * Set the value of [app_status] column. - * - * @param string $v new value - * @return void - */ - public function setAppStatus($v) - { - - // Since the native PHP type for this column is string, - // we will cast the input to a string (if it is not). - if ($v !== null && !is_string($v)) { - $v = (string) $v; - } - - if ($this->app_status !== $v || $v === '') { - $this->app_status = $v; - $this->modifiedColumns[] = ApplicationPeer::APP_STATUS; - } - - } // setAppStatus() - - /** - * Set the value of [pro_uid] column. - * - * @param string $v new value - * @return void - */ - public function setProUid($v) - { - - // Since the native PHP type for this column is string, - // we will cast the input to a string (if it is not). - if ($v !== null && !is_string($v)) { - $v = (string) $v; - } - - if ($this->pro_uid !== $v || $v === '') { - $this->pro_uid = $v; - $this->modifiedColumns[] = ApplicationPeer::PRO_UID; - } - - } // setProUid() - - /** - * Set the value of [app_proc_status] column. - * - * @param string $v new value - * @return void - */ - public function setAppProcStatus($v) - { - - // Since the native PHP type for this column is string, - // we will cast the input to a string (if it is not). - if ($v !== null && !is_string($v)) { - $v = (string) $v; - } - - if ($this->app_proc_status !== $v || $v === '') { - $this->app_proc_status = $v; - $this->modifiedColumns[] = ApplicationPeer::APP_PROC_STATUS; - } - - } // setAppProcStatus() - - /** - * Set the value of [app_proc_code] column. - * - * @param string $v new value - * @return void - */ - public function setAppProcCode($v) - { - - // Since the native PHP type for this column is string, - // we will cast the input to a string (if it is not). - if ($v !== null && !is_string($v)) { - $v = (string) $v; - } - - if ($this->app_proc_code !== $v || $v === '') { - $this->app_proc_code = $v; - $this->modifiedColumns[] = ApplicationPeer::APP_PROC_CODE; - } - - } // setAppProcCode() - - /** - * Set the value of [app_parallel] column. - * - * @param string $v new value - * @return void - */ - public function setAppParallel($v) - { - - // Since the native PHP type for this column is string, - // we will cast the input to a string (if it is not). - if ($v !== null && !is_string($v)) { - $v = (string) $v; - } - - if ($this->app_parallel !== $v || $v === 'NO') { - $this->app_parallel = $v; - $this->modifiedColumns[] = ApplicationPeer::APP_PARALLEL; - } - - } // setAppParallel() - - /** - * Set the value of [app_init_user] column. - * - * @param string $v new value - * @return void - */ - public function setAppInitUser($v) - { - - // Since the native PHP type for this column is string, - // we will cast the input to a string (if it is not). - if ($v !== null && !is_string($v)) { - $v = (string) $v; - } - - if ($this->app_init_user !== $v || $v === '') { - $this->app_init_user = $v; - $this->modifiedColumns[] = ApplicationPeer::APP_INIT_USER; - } - - } // setAppInitUser() - - /** - * Set the value of [app_cur_user] column. - * - * @param string $v new value - * @return void - */ - public function setAppCurUser($v) - { - - // Since the native PHP type for this column is string, - // we will cast the input to a string (if it is not). - if ($v !== null && !is_string($v)) { - $v = (string) $v; - } - - if ($this->app_cur_user !== $v || $v === '') { - $this->app_cur_user = $v; - $this->modifiedColumns[] = ApplicationPeer::APP_CUR_USER; - } - - } // setAppCurUser() - - /** - * Set the value of [app_create_date] column. - * - * @param int $v new value - * @return void - */ - public function setAppCreateDate($v) - { - - if ($v !== null && !is_int($v)) { - $ts = strtotime($v); - //Date/time accepts null values - if ($v == '') { - $ts = null; - } - if ($ts === -1 || $ts === false) { - throw new PropelException("Unable to parse date/time value for [app_create_date] from input: " . - var_export($v, true)); - } - } else { - $ts = $v; - } - if ($this->app_create_date !== $ts) { - $this->app_create_date = $ts; - $this->modifiedColumns[] = ApplicationPeer::APP_CREATE_DATE; - } - - } // setAppCreateDate() - - /** - * Set the value of [app_init_date] column. - * - * @param int $v new value - * @return void - */ - public function setAppInitDate($v) - { - - if ($v !== null && !is_int($v)) { - $ts = strtotime($v); - //Date/time accepts null values - if ($v == '') { - $ts = null; - } - if ($ts === -1 || $ts === false) { - throw new PropelException("Unable to parse date/time value for [app_init_date] from input: " . - var_export($v, true)); - } - } else { - $ts = $v; - } - if ($this->app_init_date !== $ts) { - $this->app_init_date = $ts; - $this->modifiedColumns[] = ApplicationPeer::APP_INIT_DATE; - } - - } // setAppInitDate() - - /** - * Set the value of [app_finish_date] column. - * - * @param int $v new value - * @return void - */ - public function setAppFinishDate($v) - { - - if ($v !== null && !is_int($v)) { - $ts = strtotime($v); - //Date/time accepts null values - if ($v == '') { - $ts = null; - } - if ($ts === -1 || $ts === false) { - throw new PropelException("Unable to parse date/time value for [app_finish_date] from input: " . - var_export($v, true)); - } - } else { - $ts = $v; - } - if ($this->app_finish_date !== $ts) { - $this->app_finish_date = $ts; - $this->modifiedColumns[] = ApplicationPeer::APP_FINISH_DATE; - } - - } // setAppFinishDate() - - /** - * Set the value of [app_update_date] column. - * - * @param int $v new value - * @return void - */ - public function setAppUpdateDate($v) - { - - if ($v !== null && !is_int($v)) { - $ts = strtotime($v); - //Date/time accepts null values - if ($v == '') { - $ts = null; - } - if ($ts === -1 || $ts === false) { - throw new PropelException("Unable to parse date/time value for [app_update_date] from input: " . - var_export($v, true)); - } - } else { - $ts = $v; - } - if ($this->app_update_date !== $ts) { - $this->app_update_date = $ts; - $this->modifiedColumns[] = ApplicationPeer::APP_UPDATE_DATE; - } - - } // setAppUpdateDate() - - /** - * Set the value of [app_data] column. - * - * @param string $v new value - * @return void - */ - public function setAppData($v) - { - - // Since the native PHP type for this column is string, - // we will cast the input to a string (if it is not). - if ($v !== null && !is_string($v)) { - $v = (string) $v; - } - - if ($this->app_data !== $v) { - $this->app_data = $v; - $this->modifiedColumns[] = ApplicationPeer::APP_DATA; - } - - } // setAppData() - - /** - * Set the value of [app_pin] column. - * - * @param string $v new value - * @return void - */ - public function setAppPin($v) - { - - // Since the native PHP type for this column is string, - // we will cast the input to a string (if it is not). - if ($v !== null && !is_string($v)) { - $v = (string) $v; - } - - if ($this->app_pin !== $v || $v === '') { - $this->app_pin = $v; - $this->modifiedColumns[] = ApplicationPeer::APP_PIN; - } - - } // setAppPin() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (1-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. - * @param int $startcol 1-based offset column which indicates which restultset column to start with. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate(ResultSet $rs, $startcol = 1) - { - try { - - $this->app_uid = $rs->getString($startcol + 0); - - $this->app_number = $rs->getInt($startcol + 1); - - $this->app_parent = $rs->getString($startcol + 2); - - $this->app_status = $rs->getString($startcol + 3); - - $this->pro_uid = $rs->getString($startcol + 4); - - $this->app_proc_status = $rs->getString($startcol + 5); - - $this->app_proc_code = $rs->getString($startcol + 6); - - $this->app_parallel = $rs->getString($startcol + 7); - - $this->app_init_user = $rs->getString($startcol + 8); - - $this->app_cur_user = $rs->getString($startcol + 9); - - $this->app_create_date = $rs->getTimestamp($startcol + 10, null); - - $this->app_init_date = $rs->getTimestamp($startcol + 11, null); - - $this->app_finish_date = $rs->getTimestamp($startcol + 12, null); - - $this->app_update_date = $rs->getTimestamp($startcol + 13, null); - - $this->app_data = $rs->getString($startcol + 14); - - $this->app_pin = $rs->getString($startcol + 15); - - $this->resetModified(); - - $this->setNew(false); - - // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 16; // 16 = ApplicationPeer::NUM_COLUMNS - ApplicationPeer::NUM_LAZY_LOAD_COLUMNS). - - } catch (Exception $e) { - throw new PropelException("Error populating Application object", $e); - } - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param Connection $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete($con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(ApplicationPeer::DATABASE_NAME); - } - - try { - $con->begin(); - ApplicationPeer::doDelete($this, $con); - $this->setDeleted(true); - $con->commit(); - } catch (PropelException $e) { - $con->rollback(); - throw $e; - } - } - - /** - * Stores the object in the database. If the object is new, - * it inserts it; otherwise an update is performed. This method - * wraps the doSave() worker method in a transaction. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update - * @throws PropelException - * @see doSave() - */ - public function save($con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(ApplicationPeer::DATABASE_NAME); - } - - try { - $con->begin(); - $affectedRows = $this->doSave($con); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollback(); - throw $e; - } - } - - /** - * Stores the object in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param Connection $con - * @return int The number of rows affected by this insert/update and any referring - * @throws PropelException - * @see save() - */ - protected function doSave($con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - - // If this object has been modified, then save it to the database. - if ($this->isModified()) { - if ($this->isNew()) { - $pk = ApplicationPeer::doInsert($this, $con); - $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which - // should always be true here (even though technically - // BasePeer::doInsert() can insert multiple rows). - - $this->setNew(false); - } else { - $affectedRows += ApplicationPeer::doUpdate($this, $con); - } - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } - - $this->alreadyInSave = false; - } - return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - return true; - } else { - $this->validationFailures = $res; - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; - array of ValidationFailed objects otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - if (($retval = ApplicationPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = ApplicationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - return $this->getByPosition($pos); - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch($pos) { - case 0: - return $this->getAppUid(); - break; - case 1: - return $this->getAppNumber(); - break; - case 2: - return $this->getAppParent(); - break; - case 3: - return $this->getAppStatus(); - break; - case 4: - return $this->getProUid(); - break; - case 5: - return $this->getAppProcStatus(); - break; - case 6: - return $this->getAppProcCode(); - break; - case 7: - return $this->getAppParallel(); - break; - case 8: - return $this->getAppInitUser(); - break; - case 9: - return $this->getAppCurUser(); - break; - case 10: - return $this->getAppCreateDate(); - break; - case 11: - return $this->getAppInitDate(); - break; - case 12: - return $this->getAppFinishDate(); - break; - case 13: - return $this->getAppUpdateDate(); - break; - case 14: - return $this->getAppData(); - break; - case 15: - return $this->getAppPin(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME) - { - $keys = ApplicationPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getAppUid(), - $keys[1] => $this->getAppNumber(), - $keys[2] => $this->getAppParent(), - $keys[3] => $this->getAppStatus(), - $keys[4] => $this->getProUid(), - $keys[5] => $this->getAppProcStatus(), - $keys[6] => $this->getAppProcCode(), - $keys[7] => $this->getAppParallel(), - $keys[8] => $this->getAppInitUser(), - $keys[9] => $this->getAppCurUser(), - $keys[10] => $this->getAppCreateDate(), - $keys[11] => $this->getAppInitDate(), - $keys[12] => $this->getAppFinishDate(), - $keys[13] => $this->getAppUpdateDate(), - $keys[14] => $this->getAppData(), - $keys[15] => $this->getAppPin(), - ); - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = ApplicationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - return $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch($pos) { - case 0: - $this->setAppUid($value); - break; - case 1: - $this->setAppNumber($value); - break; - case 2: - $this->setAppParent($value); - break; - case 3: - $this->setAppStatus($value); - break; - case 4: - $this->setProUid($value); - break; - case 5: - $this->setAppProcStatus($value); - break; - case 6: - $this->setAppProcCode($value); - break; - case 7: - $this->setAppParallel($value); - break; - case 8: - $this->setAppInitUser($value); - break; - case 9: - $this->setAppCurUser($value); - break; - case 10: - $this->setAppCreateDate($value); - break; - case 11: - $this->setAppInitDate($value); - break; - case 12: - $this->setAppFinishDate($value); - break; - case 13: - $this->setAppUpdateDate($value); - break; - case 14: - $this->setAppData($value); - break; - case 15: - $this->setAppPin($value); - break; - } // switch() - } - - /** - * 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 = ApplicationPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) { - $this->setAppUid($arr[$keys[0]]); - } - - if (array_key_exists($keys[1], $arr)) { - $this->setAppNumber($arr[$keys[1]]); - } - - if (array_key_exists($keys[2], $arr)) { - $this->setAppParent($arr[$keys[2]]); - } - - if (array_key_exists($keys[3], $arr)) { - $this->setAppStatus($arr[$keys[3]]); - } - - if (array_key_exists($keys[4], $arr)) { - $this->setProUid($arr[$keys[4]]); - } - - if (array_key_exists($keys[5], $arr)) { - $this->setAppProcStatus($arr[$keys[5]]); - } - - if (array_key_exists($keys[6], $arr)) { - $this->setAppProcCode($arr[$keys[6]]); - } - - if (array_key_exists($keys[7], $arr)) { - $this->setAppParallel($arr[$keys[7]]); - } - - if (array_key_exists($keys[8], $arr)) { - $this->setAppInitUser($arr[$keys[8]]); - } - - if (array_key_exists($keys[9], $arr)) { - $this->setAppCurUser($arr[$keys[9]]); - } - - if (array_key_exists($keys[10], $arr)) { - $this->setAppCreateDate($arr[$keys[10]]); - } - - if (array_key_exists($keys[11], $arr)) { - $this->setAppInitDate($arr[$keys[11]]); - } - - if (array_key_exists($keys[12], $arr)) { - $this->setAppFinishDate($arr[$keys[12]]); - } - - if (array_key_exists($keys[13], $arr)) { - $this->setAppUpdateDate($arr[$keys[13]]); - } - - if (array_key_exists($keys[14], $arr)) { - $this->setAppData($arr[$keys[14]]); - } - - if (array_key_exists($keys[15], $arr)) { - $this->setAppPin($arr[$keys[15]]); - } - - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(ApplicationPeer::DATABASE_NAME); - - if ($this->isColumnModified(ApplicationPeer::APP_UID)) { - $criteria->add(ApplicationPeer::APP_UID, $this->app_uid); - } - - if ($this->isColumnModified(ApplicationPeer::APP_NUMBER)) { - $criteria->add(ApplicationPeer::APP_NUMBER, $this->app_number); - } - - if ($this->isColumnModified(ApplicationPeer::APP_PARENT)) { - $criteria->add(ApplicationPeer::APP_PARENT, $this->app_parent); - } - - if ($this->isColumnModified(ApplicationPeer::APP_STATUS)) { - $criteria->add(ApplicationPeer::APP_STATUS, $this->app_status); - } - - if ($this->isColumnModified(ApplicationPeer::PRO_UID)) { - $criteria->add(ApplicationPeer::PRO_UID, $this->pro_uid); - } - - if ($this->isColumnModified(ApplicationPeer::APP_PROC_STATUS)) { - $criteria->add(ApplicationPeer::APP_PROC_STATUS, $this->app_proc_status); - } - - if ($this->isColumnModified(ApplicationPeer::APP_PROC_CODE)) { - $criteria->add(ApplicationPeer::APP_PROC_CODE, $this->app_proc_code); - } - - if ($this->isColumnModified(ApplicationPeer::APP_PARALLEL)) { - $criteria->add(ApplicationPeer::APP_PARALLEL, $this->app_parallel); - } - - if ($this->isColumnModified(ApplicationPeer::APP_INIT_USER)) { - $criteria->add(ApplicationPeer::APP_INIT_USER, $this->app_init_user); - } - - if ($this->isColumnModified(ApplicationPeer::APP_CUR_USER)) { - $criteria->add(ApplicationPeer::APP_CUR_USER, $this->app_cur_user); - } - - if ($this->isColumnModified(ApplicationPeer::APP_CREATE_DATE)) { - $criteria->add(ApplicationPeer::APP_CREATE_DATE, $this->app_create_date); - } - - if ($this->isColumnModified(ApplicationPeer::APP_INIT_DATE)) { - $criteria->add(ApplicationPeer::APP_INIT_DATE, $this->app_init_date); - } - - if ($this->isColumnModified(ApplicationPeer::APP_FINISH_DATE)) { - $criteria->add(ApplicationPeer::APP_FINISH_DATE, $this->app_finish_date); - } - - if ($this->isColumnModified(ApplicationPeer::APP_UPDATE_DATE)) { - $criteria->add(ApplicationPeer::APP_UPDATE_DATE, $this->app_update_date); - } - - if ($this->isColumnModified(ApplicationPeer::APP_DATA)) { - $criteria->add(ApplicationPeer::APP_DATA, $this->app_data); - } - - if ($this->isColumnModified(ApplicationPeer::APP_PIN)) { - $criteria->add(ApplicationPeer::APP_PIN, $this->app_pin); - } - - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(ApplicationPeer::DATABASE_NAME); - - $criteria->add(ApplicationPeer::APP_UID, $this->app_uid); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return string - */ - public function getPrimaryKey() - { - return $this->getAppUid(); - } - - /** - * Generic method to set the primary key (app_uid column). - * - * @param string $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setAppUid($key); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of Application (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false) - { - - $copyObj->setAppNumber($this->app_number); - - $copyObj->setAppParent($this->app_parent); - - $copyObj->setAppStatus($this->app_status); - - $copyObj->setProUid($this->pro_uid); - - $copyObj->setAppProcStatus($this->app_proc_status); - - $copyObj->setAppProcCode($this->app_proc_code); - - $copyObj->setAppParallel($this->app_parallel); - - $copyObj->setAppInitUser($this->app_init_user); - - $copyObj->setAppCurUser($this->app_cur_user); - - $copyObj->setAppCreateDate($this->app_create_date); - - $copyObj->setAppInitDate($this->app_init_date); - - $copyObj->setAppFinishDate($this->app_finish_date); - - $copyObj->setAppUpdateDate($this->app_update_date); - - $copyObj->setAppData($this->app_data); - - $copyObj->setAppPin($this->app_pin); - - - $copyObj->setNew(true); - - $copyObj->setAppUid(''); // this is a pkey column, so set to default value - - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return Application Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return ApplicationPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new ApplicationPeer(); - } - return self::$peer; - } -} - +app_uid; + } + + /** + * Get the [app_number] column value. + * + * @return int + */ + public function getAppNumber() + { + + return $this->app_number; + } + + /** + * Get the [app_parent] column value. + * + * @return string + */ + public function getAppParent() + { + + return $this->app_parent; + } + + /** + * Get the [app_status] column value. + * + * @return string + */ + public function getAppStatus() + { + + return $this->app_status; + } + + /** + * Get the [pro_uid] column value. + * + * @return string + */ + public function getProUid() + { + + return $this->pro_uid; + } + + /** + * Get the [app_proc_status] column value. + * + * @return string + */ + public function getAppProcStatus() + { + + return $this->app_proc_status; + } + + /** + * Get the [app_proc_code] column value. + * + * @return string + */ + public function getAppProcCode() + { + + return $this->app_proc_code; + } + + /** + * Get the [app_parallel] column value. + * + * @return string + */ + public function getAppParallel() + { + + return $this->app_parallel; + } + + /** + * Get the [app_init_user] column value. + * + * @return string + */ + public function getAppInitUser() + { + + return $this->app_init_user; + } + + /** + * Get the [app_cur_user] column value. + * + * @return string + */ + public function getAppCurUser() + { + + return $this->app_cur_user; + } + + /** + * Get the [optionally formatted] [app_create_date] column value. + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the integer unix timestamp will be returned. + * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). + * @throws PropelException - if unable to convert the date/time to timestamp. + */ + public function getAppCreateDate($format = 'Y-m-d H:i:s') + { + + if ($this->app_create_date === null || $this->app_create_date === '') { + return null; + } elseif (!is_int($this->app_create_date)) { + // a non-timestamp value was set externally, so we convert it + $ts = strtotime($this->app_create_date); + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse value of [app_create_date] as date/time value: " . + var_export($this->app_create_date, true)); + } + } else { + $ts = $this->app_create_date; + } + if ($format === null) { + return $ts; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $ts); + } else { + return date($format, $ts); + } + } + + /** + * Get the [optionally formatted] [app_init_date] column value. + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the integer unix timestamp will be returned. + * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). + * @throws PropelException - if unable to convert the date/time to timestamp. + */ + public function getAppInitDate($format = 'Y-m-d H:i:s') + { + + if ($this->app_init_date === null || $this->app_init_date === '') { + return null; + } elseif (!is_int($this->app_init_date)) { + // a non-timestamp value was set externally, so we convert it + $ts = strtotime($this->app_init_date); + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse value of [app_init_date] as date/time value: " . + var_export($this->app_init_date, true)); + } + } else { + $ts = $this->app_init_date; + } + if ($format === null) { + return $ts; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $ts); + } else { + return date($format, $ts); + } + } + + /** + * Get the [optionally formatted] [app_finish_date] column value. + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the integer unix timestamp will be returned. + * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). + * @throws PropelException - if unable to convert the date/time to timestamp. + */ + public function getAppFinishDate($format = 'Y-m-d H:i:s') + { + + if ($this->app_finish_date === null || $this->app_finish_date === '') { + return null; + } elseif (!is_int($this->app_finish_date)) { + // a non-timestamp value was set externally, so we convert it + $ts = strtotime($this->app_finish_date); + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse value of [app_finish_date] as date/time value: " . + var_export($this->app_finish_date, true)); + } + } else { + $ts = $this->app_finish_date; + } + if ($format === null) { + return $ts; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $ts); + } else { + return date($format, $ts); + } + } + + /** + * Get the [optionally formatted] [app_update_date] column value. + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the integer unix timestamp will be returned. + * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). + * @throws PropelException - if unable to convert the date/time to timestamp. + */ + public function getAppUpdateDate($format = 'Y-m-d H:i:s') + { + + if ($this->app_update_date === null || $this->app_update_date === '') { + return null; + } elseif (!is_int($this->app_update_date)) { + // a non-timestamp value was set externally, so we convert it + $ts = strtotime($this->app_update_date); + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse value of [app_update_date] as date/time value: " . + var_export($this->app_update_date, true)); + } + } else { + $ts = $this->app_update_date; + } + if ($format === null) { + return $ts; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $ts); + } else { + return date($format, $ts); + } + } + + /** + * Get the [app_data] column value. + * + * @return string + */ + public function getAppData() + { + + return $this->app_data; + } + + /** + * Get the [app_pin] column value. + * + * @return string + */ + public function getAppPin() + { + + return $this->app_pin; + } + + /** + * Get the [app_duration] column value. + * + * @return double + */ + public function getAppDuration() + { + + return $this->app_duration; + } + + /** + * Get the [app_delay_duration] column value. + * + * @return double + */ + public function getAppDelayDuration() + { + + return $this->app_delay_duration; + } + + /** + * Set the value of [app_uid] column. + * + * @param string $v new value + * @return void + */ + public function setAppUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_uid !== $v || $v === '') { + $this->app_uid = $v; + $this->modifiedColumns[] = ApplicationPeer::APP_UID; + } + + } // setAppUid() + + /** + * Set the value of [app_number] column. + * + * @param int $v new value + * @return void + */ + public function setAppNumber($v) + { + + // Since the native PHP type for this column is integer, + // we will cast the input value to an int (if it is not). + if ($v !== null && !is_int($v) && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->app_number !== $v || $v === 0) { + $this->app_number = $v; + $this->modifiedColumns[] = ApplicationPeer::APP_NUMBER; + } + + } // setAppNumber() + + /** + * Set the value of [app_parent] column. + * + * @param string $v new value + * @return void + */ + public function setAppParent($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_parent !== $v || $v === '0') { + $this->app_parent = $v; + $this->modifiedColumns[] = ApplicationPeer::APP_PARENT; + } + + } // setAppParent() + + /** + * Set the value of [app_status] column. + * + * @param string $v new value + * @return void + */ + public function setAppStatus($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_status !== $v || $v === '') { + $this->app_status = $v; + $this->modifiedColumns[] = ApplicationPeer::APP_STATUS; + } + + } // setAppStatus() + + /** + * Set the value of [pro_uid] column. + * + * @param string $v new value + * @return void + */ + public function setProUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->pro_uid !== $v || $v === '') { + $this->pro_uid = $v; + $this->modifiedColumns[] = ApplicationPeer::PRO_UID; + } + + } // setProUid() + + /** + * Set the value of [app_proc_status] column. + * + * @param string $v new value + * @return void + */ + public function setAppProcStatus($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_proc_status !== $v || $v === '') { + $this->app_proc_status = $v; + $this->modifiedColumns[] = ApplicationPeer::APP_PROC_STATUS; + } + + } // setAppProcStatus() + + /** + * Set the value of [app_proc_code] column. + * + * @param string $v new value + * @return void + */ + public function setAppProcCode($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_proc_code !== $v || $v === '') { + $this->app_proc_code = $v; + $this->modifiedColumns[] = ApplicationPeer::APP_PROC_CODE; + } + + } // setAppProcCode() + + /** + * Set the value of [app_parallel] column. + * + * @param string $v new value + * @return void + */ + public function setAppParallel($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_parallel !== $v || $v === 'NO') { + $this->app_parallel = $v; + $this->modifiedColumns[] = ApplicationPeer::APP_PARALLEL; + } + + } // setAppParallel() + + /** + * Set the value of [app_init_user] column. + * + * @param string $v new value + * @return void + */ + public function setAppInitUser($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_init_user !== $v || $v === '') { + $this->app_init_user = $v; + $this->modifiedColumns[] = ApplicationPeer::APP_INIT_USER; + } + + } // setAppInitUser() + + /** + * Set the value of [app_cur_user] column. + * + * @param string $v new value + * @return void + */ + public function setAppCurUser($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_cur_user !== $v || $v === '') { + $this->app_cur_user = $v; + $this->modifiedColumns[] = ApplicationPeer::APP_CUR_USER; + } + + } // setAppCurUser() + + /** + * Set the value of [app_create_date] column. + * + * @param int $v new value + * @return void + */ + public function setAppCreateDate($v) + { + + if ($v !== null && !is_int($v)) { + $ts = strtotime($v); + //Date/time accepts null values + if ($v == '') { + $ts = null; + } + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse date/time value for [app_create_date] from input: " . + var_export($v, true)); + } + } else { + $ts = $v; + } + if ($this->app_create_date !== $ts) { + $this->app_create_date = $ts; + $this->modifiedColumns[] = ApplicationPeer::APP_CREATE_DATE; + } + + } // setAppCreateDate() + + /** + * Set the value of [app_init_date] column. + * + * @param int $v new value + * @return void + */ + public function setAppInitDate($v) + { + + if ($v !== null && !is_int($v)) { + $ts = strtotime($v); + //Date/time accepts null values + if ($v == '') { + $ts = null; + } + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse date/time value for [app_init_date] from input: " . + var_export($v, true)); + } + } else { + $ts = $v; + } + if ($this->app_init_date !== $ts) { + $this->app_init_date = $ts; + $this->modifiedColumns[] = ApplicationPeer::APP_INIT_DATE; + } + + } // setAppInitDate() + + /** + * Set the value of [app_finish_date] column. + * + * @param int $v new value + * @return void + */ + public function setAppFinishDate($v) + { + + if ($v !== null && !is_int($v)) { + $ts = strtotime($v); + //Date/time accepts null values + if ($v == '') { + $ts = null; + } + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse date/time value for [app_finish_date] from input: " . + var_export($v, true)); + } + } else { + $ts = $v; + } + if ($this->app_finish_date !== $ts) { + $this->app_finish_date = $ts; + $this->modifiedColumns[] = ApplicationPeer::APP_FINISH_DATE; + } + + } // setAppFinishDate() + + /** + * Set the value of [app_update_date] column. + * + * @param int $v new value + * @return void + */ + public function setAppUpdateDate($v) + { + + if ($v !== null && !is_int($v)) { + $ts = strtotime($v); + //Date/time accepts null values + if ($v == '') { + $ts = null; + } + if ($ts === -1 || $ts === false) { + throw new PropelException("Unable to parse date/time value for [app_update_date] from input: " . + var_export($v, true)); + } + } else { + $ts = $v; + } + if ($this->app_update_date !== $ts) { + $this->app_update_date = $ts; + $this->modifiedColumns[] = ApplicationPeer::APP_UPDATE_DATE; + } + + } // setAppUpdateDate() + + /** + * Set the value of [app_data] column. + * + * @param string $v new value + * @return void + */ + public function setAppData($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_data !== $v) { + $this->app_data = $v; + $this->modifiedColumns[] = ApplicationPeer::APP_DATA; + } + + } // setAppData() + + /** + * Set the value of [app_pin] column. + * + * @param string $v new value + * @return void + */ + public function setAppPin($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_pin !== $v || $v === '') { + $this->app_pin = $v; + $this->modifiedColumns[] = ApplicationPeer::APP_PIN; + } + + } // setAppPin() + + /** + * Set the value of [app_duration] column. + * + * @param double $v new value + * @return void + */ + public function setAppDuration($v) + { + + if ($this->app_duration !== $v || $v === 0) { + $this->app_duration = $v; + $this->modifiedColumns[] = ApplicationPeer::APP_DURATION; + } + + } // setAppDuration() + + /** + * Set the value of [app_delay_duration] column. + * + * @param double $v new value + * @return void + */ + public function setAppDelayDuration($v) + { + + if ($this->app_delay_duration !== $v || $v === 0) { + $this->app_delay_duration = $v; + $this->modifiedColumns[] = ApplicationPeer::APP_DELAY_DURATION; + } + + } // setAppDelayDuration() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (1-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. + * @param int $startcol 1-based offset column which indicates which restultset column to start with. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate(ResultSet $rs, $startcol = 1) + { + try { + + $this->app_uid = $rs->getString($startcol + 0); + + $this->app_number = $rs->getInt($startcol + 1); + + $this->app_parent = $rs->getString($startcol + 2); + + $this->app_status = $rs->getString($startcol + 3); + + $this->pro_uid = $rs->getString($startcol + 4); + + $this->app_proc_status = $rs->getString($startcol + 5); + + $this->app_proc_code = $rs->getString($startcol + 6); + + $this->app_parallel = $rs->getString($startcol + 7); + + $this->app_init_user = $rs->getString($startcol + 8); + + $this->app_cur_user = $rs->getString($startcol + 9); + + $this->app_create_date = $rs->getTimestamp($startcol + 10, null); + + $this->app_init_date = $rs->getTimestamp($startcol + 11, null); + + $this->app_finish_date = $rs->getTimestamp($startcol + 12, null); + + $this->app_update_date = $rs->getTimestamp($startcol + 13, null); + + $this->app_data = $rs->getString($startcol + 14); + + $this->app_pin = $rs->getString($startcol + 15); + + $this->app_duration = $rs->getFloat($startcol + 16); + + $this->app_delay_duration = $rs->getFloat($startcol + 17); + + $this->resetModified(); + + $this->setNew(false); + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 18; // 18 = ApplicationPeer::NUM_COLUMNS - ApplicationPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating Application object", $e); + } + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param Connection $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ApplicationPeer::DATABASE_NAME); + } + + try { + $con->begin(); + ApplicationPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. If the object is new, + * it inserts it; otherwise an update is performed. This method + * wraps the doSave() worker method in a transaction. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update + * @throws PropelException + * @see doSave() + */ + public function save($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(ApplicationPeer::DATABASE_NAME); + } + + try { + $con->begin(); + $affectedRows = $this->doSave($con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update and any referring + * @throws PropelException + * @see save() + */ + protected function doSave($con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = ApplicationPeer::doInsert($this, $con); + $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which + // should always be true here (even though technically + // BasePeer::doInsert() can insert multiple rows). + + $this->setNew(false); + } else { + $affectedRows += ApplicationPeer::doUpdate($this, $con); + } + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; + array of ValidationFailed objects otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = ApplicationPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = ApplicationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->getByPosition($pos); + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getAppUid(); + break; + case 1: + return $this->getAppNumber(); + break; + case 2: + return $this->getAppParent(); + break; + case 3: + return $this->getAppStatus(); + break; + case 4: + return $this->getProUid(); + break; + case 5: + return $this->getAppProcStatus(); + break; + case 6: + return $this->getAppProcCode(); + break; + case 7: + return $this->getAppParallel(); + break; + case 8: + return $this->getAppInitUser(); + break; + case 9: + return $this->getAppCurUser(); + break; + case 10: + return $this->getAppCreateDate(); + break; + case 11: + return $this->getAppInitDate(); + break; + case 12: + return $this->getAppFinishDate(); + break; + case 13: + return $this->getAppUpdateDate(); + break; + case 14: + return $this->getAppData(); + break; + case 15: + return $this->getAppPin(); + break; + case 16: + return $this->getAppDuration(); + break; + case 17: + return $this->getAppDelayDuration(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) + { + $keys = ApplicationPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getAppUid(), + $keys[1] => $this->getAppNumber(), + $keys[2] => $this->getAppParent(), + $keys[3] => $this->getAppStatus(), + $keys[4] => $this->getProUid(), + $keys[5] => $this->getAppProcStatus(), + $keys[6] => $this->getAppProcCode(), + $keys[7] => $this->getAppParallel(), + $keys[8] => $this->getAppInitUser(), + $keys[9] => $this->getAppCurUser(), + $keys[10] => $this->getAppCreateDate(), + $keys[11] => $this->getAppInitDate(), + $keys[12] => $this->getAppFinishDate(), + $keys[13] => $this->getAppUpdateDate(), + $keys[14] => $this->getAppData(), + $keys[15] => $this->getAppPin(), + $keys[16] => $this->getAppDuration(), + $keys[17] => $this->getAppDelayDuration(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = ApplicationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setAppUid($value); + break; + case 1: + $this->setAppNumber($value); + break; + case 2: + $this->setAppParent($value); + break; + case 3: + $this->setAppStatus($value); + break; + case 4: + $this->setProUid($value); + break; + case 5: + $this->setAppProcStatus($value); + break; + case 6: + $this->setAppProcCode($value); + break; + case 7: + $this->setAppParallel($value); + break; + case 8: + $this->setAppInitUser($value); + break; + case 9: + $this->setAppCurUser($value); + break; + case 10: + $this->setAppCreateDate($value); + break; + case 11: + $this->setAppInitDate($value); + break; + case 12: + $this->setAppFinishDate($value); + break; + case 13: + $this->setAppUpdateDate($value); + break; + case 14: + $this->setAppData($value); + break; + case 15: + $this->setAppPin($value); + break; + case 16: + $this->setAppDuration($value); + break; + case 17: + $this->setAppDelayDuration($value); + break; + } // switch() + } + + /** + * 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 = ApplicationPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) { + $this->setAppUid($arr[$keys[0]]); + } + + if (array_key_exists($keys[1], $arr)) { + $this->setAppNumber($arr[$keys[1]]); + } + + if (array_key_exists($keys[2], $arr)) { + $this->setAppParent($arr[$keys[2]]); + } + + if (array_key_exists($keys[3], $arr)) { + $this->setAppStatus($arr[$keys[3]]); + } + + if (array_key_exists($keys[4], $arr)) { + $this->setProUid($arr[$keys[4]]); + } + + if (array_key_exists($keys[5], $arr)) { + $this->setAppProcStatus($arr[$keys[5]]); + } + + if (array_key_exists($keys[6], $arr)) { + $this->setAppProcCode($arr[$keys[6]]); + } + + if (array_key_exists($keys[7], $arr)) { + $this->setAppParallel($arr[$keys[7]]); + } + + if (array_key_exists($keys[8], $arr)) { + $this->setAppInitUser($arr[$keys[8]]); + } + + if (array_key_exists($keys[9], $arr)) { + $this->setAppCurUser($arr[$keys[9]]); + } + + if (array_key_exists($keys[10], $arr)) { + $this->setAppCreateDate($arr[$keys[10]]); + } + + if (array_key_exists($keys[11], $arr)) { + $this->setAppInitDate($arr[$keys[11]]); + } + + if (array_key_exists($keys[12], $arr)) { + $this->setAppFinishDate($arr[$keys[12]]); + } + + if (array_key_exists($keys[13], $arr)) { + $this->setAppUpdateDate($arr[$keys[13]]); + } + + if (array_key_exists($keys[14], $arr)) { + $this->setAppData($arr[$keys[14]]); + } + + if (array_key_exists($keys[15], $arr)) { + $this->setAppPin($arr[$keys[15]]); + } + + if (array_key_exists($keys[16], $arr)) { + $this->setAppDuration($arr[$keys[16]]); + } + + if (array_key_exists($keys[17], $arr)) { + $this->setAppDelayDuration($arr[$keys[17]]); + } + + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(ApplicationPeer::DATABASE_NAME); + + if ($this->isColumnModified(ApplicationPeer::APP_UID)) { + $criteria->add(ApplicationPeer::APP_UID, $this->app_uid); + } + + if ($this->isColumnModified(ApplicationPeer::APP_NUMBER)) { + $criteria->add(ApplicationPeer::APP_NUMBER, $this->app_number); + } + + if ($this->isColumnModified(ApplicationPeer::APP_PARENT)) { + $criteria->add(ApplicationPeer::APP_PARENT, $this->app_parent); + } + + if ($this->isColumnModified(ApplicationPeer::APP_STATUS)) { + $criteria->add(ApplicationPeer::APP_STATUS, $this->app_status); + } + + if ($this->isColumnModified(ApplicationPeer::PRO_UID)) { + $criteria->add(ApplicationPeer::PRO_UID, $this->pro_uid); + } + + if ($this->isColumnModified(ApplicationPeer::APP_PROC_STATUS)) { + $criteria->add(ApplicationPeer::APP_PROC_STATUS, $this->app_proc_status); + } + + if ($this->isColumnModified(ApplicationPeer::APP_PROC_CODE)) { + $criteria->add(ApplicationPeer::APP_PROC_CODE, $this->app_proc_code); + } + + if ($this->isColumnModified(ApplicationPeer::APP_PARALLEL)) { + $criteria->add(ApplicationPeer::APP_PARALLEL, $this->app_parallel); + } + + if ($this->isColumnModified(ApplicationPeer::APP_INIT_USER)) { + $criteria->add(ApplicationPeer::APP_INIT_USER, $this->app_init_user); + } + + if ($this->isColumnModified(ApplicationPeer::APP_CUR_USER)) { + $criteria->add(ApplicationPeer::APP_CUR_USER, $this->app_cur_user); + } + + if ($this->isColumnModified(ApplicationPeer::APP_CREATE_DATE)) { + $criteria->add(ApplicationPeer::APP_CREATE_DATE, $this->app_create_date); + } + + if ($this->isColumnModified(ApplicationPeer::APP_INIT_DATE)) { + $criteria->add(ApplicationPeer::APP_INIT_DATE, $this->app_init_date); + } + + if ($this->isColumnModified(ApplicationPeer::APP_FINISH_DATE)) { + $criteria->add(ApplicationPeer::APP_FINISH_DATE, $this->app_finish_date); + } + + if ($this->isColumnModified(ApplicationPeer::APP_UPDATE_DATE)) { + $criteria->add(ApplicationPeer::APP_UPDATE_DATE, $this->app_update_date); + } + + if ($this->isColumnModified(ApplicationPeer::APP_DATA)) { + $criteria->add(ApplicationPeer::APP_DATA, $this->app_data); + } + + if ($this->isColumnModified(ApplicationPeer::APP_PIN)) { + $criteria->add(ApplicationPeer::APP_PIN, $this->app_pin); + } + + if ($this->isColumnModified(ApplicationPeer::APP_DURATION)) { + $criteria->add(ApplicationPeer::APP_DURATION, $this->app_duration); + } + + if ($this->isColumnModified(ApplicationPeer::APP_DELAY_DURATION)) { + $criteria->add(ApplicationPeer::APP_DELAY_DURATION, $this->app_delay_duration); + } + + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(ApplicationPeer::DATABASE_NAME); + + $criteria->add(ApplicationPeer::APP_UID, $this->app_uid); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return string + */ + public function getPrimaryKey() + { + return $this->getAppUid(); + } + + /** + * Generic method to set the primary key (app_uid column). + * + * @param string $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setAppUid($key); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of Application (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + + $copyObj->setAppNumber($this->app_number); + + $copyObj->setAppParent($this->app_parent); + + $copyObj->setAppStatus($this->app_status); + + $copyObj->setProUid($this->pro_uid); + + $copyObj->setAppProcStatus($this->app_proc_status); + + $copyObj->setAppProcCode($this->app_proc_code); + + $copyObj->setAppParallel($this->app_parallel); + + $copyObj->setAppInitUser($this->app_init_user); + + $copyObj->setAppCurUser($this->app_cur_user); + + $copyObj->setAppCreateDate($this->app_create_date); + + $copyObj->setAppInitDate($this->app_init_date); + + $copyObj->setAppFinishDate($this->app_finish_date); + + $copyObj->setAppUpdateDate($this->app_update_date); + + $copyObj->setAppData($this->app_data); + + $copyObj->setAppPin($this->app_pin); + + $copyObj->setAppDuration($this->app_duration); + + $copyObj->setAppDelayDuration($this->app_delay_duration); + + + $copyObj->setNew(true); + + $copyObj->setAppUid(''); // this is a pkey column, so set to default value + + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return Application Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return ApplicationPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new ApplicationPeer(); + } + return self::$peer; + } +} \ No newline at end of file diff --git a/workflow/engine/classes/model/om/BaseApplicationPeer.php b/workflow/engine/classes/model/om/BaseApplicationPeer.php index b20f51730..b93e6347f 100755 --- a/workflow/engine/classes/model/om/BaseApplicationPeer.php +++ b/workflow/engine/classes/model/om/BaseApplicationPeer.php @@ -1,645 +1,654 @@ - array ('AppUid', 'AppNumber', 'AppParent', 'AppStatus', 'ProUid', 'AppProcStatus', 'AppProcCode', 'AppParallel', 'AppInitUser', 'AppCurUser', 'AppCreateDate', 'AppInitDate', 'AppFinishDate', 'AppUpdateDate', 'AppData', 'AppPin', ), - BasePeer::TYPE_COLNAME => array (ApplicationPeer::APP_UID, ApplicationPeer::APP_NUMBER, ApplicationPeer::APP_PARENT, ApplicationPeer::APP_STATUS, ApplicationPeer::PRO_UID, ApplicationPeer::APP_PROC_STATUS, ApplicationPeer::APP_PROC_CODE, ApplicationPeer::APP_PARALLEL, ApplicationPeer::APP_INIT_USER, ApplicationPeer::APP_CUR_USER, ApplicationPeer::APP_CREATE_DATE, ApplicationPeer::APP_INIT_DATE, ApplicationPeer::APP_FINISH_DATE, ApplicationPeer::APP_UPDATE_DATE, ApplicationPeer::APP_DATA, ApplicationPeer::APP_PIN, ), - BasePeer::TYPE_FIELDNAME => array ('APP_UID', 'APP_NUMBER', 'APP_PARENT', 'APP_STATUS', 'PRO_UID', 'APP_PROC_STATUS', 'APP_PROC_CODE', 'APP_PARALLEL', 'APP_INIT_USER', 'APP_CUR_USER', 'APP_CREATE_DATE', 'APP_INIT_DATE', 'APP_FINISH_DATE', 'APP_UPDATE_DATE', 'APP_DATA', 'APP_PIN', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'AppNumber' => 1, 'AppParent' => 2, 'AppStatus' => 3, 'ProUid' => 4, 'AppProcStatus' => 5, 'AppProcCode' => 6, 'AppParallel' => 7, 'AppInitUser' => 8, 'AppCurUser' => 9, 'AppCreateDate' => 10, 'AppInitDate' => 11, 'AppFinishDate' => 12, 'AppUpdateDate' => 13, 'AppData' => 14, 'AppPin' => 15, ), - BasePeer::TYPE_COLNAME => array (ApplicationPeer::APP_UID => 0, ApplicationPeer::APP_NUMBER => 1, ApplicationPeer::APP_PARENT => 2, ApplicationPeer::APP_STATUS => 3, ApplicationPeer::PRO_UID => 4, ApplicationPeer::APP_PROC_STATUS => 5, ApplicationPeer::APP_PROC_CODE => 6, ApplicationPeer::APP_PARALLEL => 7, ApplicationPeer::APP_INIT_USER => 8, ApplicationPeer::APP_CUR_USER => 9, ApplicationPeer::APP_CREATE_DATE => 10, ApplicationPeer::APP_INIT_DATE => 11, ApplicationPeer::APP_FINISH_DATE => 12, ApplicationPeer::APP_UPDATE_DATE => 13, ApplicationPeer::APP_DATA => 14, ApplicationPeer::APP_PIN => 15, ), - BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0, 'APP_NUMBER' => 1, 'APP_PARENT' => 2, 'APP_STATUS' => 3, 'PRO_UID' => 4, 'APP_PROC_STATUS' => 5, 'APP_PROC_CODE' => 6, 'APP_PARALLEL' => 7, 'APP_INIT_USER' => 8, 'APP_CUR_USER' => 9, 'APP_CREATE_DATE' => 10, 'APP_INIT_DATE' => 11, 'APP_FINISH_DATE' => 12, 'APP_UPDATE_DATE' => 13, 'APP_DATA' => 14, 'APP_PIN' => 15, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ) - ); - - /** - * @return MapBuilder the map builder for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getMapBuilder() - { - include_once 'classes/model/map/ApplicationMapBuilder.php'; - return BasePeer::getMapBuilder('classes.model.map.ApplicationMapBuilder'); - } - /** - * Gets a map (hash) of PHP names to DB column names. - * - * @return array The PHP to DB name map for this peer - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. - */ - public static function getPhpNameMap() - { - if (self::$phpNameMap === null) { - $map = ApplicationPeer::getTableMap(); - $columns = $map->getColumns(); - $nameMap = array(); - foreach ($columns as $column) { - $nameMap[$column->getPhpName()] = $column->getColumnName(); - } - self::$phpNameMap = $nameMap; - } - return self::$phpNameMap; - } - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - */ - static public function translateFieldName($name, $fromType, $toType) - { - $toNames = self::getFieldNames($toType); - $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); - } - return $toNames[$key]; - } - - /** - * Returns an array of of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants TYPE_PHPNAME, - * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM - * @return array A list of field names - */ - - static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, self::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.'); - } - return self::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. ApplicationPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(ApplicationPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param criteria object containing the columns to add. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria) - { - - $criteria->addSelectColumn(ApplicationPeer::APP_UID); - - $criteria->addSelectColumn(ApplicationPeer::APP_NUMBER); - - $criteria->addSelectColumn(ApplicationPeer::APP_PARENT); - - $criteria->addSelectColumn(ApplicationPeer::APP_STATUS); - - $criteria->addSelectColumn(ApplicationPeer::PRO_UID); - - $criteria->addSelectColumn(ApplicationPeer::APP_PROC_STATUS); - - $criteria->addSelectColumn(ApplicationPeer::APP_PROC_CODE); - - $criteria->addSelectColumn(ApplicationPeer::APP_PARALLEL); - - $criteria->addSelectColumn(ApplicationPeer::APP_INIT_USER); - - $criteria->addSelectColumn(ApplicationPeer::APP_CUR_USER); - - $criteria->addSelectColumn(ApplicationPeer::APP_CREATE_DATE); - - $criteria->addSelectColumn(ApplicationPeer::APP_INIT_DATE); - - $criteria->addSelectColumn(ApplicationPeer::APP_FINISH_DATE); - - $criteria->addSelectColumn(ApplicationPeer::APP_UPDATE_DATE); - - $criteria->addSelectColumn(ApplicationPeer::APP_DATA); - - $criteria->addSelectColumn(ApplicationPeer::APP_PIN); - - } - - const COUNT = 'COUNT(APPLICATION.APP_UID)'; - const COUNT_DISTINCT = 'COUNT(DISTINCT APPLICATION.APP_UID)'; - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). - * @param Connection $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, $con = null) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // clear out anything that might confuse the ORDER BY clause - $criteria->clearSelectColumns()->clearOrderByColumns(); - if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->addSelectColumn(ApplicationPeer::COUNT_DISTINCT); - } else { - $criteria->addSelectColumn(ApplicationPeer::COUNT); - } - - // just in case we're grouping: add those columns to the select statement - foreach ($criteria->getGroupByColumns() as $column) { - $criteria->addSelectColumn($column); - } - - $rs = ApplicationPeer::doSelectRS($criteria, $con); - if ($rs->next()) { - return $rs->getInt(1); - } else { - // no rows returned; we infer that means 0 matches. - return 0; - } - } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param Connection $con - * @return Application - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = ApplicationPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - return null; - } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, $con = null) - { - return ApplicationPeer::populateObjects(ApplicationPeer::doSelectRS($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() - * method to get a ResultSet. - * - * Use this method directly if you want to just get the resultset - * (instead of an array of objects). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return ResultSet The resultset object with numerically-indexed fields. - * @see BasePeer::doSelect() - */ - public static function doSelectRS(Criteria $criteria, $con = null) - { - if ($con === null) { - $con = Propel::getConnection(self::DATABASE_NAME); - } - - if (!$criteria->getSelectColumns()) { - $criteria = clone $criteria; - ApplicationPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - // BasePeer returns a Creole ResultSet, set to return - // rows indexed numerically. - return BasePeer::doSelect($criteria, $con); - } - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(ResultSet $rs) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = ApplicationPeer::getOMClass(); - $cls = Propel::import($cls); - // populate the object(s) - while ($rs->next()) { - - $obj = new $cls(); - $obj->hydrate($rs); - $results[] = $obj; - - } - return $results; - } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); - } - - /** - * The class that the Peer will make instances of. - * - * This uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @return string path.to.ClassName - */ - public static function getOMClass() - { - return ApplicationPeer::CLASS_DEFAULT; - } - - /** - * Method perform an INSERT on the database, given a Application or Criteria object. - * - * @param mixed $values Criteria or Application object containing data that is used to create the INSERT statement. - * @param Connection $con the connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, $con = null) - { - if ($con === null) { - $con = Propel::getConnection(self::DATABASE_NAME); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from Application object - } - - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->begin(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch (PropelException $e) { - $con->rollback(); - throw $e; - } - - return $pk; - } - - /** - * Method perform an UPDATE on the database, given a Application or Criteria object. - * - * @param mixed $values Criteria or Application object containing data create the UPDATE statement. - * @param Connection $con The connection to use (specify Connection exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, $con = null) - { - if ($con === null) { - $con = Propel::getConnection(self::DATABASE_NAME); - } - - $selectCriteria = new Criteria(self::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(ApplicationPeer::APP_UID); - $selectCriteria->add(ApplicationPeer::APP_UID, $criteria->remove(ApplicationPeer::APP_UID), $comparison); - - } else { - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Method to DELETE all rows from the APPLICATION table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ - public static function doDeleteAll($con = null) - { - if ($con === null) { - $con = Propel::getConnection(self::DATABASE_NAME); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); - $affectedRows += BasePeer::doDeleteAll(ApplicationPeer::TABLE_NAME, $con); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollback(); - throw $e; - } - } - - /** - * Method perform a DELETE on the database, given a Application or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or Application object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param Connection $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - * This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, $con = null) - { - if ($con === null) { - $con = Propel::getConnection(ApplicationPeer::DATABASE_NAME); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } elseif ($values instanceof Application) { - - $criteria = $values->buildPkeyCriteria(); - } else { - // it must be the primary key - $criteria = new Criteria(self::DATABASE_NAME); - $criteria->add(ApplicationPeer::APP_UID, (array) $values, Criteria::IN); - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->begin(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollback(); - throw $e; - } - } - - /** - * Validates all modified columns of given Application object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param Application $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate(Application $obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(ApplicationPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(ApplicationPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->containsColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - if ($obj->isNew() || $obj->isColumnModified(ApplicationPeer::APP_STATUS)) - $columns[ApplicationPeer::APP_STATUS] = $obj->getAppStatus(); - - } - - return BasePeer::doValidate(ApplicationPeer::DATABASE_NAME, ApplicationPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param mixed $pk the primary key. - * @param Connection $con the connection to use - * @return Application - */ - public static function retrieveByPK($pk, $con = null) - { - if ($con === null) { - $con = Propel::getConnection(self::DATABASE_NAME); - } - - $criteria = new Criteria(ApplicationPeer::DATABASE_NAME); - - $criteria->add(ApplicationPeer::APP_UID, $pk); - - - $v = ApplicationPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param Connection $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, $con = null) - { - if ($con === null) { - $con = Propel::getConnection(self::DATABASE_NAME); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(); - $criteria->add(ApplicationPeer::APP_UID, $pks, Criteria::IN); - $objs = ApplicationPeer::doSelect($criteria, $con); - } - return $objs; - } -} - - -// static code to register the map builder for this Peer with the main Propel class -if (Propel::isInit()) { - // the MapBuilder classes register themselves with Propel during initialization - // so we need to load them here. - try { - BaseApplicationPeer::getMapBuilder(); - } catch (Exception $e) { - Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); - } -} else { - // even if Propel is not yet initialized, the map builder class can be registered - // now and then it will be loaded when Propel initializes. - require_once 'classes/model/map/ApplicationMapBuilder.php'; - Propel::registerMapBuilder('classes.model.map.ApplicationMapBuilder'); -} - + array ('AppUid', 'AppNumber', 'AppParent', 'AppStatus', 'ProUid', 'AppProcStatus', 'AppProcCode', 'AppParallel', 'AppInitUser', 'AppCurUser', 'AppCreateDate', 'AppInitDate', 'AppFinishDate', 'AppUpdateDate', 'AppData', 'AppPin', 'AppDuration', 'AppDelayDuration', ), + BasePeer::TYPE_COLNAME => array (ApplicationPeer::APP_UID, ApplicationPeer::APP_NUMBER, ApplicationPeer::APP_PARENT, ApplicationPeer::APP_STATUS, ApplicationPeer::PRO_UID, ApplicationPeer::APP_PROC_STATUS, ApplicationPeer::APP_PROC_CODE, ApplicationPeer::APP_PARALLEL, ApplicationPeer::APP_INIT_USER, ApplicationPeer::APP_CUR_USER, ApplicationPeer::APP_CREATE_DATE, ApplicationPeer::APP_INIT_DATE, ApplicationPeer::APP_FINISH_DATE, ApplicationPeer::APP_UPDATE_DATE, ApplicationPeer::APP_DATA, ApplicationPeer::APP_PIN, ApplicationPeer::APP_DURATION, ApplicationPeer::APP_DELAY_DURATION, ), + BasePeer::TYPE_FIELDNAME => array ('APP_UID', 'APP_NUMBER', 'APP_PARENT', 'APP_STATUS', 'PRO_UID', 'APP_PROC_STATUS', 'APP_PROC_CODE', 'APP_PARALLEL', 'APP_INIT_USER', 'APP_CUR_USER', 'APP_CREATE_DATE', 'APP_INIT_DATE', 'APP_FINISH_DATE', 'APP_UPDATE_DATE', 'APP_DATA', 'APP_PIN', 'APP_DURATION', 'APP_DELAY_DURATION', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'AppNumber' => 1, 'AppParent' => 2, 'AppStatus' => 3, 'ProUid' => 4, 'AppProcStatus' => 5, 'AppProcCode' => 6, 'AppParallel' => 7, 'AppInitUser' => 8, 'AppCurUser' => 9, 'AppCreateDate' => 10, 'AppInitDate' => 11, 'AppFinishDate' => 12, 'AppUpdateDate' => 13, 'AppData' => 14, 'AppPin' => 15, 'AppDuration' => 16, 'AppDelayDuration' => 17, ), + BasePeer::TYPE_COLNAME => array (ApplicationPeer::APP_UID => 0, ApplicationPeer::APP_NUMBER => 1, ApplicationPeer::APP_PARENT => 2, ApplicationPeer::APP_STATUS => 3, ApplicationPeer::PRO_UID => 4, ApplicationPeer::APP_PROC_STATUS => 5, ApplicationPeer::APP_PROC_CODE => 6, ApplicationPeer::APP_PARALLEL => 7, ApplicationPeer::APP_INIT_USER => 8, ApplicationPeer::APP_CUR_USER => 9, ApplicationPeer::APP_CREATE_DATE => 10, ApplicationPeer::APP_INIT_DATE => 11, ApplicationPeer::APP_FINISH_DATE => 12, ApplicationPeer::APP_UPDATE_DATE => 13, ApplicationPeer::APP_DATA => 14, ApplicationPeer::APP_PIN => 15, ApplicationPeer::APP_DURATION => 16, ApplicationPeer::APP_DELAY_DURATION => 17, ), + BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0, 'APP_NUMBER' => 1, 'APP_PARENT' => 2, 'APP_STATUS' => 3, 'PRO_UID' => 4, 'APP_PROC_STATUS' => 5, 'APP_PROC_CODE' => 6, 'APP_PARALLEL' => 7, 'APP_INIT_USER' => 8, 'APP_CUR_USER' => 9, 'APP_CREATE_DATE' => 10, 'APP_INIT_DATE' => 11, 'APP_FINISH_DATE' => 12, 'APP_UPDATE_DATE' => 13, 'APP_DATA' => 14, 'APP_PIN' => 15, 'APP_DURATION' => 16, 'APP_DELAY_DURATION' => 17, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + ); + + /** + * @return MapBuilder the map builder for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getMapBuilder() + { + include_once 'classes/model/map/ApplicationMapBuilder.php'; + return BasePeer::getMapBuilder('classes.model.map.ApplicationMapBuilder'); + } + /** + * Gets a map (hash) of PHP names to DB column names. + * + * @return array The PHP to DB name map for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. + */ + public static function getPhpNameMap() + { + if (self::$phpNameMap === null) { + $map = ApplicationPeer::getTableMap(); + $columns = $map->getColumns(); + $nameMap = array(); + foreach ($columns as $column) { + $nameMap[$column->getPhpName()] = $column->getColumnName(); + } + self::$phpNameMap = $nameMap; + } + return self::$phpNameMap; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. ApplicationPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(ApplicationPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param criteria object containing the columns to add. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria) + { + + $criteria->addSelectColumn(ApplicationPeer::APP_UID); + + $criteria->addSelectColumn(ApplicationPeer::APP_NUMBER); + + $criteria->addSelectColumn(ApplicationPeer::APP_PARENT); + + $criteria->addSelectColumn(ApplicationPeer::APP_STATUS); + + $criteria->addSelectColumn(ApplicationPeer::PRO_UID); + + $criteria->addSelectColumn(ApplicationPeer::APP_PROC_STATUS); + + $criteria->addSelectColumn(ApplicationPeer::APP_PROC_CODE); + + $criteria->addSelectColumn(ApplicationPeer::APP_PARALLEL); + + $criteria->addSelectColumn(ApplicationPeer::APP_INIT_USER); + + $criteria->addSelectColumn(ApplicationPeer::APP_CUR_USER); + + $criteria->addSelectColumn(ApplicationPeer::APP_CREATE_DATE); + + $criteria->addSelectColumn(ApplicationPeer::APP_INIT_DATE); + + $criteria->addSelectColumn(ApplicationPeer::APP_FINISH_DATE); + + $criteria->addSelectColumn(ApplicationPeer::APP_UPDATE_DATE); + + $criteria->addSelectColumn(ApplicationPeer::APP_DATA); + + $criteria->addSelectColumn(ApplicationPeer::APP_PIN); + + $criteria->addSelectColumn(ApplicationPeer::APP_DURATION); + + $criteria->addSelectColumn(ApplicationPeer::APP_DELAY_DURATION); + + } + + const COUNT = 'COUNT(APPLICATION.APP_UID)'; + const COUNT_DISTINCT = 'COUNT(DISTINCT APPLICATION.APP_UID)'; + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). + * @param Connection $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // clear out anything that might confuse the ORDER BY clause + $criteria->clearSelectColumns()->clearOrderByColumns(); + if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->addSelectColumn(ApplicationPeer::COUNT_DISTINCT); + } else { + $criteria->addSelectColumn(ApplicationPeer::COUNT); + } + + // just in case we're grouping: add those columns to the select statement + foreach ($criteria->getGroupByColumns() as $column) { + $criteria->addSelectColumn($column); + } + + $rs = ApplicationPeer::doSelectRS($criteria, $con); + if ($rs->next()) { + return $rs->getInt(1); + } else { + // no rows returned; we infer that means 0 matches. + return 0; + } + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param Connection $con + * @return Application + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = ApplicationPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, $con = null) + { + return ApplicationPeer::populateObjects(ApplicationPeer::doSelectRS($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() + * method to get a ResultSet. + * + * Use this method directly if you want to just get the resultset + * (instead of an array of objects). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return ResultSet The resultset object with numerically-indexed fields. + * @see BasePeer::doSelect() + */ + public static function doSelectRS(Criteria $criteria, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if (!$criteria->getSelectColumns()) { + $criteria = clone $criteria; + ApplicationPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a Creole ResultSet, set to return + // rows indexed numerically. + return BasePeer::doSelect($criteria, $con); + } + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(ResultSet $rs) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = ApplicationPeer::getOMClass(); + $cls = Propel::import($cls); + // populate the object(s) + while ($rs->next()) { + + $obj = new $cls(); + $obj->hydrate($rs); + $results[] = $obj; + + } + return $results; + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * The class that the Peer will make instances of. + * + * This uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @return string path.to.ClassName + */ + public static function getOMClass() + { + return ApplicationPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a Application or Criteria object. + * + * @param mixed $values Criteria or Application object containing data that is used to create the INSERT statement. + * @param Connection $con the connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from Application object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->begin(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a Application or Criteria object. + * + * @param mixed $values Criteria or Application object containing data create the UPDATE statement. + * @param Connection $con The connection to use (specify Connection exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(ApplicationPeer::APP_UID); + $selectCriteria->add(ApplicationPeer::APP_UID, $criteria->remove(ApplicationPeer::APP_UID), $comparison); + + } else { + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the APPLICATION table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + $affectedRows += BasePeer::doDeleteAll(ApplicationPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a Application or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or Application object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param Connection $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + * This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(ApplicationPeer::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } elseif ($values instanceof Application) { + + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(ApplicationPeer::APP_UID, (array) $values, Criteria::IN); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Validates all modified columns of given Application object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param Application $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(Application $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(ApplicationPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(ApplicationPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + if ($obj->isNew() || $obj->isColumnModified(ApplicationPeer::APP_STATUS)) + $columns[ApplicationPeer::APP_STATUS] = $obj->getAppStatus(); + + } + + return BasePeer::doValidate(ApplicationPeer::DATABASE_NAME, ApplicationPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param mixed $pk the primary key. + * @param Connection $con the connection to use + * @return Application + */ + public static function retrieveByPK($pk, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $criteria = new Criteria(ApplicationPeer::DATABASE_NAME); + + $criteria->add(ApplicationPeer::APP_UID, $pk); + + + $v = ApplicationPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(); + $criteria->add(ApplicationPeer::APP_UID, $pks, Criteria::IN); + $objs = ApplicationPeer::doSelect($criteria, $con); + } + return $objs; + } +} + + +// static code to register the map builder for this Peer with the main Propel class +if (Propel::isInit()) { + // the MapBuilder classes register themselves with Propel during initialization + // so we need to load them here. + try { + BaseApplicationPeer::getMapBuilder(); + } catch (Exception $e) { + Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); + } +} else { + // even if Propel is not yet initialized, the map builder class can be registered + // now and then it will be loaded when Propel initializes. + require_once 'classes/model/map/ApplicationMapBuilder.php'; + Propel::registerMapBuilder('classes.model.map.ApplicationMapBuilder'); +} \ No newline at end of file diff --git a/workflow/engine/classes/model/om/BaseUsers.php b/workflow/engine/classes/model/om/BaseUsers.php index b9c8bc78b..85928d75f 100755 --- a/workflow/engine/classes/model/om/BaseUsers.php +++ b/workflow/engine/classes/model/om/BaseUsers.php @@ -183,6 +183,17 @@ abstract class BaseUsers extends BaseObject implements Persistent */ protected $usr_ux = 'NORMAL'; + /** + * The value for the usr_cost_by_hour field. + * @var double + */ + protected $usr_cost_by_hour = 0; + + /** + * The value for the usr_unit_cost field. + * @var string + */ + protected $usr_unit_cost = ''; /** * The value for the usr_total_inbox field. * @var int @@ -608,6 +619,28 @@ abstract class BaseUsers extends BaseObject implements Persistent return $this->usr_ux; } + + /** + * Get the [usr_cost_by_hour] column value. + * + * @return double + */ + public function getUsrCostByHour() + { + + return $this->usr_cost_by_hour; + } + + /** + * Get the [usr_unit_cost] column value. + * + * @return string + */ + public function getUsrUnitCost() + { + + return $this->usr_unit_cost; + } /** * Get the [usr_total_inbox] column value. @@ -1286,6 +1319,44 @@ abstract class BaseUsers extends BaseObject implements Persistent } // setUsrUx() + /** + * Set the value of [usr_cost_by_hour] column. + * + * @param double $v new value + * @return void + */ + public function setUsrCostByHour($v) + { + + if ($this->usr_cost_by_hour !== $v || $v === 0) { + $this->usr_cost_by_hour = $v; + $this->modifiedColumns[] = UsersPeer::USR_COST_BY_HOUR; + } + + } // setUsrCostByHour() + + /** + * Set the value of [usr_unit_cost] column. + * + * @param string $v new value + * @return void + */ + public function setUsrUnitCost($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->usr_unit_cost !== $v || $v === '') { + $this->usr_unit_cost = $v; + $this->modifiedColumns[] = UsersPeer::USR_UNIT_COST; + } + + } // setUsrUnitCost() + /** * Set the value of [usr_total_inbox] column. * @@ -1509,6 +1580,10 @@ abstract class BaseUsers extends BaseObject implements Persistent $this->usr_ux = $rs->getString($startcol + 25); + $this->usr_cost_by_hour = $rs->getFloat($startcol + 26); + + $this->usr_unit_cost = $rs->getString($startcol + 27); + $this->usr_total_inbox = $rs->getInt($startcol + 26); $this->usr_total_draft = $rs->getInt($startcol + 27); @@ -1528,7 +1603,7 @@ abstract class BaseUsers extends BaseObject implements Persistent $this->setNew(false); // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 33; // 33 = UsersPeer::NUM_COLUMNS - UsersPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 35; // 35 = UsersPeer::NUM_COLUMNS - UsersPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating Users object", $e); @@ -1831,6 +1906,12 @@ abstract class BaseUsers extends BaseObject implements Persistent case 32: return $this->getUsrTotalUnassigned(); break; + case 33: + return $this->getUsrCostByHour(); + break; + case 34: + return $this->getUsrUnitCost(); + break; default: return null; break; @@ -1884,6 +1965,8 @@ abstract class BaseUsers extends BaseObject implements Persistent $keys[30] => $this->getUsrTotalPaused(), $keys[31] => $this->getUsrTotalCompleted(), $keys[32] => $this->getUsrTotalUnassigned(), + $keys[33] => $this->getUsrCostByHour(), + $keys[34] => $this->getUsrUnitCost(), ); return $result; } @@ -2014,6 +2097,12 @@ abstract class BaseUsers extends BaseObject implements Persistent case 32: $this->setUsrTotalUnassigned($value); break; + case 26: + $this->setUsrCostByHour($value); + break; + case 27: + $this->setUsrUnitCost($value); + break; } // switch() } @@ -2169,6 +2258,14 @@ abstract class BaseUsers extends BaseObject implements Persistent $this->setUsrTotalUnassigned($arr[$keys[32]]); } + if (array_key_exists($keys[33], $arr)) { + $this->setUsrCostByHour($arr[$keys[26]]); + } + + if (array_key_exists($keys[34], $arr)) { + $this->setUsrUnitCost($arr[$keys[27]]); + } + } /** @@ -2312,6 +2409,13 @@ abstract class BaseUsers extends BaseObject implements Persistent $criteria->add(UsersPeer::USR_TOTAL_UNASSIGNED, $this->usr_total_unassigned); } + if ($this->isColumnModified(UsersPeer::USR_COST_BY_HOUR)) { + $criteria->add(UsersPeer::USR_COST_BY_HOUR, $this->usr_cost_by_hour); + } + + if ($this->isColumnModified(UsersPeer::USR_UNIT_COST)) { + $criteria->add(UsersPeer::USR_UNIT_COST, $this->usr_unit_cost); + } return $criteria; } @@ -2429,7 +2533,10 @@ abstract class BaseUsers extends BaseObject implements Persistent $copyObj->setUsrTotalCompleted($this->usr_total_completed); $copyObj->setUsrTotalUnassigned($this->usr_total_unassigned); - + + $copyObj->setUsrCostByHour($this->usr_cost_by_hour); + + $copyObj->setUsrUnitCost($this->usr_unit_cost); $copyObj->setNew(true); diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index af804da02..2df8a96a0 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -1476,6 +1476,8 @@ + + @@ -4816,5 +4818,217 @@
iDelegateDate iInitDate iDueDate iFinishDate isStarted isFinished isDelayed queueDuration delDuration delayDuration
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index 80b66d290..a1e5c16ee 100755 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -413,7 +413,7 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('AR', 'B', 'Buenos Aires' ) , ('AR', 'C', 'Distrito Federal' ) , ('AR', 'D', 'San Luis' ) , -('AR', 'E', 'Entre Ríos' ) , +('AR', 'E', 'Entre Ríos' ) , ('AR', 'F', 'La Rioja' ) , ('AR', 'G', 'Santiago del Estero' ) , ('AR', 'H', 'Chaco' ) , @@ -423,14 +423,14 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('AR', 'M', 'Mendoza' ) , ('AR', 'N', 'Misiones' ) , ('AR', 'P', 'Formosa' ) , -('AR', 'Q', 'Neuquén' ) , -('AR', 'R', 'Río Negro' ) , +('AR', 'Q', 'Neuquén' ) , +('AR', 'R', 'Río Negro' ) , ('AR', 'S', 'Santa Fe' ) , -('AR', 'T', 'Tucumán' ) , +('AR', 'T', 'Tucumán' ) , ('AR', 'U', 'Chubut' ) , ('AR', 'V', 'Tierra del Fuego' ) , ('AR', 'W', 'Corrientes' ) , -('AR', 'X', 'Córdoba' ) , +('AR', 'X', 'Córdoba' ) , ('AR', 'Y', 'Jujuy' ) , ('AR', 'Z', 'Santa Cruz' ) , ('AU', 'CT', 'Australian Capital Territory' ) , @@ -441,17 +441,17 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('AU', 'TS', 'Tasmania' ) , ('AU', 'VI', 'Victoria' ) , ('AU', 'WA', 'Western Australia' ) , -('BE', 'BRU', 'Bruxelles-Capitale, Région de (fr), Brussels Hoofdstedelijk Gewest (nl)' ) , +('BE', 'BRU', 'Bruxelles-Capitale, Région de (fr), Brussels Hoofdstedelijk Gewest (nl)' ) , ('BE', 'VAN', 'Antwerpen (VLG)' ) , ('BE', 'VBR', 'Vlaams Brabant (VLG)' ) , ('BE', 'VLG', 'Vlaamse Gewest (nl)' ) , ('BE', 'VLI', 'Limburg (VLG)' ) , ('BE', 'VOV', 'Oost-Vlaanderen (VLG)' ) , ('BE', 'VWV', 'West-Vlaanderen (VLG)' ) , -('BE', 'WAL', 'Wallonne, Région (fr)' ) , +('BE', 'WAL', 'Wallonne, Région (fr)' ) , ('BE', 'WBR', 'Brabant Wallon (WAL)' ) , ('BE', 'WHT', 'Hainaut (WAL)' ) , -('BE', 'WLG', 'Liège (WAL)' ) , +('BE', 'WLG', 'Liège (WAL)' ) , ('BE', 'WLX', 'Luxembourg (WAL)' ) , ('BE', 'WNA', 'Namur (WAL)' ) , ('BO', 'B', 'El Beni' ) , @@ -460,35 +460,35 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('BO', 'L', 'La Paz' ) , ('BO', 'N', 'Pando' ) , ('BO', 'O', 'Oruro' ) , -('BO', 'P', 'Potosí' ) , +('BO', 'P', 'Potosí' ) , ('BO', 'S', 'Santa Cruz' ) , ('BO', 'T', 'Tarija' ) , ('BR', 'AC', 'Acre' ) , ('BR', 'AL', 'Alagoas' ) , ('BR', 'AM', 'Amazonas' ) , -('BR', 'AP', 'Amapá' ) , +('BR', 'AP', 'Amapá' ) , ('BR', 'BA', 'Bahia' ) , -('BR', 'CE', 'Ceará' ) , +('BR', 'CE', 'Ceará' ) , ('BR', 'DF', 'Distrito Federal' ) , -('BR', 'ES', 'Espírito Santo' ) , -('BR', 'GO', 'Goiás' ) , -('BR', 'MA', 'Maranhão' ) , +('BR', 'ES', 'Espírito Santo' ) , +('BR', 'GO', 'Goiás' ) , +('BR', 'MA', 'Maranhão' ) , ('BR', 'MG', 'Minas Gerais' ) , ('BR', 'MS', 'Mato Grosso do Sul' ) , ('BR', 'MT', 'Mato Grosso' ) , -('BR', 'PA', 'Pará' ) , -('BR', 'PB', 'Paraíba' ) , +('BR', 'PA', 'Pará' ) , +('BR', 'PB', 'Paraíba' ) , ('BR', 'PE', 'Pernambuco' ) , -('BR', 'PI', 'Piauí' ) , -('BR', 'PR', 'Paraná' ) , +('BR', 'PI', 'Piauí' ) , +('BR', 'PR', 'Paraná' ) , ('BR', 'RJ', 'Rio de Janeiro' ) , ('BR', 'RN', 'Rio Grande do Norte' ) , -('BR', 'RO', 'Rondônia' ) , +('BR', 'RO', 'Rondônia' ) , ('BR', 'RR', 'Roraima' ) , ('BR', 'RS', 'Rio Grande do Sul' ) , ('BR', 'SC', 'Santa Catarina' ) , ('BR', 'SE', 'Sergipe' ) , -('BR', 'SP', 'São Paulo' ) ; +('BR', 'SP', 'São Paulo' ) ; INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('BR', 'TO', 'Tocantins' ) , ('CA', 'AB', 'Alberta' ) , @@ -511,12 +511,12 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('CH', 'BL', 'Basel-Landschaft (de)' ) , ('CH', 'BS', 'Basel-Stadt (de)' ) , ('CH', 'FR', 'Fribourg (fr)' ) , -('CH', 'GE', 'Genève (fr)' ) , +('CH', 'GE', 'Genève (fr)' ) , ('CH', 'GL', 'Glarus (de)' ) , -('CH', 'GR', 'Graubünden (de)' ) , +('CH', 'GR', 'Graubünden (de)' ) , ('CH', 'JU', 'Jura (fr)' ) , ('CH', 'LU', 'Luzern (de)' ) , -('CH', 'NE', 'Neuchâtel (fr)' ) , +('CH', 'NE', 'Neuchâtel (fr)' ) , ('CH', 'NW', 'Nidwalden (de)' ) , ('CH', 'OW', 'Obwalden (de)' ) , ('CH', 'SG', 'Sankt Gallen (de)' ) , @@ -529,20 +529,20 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('CH', 'VD', 'Vaud (fr)' ) , ('CH', 'VS', 'Valais (fr)' ) , ('CH', 'ZG', 'Zug (de)' ) , -('CH', 'ZH', 'Zürich (de)' ) , -('CL', 'AI', 'Aisén del General Carlos Ibáñez del Campo' ) , +('CH', 'ZH', 'Zürich (de)' ) , +('CL', 'AI', 'Aisén del General Carlos Ibáñez del Campo' ) , ('CL', 'AN', 'Antofagasta' ) , -('CL', 'AR', 'La Araucanía' ) , +('CL', 'AR', 'La Araucanía' ) , ('CL', 'AT', 'Atacama' ) , -('CL', 'BI', 'Biobío' ) , +('CL', 'BI', 'Biobío' ) , ('CL', 'CO', 'Coquimbo' ) , ('CL', 'LI', 'Libertador General Bernardo O''Higgins' ) , ('CL', 'LL', 'Los Lagos' ) , ('CL', 'MA', 'Magallanes' ) , ('CL', 'ML', 'Maule' ) , -('CL', 'RM', 'Regón Metropolitana de Santiago' ) , -('CL', 'TA', 'Tarapacá' ) , -('CL', 'VS', 'Valparaíso' ) , +('CL', 'RM', 'Regón Metropolitana de Santiago' ) , +('CL', 'TA', 'Tarapacá' ) , +('CL', 'VS', 'Valparaíso' ) , ('CN', '11', 'Beijing' ) , ('CN', '12', 'Tianjin' ) , ('CN', '13', 'Hebei' ) , @@ -582,16 +582,16 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('CR', 'C', 'Cartago' ) , ('CR', 'G', 'Guanacaste' ) , ('CR', 'H', 'Heredia' ) , -('CR', 'L', 'Limón' ) , +('CR', 'L', 'Limón' ) , ('CR', 'P', 'Puntarenas' ) , -('CR', 'SJ', 'San José' ) , +('CR', 'SJ', 'San José' ) , ('CS', 'CG', 'Crna Gora' ) , ('CS', 'KM', 'Kosovo-Metohija' ) , ('CS', 'SR', 'Srbija' ) , ('CS', 'VO', 'Vojvodina' ) , ('DE', 'BE', 'Berlin' ) , ('DE', 'BR', 'Brandenburg' ) , -('DE', 'BW', 'Baden-Württemberg' ) , +('DE', 'BW', 'Baden-Württemberg' ) , ('DE', 'BY', 'Bayern' ) , ('DE', 'HB', 'Bremen (Hansestadt)' ) , ('DE', 'HE', 'Hessen' ) , @@ -604,68 +604,68 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('DE', 'SL', 'Saarland' ) , ('DE', 'SN', 'Sachsen' ) , ('DE', 'ST', 'Sachsen-Anhalt' ) , -('DE', 'TH', 'Thüringen' ) , +('DE', 'TH', 'Thüringen' ) , ('EE', '37', 'Harjumaa' ) , ('EE', '39', 'Hiiumaa' ) , ('EE', '44', 'Ida-Virumaa' ) , -('EE', '49', 'Jõgevamaa' ) , -('EE', '51', 'Järvamaa' ) , -('EE', '57', 'Läänemaa' ) , -('EE', '59', 'Lääne-Virumaa' ) , -('EE', '65', 'Põlvamaa' ) , -('EE', '67', 'Pärnumaa' ) , +('EE', '49', 'Jõgevamaa' ) , +('EE', '51', 'Järvamaa' ) , +('EE', '57', 'Läänemaa' ) , +('EE', '59', 'Lääne-Virumaa' ) , +('EE', '65', 'Põlvamaa' ) , +('EE', '67', 'Pärnumaa' ) , ('EE', '70', 'Raplamaa' ) , ('EE', '74', 'Saaremaa' ) , ('EE', '78', 'Tartumaa' ) , ('EE', '82', 'Valgamaa' ) , ('EE', '84', 'Viljandimaa' ) , -('EE', '86', 'Võrumaa' ) , +('EE', '86', 'Võrumaa' ) , ('FI', 'AL', 'Ahvenanmaan Maakunta (fi)' ) , -('FI', 'ES', 'Etelä-Suomen lääni (fi)' ) , -('FI', 'IS', 'Itä-Suomen lääni (fi)' ) , -('FI', 'LL', 'Lapin lääni (fi)' ) , -('FI', 'LS', 'Länsi-Suomen lääni (fi)' ) , -('FI', 'OL', 'Oulun lääni (fi)' ) , +('FI', 'ES', 'Etelä-Suomen lääni (fi)' ) , +('FI', 'IS', 'Itä-Suomen lääni (fi)' ) , +('FI', 'LL', 'Lapin lääni (fi)' ) , +('FI', 'LS', 'Länsi-Suomen lääni (fi)' ) , +('FI', 'OL', 'Oulun lääni (fi)' ) , ('FR', '01', 'Ain' ) , ('FR', '02', 'Aisne' ) , ('FR', '03', 'Allier' ) , ('FR', '04', 'Alpes-de-Haute-Provence' ) , ('FR', '05', 'Hautes-Alpes' ) , ('FR', '06', 'Alpes-Maritimes' ) , -('FR', '07', 'Ardèche' ) , +('FR', '07', 'Ardèche' ) , ('FR', '08', 'Ardennes' ) , -('FR', '09', 'Ariège' ) , +('FR', '09', 'Ariège' ) , ('FR', '10', 'Aube' ) , ('FR', '11', 'Aude' ) , ('FR', '12', 'Aveyron' ) , -('FR', '13', 'Bouches-du-Rhône' ) , +('FR', '13', 'Bouches-du-Rhône' ) , ('FR', '14', 'Calvados' ) , ('FR', '15', 'Cantal' ) , ('FR', '16', 'Charente' ) , ('FR', '17', 'Charente-Maritime' ) , ('FR', '18', 'Cher' ) , -('FR', '19', 'Corrèze' ) , -('FR', '21', 'Côte-d''Or' ) , -('FR', '22', 'Côtes-d''Armor' ) , +('FR', '19', 'Corrèze' ) , +('FR', '21', 'Côte-d''Or' ) , +('FR', '22', 'Côtes-d''Armor' ) , ('FR', '23', 'Creuse' ) , ('FR', '24', 'Dordogne' ) , ('FR', '25', 'Doubs' ) , -('FR', '26', 'Drôme' ) ; +('FR', '26', 'Drôme' ) ; INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('FR', '27', 'Eure' ) , ('FR', '28', 'Eure-et-Loir' ) , -('FR', '29', 'Finistère' ) , +('FR', '29', 'Finistère' ) , ('FR', '2A', 'Corse-du-Sud' ) , ('FR', '2B', 'Haute-Corse' ) , ('FR', '30', 'Gard' ) , ('FR', '31', 'Haute-Garonne' ) , ('FR', '32', 'Gers' ) , ('FR', '33', 'Gironde' ) , -('FR', '34', 'Hérault' ) , +('FR', '34', 'Hérault' ) , ('FR', '35', 'Ille-et-Vilaine' ) , ('FR', '36', 'Indre' ) , ('FR', '37', 'Indre-et-Loire' ) , -('FR', '38', 'Isère' ) , +('FR', '38', 'Isère' ) , ('FR', '39', 'Jura' ) , ('FR', '40', 'Landes' ) , ('FR', '41', 'Loir-et-Cher' ) , @@ -675,7 +675,7 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('FR', '45', 'Loiret' ) , ('FR', '46', 'Lot' ) , ('FR', '47', 'Lot-et-Garonne' ) , -('FR', '48', 'Lozère' ) , +('FR', '48', 'Lozère' ) , ('FR', '49', 'Maine-et-Loire' ) , ('FR', '50', 'Manche' ) , ('FR', '51', 'Marne' ) , @@ -685,20 +685,20 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('FR', '55', 'Meuse' ) , ('FR', '56', 'Morbihan' ) , ('FR', '57', 'Moselle' ) , -('FR', '58', 'Nièvre' ) , +('FR', '58', 'Nièvre' ) , ('FR', '59', 'Nord' ) , ('FR', '60', 'Oise' ) , ('FR', '61', 'Orne' ) , ('FR', '62', 'Pas-de-Calais' ) , -('FR', '63', 'Puy-de-Dôme' ) , -('FR', '64', 'Pyrénées-Atlantiques' ) , -('FR', '65', 'Hautes-Pyrénées' ) , -('FR', '66', 'Pyrénées-Orientales' ) , +('FR', '63', 'Puy-de-Dôme' ) , +('FR', '64', 'Pyrénées-Atlantiques' ) , +('FR', '65', 'Hautes-Pyrénées' ) , +('FR', '66', 'Pyrénées-Orientales' ) , ('FR', '67', 'Bas-Rhin' ) , ('FR', '68', 'Haut-Rhin' ) , -('FR', '69', 'Rhône' ) , -('FR', '70', 'Haute-Saône' ) , -('FR', '71', 'Saône-et-Loire' ) , +('FR', '69', 'Rhône' ) , +('FR', '70', 'Haute-Saône' ) , +('FR', '71', 'Saône-et-Loire' ) , ('FR', '72', 'Sarthe' ) , ('FR', '73', 'Savoie' ) , ('FR', '74', 'Haute-Savoie' ) , @@ -706,13 +706,13 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('FR', '76', 'Seine-Maritime' ) , ('FR', '77', 'Seine-et-Marne' ) , ('FR', '78', 'Yvelines' ) , -('FR', '79', 'Deux-Sèvres' ) , +('FR', '79', 'Deux-Sèvres' ) , ('FR', '80', 'Somme' ) , ('FR', '81', 'Tarn' ) , ('FR', '82', 'Tarn-et-Garonne' ) , ('FR', '83', 'Var' ) , ('FR', '84', 'Vaucluse' ) , -('FR', '85', 'Vendée' ) , +('FR', '85', 'Vendée' ) , ('FR', '86', 'Vienne' ) , ('FR', '87', 'Haute-Vienne' ) , ('FR', '88', 'Vosges' ) , @@ -726,7 +726,7 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('GB', 'ABD', 'Aberdeenshire' ) , ('GB', 'ABE', 'Aberdeen City' ) , ('GB', 'AGB', 'Argyll and Bute' ) , -('GB', 'AGY', 'Isle of Anglesey [ Sir Ynys Môn GB-YNM]' ) , +('GB', 'AGY', 'Isle of Anglesey [ Sir Ynys Môn GB-YNM]' ) , ('GB', 'ANS', 'Angus' ) , ('GB', 'ANT', 'Antrim' ) , ('GB', 'ARD', 'Ards' ) , @@ -990,12 +990,12 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('GM', 'N', 'North Bank' ) , ('GM', 'U', 'Upper River' ) , ('GM', 'W', 'Western' ) , -('GW', 'BA', 'Bafatá' ) , +('GW', 'BA', 'Bafatá' ) , ('GW', 'BL', 'Bolama' ) , ('GW', 'BM', 'Biombo' ) , ('GW', 'BS', 'Bissau' ) , ('GW', 'CA', 'Cacheu' ) , -('GW', 'GA', 'Gabù' ) , +('GW', 'GA', 'Gabù' ) , ('GW', 'OI', 'Oio' ) , ('GW', 'QU', 'Quinara' ) , ('GW', 'TO', 'Tombali' ) , @@ -1006,7 +1006,7 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('IN', 'BR', 'Bihar' ) , ('IN', 'CH', 'Chandigarh' ) , ('IN', 'CT', 'Chhattisgarh' ) , -('IN', 'DD', 'Damán y Diu' ) , +('IN', 'DD', 'Damán y Diu' ) , ('IN', 'DL', 'Delhi' ) , ('IN', 'DN', 'Dadra y Nagar Haveli' ) , ('IN', 'GA', 'Goa' ) , @@ -1084,7 +1084,7 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('JP', '47', 'Okinawa' ) , ('KM', 'A', 'Anjouan' ) , ('KM', 'G', 'Grande Comore' ) , -('KM', 'M', 'Mohéli' ) , +('KM', 'M', 'Mohéli' ) , ('KR', '11', 'Seoul Teugbyeolsi [Seoul-T'' kpy lshi]' ) , ('KR', '26', 'Busan Gwang''yeogsi [Pusan-Kwangy kshi]' ) , ('KR', '27', 'Daegu Gwang''yeogsi [Taegu-Kwangy kshi]' ) , @@ -1102,26 +1102,26 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('KR', '48', 'Gyeongsangnamdo [Ky ngsangnam-do]' ) , ('KR', '49', 'Jejudo [Cheju-do]' ) , ('LV', 'AI', 'Aizkraukle' ) , -('LV', 'AL', 'Alūksne' ) , +('LV', 'AL', 'AlÅ«ksne' ) , ('LV', 'BL', 'Balvi' ) , ('LV', 'BU', 'Bauska' ) , -('LV', 'CE', 'Cēsis' ) , +('LV', 'CE', 'CÄ“sis' ) , ('LV', 'DA', 'Daugavpils' ) , ('LV', 'DO', 'Dobele' ) , ('LV', 'GU', 'Gulbene' ) , -('LV', 'JK', 'Jēkabpils' ) , +('LV', 'JK', 'JÄ“kabpils' ) , ('LV', 'JL', 'Jelgava' ) , -('LV', 'JUR', 'Jūrmala' ) , -('LV', 'KR', 'Krāslava' ) , -('LV', 'KU', 'Kuldīga' ) , -('LV', 'LE', 'Liepāja' ) , -('LV', 'LM', 'Limbaži' ) , +('LV', 'JUR', 'JÅ«rmala' ) , +('LV', 'KR', 'KrÄ�slava' ) , +('LV', 'KU', 'KuldÄ«ga' ) , +('LV', 'LE', 'LiepÄ�ja' ) , +('LV', 'LM', 'Limbaži' ) , ('LV', 'LPX', 'Liepdja' ) , ('LV', 'LU', 'Ludza' ) , ('LV', 'MA', 'Madona' ) , ('LV', 'OG', 'Ogre' ) , -('LV', 'PR', 'Preiļi' ) , -('LV', 'RE', 'Rēzekne' ) , +('LV', 'PR', 'Preiļi' ) , +('LV', 'RE', 'RÄ“zekne' ) , ('LV', 'RI', 'Riga' ) , ('LV', 'SA', 'Saldus' ) , ('LV', 'TA', 'Talsi' ) , @@ -1144,25 +1144,25 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('MX', 'GUA', 'Guanajuato' ) , ('MX', 'HID', 'Hidalgo' ) , ('MX', 'JAL', 'Jalisco' ) , -('MX', 'MEX', 'México' ) , -('MX', 'MIC', 'Michoacán' ) , +('MX', 'MEX', 'México' ) , +('MX', 'MIC', 'Michoacán' ) , ('MX', 'MOR', 'Morelos' ) , ('MX', 'NAY', 'Nayarit' ) , -('MX', 'NLE', 'Nuevo León' ) , +('MX', 'NLE', 'Nuevo León' ) , ('MX', 'OAX', 'Oaxaca' ) , ('MX', 'PUE', 'Puebla' ) , -('MX', 'QUE', 'Querétaro' ) , +('MX', 'QUE', 'Querétaro' ) , ('MX', 'ROO', 'Quintana Roo' ) , ('MX', 'SIN', 'Sinaloa' ) , -('MX', 'SLP', 'San Luis Potosí' ) , +('MX', 'SLP', 'San Luis Potosí' ) , ('MX', 'SON', 'Sonora' ) , ('MX', 'TAB', 'Tabasco' ) , ('MX', 'TAM', 'Tamaulipas' ) , ('MX', 'TLA', 'Tlaxcala' ) , ('MX', 'VER', 'Veracruz' ) , -('MX', 'YUC', 'Yucatán' ) , +('MX', 'YUC', 'Yucatán' ) , ('MX', 'ZAC', 'Zacatecas' ) , -('NO', '01', 'Østfold' ) , +('NO', '01', 'Østfold' ) , ('NO', '02', 'Akershus' ) , ('NO', '03', 'Oslo' ) , ('NO', '04', 'Hedmark' ) , @@ -1175,9 +1175,9 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('NO', '11', 'Rogaland' ) , ('NO', '12', 'Hordaland' ) , ('NO', '14', 'Sogn og Fjordane' ) , -('NO', '15', 'Møre og Romsdal' ) , -('NO', '16', 'Sør-Trøndelag' ) , -('NO', '17', 'Nord-Trøndelag' ) , +('NO', '15', 'Møre og Romsdal' ) , +('NO', '16', 'Sør-Trøndelag' ) , +('NO', '17', 'Nord-Trøndelag' ) , ('NO', '18', 'Nordland' ) , ('NO', '19', 'Troms' ) , ('NO', '20', 'Finnmark' ) , @@ -1203,42 +1203,42 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('PT', '04', 'Braganza' ) , ('PT', '05', 'Castelo Branco' ) , ('PT', '06', 'Coimbra' ) , -('PT', '07', 'Évora' ) , +('PT', '07', 'Évora' ) , ('PT', '08', 'Faro' ) , ('PT', '09', 'Guarda' ) , ('PT', '10', 'Leiria' ) , ('PT', '11', 'Lisboa' ) , ('PT', '12', 'Portalegre' ) , ('PT', '13', 'Porto' ) , -('PT', '14', 'Santarém' ) , -('PT', '15', 'Setúbal' ) , +('PT', '14', 'Santarém' ) , +('PT', '15', 'Setúbal' ) , ('PT', '16', 'Viana do Castelo' ) , ('PT', '17', 'Vila Real' ) , ('PT', '18', 'Viseu' ) , -('PT', '20', 'Região Autónoma dos Açores' ) , -('PT', '30', 'Região Autónoma da Madeira' ) , +('PT', '20', 'Região Autónoma dos Açores' ) , +('PT', '30', 'Região Autónoma da Madeira' ) , ('SE', 'AB', 'Stockholms' ) ; INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('SE', 'AC', 'Vesterbottens' ) , -('SE', 'BD', 'Norrbottens län' ) , -('SE', 'C', 'Uppsala län' ) , -('SE', 'D', 'Södermanlands län' ) , -('SE', 'E', 'Östergötland' ) , -('SE', 'F', 'Jönköping' ) , +('SE', 'BD', 'Norrbottens län' ) , +('SE', 'C', 'Uppsala län' ) , +('SE', 'D', 'Södermanlands län' ) , +('SE', 'E', 'Östergötland' ) , +('SE', 'F', 'Jönköping' ) , ('SE', 'G', 'Kronoberg' ) , ('SE', 'H', 'Kalmar' ) , ('SE', 'I', 'Gotlands' ) , ('SE', 'K', 'Blekinge' ) , -('SE', 'M', 'Skåne' ) , +('SE', 'M', 'SkÃ¥ne' ) , ('SE', 'N', 'Halland' ) , -('SE', 'O', 'Västra Götaland' ) , -('SE', 'S', 'Värmland' ) , -('SE', 'T', 'Örebro' ) , -('SE', 'U', 'Västmanland' ) , +('SE', 'O', 'Västra Götaland' ) , +('SE', 'S', 'Värmland' ) , +('SE', 'T', 'Örebro' ) , +('SE', 'U', 'Västmanland' ) , ('SE', 'W', 'Dalarna' ) , -('SE', 'X', 'Gävleborg' ) , -('SE', 'Y', 'Västernorrland' ) , -('SE', 'Z', 'Jämtland' ) , +('SE', 'X', 'Gävleborg' ) , +('SE', 'Y', 'Västernorrland' ) , +('SE', 'Z', 'Jämtland' ) , ('TR', '01', 'Adana' ) , ('TR', '02', 'Adiyaman' ) , ('TR', '03', 'Afyon' ) , @@ -1267,7 +1267,7 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('TR', '26', 'Eskisehir' ) , ('TR', '27', 'Gaziantep' ) , ('TR', '28', 'Giresun' ) , -('TR', '29', 'Gümüşhane' ) , +('TR', '29', 'Gümüşhane' ) , ('TR', '30', 'Hakkari' ) , ('TR', '31', 'Hatay' ) , ('TR', '32', 'Isparta' ) , @@ -1281,7 +1281,7 @@ INSERT INTO ISO_SUBDIVISION (IC_UID,IS_UID,IS_NAME) VALUES ('TR', '40', 'Kirsehir' ) , ('TR', '41', 'Kocaeli' ) , ('TR', '42', 'Konya' ) , -('TR', '43', 'Kütahya' ) , +('TR', '43', 'Kütahya' ) , ('TR', '44', 'Malatya' ) , ('TR', '45', 'Manisa' ) , ('TR', '46', 'Kahramanmaras' ) , @@ -3413,7 +3413,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_INTERMEDIATE_MESSAGE_EVENT','en','Intermediate Message Events (Task Notifications)','2014-01-15') , ( 'LABEL','ID_TEMPLATES','en','Templates','2014-01-15') , ( 'LABEL','ID_PUBLIC','en','Public','2014-01-15') , -( 'LABEL','ID_DELETE_INPUTDOCUMENT_CONFIRM','en','The item will be deleted the day of the work hour’s list. Do you want continue?','2014-10-21') , +( 'LABEL','ID_DELETE_INPUTDOCUMENT_CONFIRM','en','The item will be deleted the day of the work hour’s list. Do you want continue?','2014-10-21') , ( 'JAVASCRIPT','ID_SUBJECT_FIELD_REQUIRED','en','Subject Field is required.','2014-01-15') , ( 'JAVASCRIPT','ID_MESSAGE_FIELD_REQUIRED','en','Message Field is required.','2014-01-15') , ( 'JAVASCRIPT','ID_TEMPLATE_FIELD_REQUIRED','en','Template Field is required.','2014-01-15') , @@ -3639,7 +3639,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_NOT_WORKSPACE_SPECIFIED','en','No workspace specified!','2014-01-15') , ( 'LABEL','ID_BAD_REQUEST','en','Bad Request!','2014-01-15') , ( 'LABEL','ID_COLOSA_AND_CERTIFIED_PARTNERS','en','Supplied free of charge with no support, certification, warranty, maintenance nor indemnity by Colosa and its Certified Partners.','2014-10-21') , -( 'LABEL','ID_COPYRIGHT','en','Copyright © 2003-2011 Colosa, Inc. All rights reserved.','2014-01-15') , +( 'LABEL','ID_COPYRIGHT','en','Copyright © 2003-2011 Colosa, Inc. All rights reserved.','2014-01-15') , ( 'LABEL','ID_LOGIN_WITH_FACEBOOK','en','Login with Facebook!!','2014-01-15') , ( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_DESCRIPTION_STEP6','en','xxx','2014-01-15') , ( 'LABEL','ID_SIZE_VERY_LARGE_PERMITTED','en','The file is too large . Please upload a smaller file.','2014-10-08') , @@ -4048,7 +4048,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_ROUTING_SCREEN_TEMPLATE_DOES_NOT_EXIST','en','The routing screen template with {0}: {1} does not exist.','2014-05-20') , ( 'LABEL','ID_RECORD_EXISTS_IN_TABLE','en','The record "{0}" exists in table {1}.','2014-10-21') , ( 'LABEL','ID_RECORD_DOES_NOT_EXIST_IN_TABLE','en','The record "{0}", does not exist in table {1}.','2014-05-20') , -( 'LABEL','ID_RECORD_CANNOT_BE_CREATED','en','The record couldn’t be created!','2014-10-21') , +( 'LABEL','ID_RECORD_CANNOT_BE_CREATED','en','The record couldn’t be created!','2014-10-21') , ( 'LABEL','ID_CASE_TRACKER_OBJECT_DOES_NOT_EXIST','en','The case tracker object with {0}: {1} does not exist.','2014-05-20') , ( 'LABEL','ID_ATTRIBUTE_HAS_INVALID_ELEMENT_KEY','en','The attribute {0}, has an invalid element (incorrect keys).','2014-05-20') , ( 'LABEL','ID_DYNAFORM_DOES_NOT_EXIST','en','The DynaForm with {0}: {1} does not exist.','2014-05-20') , @@ -14907,7 +14907,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('CZ','JRN','Jirny',' ','') , ('CZ','JSN','Jesenik',' ','') , ('CZ','JTV','JetYichov',' ','') , -('CZ','KAD','Kadaň',' ','') , +('CZ','KAD','Kadaň',' ','') , ('CZ','KAP','Kaplice',' ','') , ('CZ','KAR','Karlin',' ','') , ('CZ','KCC','Klasterec nad Orlici',' ','') , @@ -14937,7 +14937,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('CZ','KSL','Kostelec nad Labem',' ','') , ('CZ','KST','Kostomlatky',' ','') , ('CZ','KSV','Kamenicky Senov',' ','') , -('CZ','KTA','Košťálov',' ','') , +('CZ','KTA','Košťálov',' ','') , ('CZ','KTV','Klatovy',' ','') , ('CZ','KUH','Kutna Hora',' ','') , ('CZ','KUN','Kunovice',' ','') ; @@ -15145,7 +15145,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('CZ','SUS','Susice',' ','') , ('CZ','SVK','Svaty Kriz',' ','') , ('CZ','SVO','Straskov',' ','') , -('CZ','SVR','Svrkyně',' ','') , +('CZ','SVR','SvrkynÄ›',' ','') , ('CZ','SZA','Strazny',' ','') , ('CZ','TAC','Tachov',' ','') , ('CZ','TAS','Tynec nad Sazavou',' ','') , @@ -15180,7 +15180,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('CZ','VCH','Vysoky Chlumec',' ','') , ('CZ','VCR','Volduchy',' ','') , ('CZ','VEA','Ceske Velenice',' ','') , -('CZ','VEB','Velká Bíteš',' ','') , +('CZ','VEB','Velká BíteÅ¡',' ','') , ('CZ','VEL','Veletov',' ','') , ('CZ','VFA','Varnsdorf',' ','') , ('CZ','VIM','Vimperk',' ','') ; @@ -23197,7 +23197,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('FR','FDO','Fours',' ','33') , ('FR','FDS','Fondettes',' ','37') , ('FR','FDU','Ferdrupt',' ','88') , -('FR','FEA','Ferrières-en-Gâtinais',' ','45') , +('FR','FEA','Ferrières-en-Gâtinais',' ','45') , ('FR','FEC','Fecamp',' ','76') , ('FR','FEE','Fresse',' ','70') , ('FR','FEG','Fegersheim',' ','67') , @@ -31025,7 +31025,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('HR','BVA','Brezovica',' ','') , ('HR','BVO','Baska Voda',' ','') , ('HR','BZA','Bozava',' ','') , -('HR','CAK','Čakovec',' ','') , +('HR','CAK','ÄŒakovec',' ','') , ('HR','CRA','Crikvenica',' ','') , ('HR','CRS','Cres',' ','') , ('HR','CVT','Cavtat',' ','') , @@ -31047,8 +31047,8 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('HR','GCN','Gorican',' ','') , ('HR','GNA','Gazenica',' ','') , ('HR','GOM','Gomirje',' ','') , -('HR','GRA','Gračac',' ','') , -('HR','GSP','Gospić',' ','') , +('HR','GRA','GraÄ�ac',' ','') , +('HR','GSP','Gospić',' ','') , ('HR','HLE','Hrvatski Leskovac',' ','') , ('HR','HVA','Hvar',' ','') , ('HR','ILO','Ilok',' ','') , @@ -31089,7 +31089,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('HR','MAS','Maslenica',' ','') , ('HR','MAV','Martinska Ves Desna',' ','') , ('HR','MCC','Macinec',' ','') , -('HR','MET','Metković',' ','') , +('HR','MET','Metković',' ','') , ('HR','MHV','Mohovo',' ','') , ('HR','MIL','Milna',' ','') , ('HR','MNK','Misnjak',' ','') , @@ -31118,7 +31118,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('HR','OPT','Opatovac',' ','') , ('HR','ORB','Orebic',' ','') , ('HR','OSI','Osijek',' ','') , -('HR','OTO','Otočac',' ','') , +('HR','OTO','OtoÄ�ac',' ','') , ('HR','OVA','Orahovica',' ','') , ('HR','OVC','Oriovac',' ','') , ('HR','PAG','Pag',' ','') , @@ -31157,7 +31157,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('HR','SBC','Stobrec',' ','') , ('HR','SBD','Slavonski Brod',' ','') , ('HR','SBR','Sobra',' ','') , -('HR','SDA','Satnica Đakovačka',' ','') , +('HR','SDA','Satnica Ä�akovaÄ�ka',' ','') , ('HR','SDR','Sudurad',' ','') , ('HR','SEN','Senj',' ','') , ('HR','SGA','Strigova',' ','') , @@ -31344,7 +31344,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('HU','HER','Hercegszanto',' ','') , ('HU','HEV','Heves',' ','') , ('HU','HIS','Hidasnemeti',' ','') , -('HU','HMV','Hódmezővásárhely',' ','') , +('HU','HMV','HódmezÅ‘vásárhely',' ','') , ('HU','HRY','Hater',' ','') , ('HU','IPO','Ipolytarnoc',' ','') , ('HU','IPS','Ipolytolgyes',' ','') , @@ -31367,7 +31367,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('HU','KIA','Kisvarda',' ','') , ('HU','KIS','Kiskunfelegyhaza',' ','') , ('HU','KIT','Kistarcsa',' ','') , -('HU','KKS','Kiskőrös',' ','') , +('HU','KKS','KiskÅ‘rös',' ','') , ('HU','KLK','Kistelek',' ','') , ('HU','KMD','Kunmadaras',' ','') , ('HU','KMJ','Kiskunmajsa',' ','') , @@ -37925,7 +37925,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('LV','ASE','Aluksne',' ','AL') , ('LV','AUC','Auce',' ','DO') , ('LV','BAU','Bauska',' ','BU') , -('LV','BRC','Brocēni',' ','SA') , +('LV','BRC','BrocÄ“ni',' ','SA') , ('LV','BZC','Briezuciems',' ','BL') , ('LV','CES','Cesis',' ','CE') , ('LV','DGP','Daugavpils',' ','DW') , @@ -38068,7 +38068,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('MD','RIB','Ribnita',' ','') , ('MD','TIR','Tiraspol',' ','') , ('MD','UNG','Ungeny',' ','') , -('MD','VUL','Vulcăneşti',' ','') , +('MD','VUL','VulcăneÅŸti',' ','') , ('ME','','',' ','') , ('ME','BAR','Bar',' ','') , ('ME','BIJ','Bijela',' ','') , @@ -38391,7 +38391,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('MT','PAO','Paola',' ','') , ('MT','RMI','Qormi',' ','') , ('MT','SGW','San A Wann, Valletta',' ','') , -('MT','SJN','San Julián (St Julian)',' ','') , +('MT','SJN','San Julián (St Julian)',' ','') , ('MT','SPB','St Paul''s Bay (San Paul il-Bahir)',' ','') , ('MU','','',' ','') , ('MU','CDE','Cloverdale',' ','') , @@ -42559,8 +42559,8 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('PL','BAP','Biala Podlaska',' ','') , ('PL','BAR','Bartoszyce',' ','') , ('PL','BCA','Bochnia',' ','') , -('PL','BED','Będzin',' ','') , -('PL','BEL','Bełżyce',' ','') , +('PL','BED','BÄ™dzin',' ','') , +('PL','BEL','Bełżyce',' ','') , ('PL','BGA','Boguchwala',' ','') ; INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('PL','BGW','BoguchwaBa',' ','') , @@ -42626,7 +42626,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('PL','DKA','Debnica Kaszubska',' ','') , ('PL','DNW','Dobrzyn nad Wisla',' ','') , ('PL','DOK','Dobrzyniewo Koscielne',' ','') , -('PL','DOL','Dołuje Mierzyn',' ','') , +('PL','DOL','DoÅ‚uje Mierzyn',' ','') , ('PL','DUS','Duszniki Zdroj',' ','') , ('PL','DZE','Dobrzykowice Wroclawskie',' ','') , ('PL','DZI','Dzialdowo',' ','') , @@ -42711,7 +42711,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('PL','KAZ','Kazimierz',' ','') , ('PL','KCL','Kucelinska',' ','') , ('PL','KCN','Krasocin',' ','') , -('PL','KEK','Kędzierzyn-',' ','') , +('PL','KEK','KÄ™dzierzyn-',' ','') , ('PL','KEP','Kepno',' ','') , ('PL','KIJ','Kijow',' ','') , ('PL','KKE','Krapkowice',' ','') , @@ -42819,7 +42819,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('PL','MIC','Miechow',' ','') , ('PL','MID','Miedzyzdroje',' ','') , ('PL','MIE','Michalowice',' ','') , -('PL','MIK','Mikołów',' ','') , +('PL','MIK','Mikołów',' ','') , ('PL','MIN','Minsk Mazowiecki',' ','') , ('PL','MIR','Mirkow',' ','') , ('PL','MKI','Marki',' ','') , @@ -43000,7 +43000,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('PL','SKP','Skopanie',' ','') , ('PL','SKW','Skwierzyna',' ','') , ('PL','SKZ','Skalmierzyce',' ','') , -('PL','SLA','Sławno',' ','') , +('PL','SLA','SÅ‚awno',' ','') , ('PL','SLC','Slupca',' ','') , ('PL','SLE','Slubice, Mazowieckie',' ','') , ('PL','SLP','Slupsk',' ','') , @@ -43030,7 +43030,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('PL','STD','Starogard',' ','') , ('PL','STE','Starachowice',' ','') , ('PL','STG','Starogard Gdanski',' ','') , -('PL','STJ','Stare Jeżewo',' ','') , +('PL','STJ','Stare Jeżewo',' ','') , ('PL','STM','Stare Miasto',' ','') , ('PL','STN','Straszyn',' ','') , ('PL','STP','Stare Pole',' ','') , @@ -43152,7 +43152,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('PL','ZGZ','Zagorz',' ','') , ('PL','ZIE','Ziebice',' ','') , ('PL','ZIL','Zielonka',' ','') , -('PL','ZKW','Żyraków',' ','') , +('PL','ZKW','Å»yraków',' ','') , ('PL','ZLA','Zolynia',' ','') , ('PL','ZLO','Zlotow',' ','') , ('PL','ZNI','Znin',' ','') , @@ -43921,7 +43921,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('RO','CCA','Carcea',' ','') , ('RO','CCI','Clinceni',' ','') , ('RO','CCL','Caracal',' ','') , -('RO','CDA','Curtea de Argeș',' ','') , +('RO','CDA','Curtea de ArgeÈ™',' ','') , ('RO','CEV','Cernavoda',' ','') , ('RO','CJA','Chiajna',' ','') , ('RO','CLA','Codlea',' ','') , @@ -43952,7 +43952,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('RO','DCU','Dascalu',' ','') , ('RO','DEJ','Dej',' ','') , ('RO','DHO','Dorohoi',' ','') , -('RO','DIM','Dâmbovița',' ','') , +('RO','DIM','DâmboviÈ›a',' ','') , ('RO','DOR','Dornesti',' ','') , ('RO','DSI','Dragasani',' ','') , ('RO','DTS','Drobeta Turnu Severin',' ','') , @@ -44045,7 +44045,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('RO','PCI','Pascani',' ','') , ('RO','PDM','Poienarii de Muscel',' ','') , ('RO','PEI','Petrosani',' ','') , -('RO','PET','Petroșani',' ','') , +('RO','PET','PetroÈ™ani',' ','') , ('RO','PFD','Portile de Fier Doi',' ','') , ('RO','PFU','Portile de Fier Unu',' ','') , ('RO','PIA','Piatra Olt',' ','') , @@ -46708,7 +46708,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('TR','MFZ','Mersin-Free Zone',' ','33') , ('TR','MHM','Mahmudiye',' ','26') , ('TR','MIL','Milas',' ','48') , -('TR','MKP','Mustafakemalpaşa',' ','16') , +('TR','MKP','MustafakemalpaÅŸa',' ','16') , ('TR','MLK','Malkara',' ','59') , ('TR','MLX','Malatya',' ','44') , ('TR','MNM','Menemen',' ','35') , @@ -46799,7 +46799,7 @@ INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('TR','SRG','Sarigazi',' ','34') , ('TR','SRK','Sarkoy',' ','59') , ('TR','SRN','Sirinevler',' ','34') , -('TR','SRS','Samandağ',' ','31') , +('TR','SRS','SamandaÄŸ',' ','31') , ('TR','SRY','Sariyer',' ','34') , ('TR','SSL','Susurluk',' ','10') , ('TR','SSX','Samsun',' ','55') , @@ -59942,4 +59942,20 @@ INSERT INTO DASHLET_INSTANCE (DAS_INS_UID,DAS_UID,DAS_INS_OWNER_TYPE,DAS_INS_OWN ('00000000000000000000000000000004','00000000000000000000000000000004','EVERYBODY','','a:2:{s:13:"DAS_INS_TITLE";s:15:"PM Plugins News";s:7:"DAS_URL";s:71:"http://license.processmaker.com/syspmLicenseSrv/en/green/services/rssAP";}','2012-04-16 00:00:00','2012-04-16 00:00:00',1); INSERT INTO CONFIGURATION (CFG_UID,OBJ_UID,CFG_VALUE,PRO_UID,USR_UID,APP_UID) VALUES -('ENVIRONMENT_SETTINGS','','a:1:{s:18:"directoryStructure";i:2;}','','',''); \ No newline at end of file +('ENVIRONMENT_SETTINGS','','a:1:{s:18:"directoryStructure";i:2;}','','',''); + +INSERT INTO CATALOG (CAT_UID, CAT_LABEL_ID, CAT_TYPE, CAT_FLAG, CAT_OBSERVATION, CAT_CREATE_DATE, CAT_UPDATE_DATE) VALUES +('10','ID_BARS','GRAPHIC','','','2015-03-04','2015-03-04'), +('20','ID_LINES','GRAPHIC','','','2015-03-04','2015-03-04'), +('100','ID_MONTH','PERIODICITY','','','2015-03-04','2015-03-04'), +('200','ID_QUARTER','PERIODICITY','','','2015-03-04','2015-03-04'), +('300','ID_SEMESTER','PERIODICITY','','','2015-03-04','2015-03-04'), +('400','ID_YEAR','PERIODICITY','','','2015-03-04','2015-03-04'), +('1010','ID_PROCESS_EFFICIENCE','INDICATOR','','','2015-03-04','2015-03-04'), +('1020','ID_PROCESS_INEFFICIENCE','INDICATOR','','','2015-03-04','2015-03-04'), +('1030','ID_EMPLYEE_EFFICIENCIE','INDICATOR','','','2015-03-04','2015-03-04'), +('1040','ID_USER_INEFFICIENCE','INDICATOR','','','2015-03-04','2015-03-04'), +('1050','ID_OVER_DUE','INDICATOR','%','Unit for displaying','2015-03-04','2015-03-04'), +('1060','ID_NEW_CASES','INDICATOR','','','2015-03-04','2015-03-04'), +('1070','ID_COMPLETED_CASES','INDICATOR','','','2015-03-04','2015-03-04'), +('1080','ID_WORKING_CASES','INDICATOR','','','2015-03-04','2015-03-04'); diff --git a/workflow/engine/menus/processmaker.php b/workflow/engine/menus/processmaker.php index f51bf33be..126d04c35 100755 --- a/workflow/engine/menus/processmaker.php +++ b/workflow/engine/menus/processmaker.php @@ -1,57 +1,66 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - - -/************************************* - * ---= Processmaker main menu=--- - *************************************/ - -global $G_TMP_MENU; -global $RBAC; - -// HOME MODULE -if ($RBAC->userCanAccess('PM_CASES') == 1) { - $G_TMP_MENU->AddIdRawOption('CASES', 'cases/main', G::LoadTranslation('ID_HOME'), '', '', '', 'x-pm-home'); -} - -// DESIGNER MODULE -if ($RBAC->userCanAccess('PM_FACTORY') == 1 ) { - $G_TMP_MENU->AddIdRawOption('PROCESSES', 'processes/main', G::LoadTranslation('ID_DESIGNER'), '', '', '', 'x-pm-designer'); -} - -// DASHBOARD MODULE -if ($RBAC->userCanAccess('PM_DASHBOARD') == 1) { - $G_TMP_MENU->AddIdRawOption('DASHBOARD', 'dashboard/main', G::LoadTranslation('ID_DASHBOARD'), '', '', '', 'x-pm-dashboard'); -} - -// ADMIN MODULE -if ($RBAC->userCanAccess('PM_SETUP') == 1 || $RBAC->userCanAccess('PM_USERS') == 1) { - $G_TMP_MENU->AddIdRawOption('SETUP', 'setup/main', G::LoadTranslation('ID_SETUP'), '', '', '', 'x-pm-setup'); -} - -// PLUGINS MENUS -if( file_exists(PATH_CORE . 'menus/plugin.php') ) { - require_once(PATH_CORE . 'menus/plugin.php'); -} \ No newline at end of file +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + */ + + +/************************************* + * ---= Processmaker main menu=--- + *************************************/ + +global $G_TMP_MENU; +global $RBAC; + +// HOME MODULE +if ($RBAC->userCanAccess('PM_CASES') == 1) { + $G_TMP_MENU->AddIdRawOption('CASES', 'cases/main', G::LoadTranslation('ID_HOME'), '', '', '', 'x-pm-home'); +} + +// DESIGNER MODULE +if ($RBAC->userCanAccess('PM_FACTORY') == 1 ) { + $G_TMP_MENU->AddIdRawOption('PROCESSES', 'processes/main', G::LoadTranslation('ID_DESIGNER'), '', '', '', 'x-pm-designer'); +} + +// DASHBOARD MODULE +if ($RBAC->userCanAccess('PM_DASHBOARD') == 1) { + $G_TMP_MENU->AddIdRawOption('DASHBOARD', 'dashboard/main', G::LoadTranslation('ID_DASHBOARD'), '', '', '', 'x-pm-dashboard'); +} + +// ADMIN MODULE +if ($RBAC->userCanAccess('PM_SETUP') == 1 || $RBAC->userCanAccess('PM_USERS') == 1) { + $G_TMP_MENU->AddIdRawOption('SETUP', 'setup/main', G::LoadTranslation('ID_SETUP'), '', '', '', 'x-pm-setup'); +} + +/*----------------------------------********---------------------------------*/ +// NEW DASHBOARD MODULE +$licensedFeatures = & PMLicensedFeatures::getSingleton(); +if ($licensedFeatures->verifyfeature('bvZTnIraUhCSXIxNEVOcGluVVR6Y3E3NStiMW9tWU54aU5tb0FrRnJ0MXMzLzRWMHZtakJIN3dRPT0=') && ($RBAC->userCanAccess('PM_SETUP') == 1 || $RBAC->userCanAccess('PM_USERS') == 1)) { + $G_TMP_MENU->AddIdRawOption('DASHBOARD+', 'strategicDashboard/main', G::LoadTranslation('ID_DASHBOARD'), '', '', '', 'x-pm-dashboard'); +} +/*----------------------------------********---------------------------------*/ + +// PLUGINS MENUS +if( file_exists(PATH_CORE . 'menus/plugin.php') ) { + require_once(PATH_CORE . 'menus/plugin.php'); +} + diff --git a/workflow/engine/menus/setup.php b/workflow/engine/menus/setup.php index 8f70c7433..ac62ba261 100755 --- a/workflow/engine/menus/setup.php +++ b/workflow/engine/menus/setup.php @@ -1,153 +1,160 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -global $G_TMP_MENU; -global $RBAC; -$partnerFlag = (defined('PARTNER_FLAG')) ? PARTNER_FLAG : false; - -/*----------------------------------********---------------------------------*/ -$oServerConf = & serverConf::getSingleton(); -$sAudit = $oServerConf->getAuditLogProperty( 'AL_OPTION', SYS_SYS ); -$licensedFeatures = & PMLicensedFeatures::getSingleton(); -/*----------------------------------********---------------------------------*/ - -if ($RBAC->userCanAccess('PM_SETUP') == 1 ) { - //settings options - // $G_TMP_MENU->AddIdRawOption('LOGO', 'uplogo', G::LoadTranslation('ID_LOGO'), 'icon-pmlogo.png', '', 'settings'); - $G_TMP_MENU->AddIdRawOption('LOGO', '../admin/pmLogo', G::LoadTranslation('ID_LOGO'), 'icon-pmlogo.png','', 'settings'); - $G_TMP_MENU->AddIdRawOption("EMAIL_SERVER", "../emailServer/emailServer", G::LoadTranslation("ID_EMAIL_SERVER_TITLE"), "icon-email-settings1.png", "", "settings"); - $G_TMP_MENU->AddIdRawOption('CALENDAR', 'calendarList', G::LoadTranslation('ID_CALENDAR'), 'icon-calendar.png', '', 'settings' ); - //if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1) - // $G_TMP_MENU->AddIdRawOption('CASES_LIST_SETUP', '../cases/casesListSetup', G::LoadTranslation('ID_CASES_LIST_SETUP'), "",'', 'settings'); - $G_TMP_MENU->AddIdRawOption('PROCESS_CATEGORY', '../processCategory/processCategoryList', G::LoadTranslation('ID_PROCESS_CATEGORY'), "rules.png",'', 'settings'); -} - -if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1) { - $G_TMP_MENU->AddIdRawOption('LANGUAGES', 'languages', G::LoadTranslation('ID_LANGUAGES'), 'icon-language.png', '', 'settings'); -} - -if ($RBAC->userCanAccess('PM_SETUP') == 1 ) { - $G_TMP_MENU->AddIdRawOption('SKINS', 'skinsList', G::LoadTranslation('ID_SKINS'), 'icon-skins.png', '', 'settings'); - if (!$partnerFlag) { - $G_TMP_MENU->AddIdRawOption('HEARTBEAT', 'processHeartBeatConfig', G::LoadTranslation('ID_HEARTBEAT_CONFIG'), "heartBeat.jpg",'', 'settings'); - } - - $G_TMP_MENU->AddIdRawOption('ENVIRONMENT_SETTINGS', 'environmentSettings', G::LoadTranslation('ID_ENVIRONMENT_SETTINGS'), "",'', 'settings'); -} - -if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1) { - $G_TMP_MENU->AddIdRawOption('APPCACHEVIEW_SETUP', '../setup/appCacheViewConf', G::LoadTranslation('ID_APPCACHE_SETUP'), "",'', 'settings'); -} - -if ($RBAC->userCanAccess('PM_SETUP') == 1) { - $G_TMP_MENU->AddIdRawOption('CLEAR_CACHE', 'clearCompiled', G::LoadTranslation('ID_CLEAR_CACHE'), 'icon-rebuild-clean.png', "", 'settings' ); - //$G_TMP_MENU->AddIdRawOption('ADDITIONAL_TABLES', '../additionalTables/additionalTablesList', G::LoadTranslation('ID_ADDITIONAL_TABLES'), 'icon-tables.png','', 'settings'); - //$G_TMP_MENU->AddIdRawOption('REPORT_TABLES', '../reportTables/main', 'Report Tables', 'icon-tables.png','', 'settings'); - - $G_TMP_MENU->AddIdRawOption('PM_TABLES', '../pmTables', G::LoadTranslation('ID_ADDITIONAL_TABLES'), 'icon-tables.png','', 'settings'); - - if (!$partnerFlag) { - $G_TMP_MENU->AddIdRawOption('WEBSERVICES', 'webServices', G::LoadTranslation('ID_WEB_SERVICES'), 'icon-webservices.png', '', 'settings'); - } - $G_TMP_MENU->AddIdRawOption('LOGIN', 'loginSettings', G::LoadTranslation('LOGIN'), "",'', 'settings'); - $G_TMP_MENU->AddIdRawOption('DASHBOARD', '../dashboard/dashletsList', ucfirst(G::LoadTranslation('ID_DASHBOARD')), '', '', 'settings'); -} -//tools options -if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1 ) { - if (!$partnerFlag) { - $G_TMP_MENU->AddIdRawOption('PLUGINS', 'pluginsMain', G::LoadTranslation('ID_PLUGINS_MANAGER'), 'icon-plugins.png', '', 'plugins'); - } -} - -//users options -if ($RBAC->userCanAccess('PM_USERS') == 1) { - $G_TMP_MENU->AddIdRawOption('USERS', '../users/users_List', G::LoadTranslation('ID_USERS_LIST'), 'icon-webservices.png', '', 'users'); - - $G_TMP_MENU->AddIdRawOption('GROUPS', '../groups/groups', G::LoadTranslation('ID_GROUPS'), '', '', 'users'); - $G_TMP_MENU->AddIdRawOption('DEPARTAMENTS', '../departments/departments', G::LoadTranslation('ID_DEPARTMENTS_USERS'), '', '', 'users'); - $G_TMP_MENU->AddIdRawOption('ROLES', '../roles/roles_List', G::LoadTranslation('ID_ROLES'), '', '', 'users'); -} - -if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1 && $RBAC->userCanAccess('PM_USERS') == 1) { - $G_TMP_MENU->AddIdRawOption('AUTHSOURCES', '../authSources/authSources_List', G::LoadTranslation('ID_AUTH_SOURCES'), '', '', 'users'); - $G_TMP_MENU->AddIdRawOption('UX', '../admin/uxList', G::LoadTranslation('ID_USER_EXPERIENCE'), '', '', 'users'); - $G_TMP_MENU->AddIdRawOption('SYSTEM', '../admin/system', G::LoadTranslation('ID_SYSTEM'), '', '', 'settings'); - $G_TMP_MENU->AddIdRawOption('INFORMATION', '../setup/systemInfo?option=processInfo', G::LoadTranslation('ID_SYSTEM_INFO'), '', '', 'settings'); -} - -if ($RBAC->userCanAccess('PM_SETUP') == 1) { - $G_TMP_MENU->AddIdRawOption('EVENT', '../events/eventList', G::LoadTranslation('ID_EVENTS'), '', '', 'logs'); - $G_TMP_MENU->AddIdRawOption('LOG_CASE_SCHEDULER', '../cases/cases_Scheduler_Log', G::LoadTranslation('ID_CASE_SCHEDULER'), "icon-logs-list.png",'', 'logs'); - $G_TMP_MENU->AddIdRawOption("CRON", "../setup/cron", G::LoadTranslation("ID_CRON_ACTIONS"), null, null, "logs"); - $G_TMP_MENU->AddIdRawOption('EMAILS', '../mails/emailList', ucfirst (strtolower ( G::LoadTranslation('ID_EMAILS'))), '', '', 'logs'); - /*----------------------------------********---------------------------------*/ - if (isset($sAudit) && $sAudit != false && $licensedFeatures->verifyfeature('vtSeHNhT0JnSmo1bTluUVlTYUxUbUFSVStEeXVqc1pEUG5EeXc0MGd2Q3ErYz0=')) { - $G_TMP_MENU->AddIdRawOption('AUDIT_LOG', '../setup/auditLog', ucfirst (G::LoadTranslation('ID_AUDITLOG_DISPLAY')), '', '', 'logs'); - } - /*----------------------------------********---------------------------------*/ -} - -if ($RBAC->userCanAccess("PM_SETUP") == 1) { - $G_TMP_MENU->AddIdRawOption("PM_REQUIREMENTS", "../setup/systemInfo", G::LoadTranslation("ID_PROCESSMAKER_REQUIREMENTS_CHECK"), "", "", "settings"); - $G_TMP_MENU->AddIdRawOption("PHP_INFO", "../setup/systemInfo?option=php", G::LoadTranslation("ID_PHP_INFO"), "", "", "settings"); - //$G_TMP_MENU->AddIdRawOption("PHP_MAINTENANCE", "../admin/maintenance", 'Maintenance', "", "", "settings"); - /*----------------------------------********---------------------------------*/ - if ($licensedFeatures->verifyfeature('vtSeHNhT0JnSmo1bTluUVlTYUxUbUFSVStEeXVqc1pEUG5EeXc0MGd2Q3ErYz0=')) { - $G_TMP_MENU->AddIdRawOption("AUDIT_LOG", "auditLogConfig", G::LoadTranslation("ID_AUDITLOG_DISPLAY"), "", "", "settings"); - } - /*----------------------------------********---------------------------------*/ -} -/*----------------------------------********---------------------------------*/ -require_once 'classes/class.pmLicenseManager.php'; -if (!file_exists(PATH_DATA_SITE . "plugin.singleton")) { - require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php'; - $enterprise = new enterprisePlugin('enterprise'); - $enterprise->enable(); - $enterprise->setup(); -} -$pmLicenseManagerO = &pmLicenseManager::getSingleton(); -$licenseStatusInfo = $pmLicenseManagerO->getCurrentLicenseStatus(); -$licStatusMsg = null; - -if ((isset($pmLicenseManagerO->plan)) && ($pmLicenseManagerO->plan != "")) { - $lines = explode(" - ", $pmLicenseManagerO->plan); - if (isset($lines[0])) { - $licStatusMsg .= "
          " . $lines[0] . ""; - } - if ((isset($lines[1])) && ($lines[1] != $lines[0])) { - $licStatusMsg .= "
          " . $lines[1] . ""; - } -} - -if ($licenseStatusInfo["message"] != "") { - $licStatusMsg = " (" . $licenseStatusInfo["message"] . ")"; -} -/*----------------------------------********---------------------------------*/ -if ($RBAC->userCanAccess("PM_SETUP") == 1) { - /*----------------------------------********---------------------------------*/ - $G_TMP_MENU->AddIdRawOption("PMENTERPRISE", "../enterprise/addonsStore", G::LoadTranslation('ID_MENU_NAME') . $licStatusMsg, "", "", "plugins"); - /*----------------------------------********---------------------------------*/ - $G_TMP_MENU->AddIdRawOption("CASES_LIST_SETUP", "../cases/casesListSetup", G::LoadTranslation('ID_CASES_LIST'), "", "", "settings"); -} - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + */ +global $G_TMP_MENU; +global $RBAC; +$partnerFlag = (defined('PARTNER_FLAG')) ? PARTNER_FLAG : false; + +/*----------------------------------********---------------------------------*/ +$oServerConf = & serverConf::getSingleton(); +$sAudit = $oServerConf->getAuditLogProperty( 'AL_OPTION', SYS_SYS ); +$licensedFeatures = & PMLicensedFeatures::getSingleton(); +/*----------------------------------********---------------------------------*/ + +if ($RBAC->userCanAccess('PM_SETUP') == 1 ) { + //settings options + // $G_TMP_MENU->AddIdRawOption('LOGO', 'uplogo', G::LoadTranslation('ID_LOGO'), 'icon-pmlogo.png', '', 'settings'); + $G_TMP_MENU->AddIdRawOption('LOGO', '../admin/pmLogo', G::LoadTranslation('ID_LOGO'), 'icon-pmlogo.png','', 'settings'); + $G_TMP_MENU->AddIdRawOption("EMAIL_SERVER", "../emailServer/emailServer", G::LoadTranslation("ID_EMAIL_SERVER_TITLE"), "icon-email-settings1.png", "", "settings"); + $G_TMP_MENU->AddIdRawOption('CALENDAR', 'calendarList', G::LoadTranslation('ID_CALENDAR'), 'icon-calendar.png', '', 'settings' ); + //if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1) + // $G_TMP_MENU->AddIdRawOption('CASES_LIST_SETUP', '../cases/casesListSetup', G::LoadTranslation('ID_CASES_LIST_SETUP'), "",'', 'settings'); + $G_TMP_MENU->AddIdRawOption('PROCESS_CATEGORY', '../processCategory/processCategoryList', G::LoadTranslation('ID_PROCESS_CATEGORY'), "rules.png",'', 'settings'); +} + +if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1) { + $G_TMP_MENU->AddIdRawOption('LANGUAGES', 'languages', G::LoadTranslation('ID_LANGUAGES'), 'icon-language.png', '', 'settings'); +} + +if ($RBAC->userCanAccess('PM_SETUP') == 1 ) { + $G_TMP_MENU->AddIdRawOption('SKINS', 'skinsList', G::LoadTranslation('ID_SKINS'), 'icon-skins.png', '', 'settings'); + if (!$partnerFlag) { + $G_TMP_MENU->AddIdRawOption('HEARTBEAT', 'processHeartBeatConfig', G::LoadTranslation('ID_HEARTBEAT_CONFIG'), "heartBeat.jpg",'', 'settings'); + } + + $G_TMP_MENU->AddIdRawOption('ENVIRONMENT_SETTINGS', 'environmentSettings', G::LoadTranslation('ID_ENVIRONMENT_SETTINGS'), "",'', 'settings'); +} + +if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1) { + $G_TMP_MENU->AddIdRawOption('APPCACHEVIEW_SETUP', '../setup/appCacheViewConf', G::LoadTranslation('ID_APPCACHE_SETUP'), "",'', 'settings'); +} + +if ($RBAC->userCanAccess('PM_SETUP') == 1) { + $G_TMP_MENU->AddIdRawOption('CLEAR_CACHE', 'clearCompiled', G::LoadTranslation('ID_CLEAR_CACHE'), 'icon-rebuild-clean.png', "", 'settings' ); + //$G_TMP_MENU->AddIdRawOption('ADDITIONAL_TABLES', '../additionalTables/additionalTablesList', G::LoadTranslation('ID_ADDITIONAL_TABLES'), 'icon-tables.png','', 'settings'); + //$G_TMP_MENU->AddIdRawOption('REPORT_TABLES', '../reportTables/main', 'Report Tables', 'icon-tables.png','', 'settings'); + + $G_TMP_MENU->AddIdRawOption('PM_TABLES', '../pmTables', G::LoadTranslation('ID_ADDITIONAL_TABLES'), 'icon-tables.png','', 'settings'); + + if (!$partnerFlag) { + $G_TMP_MENU->AddIdRawOption('WEBSERVICES', 'webServices', G::LoadTranslation('ID_WEB_SERVICES'), 'icon-webservices.png', '', 'settings'); + } + $G_TMP_MENU->AddIdRawOption('LOGIN', 'loginSettings', G::LoadTranslation('LOGIN'), "",'', 'settings'); + $G_TMP_MENU->AddIdRawOption('DASHBOARD', '../dashboard/dashletsList', ucfirst(G::LoadTranslation('ID_DASHBOARD')), '', '', 'settings'); + /*----------------------------------********---------------------------------*/ + + if ($licensedFeatures->verifyfeature('bvZTnIraUhCSXIxNEVOcGluVVR6Y3E3NStiMW9tWU54aU5tb0FrRnJ0MXMzLzRWMHZtakJIN3dRPT0=')) { + $G_TMP_MENU->AddIdRawOption('NEW_DASHBOARD', '../strategicDashboard/dashboardList', ucfirst(G::LoadTranslation('ID_STRATEGIC_DASHBOARD')), '', '', 'settings'); + } + + /*----------------------------------********---------------------------------*/ + +} +//tools options +if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1 ) { + if (!$partnerFlag) { + $G_TMP_MENU->AddIdRawOption('PLUGINS', 'pluginsMain', G::LoadTranslation('ID_PLUGINS_MANAGER'), 'icon-plugins.png', '', 'plugins'); + } +} + +//users options +if ($RBAC->userCanAccess('PM_USERS') == 1) { + $G_TMP_MENU->AddIdRawOption('USERS', '../users/users_List', G::LoadTranslation('ID_USERS_LIST'), 'icon-webservices.png', '', 'users'); + + $G_TMP_MENU->AddIdRawOption('GROUPS', '../groups/groups', G::LoadTranslation('ID_GROUPS'), '', '', 'users'); + $G_TMP_MENU->AddIdRawOption('DEPARTAMENTS', '../departments/departments', G::LoadTranslation('ID_DEPARTMENTS_USERS'), '', '', 'users'); + $G_TMP_MENU->AddIdRawOption('ROLES', '../roles/roles_List', G::LoadTranslation('ID_ROLES'), '', '', 'users'); +} + +if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1 && $RBAC->userCanAccess('PM_USERS') == 1) { + $G_TMP_MENU->AddIdRawOption('AUTHSOURCES', '../authSources/authSources_List', G::LoadTranslation('ID_AUTH_SOURCES'), '', '', 'users'); + $G_TMP_MENU->AddIdRawOption('UX', '../admin/uxList', G::LoadTranslation('ID_USER_EXPERIENCE'), '', '', 'users'); + $G_TMP_MENU->AddIdRawOption('SYSTEM', '../admin/system', G::LoadTranslation('ID_SYSTEM'), '', '', 'settings'); + $G_TMP_MENU->AddIdRawOption('INFORMATION', '../setup/systemInfo?option=processInfo', G::LoadTranslation('ID_SYSTEM_INFO'), '', '', 'settings'); +} + +if ($RBAC->userCanAccess('PM_SETUP') == 1) { + $G_TMP_MENU->AddIdRawOption('EVENT', '../events/eventList', G::LoadTranslation('ID_EVENTS'), '', '', 'logs'); + $G_TMP_MENU->AddIdRawOption('LOG_CASE_SCHEDULER', '../cases/cases_Scheduler_Log', G::LoadTranslation('ID_CASE_SCHEDULER'), "icon-logs-list.png",'', 'logs'); + $G_TMP_MENU->AddIdRawOption("CRON", "../setup/cron", G::LoadTranslation("ID_CRON_ACTIONS"), null, null, "logs"); + $G_TMP_MENU->AddIdRawOption('EMAILS', '../mails/emailList', ucfirst (strtolower ( G::LoadTranslation('ID_EMAILS'))), '', '', 'logs'); + /*----------------------------------********---------------------------------*/ + if (isset($sAudit) && $sAudit != false && $licensedFeatures->verifyfeature('vtSeHNhT0JnSmo1bTluUVlTYUxUbUFSVStEeXVqc1pEUG5EeXc0MGd2Q3ErYz0=')) { + $G_TMP_MENU->AddIdRawOption('AUDIT_LOG', '../setup/auditLog', ucfirst (G::LoadTranslation('ID_AUDITLOG_DISPLAY')), '', '', 'logs'); + } + /*----------------------------------********---------------------------------*/ +} + +if ($RBAC->userCanAccess("PM_SETUP") == 1) { + $G_TMP_MENU->AddIdRawOption("PM_REQUIREMENTS", "../setup/systemInfo", G::LoadTranslation("ID_PROCESSMAKER_REQUIREMENTS_CHECK"), "", "", "settings"); + $G_TMP_MENU->AddIdRawOption("PHP_INFO", "../setup/systemInfo?option=php", G::LoadTranslation("ID_PHP_INFO"), "", "", "settings"); + //$G_TMP_MENU->AddIdRawOption("PHP_MAINTENANCE", "../admin/maintenance", 'Maintenance', "", "", "settings"); + /*----------------------------------********---------------------------------*/ + if ($licensedFeatures->verifyfeature('vtSeHNhT0JnSmo1bTluUVlTYUxUbUFSVStEeXVqc1pEUG5EeXc0MGd2Q3ErYz0=')) { + $G_TMP_MENU->AddIdRawOption("AUDIT_LOG", "auditLogConfig", G::LoadTranslation("ID_AUDITLOG_DISPLAY"), "", "", "settings"); + } + /*----------------------------------********---------------------------------*/ +} +/*----------------------------------********---------------------------------*/ +require_once 'classes/class.pmLicenseManager.php'; +if (!file_exists(PATH_DATA_SITE . "plugin.singleton")) { + require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php'; + $enterprise = new enterprisePlugin('enterprise'); + $enterprise->enable(); + $enterprise->setup(); +} +$pmLicenseManagerO = &pmLicenseManager::getSingleton(); +$licenseStatusInfo = $pmLicenseManagerO->getCurrentLicenseStatus(); +$licStatusMsg = null; + +if ((isset($pmLicenseManagerO->plan)) && ($pmLicenseManagerO->plan != "")) { + $lines = explode(" - ", $pmLicenseManagerO->plan); + if (isset($lines[0])) { + $licStatusMsg .= "
          " . $lines[0] . ""; + } + if ((isset($lines[1])) && ($lines[1] != $lines[0])) { + $licStatusMsg .= "
          " . $lines[1] . ""; + } +} + +if ($licenseStatusInfo["message"] != "") { + $licStatusMsg = " (" . $licenseStatusInfo["message"] . ")"; +} +/*----------------------------------********---------------------------------*/ +if ($RBAC->userCanAccess("PM_SETUP") == 1) { + /*----------------------------------********---------------------------------*/ + $G_TMP_MENU->AddIdRawOption("PMENTERPRISE", "../enterprise/addonsStore", G::LoadTranslation('ID_MENU_NAME') . $licStatusMsg, "", "", "plugins"); + /*----------------------------------********---------------------------------*/ + $G_TMP_MENU->AddIdRawOption("CASES_LIST_SETUP", "../cases/casesListSetup", G::LoadTranslation('ID_CASES_LIST'), "", "", "settings"); +} \ No newline at end of file diff --git a/workflow/engine/src/ProcessMaker/Services/api.ini b/workflow/engine/src/ProcessMaker/Services/api.ini index ac846471a..f44a1dba1 100644 --- a/workflow/engine/src/ProcessMaker/Services/api.ini +++ b/workflow/engine/src/ProcessMaker/Services/api.ini @@ -103,3 +103,9 @@ debug = 1 [alias: consolidated] list = "ProcessMaker\Services\Api\Consolidated" + +[alias: dashboard] + dashboard = "ProcessMaker\Services\Api\Dashboard" + +[alias: catalog] + dashboard = "ProcessMaker\Services\Api\Catalog"