From dc58a90a486e92818cd37a5f7c1ae0c440ef85d9 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Wed, 31 Jul 2024 15:35:15 +0200 Subject: [PATCH 1/7] Fix modulebuilder MAIN_ODT_AS_PDF (#30496) --- .../modules/mymodule/doc/doc_generic_myobject_odt.modules.php | 2 +- .../core/modules/mymodule/doc/pdf_standard_myobject.modules.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index 9baea8a2a71..e35fb604cec 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -473,7 +473,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file - if (getDolGlobalInt('MAIN_ODT_AS_PDF')) { + if (getDolGlobalString('MAIN_ODT_AS_PDF')) { try { $odfHandler->exportAsAttachedPDF($file); } catch (Exception $e) { diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index b0e62412651..4d6d8987f62 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -944,7 +944,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); $title = $outputlangs->transnoentities("PdfTitle"); - if (getDolGlobalInt('MAIN_ODT_AS_PDF') && is_object($outputlangsbis)) { + if (getDolGlobalString('MAIN_ODT_AS_PDF') && is_object($outputlangsbis)) { $title .= ' - '; $title .= $outputlangsbis->transnoentities("PdfTitle"); } From 7d996cf59f4c8a0a214c96e06f10cc165827e97a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20NASSIET?= <109105553+comaiteseb@users.noreply.github.com> Date: Wed, 31 Jul 2024 15:41:59 +0200 Subject: [PATCH 2/7] Update list.php Bad translation Key for demand_reason (#30487) The Right translation for Demand Reason is Origin and not Channel. (see in propale where the translation works fine) --- htdocs/commande/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 0141f9df4f6..9211cddf045 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -182,7 +182,7 @@ $arrayfields = array( 'c.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>-1, 'position'=>66 , 'enabled'=>isModEnabled("expedition")), 'c.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>-1, 'position'=>67), 'c.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>-1, 'position'=>68), - 'c.fk_input_reason'=>array('label'=>"Channel", 'checked'=>-1, 'position'=>69), + 'c.fk_input_reason'=>array('label'=>"Origin", 'checked'=>-1, 'position'=>69), 'c.total_ht'=>array('label'=>"AmountHT", 'checked'=>1, 'position'=>75), 'c.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0, 'position'=>80), 'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>85), From d8a9ae39618d1018f1d73fedd19aa49fbea33f69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20NASSIET?= <109105553+comaiteseb@users.noreply.github.com> Date: Wed, 31 Jul 2024 15:43:53 +0200 Subject: [PATCH 3/7] Update card.php Bad translation Key for demand_reason (#30486) The Right translation for Demand Reason is Source as it was defined line 2615 --- htdocs/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 77ba69204bf..13f90625cd8 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1954,7 +1954,7 @@ if ($action == 'create' && $usercancreate) { } // Source / Channel - What trigger creation - print ''.$langs->trans('Channel').''; + print ''.$langs->trans('Source').''; print img_picto('', 'question', 'class="pictofixedwidth"'); $form->selectInputReason((GETPOSTISSET('demand_reason_id') ? GETPOST('demand_reason_id') : $demand_reason_id), 'demand_reason_id', '', 1, 'maxwidth200 widthcentpercentminusx'); print ''; From 66da3d7f9bc15adfc47cf364258303362131cc21 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Aug 2024 11:35:42 +0200 Subject: [PATCH 4/7] Debug v20 - Fix use of oauth for alternative send email setup --- htdocs/core/class/CMailFile.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index f444f5fc46f..a0846a38196 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -208,7 +208,7 @@ class CMailFile $this->sendcontext = $sendcontext; - // Define this->sendmode ('mail', 'smtps', 'swiftmailer', ...) according to $sendcontext ('standard', 'emailing', 'ticket', 'password') + // Define this->sendmode ('mail', 'smtps', 'swiftmailer', ...) according to $sendcontext ('standard', 'emailing', 'ticket', 'passwordreset') $this->sendmode = ''; if (!empty($this->sendcontext)) { $smtpContextKey = strtoupper($this->sendcontext); @@ -1092,9 +1092,9 @@ class CMailFile // Token expired so we refresh it if (is_object($tokenobj) && $expire) { $credentials = new Credentials( - getDolGlobalString('OAUTH_'.getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE').'_ID'), - getDolGlobalString('OAUTH_'.getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE').'_SECRET'), - getDolGlobalString('OAUTH_'.getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE').'_URLAUTHORIZE') + getDolGlobalString('OAUTH_'.getDolGlobalString($keyforsmtpoauthservice).'_ID'), + getDolGlobalString('OAUTH_'.getDolGlobalString($keyforsmtpoauthservice).'_SECRET'), + getDolGlobalString('OAUTH_'.getDolGlobalString($keyforsmtpoauthservice).'_URLAUTHORIZE') ); $serviceFactory = new \OAuth\ServiceFactory(); $oauthname = explode('-', $OAUTH_SERVICENAME); @@ -1249,9 +1249,9 @@ class CMailFile // Token expired so we refresh it if (is_object($tokenobj) && $expire) { $credentials = new Credentials( - getDolGlobalString('OAUTH_'.getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE').'_ID'), - getDolGlobalString('OAUTH_'.getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE').'_SECRET'), - getDolGlobalString('OAUTH_'.getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE').'_URLAUTHORIZE') + getDolGlobalString('OAUTH_'.getDolGlobalString($keyforsmtpoauthservice).'_ID'), + getDolGlobalString('OAUTH_'.getDolGlobalString($keyforsmtpoauthservice).'_SECRET'), + getDolGlobalString('OAUTH_'.getDolGlobalString($keyforsmtpoauthservice).'_URLAUTHORIZE') ); $serviceFactory = new \OAuth\ServiceFactory(); $oauthname = explode('-', $OAUTH_SERVICENAME); From 483a30078dccfd118f6a1fb91f0974ff186b96f8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Aug 2024 11:55:49 +0200 Subject: [PATCH 5/7] Try to avoid to reload token when not necessary. --- htdocs/core/class/CMailFile.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index a0846a38196..47eb0cd3ece 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1084,6 +1084,7 @@ class CMailFile $storage = new DoliStorage($db, $conf, $keyforprovider); try { $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); + $expire = false; // Is token expired or will token expire in the next 30 seconds if (is_object($tokenobj)) { @@ -1105,9 +1106,10 @@ class CMailFile $tokenobj = $apiService->refreshAccessToken($tokenobj); $tokenobj->setRefreshToken($refreshtoken); $storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj); + + $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); } - $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); if (is_object($tokenobj)) { $this->smtps->setToken($tokenobj->getAccessToken()); } else { @@ -1241,6 +1243,7 @@ class CMailFile try { $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); + $expire = false; // Is token expired or will token expire in the next 30 seconds if (is_object($tokenobj)) { @@ -1262,7 +1265,10 @@ class CMailFile $tokenobj = $apiService->refreshAccessToken($tokenobj); $tokenobj->setRefreshToken($refreshtoken); $storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj); + + $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); } + if (is_object($tokenobj)) { $this->transport->setAuthMode('XOAUTH2'); $this->transport->setPassword($tokenobj->getAccessToken()); From 2c92e57fe7b81a814f67ad8064dce67f37f8118a Mon Sep 17 00:00:00 2001 From: atm-adrien <67913809+atm-adrien@users.noreply.github.com> Date: Thu, 1 Aug 2024 12:52:53 +0200 Subject: [PATCH 6/7] FIX : Display the real_PMP on inventory when its value is equal to 0 (#22291) * FIX : Display the real_PMP on inventory when its value is equal to 0 * FIX : PR Returns * FIX : PR returns --- htdocs/product/inventory/inventory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 4719fe00ce8..0d65a78badd 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -1087,7 +1087,7 @@ if ($object->id > 0) { print ''; - if (! empty($obj->pmp_real)) $pmp_real = $obj->pmp_real; + if (! empty($obj->pmp_real) || (string) $obj->pmp_real === '0') $pmp_real = $obj->pmp_real; else $pmp_real = $product_static->pmp; $pmp_valuation_real = $pmp_real * $qty_view; print ''; From 534570a85b6105150b50fdc2e5f2d9ca2c070764 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Aug 2024 13:39:27 +0200 Subject: [PATCH 7/7] Disable deprecated entry --- htdocs/install/mysql/data/llx_c_input_reason.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_c_input_reason.sql b/htdocs/install/mysql/data/llx_c_input_reason.sql index ff3621aed16..0e1509f21df 100644 --- a/htdocs/install/mysql/data/llx_c_input_reason.sql +++ b/htdocs/install/mysql/data/llx_c_input_reason.sql @@ -24,7 +24,7 @@ INSERT INTO llx_c_input_reason (rowid,code,label,active) VALUES ( 1, 'SRC_INTE', 'Web site', 1); INSERT INTO llx_c_input_reason (rowid,code,label,active) VALUES ( 2, 'SRC_CAMP_MAIL', 'Mailing campaign', 1); INSERT INTO llx_c_input_reason (rowid,code,label,active) VALUES ( 3, 'SRC_CAMP_PHO', 'Phone campaign', 1); -INSERT INTO llx_c_input_reason (rowid,code,label,active) VALUES ( 4, 'SRC_CAMP_FAX', 'Fax campaign', 1); +INSERT INTO llx_c_input_reason (rowid,code,label,active) VALUES ( 4, 'SRC_CAMP_FAX', 'Fax campaign', 0); INSERT INTO llx_c_input_reason (rowid,code,label,active) VALUES ( 5, 'SRC_COMM', 'Commercial contact', 1); INSERT INTO llx_c_input_reason (rowid,code,label,active) VALUES ( 6, 'SRC_SHOP', 'Shop contact', 1); INSERT INTO llx_c_input_reason (rowid,code,label,active) VALUES ( 7, 'SRC_CAMP_EMAIL', 'EMailing campaign', 1);