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 ''; -// Last contracts +// Last modified contracts $max=5; $sql = 'SELECT '; $sql.= ' sum('.$db->ifsql("cd.statut=0",1,0).') as nb_initial,'; @@ -199,12 +200,17 @@ if ($result) $var=!$var; print ""; - print "cid\">"; - print img_object($langs->trans("ShowContract"),"contract").' ' - . (isset($obj->ref) ? $obj->ref : $obj->cid).''; + print ""; + $staticcontrat->ref=($obj->ref?$obj->ref:$obj->cid); + $staticcontrat->id=$obj->cid; + print $staticcontrat->getNomUrl(1,16); if ($obj->nb_late) print img_warning($langs->trans("Late")); print ''; - print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.''; + print ''; + $staticcompany->id=$obj->fk_soc; + $staticcompany->nom=$obj->nom; + print $staticcompany->getNomUrl(1,'',20); + print ''; print ''.dolibarr_print_date($obj->datec).''; //print ''.$staticcontrat->LibStatut($obj->statut,2).''; print ''.($obj->nb_initial>0 ? $obj->nb_initial.$staticcontratligne->LibStatut(0,3):'').''; @@ -254,12 +260,20 @@ if ( $db->query($sql) ) $var=!$var; print ""; - print ''.img_object($langs->trans("ShowContract"),"contract").' ' - .(isset($obj->ref) ? $obj->ref : $obj->fk_contrat).''; - print ''.img_object($langs->trans("ShowService"),"service"); + print ''; + $staticcontrat->ref=($obj->ref?$obj->ref:$obj->fk_contrat); + $staticcontrat->id=$obj->fk_contrat; + print $staticcontrat->getNomUrl(1,16); + print ''; + 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,44).''; + print ''; + $staticcompany->id=$obj->fk_soc; + $staticcompany->nom=$obj->nom; + print $staticcompany->getNomUrl(1,'',20); + print ''; print ''; print $staticcontratligne->LibStatut($obj->statut,3); print ''; @@ -281,7 +295,9 @@ print '
'; // Last modified services $max=5; -$sql = "SELECT cd.rowid as cid, c.ref, cd.statut, cd.label, cd.description as note, cd.fk_contrat, c.fk_soc, s.nom"; +$sql = "SELECT c.ref, c.fk_soc, "; +$sql.= " cd.rowid as cid, cd.statut, cd.label, cd.description as note, cd.fk_contrat,"; +$sql.= " s.nom"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -290,9 +306,10 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc if ($socid > 0) $sql.= " AND s.rowid = ".$socid; $sql.= " ORDER BY cd.tms DESC"; -if ( $db->query($sql) ) +$resql=$db->query($sql); +if ($resql) { - $num = $db->num_rows(); + $num = $db->num_rows($resql); $i = 0; print ''; @@ -303,18 +320,23 @@ if ( $db->query($sql) ) $var=True; while ($i < min($num,$max)) { - $obj = $db->fetch_object(); + $obj = $db->fetch_object($resql); $var=!$var; print ""; -// width="50" nowrap - print ''; print ''; else print ' '.dolibarr_trunc($obj->note,20).''; - print ''; + print ''; 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 ''.$alt.''; return ''.$alt.''; } @@ -1601,15 +1603,16 @@ function print_titre($titre) /** \brief Affichage d'un titre d'une fiche, aligné a gauche - \param titre Le titre a afficher - \param mesg Message suplémentaire a afficher a droite - \param picto Picto pour ligne de titre + \param titre Le titre a afficher + \param mesg Message suplémentaire a afficher a droite + \param picto Picto pour ligne de titre + \param pictoisfullpath 1=Picto is a full absolute url of image */ -function print_fiche_titre($titre, $mesg='', $picto='') +function print_fiche_titre($titre, $mesg='', $picto='', $pictoisfullpath=0) { print "\n"; 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 ''.img_object($langs->trans("ShowService"),"service"); if ($obj->label) print ' '.dolibarr_trunc($obj->label,20).''.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,28).''; + $staticcompany->id=$obj->fk_soc; + $staticcompany->nom=$obj->nom; + print $staticcompany->getNomUrl(1,'',20); + print ''; print $staticcontratligne->LibStatut($obj->statut,5); print '
'; - if ($picto) print ''; + if ($picto) print ''; 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 + * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2007 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -274,16 +274,21 @@ if ($resql) // Ref print '\n"; + print ''.$objp->ref.""; +*/ print "\n"; // Label - print ''; + print ''; // Date print '\n";
'.img_picto('',$picto).''.img_picto('',$picto, '', $pictoisfullpath).''; print '
'.$titre.'
'; print '
'; - 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."'.$objp->label.''.dolibarr_trunc($objp->label,40).''.dolibarr_print_date($objp->datem,'day')."