From db06de0ac2e1e6c499184789ff86433c3647c351 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Tue, 30 Nov 2021 16:27:50 +0100 Subject: [PATCH 01/16] add printFieldListHaving hook --- htdocs/comm/propal/list.php | 5 +++++ htdocs/commande/list.php | 5 +++++ htdocs/expedition/list.php | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 4f59682abb8..3e467539c88 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -696,6 +696,11 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; +// Add HAVING from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= !empty($hookmanager->resPrint) ? (' HAVING 1=1 ' . $hookmanager->resPrint) : ''; + $sql .= $db->order($sortfield, $sortorder); $sql .= ', p.ref DESC'; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 9c278359acc..b534d915914 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -628,6 +628,11 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; +// Add HAVING from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= !empty($hookmanager->resPrint) ? (' HAVING 1=1 ' . $hookmanager->resPrint) : ''; + $sql .= $db->order($sortfield, $sortorder); // Count total nb of records diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 6a1b26fa19f..79ed3b52215 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -373,6 +373,11 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; +// Add HAVING from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= !empty($hookmanager->resPrint) ? (' HAVING 1=1 ' . $hookmanager->resPrint) : ''; + $sql .= $db->order($sortfield, $sortorder); $nbtotalofrecords = ''; From 202b123aaaf0d5b5615e607d364a9009b38850b7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 2 Dec 2021 15:10:29 +0100 Subject: [PATCH 02/16] FIX compatibility with multicompany --- htdocs/societe/card.php | 4 ++-- htdocs/societe/website.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index e5a624ec07f..fdff7c1940a 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -900,7 +900,7 @@ if (empty($reshook)) { // Actions to build doc $id = $socid; - $upload_dir = $conf->societe->dir_output; + $upload_dir = $conf->societe->multidir_output[$object->entity]; $permissiontoadd = $user->rights->societe->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } @@ -3006,7 +3006,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Presend form $modelmail = 'thirdparty'; $defaulttopic = 'Information'; - $diroutput = $conf->societe->dir_output; + $diroutput = $conf->societe->multidir_output[$object->entity]; $trackid = 'thi'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 0740200867d..7d79a429eea 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -159,7 +159,7 @@ if (empty($reshook)) { $objectlabel = 'WebsiteAccount'; $permissiontoread = $user->rights->societe->lire; $permissiontodelete = $user->rights->societe->supprimer; - $uploaddir = $conf->societe->dir_output; + $uploaddir = $conf->societe->multidir_output[$object->entity]; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } From 075faded4760fde81266a01c4cc17822d0382155 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Oct 2021 11:58:21 +0200 Subject: [PATCH 03/16] FIX list of categories in stats of supplier invoices Conflicts: htdocs/compta/facture/stats/index.php --- htdocs/compta/facture/stats/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index a42003e3c2a..8a32077cb54 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -309,7 +309,7 @@ if (!empty($conf->category->enabled)) { $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier")); } print ''.$cat_label.''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1); + $cate_arbo = $form->select_all_categories($cat_type, null, 'parent', null, null, 1); print img_picto('', 'category', 'class="pictofixedwidth"'); print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), 0, 0, 'widthcentpercentminusx maxwidth300'); //print $formother->select_categories($cat_type, $categ_id, 'categ_id', true); From 7e835ec91534435873758e7ba110537e092c7559 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Dec 2021 19:06:44 +0100 Subject: [PATCH 04/16] Fix css --- htdocs/theme/eldy/info-box.inc.php | 12 ++++++------ htdocs/theme/md/info-box.inc.php | 31 +++++++++++++++--------------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 3fe2552c86a..40a62dbf18a 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -330,15 +330,15 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) { color: #b06080 !important; } /* Color for customer object */ -.infobox-propal:not(.pictotitle), -.infobox-facture:not(.pictotitle), -.infobox-commande:not(.pictotitle) { +.infobox-propal:not(.pictotitle):not(.error), +.infobox-facture:not(.pictotitle):not(.error), +.infobox-commande:not(.pictotitle):not(.error) { color: #65953d !important; } /* Color for vendor object */ -.infobox-supplier_proposal:not(.pictotitle), -.infobox-invoice_supplier:not(.pictotitle), -.infobox-order_supplier:not(.pictotitle){ +.infobox-supplier_proposal:not(.pictotitle):not(.error), +.infobox-invoice_supplier:not(.pictotitle):not(.error), +.infobox-order_supplier:not(.pictotitle):not(.error) { color: #599caf !important; } .infobox-contrat, .infobox-ticket{ diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index a363475c409..02f263900c6 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -28,7 +28,7 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) { ?> .customer-back { - background-color: #99a17d !important; + background-color: #65953d !important; color: #FFF !important; padding: 2px; margin: 2px; @@ -56,15 +56,11 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) { .bg-infobox-action{ color: #a47080 !important; } -.bg-infobox-propal, -.bg-infobox-facture, -.bg-infobox-commande{ - color: #99a17d !important; +.bg-infobox-propal, .bg-infobox-facture, .bg-infobox-commande { + color: #65953d !important; } -.bg-infobox-supplier_proposal, -.bg-infobox-invoice_supplier, -.bg-infobox-order_supplier{ - color: #599caf !important; +.bg-infobox-supplier_proposal, .bg-infobox-invoice_supplier, .bg-infobox-order_supplier { + color: #599caf !important; } .bg-infobox-contrat, .bg-infobox-ticket{ color: #46a676 !important; @@ -92,16 +88,19 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) { .infobox-action{ color: #a47080 !important; } -.infobox-propal, -.infobox-facture, -.infobox-commande{ - color: #99a17d !important; +/* Color for customer object */ +.infobox-propal:not(.pictotitle):not(.error), +.infobox-facture:not(.pictotitle):not(.error), +.infobox-commande:not(.pictotitle):not(.error) { + color: #65953d !important; } -.infobox-supplier_proposal, -.infobox-invoice_supplier, -.infobox-order_supplier{ +/* Color for vendor object */ +.infobox-supplier_proposal:not(.pictotitle):not(.error), +.infobox-invoice_supplier:not(.pictotitle):not(.error), +.infobox-order_supplier:not(.pictotitle):not(.error) { color: #599caf !important; } + .infobox-contrat, .infobox-ticket{ color: #46a676 !important; } From 2b505ec9b8da63035e8c67739a5476ed640e6fca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Dec 2021 13:01:05 +0100 Subject: [PATCH 05/16] Fix can read category if can run takepos. --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 36feaf79a6e..13e5269d42a 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2483,7 +2483,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, if (empty($entity) || empty($conf->categorie->multidir_output[$entity])) { return array('accessallowed'=>0, 'error'=>'Value entity must be provided'); } - if ($fuser->rights->categorie->{$lire}) { + if ($fuser->rights->categorie->{$lire} || $fuser->rights->takepos->run) { $accessallowed = 1; } $original_file = $conf->categorie->multidir_output[$entity].'/'.$original_file; From 305d8af76a6658a81fb19d7792b30bb65bf929c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Dec 2021 14:58:07 +0100 Subject: [PATCH 06/16] Fix use a standard link insted of js to open a window. --- htdocs/takepos/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 1956166cf60..e97a3f72cbb 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -864,7 +864,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {