From 332dbe90a9669769c1c5437a2df3cb7372147928 Mon Sep 17 00:00:00 2001 From: Irvine Fleith Date: Tue, 29 Oct 2024 11:27:47 +0100 Subject: [PATCH 1/2] Backport 17.0 PR #31623 : Suspend facture rec when nb gen max is reached --- ChangeLog_Koesio.md | 1 + htdocs/compta/facture/class/facture-rec.class.php | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog_Koesio.md b/ChangeLog_Koesio.md index 2b797edecd507..21d876466b33b 100644 --- a/ChangeLog_Koesio.md +++ b/ChangeLog_Koesio.md @@ -2,3 +2,4 @@ - Backport 21.0 PR #31463 : Tab to see generated invoices on recurring supplier or customer invoice cards - *2024-10-23* - Backport 17.0 PR #31445 : Follow ExtraFields between model invoice and classic invoice - *2024-10-18* +- Backport 17.0 PR #31623 : Suspend facture rec when nb gen max is reached - *2024-10-29* diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 68b7c3c75aa09..1d307c8a7f60f 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1905,6 +1905,15 @@ public function setNextDate($date, $increment_nb_gen_done = 0, $notrigger = 0) $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) { From 09e22a15e3bb83094f70d1df17edde3b6352f29e Mon Sep 17 00:00:00 2001 From: Irvine Fleith Date: Tue, 29 Oct 2024 12:06:19 +0100 Subject: [PATCH 2/2] Retours de PR --- ChangeLog_Koesio.md | 2 +- htdocs/compta/facture/class/facture-rec.class.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog_Koesio.md b/ChangeLog_Koesio.md index 21d876466b33b..1fc80b9ca1f51 100644 --- a/ChangeLog_Koesio.md +++ b/ChangeLog_Koesio.md @@ -1,5 +1,5 @@ ## Backported from 17.0 : +- Backport 17.0 PR #31623 : Suspend facture rec when nb gen max is reached - *2024-10-29* - Backport 21.0 PR #31463 : Tab to see generated invoices on recurring supplier or customer invoice cards - *2024-10-23* - Backport 17.0 PR #31445 : Follow ExtraFields between model invoice and classic invoice - *2024-10-18* -- Backport 17.0 PR #31623 : Suspend facture rec when nb gen max is reached - *2024-10-29* diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 1d307c8a7f60f..6d1e804ba3c9f 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1906,6 +1906,7 @@ public function setNextDate($date, $increment_nb_gen_done = 0, $notrigger = 0) if ($increment_nb_gen_done > 0) { $this->nb_gen_done++; + // Backport 17.0 #31623 if (getDolGlobalInt('MAIN_SUSPEND_FACTURE_REC_ON_MAX_GEN_REACHED') && $this->isMaxNbGenReached()) { $resSuspend = $this->setValueFrom('suspended', 1);