Merge pull request #24059 from frederic34/patch-5

use hasRight and isModEnabled
This commit is contained in:
Laurent Destailleur 2023-03-02 14:11:39 +01:00 committed by GitHub
commit 54fbed2142
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 56 additions and 57 deletions

View File

@ -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);
}

View File

@ -88,8 +88,8 @@ if ($id > 0 || !empty($ref)) {
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
$permissiontoread = $user->rights->bookcal->availabilities->read;
$permissiontoadd = $user->rights->bookcal->availabilities->write;
$permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
$permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write');
} else {
$permissiontoread = 1;
$permissiontoadd = 1;
@ -100,7 +100,7 @@ if ($enablepermissioncheck) {
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->bookcal->enabled)) accessforbidden();
if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();

View File

@ -77,11 +77,11 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
$permissiontoread = $user->rights->bookcal->availabilities->read;
$permissiontoadd = $user->rights->bookcal->availabilities->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->bookcal->availabilities->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$permissionnote = $user->rights->bookcal->availabilities->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->bookcal->availabilities->write; // Used by the include of actions_dellink.inc.php
$permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
$permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->hasRight('bookcal', 'availabilities', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$permissionnote = $user->hasRight('bookcal', 'availabilities', 'write'); // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->hasRight('bookcal', 'availabilities', 'write'); // Used by the include of actions_dellink.inc.php
} else {
$permissiontoread = 1;
$permissiontoadd = 1; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
@ -97,7 +97,7 @@ $upload_dir = $conf->bookcal->multidir_output[isset($object->entity) ? $object->
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->bookcal->enabled)) accessforbidden();
if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();

View File

@ -53,8 +53,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
$permissiontoread = $user->rights->bookcal->availabilities->read;
$permission = $user->rights->bookcal->availabilities->write;
$permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
$permission = $user->hasRight('bookcal', 'availabilities', 'write');
} else {
$permissiontoread = 1;
$permission = 1;
@ -65,7 +65,7 @@ if ($enablepermissioncheck) {
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->bookcal->enabled)) accessforbidden();
if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();

View File

@ -78,8 +78,8 @@ if ($id > 0 || !empty($ref)) {
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
$permissiontoread = $user->rights->bookcal->availabilities->read;
$permissiontoadd = $user->rights->bookcal->availabilities->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
$permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
$permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
} else {
$permissiontoread = 1;
$permissiontoadd = 1;
@ -90,7 +90,7 @@ if ($enablepermissioncheck) {
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->bookcal->enabled)) accessforbidden();
if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();
@ -192,9 +192,9 @@ if ($object->id) {
print dol_get_fiche_end();
$modulepart = 'bookcal';
//$permissiontoadd = $user->rights->bookcal->availabilities->write;
//$permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write');
$permissiontoadd = 1;
//$permtoedit = $user->rights->bookcal->availabilities->write;
//$permtoedit = $user->hasRight('bookcal', 'availabilities', 'write');
$permtoedit = 1;
$param = '&id='.$object->id;

View File

@ -132,9 +132,9 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
$permissiontoread = $user->rights->bookcal->availabilities->read;
$permissiontoadd = $user->rights->bookcal->availabilities->write;
$permissiontodelete = $user->rights->bookcal->availabilities->delete;
$permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
$permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write');
$permissiontodelete = $user->hasRight('bookcal', 'availabilities', 'delete');
} else {
$permissiontoread = 1;
$permissiontoadd = 1;
@ -147,7 +147,7 @@ if ($user->socid > 0) accessforbidden();
//$socid = 0; if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->bookcal->enabled)) accessforbidden('Module not enabled');
if (!isModEnabled('bookcal')) accessforbidden('Module not enabled');
if (!$permissiontoread) accessforbidden();

View File

@ -56,9 +56,9 @@ if ($id > 0 || !empty($ref)) {
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
$permissiontoread = $user->rights->bookcal->availabilities->read;
$permissiontoadd = $user->rights->bookcal->availabilities->write;
$permissionnote = $user->rights->bookcal->availabilities->write; // Used by the include of actions_setnotes.inc.php
$permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
$permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write');
$permissionnote = $user->hasRight('bookcal', 'availabilities', 'write'); // Used by the include of actions_setnotes.inc.php
} else {
$permissiontoread = 1;
$permissiontoadd = 1;
@ -70,7 +70,7 @@ if ($enablepermissioncheck) {
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->bookcal->enabled)) accessforbidden();
if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();

View File

@ -71,7 +71,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
// BEGIN MODULEBUILDER DRAFT MYOBJECT
// Draft MyObject
if ($user->rights->bookcal->availabilities->read && !empty($conf->bookcal->enabled)) {
if ($user->hasRight('bookcal', 'availabilities', 'read') && isModEnabled('bookcal')) {
$langs->load("orders");
$sql = "SELECT rowid, `ref`, fk_soc, fk_project, description, note_public, note_private, date_creation, tms, fk_user_creat, fk_user_modif, last_main_doc, import_key, model_pdf, status, firstname, lastname, email, `start`, duration";
@ -143,8 +143,7 @@ $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
// Last modified myobject
if (! empty($conf->bookcal->enabled))
{
if (isModEnabled('bookcal')) {
$sql = "SELECT rowid, `ref`, fk_soc, fk_project, description, note_public, note_private, date_creation, tms, fk_user_creat, fk_user_modif, last_main_doc, import_key, model_pdf, status, firstname, lastname, email, `start`, duration";
$sql .= " FROM ". MAIN_DB_PREFIX . 'bookcal_booking';
print "here2";

View File

@ -100,7 +100,7 @@ if ($enablepermissioncheck) {
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->bookcal->enabled)) accessforbidden();
if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();

View File

@ -97,7 +97,7 @@ $upload_dir = $conf->bookcal->multidir_output[isset($object->entity) ? $object->
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->bookcal->enabled)) accessforbidden();
if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();

View File

@ -65,7 +65,7 @@ if ($enablepermissioncheck) {
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->bookcal->enabled)) accessforbidden();
if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();

View File

@ -90,7 +90,7 @@ if ($enablepermissioncheck) {
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->bookcal->enabled)) accessforbidden();
if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();

View File

@ -147,7 +147,7 @@ if ($user->socid > 0) accessforbidden();
//$socid = 0; if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->bookcal->enabled)) accessforbidden('Module not enabled');
if (!isModEnabled('bookcal')) accessforbidden('Module not enabled');
if (!$permissiontoread) accessforbidden();

View File

@ -70,7 +70,7 @@ if ($enablepermissioncheck) {
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->bookcal->enabled)) accessforbidden();
if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();

