From 88b5594af31f54bed54d0c89e61930f78c48404e Mon Sep 17 00:00:00 2001 From: kamel Date: Wed, 31 Aug 2022 09:59:24 +0200 Subject: [PATCH 01/17] FIX: Preview button position on documents list (case when the file is too long) --- htdocs/core/class/html.formfile.class.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 349b05416aa..6fe10788c54 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -850,6 +850,7 @@ class FormFile // Show file name with link to download $out .= ''; + $out .= $this->showPreview($file, $modulepart, $relativepath, 0, $param, 'paddingright')."\n"; $out .= 'trans("File").': '.$file["name"]); $out .= dol_trunc($file["name"], 150); - $out .= ''."\n"; - $out .= $this->showPreview($file, $modulepart, $relativepath, 0, $param); + $out .= ''; $out .= ''; // Show file size @@ -1307,6 +1307,11 @@ class FormFile // File name print ''; + // Preview link + if (!$editline) { + print $this->showPreview($file, $modulepart, $filepath, 0, '&entity='.(!empty($object->entity) ? $object->entity : $conf->entity), 'paddingright') . "\n"; + } + // Show file name with link to download //print "XX".$file['name']; //$file['name'] must be utf8 print '\n"; @@ -2097,9 +2098,10 @@ class FormFile * @param string $relativepath Relative path of docs * @param integer $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file) * @param string $param More param on http links + * @param string $moreclass Add more class to class style * @return string $out Output string with HTML */ - public function showPreview($file, $modulepart, $relativepath, $ruleforpicto = 0, $param = '') + public function showPreview($file, $modulepart, $relativepath, $ruleforpicto = 0, $param = '', $moreclass = '') { global $langs, $conf; @@ -2107,7 +2109,7 @@ class FormFile if ($conf->browser->layout != 'phone' && !empty($conf->use_javascript_ajax)) { $urladvancedpreview = getAdvancedPreviewUrl($modulepart, $relativepath, 1, $param); // Return if a file is qualified for preview. if (count($urladvancedpreview)) { - $out .= ''; + $out .= ''; //$out.= ''; if (empty($ruleforpicto)) { //$out.= img_picto($langs->trans('Preview').' '.$file['name'], 'detail'); From ca8c650feb12668abcd6a67fbc8147e577e68299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Courtier?= Date: Fri, 9 Sep 2022 12:20:47 +0200 Subject: [PATCH 02/17] Fix: status of product suplier price was not recovered --- htdocs/fourn/class/fournisseur.product.class.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 0ae975a1cbf..ea5dc639a5e 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -578,7 +578,7 @@ class ProductFournisseur extends Product $sql .= " pfp.supplier_reputation, pfp.fk_user, pfp.datec,"; $sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,"; $sql .= " pfp.barcode, pfp.fk_barcode_type, pfp.packaging,"; - $sql .= " p.ref as product_ref"; + $sql .= " p.ref as product_ref, p.tosell as status, p.tobuy as status_buy"; $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."product as p"; $sql .= " WHERE pfp.rowid = ".(int) $rowid; $sql .= " AND pfp.fk_product = p.rowid"; @@ -594,7 +594,8 @@ class ProductFournisseur extends Product $this->fk_product = $obj->fk_product; $this->product_id = $obj->fk_product; $this->product_ref = $obj->product_ref; - + $this->status = $obj->status; + $this->status_buy = $obj->status_buy; $this->fourn_id = $obj->fk_soc; $this->fourn_ref = $obj->ref_fourn; // deprecated $this->ref_supplier = $obj->ref_fourn; @@ -670,7 +671,7 @@ class ProductFournisseur extends Product // phpcs:enable global $conf; - $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id, p.ref as product_ref,"; + $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id, p.ref as product_ref, p.tosell as status, p.tobuy as status_buy, "; $sql .= " pfp.rowid as product_fourn_pri_id, pfp.entity, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_product as product_fourn_id, pfp.fk_supplier_price_expression,"; $sql .= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation,"; $sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code, pfp.datec, pfp.tms,"; @@ -699,6 +700,8 @@ class ProductFournisseur extends Product $prodfourn->product_ref = $record["product_ref"]; $prodfourn->product_fourn_price_id = $record["product_fourn_pri_id"]; + $prodfourn->status = $record["status"]; + $prodfourn->status_buy = $record["status_buy"]; $prodfourn->product_fourn_id = $record["product_fourn_id"]; $prodfourn->product_fourn_entity = $record["entity"]; $prodfourn->ref_supplier = $record["ref_fourn"]; From 6b4bd6c09eef238300a87ba418c9b21a6ac34f9c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 9 Sep 2022 15:56:17 +0200 Subject: [PATCH 03/17] FIX #21859 - Don't show html balise on list for private/public note --- htdocs/comm/propal/list.php | 4 ++-- htdocs/commande/list.php | 4 ++-- htdocs/compta/facture/list.php | 4 ++-- htdocs/fichinter/list.php | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 7a8fe187570..037ce5f26f8 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1915,7 +1915,7 @@ if ($resql) { // Note public if (!empty($arrayfields['p.note_public']['checked'])) { print ''; - print dol_escape_htmltag($obj->note_public); + print dol_string_nohtmltag($obj->note_public); print ''; if (!$i) { $totalarray['nbfield']++; @@ -1924,7 +1924,7 @@ if ($resql) { // Note private if (!empty($arrayfields['p.note_private']['checked'])) { print ''; - print dol_escape_htmltag($obj->note_private); + print dol_string_nohtmltag($obj->note_private); print ''; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 2033b5626b2..07db0c6077c 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1762,7 +1762,7 @@ if ($resql) { // Note public if (!empty($arrayfields['c.note_public']['checked'])) { print ''; - print dol_escape_htmltag($obj->note_public); + print dol_string_nohtmltag($obj->note_public); print ''; if (!$i) { $totalarray['nbfield']++; @@ -1772,7 +1772,7 @@ if ($resql) { // Note private if (!empty($arrayfields['c.note_private']['checked'])) { print ''; - print dol_escape_htmltag($obj->note_private); + print dol_string_nohtmltag($obj->note_private); print ''; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index f2cc5943e7a..f847d633ba0 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -2103,7 +2103,7 @@ if ($resql) { // Note public if (!empty($arrayfields['f.note_public']['checked'])) { print ''; - print dol_escape_htmltag($obj->note_public); + print dol_string_nohtmltag($obj->note_public); print ''; if (!$i) { $totalarray['nbfield']++; @@ -2112,7 +2112,7 @@ if ($resql) { // Note private if (!empty($arrayfields['f.note_private']['checked'])) { print ''; - print dol_escape_htmltag($obj->note_private); + print dol_string_nohtmltag($obj->note_private); print ''; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 508eb984307..c1e01db6a79 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -698,7 +698,7 @@ if ($resql) { // Note public if (!empty($arrayfields['f.note_public']['checked'])) { print ''; - print dol_escape_htmltag($obj->note_public); + print dol_string_nohtmltag($obj->note_public); print ''; if (!$i) { $totalarray['nbfield']++; @@ -707,7 +707,7 @@ if ($resql) { // Note private if (!empty($arrayfields['f.note_private']['checked'])) { print ''; - print dol_escape_htmltag($obj->note_private); + print dol_string_nohtmltag($obj->note_private); print ''; if (!$i) { $totalarray['nbfield']++; From 4490f0615e22d74fed64e1dbbf4e9d022fa63be8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Sep 2022 02:47:43 +0200 Subject: [PATCH 04/17] doc --- ChangeLog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 891e445ab39..49a782e1264 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,8 +10,8 @@ For users: --------------- NEW: PHP 8.1 compatibility: - Warning: Application works correctly with PHP8 and 8.1 but you may experience a lot of PHP warning into the PHP server log files (depending - on the PHP setup). Removal of all PHP warnings on server side is planned for v17. + Warning!! Application works correctly with PHP8 and 8.1 but you will experience a lot of PHP warnings into the PHP server + log files (depending on your PHP setup). Removal of all PHP warnings on server side is planned for v17. NEW: Support for recurring purchase invoices. NEW: #20292 Include German public holidays NEW: Can show ZATCA QRCode on PDFs From 5b2b5e6a583aeac6c22752341383c5aaac8ac532 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Sep 2022 08:33:36 +0200 Subject: [PATCH 05/17] Fix picto multicompany --- htdocs/user/group/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 1acfa858663..3e6e6eb1231 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -443,7 +443,7 @@ if ($action == 'create') { print ''; print ''; print $useringroup->getNomUrl(-1, '', 0, 0, 24, 0, 'login'); - if ($useringroup->admin && !$useringroup->entity) { + if (isModEnabled('multicompany') && $useringroup->admin && empty($useringroup->entity)) { print img_picto($langs->trans("SuperAdministrator"), 'redstar'); } elseif ($useringroup->admin) { print img_picto($langs->trans("Administrator"), 'star'); From 7a97fc8989d366e5be5493de080174fb7c817e0b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Sep 2022 16:44:32 +0200 Subject: [PATCH 06/17] Fix missing trans --- htdocs/langs/en_US/install.lang | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index dd451200c11..27e1792edac 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -211,3 +211,5 @@ ClickHereToGoToApp=Click here to go to your application ClickOnLinkOrRemoveManualy=If an upgrade is in progress, please wait. If not, click on the following link. If you always see this same page, you must remove/rename the file install.lock in the documents directory. Loaded=Loaded FunctionTest=Function test +NodoUpgradeAfterDB=No action requested by external modules after upgrade of database +NodoUpgradeAfterFiles=No action requested by external modules after upgrade of files or directories From 994603f009a00c6e0eff782e98b30e2a0a7a9dae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Sep 2022 12:17:49 +0200 Subject: [PATCH 07/17] FIX Missing token --- htdocs/admin/security.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 795a0557f16..a1281351176 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -356,7 +356,7 @@ if ($conf->global->USER_PASSWORD_GENERATED == "Perso") { print ' }'; print ' function generatelink(){'; - print ' return "security.php?action=updatepattern&pattern="+getStringArg();'; + print ' return "security.php?action=updatepattern&token='.newToken().'&pattern="+getStringArg();'; print ' }'; print ' function valuePatternChange(){'; From 271150e1e64c2e4638c5d0c828642918cdcf2bd4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Sep 2022 14:26:35 +0200 Subject: [PATCH 08/17] FIX CSS --- htdocs/contact/list.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 0bb902f7ca1..d41b6829bb2 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -1072,7 +1072,7 @@ while ($i < min($num, $limit)) { // ID if (!empty($arrayfields['p.rowid']['checked'])) { print ''; - print $obj->rowid; + print dol_escape_htmltag($obj->rowid); print "\n"; if (!$i) { $totalarray['nbfield']++; @@ -1080,7 +1080,7 @@ while ($i < min($num, $limit)) { } // Name if (!empty($arrayfields['p.lastname']['checked'])) { - print ''; + print ''; print $contactstatic->getNomUrl(1); print ''; if (!$i) { @@ -1089,35 +1089,35 @@ while ($i < min($num, $limit)) { } // Firstname if (!empty($arrayfields['p.firstname']['checked'])) { - print ''.$obj->firstname.''; + print ''.dol_escape_htmltag($obj->firstname).''; if (!$i) { $totalarray['nbfield']++; } } // Job position if (!empty($arrayfields['p.poste']['checked'])) { - print ''.$obj->poste.''; + print ''.dol_escape_htmltag($obj->poste).''; if (!$i) { $totalarray['nbfield']++; } } // Address if (!empty($arrayfields['p.address']['checked'])) { - print ''.$obj->address.''; + print ''.dol_escape_htmltag($obj->address).''; if (!$i) { $totalarray['nbfield']++; } } // Zip if (!empty($arrayfields['p.zip']['checked'])) { - print ''.$obj->zip.''; + print ''.dol_escape_htmltag($obj->zip).''; if (!$i) { $totalarray['nbfield']++; } } // Town if (!empty($arrayfields['p.town']['checked'])) { - print ''.$obj->town.''; + print ''.dol_escape_htmltag($obj->town).''; if (!$i) { $totalarray['nbfield']++; } @@ -1138,7 +1138,7 @@ while ($i < min($num, $limit)) { if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; $tmparray = getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; + print dol_escape_htmltag($tmparray['label']); print ''; if (!$i) { $totalarray['nbfield']++; @@ -1195,7 +1195,7 @@ while ($i < min($num, $limit)) { if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) { - print ''.dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key, $socialnetworks).''; + print ''.dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key, $socialnetworks).''; if (!$i) { $totalarray['nbfield']++; } @@ -1264,7 +1264,7 @@ while ($i < min($num, $limit)) { print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['p.datec']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; if (!$i) { @@ -1273,7 +1273,7 @@ while ($i < min($num, $limit)) { } // Date modification if (!empty($arrayfields['p.tms']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''; if (!$i) { From c22db758324f2fbafe66019fc0ec12dab0dbb635 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Sep 2022 16:05:33 +0200 Subject: [PATCH 09/17] FIX Missing reposition --- htdocs/admin/mails_templates.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 58a694726bc..f9fe30ef6d7 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -1242,7 +1242,7 @@ if ($num) { // Status / Active print ''; if ($canbedisabled) { - print ''.$actl[$obj->active].''; + print ''.$actl[$obj->active].''; } else { print ''.$actl[$obj->active].''; } From 8d05c98701153f693e11dc779edb631f08f06fa7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Sep 2022 13:31:20 +0200 Subject: [PATCH 10/17] Can modify creation date --- htdocs/recruitment/class/recruitmentjobposition.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index cc56b1c9cd7..97ec05d6985 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -115,7 +115,7 @@ class RecruitmentJobPosition extends CommonObject 'description' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>65, 'notnull'=>0, 'visible'=>3,), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>101, 'notnull'=>0, 'visible'=>0,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>102, 'notnull'=>0, 'visible'=>0,), - 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), + 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-4,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,), 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',), 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,), From d8b6a670644c42884ebe7c95887edf887ddcc9b7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Sep 2022 15:05:28 +0200 Subject: [PATCH 11/17] Fix picto --- .../triggers/interface_99_modWebhook_WebhookTriggers.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_99_modWebhook_WebhookTriggers.class.php b/htdocs/core/triggers/interface_99_modWebhook_WebhookTriggers.class.php index 335024554fc..a8932934bd1 100644 --- a/htdocs/core/triggers/interface_99_modWebhook_WebhookTriggers.class.php +++ b/htdocs/core/triggers/interface_99_modWebhook_WebhookTriggers.class.php @@ -52,7 +52,7 @@ class InterfaceWebhookTriggers extends DolibarrTriggers $this->description = "Webhook triggers."; // 'development', 'experimental', 'dolibarr' or version $this->version = 'development'; - $this->picto = 'webhook@webhook'; + $this->picto = 'webhook'; } /** From e7ea57d183a7c881cba94949641e13d498620740 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 11 Sep 2022 19:22:51 +0200 Subject: [PATCH 12/17] FIX avoid warning (php7+) --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b63bb68c4a5..e6c69cadc96 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1448,9 +1448,9 @@ function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0, $noescapeta // escape quotes and backslashes, newlines, etc. if ($escapeonlyhtmltags) { - $tmp = htmlspecialchars_decode($stringtoescape, ENT_COMPAT); + $tmp = htmlspecialchars_decode((string) $stringtoescape, ENT_COMPAT); } else { - $tmp = html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8'); + $tmp = html_entity_decode((string) $stringtoescape, ENT_COMPAT, 'UTF-8'); } if (!$keepb) { $tmp = strtr($tmp, array(""=>'', ''=>'')); From 003723bcf29555d199a76b8e9c77f8e79fa9cf8c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Sep 2022 22:17:07 +0200 Subject: [PATCH 13/17] Fix missing include --- htdocs/main.inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 3cbef0d799e..e00c1887fa7 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1428,6 +1428,7 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0) $contentsecuritypolicy = empty($conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY) ? '' : $conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY; if (!is_object($hookmanager)) { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); } $hookmanager->initHooks(array("main")); From dc7329679457a6cf75069bc3f4dee823ddf74da2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Sep 2022 21:30:12 +0200 Subject: [PATCH 14/17] FIX Test that web dir is correct in install --- htdocs/install/step1.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 7235e564275..24b5dba4d01 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -199,6 +199,14 @@ if (!empty($main_url) && substr($main_url, dol_strlen($main_url) - 1) == "/") { $main_url = substr($main_url, 0, dol_strlen($main_url) - 1); } +if (!dol_is_dir($main_dir.'/core/db/')) { + print '
'.$langs->trans("ErrorBadValueForParameter", $main_dir, $langs->transnoentitiesnoconv("WebPagesDirectory")).'
'; + print '
'; + //print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'

