From f5702f7710aad440e3d9c100dc9ab2a60e1d192f Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 13 Nov 2023 21:01:44 +0100 Subject: [PATCH 01/26] FIX Social contribution - Payment list - Wrong information in type column (#26561) --- htdocs/compta/sociales/payments.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index ee23d52ae99..eb19526e858 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -288,7 +288,7 @@ while ($i < min($num, $limit)) { print $socialcontrib->getNomUrl(1, ''); print ''; // Type - print ''.$obj->label_sc.''; + print ''.$obj->type_label.''; // Date $date = $obj->periode; if (empty($date)) { From a97335ce3a4f61f5bab26703ff6e74fb1f5faf3a Mon Sep 17 00:00:00 2001 From: thibdrev Date: Tue, 14 Nov 2023 02:05:40 +0100 Subject: [PATCH 02/26] fix Customer Invoice - Display payment delete button solely if payment isn't reconciled (#26568) * add function isReconciled() * display payment delete button solely if payment isn't reconciled * phpcs * phpcs --- htdocs/compta/facture/card.php | 5 ++++- htdocs/compta/paiement/class/paiement.class.php | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 0d7dfc29d33..2ccb6828f16 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5219,7 +5219,10 @@ if ($action == 'create') { } print ''.price($sign * $objp->amount).''; print ''; - if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0) { + + $paiement = new Paiement($db); + $paiement->fetch($objp->rowid); + if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0 && !$paiement->isReconciled()) { print 'rowid.'">'; print img_delete(); print ''; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 0d4c6086578..0fb163b8dfe 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -1400,4 +1400,18 @@ class Paiement extends CommonObject return parent::fetch_thirdparty($force_thirdparty_id); } + + + /** + * Return if payment is reconciled + * + * @return boolean True if payment is reconciled + */ + public function isReconciled() + { + $accountline = new AccountLine($this->db); + $accountline->fetch($this->bank_line); + return $accountline->rappro; + } + } From c81f7a01d14e4d5b17a70004e84fc79d0dfb7d3b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Nov 2023 02:26:33 +0100 Subject: [PATCH 03/26] FIX #26518 --- htdocs/contact/class/contact.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 255da7981f2..975970c3a2f 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -118,7 +118,7 @@ class Contact extends CommonObject 'priv' =>array('type'=>'smallint(6)', 'label'=>'ContactVisibility', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>175), 'fk_stcommcontact' =>array('type'=>'integer', 'label'=>'ProspectStatus', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220), 'fk_prospectcontactlevel' =>array('type'=>'varchar(12)', 'label'=>'ProspectLevel', 'enabled'=>1, 'visible'=>-1, 'position'=>255), - 'no_email' =>array('type'=>'smallint(6)', 'label'=>'No_Email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180), + //no more used. Replace by a scan of email into mailing_unsubscribe. 'no_email' =>array('type'=>'smallint(6)', 'label'=>'No_Email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180), 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>3, 'position'=>195, 'searchall'=>1), 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>3, 'position'=>200, 'searchall'=>1), 'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>3, 'position'=>205), @@ -235,6 +235,7 @@ class Contact extends CommonObject /** * Unsuscribe all : 1 = contact has globaly unsubscribe of all mass emailings * @var int + * @deprecated Has been replaced by a search into ll_xmailing_unsubscribe */ public $no_email; From 1ba7d135e0650c60c6f533f647e3dddb82118050 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Tue, 14 Nov 2023 14:29:25 +0100 Subject: [PATCH 04/26] delete method isReconciled() because it is now inherited (#26591) --- htdocs/fourn/class/paiementfourn.class.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 967201e2c10..e8d6138b85f 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -917,17 +917,4 @@ class PaiementFourn extends Paiement return parent::fetch_thirdparty($force_thirdparty_id); } - - - /** - * Return if payment is reconciled - * - * @return boolean True if payment is reconciled - */ - public function isReconciled() - { - $accountline = new AccountLine($this->db); - $accountline->fetch($this->bank_line); - return $accountline->rappro; - } } From 966e26e450cb97dbf0ac5807ada110df726d66eb Mon Sep 17 00:00:00 2001 From: atm-sami <139965072+atm-sami@users.noreply.github.com> Date: Tue, 14 Nov 2023 14:53:40 +0100 Subject: [PATCH 05/26] FIX add display of an error when attempting to delete a committed transaction (#26573) * add display of an error when attempting to delete a committed transaction * update --- htdocs/accountancy/bookkeeping/list.php | 6 +++++- htdocs/accountancy/bookkeeping/listbyaccount.php | 6 +++++- htdocs/accountancy/class/bookkeeping.class.php | 2 +- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/fr_FR/main.lang | 1 + 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index b57e0a10157..20f96eefa25 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -519,7 +519,11 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); $error++; break; - } + } elseif (isset($object->date_validation) || $object->date_validation != '') { + setEventMessages($langs->trans("ValidatedRecordWhereFound"), null, 'errors'); + $error++; + break; + } } } diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 29596f0a124..cb3c1a72d53 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -430,7 +430,11 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); $error++; break; - } + } elseif (isset($object->date_validation) || $object->date_validation != '') { + setEventMessages($langs->trans("ValidatedRecordWhereFound"), null, 'errors'); + $error++; + break; + } } } diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 95ba38d20bb..021eabe999e 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -798,7 +798,7 @@ class BookKeeping extends CommonObject $this->piece_num = $obj->piece_num; $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_export = $this->db->jdate($obj->date_export); - $this->date_validation = isset($obj->date_validated) ? $this->db->jdate($obj->date_validated) : ''; + $this->date_validation = isset($obj->date_validation) ? $this->db->jdate($obj->date_validation) : ''; } $this->db->free($resql); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index b4745e1b919..fb3aee34fc8 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -719,6 +719,7 @@ RecordModifiedSuccessfully=Record modified successfully RecordsModified=%s record(s) modified RecordsDeleted=%s record(s) deleted RecordsGenerated=%s record(s) generated +ValidatedRecordWhereFound = Some of the selected records have already been validated. No records have been deleted. AutomaticCode=Automatic code FeatureDisabled=Feature disabled MoveBox=Move widget diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 619dde3f5a1..85768a68a70 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -717,6 +717,7 @@ RecordModifiedSuccessfully=Enregistrement modifié avec succès RecordsModified=%s enregistrements modifiés RecordsDeleted=%s enregistrement(s) supprimé(s) RecordsGenerated=%s enregistrement(s) généré(s) +ValidatedRecordWhereFound = Certains des enregistrements sélectionnés ont déjà été validés. Aucun enregistrement n'a été supprimé. AutomaticCode=Création automatique du code FeatureDisabled=Fonction désactivée MoveBox=Déplacer le widget From a1c040dcc1282aa6c526807090bb04ccf1720881 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Nov 2023 23:52:48 +0100 Subject: [PATCH 06/26] Doc --- htdocs/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/index.php b/htdocs/index.php index 7d047f69ffd..491fba6ebcc 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -205,14 +205,14 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { $dashboardlines[$board->element.'_signed'] = $board->load_board($user, "signed"); } - // Number of sales orders a deal + // Number of sales orders if (isModEnabled('commande') && empty($conf->global->MAIN_DISABLE_BLOCK_CUSTOMER) && $user->hasRight('commande', 'lire')) { include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $board = new Commande($db); $dashboardlines[$board->element] = $board->load_board($user); } - // Number of suppliers orders a deal + // Number of suppliers orders if (isModEnabled('supplier_order') && empty($conf->global->MAIN_DISABLE_BLOCK_SUPPLIER) && $user->hasRight('fournisseur', 'commande', 'lire')) { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; $board = new CommandeFournisseur($db); From 06915267a7915cb8ebad79f6272a9028bb2001ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Thu, 16 Nov 2023 14:59:07 +0100 Subject: [PATCH 07/26] Fix #26620 (#26622) Fix calculation of total amount of multicurrency --- htdocs/expedition/class/expedition.class.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 3f27fd35f88..dc69886bab7 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1616,6 +1616,10 @@ class Expedition extends CommonObject $this->total_localtax1 = 0; $this->total_localtax2 = 0; + $this->multicurrency_total_ht = 0; + $this->multicurrency_total_tva = 0; + $this->multicurrency_total_ttc = 0; + $shipmentlinebatch = new ExpeditionLineBatch($this->db); while ($i < $num) { @@ -1704,10 +1708,14 @@ class Expedition extends CommonObject // Multicurrency $this->fk_multicurrency = $obj->fk_multicurrency; $this->multicurrency_code = $obj->multicurrency_code; - $this->multicurrency_subprice = $obj->multicurrency_subprice; - $this->multicurrency_total_ht = $obj->multicurrency_total_ht; - $this->multicurrency_total_tva = $obj->multicurrency_total_tva; - $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; + $line->multicurrency_subprice = $obj->multicurrency_subprice; + $line->multicurrency_total_ht = $obj->multicurrency_total_ht; + $line->multicurrency_total_tva = $obj->multicurrency_total_tva; + $line->multicurrency_total_ttc = $obj->multicurrency_total_ttc; + + $this->multicurrency_total_ht += $obj->multicurrency_total_ht; + $this->multicurrency_total_tva += $obj->multicurrency_total_tva; + $this->multicurrency_total_ttc += $obj->multicurrency_total_ttc; if ($originline != $obj->fk_origin_line) { $line->detail_batch = array(); From d567bdaa53fddf86ee4054f4cc7fc3007b8b5e6a Mon Sep 17 00:00:00 2001 From: Christian Humpel <78662388+Humml87@users.noreply.github.com> Date: Thu, 16 Nov 2023 15:00:13 +0100 Subject: [PATCH 08/26] Integrate 'sqlfilterlines' in API for supplierorders. (#26613) Co-authored-by: christian.humpel --- htdocs/fourn/class/api_supplier_orders.class.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index 503bd908a2d..120b3d9ef99 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -93,11 +93,12 @@ class SupplierOrders extends DolibarrApi * @param string $product_ids Product ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $status Filter by order status : draft | validated | approved | running | received_start | received_end | cancelled | refused * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" + * @param string $sqlfilterlines Other criteria to filter answers separated by a comma. Syntax example "(tl.fk_product:=:'17') and (tl.price:<:'250')" * @return array Array of order objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $product_ids = '', $status = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $product_ids = '', $status = '', $sqlfilters = '', $sqlfilterlines = '') { global $db, $conf; @@ -181,6 +182,16 @@ class SupplierOrders extends DolibarrApi throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } } + // Add sql filters for lines + if ($sqlfilterlines) { + $errormessage = ''; + $sql .= " AND EXISTS (SELECT tl.rowid FROM ".MAIN_DB_PREFIX."commande_fournisseurdet AS tl WHERE tl.fk_commande = t.rowid"; + $sql .= forgeSQLFromUniversalSearchCriteria($sqlfilterlines, $errormessage); + $sql .= ")"; + if ($errormessage) { + throw new RestException(400, 'Error when validating parameter sqlfilterlines -> '.$errormessage); + } + } $sql .= $this->db->order($sortfield, $sortorder); if ($limit) { From df31421e86d120b3a0c827f88ea6b86fadff045a Mon Sep 17 00:00:00 2001 From: Christian Humpel <78662388+Humml87@users.noreply.github.com> Date: Thu, 16 Nov 2023 15:05:32 +0100 Subject: [PATCH 09/26] Integrate 'sqlfilterlines' in API for commande. (#26612) Co-authored-by: christian.humpel --- htdocs/commande/class/api_orders.class.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index b82bd618a42..66e8c2ee957 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -156,12 +156,13 @@ class Orders extends DolibarrApi * @param int $page Page number * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $sqlfilterlines Other criteria to filter answers separated by a comma. Syntax example "(tl.fk_product:=:'17') and (tl.price:<:'250')" * @return array Array of order objects * * @throws RestException 404 Not found * @throws RestException 503 Error */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $sqlfilterlines = '') { global $db, $conf; @@ -212,7 +213,16 @@ class Orders extends DolibarrApi throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } } - + // Add sql filters for lines + if ($sqlfilterlines) { + $errormessage = ''; + $sql .= " AND EXISTS (SELECT tl.rowid FROM ".MAIN_DB_PREFIX."commandedet AS tl WHERE tl.fk_commande = t.rowid"; + $sql .= forgeSQLFromUniversalSearchCriteria($sqlfilterlines, $errormessage); + $sql .= ")"; + if ($errormessage) { + throw new RestException(400, 'Error when validating parameter sqlfilterlines -> '.$errormessage); + } + } $sql .= $this->db->order($sortfield, $sortorder); if ($limit) { if ($page < 0) { From 11ed276fe3f42d799c3f7fa77e92f41f53036c79 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Thu, 16 Nov 2023 15:19:51 +0100 Subject: [PATCH 10/26] fix PRODUCT VARIANTS - Missing translation key for "Combination" (#26618) * Add "Attributes" key to en_US/products.lang * Add "Attributes" key to fr_FR/products.lang * Change langs->trans('Combination') to lang-trans->trans('Attributes') --- htdocs/langs/en_US/products.lang | 1 + htdocs/langs/fr_FR/products.lang | 1 + htdocs/variants/combinations.php | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 327bcdc8af7..e2bcbe62fc3 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -352,6 +352,7 @@ PackagingForThisProductDesc=You will automaticaly purchase a multiple of this qu QtyRecalculatedWithPackaging=The quantity of the line were recalculated according to supplier packaging #Attributes +Attributes=Attributes VariantAttributes=Variant attributes ProductAttributes=Variant attributes for products ProductAttributeName=Variant attribute %s diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index c9ac61c28d0..060f7780a70 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -352,6 +352,7 @@ PackagingForThisProductDesc=Vous achèterez automatiquement un multiple de cette QtyRecalculatedWithPackaging=La quantité de la ligne a été recalculée en fonction de l'emballage du fournisseur #Attributes +Attributes=Attributs VariantAttributes=Attributs de variante ProductAttributes=Attributs de variantes pour les produits ProductAttributeName=Attribut de variante %s diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index ed31ebb9510..ee667ea4c49 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -689,7 +689,7 @@ if (!empty($id) || !empty($ref)) { if (is_array($productCombination2ValuePairs1) && count($productCombination2ValuePairs1)) { ?> - +
fetch($val->fk_prod_attr_val); //print 'rr'.$result1.' '.$result2; if ($result1 > 0 && $result2 > 0) { - print $prodattr->label.' - '.$prodattr_val->value.'
'; + print $prodattr->label.' : '.$prodattr_val->value.'
'; // TODO Add delete link } } @@ -910,7 +910,7 @@ if (!empty($id) || !empty($ref)) { } ?> trans('Product') ?> - trans('Combination') ?> + trans('Attributes') ?> trans('PriceImpact') ?> isProduct()) { print''.$langs->trans('WeightImpact').''; From fdb81c3ceb3275611d1de045ba3d99b085016a04 Mon Sep 17 00:00:00 2001 From: kkhelifa-opendsi Date: Thu, 16 Nov 2023 15:26:51 +0100 Subject: [PATCH 11/26] FIX: Fix set private note (#26610) --- htdocs/core/actions_setnotes.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_setnotes.inc.php b/htdocs/core/actions_setnotes.inc.php index 44fd5754e22..6ce9d3b08b3 100644 --- a/htdocs/core/actions_setnotes.inc.php +++ b/htdocs/core/actions_setnotes.inc.php @@ -81,7 +81,7 @@ if ($action == 'setnote_public' && !empty($permissionnote) && !GETPOST('cancel', if (empty($object->id)) { $object->fetch($id); // Fetch may not be already done } - $result = $object->update_note(dol_html_entity_decode(GETPOST('note_private', 'restricthtml'), ENT_QUOTES | ENT_HTML5), '_private'); + $result = $object->update_note(dol_html_entity_decode(GETPOST('note_private', 'restricthtml'), ENT_QUOTES | ENT_HTML5, 'UTF-8', 1), '_private'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } From 7c43aa86c9b9b72df996073425c0bfda2cbbc35e Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Thu, 16 Nov 2023 15:31:20 +0100 Subject: [PATCH 12/26] fix: mising delete inventory perms with MAIN_USE_ADVANCED_PERMS (#26617) * fix: mising delete inventory perms * fix: mising delete inventory perms --- htdocs/core/modules/modStock.class.php | 7 +++++++ htdocs/langs/en_US/stocks.lang | 2 +- htdocs/product/inventory/card.php | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index e99742a14c4..740bbf6cc7a 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -160,6 +160,13 @@ class modStock extends DolibarrModules $this->rights[6][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[6][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[6][0] = 1013; + $this->rights[6][1] = 'inventoryDeletePermission'; // Permission label + $this->rights[6][3] = 0; // Permission by default for new user (0/1) + $this->rights[6][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[6][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { $this->rights[8][0] = 1014; $this->rights[8][1] = 'inventoryValidatePermission'; // Permission label diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 3ee38749b10..504a637a869 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -317,4 +317,4 @@ StockTransferRightRead=Read stocks transfers StockTransferRightCreateUpdate=Create/Update stocks transfers StockTransferRightDelete=Delete stocks transfers BatchNotFound=Lot / serial not found for this product -WarningThisWIllAlsoDeleteStock=Warning, this will also destroy all quantities in stock in the warehouse \ No newline at end of file +WarningThisWIllAlsoDeleteStock=Warning, this will also destroy all quantities in stock in the warehouse diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 874c1918de2..a16b11a0f5a 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -92,7 +92,7 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { } else { $permissiontoread = $user->rights->stock->inventory_advance->read; $permissiontoadd = $user->rights->stock->inventory_advance->write; - $permissiontodelete = $user->rights->stock->inventory_advance->write; + $permissiontodelete = $user->rights->stock->inventory_advance->delete; $permissionnote = $user->rights->stock->inventory_advance->write; // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->rights->stock->inventory_advance->write; // Used by the include of actions_dellink.inc.php $upload_dir = $conf->stock->multidir_output[isset($object->entity) ? $object->entity : 1]; From 8444c1e389462fac8050f00e9c747e3da919175b Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Thu, 16 Nov 2023 15:41:34 +0100 Subject: [PATCH 13/26] FIX pagination parameters on save and cancel buttons (#26605) --- htdocs/product/inventory/inventory.php | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 40ccee11b4e..4ca3768fa11 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -97,11 +97,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ //$result = restrictedArea($user, 'mymodule', $id); //Parameters Page -$param = '&id='.$object->id; +$paramwithsearch = ''; if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.((int) $limit); + $paramwithsearch .= '&limit='.((int) $limit); } -$paramwithsearch = $param; if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { @@ -459,7 +458,7 @@ if ($action == 'clone') { // Confirmation to close if ($action == 'record') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Close'), $langs->trans('ConfirmFinish'), 'update', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&page='.$page.$paramwithsearch, $langs->trans('Close'), $langs->trans('ConfirmFinish'), 'update', '', 0, 1); $action = 'view'; } @@ -583,13 +582,13 @@ if ($action != 'record') { // Save if ($object->status == $object::STATUS_VALIDATED) { if ($permissiontoadd) { - print ''.$langs->trans("MakeMovementsAndClose").''."\n"; + print ''.$langs->trans("MakeMovementsAndClose").''."\n"; } else { print ''.$langs->trans('MakeMovementsAndClose').''."\n"; } if ($permissiontoadd) { - print ''.$langs->trans("Cancel").''."\n"; + print ''.$langs->trans("Cancel").''."\n"; } } } @@ -990,7 +989,7 @@ if ($resql) { $num = $db->num_rows($resql); if (!empty($limit != 0) || $num > $limit || $page) { - print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num >= $limit), '', '', $limit); + print_fleche_navigation($page, $_SERVER["PHP_SELF"], '&id='.$object->id.$paramwithsearch, ($num >= $limit), '', '', $limit); } $i = 0; @@ -1206,38 +1205,38 @@ print '