From 10b546db1c5a49ca26243bc93c0cad8cfe7ef200 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Nov 2025 23:35:15 +0100 Subject: [PATCH 01/12] Fix warning --- htdocs/main.inc.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 383b0f0bec4..0de6217deb6 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1273,13 +1273,15 @@ if (!defined('NOREQUIRETRAN')) { // accesskey is for Windows or Linux: ALT + key for chrome, ALT + SHIFT + KEY for firefox // accesskey is for Mac: CTRL + Option + key for all browsers + + // Note: $con->browser->os and $conf->browser->name may not be defined if we are in CLI mode. $conf->browser->stringforfirstkey = $langs->trans("KeyboardShortcut"); - if ($conf->browser->os == 'macintosh') { + if (!empty($conf->browser->os) && $conf->browser->os == 'macintosh') { $conf->browser->stringforfirstkey .= ' CTRL + Option +'; } else { - if ($conf->browser->name == 'chrome') { + if (!empty($conf->browser->name) && $conf->browser->name == 'chrome') { $conf->browser->stringforfirstkey .= ' ALT +'; - } elseif ($conf->browser->name == 'firefox') { + } elseif (!empty($conf->browser->name) && $conf->browser->name == 'firefox') { $conf->browser->stringforfirstkey .= ' ALT + SHIFT +'; } else { $conf->browser->stringforfirstkey .= ' CTL +'; From 0027e0c12684cca6479892541b52f32a177b8861 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 26 Nov 2025 01:35:10 +0100 Subject: [PATCH 02/12] Fix CI --- htdocs/public/stripe/ipn.php | 38 +++++++++++++----------------------- htdocs/reception/card.php | 2 +- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 6f471059de2..bc0297f82ee 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -376,8 +376,8 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P $currencyCodeType = strtoupper($object->currency); $paymentmethodstripeid = $object->payment_method; $customer_id = $object->customer; - $invoice_id = ""; - $supplierinvoice_id = ""; + $invoice_id = 0; + $supplierinvoice_id = 0; $salary_id = ""; $paymentTypeCode = ""; // payment type according to Stripe $paymentTypeCodeInDolibarr = ""; // payment type according to Dolibarr @@ -660,10 +660,11 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P $invoice = new Facture($db); $invoice->fetch($invoice_id); + $invoice->fetch_thirdparty(); // Set output language $outputlangs = new Translate('', $conf); - $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); + $outputlangs->setDefaultLang(empty($invoice->thirdparty->default_lang) ? $mysoc->default_lang : $invoice->thirdparty->default_lang); $outputlangs->loadLangs(array("main", "members", "bills")); // Get email content from template @@ -672,16 +673,14 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail=new FormMail($db); - if (! empty($labeltouse)) { - $arraydefaultmessage = $formmail->getEMailTemplate($db, 'facture_send', $user, $outputlangs, 0, 1, $labeltouse); - } + $arraydefaultmessage = $formmail->getEMailTemplate($db, 'facture_send', $user, $outputlangs, 0, 1, $labeltouse); - if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { + if (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; } - $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object); + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $invoice); complete_substitutions_array($substitutionarray, $outputlangs, $object); @@ -692,11 +691,12 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P if (is_array($invoice->linkedObjects['contrat']) && count($invoice->linkedObjects['contrat']) > 0) { //dol_sort_array($object->linkedObjects['facture'], 'date'); - foreach ($invoice->linkedObjects['contrat'] as $idcontract => $contract) { - $substitutionarray['__CONTRACT_REF__']=$contract->ref_customer; - $substitutionarray['__REFCLIENT__']=$contract->ref_customer; // For backward compatibility - $substitutionarray['__REF_CLIENT__']=$contract->ref_customer; - $substitutionarray['__REF_CUSTOMER__']=$contract->ref_customer; + foreach ($invoice->linkedObjects['contrat'] as $contract) { + /** @var Contrat $contract */ + $substitutionarray['__CONTRACT_REF__'] = $contract->ref_customer; + $substitutionarray['__REFCLIENT__'] = $contract->ref_customer; // For backward compatibility + $substitutionarray['__REF_CLIENT__'] = $contract->ref_customer; + $substitutionarray['__REF_CUSTOMER__'] = $contract->ref_customer; $foundcontract = $contract; break; } @@ -704,16 +704,6 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P dol_syslog('__DIRECTDOWNLOAD_URL_INVOICE__='.$substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__']); - $urlforsellyoursaasaccount = getRootUrlForAccount($foundcontract); - if ($urlforsellyoursaasaccount) { - $tmpforurl=preg_replace('/.*document.php/', '', $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__']); - if ($tmpforurl) { - $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__']=$urlforsellyoursaasaccount.'/source/document.php'.$tmpforurl; - } else { - $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__']=$urlforsellyoursaasaccount; - } - } - $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); @@ -737,7 +727,7 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P $from = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL'); $trackid = 'inv'.$invoice->id; - $moreinheader = 'X-Dolibarr-Info: doTakeStripePaymentForThirdParty'."\r\n"; + $moreinheader = 'X-Dolibarr-Info: public stripe ipn.php'."\r\n"; $addr_cc = ''; if (!empty($invoice->thirdparty->array_options['options_emailccinvoice'])) { dol_syslog("We add the recipient ".$invoice->thirdparty->array_options['options_emailccinvoice']." as CC", LOG_DEBUG); diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 7aa47e710b1..e8d9a23780e 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -2480,7 +2480,7 @@ if ($action == 'create' && $permissiontoadd) { $origin = 'supplier_order'; } - if ($origin && $origin_id > 0) { + if ($origin_id > 0) { $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end"; $sql .= ", ed.rowid as receptionline_id, ed.qty, ed.fk_reception as reception_id, ed.fk_entrepot"; $sql .= ", e.rowid as reception_id, e.ref as reception_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_reception"; From 54cba89bc5a3758cbe0b324cb54732d37045c2b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 26 Nov 2025 01:40:45 +0100 Subject: [PATCH 03/12] Fix CI --- htdocs/public/stripe/ipn.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index bc0297f82ee..1e917a92c65 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -656,7 +656,8 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P if (!$error) { if (getDolGlobalString('STRIPE_IPN_SEND_EMAIL_ON_DIRECT_DEBIT_CONFIRMATION')) { // If option to send email after confirmation of direct debit is on, we send the email (template must exists - $labeltouse = getDolGlobalString('STRIPE_IPN_SEND_EMAIL_ON_DIRECT_DEBIT_CONFIRMATION'); // Example: 'InvoicePaymentSuccess' + $labeltouse = getDolGlobalString('STRIPE_IPN_SEND_EMAIL_ON_DIRECT_DEBIT_CONFIRMATION'); + // Example: $labeltouse = 'InvoicePaymentSuccess' $invoice = new Facture($db); $invoice->fetch($invoice_id); @@ -675,6 +676,10 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P $arraydefaultmessage = $formmail->getEMailTemplate($db, 'facture_send', $user, $outputlangs, 0, 1, $labeltouse); + $appli = $mysoc->name; + + $subject = '['.$appli.'] Invoice direct debit payment recevied'; + $msg = 'An invoice direct debit payment for invoice '.$invoice->ref.' has been recevied'; if (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; From e486d22b61d0c5b848cf9ce793f2a4389618ddfc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 26 Nov 2025 01:43:23 +0100 Subject: [PATCH 04/12] Fix CI --- htdocs/public/stripe/ipn.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 1e917a92c65..2a335f62882 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -713,22 +713,23 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); // Attach a file ? - $file=''; $listofpaths=array(); $listofnames=array(); $listofmimes=array(); - if (is_object($invoice)) { - $invoicediroutput = $conf->invoice->dir_output; - $fileparams = dol_most_recent_file($invoicediroutput . '/' . $invoice->ref, preg_quote($invoice->ref, '/').'[^\-]+'); - $file = $fileparams['fullname']; - $file = ''; // Disable attachment of invoice in emails - if ($file) { - $listofpaths=array($file); - $listofnames=array(basename($file)); - $listofmimes=array(dol_mimetype($file)); - } + /* + $invoicediroutput = $conf->invoice->dir_output; + $fileparams = dol_most_recent_file($invoicediroutput . '/' . $invoice->ref, preg_quote($invoice->ref, '/').'[^\-]+'); + $file = $fileparams['fullname']; + $file = ''; // Disable attachment of invoice in emails + + if ($file) { + $listofpaths=array($file); + $listofnames=array(basename($file)); + $listofmimes=array(dol_mimetype($file)); } + */ + $from = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL'); $trackid = 'inv'.$invoice->id; From ed8fc3ab30904567f61e2c749ddcb63ca450f203 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 26 Nov 2025 01:45:45 +0100 Subject: [PATCH 05/12] Fix CI --- htdocs/core/class/cleadstatus.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/class/cleadstatus.class.php b/htdocs/core/class/cleadstatus.class.php index 87c4e832370..46122f12a54 100644 --- a/htdocs/core/class/cleadstatus.class.php +++ b/htdocs/core/class/cleadstatus.class.php @@ -58,6 +58,9 @@ class CLeadStatus extends CommonDict */ public $percent; + /** + * @var array|string,position:int,notnull?:int,visible:int<-5,5>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> + */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), 'label' => array('type' => 'varchar(128)', 'label' => 'Label', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'comment' => "Label of status"), From 1432588fa91afafbff86b929641b0da2bb70124b Mon Sep 17 00:00:00 2001 From: Aksanti Bahiga tacite <71480535+marcellintacite@users.noreply.github.com> Date: Wed, 26 Nov 2025 03:50:15 +0300 Subject: [PATCH 06/12] FIX: Resolve JS error on country change in public member form (#36422) --- htdocs/public/members/new.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 8bbf2b9b505..6ea6a893f8e 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -683,8 +683,8 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR print "\n".'