FIX: reception reopening lacks of message when an error occurs (#36752)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Jyhere 2026-01-05 17:46:45 +01:00 committed by GitHub
parent 7f06060592
commit d88730174c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -235,6 +235,9 @@ if (empty($reshook)) {
// Reopen
if ($action == 'reopen' && $permissiontoadd) { // Test on permissions not required here
$result = $object->reOpen();
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
// Confirm back to draft status

View file

@ -2191,7 +2191,7 @@ class Reception extends CommonObject
*/
public function reOpen()
{
global $conf, $langs, $user;
global $langs, $user;
$error = 0;
@ -2201,6 +2201,8 @@ class Reception extends CommonObject
$sql .= " WHERE rowid = ".((int) $this->id).' AND fk_statut > 0';
$resql = $this->db->query($sql);
$rollbackStatus = $this->status;
$rollbackBilled = $this->billed;
if ($resql) {
$this->statut = self::STATUS_VALIDATED;
$this->status = self::STATUS_VALIDATED;
@ -2304,6 +2306,8 @@ class Reception extends CommonObject
$this->db->commit();
return 1;
} else {
$this->statut = $this->status = $rollbackStatus;
$this->billed = $rollbackBilled;
$this->db->rollback();
return -1;
}