View File

@ -201,7 +201,7 @@ class Availabilities extends CommonObject
}
// Example to show how to set values of fields definition dynamically
/*if ($user->rights->bookcal->availabilities->read) {
/*if ($user->hasRight('bookcal', 'availabilities', 'read')) {
$this->fields['myfield']['visible'] = 1;
$this->fields['myfield']['noteditable'] = 0;
}*/
@ -516,7 +516,7 @@ class Availabilities extends CommonObject
return 0;
}
/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bookcal->availabilities->write))
/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('bookcal', 'availabilities', 'write'))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bookcal->availabilities->availabilities_advance->validate))))
{
$this->error='NotEnoughPermissions';

View File

@ -332,14 +332,14 @@ class Commande extends CommonOrder
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160),
//'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>170),
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'isModEnabled("banque")', 'visible'=>-1, 'position'=>170),
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'MulticurrencyID', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>181),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'$conf->stock->enabled', 'visible'=>-1, 'position'=>200),
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'isModEnabled("stock")', 'visible'=>-1, 'position'=>200),
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>210),
//'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
@ -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();
@ -2531,7 +2531,7 @@ class Commande extends CommonOrder
$remise = price2num($remise);
if ($user->rights->commande->creer) {
if ($user->hasRight('commande', 'creer')) {
$error = 0;
$this->db->begin();
@ -2591,7 +2591,7 @@ class Commande extends CommonOrder
public function set_date($user, $date, $notrigger = 0)
{
// phpcs:enable
if ($user->rights->commande->creer) {
if ($user->hasRight('commande', 'creer')) {
$error = 0;
$this->db->begin();
@ -2663,7 +2663,7 @@ class Commande extends CommonOrder
*/
public function setDeliveryDate($user, $delivery_date, $notrigger = 0)
{
if ($user->rights->commande->creer) {
if ($user->hasRight('commande', 'creer')) {
$error = 0;
$this->db->begin();
@ -2922,7 +2922,7 @@ class Commande extends CommonOrder
public function set_ref_client($user, $ref_client, $notrigger = 0)
{
// phpcs:enable
if ($user->rights->commande->creer) {
if ($user->hasRight('commande', 'creer')) {
$error = 0;
$this->db->begin();
@ -3174,17 +3174,17 @@ class Commande extends CommonOrder
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
$total_ht = $tabprice[0];
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
$total_localtax1 = $tabprice[9];
$total_localtax2 = $tabprice[10];
$pu_ht = $tabprice[3];
$pu_ht = $tabprice[3];
$pu_tva = $tabprice[4];
$pu_ttc = $tabprice[5];
// MultiCurrency
$multicurrency_total_ht = $tabprice[16];
$multicurrency_total_ht = $tabprice[16];
$multicurrency_total_tva = $tabprice[17];
$multicurrency_total_ttc = $tabprice[18];
$pu_ht_devise = $tabprice[19];

View File

@ -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);
}

View File

@ -2116,7 +2116,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");

View File

@ -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";

View File

@ -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';

View File

@ -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;';

View File

@ -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 .= ' : ';

View File

@ -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 .= ' : ';

View File

@ -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 .= ' : ';

View File

@ -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";

View File

@ -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 .= ' : ';