diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 72852e1694b..8518709eddd 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1530,6 +1530,12 @@ class Reception extends CommonObject $error = 0; + // Protection + if ($this->statut == Reception::STATUS_CLOSED) { + dol_syslog(get_class($this)."::Already in closed status", LOG_WARNING); + return 0; + } + $this->db->begin(); $sql = 'UPDATE '.MAIN_DB_PREFIX.'reception SET fk_statut='.self::STATUS_CLOSED; @@ -1664,7 +1670,10 @@ class Reception extends CommonObject $this->db->begin(); - $this->setClosed(); + if ($this->statut == Reception::STATUS_VALIDATED) { + // do not close if already closed + $this->setClosed(); + } $sql = 'UPDATE '.MAIN_DB_PREFIX.'reception SET billed=1'; $sql .= " WHERE rowid = ".((int) $this->id).' AND fk_statut > 0';