use user->hasRight

This commit is contained in:
Frédéric FRANCE 2023-02-14 22:56:12 +01:00
parent 9d6cf70010
commit ae48571135
34 changed files with 141 additions and 142 deletions

View File

@ -699,7 +699,7 @@ if ($object->id > 0) {
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop boxtablenomarginbottom centpercent">';
$boxstat .= '<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
if (isModEnabled("propal") && $user->rights->propal->lire) {
if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) {
// Box proposals
$tmp = $object->getOutstandingProposals();
$outstandingOpened = $tmp['opened'];
@ -720,7 +720,7 @@ if ($object->id > 0) {
}
}
if (isModEnabled('commande') && $user->rights->commande->lire) {
if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) {
// Box commandes
$tmp = $object->getOutstandingOrders();
$outstandingOpened = $tmp['opened'];
@ -741,7 +741,7 @@ if ($object->id > 0) {
}
}
if (isModEnabled('facture') && $user->rights->facture->lire) {
if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) {
// Box factures
$tmp = $object->getOutstandingBills('customer', 0);
$outstandingOpened = $tmp['opened'];
@ -820,7 +820,7 @@ if ($object->id > 0) {
/*
* Latest proposals
*/
if (isModEnabled("propal") && $user->rights->propal->lire) {
if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) {
$langs->load("propal");
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht";
@ -915,7 +915,7 @@ if ($object->id > 0) {
/*
* Latest orders
*/
if (isModEnabled('commande') && $user->rights->commande->lire) {
if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) {
$param ="";
$sql = "SELECT s.nom, s.rowid";
@ -1124,7 +1124,7 @@ if ($object->id > 0) {
/*
* Latest contracts
*/
if (isModEnabled('contrat') && $user->rights->contrat->lire) {
if (isModEnabled('contrat') && $user->hasRight('contrat', 'lire')) {
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut as contract_status, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup, c.entity,";
$sql .= " c.last_main_doc, c.model_pdf";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
@ -1318,7 +1318,7 @@ if ($object->id > 0) {
/*
* Latest invoices templates
*/
if (isModEnabled('facture') && $user->rights->facture->lire) {
if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) {
$sql = 'SELECT f.rowid as id, f.titre as ref';
$sql .= ', f.total_ht';
$sql .= ', f.total_tva';
@ -1413,7 +1413,7 @@ if ($object->id > 0) {
/*
* Latest invoices
*/
if (isModEnabled('facture') && $user->rights->facture->lire) {
if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) {
$sql = 'SELECT f.rowid as facid, f.ref, f.type';
$sql .= ', f.total_ht';
$sql .= ', f.total_tva';
@ -1557,12 +1557,12 @@ if ($object->id > 0) {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("ThirdPartyIsClosed").'</a></div>';
}
if (isModEnabled("propal") && $user->rights->propal->creer && $object->status == 1) {
if (isModEnabled("propal") && $user->hasRight('propal', 'creer') && $object->status == 1) {
$langs->load("propal");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddProp").'</a></div>';
}
if (isModEnabled('commande') && $user->rights->commande->creer && $object->status == 1) {
if (isModEnabled('commande') && $user->hasRight('commande', 'creer') && $object->status == 1) {
$langs->load("orders");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddOrder").'</a></div>';
}

View File

@ -321,7 +321,7 @@ if (isModEnabled('supplier_proposal') && $user->hasRight("supplier_proposal", "l
* Draft sales orders
*/
if (isModEnabled('commande') && $user->rights->commande->lire) {
if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) {
$sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.total_tva, c.total_ttc, c.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
@ -1008,7 +1008,7 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
/*
* Opened (validated) order
*/
if (isModEnabled('commande') && $user->rights->commande->lire) {
if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) {
$sql = "SELECT c.rowid as commandeid, c.total_ttc, c.total_ht, c.total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";

View File

@ -789,7 +789,7 @@ if (empty($reshook)) {
}
}
} elseif ($action == 'import_lines_from_object'
&& $user->rights->propal->creer
&& $user->hasRight('propal', 'creer')
&& $object->statut == Propal::STATUS_DRAFT
) {
// add lines from objectlinked

View File

@ -3795,7 +3795,7 @@ class Propal extends CommonObject
}
$linkclose = '';
if (empty($notooltip) && $user->rights->propal->lire) {
if (empty($notooltip) && $user->hasRight('propal', 'lire')) {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$label = $langs->trans("Proposal");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';

View File

@ -76,7 +76,7 @@ $usercancreate = $user->hasRight("propal", "creer");
* Add a new contact
*/
if ($action == 'addcontact' && $user->rights->propal->creer) {
if ($action == 'addcontact' && $user->hasRight('propal', 'creer')) {
if ($object->id > 0) {
$contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
@ -94,12 +94,12 @@ if ($action == 'addcontact' && $user->rights->propal->creer) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
} elseif ($action == 'swapstatut' && $user->rights->propal->creer) {
} elseif ($action == 'swapstatut' && $user->hasRight('propal', 'creer')) {
// Toggle the status of a contact
if ($object->id > 0) {
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
}
} elseif ($action == 'deletecontact' && $user->rights->propal->creer) {
} elseif ($action == 'deletecontact' && $user->hasRight('propal', 'creer')) {
// Deletes a contact
$result = $object->delete_contact($lineid);

View File

@ -227,7 +227,7 @@ if ($resql) {
/*
* Open (validated) proposals
*/
if (isModEnabled("propal") && $user->rights->propal->lire) {
if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) {
$sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, s.email, s.code_compta";
$sql .= ", p.rowid as propalid, p.entity, p.total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";

View File

@ -119,7 +119,7 @@ if ($resql) {
/*
* Liste des propal brouillons
*/
if (isModEnabled("propal") && $user->rights->propal->lire) {
if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) {
$sql = "SELECT p.rowid, p.ref, p.price, s.nom as sname";
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
@ -177,7 +177,7 @@ if (isModEnabled('agenda')) {
/*
* Dernieres propales ouvertes
*/
if (isModEnabled("propal") && $user->rights->propal->lire) {
if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) {
$sql = "SELECT s.nom as name, s.rowid as socid, s.client, s.canvas,";
$sql .= " p.rowid as propalid, p.total_ttc, p.ref, p.datep as dp, c.label as statut, c.id as statutid";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";

View File

@ -3820,7 +3820,7 @@ class Commande extends CommonOrder
$label = implode($this->getTooltipContentArray($params));
$linkclose = '';
if (empty($notooltip) && $user->rights->commande->lire) {
if (empty($notooltip) && $user->hasRight('commande', 'lire')) {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$label = $langs->trans("Order");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';

View File

@ -56,7 +56,7 @@ $object = new Commande($db);
* Ajout d'un nouveau contact
*/
if ($action == 'addcontact' && $user->rights->commande->creer) {
if ($action == 'addcontact' && $user->hasRight('commande', 'creer')) {
$result = $object->fetch($id);
if ($result > 0 && $id > 0) {
@ -76,14 +76,14 @@ if ($action == 'addcontact' && $user->rights->commande->creer) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
} elseif ($action == 'swapstatut' && $user->rights->commande->creer) {
} elseif ($action == 'swapstatut' && $user->hasRight('commande', 'creer')) {
// bascule du statut d'un contact
if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db);
}
} elseif ($action == 'deletecontact' && $user->rights->commande->creer) {
} elseif ($action == 'deletecontact' && $user->hasRight('commande', 'creer')) {
// Efface un contact
$object->fetch($id);
$result = $object->delete_contact(GETPOST("lineid", 'int'));

View File

@ -281,15 +281,15 @@ if (empty($reshook)) {
// Update field
// Set condition
if ($action == 'setconditions' && $user->rights->facture->creer) {
if ($action == 'setconditions' && $user->hasRight('facture', 'creer')) {
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
} elseif ($action == 'setmode' && $user->rights->facture->creer) {
} elseif ($action == 'setmode' && $user->hasRight('facture', 'creer')) {
// Set mode
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
} elseif ($action == 'classin' && $user->rights->facture->creer) {
} elseif ($action == 'classin' && $user->hasRight('facture', 'creer')) {
// Set project
$object->setProject(GETPOST('projectid', 'int'));
} elseif ($action == 'setref' && $user->rights->facture->creer) {
} elseif ($action == 'setref' && $user->hasRight('facture', 'creer')) {
// Set bank account
//var_dump(GETPOST('ref', 'alpha'));exit;
$result = $object->setValueFrom('titre', $ref, '', null, 'text', '', $user, 'BILLREC_MODIFY');
@ -306,31 +306,31 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
} elseif ($action == 'setbankaccount' && $user->rights->facture->creer) {
} elseif ($action == 'setbankaccount' && $user->hasRight('facture', 'creer')) {
// Set bank account
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
} elseif ($action == 'setfrequency' && $user->rights->facture->creer) {
} elseif ($action == 'setfrequency' && $user->hasRight('facture', 'creer')) {
// Set frequency and unit frequency
$object->setFrequencyAndUnit(GETPOST('frequency', 'int'), GETPOST('unit_frequency', 'alpha'));
} elseif ($action == 'setdate_when' && $user->rights->facture->creer) {
} elseif ($action == 'setdate_when' && $user->hasRight('facture', 'creer')) {
// Set next date of execution
$date = dol_mktime(GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear'));
if (!empty($date)) {
$object->setNextDate($date);
}
} elseif ($action == 'setnb_gen_max' && $user->rights->facture->creer) {
} elseif ($action == 'setnb_gen_max' && $user->hasRight('facture', 'creer')) {
// Set max period
$object->setMaxPeriod(GETPOST('nb_gen_max', 'int'));
} elseif ($action == 'setauto_validate' && $user->rights->facture->creer) {
} elseif ($action == 'setauto_validate' && $user->hasRight('facture', 'creer')) {
// Set auto validate
$object->setAutoValidate(GETPOST('auto_validate', 'int'));
} elseif ($action == 'setgenerate_pdf' && $user->rights->facture->creer) {
} elseif ($action == 'setgenerate_pdf' && $user->hasRight('facture', 'creer')) {
// Set generate pdf
$object->setGeneratepdf(GETPOST('generate_pdf', 'int'));
} elseif ($action == 'setmodelpdf' && $user->rights->facture->creer) {
} elseif ($action == 'setmodelpdf' && $user->hasRight('facture', 'creer')) {
// Set model pdf
$object->setModelpdf(GETPOST('modelpdf', 'alpha'));
} elseif ($action == 'disable' && $user->rights->facture->creer) {
} elseif ($action == 'disable' && $user->hasRight('facture', 'creer')) {
// Set status disabled
$db->begin();
@ -347,7 +347,7 @@ if (empty($reshook)) {
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'enable' && $user->rights->facture->creer) {
} elseif ($action == 'enable' && $user->hasRight('facture', 'creer')) {
// Set status enabled
$db->begin();
@ -373,7 +373,7 @@ if (empty($reshook)) {
}
// Delete line
if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->facture->creer) {
if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->hasRight('facture', 'creer')) {
$object->fetch($id);
$object->fetch_thirdparty();
@ -417,7 +417,7 @@ if (empty($reshook)) {
}
// Add a new line
if ($action == 'addline' && $user->rights->facture->creer) {
if ($action == 'addline' && $user->hasRight('facture', 'creer')) {
$langs->load('errors');
$error = 0;
@ -1288,7 +1288,7 @@ if ($action == 'create') {
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('PaymentConditionsShort');
print '</td>';
if ($action != 'editconditions' && $user->rights->facture->creer) {
if ($action != 'editconditions' && $user->hasRight('facture', 'creer')) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
}
print '</tr></table>';
@ -1309,7 +1309,7 @@ if ($action == 'create') {
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode');
print '</td>';
if ($action != 'editmode' && $user->rights->facture->creer) {
if ($action != 'editmode' && $user->hasRight('facture', 'creer')) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
}
print '</tr></table>';
@ -1418,7 +1418,7 @@ if ($action == 'create') {
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('BankAccount');
print '<td>';
if (($action != 'editbankaccount') && $user->rights->facture->creer && $object->statut == FactureRec::STATUS_DRAFT) {
if (($action != 'editbankaccount') && $user->hasRight('facture', 'creer') && $object->statut == FactureRec::STATUS_DRAFT) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
}
print '</tr></table>';
@ -1436,7 +1436,7 @@ if ($action == 'create') {
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('Model');
print '<td>';
if (($action != 'editmodelpdf') && $user->rights->facture->creer && $object->statut == FactureRec::STATUS_DRAFT) {
if (($action != 'editmodelpdf') && $user->hasRight('facture', 'creer') && $object->statut == FactureRec::STATUS_DRAFT) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmodelpdf&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetModel'), 1).'</a></td>';
}
print '</tr></table>';
@ -1482,7 +1482,7 @@ if ($action == 'create') {
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Frequency');
print '</td>';
if ($action != 'editfrequency' && $user->rights->facture->creer) {
if ($action != 'editfrequency' && $user->hasRight('facture', 'creer')) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editfrequency&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('Edit'), 1).'</a></td>';
}
print '</tr></table>';
@ -1639,7 +1639,7 @@ if ($action == 'create') {
}
// Form to add new line
if ($object->statut == $object::STATUS_DRAFT && $user->rights->facture->creer && $action != 'valid' && $action != 'editline') {
if ($object->statut == $object::STATUS_DRAFT && $user->hasRight('facture', 'creer') && $action != 'valid' && $action != 'editline') {
if ($action != 'editline') {
// Add free products/services

View File

@ -391,7 +391,7 @@ if (empty($reshook)) {
if ($result < 0) {
dol_print_error($db, $object->error);
}
} elseif ($action == 'setretainedwarrantyconditions' && $user->rights->facture->creer) {
} elseif ($action == 'setretainedwarrantyconditions' && $user->hasRight('facture', 'creer')) {
$object->fetch($id);
$object->retained_warranty_fk_cond_reglement = 0; // To clean property
$result = $object->setRetainedWarrantyPaymentTerms(GETPOST('retained_warranty_fk_cond_reglement', 'int'));
@ -411,13 +411,13 @@ if (empty($reshook)) {
if ($result < 0) {
dol_print_error($db, $object->error);
}
} elseif ($action == 'setretainedwarranty' && $user->rights->facture->creer) {
} elseif ($action == 'setretainedwarranty' && $user->hasRight('facture', 'creer')) {
$object->fetch($id);
$result = $object->setRetainedWarranty(GETPOST('retained_warranty', 'float'));
if ($result < 0) {
dol_print_error($db, $object->error);
}
} elseif ($action == 'setretainedwarrantydatelimit' && $user->rights->facture->creer) {
} elseif ($action == 'setretainedwarrantydatelimit' && $user->hasRight('facture', 'creer')) {
$object->fetch($id);
$result = $object->setRetainedWarrantyDateLimit(GETPOST('retained_warranty_date_limit', 'float'));
if ($result < 0) {
@ -4684,7 +4684,7 @@ if ($action == 'create') {
print '<table id="retained-warranty-table" class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('RetainedWarranty');
print '</td>';
if ($action != 'editretainedwarranty' && $user->rights->facture->creer && $object->statut == Facture::STATUS_DRAFT) {
if ($action != 'editretainedwarranty' && $user->hasRight('facture', 'creer') && $object->statut == Facture::STATUS_DRAFT) {
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarranty&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).'</a></td>';
}
@ -4707,7 +4707,7 @@ if ($action == 'create') {
print '<table id="retained-warranty-cond-reglement-table" class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShortRetainedWarranty');
print '</td>';
if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer && $object->statut == Facture::STATUS_DRAFT) {
if ($action != 'editretainedwarrantypaymentterms' && $user->hasRight('facture', 'creer') && $object->statut == Facture::STATUS_DRAFT) {
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarrantypaymentterms&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).'</a></td>';
}
@ -4742,7 +4742,7 @@ if ($action == 'create') {
print '<table id="retained-warranty-date-limit-table" class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('RetainedWarrantyDateLimit');
print '</td>';
if ($action != 'editretainedwarrantydatelimit' && $user->rights->facture->creer && $object->statut == Facture::STATUS_DRAFT) {
if ($action != 'editretainedwarrantydatelimit' && $user->hasRight('facture', 'creer') && $object->statut == Facture::STATUS_DRAFT) {
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarrantydatelimit&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('setretainedwarrantyDateLimit'), 1).'</a></td>';
}

View File

@ -65,7 +65,7 @@ $usercancreate = $user->hasRight("facture", "creer");
* Add a new contact
*/
if ($action == 'addcontact' && $user->rights->facture->creer) {
if ($action == 'addcontact' && $user->hasRight('facture', 'creer')) {
if ($result > 0 && $id > 0) {
$contactid = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
@ -83,10 +83,10 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
} elseif ($action == 'swapstatut' && $user->rights->facture->creer) {
} elseif ($action == 'swapstatut' && $user->hasRight('facture', 'creer')) {
// Toggle the status of a contact
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} elseif ($action == 'deletecontact' && $user->rights->facture->creer) {
} elseif ($action == 'deletecontact' && $user->hasRight('facture', 'creer')) {
// Deletes a contact
$result = $object->delete_contact($lineid);

View File

@ -483,7 +483,7 @@ if ($object->id > 0) {
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('DateInvoice');
print '</td>';
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) {
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->hasRight('facture', 'creer')) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&token='.newToken().'&id='.$object->id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
}
print '</tr></table>';
@ -506,7 +506,7 @@ if ($object->id > 0) {
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('PaymentConditionsShort');
print '</td>';
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) {
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->hasRight('facture', 'creer')) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&id='.$object->id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
}
print '</tr></table>';
@ -527,7 +527,7 @@ if ($object->id > 0) {
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('DateMaxPayment');
print '</td>';
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) {
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->hasRight('facture', 'creer')) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&token='.newToken().'&id='.$object->id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
}
print '</tr></table>';
@ -556,7 +556,7 @@ if ($object->id > 0) {
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('PaymentMode');
print '</td>';
if ($action != 'editmode' && !empty($object->brouillon) && $user->rights->facture->creer) {
if ($action != 'editmode' && !empty($object->brouillon) && $user->hasRight('facture', 'creer')) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
}
print '</tr></table>';
@ -577,7 +577,7 @@ if ($object->id > 0) {
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('BankAccount');
print '<td>';
if (($action != 'editbankaccount') && $user->rights->commande->creer && !empty($object->brouillon)) {
if (($action != 'editbankaccount') && $user->hasRight('commande', 'creer') && !empty($object->brouillon)) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&id='.$object->id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
}
print '</tr></table>';
@ -662,7 +662,7 @@ if ($object->id > 0) {
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('RevenueStamp');
print '</td>';
if ($action != 'editrevenuestamp' && !empty($object->brouillon) && $user->rights->facture->creer) {
if ($action != 'editrevenuestamp' && !empty($object->brouillon) && $user->hasRight('facture', 'creer')) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editrevenuestamp&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).'</a></td>';
}
print '</tr></table>';

View File

@ -117,7 +117,7 @@ if ($id > 0) {
dol_banner_tab($object, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 1);
print dol_get_fiche_end();
if (isModEnabled('facture') && $user->rights->facture->lire) {
if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) {
// Invoice list
print load_fiche_titre($langs->trans("CustomerPreview"));

View File

@ -156,16 +156,16 @@ print '</td></tr>';
if ($object->thirdparty->client) {
$thirdTypeArray['customer'] = $langs->trans("customer");
if (isModEnabled("propal") && $user->rights->propal->lire) {
if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) {
$elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals');
}
if (isModEnabled('commande') && $user->rights->commande->lire) {
if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) {
$elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders');
}
if (isModEnabled('facture') && $user->rights->facture->lire) {
if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) {
$elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices');
}
if (isModEnabled('contrat') && $user->rights->contrat->lire) {
if (isModEnabled('contrat') && $user->hasRight('contrat', 'lire')) {
$elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts');
}
}

View File

@ -214,7 +214,7 @@ if (empty($reshook)) {
}
// Add contract
if ($action == 'add' && $user->rights->contrat->creer) {
if ($action == 'add' && $user->hasRight('contrat', 'creer')) {
// Check
if (empty($datecontrat)) {
$error++;
@ -408,9 +408,9 @@ if (empty($reshook)) {
$action = 'create';
}
}
} elseif ($action == 'classin' && $user->rights->contrat->creer) {
} elseif ($action == 'classin' && $user->hasRight('contrat', 'creer')) {
$object->setProject(GETPOST('projectid'));
} elseif ($action == 'addline' && $user->rights->contrat->creer) {
} elseif ($action == 'addline' && $user->hasRight('contrat', 'creer')) {
// Add a new line
// Set if we used free entry or predefined product
$predef = '';
@ -682,7 +682,7 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
} elseif ($action == 'updateline' && $user->rights->contrat->creer && !GETPOST('cancel', 'alpha')) {
} elseif ($action == 'updateline' && $user->hasRight('contrat', 'creer') && !GETPOST('cancel', 'alpha')) {
$error = 0;
$predef = '';
@ -795,7 +795,7 @@ if (empty($reshook)) {
} else {
$db->rollback();
}
} elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->contrat->creer) {
} elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->hasRight('contrat', 'creer')) {
$result = $object->deleteline(GETPOST('lineid', 'int'), $user);
if ($result >= 0) {
@ -804,7 +804,7 @@ if (empty($reshook)) {
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer) {
} elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->hasRight('contrat', 'creer')) {
$result = $object->validate($user);
if ($result > 0) {
@ -830,18 +830,18 @@ if (empty($reshook)) {
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'reopen' && $user->rights->contrat->creer) {
} elseif ($action == 'reopen' && $user->hasRight('contrat', 'creer')) {
$result = $object->reopen($user);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->contrat->creer) {
} elseif ($action == 'confirm_close' && $confirm == 'yes' && $user->hasRight('contrat', 'creer')) {
// Close all lines
$result = $object->closeAll($user);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'confirm_activate' && $confirm == 'yes' && $user->rights->contrat->creer) {
} elseif ($action == 'confirm_activate' && $confirm == 'yes' && $user->hasRight('contrat', 'creer')) {
$date_start = dol_mktime(12, 0, 0, GETPOST('d_startmonth'), GETPOST('d_startday'), GETPOST('d_startyear'));
$date_end = dol_mktime(12, 0, 0, GETPOST('d_endmonth'), GETPOST('d_endday'), GETPOST('d_endyear'));
$comment = GETPOST('comment', 'alpha');
@ -857,7 +857,7 @@ if (empty($reshook)) {
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contrat->creer) {
} elseif ($action == 'confirm_move' && $confirm == 'yes' && $user->hasRight('contrat', 'creer')) {
if (GETPOST('newcid') > 0) {
$contractline = new ContratLigne($db);
$result = $contractline->fetch(GETPOSTINT('lineid'));
@ -995,7 +995,7 @@ if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat->creer) {
if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->hasRight('contrat', 'creer')) {
if ($action == 'addcontact') {
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
@ -1351,7 +1351,7 @@ if ($action == 'create') {
// Contract
if (!empty($object->brouillon) && $user->rights->contrat->creer) {
if (!empty($object->brouillon) && $user->hasRight('contrat', 'creer')) {
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setremise">';
@ -1448,7 +1448,7 @@ if ($action == 'create') {
print '</div>';
if (!empty($object->brouillon) && $user->rights->contrat->creer) {
if (!empty($object->brouillon) && $user->hasRight('contrat', 'creer')) {
print '</form>';
}
@ -1826,7 +1826,7 @@ if ($action == 'create') {
/*
* Confirmation to delete service line of contract
*/
if ($action == 'deleteline' && !$_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline - 1]->id == GETPOST('rowid')) {
if ($action == 'deleteline' && !$_REQUEST["cancel"] && $user->hasRight('contrat', 'creer') && $object->lines[$cursorline - 1]->id == GETPOST('rowid')) {
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'), $langs->trans("DeleteContractLine"), $langs->trans("ConfirmDeleteContractLine"), "confirm_deleteline", '', 0, 1);
if ($ret == 'html') {
print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>';
@ -1836,7 +1836,7 @@ if ($action == 'create') {
/*
* Confirmation to move service toward another contract
*/
if ($action == 'move' && !$_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline - 1]->id == GETPOST('rowid')) {
if ($action == 'move' && !$_REQUEST["cancel"] && $user->hasRight('contrat', 'creer') && $object->lines[$cursorline - 1]->id == GETPOST('rowid')) {
$arraycontractid = array();
foreach ($arrayothercontracts as $contractcursor) {
$arraycontractid[$contractcursor->id] = $contractcursor->ref;

View File

@ -2062,7 +2062,7 @@ class Contrat extends CommonObject
$label = implode($this->getTooltipContentArray($params));
$linkclose = '';
if (empty($notooltip) && $user->rights->contrat->lire) {
if (empty($notooltip) && $user->hasRight('contrat', 'lire')) {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$label = $langs->trans("ShowContract");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';

View File

@ -61,7 +61,7 @@ $permissiontoadd = $user->rights->contrat->creer; // Used by the include
* Actions
*/
if ($action == 'addcontact' && $user->rights->contrat->creer) {
if ($action == 'addcontact' && $user->hasRight('contrat', 'creer')) {
$result = $object->fetch($id);
if ($result > 0 && $id > 0) {
@ -86,7 +86,7 @@ if ($action == 'addcontact' && $user->rights->contrat->creer) {
}
// bascule du statut d'un contact
if ($action == 'swapstatut' && $user->rights->contrat->creer) {
if ($action == 'swapstatut' && $user->hasRight('contrat', 'creer')) {
if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
@ -95,7 +95,7 @@ if ($action == 'swapstatut' && $user->rights->contrat->creer) {
}
// Delete contact
if ($action == 'deletecontact' && $user->rights->contrat->creer) {
if ($action == 'deletecontact' && $user->hasRight('contrat', 'creer')) {
$object->fetch($id);
$result = $object->delete_contact(GETPOST("lineid", 'int'));

View File

@ -239,7 +239,7 @@ print "</table></div><br>";
// Draft contracts
if (isModEnabled('contrat') && $user->rights->contrat->lire) {
if (isModEnabled('contrat') && $user->hasRight('contrat', 'lire')) {
$sql = "SELECT c.rowid, c.ref,";
$sql .= " s.nom as name, s.name_alias, s.logo, s.rowid as socid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s";

View File

@ -80,7 +80,7 @@ if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_e
if ($user->rights->$element->lire || $user->rights->$element->read
|| (isset($subelement) && ($user->rights->$element->$subelement->lire || $user->rights->$element->$subelement->read))
|| ($element == 'payment' && $user->rights->facture->lire)
|| ($element == 'payment' && $user->hasRight('facture', 'lire'))
|| ($element == 'payment_supplier' && $user->rights->fournisseur->facture->lire)) {
if ($type == 'select') {
$methodname = 'load_cache_'.$loadmethod;

View File

@ -74,13 +74,13 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
// Make test on permission
$perm = 0;
if ($table_element_line == 'propaldet' && $user->rights->propal->creer) {
if ($table_element_line == 'propaldet' && $user->hasRight('propal', 'creer')) {
$perm = 1;
} elseif ($table_element_line == 'commandedet' && $user->rights->commande->creer) {
} elseif ($table_element_line == 'commandedet' && $user->hasRight('commande', 'creer')) {
$perm = 1;
} elseif ($table_element_line == 'facturedet' && $user->rights->facture->creer) {
} elseif ($table_element_line == 'facturedet' && $user->hasRight('facture', 'creer')) {
$perm = 1;
} elseif ($table_element_line == 'facturedet_rec' && $user->rights->facture->creer) {
} elseif ($table_element_line == 'facturedet_rec' && $user->hasRight('facture', 'creer')) {
$perm = 1;
} elseif ($table_element_line == 'emailcollector_emailcollectoraction' && $user->admin) {
$perm = 1;

View File

@ -81,7 +81,7 @@ class box_services_contracts extends ModeleBoxes
$this->info_box_head = array('text' => $langs->trans("BoxLastProductsInContract", $max));
if ($user->rights->service->lire && $user->rights->contrat->lire) {
if ($user->rights->service->lire && $user->hasRight('contrat', 'lire')) {
$contractstatic = new Contrat($this->db);
$contractlinestatic = new ContratLigne($this->db);
$thirdpartytmp = new Societe($this->db);

View File

@ -432,7 +432,7 @@ function show_stats_for_company($product, $socid)
print '</tr>';
// Customer proposals
if (isModEnabled("propal") && $user->rights->propal->lire) {
if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) {
$nblines++;
$ret = $product->load_stats_propale($socid);
if ($ret < 0) {
@ -470,7 +470,7 @@ function show_stats_for_company($product, $socid)
print '</tr>';
}
// Sales orders
if (isModEnabled('commande') && $user->rights->commande->lire) {
if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) {
$nblines++;
$ret = $product->load_stats_commande($socid);
if ($ret < 0) {
@ -508,7 +508,7 @@ function show_stats_for_company($product, $socid)
print '</tr>';
}
// Customer invoices
if (isModEnabled('facture') && $user->rights->facture->lire) {
if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) {
$nblines++;
$ret = $product->load_stats_facture($socid);
if ($ret < 0) {
@ -527,7 +527,7 @@ function show_stats_for_company($product, $socid)
print '</tr>';
}
// Customer template invoices
if (isModEnabled("facture") && $user->rights->facture->lire) {
if (isModEnabled("facture") && $user->hasRight('facture', 'lire')) {
$nblines++;
$ret = $product->load_stats_facturerec($socid);
if ($ret < 0) {
@ -566,7 +566,7 @@ function show_stats_for_company($product, $socid)
}
// Contracts
if (isModEnabled('contrat') && $user->rights->contrat->lire) {
if (isModEnabled('contrat') && $user->hasRight('contrat', 'lire')) {
$nblines++;
$ret = $product->load_stats_contrat($socid);
if ($ret < 0) {

View File

@ -945,25 +945,25 @@ class doc_generic_project_odt extends ModelePDFProjects
'title' => "ListProposalsAssociatedProject",
'class' => 'Propal',
'table' => 'propal',
'test' => $conf->propal->enabled && $user->rights->propal->lire
'test' => $conf->propal->enabled && $user->hasRight('propal', 'lire')
),
'order' => array(
'title' => "ListOrdersAssociatedProject",
'class' => 'Commande',
'table' => 'commande',
'test' => $conf->commande->enabled && $user->rights->commande->lire
'test' => $conf->commande->enabled && $user->hasRight('commande', 'lire')
),
'invoice' => array(
'title' => "ListInvoicesAssociatedProject",
'class' => 'Facture',
'table' => 'facture',
'test' => $conf->facture->enabled && $user->rights->facture->lire
'test' => $conf->facture->enabled && $user->hasRight('facture', 'lire')
),
'invoice_predefined' => array(
'title' => "ListPredefinedInvoicesAssociatedProject",
'class' => 'FactureRec',
'table' => 'facture_rec',
'test' => $conf->facture->enabled && $user->rights->facture->lire
'test' => $conf->facture->enabled && $user->hasRight('facture', 'lire')
),
'proposal_supplier' => array(
'title' => "ListSupplierProposalsAssociatedProject",
@ -987,7 +987,7 @@ class doc_generic_project_odt extends ModelePDFProjects
'title' => "ListContractAssociatedProject",
'class' => 'Contrat',
'table' => 'contrat',
'test' => $conf->contrat->enabled && $user->rights->contrat->lire
'test' => $conf->contrat->enabled && $user->hasRight('contrat', 'lire')
),
'intervention' => array(
'title' => "ListFichinterAssociatedProject",

View File

@ -374,7 +374,7 @@ class pdf_beluga extends ModelePDFProjects
'class'=>'Propal',
'table'=>'propal',
'datefieldname'=>'datep',
'test'=>$conf->propal->enabled && $user->rights->propal->lire,
'test'=>$conf->propal->enabled && $user->hasRight('propal', 'lire'),
'lang'=>'propal'),
'order'=>array(
'name'=>"CustomersOrders",
@ -382,7 +382,7 @@ class pdf_beluga extends ModelePDFProjects
'class'=>'Commande',
'table'=>'commande',
'datefieldname'=>'date_commande',
'test'=>$conf->commande->enabled && $user->rights->commande->lire,
'test'=>$conf->commande->enabled && $user->hasRight('commande', 'lire'),
'lang'=>'orders'),
'invoice'=>array(
'name'=>"CustomersInvoices",
@ -391,7 +391,7 @@ class pdf_beluga extends ModelePDFProjects
'margin'=>'add',
'table'=>'facture',
'datefieldname'=>'datef',
'test'=>$conf->facture->enabled && $user->rights->facture->lire,
'test'=>$conf->facture->enabled && $user->hasRight('facture', 'lire'),
'lang'=>'bills'),
'invoice_predefined'=>array(
'name'=>"PredefinedInvoices",
@ -399,7 +399,7 @@ class pdf_beluga extends ModelePDFProjects
'class'=>'FactureRec',
'table'=>'facture_rec',
'datefieldname'=>'datec',
'test'=>$conf->facture->enabled && $user->rights->facture->lire,
'test'=>$conf->facture->enabled && $user->hasRight('facture', 'lire'),
'lang'=>'bills'),
'order_supplier'=>array(
'name'=>"SuppliersOrders",
@ -424,7 +424,7 @@ class pdf_beluga extends ModelePDFProjects
'class'=>'Contrat',
'table'=>'contrat',
'datefieldname'=>'date_contrat',
'test'=>$conf->contrat->enabled && $user->rights->contrat->lire,
'test'=>$conf->contrat->enabled && $user->hasRight('contrat', 'lire'),
'lang'=>'contract'),
'intervention'=>array(
'name'=>"Interventions",

View File

@ -104,7 +104,7 @@ if (empty($reshook)) {
if ($action == 'confirm_cloture' && GETPOST('confirm', 'alpha') == 'yes') {
$object->fetch($id);
$result = $object->cloture($user);
} elseif ($action == 'setref_client' && $user->rights->commande->creer) {
} elseif ($action == 'setref_client' && $user->hasRight('commande', 'creer')) {
// Positionne ref commande client
$result = $object->set_ref_client($user, GETPOST('ref_client'));
if ($result < 0) {
@ -112,7 +112,7 @@ if (empty($reshook)) {
}
}
if ($action == 'setdatedelivery' && $user->rights->commande->creer) {
if ($action == 'setdatedelivery' && $user->hasRight('commande', 'creer')) {
$datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'));
$object->fetch($id);
@ -122,7 +122,7 @@ if (empty($reshook)) {
}
}
/*
if ($action == 'setdeliveryaddress' && $user->rights->commande->creer)
if ($action == 'setdeliveryaddress' && $user->hasRight('commande', 'creer'))
{
$object = new Commande($db);
$object->fetch($id);
@ -131,7 +131,7 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
}
*/
if ($action == 'setmode' && $user->rights->commande->creer) {
if ($action == 'setmode' && $user->hasRight('commande', 'creer')) {
$object->fetch($id);
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
if ($result < 0) {
@ -139,7 +139,7 @@ if (empty($reshook)) {
}
}
if ($action == 'setavailability' && $user->rights->commande->creer) {
if ($action == 'setavailability' && $user->hasRight('commande', 'creer')) {
$object->fetch($id);
$result = $object->availability(GETPOST('availability_id'));
if ($result < 0) {
@ -147,7 +147,7 @@ if (empty($reshook)) {
}
}
if ($action == 'setdemandreason' && $user->rights->commande->creer) {
if ($action == 'setdemandreason' && $user->hasRight('commande', 'creer')) {
$object->fetch($id);
$result = $object->demand_reason(GETPOST('demand_reason_id'));
if ($result < 0) {
@ -155,7 +155,7 @@ if (empty($reshook)) {
}
}
if ($action == 'setconditions' && $user->rights->commande->creer) {
if ($action == 'setconditions' && $user->hasRight('commande', 'creer')) {
$object->fetch($id);
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
if ($result < 0) {
@ -170,7 +170,7 @@ if (empty($reshook)) {
}
// shipping method
if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
if ($action == 'setshippingmethod' && $user->hasRight('commande', 'creer')) {
$object->fetch($id);
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
if ($result < 0) {
@ -179,7 +179,7 @@ if (empty($reshook)) {
}
// warehouse
if ($action == 'setwarehouse' && $user->rights->commande->creer) {
if ($action == 'setwarehouse' && $user->hasRight('commande', 'creer')) {
$object->fetch($id);
$result = $object->setWarehouse(GETPOST('warehouse_id', 'int'));
if ($result < 0) {
@ -210,7 +210,7 @@ if (empty($reshook)) {
}
}
if ($action == 'set_thirdparty' && $user->rights->commande->creer) {
if ($action == 'set_thirdparty' && $user->hasRight('commande', 'creer')) {
$object->fetch($id);
$object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY');
@ -427,7 +427,7 @@ if ($id > 0 || !empty($ref)) {
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('Warehouse');
print '</td>';
if ($action != 'editwarehouse' && $user->rights->commande->creer) {
if ($action != 'editwarehouse' && $user->hasRight('commande', 'creer')) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editwarehouse&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetWarehouse'), 1).'</a></td>';
}
print '</tr></table>';

View File

@ -456,7 +456,7 @@ if (empty($reshook)) {
if ($result < 0) {
dol_print_error($db, $object->error);
}
} elseif ($action == 'setcontract' && $user->rights->contrat->creer) {
} elseif ($action == 'setcontract' && $user->hasRight('contrat', 'creer')) {
// Set into a contract
$result = $object->set_contrat($user, GETPOST('contratid', 'int'));
if ($result < 0) {

View File

@ -2846,7 +2846,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action ==
//print '<div class="fichecenter"><div class="fichehalfleft">';
// Propals
if (isModEnabled("propal") && $user->rights->propal->creer) {
if (isModEnabled("propal") && $user->hasRight('propal', 'creer')) {
$propal = new Propal($db);
$langs->load("propal");
@ -2867,7 +2867,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action ==
}
// Commande
if (isModEnabled('commande') && $user->rights->commande->creer) {
if (isModEnabled('commande') && $user->hasRight('commande', 'creer')) {
$commande = new Commande($db);
$langs->load("orders");
@ -2887,7 +2887,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action ==
}
// Factures
if (isModEnabled('facture') && $user->rights->facture->creer) {
if (isModEnabled('facture') && $user->hasRight('facture', 'creer')) {
$invoice = new Facture($db);
$langs->load("bills");

View File

@ -1530,15 +1530,15 @@ if ($action == 'create' && $user->rights->projet->creer) {
print'<a style="margin-right: auto;"class="dropdown-toggle butAction" data-toggle="dropdown">'.$langs->trans("Create").'</a>';
print '<div class="dropdown-menu">';
print '<div class="dropdown-global-search-button-list" >';
if (isModEnabled("propal") && $user->rights->propal->creer) {
if (isModEnabled("propal") && $user->hasRight('propal', 'creer')) {
$langs->load("propal");
print dolGetButtonAction('', $langs->trans('AddProp'), 'default', DOL_URL_ROOT.'/comm/propal/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
}
if (isModEnabled('commande') && $user->rights->commande->creer) {
if (isModEnabled('commande') && $user->hasRight('commande', 'creer')) {
$langs->load("orders");
print dolGetButtonAction('', $langs->trans('CreateOrder'), 'default', DOL_URL_ROOT.'/commande/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
}
if (isModEnabled('facture') && $user->rights->facture->creer) {
if (isModEnabled('facture') && $user->hasRight('facture', 'creer')) {
$langs->load("bills");
print dolGetButtonAction('', $langs->trans('CreateBill'), 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
}
@ -1558,7 +1558,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
$langs->load("interventions");
print dolGetButtonAction('', $langs->trans('AddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
}
if (isModEnabled('contrat') && $user->rights->contrat->creer) {
if (isModEnabled('contrat') && $user->hasRight('contrat', 'creer')) {
$langs->load("contracts");
print dolGetButtonAction('', $langs->trans('AddContract'), 'default', DOL_URL_ROOT.'/contrat/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
}

View File

@ -1388,7 +1388,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print '<input type="hidden" name="action" value="updatesplitline">';
} elseif ($action == 'createtime' && $user->rights->projet->time) {
print '<input type="hidden" name="action" value="addtimespent">';
} elseif ($massaction == 'generateinvoice' && $user->rights->facture->creer) {
} elseif ($massaction == 'generateinvoice' && $user->hasRight('facture', 'creer')) {
print '<input type="hidden" name="action" value="confirm_generateinvoice">';
} elseif ($massaction == 'generateinter' && $user->rights->ficheinter->creer) {
print '<input type="hidden" name="action" value="confirm_generateinter">';

View File

@ -167,16 +167,16 @@ if ($object->client) {
$obj = $db->fetch_object($resql);
$nbFactsClient = $obj->nb;
$thirdTypeArray['customer'] = $langs->trans("customer");
if (isModEnabled("propal") && $user->rights->propal->lire) {
if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) {
$elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals');
}
if (isModEnabled('commande') && $user->rights->commande->lire) {
if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) {
$elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders');
}
if (isModEnabled('facture') && $user->rights->facture->lire) {
if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) {
$elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices');
}
if (isModEnabled('contrat') && $user->rights->contrat->lire) {
if (isModEnabled('contrat') && $user->hasRight('contrat', 'lire')) {
$elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts');
}
}

View File

@ -903,16 +903,16 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
$obj = $db->fetch_object($resql);
$nbFactsClient = $obj->nb;
$thirdTypeArray['customer'] = $langs->trans("customer");
if (isModEnabled("propal") && $user->rights->propal->lire) {
if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) {
$elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals');
}
if (isModEnabled('commande') && $user->rights->commande->lire) {
if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) {
$elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders');
}
if (isModEnabled('facture') && $user->rights->facture->lire) {
if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) {
$elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices');
}
if (isModEnabled('contrat') && $user->rights->contrat->lire) {
if (isModEnabled('contrat') && $user->hasRight('contrat', 'lire')) {
$elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts');
}
@ -964,16 +964,16 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
$obj = $db->fetch_object($resql);
$nbFactsClient = $obj->nb;
$thirdTypeArray['customer'] = $langs->trans("customer");
if (isModEnabled('propal') && $user->rights->propal->lire) {
if (isModEnabled('propal') && $user->hasRight('propal', 'lire')) {
$elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals');
}
if (isModEnabled('commande') && $user->rights->commande->lire) {
if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) {
$elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders');
}
if (isModEnabled('facture') && $user->rights->facture->lire) {
if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) {
$elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices');
}
if (isModEnabled('contrat') && $user->rights->contrat->lire) {
if (isModEnabled('contrat') && $user->hasRight('contrat', 'lire')) {
$elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts');
}
}

View File

@ -2563,7 +2563,7 @@ class SupplierProposal extends CommonObject
}
$linkclose = '';
if (empty($notooltip) && $user->rights->propal->lire) {
if (empty($notooltip) && $user->hasRight('propal', 'lire')) {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$label = $langs->trans("ShowSupplierProposal");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';

View File

@ -166,7 +166,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook)) {
// Action to record a payment on a TakePOS invoice
if ($action == 'valid' && $user->rights->facture->creer) {
if ($action == 'valid' && $user->hasRight('facture', 'creer')) {
$bankaccount = 0;
$error = 0;
@ -305,7 +305,7 @@ if (empty($reshook)) {
}
}
if ($action == 'creditnote' && $user->rights->facture->creer) {
if ($action == 'creditnote' && $user->hasRight('facture', 'creer')) {
$creditnote = new Facture($db);
$creditnote->socid = $invoice->socid;
$creditnote->date = dol_now();
@ -1692,4 +1692,3 @@ print '</div>';
if ((getDolGlobalString('TAKEPOS_PHONE_BASIC_LAYOUT') == 1 && $conf->browser->layout == 'phone') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
print '</body></html>';
}