|
@@ -605,7 +605,7 @@ if (empty($reshook)) {
|
|
|
$info_bits |= 0x01;
|
|
|
}
|
|
|
|
|
|
- if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance))
|
|
|
+ if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('produit', 'ignore_price_min_advance'))
|
|
|
|| empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) {
|
|
|
$object->error = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
|
|
|
$result = -1;
|
|
@@ -1388,18 +1388,18 @@ if ($action == 'create') {
|
|
|
if (!empty($modCodeContract->code_auto)) {
|
|
|
$morehtmlref .= $object->ref;
|
|
|
} else {
|
|
|
- $morehtmlref .= $form->editfieldkey("", 'ref', $object->ref, $object, $user->rights->contrat->creer, 'string', '', 0, 3);
|
|
|
- $morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->rights->contrat->creer, 'string', '', 0, 2);
|
|
|
+ $morehtmlref .= $form->editfieldkey("", 'ref', $object->ref, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 3);
|
|
|
+ $morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 2);
|
|
|
}
|
|
|
|
|
|
$morehtmlref .= '<div class="refidno">';
|
|
|
// Ref customer
|
|
|
- $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', 0, 1);
|
|
|
- $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1, 'getFormatedCustomerRef');
|
|
|
+ $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 1);
|
|
|
+ $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->hasRight('contrat', 'creer'), 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1, 'getFormatedCustomerRef');
|
|
|
// Ref supplier
|
|
|
$morehtmlref .= '<br>';
|
|
|
- $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', 0, 1);
|
|
|
- $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
|
|
|
+ $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 1);
|
|
|
+ $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->hasRight('contrat', 'creer'), 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
|
|
|
// Thirdparty
|
|
|
$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1);
|
|
|
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
|
|
@@ -1456,9 +1456,9 @@ if ($action == 'create') {
|
|
|
// Date
|
|
|
print '<tr>';
|
|
|
print '<td class="titlefield">';
|
|
|
- print $form->editfieldkey("Date", 'date_contrat', $object->date_contrat, $object, $user->rights->contrat->creer);
|
|
|
+ print $form->editfieldkey("Date", 'date_contrat', $object->date_contrat, $object, $user->hasRight('contrat', 'creer'));
|
|
|
print '</td><td>';
|
|
|
- print $form->editfieldval("Date", 'date_contrat', $object->date_contrat, $object, $user->rights->contrat->creer, 'datehourpicker');
|
|
|
+ print $form->editfieldval("Date", 'date_contrat', $object->date_contrat, $object, $user->hasRight('contrat', 'creer'), 'datehourpicker');
|
|
|
print '</td>';
|
|
|
print '</tr>';
|
|
|
|
|
@@ -1561,7 +1561,7 @@ if ($action == 'create') {
|
|
|
}
|
|
|
//
|
|
|
|
|
|
- if ($nbofservices > 1 && $conf->browser->layout != 'phone' && !empty($user->rights->contrat->creer)) {
|
|
|
+ if ($nbofservices > 1 && $conf->browser->layout != 'phone' && $user->hasRight('contrat', 'creer')) {
|
|
|
print '<td width="30" class="linecolmove tdlineupdown center">';
|
|
|
if ($cursorline > 1) {
|
|
|
print '<a class="lineupdown reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=up&token='.newToken().'&rowid='.$objp->rowid.'">';
|
|
@@ -1652,18 +1652,18 @@ if ($action == 'create') {
|
|
|
|
|
|
// Icon move, update et delete (status contract 0=draft,1=validated,2=closed)
|
|
|
print '<td class="nowraponall right">';
|
|
|
- if ($user->rights->contrat->creer && is_array($arrayothercontracts) && count($arrayothercontracts) && ($object->statut >= 0)) {
|
|
|
+ if ($user->hasRight('contrat', 'creer') && is_array($arrayothercontracts) && count($arrayothercontracts) && ($object->statut >= 0)) {
|
|
|
print '<!-- link to move service line into another contract -->';
|
|
|
print '<a class="reposition marginrightonly" style="padding-left: 5px;" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=move&token='.newToken().'&rowid='.$objp->rowid.'">';
|
|
|
print img_picto($langs->trans("MoveToAnotherContract"), 'uparrow');
|
|
|
print '</a>';
|
|
|
}
|
|
|
- if ($user->rights->contrat->creer && ($object->statut >= 0)) {
|
|
|
+ if ($user->hasRight('contrat', 'creer') && ($object->statut >= 0)) {
|
|
|
print '<a class="reposition marginrightonly editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=editline&token='.newToken().'&rowid='.$objp->rowid.'">';
|
|
|
print img_edit();
|
|
|
print '</a>';
|
|
|
}
|
|
|
- if ($user->rights->contrat->creer && ($object->statut >= 0)) {
|
|
|
+ if ($user->hasRight('contrat', 'creer') && ($object->statut >= 0)) {
|
|
|
print '<a class="reposition marginrightonly" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=deleteline&token='.newToken().'&rowid='.$objp->rowid.'">';
|
|
|
print img_delete();
|
|
|
print '</a>';
|
|
@@ -1903,7 +1903,7 @@ if ($action == 'create') {
|
|
|
$tmpactionpicto = 'playstop';
|
|
|
$tmpactiontext = $langs->trans("Disable");
|
|
|
}
|
|
|
- if (($tmpaction == 'activateline' && $user->rights->contrat->activer) || ($tmpaction == 'unactivateline' && $user->rights->contrat->desactiver)) {
|
|
|
+ if (($tmpaction == 'activateline' && $user->hasRight('contrat', 'activer')) || ($tmpaction == 'unactivateline' && $user->hasRight('contrat', 'desactiver'))) {
|
|
|
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&ligne='.$object->lines[$cursorline - 1]->id.'&action='.$tmpaction.'">';
|
|
|
print img_picto($tmpactiontext, $tmpactionpicto);
|
|
|
print '</a>';
|
|
@@ -1950,7 +1950,7 @@ if ($action == 'create') {
|
|
|
}
|
|
|
|
|
|
// Form to activate line
|
|
|
- if ($user->rights->contrat->activer && $action == 'activateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
|
|
|
+ if ($user->hasRight('contrat', 'activer') && $action == 'activateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
|
|
|
print '<form name="active" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
|
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
print '<input type="hidden" name="action" value="confirm_active">';
|
|
@@ -2005,7 +2005,7 @@ if ($action == 'create') {
|
|
|
print '</form>';
|
|
|
}
|
|
|
|
|
|
- if ($user->rights->contrat->activer && $action == 'unactivateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
|
|
|
+ if ($user->hasRight('contrat', 'activer') && $action == 'unactivateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
|
|
|
/**
|
|
|
* Disable a contract line
|
|
|
*/
|
|
@@ -2070,7 +2070,7 @@ if ($action == 'create') {
|
|
|
print '</div>';
|
|
|
|
|
|
// Form to add new line
|
|
|
- if ($user->rights->contrat->creer && ($object->statut == 0)) {
|
|
|
+ if ($user->hasRight('contrat', 'creer') && ($object->statut == 0)) {
|
|
|
$dateSelector = 1;
|
|
|
|
|
|
print "\n";
|
|
@@ -2134,7 +2134,7 @@ if ($action == 'create') {
|
|
|
// Send
|
|
|
if (empty($user->socid)) {
|
|
|
if ($object->status == $object::STATUS_VALIDATED) {
|
|
|
- if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->contrat->creer)) {
|
|
|
+ if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->hasRight('contrat', 'creer'))) {
|
|
|
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle', '', true, $params);
|
|
|
} else {
|
|
|
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false, $params);
|
|
@@ -2143,7 +2143,7 @@ if ($action == 'create') {
|
|
|
}
|
|
|
|
|
|
if ($object->status == $object::STATUS_DRAFT && $nbofservices) {
|
|
|
- if ($user->rights->contrat->creer) {
|
|
|
+ if ($user->hasRight('contrat', 'creer')) {
|
|
|
print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid&token='.newToken(), '', true, $params);
|
|
|
} else {
|
|
|
$params['attr']['title'] = $langs->trans("NotEnoughPermissions");
|
|
@@ -2151,7 +2151,7 @@ if ($action == 'create') {
|
|
|
}
|
|
|
}
|
|
|
if ($object->status == $object::STATUS_VALIDATED) {
|
|
|
- if ($user->rights->contrat->creer) {
|
|
|
+ if ($user->hasRight('contrat', 'creer')) {
|
|
|
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken(), '', true, $params);
|
|
|
} else {
|
|
|
$params['attr']['title'] = $langs->trans("NotEnoughPermissions");
|
|
@@ -2182,14 +2182,14 @@ if ($action == 'create') {
|
|
|
}
|
|
|
|
|
|
if ($object->nbofservicesclosed > 0 || $object->nbofserviceswait > 0) {
|
|
|
- if ($user->rights->contrat->activer) {
|
|
|
+ if ($user->hasRight('contrat', 'activer')) {
|
|
|
print dolGetButtonAction($langs->trans('ActivateAllContracts'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=activate&token='.newToken(), '', true, $params);
|
|
|
} else {
|
|
|
print dolGetButtonAction($langs->trans('ActivateAllContracts'), '', 'default', '#', '', false, $params);
|
|
|
}
|
|
|
}
|
|
|
if ($object->nbofservicesclosed < $nbofservices) {
|
|
|
- if ($user->rights->contrat->desactiver) {
|
|
|
+ if ($user->hasRight('contrat', 'desactiver')) {
|
|
|
print dolGetButtonAction($langs->trans('CloseAllContracts'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', true, $params);
|
|
|
} else {
|
|
|
print dolGetButtonAction($langs->trans('CloseAllContracts'), '', 'default', '#', '', false, $params);
|
|
@@ -2213,7 +2213,7 @@ if ($action == 'create') {
|
|
|
}
|
|
|
|
|
|
// Clone
|
|
|
- if ($user->rights->contrat->creer) {
|
|
|
+ if ($user->hasRight('contrat', 'creer')) {
|
|
|
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken(), '', true, $params);
|
|
|
}
|
|
|
|
|
@@ -2341,5 +2341,5 @@ $(document).ready(function() {
|
|
|
}
|
|
|
});
|
|
|
</script>
|
|
|
- <?php
|
|
|
+<?php
|
|
|
}
|