Refactored supplier invoice line view to fit commonobjectline view

This commit is contained in:
Marcos García de La Fuente 2015-03-04 10:28:37 +01:00
parent 47a151f157
commit 174f1cb5f7
2 changed files with 17 additions and 3 deletions

View File

@ -2686,7 +2686,9 @@ abstract class CommonObject
function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$extrafieldsline=0,$permtoedit=0) function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$extrafieldsline=0,$permtoedit=0)
{ {
global $conf,$langs,$user,$object,$hookmanager; global $conf,$langs,$user,$object,$hookmanager;
global $form,$bc,$bcdd; global $form,$bc,$bcdd, $object_rights;
$object_rights = $this->getRights();
$element=$this->element; $element=$this->element;
@ -3727,4 +3729,16 @@ abstract class CommonObject
return $out; return $out;
} }
/**
* Returns the rights used for this class
* @return stdClass
*/
public function getRights()
{
global $user;
return $user->rights->{$this->element};
}
} }

View File

@ -122,7 +122,7 @@ if (empty($usemargins)) $usemargins=0;
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo vatrate($line->tva_tx,'%',$line->info_bits); ?></td> <td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo vatrate($line->tva_tx,'%',$line->info_bits); ?></td>
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo (isset($line->pu_ht)?price($line->pu_ht):price($line->subprice)); ?></td> <td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->pu_ht); ?></td>
<?php if ($inputalsopricewithtax) { ?> <?php if ($inputalsopricewithtax) { ?>
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo (isset($line->pu_ttc)?price($line->pu_ttc):price($line->subprice)); ?></td> <td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo (isset($line->pu_ttc)?price($line->pu_ttc):price($line->subprice)); ?></td>
@ -173,7 +173,7 @@ if (empty($usemargins)) $usemargins=0;
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->total_ht); ?></td> <td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->total_ht); ?></td>
<?php } ?> <?php } ?>
<?php if ($this->statut == 0 && ($user->rights->$element->creer || $permtoedit)) { ?> <?php if ($this->statut == 0 && ($object_rights->creer)) { ?>
<td align="center"><?php $coldisplay++; ?> <td align="center"><?php $coldisplay++; ?>
<?php if (($line->info_bits & 2) == 2) { ?> <?php if (($line->info_bits & 2) == 2) { ?>
<?php } else { ?> <?php } else { ?>