From 857454a28db767e792548ae5e0d9316dad01e9a4 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 4 Jun 2016 12:16:30 +0200 Subject: [PATCH 001/470] For each module, no default permission on activation --- htdocs/core/modules/modAdherent.class.php | 4 ++-- htdocs/core/modules/modAgenda.class.php | 2 +- htdocs/core/modules/modApi.class.php | 2 +- htdocs/core/modules/modBanque.class.php | 2 +- htdocs/core/modules/modBookmark.class.php | 6 +++--- htdocs/core/modules/modCashDesk.class.php | 2 +- htdocs/core/modules/modCategorie.class.php | 2 +- htdocs/core/modules/modCommande.class.php | 2 +- htdocs/core/modules/modComptabilite.class.php | 2 +- htdocs/core/modules/modContrat.class.php | 2 +- htdocs/core/modules/modCron.class.php | 2 +- htdocs/core/modules/modDocumentGeneration.class.php | 2 +- htdocs/core/modules/modECM.class.php | 6 +++--- htdocs/core/modules/modExpedition.class.php | 4 ++-- htdocs/core/modules/modExport.class.php | 2 +- htdocs/core/modules/modFTP.class.php | 2 +- htdocs/core/modules/modFacture.class.php | 2 +- htdocs/core/modules/modFicheinter.class.php | 2 +- htdocs/core/modules/modFournisseur.class.php | 6 +++--- htdocs/core/modules/modGravatar.class.php | 2 +- htdocs/core/modules/modHRM.class.php | 6 +++--- htdocs/core/modules/modHoliday.class.php | 4 ++-- htdocs/core/modules/modLoan.class.php | 2 +- htdocs/core/modules/modMailing.class.php | 2 +- htdocs/core/modules/modMargin.class.php | 2 +- htdocs/core/modules/modMultiCurrency.class.php | 2 +- htdocs/core/modules/modOauth.class.php | 2 +- htdocs/core/modules/modPaybox.class.php | 2 +- htdocs/core/modules/modPrelevement.class.php | 2 +- htdocs/core/modules/modPrinting.class.php | 2 +- htdocs/core/modules/modProduct.class.php | 2 +- htdocs/core/modules/modProjet.class.php | 2 +- htdocs/core/modules/modPropale.class.php | 2 +- htdocs/core/modules/modReceiptPrinter.class.php | 2 +- htdocs/core/modules/modResource.class.php | 2 +- htdocs/core/modules/modService.class.php | 2 +- htdocs/core/modules/modSociete.class.php | 6 +++--- htdocs/core/modules/modSupplierProposal.class.php | 4 ++-- htdocs/core/modules/modTax.class.php | 2 +- htdocs/core/modules/modUser.class.php | 8 ++++---- htdocs/core/modules/modWebsites.class.php | 2 +- htdocs/core/modules/modWorkflow.class.php | 2 +- 42 files changed, 59 insertions(+), 59 deletions(-) diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index ea611fe947a..2154d1aab4f 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -209,7 +209,7 @@ class modAdherent extends DolibarrModules $this->rights[$r][0] = 71; $this->rights[$r][1] = 'Read members\' card'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'lire'; $r++; @@ -244,7 +244,7 @@ class modAdherent extends DolibarrModules $this->rights[$r][0] = 78; $this->rights[$r][1] = 'Read subscriptions'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'cotisation'; $this->rights[$r][5] = 'lire'; diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 0d0720d7440..6791a581f6d 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -118,7 +118,7 @@ class modAgenda extends DolibarrModules $this->rights[$r][0] = 2401; $this->rights[$r][1] = 'Read actions/tasks linked to his account'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'myactions'; $this->rights[$r][5] = 'read'; $r++; diff --git a/htdocs/core/modules/modApi.class.php b/htdocs/core/modules/modApi.class.php index 8008590cce7..fc1821fde53 100644 --- a/htdocs/core/modules/modApi.class.php +++ b/htdocs/core/modules/modApi.class.php @@ -155,7 +155,7 @@ class modApi extends DolibarrModules // Example: // $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) // $this->rights[$r][1] = 'Permision label'; // Permission label - // $this->rights[$r][3] = 1; // Permission by default for new user (0/1) + // $this->rights[$r][3] = 0; // Permission by default for new user (0/1) // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $r++; diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index 86c772fe4c8..511289827c3 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -89,7 +89,7 @@ class modBanque extends DolibarrModules $this->rights[$r][0] = 111; // id de la permission $this->rights[$r][1] = 'Lire les comptes bancaires'; // libelle de la permission $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'lire'; $r++; diff --git a/htdocs/core/modules/modBookmark.class.php b/htdocs/core/modules/modBookmark.class.php index 5614ceb53ab..ae913451d49 100644 --- a/htdocs/core/modules/modBookmark.class.php +++ b/htdocs/core/modules/modBookmark.class.php @@ -81,21 +81,21 @@ class modBookmark extends DolibarrModules $this->rights[$r][0] = 331; // id de la permission $this->rights[$r][1] = 'Lire les bookmarks'; // libelle de la permission $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) - $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'lire'; $r++; $this->rights[$r][0] = 332; // id de la permission $this->rights[$r][1] = 'Creer/modifier les bookmarks'; // libelle de la permission $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) - $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'creer'; $r++; $this->rights[$r][0] = 333; // id de la permission $this->rights[$r][1] = 'Supprimer les bookmarks'; // libelle de la permission $this->rights[$r][2] = 'r'; // type de la permission (d�pr�ci� � ce jour) - $this->rights[$r][3] = 1; // La permission est-elle une permission par d�faut + $this->rights[$r][3] = 0; // La permission est-elle une permission par d�faut $this->rights[$r][4] = 'supprimer'; } diff --git a/htdocs/core/modules/modCashDesk.class.php b/htdocs/core/modules/modCashDesk.class.php index 93c0f3016ed..ec8764c9017 100644 --- a/htdocs/core/modules/modCashDesk.class.php +++ b/htdocs/core/modules/modCashDesk.class.php @@ -86,7 +86,7 @@ class modCashDesk extends DolibarrModules $this->rights[$r][0] = 50101; $this->rights[$r][1] = 'Use point of sale'; $this->rights[$r][2] = 'a'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'use'; // Main menu entries diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 17141b6200d..cc6d7ab4337 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -89,7 +89,7 @@ class modCategorie extends DolibarrModules $this->rights[$r][0] = 241; // id de la permission $this->rights[$r][1] = 'Lire les categories'; // libelle de la permission $this->rights[$r][2] = 'r'; // type de la permission (deprecated) - $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'lire'; $r++; diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index ec11708641c..08e191888bb 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -114,7 +114,7 @@ class modCommande extends DolibarrModules $this->rights[$r][0] = 81; $this->rights[$r][1] = 'Lire les commandes clients'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'lire'; $r++; diff --git a/htdocs/core/modules/modComptabilite.class.php b/htdocs/core/modules/modComptabilite.class.php index ca49ab12f7d..c6196ef6ce3 100644 --- a/htdocs/core/modules/modComptabilite.class.php +++ b/htdocs/core/modules/modComptabilite.class.php @@ -91,7 +91,7 @@ class modComptabilite extends DolibarrModules $this->rights[$r][0] = 95; $this->rights[$r][1] = 'Lire CA, bilans, resultats'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'resultat'; $this->rights[$r][5] = 'lire'; } diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php index d298c5aa182..b9546d1a476 100644 --- a/htdocs/core/modules/modContrat.class.php +++ b/htdocs/core/modules/modContrat.class.php @@ -91,7 +91,7 @@ class modContrat extends DolibarrModules $this->rights[$r][0] = 161; $this->rights[$r][1] = 'Lire les contrats'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'lire'; $r++; diff --git a/htdocs/core/modules/modCron.class.php b/htdocs/core/modules/modCron.class.php index 89a90dfc8bd..9b77c736c54 100644 --- a/htdocs/core/modules/modCron.class.php +++ b/htdocs/core/modules/modCron.class.php @@ -108,7 +108,7 @@ class modCron extends DolibarrModules $this->rights[$r][0] = 23001; $this->rights[$r][1] = 'Read cron jobs'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'read'; $r++; diff --git a/htdocs/core/modules/modDocumentGeneration.class.php b/htdocs/core/modules/modDocumentGeneration.class.php index 0648eb8bf0b..541145c0132 100644 --- a/htdocs/core/modules/modDocumentGeneration.class.php +++ b/htdocs/core/modules/modDocumentGeneration.class.php @@ -84,7 +84,7 @@ class modDocumentGeneration extends DolibarrModules $this->rights[$r][0] = 1521; $this->rights[$r][1] = 'Lire les documents'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'lire'; $r++; diff --git a/htdocs/core/modules/modECM.class.php b/htdocs/core/modules/modECM.class.php index 1aa5008032d..b263b16e29e 100644 --- a/htdocs/core/modules/modECM.class.php +++ b/htdocs/core/modules/modECM.class.php @@ -101,21 +101,21 @@ class modECM extends DolibarrModules $this->rights[$r][0] = 2501; $this->rights[$r][1] = 'Consulter/Télécharger les documents'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'read'; $r++; $this->rights[$r][0] = 2503; $this->rights[$r][1] = 'Soumettre ou supprimer des documents'; $this->rights[$r][2] = 'w'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'upload'; $r++; $this->rights[$r][0] = 2515; $this->rights[$r][1] = 'Administrer les rubriques de documents'; $this->rights[$r][2] = 'w'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'setup'; diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index 4f7baff0c64..eacbf9c9862 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -145,7 +145,7 @@ class modExpedition extends DolibarrModules $this->rights[$r][0] = 101; $this->rights[$r][1] = 'Lire les expeditions'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'lire'; $r++; @@ -190,7 +190,7 @@ class modExpedition extends DolibarrModules $this->rights[$r][0] = 1101; $this->rights[$r][1] = 'Lire les bons de livraison'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'livraison'; $this->rights[$r][5] = 'lire'; diff --git a/htdocs/core/modules/modExport.class.php b/htdocs/core/modules/modExport.class.php index e8a6baa8509..c5f2932b3aa 100644 --- a/htdocs/core/modules/modExport.class.php +++ b/htdocs/core/modules/modExport.class.php @@ -81,7 +81,7 @@ class modExport extends DolibarrModules $this->rights[$r][0] = 1201; $this->rights[$r][1] = 'Lire les exports'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'lire'; $r++; diff --git a/htdocs/core/modules/modFTP.class.php b/htdocs/core/modules/modFTP.class.php index e7388faaedf..8bd0358d614 100644 --- a/htdocs/core/modules/modFTP.class.php +++ b/htdocs/core/modules/modFTP.class.php @@ -97,7 +97,7 @@ class modFTP extends DolibarrModules $this->rights[$r][0] = 2801; $this->rights[$r][1] = 'Use FTP client in read mode (browse and download only)'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'read'; $r++; diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index c4f9dc20243..2ce4c2a1c5d 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -126,7 +126,7 @@ class modFacture extends DolibarrModules $this->rights[$r][0] = 11; $this->rights[$r][1] = 'Lire les factures'; $this->rights[$r][2] = 'a'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'lire'; $r++; diff --git a/htdocs/core/modules/modFicheinter.class.php b/htdocs/core/modules/modFicheinter.class.php index 4c4fcbcc6d8..1114705fb31 100644 --- a/htdocs/core/modules/modFicheinter.class.php +++ b/htdocs/core/modules/modFicheinter.class.php @@ -99,7 +99,7 @@ class modFicheinter extends DolibarrModules $this->rights[$r][0] = 61; $this->rights[$r][1] = 'Lire les fiches d\'intervention'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'lire'; $r++; diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 3cf63b6cfb9..97f7e389f96 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -129,14 +129,14 @@ class modFournisseur extends DolibarrModules $this->rights[$r][0] = 1181; $this->rights[$r][1] = 'Consulter les fournisseurs'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'lire'; $r++; $this->rights[$r][0] = 1182; $this->rights[$r][1] = 'Consulter les commandes fournisseur'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'commande'; $this->rights[$r][5] = 'lire'; @@ -209,7 +209,7 @@ class modFournisseur extends DolibarrModules $this->rights[$r][0] = 1231; $this->rights[$r][1] = 'Consulter les factures fournisseur'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'facture'; $this->rights[$r][5] = 'lire'; diff --git a/htdocs/core/modules/modGravatar.class.php b/htdocs/core/modules/modGravatar.class.php index 241cca18dbb..237778309c2 100644 --- a/htdocs/core/modules/modGravatar.class.php +++ b/htdocs/core/modules/modGravatar.class.php @@ -114,7 +114,7 @@ class modGravatar extends DolibarrModules // Example: // $this->rights[$r][0] = 2000; // Permission id (must not be already used) // $this->rights[$r][1] = 'Permision label'; // Permission label - // $this->rights[$r][3] = 1; // Permission by default for new user (0/1) + // $this->rights[$r][3] = 0; // Permission by default for new user (0/1) // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $r++; diff --git a/htdocs/core/modules/modHRM.class.php b/htdocs/core/modules/modHRM.class.php index 174158ac7e2..10802d60161 100644 --- a/htdocs/core/modules/modHRM.class.php +++ b/htdocs/core/modules/modHRM.class.php @@ -99,21 +99,21 @@ class modHRM extends DolibarrModules $this->rights[$r][0] = 4001; $this->rights[$r][1] = 'See employees'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'employee'; $this->rights[$r][5] = 'read'; $r ++; $this->rights[$r][0] = 4002; $this->rights[$r][1] = 'Create employees'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'employee'; $this->rights[$r][5] = 'write'; $r ++; $this->rights[$r][0] = 4003; $this->rights[$r][1] = 'Delete employees'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'employee'; $this->rights[$r][5] = 'delete'; $r ++; diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 73b316ec164..ea41de29656 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -133,14 +133,14 @@ class modHoliday extends DolibarrModules $this->rights[$r][0] = 20001; // Permission id (must not be already used) $this->rights[$r][1] = 'Read your own holidays'; // Permission label - $this->rights[$r][3] = 1; // Permission by default for new user (0/1) + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $r++; $this->rights[$r][0] = 20002; // Permission id (must not be already used) $this->rights[$r][1] = 'Create/modify your own holidays'; // Permission label - $this->rights[$r][3] = 1; // Permission by default for new user (0/1) + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $r++; diff --git a/htdocs/core/modules/modLoan.class.php b/htdocs/core/modules/modLoan.class.php index b7e7f822bbc..0f179fcdebf 100644 --- a/htdocs/core/modules/modLoan.class.php +++ b/htdocs/core/modules/modLoan.class.php @@ -99,7 +99,7 @@ class modLoan extends DolibarrModules $this->rights[$r][0] = 520; $this->rights[$r][1] = 'Read loans'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'read'; $this->rights[$r][5] = ''; diff --git a/htdocs/core/modules/modMailing.class.php b/htdocs/core/modules/modMailing.class.php index 00ece509285..934e21e56e3 100644 --- a/htdocs/core/modules/modMailing.class.php +++ b/htdocs/core/modules/modMailing.class.php @@ -79,7 +79,7 @@ class modMailing extends DolibarrModules $this->rights[$r][0] = 221; // id de la permission $this->rights[$r][1] = 'Consulter les mailings'; // libelle de la permission $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) - $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'lire'; $r++; diff --git a/htdocs/core/modules/modMargin.class.php b/htdocs/core/modules/modMargin.class.php index b2bc41220c3..d7827c191e7 100644 --- a/htdocs/core/modules/modMargin.class.php +++ b/htdocs/core/modules/modMargin.class.php @@ -126,7 +126,7 @@ class modMargin extends DolibarrModules $this->rights[$r][0] = 59001; // id de la permission $this->rights[$r][1] = 'Visualiser les marges'; // libelle de la permission $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) - $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'liretous'; $r++; diff --git a/htdocs/core/modules/modMultiCurrency.class.php b/htdocs/core/modules/modMultiCurrency.class.php index 7ae613edd49..a4875dc16e2 100644 --- a/htdocs/core/modules/modMultiCurrency.class.php +++ b/htdocs/core/modules/modMultiCurrency.class.php @@ -189,7 +189,7 @@ class modMultiCurrency extends DolibarrModules // Example: // $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) // $this->rights[$r][1] = 'Permision label'; // Permission label - // $this->rights[$r][3] = 1; // Permission by default for new user (0/1) + // $this->rights[$r][3] = 0; // Permission by default for new user (0/1) // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $r++; diff --git a/htdocs/core/modules/modOauth.class.php b/htdocs/core/modules/modOauth.class.php index fe444960b53..4be01e561fe 100644 --- a/htdocs/core/modules/modOauth.class.php +++ b/htdocs/core/modules/modOauth.class.php @@ -97,7 +97,7 @@ class modOauth extends DolibarrModules $this->rights[$r][0] = 66000; $this->rights[$r][1] = 'OauthAccess'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'read';*/ // Main menu entries diff --git a/htdocs/core/modules/modPaybox.class.php b/htdocs/core/modules/modPaybox.class.php index d77d2dfc3f4..6cbdd5e2127 100644 --- a/htdocs/core/modules/modPaybox.class.php +++ b/htdocs/core/modules/modPaybox.class.php @@ -106,7 +106,7 @@ class modPayBox extends DolibarrModules // Example: // $this->rights[$r][0] = 2000; // Permission id (must not be already used) // $this->rights[$r][1] = 'Permision label'; // Permission label - // $this->rights[$r][3] = 1; // Permission by default for new user (0/1) + // $this->rights[$r][3] = 0; // Permission by default for new user (0/1) // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $r++; diff --git a/htdocs/core/modules/modPrelevement.class.php b/htdocs/core/modules/modPrelevement.class.php index b2d0589f828..695c058dbff 100644 --- a/htdocs/core/modules/modPrelevement.class.php +++ b/htdocs/core/modules/modPrelevement.class.php @@ -85,7 +85,7 @@ class modPrelevement extends DolibarrModules $this->rights[$r][0] = 151; $this->rights[$r][1] = 'Read withdrawals'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'bons'; $this->rights[$r][5] = 'lire'; diff --git a/htdocs/core/modules/modPrinting.class.php b/htdocs/core/modules/modPrinting.class.php index 0e5965b8793..bf3c30d8441 100644 --- a/htdocs/core/modules/modPrinting.class.php +++ b/htdocs/core/modules/modPrinting.class.php @@ -97,7 +97,7 @@ class modPrinting extends DolibarrModules $this->rights[$r][0] = 64001; $this->rights[$r][1] = 'DirectPrint'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'read'; // Main menu entries diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index a36abbf0b0f..92bfff41988 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -99,7 +99,7 @@ class modProduct extends DolibarrModules $this->rights[$r][0] = 31; // id de la permission $this->rights[$r][1] = 'Lire les produits'; // libelle de la permission $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) - $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'lire'; $r++; diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 8de0d100194..3f0141f2ec7 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -149,7 +149,7 @@ class modProjet extends DolibarrModules $this->rights[$r][0] = 41; // id de la permission $this->rights[$r][1] = "Read projects and tasks (shared projects or projects I am contact for). Can also enter time consumed on assigned tasks (timesheet)"; // libelle de la permission $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) - $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'lire'; $r++; diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index 32ebb340e71..484852e20eb 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -116,7 +116,7 @@ class modPropale extends DolibarrModules $this->rights[$r][0] = 21; // id de la permission $this->rights[$r][1] = 'Lire les propositions commerciales'; // libelle de la permission $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) - $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'lire'; $r++; diff --git a/htdocs/core/modules/modReceiptPrinter.class.php b/htdocs/core/modules/modReceiptPrinter.class.php index 121722125f2..f1520cf698f 100644 --- a/htdocs/core/modules/modReceiptPrinter.class.php +++ b/htdocs/core/modules/modReceiptPrinter.class.php @@ -97,7 +97,7 @@ class modReceiptPrinter extends DolibarrModules $this->rights[$r][0] = 67000; $this->rights[$r][1] = 'ReceiptPrinter'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'read'; // Main menu entries diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php index 82d57514623..cb0d037814c 100644 --- a/htdocs/core/modules/modResource.class.php +++ b/htdocs/core/modules/modResource.class.php @@ -204,7 +204,7 @@ class modResource extends DolibarrModules //// Permission label //$this->rights[$r][1] = 'Permision label'; //// Permission by default for new user (0/1) - //$this->rights[$r][3] = 1; + //$this->rights[$r][3] = 0; //// In php code, permission will be checked by test //// if ($user->rights->permkey->level1->level2) //$this->rights[$r][4] = 'level1'; diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 5ea2cfde964..4ea66f0dccd 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -88,7 +88,7 @@ class modService extends DolibarrModules $this->rights[$r][0] = 531; // id de la permission $this->rights[$r][1] = 'Lire les services'; // libelle de la permission $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) - $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'lire'; $r++; diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index baf680f0352..09b3566f413 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -143,7 +143,7 @@ class modSociete extends DolibarrModules $this->rights[$r][0] = 121; // id de la permission $this->rights[$r][1] = 'Lire les societes'; // libelle de la permission $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) - $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'lire'; /* $r++; @@ -206,7 +206,7 @@ class modSociete extends DolibarrModules $this->rights[$r][0] = 262; $this->rights[$r][1] = 'Consulter tous les tiers par utilisateurs internes (sinon uniquement si contact commercial). Non effectif pour utilisateurs externes (tjs limités à eux-meme).'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'client'; $this->rights[$r][5] = 'voir'; @@ -214,7 +214,7 @@ class modSociete extends DolibarrModules $this->rights[$r][0] = 281; // id de la permission $this->rights[$r][1] = 'Lire les contacts'; // libelle de la permission $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) - $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'contact'; $this->rights[$r][5] = 'lire'; diff --git a/htdocs/core/modules/modSupplierProposal.class.php b/htdocs/core/modules/modSupplierProposal.class.php index 9c249da4dc6..e387784b14d 100644 --- a/htdocs/core/modules/modSupplierProposal.class.php +++ b/htdocs/core/modules/modSupplierProposal.class.php @@ -102,13 +102,13 @@ class modSupplierProposal extends DolibarrModules $r++; $this->rights[$r][0] = $this->numero + $r; // id de la permission $this->rights[$r][1] = 'Read supplier proposals'; // libelle de la permission - $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'lire'; $r++; $this->rights[$r][0] = $this->numero + $r; // id de la permission $this->rights[$r][1] = 'Create/modify supplier proposals'; // libelle de la permission - $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'creer'; $r++; diff --git a/htdocs/core/modules/modTax.class.php b/htdocs/core/modules/modTax.class.php index 5c2beab5dfa..d2475897cf0 100644 --- a/htdocs/core/modules/modTax.class.php +++ b/htdocs/core/modules/modTax.class.php @@ -88,7 +88,7 @@ class modTax extends DolibarrModules $this->rights[$r][0] = 91; $this->rights[$r][1] = 'Lire les charges'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'charges'; $this->rights[$r][5] = 'lire'; diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php index 48de5a48a6c..f86ace2455c 100644 --- a/htdocs/core/modules/modUser.class.php +++ b/htdocs/core/modules/modUser.class.php @@ -134,7 +134,7 @@ class modUser extends DolibarrModules $this->rights[$r][0] = 341; $this->rights[$r][1] = 'Consulter ses propres permissions'; $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on $this->rights[$r][5] = 'readperms'; @@ -142,7 +142,7 @@ class modUser extends DolibarrModules $this->rights[$r][0] = 342; $this->rights[$r][1] = 'Creer/modifier ses propres infos utilisateur'; $this->rights[$r][2] = 'w'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'self'; $this->rights[$r][5] = 'creer'; @@ -150,7 +150,7 @@ class modUser extends DolibarrModules $this->rights[$r][0] = 343; $this->rights[$r][1] = 'Modifier son propre mot de passe'; $this->rights[$r][2] = 'w'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'self'; $this->rights[$r][5] = 'password'; @@ -158,7 +158,7 @@ class modUser extends DolibarrModules $this->rights[$r][0] = 344; $this->rights[$r][1] = 'Modifier ses propres permissions'; $this->rights[$r][2] = 'w'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on $this->rights[$r][5] = 'writeperms'; diff --git a/htdocs/core/modules/modWebsites.class.php b/htdocs/core/modules/modWebsites.class.php index 30795c6c0fa..47c9d103ecb 100644 --- a/htdocs/core/modules/modWebsites.class.php +++ b/htdocs/core/modules/modWebsites.class.php @@ -92,7 +92,7 @@ class modWebsites extends DolibarrModules $this->rights[$r][0] = 10001; $this->rights[$r][1] = 'Read website content'; - $this->rights[$r][3] = 1; + $this->rights[$r][3] = 0; $this->rights[$r][4] = 'read'; $r++; diff --git a/htdocs/core/modules/modWorkflow.class.php b/htdocs/core/modules/modWorkflow.class.php index e793d21e03c..5c348cdf77f 100644 --- a/htdocs/core/modules/modWorkflow.class.php +++ b/htdocs/core/modules/modWorkflow.class.php @@ -94,7 +94,7 @@ class modWorkflow extends DolibarrModules $this->rights[$r][0] = 6001; // id de la permission $this->rights[$r][1] = "Lire les workflow"; // libelle de la permission $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) - $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'read'; */ From d777fca0b9e68a2a5be846c386f93a49a6812a0e Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 4 Jun 2016 13:25:39 +0200 Subject: [PATCH 002/470] Warning messages after module activation and for user with no permission --- htdocs/admin/modules.php | 5 +++++ htdocs/langs/en_US/admin.lang | 2 ++ htdocs/user/card.php | 4 ++++ htdocs/user/class/user.class.php | 6 ++++++ 4 files changed, 17 insertions(+) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 1151ef4abb9..4b12e54dc97 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -79,6 +79,11 @@ if ($action == 'set' && $user->admin) { $result=activateModule($value); if ($result) setEventMessages($result, null, 'errors'); + else + { + $msg = $langs->trans('ModuleEnabledAdminMustCheckRights'); + setEventMessages($msg, null, 'warnings'); + } header("Location: modules.php?mode=".$mode.$param.($page_y?'&page_y='.$page_y:'')); exit; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index c57c01dfc36..6dad591cf0a 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1752,3 +1752,5 @@ AddSubstitutions=Add keys substitutions DetectionNotPossible=Detection not possible UrlToGetKeyToUseAPIs=Url to get token to use API (once token has been received it is saved on database user table and will be checked on each future access) ListOfAvailableAPIs=List of available APIs +ModuleEnabledAdminMustCheckRights=Module has been activated. All permissions were given to admin users only. +UserHasNoPermissions=This user has no permission defined \ No newline at end of file diff --git a/htdocs/user/card.php b/htdocs/user/card.php index acfe1c85cd7..319e4880efa 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1129,6 +1129,10 @@ else $object->fetch($id); if ($res < 0) { dol_print_error($db,$object->error); exit; } $res=$object->fetch_optionals($object->id,$extralabels); + + // Check if user has rights + $object->getrights(); + if(empty($object->nb_rights)) setEventMessages($langs->trans('UserHasNoPermissions'), null, 'warnings'); // Connexion ldap // pour recuperer passDoNotExpire et userChangePassNextLogon diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 51945677694..f35356a9f81 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -107,6 +107,7 @@ class User extends CommonObject var $rights; // Array of permissions user->rights->permx var $all_permissions_are_loaded; /**< \private all_permissions_are_loaded */ private $_tab_loaded=array(); // Array of cache of already loaded permissions + var $nb_rights; // Number of rights granted to the user var $conf; // To store personal config var $oldcopy; // To contains a clone of this when we need to save old properties of object @@ -138,6 +139,7 @@ class User extends CommonObject // For cache usage $this->all_permissions_are_loaded = 0; + $this->nb_rights = 0; // Force some default values $this->admin = 0; @@ -629,10 +631,12 @@ class User extends CommonObject if ($subperms) { if (! isset($this->rights->$module->$perms) || ! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = new stdClass(); + if(empty($this->rights->$module->$perms->$subperms)) $this->nb_rights++; $this->rights->$module->$perms->$subperms = 1; } else { + if(empty($this->rights->$module->$perms)) $this->nb_rights++; $this->rights->$module->$perms = 1; } @@ -679,10 +683,12 @@ class User extends CommonObject if ($subperms) { if (! isset($this->rights->$module->$perms) || ! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = new stdClass(); + if(empty($this->rights->$module->$perms->$subperms)) $this->nb_rights++; $this->rights->$module->$perms->$subperms = 1; } else { + if(empty($this->rights->$module->$perms)) $this->nb_rights++; $this->rights->$module->$perms = 1; } From 3718121ceefb6411beed97c245decaede4919a8e Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 4 Jun 2016 13:25:56 +0200 Subject: [PATCH 003/470] Add number of permission in user permission tab --- htdocs/core/lib/usergroups.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index e51862922a0..01278e28e7a 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -62,7 +62,7 @@ function user_prepare_head($object) if ($canreadperms) { $head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id; - $head[$h][1] = $langs->trans("UserRights"); + $head[$h][1] = $langs->trans("UserRights"). ' '.($object->nb_rights).''; $head[$h][2] = 'rights'; $h++; } From ee02ff43d75996d1fe5de07d029e5bc9553210d0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 7 Jul 2016 12:19:20 +0200 Subject: [PATCH 004/470] Fix: add entity field in llx_societe_remise_except, useful when third-sharing is used with multicompany --- htdocs/comm/remx.php | 6 +- htdocs/core/class/discount.class.php | 17 +- htdocs/core/class/html.form.class.php | 177 +++++++++--------- .../install/mysql/migration/3.9.0-4.0.0.sql | 1 + .../tables/llx_societe_remise_except.sql | 25 +-- htdocs/install/upgrade2.php | 149 +++++++++++++-- htdocs/langs/en_US/install.lang | 1 + htdocs/societe/class/societe.class.php | 28 +-- 8 files changed, 265 insertions(+), 139 deletions(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index b682b214da8..9407553f325 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -248,7 +248,8 @@ if ($socid > 0) $remise_all=$remise_user=0; $sql = "SELECT SUM(rc.amount_ht) as amount, rc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc"; - $sql.= " WHERE rc.fk_soc =". $object->id; + $sql.= " WHERE rc.fk_soc = " . $object->id; + $sql.= " AND rc.entity = " . $conf->entity; $sql.= " AND (fk_facture_line IS NULL AND fk_facture IS NULL)"; $sql.= " GROUP BY rc.fk_user"; $resql=$db->query($sql); @@ -318,7 +319,8 @@ if ($socid > 0) $sql.= " fa.facnumber as ref, fa.type as type"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."societe_remise_except as rc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid"; - $sql.= " WHERE rc.fk_soc =". $object->id; + $sql.= " WHERE rc.fk_soc = " . $object->id; + $sql.= " AND rc.entity = " . $conf->entity; $sql.= " AND u.rowid = rc.fk_user"; $sql.= " AND (rc.fk_facture_line IS NULL AND rc.fk_facture IS NULL)"; $sql.= " ORDER BY rc.datec DESC"; diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index e256dbfb649..9a59801f720 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -66,6 +66,8 @@ class DiscountAbsolute */ function fetch($rowid,$fk_facture_source=0) { + global $conf; + // Check parameters if (! $rowid && ! $fk_facture_source) { @@ -81,9 +83,9 @@ class DiscountAbsolute $sql.= " f.facnumber as ref_facture_source"; $sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as sr"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON sr.fk_facture_source = f.rowid"; - $sql.= " WHERE"; - if ($rowid) $sql.= " sr.rowid=".$rowid; - if ($fk_facture_source) $sql.= " sr.fk_facture_source=".$fk_facture_source; + $sql.= " WHERE sr.entity = " . $conf->entity; + if ($rowid) $sql.= " AND sr.rowid=".$rowid; + if ($fk_facture_source) $sql.= " AND sr.fk_facture_source=".$fk_facture_source; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); @@ -150,11 +152,11 @@ class DiscountAbsolute // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_except"; - $sql.= " (datec, fk_soc, fk_user, description,"; + $sql.= " (entity, datec, fk_soc, fk_user, description,"; $sql.= " amount_ht, amount_tva, amount_ttc, tva_tx,"; $sql.= " fk_facture_source"; $sql.= ")"; - $sql.= " VALUES ('".$this->db->idate($this->datec!=''?$this->datec:dol_now())."', ".$this->fk_soc.", ".$user->id.", '".$this->db->escape($this->description)."',"; + $sql.= " VALUES (".$conf->entity.", '".$this->db->idate($this->datec!=''?$this->datec:dol_now())."', ".$this->fk_soc.", ".$user->id.", '".$this->db->escape($this->description)."',"; $sql.= " ".$this->amount_ht.", ".$this->amount_tva.", ".$this->amount_ttc.", ".$this->tva_tx.","; $sql.= " ".($this->fk_facture_source?"'".$this->fk_facture_source."'":"null"); $sql.= ")"; @@ -343,10 +345,13 @@ class DiscountAbsolute */ function getAvailableDiscounts($company='', $user='',$filter='', $maxvalue=0) { + global $conf; + $sql = "SELECT SUM(rc.amount_ttc) as amount"; // $sql = "SELECT rc.amount_ttc as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc"; - $sql.= " WHERE (rc.fk_facture IS NULL AND rc.fk_facture_line IS NULL)"; // Available + $sql.= " WHERE rc.entity = " . $conf->entity; + $sql.= " AND (rc.fk_facture IS NULL AND rc.fk_facture_line IS NULL)"; // Available if (is_object($company)) $sql.= " AND rc.fk_soc = ".$company->id; if (is_object($user)) $sql.= " AND rc.fk_user = ".$user->id; if ($filter) $sql.=' AND ('.$filter.')'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 507f45a12f8..334aabbd362 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -203,7 +203,7 @@ class Form $ret.=$doleditor->Create(1); } $ret.=''; - + $ret.=''; $ret.=''; if (preg_match('/ckeditor|textarea/',$typeofdata)) $ret.='
'."\n"; @@ -493,7 +493,7 @@ class Form /** * Generate select HTML to choose massaction - * + * * @param string $selected Selected value * @param int $arrayofaction array('code'=>'label', ...). The code is the key stored into the GETPOST('massaction') when submitting action. * @return string Select list @@ -501,9 +501,9 @@ class Form function selectMassAction($selected, $arrayofaction) { global $conf,$langs,$hookmanager; - + if (count($arrayofaction) == 0) return; - + $disabled=0; $ret='
'; $ret.='
'; - + $ret.=' '; - + return $ret; } - + /** * Return combo list of activated countries, into language of user * @@ -1029,9 +1029,9 @@ class Form $textifempty=''; // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. //if (! empty($conf->use_javascript_ajax) || $forcecombo) $textifempty=''; - if (! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) + if (! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) { - if ($showempty && ! is_numeric($showempty)) $textifempty=$langs->trans($showempty); + if ($showempty && ! is_numeric($showempty)) $textifempty=$langs->trans($showempty); else $textifempty.=$langs->trans("All"); } if ($showempty) $out.= ''."\n"; @@ -1117,7 +1117,8 @@ class Form $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; $sql.= " re.description, re.fk_facture_source"; $sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re"; - $sql.= " WHERE fk_soc = ".(int) $socid; + $sql.= " WHERE re.fk_soc = ".(int) $socid; + $sql.= " AND re.entity = " . $conf->entity; if ($filter) $sql.= " AND ".$filter; $sql.= " ORDER BY re.description ASC"; @@ -1350,7 +1351,7 @@ class Form * @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list * @param string $enableonlytext If option $enableonly is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty. * @param string $morecss More css - * @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on). + * @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on). * @return string HTML select string * @see select_dolgroups */ @@ -1881,7 +1882,7 @@ class Form $outlabel=$objp->label; $outdesc=$objp->description; $outbarcode=$objp->barcode; - + $outtype=$objp->fk_product_type; $outdurationvalue=$outtype == Product::TYPE_SERVICE?substr($objp->duration,0,dol_strlen($objp->duration)-1):''; $outdurationunit=$outtype == Product::TYPE_SERVICE?substr($objp->duration,-1):''; @@ -1898,13 +1899,13 @@ class Form $opt.= $objp->ref; if ($outbarcode) $opt.=' ('.$outbarcode.')'; $opt.=' - '.dol_trunc($label,$maxlengtharticle).' - '; - + $objRef = $objp->ref; if (! empty($filterkey) && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i','$1',$objRef,1); $outval.=$objRef; if ($outbarcode) $outval.=' ('.$outbarcode.')'; $outval.=' - '.dol_trunc($label,$maxlengtharticle).' - '; - + $found=0; // Multiprice @@ -1986,9 +1987,9 @@ class Form } // Price by customer - if (empty($hidepriceinlabel) && !empty($conf->global->PRODUIT_CUSTOMER_PRICES)) + if (empty($hidepriceinlabel) && !empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { - if (!empty($objp->idprodcustprice)) + if (!empty($objp->idprodcustprice)) { $found = 1; @@ -2066,7 +2067,7 @@ class Form { global $langs,$conf; global $price_level, $status, $finished; - + $selected_input_value=''; if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) { @@ -2198,11 +2199,11 @@ class Form if ($filterkey && $filterkey != '') $label=preg_replace('/('.preg_quote($filterkey).')/i','$1',$label,1); $opt.=$objp->ref; - if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) + if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) $opt.=' ('.$objp->ref_fourn.')'; $opt.=' - '; $outval.=$objRef; - if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) + if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) $outval.=' ('.$objRefFourn.')'; $outval.=' - '; $opt.=dol_trunc($label, 72).' - '; @@ -2805,7 +2806,7 @@ class Form { // If not good status if ($active >= 0 && $arraytypes['active'] != $active) continue; - + // On passe si on a demande de filtrer sur des modes de paiments particuliers if (count($filterarray) && ! in_array($arraytypes['type'],$filterarray)) continue; @@ -3168,13 +3169,13 @@ class Form $langs->load("categories"); include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; - + // For backward compatibility if (is_numeric($type)) { dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); } - + $cat = new Categorie($this->db); $cate_arbo = $cat->get_full_arbo($type,$excludeafterid); @@ -3794,7 +3795,7 @@ class Form } } } - + /** * Show form with multicurrency code * @@ -3824,7 +3825,7 @@ class Form print !empty($selected) ? currency_name($selected,1) : ' '; } } - + /** * Show form with multicurrency rate * @@ -3837,7 +3838,7 @@ class Form function form_multicurrency_rate($page, $rate='', $htmlname='multicurrency_tx', $currency='') { global $langs, $mysoc, $conf; - + if ($htmlname != "none") { print '
'; @@ -4068,7 +4069,7 @@ class Form /** * Return array of currencies in user language - * + * * @param string $selected preselected currency code * @param string $htmlname name of HTML select list * @param integer $useempty 1=Add empty line @@ -4081,7 +4082,7 @@ class Form $langs->loadCacheCurrencies(''); // Load ->cache_currencies $TCurrency = array(); - + $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency'; $sql.= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; $resql = $db->query($sql); @@ -4089,7 +4090,7 @@ class Form { while ($obj = $db->fetch_object($resql)) $TCurrency[$obj->code] = $obj->code; } - + $out=''; $out.= ''; return $out; } - + /** * Load into the cache vat rates of a country * @@ -4204,7 +4205,7 @@ class Form $defaulttx=preg_replace('/\s*\(.*\)/','',$defaulttx); } //var_dump($selectedrate.'-'.$defaulttx.'-'.$defaultnpr.'-'.$defaultcode); - + // Check parameters if (is_object($societe_vendeuse) && ! $societe_vendeuse->country_code) { @@ -4303,7 +4304,7 @@ class Form $return.= '"'; if ($defaultcode) // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag { - if ($defaultcode == $rate['code']) $return.= ' selected'; + if ($defaultcode == $rate['code']) $return.= ' selected'; } elseif ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr) { @@ -4312,7 +4313,7 @@ class Form $return.= '>'.vatrate($rate['libtva']); //$return.=($rate['code']?' '.$rate['code']:''); $return.= (empty($rate['code']) && $rate['nprtva']) ? ' *': ''; // We show the * (old behaviour only if new vat code is not used) - + $return.= ''; } @@ -4616,7 +4617,7 @@ class Form { $tmparray=dol_getdate($adddateof); $retstring.=' -