diff --git a/htdocs/contrat/contrat.class.php b/htdocs/contrat/contrat.class.php index 15ca95d0a14..3b35b3e7eff 100644 --- a/htdocs/contrat/contrat.class.php +++ b/htdocs/contrat/contrat.class.php @@ -990,10 +990,10 @@ class Contrat extends CommonObject /** \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 + \param maxlength Max length of ref \return string Chaine avec URL */ - function getNomUrl($withpicto=0,$option='') + function getNomUrl($withpicto=0,$maxlength=0) { global $langs; @@ -1002,15 +1002,13 @@ class Contrat extends CommonObject $lien = ''; $lienfin=''; - $picto='bill'; - if ($this->type == 1) $picto.='r'; - if ($this->type == 2) $picto.='a'; + $picto='contract'; $label=$langs->trans("ShowContract").': '.$this->ref; if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; + if ($withpicto != 2) $result.=$lien.($maxlength?dolibarr_trunc($this->ref,$maxlength):$this->ref).$lienfin; return $result; } @@ -1285,6 +1283,30 @@ class ContratLigne } } + /** + \brief Renvoie nom clicable (avec eventuellement le picto) + \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul + \return string Chaine avec URL + */ + function getNomUrl($withpicto=0,$maxlength=0) + { + global $langs; + + $result=''; + + $lien = ''; + $lienfin=''; + + $picto='contract'; + + $label=$langs->trans("ShowContractOfService").': '.$this->label; + + if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); + if ($withpicto && $withpicto != 2) $result.=' '; + if ($withpicto != 2) $result.=$lien.$this->label.$lienfin; + return $result; + } + /* * \brief Load object in memory from database * \param id id object diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index fdb8cd5e73c..3c858852cd4 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -41,6 +41,7 @@ $contratid = isset($_GET["id"])?$_GET["id"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'contrat',$contratid,''); +$staticcompany=new Societe($db); $staticcontrat=new Contrat($db); $staticcontratligne=new ContratLigne($db); @@ -158,7 +159,7 @@ if ($conf->contrat->enabled && $user->rights->contrat->lire) print '
| '.img_object($langs->trans("ShowContract"),"contract").' ' - .(isset($obj->ref) ? $obj->ref : $obj->fk_contrat).''; + print ' | '; + $staticcontrat->ref=($obj->ref?$obj->ref:$obj->fk_contrat); + $staticcontrat->id=$obj->fk_contrat; + print $staticcontrat->getNomUrl(1,16); if ($obj->nb_late) print img_warning($langs->trans("Late")); print ' | '; print ''.img_object($langs->trans("ShowService"),"service"); if ($obj->label) print ' '.dolibarr_trunc($obj->label,20).' | '; else print ' '.dolibarr_trunc($obj->note,20).''; - print ''.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,28).' | '; + print ''; + $staticcompany->id=$obj->fk_soc; + $staticcompany->nom=$obj->nom; + print $staticcompany->getNomUrl(1,'',20); + print ' | '; print ''; print $staticcontratligne->LibStatut($obj->statut,5); print ' | '; diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index efc299a4a22..e04d369a227 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -773,15 +773,17 @@ function img_object($alt, $object) /** \brief Affiche picto (fonction générique) - \param alt Texte sur le alt de l'image - \param picto Nom de l'image a afficher (Si pas d'extension, on met '.png') - \param options Attribut supplémentaire a la balise img - \return string Retourne tag img + \param alt Texte sur le alt de l'image + \param picto Nom de l'image a afficher (Si pas d'extension, on met '.png') + \param options Attribut supplémentaire a la balise img + \param pictoisfullpath If 1, image path is a full path + \return string Retourne tag img */ -function img_picto($alt, $picto, $options='') +function img_picto($alt, $picto, $options='', $pictoisfullpath=0) { global $conf; if (! eregi('(\.png|\.gif)$',$picto)) $picto.='.png'; + if ($pictoisfullpath) return '
| '.img_picto('',$picto).' | '; + if ($picto) print ''.img_picto('',$picto, '', $pictoisfullpath).' | '; print '';
print ' '.$titre.' ';
print ' | ';
diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php
index 1f9d8535f5e..807ca5e3341 100644
--- a/htdocs/product/liste.php
+++ b/htdocs/product/liste.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2007 Laurent Destailleur '; - print "rowid\">"; + $product_static->id = $objp->rowid; + $product_static->ref = $objp->ref; + $product_static->type = $objp->fk_product_type; + print $product_static->getNomUrl(1,'',16); + /* print "rowid\">"; if ($objp->fk_product_type==1) print img_object($langs->trans("ShowService"),"service"); else print img_object($langs->trans("ShowProduct"),"product"); print ' '; - print ''.$objp->ref." | \n"; + print ''.$objp->ref.""; +*/ print "\n"; // Label - print ''.$objp->label.' | '; + print ''.dolibarr_trunc($objp->label,40).' | '; // Date print ''.dolibarr_print_date($objp->datem,'day')." | \n";