Created ActionComm:hasDelay function

This commit is contained in:
Marcos García de La Fuente 2015-09-06 18:26:48 +02:00
parent 865489db75
commit f1ea19e09b

View File

@ -883,6 +883,7 @@ class ActionComm extends CommonObject
if ($resql)
{
$now = dol_now();
$agenda_static = new ActionComm($this->db);
$response = new WorkboardResponse();
$response->warning_delay = $conf->actions->warning_delay/60/60/24;
@ -895,7 +896,9 @@ class ActionComm extends CommonObject
{
$response->nbtodo++;
if (isset($obj->dp) && $this->db->jdate($obj->dp) < ($now - $conf->actions->warning_delay)) {
$agenda_static->datep = $this->db->jdate($obj->dp);
if ($agenda_static->hasDelay()) {
$response->nbtodolate++;
}
}
@ -1360,5 +1363,19 @@ class ActionComm extends CommonObject
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
}
/**
* Is the action delayed?
*
* @return bool
*/
public function hasDelay()
{
global $conf;
$now = dol_now();
return $this->datep && ($this->datep < ($now - $conf->actions->warning_delay));
}
}