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