'; + print $langs->trans("ErrorGoBackAndCorrectParameters"); + $error++; +} + // Test database connection if (!$error) { $result = @include_once $main_dir."/core/db/".$db_type.'.class.php'; From 4cde1e89910ffede6de44461d709f0e0631e919e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Sep 2022 22:45:02 +0200 Subject: [PATCH 15/17] Doc --- htdocs/conf/conf.php.example | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 487576ed058..cb4aad1660c 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -162,8 +162,9 @@ $dolibarr_main_db_readonly=0; // dolibarr_main_instance_unique_id // An secret ID that is unique for each installation. -// This value is also visible and never propagated outside of Dolibarr, so it can be used as a salt / key for some encryption. -// To propagate a unique key, you propagate the value concatenated with a string with a hash function. Example: md5('dolibarr'+dolibarr_main_instance_unique_id) +// This value is also visible and never propagated outside of Dolibarr, so it can be used as a salt / key for some encryption (For example to get +// a unique hashed key, application will hash the value concatenated with a string. Example: md5('dolibarr'+dolibarr_main_instance_unique_id) +// WARNING: Changing this value will also make some sensitive values encrypted in database wrong. // Default value: randomly defined during installation // Examples: // $dolibarr_main_instance_unique_id='84b5bc91f83b56e458db71e0adac2b62'; From 0016e7c5e84b075a3e6b79d003f215b48f93334d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Sep 2022 23:47:32 +0200 Subject: [PATCH 16/17] Fix section with root pass restored when required if hidden --- htdocs/install/fileconf.php | 62 +++++++++++++++++++++++-------------- htdocs/install/inc.php | 2 +- 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 14f1ee2a1cd..f8dcdfe230b 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -448,7 +448,10 @@ if (!empty($force_install_noedit)) { > - trans("CheckToCreateDatabase"); ?> + + trans("CheckToCreateDatabase"); ?> @@ -503,7 +507,10 @@ if (!empty($force_install_noedit)) { > - trans("CheckToCreateUser"); ?> + + trans("CheckToCreateUser"); ?> @@ -613,30 +621,13 @@ jQuery(document).ready(function() { }); - function init_needroot() - { - console.log("init_needroot force_install_noedit="); - /*alert(jQuery("#db_create_database").prop("checked")); */ - if (jQuery("#db_create_database").is(":checked") || jQuery("#db_create_user").is(":checked")) - { - jQuery(".hideroot").show(); - - jQuery(".needroot").removeAttr('disabled'); - - } - else - { - jQuery(".hideroot").hide(); - jQuery(".needroot").prop('disabled', true); - } - } - init_needroot(); jQuery("#db_create_database").click(function() { + console.log("click on db_create_database"); init_needroot(); }); jQuery("#db_create_user").click(function() { + console.log("click on db_create_user"); init_needroot(); }); @@ -644,6 +635,27 @@ jQuery(document).ready(function() { }); +function init_needroot() +{ + console.log("init_needroot force_install_noedit="); + /*alert(jQuery("#db_create_database").prop("checked")); */ + if (jQuery("#db_create_database").is(":checked") || jQuery("#db_create_user").is(":checked")) + { + console.log("init_needroot show root section"); + jQuery(".hideroot").show(); + + jQuery(".needroot").removeAttr('disabled'); + + } + else + { + console.log("init_needroot hide root section"); + jQuery(".hideroot").hide(); + jQuery(".needroot").prop('disabled', true); + } +} + function checkDatabaseName(databasename) { if (databasename.match(/[;\.]/)) { return false; } return true; @@ -651,6 +663,8 @@ function checkDatabaseName(databasename) { function jscheckparam() { + console.log("Click on jscheckparam"); + ok=true; if (document.forminstall.main_dir.value == '') @@ -688,12 +702,14 @@ function jscheckparam() { ok=false; alert('transnoentities("YouAskToCreateDatabaseSoRootRequired")); ?>'); + init_needroot(); } // If create user asked else if (document.forminstall.db_create_user.checked == true && (document.forminstall.db_user_root.value == '')) { ok=false; alert('transnoentities("YouAskToCreateDatabaseUserSoRootRequired")); ?>'); + init_needroot(); } return ok; diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index a20c3489866..657e9841100 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -530,7 +530,7 @@ function pFooter($nonext = 0, $setuplang = '', $jscheckfunction = '', $withpleas print ''; } - print ''."\n"; + print '
'."\n"; // If there is some logs in buffer to show if (isset($conf->logbuffer) && count($conf->logbuffer)) { From 8ac625f03bbccb4925032894270e8b0a95ca2e3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Sep 2022 10:26:20 +0200 Subject: [PATCH 17/17] FIX reading of trackid in emailcollector (when on recipient suffix) --- htdocs/comm/mailing/card.php | 2 +- htdocs/core/class/notify.class.php | 2 +- .../class/emailcollector.class.php | 44 ++++++++++++++----- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 748c5fabf10..63e79685311 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -475,7 +475,7 @@ if (empty($reshook)) { } } - $trackid = 'emailingtest'; + $trackid = 'emailing-test'; $mailfile = new CMailFile($tmpsujet, $object->sendto, $object->email_from, $tmpbody, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $object->email_errorsto, $arr_css, $trackid, '', 'emailing'); $result = $mailfile->sendfile(); diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 3f26a98c728..5e12a30ba0e 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -456,7 +456,7 @@ class Notify $notifcodedefid = $obj->adid; $trackid = ''; if ($obj->type_target == 'tocontactid') { - $trackid = 'con'.$obj->cid; + $trackid = 'ctc'.$obj->cid; } if ($obj->type_target == 'touserid') { $trackid = 'use'.$obj->cid; diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 47e3c1303da..1c8c0b8698f 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1236,22 +1236,38 @@ class EmailCollector extends CommonObject $headers['Subject'] = $this->decodeSMTPSubject($headers['Subject']); + $emailto = $this->decodeSMTPSubject($overview[0]->to); + dol_syslog("** Process email ".$iforemailloop." References: ".$headers['References']." Subject: ".$headers['Subject']); //print "Process mail ".$iforemailloop." Subject: ".dol_escape_htmltag($headers['Subject'])." References: ".dol_escape_htmltag($headers['References'])." In-Reply-To: ".dol_escape_htmltag($headers['In-Reply-To'])."
\n"; + $trackidfoundintorecipienttype = ''; + $trackidfoundintorecipientid = 0; + $reg = array(); + // See also later list of all supported tags... + if (preg_match('/\+(thi|ctc|use|mem|sub|proj|tas|con|tic|job|pro|ord|inv|spro|sor|sin|leav|stockinv|job|surv|salary)([0-9]+)@/', $emailto, $reg)) { + $trackidfoundintorecipienttype = $reg[1]; + $trackidfoundintorecipientid = $reg[2]; + } elseif (preg_match('/\+emailing-(\w+)@/', $emailto, $reg)) { // Can be 'emailing-test' or 'emailing-IdMailing-IdRecipient' + $trackidfoundintorecipienttype = 'emailing'; + $trackidfoundintorecipientid = $reg[1]; + } + // If there is a filter on trackid if ($searchfilterdoltrackid > 0) { - if (empty($headers['References']) || !preg_match('/@'.preg_quote($host, '/').'/', $headers['References'])) { - $nbemailprocessed++; - dol_syslog(" Discarded - No header References found"); - continue; // Exclude email + if (empty($trackidfoundintorecipienttype)) { + if (empty($headers['References']) || !preg_match('/@'.preg_quote($host, '/').'/', $headers['References'])) { + $nbemailprocessed++; + dol_syslog(" Discarded - No suffix in email recipient and no Header References found matching signature of application so with a trackid"); + continue; // Exclude email + } } } if ($searchfilternodoltrackid > 0) { - if (!empty($headers['References']) && preg_match('/@'.preg_quote($host, '/').'/', $headers['References'])) { + if (!empty($trackidfoundintorecipienttype) || (!empty($headers['References']) && preg_match('/@'.preg_quote($host, '/').'/', $headers['References']))) { $nbemailprocessed++; - dol_syslog(" Discarded - Header References found and matching signature of application"); + dol_syslog(" Discarded - Suffix found into email or Header References found and matching signature of application so with a trackid"); continue; // Exclude email } } @@ -1431,13 +1447,19 @@ class EmailCollector extends CommonObject foreach ($arrayofreferences as $reference) { //print "Process mail ".$iforemailloop." email_msgid ".$msgid.", date ".dol_print_date($date, 'dayhour').", subject ".$subject.", reference ".dol_escape_htmltag($reference)."
\n"; - $resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $reference, $reg); - if (empty($resultsearchtrackid) && getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE')) { - $resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote(getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE'), '/').'/', $reference, $reg); + if (!empty($trackidfoundintorecipienttype)) { + $resultsearchtrackid = -1; + $reg[1] = $trackidfoundintorecipienttype; + $reg[2] = $trackidfoundintorecipientid; + } else { + $resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $reference, $reg); + if (empty($resultsearchtrackid) && getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE')) { + $resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote(getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE'), '/').'/', $reference, $reg); + } } - if ($resultsearchtrackid) { - // This is a Dolibarr reference of the server + if (!empty($resultsearchtrackid)) { + // We found a tracker (in recipient email or into a Reference matching the Dolibarr server) $trackid = $reg[1].$reg[2]; $objectid = $reg[2];