Merge pull request #650 from FHenry/develop_merger_cust_prospect_tab
Develop merger cust prospect tab (Task 350)
This commit is contained in:
commit
7ab91b5f42
@ -55,16 +55,11 @@ $result = restrictedArea($user, 'societe',$socid,'');
|
||||
|
||||
llxHeader('','Contacts');
|
||||
|
||||
if ($type == "c")
|
||||
if ($type == "c" || $type == "p")
|
||||
{
|
||||
$label = $langs->trans("Customers");
|
||||
$urlfiche="fiche.php";
|
||||
}
|
||||
if ($type == "p")
|
||||
{
|
||||
$label = $langs->trans("Prospects");
|
||||
$urlfiche="prospect/fiche.php";
|
||||
}
|
||||
if ($type == "f")
|
||||
{
|
||||
$label = $langs->trans("Suppliers");
|
||||
|
||||
@ -31,6 +31,7 @@ require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
@ -109,6 +110,24 @@ if ($action == 'setassujtva' && $user->rights->societe->creer)
|
||||
if (! $result) dol_print_error($result);
|
||||
}
|
||||
|
||||
// set prospect level
|
||||
if ($action == 'setprospectlevel' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fk_prospectlevel=GETPOST('prospect_level_id','alpha');
|
||||
$result=$object->set_prospect_level($user);
|
||||
if ($result < 0) setEventMessage($object->error,'errors');
|
||||
}
|
||||
|
||||
// Update communication level
|
||||
if ($action == 'cstc')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->stcomm_id=GETPOST('stcomm','int');
|
||||
$result=$object->set_commnucation_level($user);
|
||||
if ($result < 0) setEventMessage($object->error,'errors');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -121,6 +140,7 @@ llxHeader('',$langs->trans('CustomerCard'));
|
||||
$contactstatic = new Contact($db);
|
||||
$userstatic=new User($db);
|
||||
$form = new Form($db);
|
||||
$formcompany=new FormCompany($db);
|
||||
|
||||
|
||||
if ($mode == 'search')
|
||||
@ -176,6 +196,11 @@ if ($id > 0)
|
||||
$object->next_prev_filter="te.client in (1,3)";
|
||||
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
|
||||
print '</td></tr>';
|
||||
|
||||
// Prospect/Customer
|
||||
print '<tr><td width="30%">'.$langs->trans('ProspectCustomer').'</td><td width="70%" colspan="3">';
|
||||
print $object->getLibCustProspStatut();
|
||||
print '</td></tr>';
|
||||
|
||||
// Prefix
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
@ -359,6 +384,31 @@ if ($id > 0)
|
||||
print '</td><td colspan="3">'.$object->price_level."</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Level of prospect
|
||||
print '<tr><td nowrap>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
|
||||
print $langs->trans('ProspectLevelShort');
|
||||
print '<td>';
|
||||
if ($action != 'editlevel' && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editlevel&socid='.$object->id.'">'.img_edit($langs->trans('Modify'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editlevel')
|
||||
$formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_prospectlevel,'prospect_level_id',1);
|
||||
else
|
||||
print $object->getLibProspLevel();
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("StatusProsp").'</td><td colspan="2">'.$object->getLibProspCommStatut(4).'</td>';
|
||||
print '<td>';
|
||||
if ($object->stcomm_id != -1) print '<a href="fiche.php?socid='.$object->id.'&stcomm=-1&action=cstc">'.img_action(0,-1).'</a>';
|
||||
if ($object->stcomm_id != 0) print '<a href="fiche.php?socid='.$object->id.'&stcomm=0&action=cstc">'.img_action(0,0).'</a>';
|
||||
if ($object->stcomm_id != 1) print '<a href="fiche.php?socid='.$object->id.'&stcomm=1&action=cstc">'.img_action(0,1).'</a>';
|
||||
if ($object->stcomm_id != 2) print '<a href="fiche.php?socid='.$object->id.'&stcomm=2&action=cstc">'.img_action(0,2).'</a>';
|
||||
if ($object->stcomm_id != 3) print '<a href="fiche.php?socid='.$object->id.'&stcomm=3&action=cstc">'.img_action(0,3).'</a>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Sales representative
|
||||
include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
|
||||
|
||||
@ -315,9 +315,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td nowrap="nowrap">'.$companystatic->getNomUrl(1,'customer',48).'</td>';
|
||||
print '<td align="right" nowrap>';
|
||||
if ($objp->client == 2 || $objp->client == 3) print $langs->trans("Prospect");
|
||||
if ($objp->client == 3) print ' / ';
|
||||
if ($objp->client == 1 || $objp->client == 3) print $langs->trans("Customer");
|
||||
print $companystatic->getLibCustProspStatut();
|
||||
print "</td>";
|
||||
print '<td align="right" nowrap>'.dol_print_date($db->jdate($objp->tms),'day')."</td>";
|
||||
print '</tr>';
|
||||
|
||||
@ -322,14 +322,7 @@ if ($result)
|
||||
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
if ($objp->client == 1)
|
||||
{
|
||||
$url = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->rowid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$objp->rowid;
|
||||
}
|
||||
$url = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->rowid;
|
||||
|
||||
// Company
|
||||
$companystatic->id=$objp->rowid;
|
||||
|
||||
@ -148,9 +148,9 @@ class Prospect extends Societe
|
||||
*
|
||||
* @return string Libelle
|
||||
*/
|
||||
function getLibLevel()
|
||||
function getLibProspLevel()
|
||||
{
|
||||
return $this->LibLevel($this->fk_prospectlevel);
|
||||
return $this->LibProspLevel($this->fk_prospectlevel);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,7 +159,7 @@ class Prospect extends Societe
|
||||
* @param int $fk_prospectlevel Prospect level
|
||||
* @return string Libelle du niveau
|
||||
*/
|
||||
function LibLevel($fk_prospectlevel)
|
||||
function LibProspLevel($fk_prospectlevel)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
@ -1,343 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/comm/prospect/fiche.php
|
||||
* \ingroup prospect
|
||||
* \brief Page de la fiche prospect
|
||||
*/
|
||||
|
||||
require_once '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/prospect/class/prospect.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
|
||||
$langs->load('companies');
|
||||
$langs->load('projects');
|
||||
$langs->load('propal');
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'societe', $socid, '&societe');
|
||||
|
||||
$object = new Prospect($db);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'cstc')
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$_GET["stcomm"];
|
||||
$sql .= " WHERE rowid = ".$socid;
|
||||
$db->query($sql);
|
||||
}
|
||||
// set prospect level
|
||||
if ($action == 'setprospectlevel' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($socid);
|
||||
$object->fk_prospectlevel=$_POST['prospect_level_id'];
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_prospectlevel='".$_POST['prospect_level_id'];
|
||||
$sql.= " WHERE rowid = ".$socid;
|
||||
$result = $db->query($sql);
|
||||
if (! $result) dol_print_error($result);
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************
|
||||
*
|
||||
* Mode fiche
|
||||
*
|
||||
*********************************************************************************/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$form=new Form($db);
|
||||
$formcompany=new FormCompany($db);
|
||||
|
||||
if ($socid > 0)
|
||||
{
|
||||
$actionstatic=new ActionComm($db);
|
||||
$result = $object->fetch($socid);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$head = societe_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'prospect', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
print '<table width="100%" class="notopnoleftnoright">';
|
||||
print '<tr><td valign="top" width="50%" class="notopnoleft">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="25%">'.$langs->trans("ThirdPartyName").'</td><td colspan="3">';
|
||||
$object->next_prev_filter="te.client in (2,3)";
|
||||
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
|
||||
print '</td></tr>';
|
||||
|
||||
// Address
|
||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">';
|
||||
dol_print_address($object->address,'gmap','thirdparty',$object->id);
|
||||
print "</td></tr>";
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td nowrap="nowrap">'.$langs->trans('Zip').' / '.$langs->trans("Town").'</td><td colspan="3">'.$object->zip.(($object->zip && $object->town)?' / ':'').$object->town.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Country
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
||||
$img=picto_from_langcode($object->country_code);
|
||||
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
|
||||
else print ($img?$img.' ':'').$object->country;
|
||||
print '</td></tr>';
|
||||
|
||||
// Phone
|
||||
print '<tr><td>'.$langs->trans("Phone").'</td><td style="min-width: 25%;">'.dol_print_phone($object->tel,$object->country_code,0,$object->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td style="min-width: 25%;">'.dol_print_phone($object->fax,$object->country_code).'</td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<td>'.$langs->trans('EMail').'</td><td colspan="3">'.dol_print_email($object->email,0,$object->id,'AC_EMAIL').'</td></tr>';
|
||||
|
||||
// Web
|
||||
print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$object->url\">$object->url</a></td></tr>";
|
||||
|
||||
// Level of prospect
|
||||
print '<tr><td nowrap>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
|
||||
print $langs->trans('ProspectLevelShort');
|
||||
print '<td>';
|
||||
if ($action != 'editlevel' && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editlevel&socid='.$object->id.'">'.img_edit($langs->trans('Modify'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editlevel')
|
||||
$formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_prospectlevel,'prospect_level_id',1);
|
||||
else
|
||||
print $object->getLibLevel();
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Multiprice level
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
print '<tr><td nowrap>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
|
||||
print $langs->trans("PriceLevel");
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/multiprix.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td><td colspan="3">'.$object->price_level."</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("StatusProsp").'</td><td colspan="2">'.$object->getLibProspStatut(4).'</td>';
|
||||
print '<td>';
|
||||
if ($object->stcomm_id != -1) print '<a href="fiche.php?socid='.$object->id.'&stcomm=-1&action=cstc">'.img_action(0,-1).'</a>';
|
||||
if ($object->stcomm_id != 0) print '<a href="fiche.php?socid='.$object->id.'&stcomm=0&action=cstc">'.img_action(0,0).'</a>';
|
||||
if ($object->stcomm_id != 1) print '<a href="fiche.php?socid='.$object->id.'&stcomm=1&action=cstc">'.img_action(0,1).'</a>';
|
||||
if ($object->stcomm_id != 2) print '<a href="fiche.php?socid='.$object->id.'&stcomm=2&action=cstc">'.img_action(0,2).'</a>';
|
||||
if ($object->stcomm_id != 3) print '<a href="fiche.php?socid='.$object->id.'&stcomm=3&action=cstc">'.img_action(0,3).'</a>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Sales representative
|
||||
include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
|
||||
|
||||
// Module Adherent
|
||||
if (! empty($conf->adherent->enabled))
|
||||
{
|
||||
$langs->load("members");
|
||||
$langs->load("users");
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("LinkedToDolibarrMember").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$adh=new Adherent($db);
|
||||
$result=$adh->fetch('','',$object->id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$adh->ref=$adh->getFullName($langs);
|
||||
print $adh->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("UserNotLinkedToMember");
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print "</td>\n";
|
||||
print '<td valign="top" width="50%" class="notopnoleftnoright">';
|
||||
|
||||
// Nbre max d'elements des petites listes
|
||||
$MAXLIST=5;
|
||||
$tableaushown=0;
|
||||
|
||||
// Lien recap
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("Summary").'</td>';
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/comm/prospect/recap-prospect.php?socid='.$object->id.'">'.$langs->trans("ShowProspectPreview").'</a></td></tr></table></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
/*
|
||||
* Last proposals
|
||||
*/
|
||||
if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||
{
|
||||
$propal_static=new Propal($db);
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid, p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.remise, ";
|
||||
$sql.= " p.datep as dp, p.fin_validite as datelimite,";
|
||||
$sql.= " c.label as statut, c.id as statutid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."c_propalst as c";
|
||||
$sql.= " WHERE p.fk_soc = s.rowid";
|
||||
$sql.= " AND p.fk_statut = c.id";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
$sql.= " AND s.rowid = ".$object->id;
|
||||
$sql.= " ORDER BY p.datep DESC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$var=true;
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/comm/propal.php?socid='.$object->id.'">'.$langs->trans("AllPropals").' ('.$num.')</a></td>';
|
||||
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
while ($i < $num && $i < $MAXLIST)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"../propal.php?id=$objp->propalid\">";
|
||||
print img_object($langs->trans("ShowPropal"),"propal");
|
||||
print " ".$objp->ref."</a>\n";
|
||||
if ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay) && $objp->fk_statut == 1)
|
||||
{
|
||||
print " ".img_warning();
|
||||
}
|
||||
print "</td><td align=\"right\">".dol_print_date($db->jdate($objp->dp),"day")."</td>\n";
|
||||
print "<td align=\"right\">".price($objp->total_ht)."</td>\n";
|
||||
print "<td align=\"right\">".$propal_static->LibStatut($objp->fk_statut,5)."</td></tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
|
||||
if ($num > 0) print "</table>";
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print "</td></tr>";
|
||||
print "</table>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
/*
|
||||
* Barre d'action
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if (! empty($conf->propal->enabled) && $user->rights->propale->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal.php?socid='.$object->id.'&action=create">'.$langs->trans("AddProp").'</a>';
|
||||
}
|
||||
|
||||
// Add action
|
||||
if (! empty($conf->agenda->enabled) && ! empty($conf->global->MAIN_REPEATTASKONEACHTAB))
|
||||
{
|
||||
if ($user->rights->agenda->myactions->create)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&socid='.$object->id.'">'.$langs->trans("AddAction").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddAction").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB))
|
||||
{
|
||||
print '<br>';
|
||||
// List of contacts
|
||||
show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB))
|
||||
{
|
||||
print load_fiche_titre($langs->trans("ActionsOnCompany"),'','');
|
||||
|
||||
// List of todo actions
|
||||
show_actions_todo($conf,$langs,$db,$object);
|
||||
|
||||
// List of done actions
|
||||
show_actions_done($conf,$langs,$db,$object);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
@ -65,16 +65,11 @@ $offset = $limit * $page;
|
||||
|
||||
$langs->load("companies");
|
||||
$titre = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses"));
|
||||
if ($type == "c")
|
||||
if ($type == "c" || $type=="p")
|
||||
{
|
||||
$titre.=' ('.$langs->trans("ThirdPartyCustomers").')';
|
||||
$urlfiche="fiche.php";
|
||||
}
|
||||
else if ($type == "p")
|
||||
{
|
||||
$titre.=' ('.$langs->trans("ThirdPartyProspects").')';
|
||||
$urlfiche="prospect/fiche.php";
|
||||
}
|
||||
else if ($type == "f")
|
||||
{
|
||||
$titre.=' ('.$langs->trans("ThirdPartySuppliers").')';
|
||||
|
||||
@ -89,11 +89,11 @@ class box_prospect extends ModeleBoxes
|
||||
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$objp->socid);
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
||||
'text' => $objp->nom,
|
||||
'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$objp->socid);
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
|
||||
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
|
||||
'text' => dol_print_date($datem, "day"));
|
||||
|
||||
@ -42,16 +42,7 @@ function societe_prepare_head($object)
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
// TODO Remove tests on object->object. Functions must be called with a company object directly
|
||||
if (($object->client==2 || $object->client==3
|
||||
|| (isset($object->object) && $object->object->client==2) || (isset($object->object) && $object->object->client==3)) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Prospect");
|
||||
$head[$h][2] = 'prospect';
|
||||
$h++;
|
||||
}
|
||||
if ($object->client==1 || $object->client==3 || (isset($object->object) && $object->object->client==1) || (isset($object->object) && $object->object->client==3))
|
||||
if ($object->client==1 || $object->client==2 || $object->client==3 || (isset($object->object) && $object->object->client==1) || (isset($object->object) && $object->object->client==3))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Customer");
|
||||
|
||||
@ -1437,18 +1437,11 @@ class Societe extends CommonObject
|
||||
|
||||
if ($option == 'customer' || $option == 'compta')
|
||||
{
|
||||
if (($this->client == 1 || $this->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) // Only customer
|
||||
{
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$this->id;
|
||||
}
|
||||
elseif($this->client == 2 && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) // Only prospect
|
||||
{
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$this->id;
|
||||
}
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$this->id;
|
||||
}
|
||||
else if ($option == 'prospect' && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
|
||||
{
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$this->id;
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$this->id;
|
||||
}
|
||||
else if ($option == 'supplier')
|
||||
{
|
||||
@ -2655,7 +2648,181 @@ class Societe extends CommonObject
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
/**
|
||||
* Return prostect level
|
||||
*
|
||||
* @return string Libelle
|
||||
*/
|
||||
function getLibProspLevel()
|
||||
{
|
||||
return $this->LibProspLevel($this->fk_prospectlevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return label of prospect level
|
||||
*
|
||||
* @param int $fk_prospectlevel Prospect level
|
||||
* @return string label of level
|
||||
*/
|
||||
function LibProspLevel($fk_prospectlevel)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$lib=$langs->trans("ProspectLevel".$fk_prospectlevel);
|
||||
// If lib not found in language file, we get label from cache/databse
|
||||
if ($lib == $langs->trans("ProspectLevel".$fk_prospectlevel))
|
||||
{
|
||||
$lib=$langs->getLabelFromKey($this->db,$fk_prospectlevel,'c_prospectlevel','code','label');
|
||||
}
|
||||
return $lib;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set prospect level
|
||||
*
|
||||
* @param User $user Utilisateur qui definie la remise
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_prospect_level($user)
|
||||
{
|
||||
if ($this->id)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
// Positionne remise courante
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
|
||||
$sql.= " fk_prospectlevel='".$this->fk_prospectlevel."'";
|
||||
$sql.= ",fk_user_modif='".$user->id."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
dol_syslog(get_class($this)."::set_prospect_level sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return status of prospect
|
||||
*
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
|
||||
* @return string Libelle
|
||||
*/
|
||||
function getLibProspCommStatut($mode=0)
|
||||
{
|
||||
return $this->LibProspCommStatut($this->stcomm_id,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return label of a given status
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @return string Libelle du statut
|
||||
*/
|
||||
function LibProspCommStatut($statut,$mode=0)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('customers');
|
||||
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($statut == -1) return img_action($langs->trans("StatusProspect-1"),-1).' '.$langs->trans("StatusProspect-1");
|
||||
if ($statut == 0) return img_action($langs->trans("StatusProspect0"), 0).' '.$langs->trans("StatusProspect0");
|
||||
if ($statut == 1) return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1");
|
||||
if ($statut == 2) return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2");
|
||||
if ($statut == 3) return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3");
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($statut == -1) return img_action($langs->trans("StatusProspect-1"),-1);
|
||||
if ($statut == 0) return img_action($langs->trans("StatusProspect0"), 0);
|
||||
if ($statut == 1) return img_action($langs->trans("StatusProspect1"), 1);
|
||||
if ($statut == 2) return img_action($langs->trans("StatusProspect2"), 2);
|
||||
if ($statut == 3) return img_action($langs->trans("StatusProspect3"), 3);
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut == -1) return img_action($langs->trans("StatusProspect-1"),-1).' '.$langs->trans("StatusProspect-1");
|
||||
if ($statut == 0) return img_action($langs->trans("StatusProspect0"), 0).' '.$langs->trans("StatusProspect0");
|
||||
if ($statut == 1) return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1");
|
||||
if ($statut == 2) return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2");
|
||||
if ($statut == 3) return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3");
|
||||
}
|
||||
|
||||
return "Error, mode/status not found";
|
||||
}
|
||||
|
||||
/**
|
||||
* Set commnunication level
|
||||
*
|
||||
* @param User $user Utilisateur qui definie la remise
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_commnucation_level($user)
|
||||
{
|
||||
if ($this->id)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
// Positionne remise courante
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
|
||||
$sql.= " fk_stcomm='".$this->stcomm_id."'";
|
||||
$sql.= ",fk_user_modif='".$user->id."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::set_commnucation_level sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return label of status customer is prospect/customer
|
||||
*
|
||||
* @return string Libelle
|
||||
*/
|
||||
function getLibCustProspStatut()
|
||||
{
|
||||
return $this->LibCustProspStatut($this->client,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @return string Libelle du statut
|
||||
*/
|
||||
function LibCustProspStatut($statut)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('companies');
|
||||
|
||||
if ($statut==0) return $langs->trans("NorProspectNorCustomer");
|
||||
if ($statut==1) return $langs->trans("Customer");
|
||||
if ($statut==2) return $langs->trans("Prospect");
|
||||
if ($statut==3) return $langs->trans("ProspectCustomer");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user