Qual: Utilisation des methodes communes plutot que code en dur

This commit is contained in:
Laurent Destailleur 2006-10-24 23:53:01 +00:00
parent 5ed391df02
commit 03ffa40e85

View File

@ -95,11 +95,17 @@ if ($mode == 'search')
} }
llxHeader();
/* /*
* Mode fiche * Mode fiche
*/ */
llxHeader();
$actionstatic=new ActionComm($db);
$facturestatic=new Facture($db);
$contactstatic = new Contact($db);
if ($socid > 0) if ($socid > 0)
{ {
$societe = new Societe($db); $societe = new Societe($db);
@ -433,8 +439,6 @@ if ($socid > 0)
print "<br>"; print "<br>";
$actionstatic=new ActionComm($db);
/* /*
* Listes des actions a faire * Listes des actions a faire
* *
@ -509,21 +513,23 @@ if ($socid > 0)
} }
else else
{ {
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id.'">'.img_object($langs->trans("ShowAction"),"task"); $actionstatic->code=$obj->acode;
$transcode=$langs->trans("Action".$obj->acode); $actionstatic->libelle=$obj->libelle;
$libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); $actionstatic->id=$obj->id;
print $libelle; print '<td>'.$actionstatic->getNomUrl(1,16).'</td>';
print '</a></td>';
} }
print '<td colspan="2">'.$obj->label.'</td>'; print '<td colspan="2">'.$obj->label.'</td>';
// Contact pour cette action // Contact pour cette action
if ($obj->fk_contact) { if ($obj->fk_contact > 0)
{
$contact = new Contact($db); $contact = new Contact($db);
$contact->fetch($obj->fk_contact); $contact->fetch($obj->fk_contact);
print '<td><a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->fk_contact.'">'.img_object($langs->trans("ShowContact"),"contact").' '.$contact->fullname.'</a></td>'; print '<td>'.$contact->getNomUrl(1).'</td>';
} else { }
else
{
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
} }
@ -602,11 +608,10 @@ if ($socid > 0)
// Action // Action
print '<td>'; print '<td>';
print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id.'">'.img_object($langs->trans("ShowTask"),"task"); $actionstatic->code=$obj->acode;
$transcode=$langs->trans("Action".$obj->acode); $actionstatic->libelle=$obj->libelle;
$libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); $actionstatic->id=$obj->id;
print $libelle; print $actionstatic->getNomUrl(1,16);
print '</a>';
print '</td>'; print '</td>';
// Objet lié // Objet lié
@ -619,9 +624,10 @@ if ($socid > 0)
} }
if ($obj->fk_facture) if ($obj->fk_facture)
{ {
print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->fk_facture.'">'.img_object($langs->trans("ShowBill"),"bill"); $facturestatic->ref=$langs->trans("Invoice");
print $langs->trans("Invoice"); $facturestatic->id=$obj->rowid;
print '</a>'; $facturestatic->type=$obj->type;
print $facturestatic->getNomUrl(1,'compta');
} }
else print '&nbsp;'; else print '&nbsp;';
print '</td>'; print '</td>';
@ -630,11 +636,11 @@ if ($socid > 0)
print "<td>$obj->label</td>"; print "<td>$obj->label</td>";
// Contact pour cette action // Contact pour cette action
if ($obj->fk_contact) if ($obj->fk_contact > 0)
{ {
$contact = new Contact($db); $contact = new Contact($db);
$contact->fetch($obj->fk_contact); $contact->fetch($obj->fk_contact);
print '<td><a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$contact->id.'">'.img_object($langs->trans("ShowContact"),"contact").' '.$contact->fullname.'</a></td>'; print '<td>'.$contact->getNomUrl(1).'</td>';
} }
else else
{ {
@ -656,7 +662,7 @@ if ($socid > 0)
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }
print "</table>"; print "</table><br>";
} }
else else
{ {