Merge pull request #26062 from fappels/18_fix_mass_bill_reception

Fix do not close reception if already closed.
This commit is contained in:
Laurent Destailleur 2023-09-29 00:38:17 +02:00 committed by GitHub
commit e70d381bc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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';