From 1efa5bcabdd1a6c5eaab13e863afa3db52589c04 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 12:44:11 +0200 Subject: [PATCH] Fix: Avoid duplicate tooltip --- .../fourn/class/fournisseur.product.class.php | 18 +++++++++++------- htdocs/product/list.php | 7 +++++-- htdocs/societe/class/societe.class.php | 2 +- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index adc1f3a50fc..8f839b08452 100755 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -631,17 +631,19 @@ class ProductFournisseur extends Product /** * Display supplier of product * - * @param int $withpicto Add picto - * @param string $option Target of link ('', 'customer', 'prospect', 'supplier') - * @return string String with supplier price + * @param int $withpicto Add picto + * @param string $option Target of link ('', 'customer', 'prospect', 'supplier') + * @param int $maxlen Max length of name + * @param integer $notooltip 1=Disable tooltip + * @return string String with supplier price * TODO Remove this method. Use getNomUrl directly. */ - function getSocNomUrl($withpicto=0,$option='supplier') + function getSocNomUrl($withpicto=0,$option='supplier',$maxlen=0,$notooltip=0) { $thirdparty = new Fournisseur($this->db); $thirdparty->fetch($this->fourn_id); - return $thirdparty->getNomUrl($withpicto,$option); + return $thirdparty->getNomUrl($withpicto,$option,$maxlen,$notooltip); } /** @@ -649,13 +651,15 @@ class ProductFournisseur extends Product * * @param int $showunitprice Show "Unit price" into output string * @param int $showsuptitle Show "Supplier" into output string + * @param int $maxlen Max length of name + * @param integer $notooltip 1=Disable tooltip * @return string String with supplier price */ - function display_price_product_fournisseur($showunitprice=1,$showsuptitle=1) + function display_price_product_fournisseur($showunitprice=1,$showsuptitle=1,$maxlen=0,$notooltip=0) { global $langs; $langs->load("suppliers"); - $out=($showunitprice?price($this->fourn_unitprice).' '.$langs->trans("HT").'   (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier').' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':''); + $out=($showunitprice?price($this->fourn_unitprice).' '.$langs->trans("HT").'   (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':''); return $out; } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index f9503778411..ededdbaff01 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -476,8 +476,11 @@ else { if ($product_fourn->product_fourn_price_id > 0) { - $htmltext=$product_fourn->display_price_product_fournisseur(); - if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) print $form->textwithpicto(price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"),$htmltext); + if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) + { + $htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1); + print $form->textwithpicto(price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"),$htmltext); + } else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"); } } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 7e2bdeef3a6..7f8df5ed810 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1727,7 +1727,7 @@ class Societe extends CommonObject * * @param int $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only) * @param string $option Target of link ('', 'customer', 'prospect', 'supplier') - * @param int $maxlen Max length of text + * @param int $maxlen Max length of name * @param integer $notooltip 1=Disable tooltip * @return string String with URL */