diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index eee47cd32a7..5fb6da2123b 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4428,7 +4428,7 @@ class OrderLine extends CommonOrderLine dol_syslog("OrderLine::delete", LOG_DEBUG); $resql = $this->db->query($sql); - if ($resql) { + if (!$resql) { $this->error = $this->db->lasterror(); $error++; } diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 75586bbb69e..b88993ccc92 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -90,7 +90,7 @@ class modStock extends DolibarrModules $this->const[$r][0] = "MOUVEMENT_ADDON_PDF"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "stdmovement"; - $this->const[$r][3] = 'Name of PDF model of stock mouvement'; + $this->const[$r][3] = 'Name of PDF model of stock movement'; $this->const[$r][4] = 0; $r++; @@ -114,78 +114,82 @@ class modStock extends DolibarrModules $this->rights = array(); $this->rights_class = 'stock'; - $this->rights[0][0] = 1001; - $this->rights[0][1] = 'Lire les stocks'; - $this->rights[0][2] = 'r'; - $this->rights[0][3] = 0; - $this->rights[0][4] = 'lire'; - $this->rights[0][5] = ''; + $r = 0; - $this->rights[1][0] = 1002; - $this->rights[1][1] = 'Creer/Modifier les stocks'; - $this->rights[1][2] = 'w'; - $this->rights[1][3] = 0; - $this->rights[1][4] = 'creer'; - $this->rights[1][5] = ''; + $this->rights[$r][0] = 1001; + $this->rights[$r][1] = 'Read stocks'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'lire'; + $this->rights[$r][5] = ''; - $this->rights[2][0] = 1003; - $this->rights[2][1] = 'Supprimer les stocks'; - $this->rights[2][2] = 'd'; - $this->rights[2][3] = 0; - $this->rights[2][4] = 'supprimer'; - $this->rights[2][5] = ''; + $r++; + $this->rights[$r][0] = 1002; + $this->rights[$r][1] = 'Create/Modify stocks'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'creer'; + $this->rights[$r][5] = ''; - $this->rights[3][0] = 1004; - $this->rights[3][1] = 'Lire movements de stocks'; - $this->rights[3][2] = 'r'; - $this->rights[3][3] = 0; - $this->rights[3][4] = 'mouvement'; - $this->rights[3][5] = 'lire'; + $r++; + $this->rights[$r][0] = 1003; + $this->rights[$r][1] = 'Delete stock'; + $this->rights[$r][2] = 'd'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'supprimer'; + $this->rights[$r][5] = ''; - $this->rights[4][0] = 1005; - $this->rights[4][1] = 'Creer/modifier movements de stocks'; - $this->rights[4][2] = 'w'; - $this->rights[4][3] = 0; - $this->rights[4][4] = 'mouvement'; - $this->rights[4][5] = 'creer'; + $r++; + $this->rights[$r][0] = 1004; + $this->rights[$r][1] = 'Read stock movements'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'mouvement'; + $this->rights[$r][5] = 'lire'; - $this->rights[5][0] = 1011; - $this->rights[5][1] = 'inventoryReadPermission'; // Permission label - $this->rights[5][3] = 0; // Permission by default for new user (0/1) - $this->rights[5][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[5][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $r++; + $this->rights[$r][0] = 1005; + $this->rights[$r][1] = 'Create/modify stock movements'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'mouvement'; + $this->rights[$r][5] = 'creer'; - $this->rights[6][0] = 1012; - $this->rights[6][1] = 'inventoryCreatePermission'; // 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] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $r++; + $this->rights[$r][0] = 1011; + $this->rights[$r][1] = 'inventoryReadPermission'; // Permission label + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[$r][5] = 'read'; // 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) + $r++; + $this->rights[$r][0] = 1012; + $this->rights[$r][1] = 'inventoryCreatePermission'; // Permission label + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $r++; + $this->rights[$r][0] = 1013; + $this->rights[$r][1] = 'inventoryDeletePermission'; // Permission label + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - $this->rights[8][0] = 1014; - $this->rights[8][1] = 'inventoryValidatePermission'; // Permission label - $this->rights[8][3] = 0; // Permission by default for new user (0/1) - $this->rights[8][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[8][5] = 'validate'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $r++; + $this->rights[$r][0] = 1014; + $this->rights[$r][1] = 'inventoryValidatePermission'; // Permission label + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[$r][5] = 'validate'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[9][0] = 1015; - $this->rights[9][1] = 'inventoryChangePMPPermission'; // Permission label - $this->rights[9][3] = 0; // Permission by default for new user (0/1) - $this->rights[9][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[9][5] = 'changePMP'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - - $this->rights[10][0] = 1016; - $this->rights[10][1] = 'inventoryDeletePermission'; // Permission label - $this->rights[10][3] = 0; // Permission by default for new user (0/1) - $this->rights[10][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[10][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $r++; + $this->rights[$r][0] = 1015; + $this->rights[$r][1] = 'inventoryChangePMPPermission'; // Permission label + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[$r][5] = 'changePMP'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) } // Main menu entries diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index c25fd3bff9c..f61929f2111 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -474,11 +474,11 @@ class Export case 'FormSelect': //var_dump($NameField); if ($InfoFieldList[1] == 'select_company') { - $szFilterField .= $form->select_company('', $NameField, '', 1); + $szFilterField .= $form->select_company('', $NameField, '', 1, 0, 0, [], 0, 'maxwidth200'); } elseif ($InfoFieldList[1] == 'selectcontacts') { - $szFilterField .= $form->selectcontacts(0, '', $NameField, ' '); + $szFilterField .= $form->selectcontacts(0, '', $NameField, ' ', '', '', 0, 'maxwidth200'); } elseif ($InfoFieldList[1] == 'select_dolusers') { - $szFilterField .= $form->select_dolusers('', $NameField, 1); + $szFilterField .= $form->select_dolusers('', $NameField, 1, null, 0, '', '', '', 0, 0, "", 0, "", "maxwidth200"); } break; case 'List': diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index c1b8404d22b..3817273ab6f 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -683,17 +683,17 @@ if (!empty($searchCategoryProductList)) { $listofcategoryid = ''; foreach ($searchCategoryProductList as $searchCategoryProduct) { if (intval($searchCategoryProduct) == -2) { - $searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND p.rowid = ck.fk_product)"; + $searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND fd.fk_product = ck.fk_product)"; } elseif (intval($searchCategoryProduct) > 0) { if ($searchCategoryProductOperator == 0) { - $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND p.rowid = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")"; + $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")"; } else { $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct); } } } if ($listofcategoryid) { - $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND p.rowid = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))"; + $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))"; } if ($searchCategoryProductOperator == 1) { if (!empty($searchCategoryProductSqlList)) { diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index d5364fb6f67..ee8fc25c00d 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -160,7 +160,7 @@ if ($id > 0 || $ref) { $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); print dol_get_fiche_head($head, 'agenda', $titre, -1, $picto); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter = "fk_product_type = ".((int) $object->type); $shownav = 1; diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 0292732aefc..15683457b6c 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -232,7 +232,7 @@ if ($id > 0 || !empty($ref)) { * Product card */ if ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire')) { - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $shownav = 1; if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) { diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 1435fa74b3a..e60b84b807b 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -239,7 +239,7 @@ if ($object->id) { } - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter = "fk_product_type = ".((int) $object->type); $shownav = 1; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index f9fcdab2709..646c8fc7fef 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -391,7 +391,7 @@ if ($id > 0 || $ref) { print dol_get_fiche_head($head, 'suppliers', $titre, -1, $picto); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter = "fk_product_type = ".((int) $object->type); $shownav = 1; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 17eed6cc980..d301a23b881 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -874,11 +874,11 @@ if ($type === "") { $params['forcenohideoftext'] = 1; } $newcardbutton .= dolGetButtonTitleSeparator(); -if ($type === "" || $type == Product::TYPE_PRODUCT) { +if ((isModEnabled('product') && $type === "") || $type == Product::TYPE_PRODUCT) { $label = 'NewProduct'; $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0', '', $perm, $params); } -if ($type === "" || $type == Product::TYPE_SERVICE) { +if ((isModEnabled('service') && $type === "") || $type == Product::TYPE_SERVICE) { $label = 'NewService'; $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=1', '', $perm, $params); } diff --git a/htdocs/product/note.php b/htdocs/product/note.php index c8348552835..6df3e689131 100644 --- a/htdocs/product/note.php +++ b/htdocs/product/note.php @@ -122,7 +122,7 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_head($head, 'note', $titre, -1, $picto); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter = "fk_product_type = ".((int) $object->type); $shownav = 1; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 2ad194f3413..075ebd97277 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -893,7 +893,7 @@ $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); print dol_get_fiche_head($head, 'price', $titre, -1, $picto); -$linkback = ''.$langs->trans("BackToList").''; +$linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter = "fk_product_type = ".((int) $object->type); $shownav = 1; diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 9f298b9d438..b8f92b87fa6 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -148,7 +148,7 @@ if ($result && ($id > 0 || !empty($ref)) && empty($notab)) { print dol_get_fiche_head($head, 'stats', $titre, -1, $picto); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', '', '', '', 0, '', '', 1); diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index c44e95eae64..3dcc2ad3d98 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -164,7 +164,7 @@ if ($id > 0 || !empty($ref)) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $shownav = 1; if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) { diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 1a33d36a1f5..39f35080378 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -612,7 +612,7 @@ if ($id > 0 || $ref) { dol_htmloutput_events(); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $shownav = 1; if ($user->socid && !in_array('stock', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) { diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 008e5af8ebd..24f2dfd6f51 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -212,7 +212,7 @@ if (!empty($object->multilangs)) { print dol_get_fiche_head($head, 'translation', $titre, 0, $picto); -$linkback = ''.$langs->trans("BackToList").''; +$linkback = ''.$langs->trans("BackToList").''; $shownav = 1; if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) {