|
@@ -170,7 +170,7 @@ if (empty($reshook)) {
|
|
|
}
|
|
|
|
|
|
// Payment terms of the settlement
|
|
|
- if ($action == 'setconditions' && $user->rights->societe->creer) {
|
|
|
+ if ($action == 'setconditions' && $user->hasRight('societe', 'creer')) {
|
|
|
$object->fetch($id);
|
|
|
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'), GETPOST('cond_reglement_id_deposit_percent', 'alpha'));
|
|
|
if ($result < 0) {
|
|
@@ -179,7 +179,7 @@ if (empty($reshook)) {
|
|
|
}
|
|
|
|
|
|
// Payment mode
|
|
|
- if ($action == 'setmode' && $user->rights->societe->creer) {
|
|
|
+ if ($action == 'setmode' && $user->hasRight('societe', 'creer')) {
|
|
|
$object->fetch($id);
|
|
|
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
|
|
if ($result < 0) {
|
|
@@ -188,7 +188,7 @@ if (empty($reshook)) {
|
|
|
}
|
|
|
|
|
|
// Transport mode
|
|
|
- if ($action == 'settransportmode' && $user->rights->societe->creer) {
|
|
|
+ if ($action == 'settransportmode' && $user->hasRight('societe', 'creer')) {
|
|
|
$object->fetch($id);
|
|
|
$result = $object->setTransportMode(GETPOST('transport_mode_id', 'alpha'));
|
|
|
if ($result < 0) {
|
|
@@ -197,7 +197,7 @@ if (empty($reshook)) {
|
|
|
}
|
|
|
|
|
|
// Bank account
|
|
|
- if ($action == 'setbankaccount' && $user->rights->societe->creer) {
|
|
|
+ if ($action == 'setbankaccount' && $user->hasRight('societe', 'creer')) {
|
|
|
$object->fetch($id);
|
|
|
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
|
|
|
if ($result < 0) {
|
|
@@ -206,7 +206,7 @@ if (empty($reshook)) {
|
|
|
}
|
|
|
|
|
|
// customer preferred shipping method
|
|
|
- if ($action == 'setshippingmethod' && $user->rights->societe->creer) {
|
|
|
+ if ($action == 'setshippingmethod' && $user->hasRight('societe', 'creer')) {
|
|
|
$object->fetch($id);
|
|
|
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
|
|
if ($result < 0) {
|
|
@@ -215,7 +215,7 @@ if (empty($reshook)) {
|
|
|
}
|
|
|
|
|
|
// assujetissement a la TVA
|
|
|
- if ($action == 'setassujtva' && $user->rights->societe->creer) {
|
|
|
+ if ($action == 'setassujtva' && $user->hasRight('societe', 'creer')) {
|
|
|
$object->fetch($id);
|
|
|
$object->tva_assuj = GETPOST('assujtva_value');
|
|
|
$result = $object->update($object->id);
|
|
@@ -225,7 +225,7 @@ if (empty($reshook)) {
|
|
|
}
|
|
|
|
|
|
// set prospect level
|
|
|
- if ($action == 'setprospectlevel' && $user->rights->societe->creer) {
|
|
|
+ if ($action == 'setprospectlevel' && $user->hasRight('societe', 'creer')) {
|
|
|
$object->fetch($id);
|
|
|
$object->fk_prospectlevel = GETPOST('prospect_level_id', 'alpha');
|
|
|
$result = $object->update($object->id, $user);
|
|
@@ -267,7 +267,7 @@ if (empty($reshook)) {
|
|
|
}
|
|
|
|
|
|
// Set sales representatives
|
|
|
- if ($action == 'set_salesrepresentatives' && $user->rights->societe->creer) {
|
|
|
+ if ($action == 'set_salesrepresentatives' && $user->hasRight('societe', 'creer')) {
|
|
|
$object->fetch($id);
|
|
|
$result = $object->setSalesRep(GETPOST('commercial', 'array'));
|
|
|
}
|
|
@@ -295,7 +295,7 @@ if (empty($reshook)) {
|
|
|
}
|
|
|
|
|
|
// warehouse
|
|
|
- if ($action == 'setwarehouse' && $user->rights->societe->creer) {
|
|
|
+ if ($action == 'setwarehouse' && $user->hasRight('societe', 'creer')) {
|
|
|
$result = $object->setWarehouse(GETPOST('fk_warehouse', 'int'));
|
|
|
}
|
|
|
}
|
|
@@ -360,9 +360,9 @@ if ($object->id > 0) {
|
|
|
|
|
|
print '<tr>';
|
|
|
print '<td>';
|
|
|
- print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $user->rights->societe->creer);
|
|
|
+ print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $user->hasRight('societe', 'creer'));
|
|
|
print '</td><td>';
|
|
|
- print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $user->rights->societe->creer);
|
|
|
+ print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $user->hasRight('societe', 'creer'));
|
|
|
print '</td>';
|
|
|
print '</tr>';
|
|
|
}
|
|
@@ -408,7 +408,7 @@ if ($object->id > 0) {
|
|
|
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
|
|
print $langs->trans('PaymentConditions');
|
|
|
print '<td>';
|
|
|
- if (($action != 'editconditions') && $user->rights->societe->creer) {
|
|
|
+ if (($action != 'editconditions') && $user->hasRight('societe', 'creer')) {
|
|
|
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
|
|
|
}
|
|
|
print '</tr></table>';
|
|
@@ -426,7 +426,7 @@ if ($object->id > 0) {
|
|
|
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
|
|
print $langs->trans('PaymentMode');
|
|
|
print '<td>';
|
|
|
- if (($action != 'editmode') && $user->rights->societe->creer) {
|
|
|
+ if (($action != 'editmode') && $user->hasRight('societe', 'creer')) {
|
|
|
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
|
|
|
}
|
|
|
print '</tr></table>';
|
|
@@ -445,7 +445,7 @@ if ($object->id > 0) {
|
|
|
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
|
|
print $langs->trans('PaymentBankAccount');
|
|
|
print '<td>';
|
|
|
- if (($action != 'editbankaccount') && $user->rights->societe->creer) {
|
|
|
+ if (($action != 'editbankaccount') && $user->hasRight('societe', 'creer')) {
|
|
|
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
|
|
|
}
|
|
|
print '</tr></table>';
|
|
@@ -467,7 +467,7 @@ if ($object->id > 0) {
|
|
|
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
|
|
print $langs->trans("CustomerRelativeDiscountShort");
|
|
|
print '<td><td class="right">';
|
|
|
- if ($user->rights->societe->creer && !$user->socid > 0) {
|
|
|
+ if ($user->hasRight('societe', 'creer') && !$user->socid > 0) {
|
|
|
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'&action=create&token='.newToken().'">'.img_edit($langs->trans("Modify")).'</a>';
|
|
|
}
|
|
|
print '</td></tr></table>';
|
|
@@ -480,7 +480,7 @@ if ($object->id > 0) {
|
|
|
print '<tr><td class="nowrap">';
|
|
|
print $langs->trans("CustomerAbsoluteDiscountShort");
|
|
|
print '<td><td class="right">';
|
|
|
- if ($user->rights->societe->creer && !$user->socid > 0) {
|
|
|
+ if ($user->hasRight('societe', 'creer') && !$user->socid > 0) {
|
|
|
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'&action=create&token='.newToken().'">'.img_edit($langs->trans("Modify")).'</a>';
|
|
|
}
|
|
|
print '</td></tr></table>';
|
|
@@ -502,10 +502,10 @@ if ($object->id > 0) {
|
|
|
if ($object->client) {
|
|
|
print '<tr class="nowrap">';
|
|
|
print '<td>';
|
|
|
- print $form->editfieldkey("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->rights->societe->creer);
|
|
|
+ print $form->editfieldkey("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->hasRight('societe', 'creer'));
|
|
|
print '</td><td>';
|
|
|
$limit_field_type = (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
|
|
|
- print $form->editfieldval("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->rights->societe->creer, $limit_field_type, ($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
|
|
|
+ print $form->editfieldval("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->hasRight('societe', 'creer'), $limit_field_type, ($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
|
|
|
print '</td>';
|
|
|
print '</tr>';
|
|
|
}
|
|
@@ -515,9 +515,9 @@ if ($object->id > 0) {
|
|
|
print '<!-- Minimim amount for orders -->'."\n";
|
|
|
print '<tr class="nowrap">';
|
|
|
print '<td>';
|
|
|
- print $form->editfieldkey("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $user->rights->societe->creer);
|
|
|
+ print $form->editfieldkey("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $user->hasRight('societe', 'creer'));
|
|
|
print '</td><td>';
|
|
|
- print $form->editfieldval("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $user->rights->societe->creer, $limit_field_type, ($object->order_min_amount != '' ? price($object->order_min_amount) : ''));
|
|
|
+ print $form->editfieldval("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $user->hasRight('societe', 'creer'), $limit_field_type, ($object->order_min_amount != '' ? price($object->order_min_amount) : ''));
|
|
|
print '</td>';
|
|
|
print '</tr>';
|
|
|
}
|
|
@@ -530,7 +530,7 @@ if ($object->id > 0) {
|
|
|
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
|
|
print $langs->trans("PriceLevel");
|
|
|
print '<td><td class="right">';
|
|
|
- if ($user->rights->societe->creer) {
|
|
|
+ if ($user->hasRight('societe', 'creer')) {
|
|
|
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/multiprix.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
|
|
|
}
|
|
|
print '</td></tr></table>';
|
|
@@ -551,7 +551,7 @@ if ($object->id > 0) {
|
|
|
$formproduct = new FormProduct($db);
|
|
|
print '<tr class="nowrap">';
|
|
|
print '<td>';
|
|
|
- print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $user->rights->societe->creer);
|
|
|
+ print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $user->hasRight('societe', 'creer'));
|
|
|
print '</td><td>';
|
|
|
if ($action == 'editwarehouse') {
|
|
|
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_warehouse, 'fk_warehouse', 1);
|
|
@@ -571,7 +571,7 @@ if ($object->id > 0) {
|
|
|
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
|
|
print $langs->trans('SendingMethod');
|
|
|
print '<td>';
|
|
|
- if (($action != 'editshipping') && $user->rights->societe->creer) {
|
|
|
+ if (($action != 'editshipping') && $user->hasRight('societe', 'creer')) {
|
|
|
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editshipping&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
|
|
|
}
|
|
|
print '</tr></table>';
|
|
@@ -591,7 +591,7 @@ if ($object->id > 0) {
|
|
|
print '<table class="centpercent nobordernopadding"><tr><td class="nowrap">';
|
|
|
print $langs->trans('IntracommReportTransportMode');
|
|
|
print '<td>';
|
|
|
- if (($action != 'edittransportmode') && $user->rights->societe->creer) {
|
|
|
+ if (($action != 'edittransportmode') && $user->hasRight('societe', 'creer')) {
|
|
|
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edittransportmode&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
|
|
|
}
|
|
|
print '</tr></table>';
|
|
@@ -654,7 +654,7 @@ if ($object->id > 0) {
|
|
|
print '<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
|
|
|
print $langs->trans('ProspectLevel');
|
|
|
print '<td>';
|
|
|
- if ($action != 'editlevel' && $user->rights->societe->creer) {
|
|
|
+ if ($action != 'editlevel' && $user->hasRight('societe', 'creer')) {
|
|
|
print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editlevel&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('Modify'), 1).'</a></td>';
|
|
|
}
|
|
|
print '</tr></table>';
|
|
@@ -1026,7 +1026,7 @@ if ($object->id > 0) {
|
|
|
/*
|
|
|
* Latest shipments
|
|
|
*/
|
|
|
- if (isModEnabled("expedition") && $user->rights->expedition->lire) {
|
|
|
+ if (isModEnabled("expedition") && $user->hasRight('expedition', 'lire')) {
|
|
|
$sql = 'SELECT e.rowid as id';
|
|
|
$sql .= ', e.ref, e.entity';
|
|
|
$sql .= ', e.date_creation';
|