From c5669bc15001c066c1719fe54d1b384bd231d391 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 3 Apr 2007 10:53:44 +0000 Subject: [PATCH] Ajout de la fonction getNomUrl dans discount.class.php --- htdocs/comm/propal.php | 3 +-- htdocs/commande/fiche.php | 3 +-- htdocs/compta/facture.php | 6 ++---- htdocs/discount.class.php | 24 ++++++++++++++++++++++++ htdocs/langs/en_US/bills.lang | 1 + htdocs/langs/fr_FR/bills.lang | 1 + 6 files changed, 30 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 41e1eb5ffdb..0454e812706 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1146,8 +1146,7 @@ if ($_GET['propalid'] > 0) { $discount=new DiscountAbsolute($db); $discount->fetch($objp->fk_remise_except); - print ' - '.$langs->trans("DiscountFromCreditNote",$discount->ref_facture_source); - // \TODO Mettre ici lien sur ref avoir en ajoutant fonction getNomUrl sur classe DiscountAbsolute + print ' - '.$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl()); } else { diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index c2b29c37e73..7b5c34b6fca 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1332,8 +1332,7 @@ else { $discount=new DiscountAbsolute($db); $discount->fetch($objp->fk_remise_except); - print ' - '.$langs->trans("DiscountFromCreditNote",$discount->ref_facture_source); - // \TODO Mettre ici lien sur ref avoir en ajoutant fonction getNomUrl sur classe DiscountAbsolute + print ' - '.$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl()); } else { diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 2b71ec2b627..7f410892e86 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1648,8 +1648,7 @@ if ($_GET['action'] == 'create') { $discount=new DiscountAbsolute($db); $discount->fetch($objp->fk_remise_except); - print $langs->trans("DiscountFromCreditNote",$discount->ref_facture_source); - // \TODO Mettre ici lien sur ref avoir en ajoutant fonction getNomUrl sur classe DiscountAbsolute + print $langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl()); } else { @@ -2290,8 +2289,7 @@ else { $discount=new DiscountAbsolute($db); $discount->fetch($objp->fk_remise_except); - print ' - '.$langs->trans("DiscountFromCreditNote",$discount->ref_facture_source); - // \TODO Mettre ici lien sur ref avoir en ajoutant fonction getNomUrl sur classe DiscountAbsolute + print ' - '.$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl()); } else { diff --git a/htdocs/discount.class.php b/htdocs/discount.class.php index 544e3de0600..61287896e35 100644 --- a/htdocs/discount.class.php +++ b/htdocs/discount.class.php @@ -207,5 +207,29 @@ class DiscountAbsolute } } + /** + \brief Renvoie nom clicable (avec eventuellement le picto) + \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul + \param option Sur quoi pointe le lien + \return string Chaine avec URL + */ + function getNomUrl($withpicto=0,$option='') + { + global $langs; + + $result=''; + + $lien = ''; + $lienfin=''; + + $picto='bill'; + $label=$langs->trans("ShowDiscount").': '.$this->ref_facture_source; + + if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); + if ($withpicto && $withpicto != 2) $result.=' '; + $result.=$lien.$this->ref_facture_source.$lienfin; + return $result; + } + } ?> diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 0e0cce687a2..ce41b8692ec 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -196,6 +196,7 @@ Reductions=Reductions ReductionsShort=Reduc. Discount=Discount Discounts=Discounts +ShowDiscount=Show discount RelativeDiscount=Relative discount GlobalDiscount=Global discount CreditNote=Credit note diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 7cd4364c94a..852bf03992a 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -196,6 +196,7 @@ Reductions=R ReductionsShort=Réduc. Discount=Remise Discounts=Remises +ShowDiscount=Visualiser l'avoir RelativeDiscount=Remise relative GlobalDiscount=Remise fixe CreditNote=Avoir