FIX Pb in management of date end of projects

This commit is contained in:
Laurent Destailleur 2016-11-09 17:46:30 +01:00
parent ff4eddb8dc
commit 71a573df61
2 changed files with 12 additions and 3 deletions

View File

@ -785,6 +785,7 @@ else
// Date end
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
print dol_print_date($object->date_end,'day');
if ($object->hasDelay()) print img_warning($langs->trans('Late'));
print '</td></tr>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))

View File

@ -237,7 +237,15 @@ class Project extends CommonObject
$this->description = trim($this->description);
if ($this->opp_amount < 0) $this->opp_amount='';
if ($this->opp_percent < 0) $this->opp_percent='';
if ($this->date_end && $this->date_end < $this->date_start)
{
$this->error = $langs->trans("ErrorDateEndLowerThanDateStart");
$this->errors[] = $this->error;
$this->db->rollback();
dol_syslog(get_class($this)."::update error -3 " . $this->error, LOG_ERR);
return -3;
}
if (dol_strlen(trim($this->ref)) > 0)
{
$this->db->begin();
@ -1721,11 +1729,11 @@ class Project extends CommonObject
global $conf;
if (! ($this->statut == 1)) return false;
if (! $this->datee) return false;
if (! $this->datee && ! $this->date_end) return false;
$now = dol_now();
return $this->datee < ($now - $conf->projet->warning_delay);
return ($this->datee ? $this->datee : $this->date_end) < ($now - $conf->projet->warning_delay);
}