From fd094638dde4b0a31f602bd113f047cc0d7900d5 Mon Sep 17 00:00:00 2001 From: atm-irvine <165771178+atm-irvine@users.noreply.github.com> Date: Tue, 29 Oct 2024 20:41:01 +0100 Subject: [PATCH] NEW : Suspend facture rec when nb gen max is reached (#31623) --- htdocs/compta/facture/class/facture-rec.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index a724d2001ff..816077ab08a 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -2003,6 +2003,15 @@ class FactureRec extends CommonInvoice $this->date_when = $date; if ($increment_nb_gen_done > 0) { $this->nb_gen_done++; + + if (getDolGlobalInt('MAIN_SUSPEND_FACTURE_REC_ON_MAX_GEN_REACHED') && $this->isMaxNbGenReached()) { + $resSuspend = $this->setValueFrom('suspended', 1); + + if ($resSuspend <= 0) { + dol_syslog(__METHOD__ . '::setValueFrom Error : ' . $this->error, LOG_ERR); + return -1; + } + } } if (!$notrigger) {