From 72ecff38e4d43d41973ba5763bf9273b3209969c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20H=C3=B6dl?= <27991923+f-hoedl@users.noreply.github.com> Date: Wed, 5 Aug 2026 10:18:26 +0200 Subject: [PATCH] FIX Missing include of ActionComm in doAutoRenewContracts (#39387) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contrat::doAutoRenewContracts() instantiates ActionComm to log the RENEW_CONTRACT event, but contrat.class.php never loads comm/action/class/actioncomm.class.php. From a web request the class is usually already loaded by some other include, so the problem stays hidden. When the method is run as a scheduled job it is not: scripts/cron/cron_run_jobs.php loads only master.inc.php, functionscli.lib.php, cronjob.class.php and user.class.php, and cronjob.class.php then loads only the job class itself via dol_include_once($this->classesname). ActionComm is not part of that include closure, so the method fails with "Class ActionComm not found". The fatal error happens after the UPDATE on llx_contratdet has been issued but before $this->db->commit(), so the transaction is never committed and the renewal is lost. The job also aborts, so every remaining contract line in the loop is left unprocessed and the failure is only visible as a fatal error in the log. Verified on 23.0.3: after the cron bootstrap, class_exists('Contrat') is true while class_exists('ActionComm') is false. Adding the include next to the existing html.formmail.class.php include makes it true. Signed-off-by: Florian Hödl Co-authored-by: Florian Hödl --- htdocs/contrat/class/contrat.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 7fc9dd45ed5..c5cc47d001b 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2753,6 +2753,7 @@ class Contrat extends CommonObject $num = $this->db->num_rows($resql); include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; $i = 0; while ($i < $num) {