Browse Source

user hasRight

Frédéric FRANCE 2 năm trước cách đây
mục cha
commit
2daa9b2dba

+ 1 - 1
htdocs/bom/tpl/linkedobjectblock.tpl.php

@@ -64,7 +64,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
 	print '</td>';
 	echo '<td class="linkedcol-date">'.dol_print_date($objectlink->date_creation, 'day').'</td>';
 	echo '<td class="linkedcol-amount right">';
-	if ($user->rights->commande->lire) {
+	if ($user->hasRight('commande', 'lire')) {
 		$total = $total + $objectlink->total_ht;
 		echo price($objectlink->total_ht);
 	}

+ 1 - 1
htdocs/commande/class/commande.class.php

@@ -2463,7 +2463,7 @@ class Commande extends CommonOrder
 	{
 		$remise = trim($remise) ?trim($remise) : 0;
 
-		if ($user->rights->commande->creer) {
+		if ($user->hasRight('commande', 'creer')) {
 			$error = 0;
 
 			$this->db->begin();

+ 1 - 1
htdocs/commande/tpl/linkedobjectblock.tpl.php

@@ -55,7 +55,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
 	echo '<td class="linkedcol-ref">'.$objectlink->ref_client.'</td>';
 	echo '<td class="linkedcol-date center">'.dol_print_date($objectlink->date, 'day').'</td>';
 	echo '<td class="linkedcol-amount right">';
-	if ($user->rights->commande->lire) {
+	if ($user->hasRight('commande', 'lire')) {
 		$total = $total + $objectlink->total_ht;
 		echo price($objectlink->total_ht);
 	}

+ 1 - 1
htdocs/contrat/card.php

@@ -2123,7 +2123,7 @@ if ($action == 'create') {
 
 				if (isModEnabled('commande') && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices) {
 					$langs->load("orders");
-					if ($user->rights->commande->creer) {
+					if ($user->hasRight('commande', 'creer')) {
 						print dolGetButtonAction($langs->trans('CreateOrder'), '', 'default', DOL_URL_ROOT.'/commande/card.php?action=create&token='.newToken().'&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id, '', true, $params);
 					} else {
 						$params['attr']['title'] = $langs->trans("NotEnoughPermissions");

+ 1 - 1
htdocs/core/boxes/box_commandes.php

@@ -85,7 +85,7 @@ class box_commandes extends ModeleBoxes
 
 		$this->info_box_head = array('text' => $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."CustomerOrders", $max));
 
-		if ($user->rights->commande->lire) {
+		if ($user->hasRight('commande', 'lire')) {
 			$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
 			$sql .= ", s.code_client, s.code_compta, s.client";
 			$sql .= ", s.logo, s.email, s.entity";

+ 1 - 1
htdocs/core/boxes/box_graph_orders_permonth.php

@@ -103,7 +103,7 @@ class box_graph_orders_permonth extends ModeleBoxes
 			$prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
 		}
 
-		if ($user->rights->commande->lire) {
+		if ($user->hasRight('commande', 'lire')) {
 			$langs->load("orders");
 
 			$param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year';

+ 1 - 1
htdocs/expedition/shipment.php

@@ -517,7 +517,7 @@ if ($id > 0 || !empty($ref)) {
 			print '<table width="100%" class="nobordernopadding"><tr><td>';
 			print $langs->trans('IncotermLabel');
 			print '<td><td class="right">';
-			if ($user->rights->commande->creer) {
+			if ($user->hasRight('commande', 'creer')) {
 				print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'/expedition/shipment.php?id='.$object->id.'&action=editincoterm&token='.newToken().'">'.img_edit().'</a>';
 			} else {
 				print '&nbsp;';

+ 1 - 1
htdocs/fichinter/document.php

@@ -127,7 +127,7 @@ if ($object->id) {
 	if (isModEnabled('project')) {
 		$langs->load("projects");
 		$morehtmlref .= '<br>'.$langs->trans('Project').' ';
-		if ($user->rights->commande->creer) {
+		if ($user->hasRight('commande', 'creer')) {
 			if ($action != 'classify') {
 				//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
 				$morehtmlref .= ' : ';

+ 1 - 1
htdocs/fichinter/info.php

@@ -82,7 +82,7 @@ $morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl
 if (isModEnabled('project')) {
 	$langs->load("projects");
 	$morehtmlref .= '<br>'.$langs->trans('Project').' ';
-	if ($user->rights->commande->creer) {
+	if ($user->hasRight('commande', 'creer')) {
 		if ($action != 'classify') {
 			//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
 			$morehtmlref .= ' : ';

+ 1 - 1
htdocs/fichinter/note.php

@@ -92,7 +92,7 @@ if ($id > 0 || !empty($ref)) {
 	if (isModEnabled('project')) {
 		$langs->load("projects");
 		$morehtmlref .= '<br>'.$langs->trans('Project').' ';
-		if ($user->rights->commande->creer) {
+		if ($user->hasRight('commande', 'creer')) {
 			if ($action != 'classify') {
 				//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
 				$morehtmlref .= ' : ';

+ 1 - 1
htdocs/product/stats/commande.php

@@ -136,7 +136,7 @@ if ($id > 0 || !empty($ref)) {
 		print dol_get_fiche_end();
 
 
-		if ($user->rights->commande->lire) {
+		if ($user->hasRight('commande', 'lire')) {
 			$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client, c.rowid, d.total_ht as total_ht, c.ref,";
 			$sql .= " c.ref_client,";
 			$sql .= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.rowid, d.qty";

+ 1 - 1
htdocs/resource/element_resource.php

@@ -541,7 +541,7 @@ if (!$ret) {
 			if (isModEnabled('project')) {
 				$langs->load("projects");
 				$morehtmlref .= '<br>'.$langs->trans('Project').' ';
-				if ($user->rights->commande->creer) {
+				if ($user->hasRight('commande', 'creer')) {
 					if ($action != 'classify') {
 						//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $fichinter->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
 						$morehtmlref .= ' : ';