On utilise methode getNomUrl

This commit is contained in:
Laurent Destailleur 2006-10-23 23:07:46 +00:00
parent 48b46697f8
commit c17097876c
2 changed files with 48 additions and 14 deletions

View File

@ -358,9 +358,9 @@ class ActionComm
} }
if ($mode == 3) if ($mode == 3)
{ {
if ($percent==0) return img_picto($langs->trans('StatusActionToDo'),'statut1'); if ($percent==0) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionToDo'),'statut1');
if ($percent > 0 && $percent < 100) return img_picto($langs->trans('StatusActionInProcess').' ('.$percent.'%)','statut3'); if ($percent > 0 && $percent < 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)','statut3');
if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6'); if ($percent >= 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionDone'),'statut6');
} }
if ($mode == 4) if ($mode == 4)
{ {
@ -376,5 +376,31 @@ class ActionComm
} }
} }
/**
* \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 = '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$this->id.'">';
$lienfin='</a>';
$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;
} }
}
?> ?>

View File

@ -28,6 +28,7 @@
*/ */
require("./pre.inc.php"); 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->contrat->enabled) require_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php");
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php");
@ -278,7 +279,9 @@ print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
* *
*/ */
$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"; 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"; if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -302,6 +305,7 @@ if ($resql)
$i = 0; $i = 0;
$staticaction=new ActionComm($db); $staticaction=new ActionComm($db);
$customerstatic=new Client($db);
while ($i < $num) while ($i < $num)
{ {
@ -309,14 +313,18 @@ if ($resql)
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print "<td><a href=\"action/fiche.php?id=$obj->id\">".img_object($langs->trans("ShowTask"),"task");
$transcode=$langs->trans("Action".$obj->code);
$libelle=($transcode!="Action".$obj->code?$transcode:$obj->libelle);
print $libelle;
print '</a></td>';
print "<td>$obj->label</td>";
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCustomer"),"company").' '.$obj->sname.'</a></td>'; $staticaction->code=$obj->code;
$staticaction->libelle=$obj->libelle;
$staticaction->id=$obj->id;
print '<td>'.$staticaction->getNomUrl(1,12).'</td>';
print '<td>'.dolibarr_trunc($obj->label,24).'</td>';
$customerstatic->id=$obj->idp;
$customerstatic->nom=$obj->sname;
$customerstatic->client=$obj->client;
print '<td>'.$customerstatic->getNomUrl(1,'').'</td>';
// Date // Date
print '<td width="100">'.dolibarr_print_date($obj->dp).'&nbsp;'; print '<td width="100">'.dolibarr_print_date($obj->dp).'&nbsp;';