Qual: Mutualize and uniformize code

This commit is contained in:
Laurent Destailleur 2010-09-19 13:55:27 +00:00
parent 3dfad63473
commit 5a80ce5141
2 changed files with 10 additions and 10 deletions

View File

@ -60,6 +60,8 @@ $pagenext = $page + 1;
llxHeader(); llxHeader();
$thirdpartystatic=new Societe($db);
if ($action == 'attribute_prefix') if ($action == 'attribute_prefix')
{ {
$societe = new Societe($db, $socid); $societe = new Societe($db, $socid);
@ -96,7 +98,7 @@ if ($mode == 'search') {
* *
*/ */
$sql = "SELECT s.rowid, s.nom, s.ville, s.datec, s.datea"; $sql = "SELECT s.rowid, s.nom, s.client, s.ville, s.datec, s.datea";
$sql.= ", st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta "; $sql.= ", st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta ";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st";
@ -199,9 +201,12 @@ if ($resql)
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$obj->rowid.'">'; print '<td>';
print img_object($langs->trans("ShowCustomer"),"company"); $thirdpartystatic->id=$obj->rowid;
print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$obj->rowid.'">'.$obj->nom.'</a></td>'; $thirdpartystatic->nom=$obj->nom;
$thirdpartystatic->client=$obj->client;
print $thirdpartystatic->getNomUrl(1,'compta');
print '</td>';
print '<td>'.$obj->ville.'&nbsp;</td>'; print '<td>'.$obj->ville.'&nbsp;</td>';
print '<td align="left">'.$obj->code_client.'&nbsp;</td>'; print '<td align="left">'.$obj->code_client.'&nbsp;</td>';
print '<td align="left">'.$obj->code_compta.'&nbsp;</td>'; print '<td align="left">'.$obj->code_compta.'&nbsp;</td>';

View File

@ -1307,7 +1307,7 @@ class Societe extends CommonObject
$result=''; $result='';
$lien=$lienfin=''; $lien=$lienfin='';
if ($option == 'customer') if ($option == 'customer' || $option == 'compta')
{ {
if ($this->client == 1) if ($this->client == 1)
{ {
@ -1325,11 +1325,6 @@ class Societe extends CommonObject
$lien = '<a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$this->id.'">'; $lien = '<a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$this->id.'">';
$lienfin='</a>'; $lienfin='</a>';
} }
if ($option == 'compta')
{
$lien = '<a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$this->id.'">';
$lienfin='</a>';
}
if (empty($lien)) if (empty($lien))
{ {
$lien = '<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$this->id.'">'; $lien = '<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$this->id.'">';