From adf59f259911ef0a1727308421be276e05032137 Mon Sep 17 00:00:00 2001 From: Mathieu Moulin Date: Sat, 16 Nov 2024 00:00:05 +0100 Subject: [PATCH 1/3] Fix mod_facture_fournisseur_tulip::getExample & get_next_value if no object in parameter (#31878) --- .../modules/supplier_invoice/mod_facture_fournisseur_tulip.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php index e6838b9c4c44e..5454c810e8d8e 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php @@ -176,7 +176,7 @@ public function getNextValue($objsoc, $object, $mode = 'next') } // Supplier invoices take invoice date instead of creation date for the mask - $numFinal = get_next_value($db, $mask, 'facture_fourn', 'ref', '', $objsoc, $object->date); + $numFinal = get_next_value($db, $mask, 'facture_fourn', 'ref', '', $objsoc, is_object($object) ?$object->date :''); return $numFinal; } From 348981a4190d12c54df4974ac59ce1a6899ea2da Mon Sep 17 00:00:00 2001 From: Mathieu Moulin Date: Sat, 16 Nov 2024 00:06:15 +0100 Subject: [PATCH 2/3] Fix show payment URL in massaction context when not one email per recipient (#31927) --- htdocs/core/actions_massactions.inc.php | 7 ++++++- htdocs/core/class/html.formmail.class.php | 11 ++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index ca8232c584be7..5ff3a0973fdc0 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -464,7 +464,12 @@ $substitutionarray['__REF__'] = ($oneemailperrecipient ? join(', ', $listofqualifiedref) : $objecttmp->ref); $substitutionarray['__EMAIL__'] = $thirdparty->email; $substitutionarray['__CHECK_READ__'] = ''; - + + if ($oneemailperrecipient) { + $substitutionarray['__ONLINE_PAYMENT_URL__'] = ''; + $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__'] = ''; + } + $parameters = array('mode'=>'formemail'); if (!empty($listofobjectthirdparties)) { diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 21d7f0710435e..cc45aaa2e919b 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -863,12 +863,12 @@ public function get_form($addfileaction = 'addfile', $removefileaction = 'remove // Complete substitution array with the url to make online payment $paymenturl = ''; - $validpaymentmethod = array(); + // Set the online payment url link into __ONLINE_PAYMENT_URL__ key + require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; + $validpaymentmethod = getValidOnlinePaymentMethods(''); if (empty($this->substit['__REF__'])) { $paymenturl = ''; } else { - // Set the online payment url link into __ONLINE_PAYMENT_URL__ key - require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $langs->loadLangs(array('paypal', 'other')); $typeforonlinepayment = 'free'; if ($this->param["models"] == 'order' || $this->param["models"] == 'order_send') { @@ -882,14 +882,15 @@ public function get_form($addfileaction = 'addfile', $removefileaction = 'remove } $url = getOnlinePaymentUrl(0, $typeforonlinepayment, $this->substit['__REF__']); $paymenturl = $url; - - $validpaymentmethod = getValidOnlinePaymentMethods(''); } if (count($validpaymentmethod) > 0 && $paymenturl) { $langs->load('other'); $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__'] = str_replace('\n', "\n", $langs->transnoentities("PredefinedMailContentLink", $paymenturl)); $this->substit['__ONLINE_PAYMENT_URL__'] = $paymenturl; + } elseif (count($validpaymentmethod) > 0) { + $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__'] = '__ONLINE_PAYMENT_TEXT_AND_URL__'; + $this->substit['__ONLINE_PAYMENT_URL__'] = '__ONLINE_PAYMENT_URL__'; } else { $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__'] = ''; $this->substit['__ONLINE_PAYMENT_URL__'] = ''; From cd6ed63768a2a0f4c7f66366db62b98f423fdd2c Mon Sep 17 00:00:00 2001 From: Mathieu Moulin Date: Sat, 16 Nov 2024 10:45:01 +0100 Subject: [PATCH 3/3] Fix Specimen warning in supplier admin when database has no products (#31867) --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index b7c01fa430642..b50bce3bd6c1e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2938,7 +2938,7 @@ public function initAsSpecimen() $sql .= $this->db->order("rowid", "ASC"); $sql .= $this->db->plimit(1); $resql = $this->db->query($sql); - if ($resql) { + if ($resql && $this->db->num_rows($resql)) { $obj = $this->db->fetch_object($resql); $prodid = $obj->rowid; }