Fix prospect box must use the getNomUrl method

This commit is contained in:
Laurent Destailleur 2015-05-04 12:42:45 +02:00
parent 90f78429ec
commit e73526b29c
3 changed files with 29 additions and 28 deletions

View File

@ -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)
{

View File

@ -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)

View File

@ -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"),
);