From 174f1cb5f7607407ff60a8d52898d1ff0b369efe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 4 Mar 2015 10:28:37 +0100 Subject: [PATCH] Refactored supplier invoice line view to fit commonobjectline view --- htdocs/core/class/commonobject.class.php | 16 +++++++++++++++- htdocs/core/tpl/objectline_view.tpl.php | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c08a2b449d7..523716a8c84 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2686,7 +2686,9 @@ abstract class CommonObject function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$extrafieldsline=0,$permtoedit=0) { global $conf,$langs,$user,$object,$hookmanager; - global $form,$bc,$bcdd; + global $form,$bc,$bcdd, $object_rights; + + $object_rights = $this->getRights(); $element=$this->element; @@ -3727,4 +3729,16 @@ abstract class CommonObject return $out; } + /** + * Returns the rights used for this class + * @return stdClass + */ + public function getRights() + { + global $user; + + return $user->rights->{$this->element}; + } + + } diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 3ae8a8bcaa4..2203642f0dc 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -122,7 +122,7 @@ if (empty($usemargins)) $usemargins=0; tva_tx,'%',$line->info_bits); ?> - pu_ht)?price($line->pu_ht):price($line->subprice)); ?> + pu_ht); ?> pu_ttc)?price($line->pu_ttc):price($line->subprice)); ?> @@ -173,7 +173,7 @@ if (empty($usemargins)) $usemargins=0; total_ht); ?> - statut == 0 && ($user->rights->$element->creer || $permtoedit)) { ?> + statut == 0 && ($object_rights->creer)) { ?> info_bits & 2) == 2) { ?>