From 94dbde9cfd04ebf90a2b1ef4e0a771f8122b9581 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Tue, 12 Mar 2024 15:28:35 +0100 Subject: [PATCH 1/5] fix default current user as commercial for the thirdparty --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index a88aec05618..c1cdb053f5b 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1652,7 +1652,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, 'AND u.statut = 1', 0, '', '', 0, 1); // Note: If user has no right to "see all thirdparties", we force selection of sale representative to him, so after creation he can see the record. - $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (empty($user->rights->societe->client->voir) ? array($user->id) : array()))); + $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (!empty($user->rights->societe->client->voir) ? array($user->id) : array()))); print img_picto('', 'user').$form->multiselectarray('commercial', $userlist, $selected, null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print ''; From 71442efa030276a1f77d8de01c575c39e23a2695 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Wed, 13 Mar 2024 12:19:01 +0100 Subject: [PATCH 2/5] remove check againts read access (and if that user create a thirdpart read access is implicit) --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index c1cdb053f5b..65c194ee50f 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1652,7 +1652,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, 'AND u.statut = 1', 0, '', '', 0, 1); // Note: If user has no right to "see all thirdparties", we force selection of sale representative to him, so after creation he can see the record. - $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (!empty($user->rights->societe->client->voir) ? array($user->id) : array()))); + $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : array($user->id))); print img_picto('', 'user').$form->multiselectarray('commercial', $userlist, $selected, null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print ''; From 9e638ccc12c46a9f4aeb213216353c53a976f1cd Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 4 Apr 2024 16:22:31 +0200 Subject: [PATCH 3/5] FIX avoid to delete "lock" and "unlock" files --- htdocs/core/class/utils.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 9907ae29834..83049fe334a 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -96,14 +96,14 @@ class Utils if ($choice == 'allfiles') { // Delete all files (except install.lock, do not follow symbolic links) if ($dolibarr_main_data_root) { - $filesarray = dol_dir_list($dolibarr_main_data_root, "all", 0, '', 'install\.lock$', 'name', SORT_ASC, 0, 0, '', 1); + $filesarray = dol_dir_list($dolibarr_main_data_root, "all", 0, '', '[\.lock|\.unlock]$', 'name', SORT_ASC, 0, 0, '', 1); } } if ($choice == 'logfile' || $choice == 'logfiles') { // Define files log if ($dolibarr_main_data_root) { - $filesarray = dol_dir_list($dolibarr_main_data_root, "files", 0, '.*\.log[\.0-9]*(\.gz)?$', 'install\.lock$', 'name', SORT_ASC, 0, 0, '', 1); + $filesarray = dol_dir_list($dolibarr_main_data_root, "files", 0, '.*\.log[\.0-9]*(\.gz)?$', '[\.lock|\.unlock]$', 'name', SORT_ASC, 0, 0, '', 1); } if (!empty($conf->syslog->enabled)) { From cb9a93d97eca6507e59b1bb97900e537265cb67a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 4 Apr 2024 16:32:24 +0200 Subject: [PATCH 4/5] FIX syntax error (but same result) :-) --- htdocs/core/class/utils.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 83049fe334a..c8599612340 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -96,14 +96,14 @@ class Utils if ($choice == 'allfiles') { // Delete all files (except install.lock, do not follow symbolic links) if ($dolibarr_main_data_root) { - $filesarray = dol_dir_list($dolibarr_main_data_root, "all", 0, '', '[\.lock|\.unlock]$', 'name', SORT_ASC, 0, 0, '', 1); + $filesarray = dol_dir_list($dolibarr_main_data_root, "all", 0, '', '(\.lock|\.unlock)$', 'name', SORT_ASC, 0, 0, '', 1); } } if ($choice == 'logfile' || $choice == 'logfiles') { // Define files log if ($dolibarr_main_data_root) { - $filesarray = dol_dir_list($dolibarr_main_data_root, "files", 0, '.*\.log[\.0-9]*(\.gz)?$', '[\.lock|\.unlock]$', 'name', SORT_ASC, 0, 0, '', 1); + $filesarray = dol_dir_list($dolibarr_main_data_root, "files", 0, '.*\.log[\.0-9]*(\.gz)?$', '(\.lock|\.unlock)$', 'name', SORT_ASC, 0, 0, '', 1); } if (!empty($conf->syslog->enabled)) { From 22244a9d84a741eb9639c3d0f67ba4f2cea1fabf Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Tue, 9 Apr 2024 20:16:10 +0200 Subject: [PATCH 5/5] FIX supplier price duplicate entry on update supplier product ref (#29290) * FIX supplier price duplicate entry on update supplier product ref * Add ref_fourn_price_id in fetch method --- htdocs/product/fournisseurs.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index c309570cc52..4a7ebb882ea 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -181,6 +181,7 @@ if (empty($reshook)) { } if ($action == 'save_price') { + $ref_fourn_price_id = GETPOSTINT('ref_fourn_price_id'); $id_fourn = GETPOST("id_fourn"); if (empty($id_fourn)) { $id_fourn = GETPOST("search_id_fourn"); @@ -265,15 +266,18 @@ if (empty($reshook)) { if (!$error) { $db->begin(); - if (!$error) { + if (empty($ref_fourn_price_id)) { $ret = $object->add_fournisseur($user, $id_fourn, $ref_fourn_old, $quantity); // This insert record with no value for price. Values are update later with update_buyprice if ($ret == -3) { $error++; - $object->fetch($object->product_id_already_linked); - $productLink = $object->getNomUrl(1, 'supplier'); + $tmpobject = new Product($db); + $tmpobject->fetch($object->product_id_already_linked); + $productLink = $tmpobject->getNomUrl(1, 'supplier'); - setEventMessages($langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct", $productLink), null, 'errors'); + $texttoshow = $langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct", '{s1}'); + $texttoshow = str_replace('{s1}', $productLink, $texttoshow); + setEventMessages($texttoshow, null, 'errors'); } elseif ($ret < 0) { $error++; setEventMessages($object->error, $object->errors, 'errors'); @@ -283,8 +287,8 @@ if (empty($reshook)) { if (!$error) { $supplier = new Fournisseur($db); $result = $supplier->fetch($id_fourn); - if (GETPOSTISSET('ref_fourn_price_id')) { - $object->fetch_product_fournisseur_price(GETPOST('ref_fourn_price_id', 'int')); + if ($ref_fourn_price_id > 0) { + $object->fetch_product_fournisseur_price($ref_fourn_price_id); } $extralabels = $extrafields->fetch_name_optionals_label("product_fournisseur_price"); $extrafield_values = $extrafields->getOptionalsFromPost("product_fournisseur_price");