Created ActionComm:hasDelay function
This commit is contained in:
parent
865489db75
commit
f1ea19e09b
@ -883,6 +883,7 @@ class ActionComm extends CommonObject
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
$agenda_static = new ActionComm($this->db);
|
||||||
|
|
||||||
$response = new WorkboardResponse();
|
$response = new WorkboardResponse();
|
||||||
$response->warning_delay = $conf->actions->warning_delay/60/60/24;
|
$response->warning_delay = $conf->actions->warning_delay/60/60/24;
|
||||||
@ -895,7 +896,9 @@ class ActionComm extends CommonObject
|
|||||||
{
|
{
|
||||||
$response->nbtodo++;
|
$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++;
|
$response->nbtodolate++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1360,5 +1363,19 @@ class ActionComm extends CommonObject
|
|||||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user