From e73526b29c4b2f3bd2f7a42f65b01e7ca5853707 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 May 2015 12:42:45 +0200 Subject: [PATCH] Fix prospect box must use the getNomUrl method --- htdocs/comm/prospect/class/prospect.class.php | 5 +- htdocs/core/boxes/box_clients.php | 2 - htdocs/core/boxes/box_prospect.php | 50 ++++++++++--------- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/htdocs/comm/prospect/class/prospect.class.php b/htdocs/comm/prospect/class/prospect.class.php index 59f284408b8..719a8c830f1 100644 --- a/htdocs/comm/prospect/class/prospect.class.php +++ b/htdocs/comm/prospect/class/prospect.class.php @@ -26,8 +26,7 @@ include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; /** - * \class Prospect - * \brief Classe permettant la gestion des prospects + * Class to manage prospects */ class Prospect extends Societe { @@ -37,7 +36,7 @@ class Prospect extends Societe /** * Constructor * - * @param DoliDB $db Databas handler + * @param DoliDB $db Database handler */ function __construct($db) { diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index 2cd5922d784..24c940fb9ea 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -101,8 +101,6 @@ class box_clients extends ModeleBoxes if ($result) { $num = $db->num_rows($result); - if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url= DOL_URL_ROOT."/comm/card.php?socid="; - else $url= DOL_URL_ROOT."/societe/soc.php?socid="; $line = 0; while ($line < $num) diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index ef9585202b0..2f96c57ee95 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -74,14 +74,20 @@ class box_prospect extends ModeleBoxes $this->max=$max; - include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - $thirdpartystatic=new Societe($db); + include_once DOL_DOCUMENT_ROOT.'/comm/prospect/class/prospect.class.php'; + $thirdpartystatic=new Prospect($db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedProspects",$max)); if ($user->rights->societe->lire) { - $sql = "SELECT s.nom as name, s.rowid as socid, s.fk_stcomm, s.datec, s.tms, s.status"; + $sql = "SELECT s.nom as name, s.rowid as socid"; + $sql.= ", s.code_client"; + $sql.= ", s.client"; + $sql.= ", s.code_fournisseur"; + $sql.= ", s.fournisseur"; + $sql.= ", s.logo"; + $sql.= ", s.fk_stcomm, s.datec, s.tms, s.status"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.client IN (2, 3)"; @@ -97,48 +103,46 @@ class box_prospect extends ModeleBoxes { $num = $db->num_rows($resql); - $i = 0; - $prospectstatic=new Prospect($db); - while ($i < $num) + $line = 0; + while ($line < $num) { $objp = $db->fetch_object($resql); $datec=$db->jdate($objp->datec); $datem=$db->jdate($objp->tms); + $thirdpartystatic->id = $objp->socid; + $thirdpartystatic->name = $objp->name; + $thirdpartystatic->code_client = $objp->code_client; + $thirdpartystatic->code_fournisseur = $objp->code_fournisseur; + $thirdpartystatic->client = $objp->client; + $thirdpartystatic->fournisseur = $objp->fournisseur; + $thirdpartystatic->logo = $objp->logo; - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $objp->name, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, - ); - - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="left"', - 'text' => $objp->name, - 'tooltip' => $objp->name, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + 'text' => $thirdpartystatic->getNomUrl(1), + 'asis' => 1, ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="right"', 'text' => dol_print_date($datem, "day"), ); - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="right" width="18"', - 'text' => str_replace('img ','img height="14" ',$prospectstatic->LibProspStatut($objp->fk_stcomm,3)), + 'text' => str_replace('img ','img height="14" ',$thirdpartystatic->LibProspStatut($objp->fk_stcomm,3)), ); - $this->info_box_contents[$i][4] = array( + $this->info_box_contents[$line][] = array( 'td' => 'align="right" width="18"', 'text' => $thirdpartystatic->LibStatut($objp->status,3), ); - $i++; + $line++; } if ($num==0) - $this->info_box_contents[$i][0] = array( + $this->info_box_contents[$line][0] = array( 'td' => 'align="center"', 'text'=>$langs->trans("NoRecordedProspects"), );