HOR-4527
This commit is contained in:
committed by
Julio Cesar Laura Avendaño
parent
abe71a6ffe
commit
0d533e19d9
@@ -100,26 +100,26 @@ class AppDelegation extends BaseAppDelegation
|
||||
* @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, $flagControl = false, $flagControlMulInstance = false, $delPrevious = 0, $appNumber = 0, $taskId = 0, $userId = 0, $proId = 0)
|
||||
public function createAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sAppThread, $iPriority = 3, $isSubprocess = false, $sPrevious = -1, $sNextTasParam = null, $flagControl = false, $flagControlMulInstance = false, $delPrevious = 0, $appNumber = 0, $taskId = 0, $userId = 0, $proId = 0)
|
||||
{
|
||||
if (! isset( $sProUid ) || strlen( $sProUid ) == 0) {
|
||||
throw (new Exception( 'Column "PRO_UID" cannot be 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($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($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($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.' ));
|
||||
if (! isset($sAppThread) || strlen($sAppThread) == 0) {
|
||||
throw (new Exception('Column "APP_THREAD" cannot be null.'));
|
||||
}
|
||||
|
||||
$this->delegation_id = null;
|
||||
@@ -161,17 +161,17 @@ class AppDelegation extends BaseAppDelegation
|
||||
}
|
||||
}
|
||||
//Verify successors: parrallel submit in the same time
|
||||
if($flagControl){
|
||||
if ($flagControl) {
|
||||
$nextTaskUid = $sTasUid;
|
||||
$index = $this->getAllTasksBeforeSecJoin($nextTaskUid, $sAppUid, $delPreviousFather);
|
||||
if($this->createThread($index, $sAppUid)){
|
||||
if ($this->createThread($index, $sAppUid)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if($flagControlMulInstance){
|
||||
if ($flagControlMulInstance) {
|
||||
$nextTaskUid = $sTasUid;
|
||||
$index = $this->getAllTheardMultipleInstance($delPreviousFather, $sAppUid);
|
||||
if($this->createThread($index, $sAppUid, $sUsrUid)){
|
||||
if ($this->createThread($index, $sAppUid, $sUsrUid)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -181,18 +181,18 @@ class AppDelegation extends BaseAppDelegation
|
||||
$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->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' );
|
||||
$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');
|
||||
$this->setAppNumber($appNumber);
|
||||
$this->setTasId($taskId);
|
||||
$this->setUsrId($userId);
|
||||
@@ -206,17 +206,17 @@ class AppDelegation extends BaseAppDelegation
|
||||
$this->setDelTaskDueDate($delTaskDueDate);
|
||||
$this->setDelRiskDate($delRiskDate);
|
||||
|
||||
if ((defined( "DEBUG_CALENDAR_LOG" )) && (DEBUG_CALENDAR_LOG)) {
|
||||
if ((defined("DEBUG_CALENDAR_LOG")) && (DEBUG_CALENDAR_LOG)) {
|
||||
//$this->setDelData( $delTaskDueDate['DUE_DATE_LOG'] ); // Log of actions made by Calendar Engine
|
||||
$this->setDelData( $delTaskDueDate );
|
||||
$this->setDelData($delTaskDueDate);
|
||||
} else {
|
||||
$this->setDelData( '' );
|
||||
$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' );
|
||||
$this->setDelInitDate('now');
|
||||
}
|
||||
|
||||
if ($this->validate()) {
|
||||
@@ -233,13 +233,13 @@ class AppDelegation extends BaseAppDelegation
|
||||
foreach ($validationFailuresArray as $objValidationFailure) {
|
||||
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
||||
}
|
||||
throw (new Exception( 'Failed Data validation. ' . $msg ));
|
||||
throw (new Exception('Failed Data validation. ' . $msg));
|
||||
}
|
||||
|
||||
$delIndex = $this->getDelIndex();
|
||||
|
||||
// Hook for the trigger PM_CREATE_NEW_DELEGATION
|
||||
if (defined( 'PM_CREATE_NEW_DELEGATION' )) {
|
||||
if (defined('PM_CREATE_NEW_DELEGATION')) {
|
||||
$bpmn = new \ProcessMaker\Project\Bpmn();
|
||||
$flagActionsByEmail = true;
|
||||
|
||||
@@ -268,7 +268,7 @@ class AppDelegation extends BaseAppDelegation
|
||||
if ($resultAbe->next()) {
|
||||
$dataAbe = $resultAbe->getRow();
|
||||
$flagActionsByEmail = false;
|
||||
if($dataAbe['ABE_TYPE']!='' && $data->USR_UID!=''){
|
||||
if ($dataAbe['ABE_TYPE']!='' && $data->USR_UID!='') {
|
||||
$actionsByEmail = new ActionsByEmailCoreClass();
|
||||
$actionsByEmail->sendActionsByEmail($data, $dataAbe);
|
||||
}
|
||||
@@ -278,10 +278,10 @@ class AppDelegation extends BaseAppDelegation
|
||||
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$licensedFeatures = &PMLicensedFeatures::getSingleton ();
|
||||
if ($licensedFeatures->verifyfeature ( '7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09' )) {
|
||||
try{
|
||||
$pmGoogle = new PmGoogleApi ();
|
||||
$licensedFeatures = PMLicensedFeatures::getSingleton();
|
||||
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
|
||||
try {
|
||||
$pmGoogle = new PmGoogleApi();
|
||||
if ($pmGoogle->getServiceGmailStatus()) {
|
||||
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
|
||||
$Pmgmail->gmailsForRouting($sUsrUid, $sTasUid, $sAppUid, $delIndex, $isSubprocess);
|
||||
@@ -338,30 +338,30 @@ class AppDelegation extends BaseAppDelegation
|
||||
* @return array $Fields the fields
|
||||
*/
|
||||
|
||||
public function LoadParallel ($AppUid, $index = "")
|
||||
public function LoadParallel($AppUid, $index = "")
|
||||
{
|
||||
$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->addSelectColumn( AppDelegationPeer::DEL_PREVIOUS );
|
||||
$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->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS);
|
||||
|
||||
$c->add( AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN' );
|
||||
$c->add( AppDelegationPeer::APP_UID, $AppUid );
|
||||
if(!empty($index)) {
|
||||
$c->add( AppDelegationPeer::DEL_INDEX, $index );
|
||||
$c->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
|
||||
$c->add(AppDelegationPeer::APP_UID, $AppUid);
|
||||
if (!empty($index)) {
|
||||
$c->add(AppDelegationPeer::DEL_INDEX, $index);
|
||||
}
|
||||
$c->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX );
|
||||
$rs = AppDelegationPeer::doSelectRS( $c );
|
||||
$row= $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$c->addDescendingOrderByColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$rs = AppDelegationPeer::doSelectRS($c);
|
||||
$row= $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
@@ -393,14 +393,14 @@ class AppDelegation extends BaseAppDelegation
|
||||
*
|
||||
*/
|
||||
|
||||
public function update ($aData)
|
||||
public function update($aData)
|
||||
{
|
||||
$con = Propel::getConnection( AppDelegationPeer::DATABASE_NAME );
|
||||
$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 );
|
||||
$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();
|
||||
@@ -411,24 +411,24 @@ class AppDelegation extends BaseAppDelegation
|
||||
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
||||
}
|
||||
|
||||
throw (new PropelException( 'The row cannot be created!', new PropelException( $msg ) ));
|
||||
throw (new PropelException('The row cannot be created!', new PropelException($msg)));
|
||||
}
|
||||
} else {
|
||||
$con->rollback();
|
||||
throw (new Exception( "This AppDelegation row doesn't exist!" ));
|
||||
throw (new Exception("This AppDelegation row doesn't exist!"));
|
||||
}
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
public function remove ($sApplicationUID, $iDelegationIndex)
|
||||
public function remove($sApplicationUID, $iDelegationIndex)
|
||||
{
|
||||
$oConnection = Propel::getConnection( StepTriggerPeer::DATABASE_NAME );
|
||||
$oConnection = Propel::getConnection(StepTriggerPeer::DATABASE_NAME);
|
||||
try {
|
||||
$oConnection->begin();
|
||||
$oApp = AppDelegationPeer::retrieveByPK( $sApplicationUID, $iDelegationIndex );
|
||||
if (is_object( $oApp ) && get_class( $oApp ) == 'AppDelegation') {
|
||||
$oApp = AppDelegationPeer::retrieveByPK($sApplicationUID, $iDelegationIndex);
|
||||
if (is_object($oApp) && get_class($oApp) == 'AppDelegation') {
|
||||
$result = $oApp->delete();
|
||||
}
|
||||
$oConnection->commit();
|
||||
@@ -441,20 +441,20 @@ class AppDelegation extends BaseAppDelegation
|
||||
|
||||
// TasTypeDay = 1 => working days
|
||||
// TasTypeDay = 2 => calendar days
|
||||
public function calculateDueDate ($sNextTasParam)
|
||||
public function calculateDueDate($sNextTasParam)
|
||||
{
|
||||
//Get Task properties
|
||||
$task = TaskPeer::retrieveByPK( $this->getTasUid() );
|
||||
$task = TaskPeer::retrieveByPK($this->getTasUid());
|
||||
|
||||
$aData = array();
|
||||
$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') {
|
||||
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'] != '') {
|
||||
if (isset($sNextTasParam['NEXT_TASK']['TAS_CALENDAR']) && $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'] != '') {
|
||||
$aCalendarUID = $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'];
|
||||
} else {
|
||||
$aCalendarUID = '';
|
||||
@@ -462,9 +462,9 @@ class AppDelegation extends BaseAppDelegation
|
||||
|
||||
//Updating the task Table , so that user will see updated values in the assign screen in consequent cases
|
||||
$oTask = new Task();
|
||||
$oTask->update( $aData );
|
||||
$oTask->update($aData);
|
||||
} else {
|
||||
if (is_null( $task )) {
|
||||
if (is_null($task)) {
|
||||
return 0;
|
||||
}
|
||||
$aData['TAS_DURATION'] = $task->getTasDuration();
|
||||
@@ -496,13 +496,12 @@ class AppDelegation extends BaseAppDelegation
|
||||
public function calculateRiskDate($dueDate, $risk)
|
||||
{
|
||||
try {
|
||||
|
||||
$data = array();
|
||||
if (isset( $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] ) && $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] == 'true') {
|
||||
if (isset($sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY']) && $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] == 'true') {
|
||||
$data['TAS_DURATION'] = $sNextTasParam['NEXT_TASK']['TAS_DURATION'];
|
||||
$data['TAS_TIMEUNIT'] = $sNextTasParam['NEXT_TASK']['TAS_TIMEUNIT'];
|
||||
} else {
|
||||
$task = TaskPeer::retrieveByPK( $this->getTasUid() );
|
||||
$task = TaskPeer::retrieveByPK($this->getTasUid());
|
||||
$data['TAS_DURATION'] = $task->getTasDuration();
|
||||
$data['TAS_TIMEUNIT'] = $task->getTasTimeUnit();
|
||||
}
|
||||
@@ -529,47 +528,47 @@ class AppDelegation extends BaseAppDelegation
|
||||
}
|
||||
}
|
||||
|
||||
public function getDiffDate ($date1, $date2)
|
||||
public function getDiffDate($date1, $date2)
|
||||
{
|
||||
return ($date1 - $date2) / (24 * 60 * 60); //days
|
||||
return ($date1 - $date2) / 3600;
|
||||
}
|
||||
|
||||
//usually this function is called when routing in the flow, so by default cron =0
|
||||
public function calculateDuration($cron = 0)
|
||||
{
|
||||
$this->writeFileIfCalledFromCronForCalculateDuration($cron);
|
||||
$this->patchDataWithValuesForCalculateDuration();
|
||||
$rs = $this->recordSetForCalculateDuration();
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
$i = 0;
|
||||
$calendar = new Calendar();
|
||||
$now = new DateTime();
|
||||
while (is_array ($row)) {
|
||||
$oAppDel = AppDelegationPeer::retrieveByPk( $row['APP_UID'], $row['DEL_INDEX'] );
|
||||
//usually this function is called when routing in the flow, so by default cron =0
|
||||
public function calculateDuration($cron = 0)
|
||||
{
|
||||
$this->writeFileIfCalledFromCronForCalculateDuration($cron);
|
||||
$this->patchDataWithValuesForCalculateDuration();
|
||||
$rs = $this->recordSetForCalculateDuration();
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
$i = 0;
|
||||
$calendar = new Calendar();
|
||||
$now = new DateTime();
|
||||
while (is_array($row)) {
|
||||
$oAppDel = AppDelegationPeer::retrieveByPk($row['APP_UID'], $row['DEL_INDEX']);
|
||||
$calendar = new Calendar();
|
||||
$calendar->getCalendar($row['USR_UID'], $row['PRO_UID'], $row['TAS_UID']);
|
||||
$calData = $calendar->getCalendarData();
|
||||
$calculatedValues = $this->getValuesToStoreForCalculateDuration($row, $calendar, $calData, $now);
|
||||
|
||||
$oAppDel->setDelStarted($calculatedValues['isStarted']);
|
||||
$oAppDel->setDelFinished($calculatedValues['isFinished']);
|
||||
$oAppDel->setDelDelayed($calculatedValues['isDelayed']);
|
||||
$oAppDel->setDelQueueDuration($calculatedValues['queueTime']);
|
||||
$oAppDel->setDelDelayDuration($calculatedValues['delayTime']);
|
||||
$oAppDel->setDelDuration($calculatedValues['durationTime']);
|
||||
$oAppDel->setAppOverduePercentage($calculatedValues['percentDelay']);
|
||||
$RES = $oAppDel->save();
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
}
|
||||
}
|
||||
$oAppDel->setDelStarted($calculatedValues['isStarted']);
|
||||
$oAppDel->setDelFinished($calculatedValues['isFinished']);
|
||||
$oAppDel->setDelDelayed($calculatedValues['isDelayed']);
|
||||
$oAppDel->setDelQueueDuration($calculatedValues['queueTime']);
|
||||
$oAppDel->setDelDelayDuration($calculatedValues['delayTime']);
|
||||
$oAppDel->setDelDuration($calculatedValues['durationTime']);
|
||||
$oAppDel->setAppOverduePercentage($calculatedValues['percentDelay']);
|
||||
$RES = $oAppDel->save();
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
}
|
||||
}
|
||||
|
||||
public function getValuesToStoreForCalculateDuration($row, $calendar, $calData, $nowDate)
|
||||
{
|
||||
public function getValuesToStoreForCalculateDuration($row, $calendar, $calData, $nowDate)
|
||||
{
|
||||
$rowValues = $this->completeRowDataForCalculateDuration($row, $nowDate);
|
||||
return Array(
|
||||
return array(
|
||||
'isStarted' => $this->createDateFromString($row['DEL_INIT_DATE']) != null ? 1 : 0,
|
||||
'isFinished' => $this->createDateFromString($row['DEL_FINISH_DATE']) != null ? 1: 0,
|
||||
'isDelayed' => $this->calculateDelayTime($calendar, $calData, $rowValues) > 0 ? 1 : 0,
|
||||
@@ -577,11 +576,11 @@ class AppDelegation extends BaseAppDelegation
|
||||
'delayTime' => $this->calculateDelayTime($calendar, $calData, $rowValues),
|
||||
'durationTime' => $this->calculateNetProcessingTime($calendar, $calData, $rowValues),
|
||||
'percentDelay' => $this->calculateOverduePercentage($calendar, $calData, $rowValues)
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private function calculateOverduePercentage($calendar, $calData, $rowValues)
|
||||
{
|
||||
private function calculateOverduePercentage($calendar, $calData, $rowValues)
|
||||
{
|
||||
if ($rowValues['fTaskDuration'] == 0) {
|
||||
return 0;
|
||||
}
|
||||
@@ -591,203 +590,210 @@ class AppDelegation extends BaseAppDelegation
|
||||
: $rowValues['fTaskDuration'] / 24;
|
||||
|
||||
return $this->calculateDelayTime($calendar, $calData, $rowValues) * 100/ $taskTime;
|
||||
}
|
||||
}
|
||||
|
||||
//time in days from init or delegate date to finish or today's date
|
||||
private function calculateNetProcessingTime($calendar, $calData, $rowValues)
|
||||
{
|
||||
$initDateForCalc = $this->selectDate ($rowValues['dInitDate'], $rowValues['dDelegateDate'], 'max');
|
||||
$endDateForCalc = $this->selectDate ($rowValues['dFinishDate'], $rowValues['dNow'], 'min');
|
||||
return $calendar->dashCalculateDurationWithCalendar(
|
||||
$initDateForCalc->format('Y-m-d H:i:s'),
|
||||
$endDateForCalc->format('Y-m-d H:i:s'),
|
||||
$calData)/(24*60*60);
|
||||
}
|
||||
//time in days from init or delegate date to finish or today's date
|
||||
private function calculateNetProcessingTime($calendar, $calData, $rowValues)
|
||||
{
|
||||
$initDateForCalc = $this->selectDate($rowValues['dInitDate'], $rowValues['dDelegateDate'], 'max');
|
||||
$endDateForCalc = $this->selectDate($rowValues['dFinishDate'], $rowValues['dNow'], 'min');
|
||||
return $calendar->dashCalculateDurationWithCalendar(
|
||||
$initDateForCalc->format('Y-m-d H:i:s'),
|
||||
$endDateForCalc->format('Y-m-d H:i:s'),
|
||||
$calData
|
||||
)/(24*60*60);
|
||||
}
|
||||
|
||||
//time in days from delegate date to init date
|
||||
private function calculateQueueTime($calendar, $calData, $rowValues)
|
||||
{
|
||||
$initDateForCalc = $rowValues['dDelegateDate'];
|
||||
$endDateForCalc = $this->selectDate ($rowValues['dInitDate'], $rowValues['dNow'], 'min');
|
||||
return $calendar->dashCalculateDurationWithCalendar(
|
||||
$initDateForCalc->format('Y-m-d H:i:s'),
|
||||
$endDateForCalc->format('Y-m-d H:i:s'),
|
||||
$calData)/(24*60*60);
|
||||
}
|
||||
//time in days from delegate date to init date
|
||||
private function calculateQueueTime($calendar, $calData, $rowValues)
|
||||
{
|
||||
$initDateForCalc = $rowValues['dDelegateDate'];
|
||||
$endDateForCalc = $this->selectDate($rowValues['dInitDate'], $rowValues['dNow'], 'min');
|
||||
return $calendar->dashCalculateDurationWithCalendar(
|
||||
$initDateForCalc->format('Y-m-d H:i:s'),
|
||||
$endDateForCalc->format('Y-m-d H:i:s'),
|
||||
$calData
|
||||
)/(24*60*60);
|
||||
}
|
||||
|
||||
//time in days from due date to finish or today date
|
||||
private function calculateDelayTime($calendar, $calData, $rowValues)
|
||||
{
|
||||
$initDateForCalc = $this->selectDate($rowValues['dDueDate'], $rowValues['dDelegateDate'], 'max');
|
||||
$endDateForCalc = $this->selectDate ($rowValues['dFinishDate'], $rowValues['dNow'], 'min');
|
||||
return $calendar->dashCalculateDurationWithCalendar(
|
||||
$initDateForCalc->format('Y-m-d H:i:s'),
|
||||
$endDateForCalc->format('Y-m-d H:i:s'),
|
||||
$calData)/(24*60*60);
|
||||
}
|
||||
//time in days from due date to finish or today date
|
||||
private function calculateDelayTime($calendar, $calData, $rowValues)
|
||||
{
|
||||
$initDateForCalc = $this->selectDate($rowValues['dDueDate'], $rowValues['dDelegateDate'], 'max');
|
||||
$endDateForCalc = $this->selectDate($rowValues['dFinishDate'], $rowValues['dNow'], 'min');
|
||||
return $calendar->dashCalculateDurationWithCalendar(
|
||||
$initDateForCalc->format('Y-m-d H:i:s'),
|
||||
$endDateForCalc->format('Y-m-d H:i:s'),
|
||||
$calData
|
||||
)/(24*60*60);
|
||||
}
|
||||
|
||||
//to avoid aplying many times the same conversions and functions the row data
|
||||
//is used to create dates as DateTime objects and other fields are stracted also,
|
||||
//so the array returned will work as a "context" object for the rest of the functions.
|
||||
private function completeRowDataForCalculateDuration($row, $nowDate)
|
||||
{
|
||||
return Array(
|
||||
'dDelegateDate' => $this->createDateFromString ($row['DEL_DELEGATE_DATE']),
|
||||
'dInitDate' => $this->createDateFromString ($row['DEL_INIT_DATE']),
|
||||
'dDueDate' => $this->createDateFromString ($row['DEL_TASK_DUE_DATE']),
|
||||
'dFinishDate' => $this->createDateFromString ($row['DEL_FINISH_DATE']),
|
||||
'fTaskDuration' => $row['TAS_DURATION'] * 1.0,
|
||||
'cTaskDurationUnit' => $row['TAS_TIMEUNIT'],
|
||||
'dNow' => $nowDate,
|
||||
'row' => $row
|
||||
);
|
||||
}
|
||||
private function completeRowDataForCalculateDuration($row, $nowDate)
|
||||
{
|
||||
return array(
|
||||
'dDelegateDate' => $this->createDateFromString($row['DEL_DELEGATE_DATE']),
|
||||
'dInitDate' => $this->createDateFromString($row['DEL_INIT_DATE']),
|
||||
'dDueDate' => $this->createDateFromString($row['DEL_TASK_DUE_DATE']),
|
||||
'dFinishDate' => $this->createDateFromString($row['DEL_FINISH_DATE']),
|
||||
'fTaskDuration' => $row['TAS_DURATION'] * 1.0,
|
||||
'cTaskDurationUnit' => $row['TAS_TIMEUNIT'],
|
||||
'dNow' => $nowDate,
|
||||
'row' => $row
|
||||
);
|
||||
}
|
||||
|
||||
//by default min function returns de null value if one of the params is null
|
||||
//by default min function returns de null value if one of the params is null
|
||||
//to avoid that behaviour this function was created so the function returns the first
|
||||
//not null date or if both are not null the mix/max date
|
||||
//NOTE date1 and date2 are DateTime objects.
|
||||
private function selectDate($date1, $date2, $compareFunction)
|
||||
{
|
||||
if ($date1 == null)
|
||||
return $date2;
|
||||
private function selectDate($date1, $date2, $compareFunction)
|
||||
{
|
||||
if ($date1 == null) {
|
||||
return $date2;
|
||||
}
|
||||
|
||||
if ($date2 == null)
|
||||
return $date1;
|
||||
if ($date2 == null) {
|
||||
return $date1;
|
||||
}
|
||||
|
||||
return $compareFunction($date1, $date2);
|
||||
}
|
||||
return $compareFunction($date1, $date2);
|
||||
}
|
||||
|
||||
//Creates a DateTime object from a string. If the string is null or empty a null object is returned
|
||||
private function createDateFromString($stringDate) {
|
||||
if ($stringDate == null || $stringDate == '')
|
||||
return null;
|
||||
return new DateTime($stringDate);
|
||||
}
|
||||
|
||||
private function recordSetForCalculateDuration()
|
||||
{
|
||||
//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 );
|
||||
$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 );
|
||||
return $rs;
|
||||
}
|
||||
private function writeFileIfCalledFromCronForCalculateDuration($cron)
|
||||
{
|
||||
if ($cron == 1) {
|
||||
$arrayCron = unserialize( trim( @file_get_contents( PATH_DATA . "cron" ) ) );
|
||||
$arrayCron["processcTimeStart"] = time();
|
||||
@file_put_contents( PATH_DATA . "cron", serialize( $arrayCron ) );
|
||||
}
|
||||
}
|
||||
|
||||
private function patchDataWithValuesForCalculateDuration()
|
||||
{
|
||||
//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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getLastDeleration ($APP_UID)
|
||||
private function createDateFromString($stringDate)
|
||||
{
|
||||
$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 );
|
||||
if ($stringDate == null || $stringDate == '') {
|
||||
return null;
|
||||
}
|
||||
return new DateTime($stringDate);
|
||||
}
|
||||
|
||||
$c->add( AppDelegationPeer::APP_UID, $APP_UID );
|
||||
$c->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX );
|
||||
$rs = AppDelegationPeer::doSelectRS( $c );
|
||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
private function recordSetForCalculateDuration()
|
||||
{
|
||||
//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);
|
||||
$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);
|
||||
return $rs;
|
||||
}
|
||||
private function writeFileIfCalledFromCronForCalculateDuration($cron)
|
||||
{
|
||||
if ($cron == 1) {
|
||||
$arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
|
||||
$arrayCron["processcTimeStart"] = time();
|
||||
@file_put_contents(PATH_DATA . "cron", serialize($arrayCron));
|
||||
}
|
||||
}
|
||||
|
||||
private function patchDataWithValuesForCalculateDuration()
|
||||
{
|
||||
//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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
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)
|
||||
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 );
|
||||
$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)
|
||||
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 );
|
||||
$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'];
|
||||
@@ -801,18 +807,16 @@ class AppDelegation extends BaseAppDelegation
|
||||
*/
|
||||
public function getCurrentUsers($appUid, $index)
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn( AppDelegationPeer::USR_UID );
|
||||
$criteria->add( AppDelegationPeer::APP_UID, $appUid );
|
||||
$criteria->add( AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN' );
|
||||
$criteria->add( AppDelegationPeer::DEL_INDEX, $index );
|
||||
$dataResult = AppDelegationPeer::doSelectRS( $criteria );
|
||||
$dataResult->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
if($dataResult->next()) {
|
||||
return $dataResult->getRow();
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
$oCriteria = new Criteria();
|
||||
$oCriteria->addSelectColumn(AppDelegationPeer::USR_UID);
|
||||
$oCriteria->add(AppDelegationPeer::APP_UID, $appUid);
|
||||
$oCriteria->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
|
||||
$oCriteria->add(AppDelegationPeer::DEL_INDEX, $index);
|
||||
$oRuleSet = AppDelegationPeer::doSelectRS($oCriteria);
|
||||
$oRuleSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oRuleSet->next();
|
||||
$data = $oRuleSet->getRow();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -822,7 +826,7 @@ class AppDelegation extends BaseAppDelegation
|
||||
* @return array $Fields the fields
|
||||
*/
|
||||
|
||||
public function alreadyRouted ($appUid, $sDelIndex)
|
||||
public function alreadyRouted($appUid, $sDelIndex)
|
||||
{
|
||||
$c = new Criteria("workflow");
|
||||
$c->clearSelectColumns();
|
||||
@@ -832,7 +836,7 @@ class AppDelegation extends BaseAppDelegation
|
||||
$c->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNOTNULL);
|
||||
$result = AppDelegationPeer::doSelectRS($c);
|
||||
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
if($result->next()) {
|
||||
if ($result->next()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -858,7 +862,8 @@ class AppDelegation extends BaseAppDelegation
|
||||
* @param string $sAppUid
|
||||
* @return array $index
|
||||
*/
|
||||
public static function getAllTasksBeforeSecJoin($nextTaskUid, $sAppUid, $sDelPrevious, $threadStatus = ''){
|
||||
public static function getAllTasksBeforeSecJoin($nextTaskUid, $sAppUid, $sDelPrevious, $threadStatus = '')
|
||||
{
|
||||
$criteriaR = new Criteria('workflow');
|
||||
$criteriaR->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$criteriaR->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS);
|
||||
@@ -874,7 +879,7 @@ class AppDelegation extends BaseAppDelegation
|
||||
$rsCriteriaR->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$index = array();
|
||||
$c = 0;
|
||||
while($rsCriteriaR->next()){
|
||||
while ($rsCriteriaR->next()) {
|
||||
$row = $rsCriteriaR->getRow();
|
||||
$index[$c++] = $row['DEL_INDEX'];
|
||||
}
|
||||
@@ -889,13 +894,14 @@ class AppDelegation extends BaseAppDelegation
|
||||
* @param string $sUsrUid
|
||||
* @return boolean $res
|
||||
*/
|
||||
public static function createThread($index, $sAppUid, $sUsrUid = ''){
|
||||
public static function createThread($index, $sAppUid, $sUsrUid = '')
|
||||
{
|
||||
$criteriaDel = new Criteria("workflow");
|
||||
$criteriaDel->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$criteriaDel->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS);
|
||||
$criteriaDel->add(AppDelegationPeer::APP_UID, $sAppUid);
|
||||
$criteriaDel->add(AppDelegationPeer::DEL_PREVIOUS, $index, Criteria::IN);
|
||||
if($sUsrUid !== ''){
|
||||
if ($sUsrUid !== '') {
|
||||
$criteriaDel->add(AppDelegationPeer::USR_UID, $sUsrUid);
|
||||
}
|
||||
$criteriaDel = AppDelegationPeer::doSelectRS($criteriaDel);
|
||||
@@ -911,7 +917,8 @@ class AppDelegation extends BaseAppDelegation
|
||||
* @param string $sAppUid
|
||||
* @return array $index
|
||||
*/
|
||||
public static function getAllTheardMultipleInstance($sPrevious, $sAppUid){
|
||||
public static function getAllTheardMultipleInstance($sPrevious, $sAppUid)
|
||||
{
|
||||
$criteriaR = new Criteria('workflow');
|
||||
$criteriaR->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$criteriaR->add(AppDelegationPeer::APP_UID, $sAppUid, Criteria::EQUAL);
|
||||
@@ -920,7 +927,7 @@ class AppDelegation extends BaseAppDelegation
|
||||
$rsCriteriaR->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$index = array();
|
||||
$c = 0;
|
||||
while($rsCriteriaR->next()){
|
||||
while ($rsCriteriaR->next()) {
|
||||
$row = $rsCriteriaR->getRow();
|
||||
$index[$c++] = $row['DEL_INDEX'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user