From 62faa8ebcc2093ea82d8b3b240a4ffbe6ecc948f Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 27 Jul 2022 11:27:23 +0200 Subject: [PATCH 1/4] FIX - PHP8 Warnning --- htdocs/core/actions_setmoduleoptions.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_setmoduleoptions.inc.php b/htdocs/core/actions_setmoduleoptions.inc.php index fbf526fd58e..0f87998e70c 100644 --- a/htdocs/core/actions_setmoduleoptions.inc.php +++ b/htdocs/core/actions_setmoduleoptions.inc.php @@ -41,7 +41,7 @@ if ($action == 'update' && is_array($arrayofparameters) && !empty($user->admin)) foreach ($arrayofparameters as $key => $val) { // Modify constant only if key was posted (avoid resetting key to the null value) if (GETPOSTISSET($key)) { - if (preg_match('/category:/', $val['type'])) { + if (isset($val['type']) && preg_match('/category:/', $val['type'])) { if (GETPOST($key, 'int') == '-1') { $val_const = ''; } else { From 487729cfff443cdabc92044004bb77a429b6a463 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 27 Jul 2022 11:30:15 +0200 Subject: [PATCH 2/4] error --- htdocs/core/actions_setmoduleoptions.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_setmoduleoptions.inc.php b/htdocs/core/actions_setmoduleoptions.inc.php index 0f87998e70c..fbf526fd58e 100644 --- a/htdocs/core/actions_setmoduleoptions.inc.php +++ b/htdocs/core/actions_setmoduleoptions.inc.php @@ -41,7 +41,7 @@ if ($action == 'update' && is_array($arrayofparameters) && !empty($user->admin)) foreach ($arrayofparameters as $key => $val) { // Modify constant only if key was posted (avoid resetting key to the null value) if (GETPOSTISSET($key)) { - if (isset($val['type']) && preg_match('/category:/', $val['type'])) { + if (preg_match('/category:/', $val['type'])) { if (GETPOST($key, 'int') == '-1') { $val_const = ''; } else { From 5f03e91d9a9781b7914598605a820328ca6f13cb Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 27 Jul 2022 12:00:36 +0200 Subject: [PATCH 3/4] c --- ChangeLog | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 76709bd8f85..763d8a0920c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,25 +30,23 @@ For users: NEW: PHP 8.1 compatibility NEW: Support for recurring purchase invoices. NEW: #20292 Include German public holidays -NEW: Can show ZATCA QRCode on PDFs -NEW: Can show Swiss QR Code on PDFs +NEW: Can show ZATCA QR-Code on PDFs +NEW: Can show Swiss QR-Code on PDFs NEW: #17123 added ExtraFields for Stock Mouvement -NEW: #20609 : new massaction to assign a sale representatives on a selection of thirdparties +NEW: #20609 new massaction to assign a sale representatives on a selection of thirdparties NEW: #20653 edit discount pourcentage for all lines in one shot NEW: Accept 'auto' for ref of object on import of purchase order/proposal NEW: Accountancy - Add more filters and info on page to bind accounting accounts -NEW: Accountancy - Add subledger account when we generate a transaction with a deposit invoice +NEW: Accountancy - Add subledger account when generate a transaction with a deposit invoice NEW: Accountancy - Add a massaction to preselect an account (customer and supplier list) NEW: ACE Editor is restored at same cursor position after a save. NEW: Add "addMoreActionsButtons" hook to subscription form NEW: Add an option in GUI to show a Quick add button into top menu bar -NEW: Module Recruitment - Add a public page with all list of open job positions. -NEW: Module Recruitment - Add a tab with list of application on the jobposition file. NEW: Add a workflow to auto link contract on a ticket NEW: Add column date of Signature on proposal list NEW: Add column template invoice in invoice list NEW: Add column "Total HT" to products array on document creation card -NEW: ADD configuration for text color of button action +NEW: Add configuration for text color of button action NEW: Add constant to hide categories in TakePos NEW: Add constant to show category description in TakePos NEW: Add constant to show only the products in stock in TakePos @@ -56,7 +54,7 @@ NEW: Add entity filter in exports NEW: Show the event block on recurring invoices #20870 NEW: Add filter "opportunity status" on statistics of projects. NEW: Add firstname, lastname and max number of attendees for module "Event Organization" -NEW: add margin info in proposal and order list +NEW: Add margin info in proposal and order list NEW: Add massaction "Edit Extrafield" for Product NEW: Add more fields to detect duplicate during import of thirdparties NEW: Add option to foce delivery on email for purchase order receipt to yes @@ -67,14 +65,12 @@ NEW: Add possibility with constant MAIN_LOGIN_BADCHARUNAUTHORIZED to define bad NEW: Add private and public notes on tax files. NEW: Add status "Obsolete" to KM articles NEW: Add substitutions "user numbers" -NEW: Add the possibility to add sub-BOMs to BOM NEW: allow a ticket to be automatically marked as read when created from backend. NEW: allow cut&paste as real numeric value to excel NEW: A public form to send a message and create a lead is available NEW: automatically set totally received status in reception NEW: Auto set invoice paid when adding credit not and remain to pay is 0 NEW: Availibility dictionnary has a new column unit and number -NEW: barcode rule to insert product in takepos NEW: Can change value of AWP during the inventory NEW: Can enter price with tax for predefined products on purchase objects NEW: Can filter on a thirdparty on product statistics @@ -90,7 +86,7 @@ NEW: create third-party with contact if not found on public ticket NEW: Default value for MAIN_SECURITY_CSRF_WITH_TOKEN is now 2 (GET are also protected agains CSRF attacks) NEW: deposit payment terms: add field into dictionary admin page to define default percentage of deposit. NEW: Dictionaries - add possibility to manage countries in EEC -NEW: display errors in a message box after generating documents +NEW: Display errors in a message box after generating documents NEW: Display physical and virtual stock of the products when creating OF from a BOM NEW: Display product ref in "Object link" product tab for BOM NEW: Enhance the import. Can use 'auto' for the ref (import of orders) @@ -102,10 +98,13 @@ NEW: leave requests: add field into type dictionary to block request if balance NEW: MAIN_MAIL_AUTOCOPY_TO can accept several email and special keys NEW: MAIN_SEARCH_CAT_OR_BY_DEFAULT const for search by category NEW: Mass action "Close shipments" +NEW: Module BOM - Add tabs for nets Bom +NEW: Module BOM - Add the possibility to add sub-BOMs to BOM +NEW: Module Recruitment - Add a public page with all list of open job positions. +NEW: Module Recruitment - Add a tab with list of application on the jobposition file. NEW: Module website now supports the multicompany module NEW: More mode for THEME_TOPMENU_DISABLE_IMAGE (2, 3, ...) NEW: Add option to move checkbox column as first column on Thirdparty list (only few screens) -NEW: Add tabs for nets Bom NEW: on redirect of page in website module, GET parameters are kept. NEW: optional display warning icons on ticket list NEW: option to default check "notify tier at creation" in ticket module @@ -117,15 +116,15 @@ NEW: Send email to the supplier order contact NEW: New permission to report time on timesheet. NEW: SEPA XML - option to place payment Type Info at Credit transfer Transaction level NEW: Show number of votes into the label of tab "Results" of a survey -NEW: Show product reference in Takepos NEW: Some core tables are created only at module activation NEW: split consumption line on MO NEW: stock filter in reassort lists NEW: stock limit in stock export CSV -NEW: Sub-bom are availables NEW: Supplier order - Show ref supplier of reception in linked object block NEW: support user_modif in order -NEW: TakePos - pagination on search results +NEW: TakePOS - barcode rule to insert product in TakePOS +NEW: TakePOS - pagination on search results +NEW: TakePOS - show product reference NEW: The backup tools has an "lowmemory" option for mysqldump on large database NEW: The 'reposition' class works on ajax constantonoff that make redirects NEW: Thirdparty - Add rules "customer accountancy code" is mandatory to validate invoice @@ -140,7 +139,7 @@ NEW: Added MMK currency (Myanmar Kyat) Modules NEW: Module Partnership Management -NEW: Experimental module Event Organization Management +NEW: Experimental Module Event Organization Management For developers or integrators: @@ -155,7 +154,6 @@ NEW: Suggest a way to run upgrade per entities. NEW: Support html content for multiselect component. NEW: ModuleBuilder - Add tabs view in module builder NEW: ModuleBuilder - More feature that can be modifed after module generation -NEW: Hook getNomUrl available everywhere in tooltip of ref links NEW: Identification of tr is possible with by attribute data-id on some pages NEW: Import with select boxes V2 NEW: Can update rank of invoice, proposal and order lines with API update @@ -182,6 +180,9 @@ NEW: Add a protection into PHPunit to avoid to forget a var_dump NEW: Add datem and type parameters to API to create movements NEW: Add hidden option on contract PDF line to hide qty and price NEW: Option MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND to send last document in mass mailing action + +Hooks: +NEW: Hook getNomUrl available everywhere in tooltip of ref links NEW: Add hooks: selectContactListWhere hook, selectThirdpartyListWhere hook NEW: TakePos - add hooks complete product display NEW: TakePos - add hooks for cart display From d8ae2361a984f0c3e337c96262ec488cc9cc7cf0 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Thu, 28 Jul 2022 11:29:36 +0200 Subject: [PATCH 4/4] NEW - Add user right order generete doc --- htdocs/commande/card.php | 7 ++++--- htdocs/core/actions_builddoc.inc.php | 2 +- htdocs/core/modules/modCommande.class.php | 10 +++++++++- htdocs/langs/en_US/admin.lang | 1 + 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 668787349be..a85aa2c5f77 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -108,14 +108,15 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once -$usercanread = $user->rights->commande->lire; -$usercancreate = $user->rights->commande->creer; -$usercandelete = $user->rights->commande->supprimer; +$usercanread = $user->hasRight('commande', 'lire'); +$usercancreate = $user->hasRight('commande', 'creer'); +$usercandelete = $user->hasRight('commande', 'supprimer'); // Advanced permissions $usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->close))); $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->validate))); $usercancancel = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->annuler))); $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send); +$usercangeneretedoc = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->hasRight('commande', 'order_advance', 'generetedoc')); $usercancreatepurchaseorder = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); diff --git a/htdocs/core/actions_builddoc.inc.php b/htdocs/core/actions_builddoc.inc.php index 69d46dae51c..385b36bdbce 100644 --- a/htdocs/core/actions_builddoc.inc.php +++ b/htdocs/core/actions_builddoc.inc.php @@ -34,7 +34,7 @@ if (!empty($permissioncreate) && empty($permissiontoadd)) { } // Build doc -if ($action == 'builddoc' && $permissiontoadd) { +if ($action == 'builddoc' && ($permissiontoadd || !empty($usercangeneretedoc))) { if (is_numeric(GETPOST('model', 'alpha'))) { $error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Model")); } else { diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index e75147ba78a..70f06169394 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -139,9 +139,17 @@ class modCommande extends DolibarrModules $this->rights[$r][4] = 'order_advance'; $this->rights[$r][5] = 'validate'; + $r++; + $this->rights[$r][0] = 85; + $this->rights[$r][1] = 'Generate the documents sales orders'; + $this->rights[$r][2] = 'd'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'order_advance'; + $this->rights[$r][5] = 'generetedoc'; + $r++; $this->rights[$r][0] = 86; - $this->rights[$r][1] = 'Send sale orders by email'; + $this->rights[$r][1] = 'Send sales orders by email'; $this->rights[$r][2] = 'd'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'order_advance'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 16c39de46b9..f004079ea09 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -739,6 +739,7 @@ Permission79=Create/modify subscriptions Permission81=Read customers orders Permission82=Create/modify customers orders Permission84=Validate customers orders +Permission85=Generate the documents sales orders Permission86=Send customers orders Permission87=Close customers orders Permission88=Cancel customers orders