From c17097876c302cc5bbd764283b93c7d62ebfc672 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Oct 2006 23:07:46 +0000 Subject: [PATCH] On utilise methode getNomUrl --- htdocs/actioncomm.class.php | 34 ++++++++++++++++++++++++++++++---- htdocs/comm/index.php | 28 ++++++++++++++++++---------- 2 files changed, 48 insertions(+), 14 deletions(-) diff --git a/htdocs/actioncomm.class.php b/htdocs/actioncomm.class.php index 1e9f9094397..b6883996dba 100644 --- a/htdocs/actioncomm.class.php +++ b/htdocs/actioncomm.class.php @@ -358,9 +358,9 @@ class ActionComm } if ($mode == 3) { - if ($percent==0) return img_picto($langs->trans('StatusActionToDo'),'statut1'); - if ($percent > 0 && $percent < 100) return img_picto($langs->trans('StatusActionInProcess').' ('.$percent.'%)','statut3'); - if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6'); + if ($percent==0) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionToDo'),'statut1'); + if ($percent > 0 && $percent < 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)','statut3'); + if ($percent >= 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionDone'),'statut6'); } if ($mode == 4) { @@ -375,6 +375,32 @@ class ActionComm if ($percent >= 100) return $langs->trans('StatusActionDone').' '.img_picto($langs->trans('StatusActionDone'),'statut6'); } } + + /** + * \brief Renvoie nom clicable (avec eventuellement le picto) + * \param withpicto Inclut le picto dans le lien + * \param option Nombre de caractères max dans libellé + * \return string Chaine avec URL + * \remarks Utilise $this->id, $this->code et $this->libelle + */ + function getNomUrl($withpicto=0,$option) + { + global $langs; -} + $result=''; + $lien = ''; + $lienfin=''; + + $transcode=$langs->trans("Action".$this->code); + $libelle=($transcode!="Action".$this->code ? $transcode : $this->libelle); + $libelleshort=$libelle; + if ($option) $libelleshort=dolibarr_trunc($libelle,$option); + + if ($withpicto) $result.=($lien.img_object($langs->trans("ShowTask").': '.$libelle,'task').$lienfin.' '); + $result.=$lien.$libelleshort.$lienfin; + return $result; + } + +} + ?> diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 0d2a223bd99..8b31e564f5b 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -28,6 +28,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/client.class.php"); if ($conf->contrat->enabled) require_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); @@ -278,11 +279,13 @@ print ''; * */ -$sql = "SELECT a.id, a.label, ".$db->pdate("a.datep")." as dp, c.code, c.libelle, a.fk_user_author, s.nom as sname, s.idp"; +$sql = "SELECT a.id, a.label, ".$db->pdate("a.datep")." as dp, a.fk_user_author,"; +$sql.= " c.code, c.libelle,"; +$sql.= " s.nom as sname, s.idp, s.client"; if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; -$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."societe as s"; +$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql .= " WHERE c.id=a.fk_action AND a.percent < 100 AND s.idp = a.fk_soc"; +$sql.= " WHERE c.id=a.fk_action AND a.percent < 100 AND s.idp = a.fk_soc"; if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) { @@ -302,6 +305,7 @@ if ($resql) $i = 0; $staticaction=new ActionComm($db); + $customerstatic=new Client($db); while ($i < $num) { @@ -309,14 +313,18 @@ if ($resql) $var=!$var; print ""; - print "id\">".img_object($langs->trans("ShowTask"),"task"); - $transcode=$langs->trans("Action".$obj->code); - $libelle=($transcode!="Action".$obj->code?$transcode:$obj->libelle); - print $libelle; - print ''; - print "$obj->label"; - print ''.img_object($langs->trans("ShowCustomer"),"company").' '.$obj->sname.''; + $staticaction->code=$obj->code; + $staticaction->libelle=$obj->libelle; + $staticaction->id=$obj->id; + print ''.$staticaction->getNomUrl(1,12).''; + + print ''.dolibarr_trunc($obj->label,24).''; + + $customerstatic->id=$obj->idp; + $customerstatic->nom=$obj->sname; + $customerstatic->client=$obj->client; + print ''.$customerstatic->getNomUrl(1,'').''; // Date print ''.dolibarr_print_date($obj->dp).' ';