From f66dfb1c087a6ed64555fea86d300526cb0dadb7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Jul 2022 11:08:04 +0200 Subject: [PATCH] phpv8 --- .../box_accountancy_last_manual_entries.php | 2 +- .../box_accountancy_suspense_account.php | 2 +- htdocs/core/boxes/box_actions.php | 2 +- htdocs/core/boxes/box_activity.php | 4 +- htdocs/core/boxes/box_boms.php | 2 +- htdocs/core/boxes/box_bookmarks.php | 2 +- htdocs/core/boxes/box_commandes.php | 2 +- htdocs/core/boxes/box_comptes.php | 2 +- htdocs/core/boxes/box_contracts.php | 2 +- .../core/boxes/box_dolibarr_state_board.php | 42 +++++++++---------- htdocs/core/boxes/box_factures.php | 2 +- htdocs/core/boxes/box_factures_fourn.php | 2 +- htdocs/core/boxes/box_factures_fourn_imp.php | 2 +- htdocs/core/boxes/box_factures_imp.php | 2 +- htdocs/core/boxes/box_ficheinter.php | 2 +- htdocs/core/boxes/box_goodcustomers.php | 2 +- .../boxes/box_graph_invoices_permonth.php | 2 +- .../core/boxes/box_graph_invoices_peryear.php | 2 +- .../box_graph_invoices_supplier_permonth.php | 2 +- .../core/boxes/box_graph_orders_permonth.php | 2 +- .../box_graph_orders_supplier_permonth.php | 2 +- .../boxes/box_graph_product_distribution.php | 4 +- .../boxes/box_graph_propales_permonth.php | 2 +- htdocs/core/boxes/box_mos.php | 2 +- htdocs/core/boxes/box_project.php | 2 +- htdocs/core/boxes/box_propales.php | 2 +- htdocs/core/boxes/box_services_expired.php | 2 +- htdocs/core/boxes/box_shipments.php | 2 +- htdocs/core/boxes/box_supplier_orders.php | 2 +- ...box_supplier_orders_awaiting_reception.php | 2 +- htdocs/core/boxes/box_task.php | 2 +- htdocs/core/boxes/box_validated_projects.php | 2 +- htdocs/core/class/vcard.class.php | 6 +-- htdocs/index.php | 32 +++++++------- htdocs/user/vcard.php | 2 +- 35 files changed, 74 insertions(+), 74 deletions(-) diff --git a/htdocs/core/boxes/box_accountancy_last_manual_entries.php b/htdocs/core/boxes/box_accountancy_last_manual_entries.php index 96abd8699f3..a15728a04f0 100644 --- a/htdocs/core/boxes/box_accountancy_last_manual_entries.php +++ b/htdocs/core/boxes/box_accountancy_last_manual_entries.php @@ -60,7 +60,7 @@ class box_accountancy_last_manual_entries extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->accounting->mouvements->lire); + $this->hidden = empty($user->rights->accounting->mouvements->lire); } /** diff --git a/htdocs/core/boxes/box_accountancy_suspense_account.php b/htdocs/core/boxes/box_accountancy_suspense_account.php index f40c6e8a41b..3ea5b191799 100644 --- a/htdocs/core/boxes/box_accountancy_suspense_account.php +++ b/htdocs/core/boxes/box_accountancy_suspense_account.php @@ -60,7 +60,7 @@ class box_accountancy_suspense_account extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->accounting->mouvements->lire); + $this->hidden = empty($user->rights->accounting->mouvements->lire); } /** diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index ee41df3cdd2..21fa3b330a5 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -62,7 +62,7 @@ class box_actions extends ModeleBoxes $this->enabled = $conf->agenda->enabled; - $this->hidden = !($user->rights->agenda->myactions->read); + $this->hidden = empty($user->rights->agenda->myactions->read); } /** diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index ea43eff12fc..49690dc893e 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -63,8 +63,8 @@ class box_activity extends ModeleBoxes $this->enabled = ($conf->global->MAIN_FEATURES_LEVEL); // Not enabled by default due to bugs (see previous comments) $this->hidden = !((isModEnabled('facture') && $user->rights->facture->lire) - || (!empty($conf->commande->enabled) && $user->rights->commande->lire) - || (!empty($conf->propal->enabled) && $user->rights->propale->lire) + || (isModEnabled('commande') && $user->rights->commande->lire) + || (isModEnabled('propal') && $user->rights->propale->lire) ); } diff --git a/htdocs/core/boxes/box_boms.php b/htdocs/core/boxes/box_boms.php index a9a4f8746da..2ace554eb55 100644 --- a/htdocs/core/boxes/box_boms.php +++ b/htdocs/core/boxes/box_boms.php @@ -60,7 +60,7 @@ class box_boms extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->bom->read); + $this->hidden = empty($user->rights->bom->read); } /** diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php index 1a3a1183032..3e8abd587c0 100644 --- a/htdocs/core/boxes/box_bookmarks.php +++ b/htdocs/core/boxes/box_bookmarks.php @@ -56,7 +56,7 @@ class box_bookmarks extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->bookmark->lire); + $this->hidden = empty($user->rights->bookmark->lire); } /** diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index b5656c36292..f4aec2075d7 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -60,7 +60,7 @@ class box_commandes extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->commande->lire); + $this->hidden = empty($user->rights->commande->lire); } /** diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 5570051a065..606f8409161 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -68,7 +68,7 @@ class box_comptes extends ModeleBoxes $this->enabled = 0; // disabled for external users } - $this->hidden = !($user->rights->banque->lire); + $this->hidden = empty($user->rights->banque->lire); } /** diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index dddafffdc02..3399304563b 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -59,7 +59,7 @@ class box_contracts extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->contrat->lire); + $this->hidden = empty($user->rights->contrat->lire); } /** diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index 4b85ce9d396..83615c17fd3 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -112,32 +112,32 @@ class box_dolibarr_state_board extends ModeleBoxes 'dolresource' ); $conditions = array( - 'users' => $user->rights->user->user->lire, - 'members' => !empty($conf->adherent->enabled) && $user->rights->adherent->lire, - 'customers' => !empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS), - 'prospects' => !empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS), + 'users' => $user->hasRight('user', 'user', 'lire'), + 'members' => isModEnabled('adherent') && $user->rights->adherent->lire, + 'customers' => isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS), + 'prospects' => isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS), 'suppliers' => ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->lire) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire) ) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS), - 'contacts' => !empty($conf->societe->enabled) && $user->rights->societe->contact->lire, - 'products' => !empty($conf->product->enabled) && $user->rights->produit->lire, - 'services' => !empty($conf->service->enabled) && $user->rights->service->lire, - 'proposals' => !empty($conf->propal->enabled) && $user->rights->propale->lire, - 'orders' => !empty($conf->commande->enabled) && $user->rights->commande->lire, - 'invoices' => isModEnabled('facture') && $user->rights->facture->lire, - 'donations' => !empty($conf->don->enabled) && $user->rights->don->lire, - 'contracts' => !empty($conf->contrat->enabled) && $user->rights->contrat->lire, - 'interventions' => !empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire, - 'supplier_orders' => !empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS), - 'supplier_invoices' => !empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS), - 'supplier_proposals' => !empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS), - 'projects' => !empty($conf->project->enabled) && $user->rights->projet->lire, - 'expensereports' => !empty($conf->expensereport->enabled) && $user->rights->expensereport->lire, - 'holidays' => !empty($conf->holiday->enabled) && $user->rights->holiday->read, - 'ticket' => !empty($conf->ticket->enabled) && $user->rights->ticket->read, - 'dolresource' => !empty($conf->resource->enabled) && $user->rights->resource->read + 'contacts' => isModEnabled('societe') && $user->hasRight('societe', 'contact', 'lire'), + 'products' => isModEnabled('product') && $user->hasRight('produit', 'lire'), + 'services' => isModEnabled('service') && $user->hasRight('service', 'lire'), + 'proposals' => isModEnabled('propal') && $user->hasRight('propale', 'lire'), + 'orders' => isModEnabled('commande') && $user->hasRight('commande', 'lire'), + 'invoices' => isModEnabled('facture') && $user->hasRight('facture', 'lire'), + 'donations' => isModEnabled('don') && $user->hasRight('don', 'lire'), + 'contracts' => isModEnabled('contrat') && $user->hasRight('contrat', 'lire'), + 'interventions' => isModEnabled('ficheinter') && $user->hasRight('ficheinter', 'lire'), + 'supplier_orders' => isModEnabled('supplier_order') && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS), + 'supplier_invoices' => isModEnabled('supplier_invoice') && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS), + 'supplier_proposals' => isModEnabled('supplier_proposal') && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS), + 'projects' => isModEnabled('project') && $user->hasRight('projet', 'lire'), + 'expensereports' => isModEnabled('expensereport') && $user->hasRight('expensereport', 'lire'), + 'holidays' => isModEnabled('holiday') && $user->hasRight('holiday', 'read'), + 'ticket' => isModEnabled('ticket') && $user->hasRight('ticket', 'read'), + 'dolresource' => isModEnabled('resource') && $user->hasRight('resource', 'read') ); $classes = array( 'users' => 'User', diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 43087949e47..e34e89c97eb 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -58,7 +58,7 @@ class box_factures extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->facture->lire); + $this->hidden = empty($user->rights->facture->lire); } /** diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 5fc3bdafa38..d6c96ed1e2f 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -59,7 +59,7 @@ class box_factures_fourn extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->fournisseur->facture->lire); + $this->hidden = empty($user->rights->fournisseur->facture->lire); } /** diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index d8c9321411d..89ce6e677d7 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -58,7 +58,7 @@ class box_factures_fourn_imp extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->fournisseur->facture->lire); + $this->hidden = empty($user->rights->fournisseur->facture->lire); } /** diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 6d6893f8ae2..a6103c26257 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -61,7 +61,7 @@ class box_factures_imp extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->facture->lire); + $this->hidden = empty($user->rights->facture->lire); } /** diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index b0f0e691471..02d7ca8e31b 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -59,7 +59,7 @@ class box_ficheinter extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->ficheinter->lire); + $this->hidden = empty($user->rights->ficheinter->lire); } /** diff --git a/htdocs/core/boxes/box_goodcustomers.php b/htdocs/core/boxes/box_goodcustomers.php index ab425ceac87..3341e08107d 100644 --- a/htdocs/core/boxes/box_goodcustomers.php +++ b/htdocs/core/boxes/box_goodcustomers.php @@ -69,7 +69,7 @@ class box_goodcustomers extends ModeleBoxes $this->enabled = 0; // not enabled by default. Very slow on large database } - $this->hidden = !($user->rights->societe->lire); + $this->hidden = empty($user->rights->societe->lire); } /** diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 8179e134bcf..03b0e1d087b 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -56,7 +56,7 @@ class box_graph_invoices_permonth extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->facture->lire); + $this->hidden = empty($user->rights->facture->lire); } /** diff --git a/htdocs/core/boxes/box_graph_invoices_peryear.php b/htdocs/core/boxes/box_graph_invoices_peryear.php index 9126cfcfb37..5a9b84829f2 100644 --- a/htdocs/core/boxes/box_graph_invoices_peryear.php +++ b/htdocs/core/boxes/box_graph_invoices_peryear.php @@ -54,7 +54,7 @@ class box_graph_invoices_peryear extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->facture->lire); + $this->hidden = empty($user->rights->facture->lire); } /** diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index fc91cb692c1..75e51e071f8 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -56,7 +56,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->fournisseur->facture->lire); + $this->hidden = empty($user->rights->fournisseur->facture->lire); } /** diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index 885ec469632..c4205901528 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -56,7 +56,7 @@ class box_graph_orders_permonth extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->commande->lire); + $this->hidden = empty($user->rights->commande->lire); } /** diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index db7400c1c5a..433ba660365 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -56,7 +56,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->fournisseur->commande->lire); + $this->hidden = empty($user->rights->fournisseur->commande->lire); } /** diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index afed778912f..44f94fd48d1 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -61,8 +61,8 @@ class box_graph_product_distribution extends ModeleBoxes $this->hidden = !( (isModEnabled('facture') && !empty($user->rights->facture->lire)) - || (!empty($conf->commande->enabled) && !empty($user->rights->commande->lire)) - || (!empty($conf->propal->enabled) && !empty($user->rights->propale->lire)) + || (isModEnabled('commande') && !empty($user->rights->commande->lire)) + || (isModEnabled('propal') && !empty($user->rights->propale->lire)) ); } diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index cb9a543bc19..13f3a29ec16 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -56,7 +56,7 @@ class box_graph_propales_permonth extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->propale->lire); + $this->hidden = empty($user->rights->propale->lire); } /** diff --git a/htdocs/core/boxes/box_mos.php b/htdocs/core/boxes/box_mos.php index cff19388c17..812fcab7b64 100644 --- a/htdocs/core/boxes/box_mos.php +++ b/htdocs/core/boxes/box_mos.php @@ -60,7 +60,7 @@ class box_mos extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->bom->read); + $this->hidden = empty($user->rights->bom->read); } /** diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 909ff32acb9..80d465f0f87 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -62,7 +62,7 @@ class box_project extends ModeleBoxes $this->db = $db; $this->boxlabel = "OpenedProjects"; - $this->hidden = !($user->rights->projet->lire); + $this->hidden = empty($user->rights->projet->lire); } /** diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index cdaf629ae3f..b010779e52a 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -61,7 +61,7 @@ class box_propales extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->propale->lire); + $this->hidden = empty($user->rights->propale->lire); } /** diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index e9cca792de1..3fbad6c1656 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -58,7 +58,7 @@ class box_services_expired extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->contrat->lire); + $this->hidden = empty($user->rights->contrat->lire); } /** diff --git a/htdocs/core/boxes/box_shipments.php b/htdocs/core/boxes/box_shipments.php index ba95fe14356..4e54f3c5992 100644 --- a/htdocs/core/boxes/box_shipments.php +++ b/htdocs/core/boxes/box_shipments.php @@ -60,7 +60,7 @@ class box_shipments extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->expedition->lire); + $this->hidden = empty($user->rights->expedition->lire); } /** diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 6ee0c5ef8a3..b6924af4123 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -58,7 +58,7 @@ class box_supplier_orders extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->fournisseur->commande->lire); + $this->hidden = empty($user->rights->fournisseur->commande->lire); } /** diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php index 32151828b83..bfbaa9abf0c 100644 --- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php +++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php @@ -58,7 +58,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->fournisseur->commande->lire); + $this->hidden = empty($user->rights->fournisseur->commande->lire); } /** diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 82e917b102a..3f3c9d83a62 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -64,7 +64,7 @@ class box_task extends ModeleBoxes $this->boxlabel = "Tasks"; $this->db = $db; - $this->hidden = (!empty($conf->global->PROJECT_HIDE_TASKS) || !($user->rights->projet->lire)); + $this->hidden = (!empty($conf->global->PROJECT_HIDE_TASKS) || empty($user->rights->projet->lire)); } /** diff --git a/htdocs/core/boxes/box_validated_projects.php b/htdocs/core/boxes/box_validated_projects.php index e57bb1f14d9..bab64d5a000 100644 --- a/htdocs/core/boxes/box_validated_projects.php +++ b/htdocs/core/boxes/box_validated_projects.php @@ -66,7 +66,7 @@ class box_validated_projects extends ModeleBoxes $this->db = $db; $this->boxlabel = "ProjectTasksWithoutTimeSpent"; - $this->hidden = !($user->rights->projet->lire); + $this->hidden = empty($user->rights->projet->lire); if ($conf->global->MAIN_FEATURES_LEVEL < 2) { $this->enabled = 0; diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index d513262b871..dbe505a894b 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -195,14 +195,14 @@ class vCard // $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL" $key = "ADR"; if ($type != "") { - $key .= ";$type"; + $key .= ";".$type; } $key .= ";CHARSET=".$this->encoding; $this->properties[$key] = ";".encode($extended).";".encode($street).";".encode($city).";".encode($region).";".encode($zip).";".encode($country); - if ($this->properties["LABEL;$type;CHARSET=".$this->encoding] == "") { + //if ($this->properties["LABEL;".$type.";CHARSET=".$this->encoding] == '') { //$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type); - } + //} } /** diff --git a/htdocs/index.php b/htdocs/index.php index 6ada359cee6..6715577e615 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -162,21 +162,21 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } // Number of project opened - if (!empty($conf->project->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_PROJECT) && $user->rights->projet->lire) { + if (!empty($conf->project->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_PROJECT) && $user->hasRight('projet', 'lire')) { include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $board = new Project($db); $dashboardlines[$board->element] = $board->load_board($user); } // Number of tasks to do (late) - if (!empty($conf->project->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_PROJECT) && empty($conf->global->PROJECT_HIDE_TASKS) && $user->rights->projet->lire) { + if (isModEnabled('project') && empty($conf->global->MAIN_DISABLE_BLOCK_PROJECT) && empty($conf->global->PROJECT_HIDE_TASKS) && $user->hasRight('projet', 'lire')) { include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; $board = new Task($db); $dashboardlines[$board->element] = $board->load_board($user); } // Number of commercial customer proposals open (expired) - if (!empty($conf->propal->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_CUSTOMER) && $user->rights->propale->lire) { + if (isModEnabled('propal') && empty($conf->global->MAIN_DISABLE_BLOCK_CUSTOMER) && $user->hasRight('propale', 'lire')) { include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $board = new Propal($db); $dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened"); @@ -185,7 +185,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } // Number of supplier proposals open (expired) - if (!empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_SUPPLIER) && $user->rights->supplier_proposal->lire) { + if (isModEnabled('supplier_proposal') && empty($conf->global->MAIN_DISABLE_BLOCK_SUPPLIER) && $user->hasRight('supplier_proposal', 'lire')) { $langs->load("supplier_proposal"); include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; $board = new SupplierProposal($db); @@ -195,14 +195,14 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } // Number of customer orders a deal - if (!empty($conf->commande->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_CUSTOMER) && $user->rights->commande->lire) { + 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 - if (!empty($conf->supplier_order->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_SUPPLIER) && $user->rights->fournisseur->commande->lire) { + if (isModEnabled('supplier_order') && empty($conf->global->MAIN_DISABLE_BLOCK_SUPPLIER) && $user->rights->fournisseur->commande->lire) { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; $board = new CommandeFournisseur($db); $dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened"); @@ -210,7 +210,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } // Number of contract / services enabled (delayed) - if (!empty($conf->contrat->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_CONTRACT) && $user->rights->contrat->lire) { + if (isModEnabled('contrat') && empty($conf->global->MAIN_DISABLE_BLOCK_CONTRACT) && $user->hasRight('contrat', 'lire')) { include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; $board = new Contrat($db); $dashboardlines[$board->element.'_inactive'] = $board->load_board($user, "inactive"); @@ -219,7 +219,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } // Number of tickets open - if (!empty($conf->ticket->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_TICKET) && $user->rights->ticket->read) { + if (isModEnabled('ticket') && empty($conf->global->MAIN_DISABLE_BLOCK_TICKET) && $user->hasRight('ticket', 'read')) { include_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; $board = new Ticket($db); $dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened"); @@ -228,21 +228,21 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } // Number of invoices customers (paid) - if (isModEnabled('facture') && empty($conf->global->MAIN_DISABLE_BLOCK_CUSTOMER) && $user->rights->facture->lire) { + if (isModEnabled('facture') && empty($conf->global->MAIN_DISABLE_BLOCK_CUSTOMER) && $user->hasRight('facture', 'lire')) { include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $board = new Facture($db); $dashboardlines[$board->element] = $board->load_board($user); } // Number of supplier invoices (paid) - if (!empty($conf->supplier_invoice->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_SUPPLIER) && !empty($user->rights->fournisseur->facture->lire)) { + if (isModEnabled('supplier_invoice') && empty($conf->global->MAIN_DISABLE_BLOCK_SUPPLIER) && !empty($user->rights->fournisseur->facture->lire)) { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $board = new FactureFournisseur($db); $dashboardlines[$board->element] = $board->load_board($user); } // Number of transactions to conciliate - if (!empty($conf->banque->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_BANK) && $user->rights->banque->lire && !$user->socid) { + if (isModEnabled('banque') && empty($conf->global->MAIN_DISABLE_BLOCK_BANK) && $user->hasRight('banque', 'lire') && !$user->socid) { include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $board = new Account($db); $nb = $board->countAccountToReconcile(); // Get nb of account to reconciliate @@ -253,7 +253,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { // Number of cheque to send - if (!empty($conf->banque->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_BANK) && $user->rights->banque->lire && !$user->socid) { + if (isModEnabled('banque') && empty($conf->global->MAIN_DISABLE_BLOCK_BANK) && $user->hasRight('banque', 'lire') && !$user->socid) { if (empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) { include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; $board = new RemiseCheque($db); @@ -272,7 +272,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } // Number of foundation members - if (!empty($conf->adherent->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_ADHERENT) && $user->rights->adherent->lire && !$user->socid) { + if (isModEnabled('adherent') && empty($conf->global->MAIN_DISABLE_BLOCK_ADHERENT) && $user->hasRight('adherent', 'lire') && !$user->socid) { include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $board = new Adherent($db); $dashboardlines[$board->element.'_shift'] = $board->load_board($user, 'shift'); @@ -280,21 +280,21 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } // Number of expense reports to approve - if (!empty($conf->expensereport->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_EXPENSEREPORT) && $user->rights->expensereport->approve) { + if (isModEnabled('expensereport') && empty($conf->global->MAIN_DISABLE_BLOCK_EXPENSEREPORT) && $user->hasRight('expensereport', 'approve')) { include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; $board = new ExpenseReport($db); $dashboardlines[$board->element.'_toapprove'] = $board->load_board($user, 'toapprove'); } // Number of expense reports to pay - if (!empty($conf->expensereport->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_EXPENSEREPORT) && $user->rights->expensereport->to_paid) { + if (isModEnabled('expensereport') && empty($conf->global->MAIN_DISABLE_BLOCK_EXPENSEREPORT) && $user->hasRight('expensereport', 'to_paid')) { include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; $board = new ExpenseReport($db); $dashboardlines[$board->element.'_topay'] = $board->load_board($user, 'topay'); } // Number of holidays to approve - if (!empty($conf->holiday->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_HOLIDAY) && $user->rights->holiday->approve) { + if (isModEnabled('holiday') && empty($conf->global->MAIN_DISABLE_BLOCK_HOLIDAY) && $user->hasRight('holiday', 'approve')) { include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; $board = new Holiday($db); $dashboardlines[$board->element] = $board->load_board($user); diff --git a/htdocs/user/vcard.php b/htdocs/user/vcard.php index 0f9085d0b52..6796d11f7aa 100644 --- a/htdocs/user/vcard.php +++ b/htdocs/user/vcard.php @@ -113,7 +113,7 @@ if ($company->id) { } // Si user lie a un tiers non de type "particulier" - if ($user2->typent_code != 'TE_PRIVATE') { + if ($company->typent_code != 'TE_PRIVATE') { $v->setOrg($company->name); } }