PM-2320 "Add DEL_RISK_DATE field in tables Delegation..." SOLVED
Issue:
Add DEL_RISK_DATE field in tables Delegation, App_cache_view, List_Inbox
Cause:
New feature
Solution:
Added DEL_RISK_DATE field in tables and implemented funcionality for new field in core
This commit is contained in:
@@ -132,10 +132,12 @@ class AppDelegation extends BaseAppDelegation
|
||||
$this->setDelDelegateDate( 'now' );
|
||||
|
||||
//The function return an array now. By JHL
|
||||
$delTaskDueDate = $this->calculateDueDate( $sNextTasParam );
|
||||
$delTaskDueDate = $this->calculateDueDate($sNextTasParam);
|
||||
$delRiskDate = $this->calculateRiskDate($delTaskDueDate, $this->getRisk());
|
||||
|
||||
//$this->setDelTaskDueDate( $delTaskDueDate['DUE_DATE'] ); // Due date formatted
|
||||
$this->setDelTaskDueDate( $delTaskDueDate );
|
||||
$this->setDelTaskDueDate($delTaskDueDate);
|
||||
$this->setDelRiskDate($delRiskDate);
|
||||
|
||||
if ((defined( "DEBUG_CALENDAR_LOG" )) && (DEBUG_CALENDAR_LOG)) {
|
||||
//$this->setDelData( $delTaskDueDate['DUE_DATE_LOG'] ); // Log of actions made by Calendar Engine
|
||||
@@ -164,7 +166,7 @@ class AppDelegation extends BaseAppDelegation
|
||||
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
||||
}
|
||||
throw (new Exception( 'Failed Data validation. ' . $msg ));
|
||||
}
|
||||
}
|
||||
|
||||
$delIndex = $this->getDelIndex();
|
||||
|
||||
@@ -179,8 +181,8 @@ class AppDelegation extends BaseAppDelegation
|
||||
$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
|
||||
// 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()
|
||||
@@ -357,16 +359,35 @@ class AppDelegation extends BaseAppDelegation
|
||||
//use the dates class to calculate dates
|
||||
$calendar = new calendar();
|
||||
|
||||
if ($calendar->pmCalendarUid == '') {
|
||||
$calendar->getCalendar(null, $task->getProUid(), $aData['TAS_UID']);
|
||||
$calData = $calendar->getCalendarData();
|
||||
$arrayCalendarData = array();
|
||||
|
||||
if ($calendar->pmCalendarUid == "") {
|
||||
$calendar->getCalendar(null, $task->getProUid(), $this->getTasUid());
|
||||
|
||||
$arrayCalendarData = $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);
|
||||
$dueDate = $calendar->dashCalculateDate($this->getDelDelegateDate(), $aData["TAS_DURATION"], $aData["TAS_TIMEUNIT"], $arrayCalendarData);
|
||||
|
||||
return $iDueDate;
|
||||
//Return
|
||||
return $dueDate;
|
||||
}
|
||||
|
||||
public function calculateRiskDate($dueDate, $risk)
|
||||
{
|
||||
try {
|
||||
$numDueDate = strtotime($dueDate); //Seconds
|
||||
$numDueDate = $numDueDate - ($numDueDate * $risk);
|
||||
|
||||
$riskDate = date("Y-m-d H:i:s", round($numDueDate));
|
||||
|
||||
//Return
|
||||
return $riskDate;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function getDiffDate ($date1, $date2)
|
||||
@@ -455,7 +476,7 @@ class AppDelegation extends BaseAppDelegation
|
||||
$i = 0;
|
||||
//print "<table colspacing='2' border='1'>";
|
||||
//print "<tr><td>iDelegateDate </td><td>iInitDate </td><td>iDueDate </td><td>iFinishDate </td><td>isStarted </td><td>isFinished </td><td>isDelayed </td><td>queueDuration </td><td>delDuration </td><td>delayDuration</td></tr>";
|
||||
|
||||
|
||||
$calendar = new calendar();
|
||||
|
||||
$now = strtotime( 'now' );
|
||||
@@ -576,8 +597,8 @@ class AppDelegation extends BaseAppDelegation
|
||||
error_log( $oError->getMessage() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function getLastDeleration ($APP_UID)
|
||||
{
|
||||
$c = new Criteria( 'workflow' );
|
||||
@@ -628,7 +649,7 @@ class AppDelegation extends BaseAppDelegation
|
||||
$data = $oRuleSet->getRow();
|
||||
return $data['TAS_UID'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Verify if the current case is already routed.
|
||||
*
|
||||
@@ -653,5 +674,16 @@ class AppDelegation extends BaseAppDelegation
|
||||
}
|
||||
}
|
||||
|
||||
public function getRisk()
|
||||
{
|
||||
try {
|
||||
$risk = 0.2;
|
||||
|
||||
//Return
|
||||
return $risk;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user