manage user permissions for margin display

This commit is contained in:
Christophe Battarel 2013-08-20 12:11:19 +02:00
parent 06b8e939bd
commit 4c7741f5f0
2 changed files with 6 additions and 4 deletions

View File

@ -2732,9 +2732,9 @@ abstract class CommonObject
else
print '<td align="right" width="80">'.$langs->trans('CostPrice').'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous)
print '<td align="right" width="50">'.$langs->trans('MarginRate').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous)
print '<td align="right" width="50">'.$langs->trans('MarkRate').'</td>';
}
@ -3170,6 +3170,8 @@ abstract class CommonObject
global $langs, $conf, $user;
if (! empty($user->societe_id)) return;
if (! $user->rights->margins->liretous) return;
$marginInfo = $this->getMarginInfos($force_price);

View File

@ -123,11 +123,11 @@
if (! empty($conf->margin->enabled) && empty($user->societe_id)) {
?>
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->pa_ht); ?></td>
<?php if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {?>
<?php if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) {?>
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo (($line->pa_ht == 0)?'n/a':price($line->marge_tx).'%'); ?></td>
<?php
}
if (! empty($conf->global->DISPLAY_MARK_RATES)) {?>
if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?>
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->marque_tx).'%'; ?></td>
<?php } } ?>