diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 633633aad7f..adc55131a10 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -785,6 +785,7 @@ else // Date end print ''.$langs->trans("DateEnd").''; print dol_print_date($object->date_end,'day'); + if ($object->hasDelay()) print img_warning($langs->trans('Late')); print ''; if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 38135a898e0..1de78f46021 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -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); }