Laurent Destailleur 2 years ago
parent
commit
f66dfb1c08
35 changed files with 74 additions and 74 deletions
  1. 1 1
      htdocs/core/boxes/box_accountancy_last_manual_entries.php
  2. 1 1
      htdocs/core/boxes/box_accountancy_suspense_account.php
  3. 1 1
      htdocs/core/boxes/box_actions.php
  4. 2 2
      htdocs/core/boxes/box_activity.php
  5. 1 1
      htdocs/core/boxes/box_boms.php
  6. 1 1
      htdocs/core/boxes/box_bookmarks.php
  7. 1 1
      htdocs/core/boxes/box_commandes.php
  8. 1 1
      htdocs/core/boxes/box_comptes.php
  9. 1 1
      htdocs/core/boxes/box_contracts.php
  10. 21 21
      htdocs/core/boxes/box_dolibarr_state_board.php
  11. 1 1
      htdocs/core/boxes/box_factures.php
  12. 1 1
      htdocs/core/boxes/box_factures_fourn.php
  13. 1 1
      htdocs/core/boxes/box_factures_fourn_imp.php
  14. 1 1
      htdocs/core/boxes/box_factures_imp.php
  15. 1 1
      htdocs/core/boxes/box_ficheinter.php
  16. 1 1
      htdocs/core/boxes/box_goodcustomers.php
  17. 1 1
      htdocs/core/boxes/box_graph_invoices_permonth.php
  18. 1 1
      htdocs/core/boxes/box_graph_invoices_peryear.php
  19. 1 1
      htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
  20. 1 1
      htdocs/core/boxes/box_graph_orders_permonth.php
  21. 1 1
      htdocs/core/boxes/box_graph_orders_supplier_permonth.php
  22. 2 2
      htdocs/core/boxes/box_graph_product_distribution.php
  23. 1 1
      htdocs/core/boxes/box_graph_propales_permonth.php
  24. 1 1
      htdocs/core/boxes/box_mos.php
  25. 1 1
      htdocs/core/boxes/box_project.php
  26. 1 1
      htdocs/core/boxes/box_propales.php
  27. 1 1
      htdocs/core/boxes/box_services_expired.php
  28. 1 1
      htdocs/core/boxes/box_shipments.php
  29. 1 1
      htdocs/core/boxes/box_supplier_orders.php
  30. 1 1
      htdocs/core/boxes/box_supplier_orders_awaiting_reception.php
  31. 1 1
      htdocs/core/boxes/box_task.php
  32. 1 1
      htdocs/core/boxes/box_validated_projects.php
  33. 3 3
      htdocs/core/class/vcard.class.php
  34. 16 16
      htdocs/index.php
  35. 1 1
      htdocs/user/vcard.php

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 2 - 2
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)
 			);
 	}
 

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 21 - 21
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',

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 2 - 2
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))
 		);
 	}
 

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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);
 	}
 
 	/**

+ 1 - 1
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));
 	}
 
 	/**

+ 1 - 1
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;

+ 3 - 3
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);
-		}
+		//}
 	}
 
 	/**

+ 16 - 16
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);

+ 1 - 1
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);
 	}
 }