diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index 114fc6398e0..98f12489fea 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -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"); diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 84987129be3..397fb9da835 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -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 ''; + + // Prospect/Customer + print ''.$langs->trans('ProspectCustomer').''; + print $object->getLibCustProspStatut(); + print ''; // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field @@ -359,6 +384,31 @@ if ($id > 0) print ''.$object->price_level.""; print ''; } + + // Level of prospect + print ''; + print ''; + print '
'; + print $langs->trans('ProspectLevelShort'); + print ''; + if ($action != 'editlevel' && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('Modify'),1).'
'; + print ''; + 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 ""; + print ''; + + // Status + print ''.$langs->trans("StatusProsp").''.$object->getLibProspCommStatut(4).''; + print ''; + if ($object->stcomm_id != -1) print ''.img_action(0,-1).''; + if ($object->stcomm_id != 0) print ''.img_action(0,0).''; + if ($object->stcomm_id != 1) print ''.img_action(0,1).''; + if ($object->stcomm_id != 2) print ''.img_action(0,2).''; + if ($object->stcomm_id != 3) print ''.img_action(0,3).''; + print ''; // Sales representative include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'; diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index cc420c48d15..cfcd8ee121c 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -315,9 +315,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire) print ''; print ''.$companystatic->getNomUrl(1,'customer',48).''; print ''; - 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 ""; print ''.dol_print_date($db->jdate($objp->tms),'day').""; print ''; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index b2f1f8dcc44..4063802ffa4 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -322,14 +322,7 @@ if ($result) print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); print ''; - 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; diff --git a/htdocs/comm/prospect/class/prospect.class.php b/htdocs/comm/prospect/class/prospect.class.php index 68440aa0b84..ec0454c4847 100644 --- a/htdocs/comm/prospect/class/prospect.class.php +++ b/htdocs/comm/prospect/class/prospect.class.php @@ -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; diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php deleted file mode 100644 index dc447122561..00000000000 --- a/htdocs/comm/prospect/fiche.php +++ /dev/null @@ -1,343 +0,0 @@ - - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * - * 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 . - */ - -/** - * \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 ''; - print '\n"; - print '"; - print "
'; - - print ''; - print ''; - - // Address - print '"; - - // Zip / Town - print ''; - print ''; - - // Country - print ''; - - // Phone - print ''; - print ''; - - // EMail - print ''; - - // Web - print '"; - - // Level of prospect - print '"; - print ''; - - // Multiprice level - if (! empty($conf->global->PRODUIT_MULTIPRICES)) - { - print '"; - print ''; - } - - // Status - print ''; - print ''; - - // 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 ''; - print ''; - print "\n"; - } - - print '
'.$langs->trans("ThirdPartyName").''; - $object->next_prev_filter="te.client in (2,3)"; - print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','',''); - print '
'.$langs->trans("Address").''; - dol_print_address($object->address,'gmap','thirdparty',$object->id); - print "
'.$langs->trans('Zip').' / '.$langs->trans("Town").''.$object->zip.(($object->zip && $object->town)?' / ':'').$object->town.'
'.$langs->trans("Country").''; - $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 '
'.$langs->trans("Phone").''.dol_print_phone($object->tel,$object->country_code,0,$object->id,'AC_TEL').''.$langs->trans("Fax").''.dol_print_phone($object->fax,$object->country_code).'
'.$langs->trans('EMail').''.dol_print_email($object->email,0,$object->id,'AC_EMAIL').'
'.$langs->trans("Web")."url\">$object->url
'; - print ''; - print '
'; - print $langs->trans('ProspectLevelShort'); - print ''; - if ($action != 'editlevel' && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('Modify'),1).'
'; - print '
'; - 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 "
'; - print '
'; - print $langs->trans("PriceLevel"); - print ''; - if ($user->rights->societe->creer) - { - print ''.img_edit($langs->trans("Modify")).''; - } - print '
'; - print '
'.$object->price_level."
'.$langs->trans("StatusProsp").''.$object->getLibProspStatut(4).''; - if ($object->stcomm_id != -1) print ''.img_action(0,-1).''; - if ($object->stcomm_id != 0) print ''.img_action(0,0).''; - if ($object->stcomm_id != 1) print ''.img_action(0,1).''; - if ($object->stcomm_id != 2) print ''.img_action(0,2).''; - if ($object->stcomm_id != 3) print ''.img_action(0,3).''; - print '
'.$langs->trans("LinkedToDolibarrMember").''; - $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 '
'; - - - print "
'; - - // Nbre max d'elements des petites listes - $MAXLIST=5; - $tableaushown=0; - - // Lien recap - print ''; - print ''; - print ''; - print ''; - print '
'; - print '
'.$langs->trans("Summary").''.$langs->trans("ShowProspectPreview").'
'; - print '
'; - - - /* - * 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 ''; - print ''; - print ''; - print ''; - } - - while ($i < $num && $i < $MAXLIST) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print ""; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - $db->free(); - - if ($num > 0) print "
'; - print ''; - print '
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' ('.$num.')'.img_picto($langs->trans("Statistics"),'stats').'
propalid\">"; - print img_object($langs->trans("ShowPropal"),"propal"); - print " ".$objp->ref."\n"; - if ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay) && $objp->fk_statut == 1) - { - print " ".img_warning(); - } - print "".dol_print_date($db->jdate($objp->dp),"day")."".price($objp->total_ht)."".$propal_static->LibStatut($objp->fk_statut,5)."
"; - } - else - { - dol_print_error($db); - } - - } - - print "
\n"; - - dol_fiche_end(); - - /* - * Barre d'action - */ - - print '
'; - - if (! empty($conf->propal->enabled) && $user->rights->propale->creer) - { - print ''.$langs->trans("AddProp").''; - } - - // Add action - if (! empty($conf->agenda->enabled) && ! empty($conf->global->MAIN_REPEATTASKONEACHTAB)) - { - if ($user->rights->agenda->myactions->create) - { - print ''.$langs->trans("AddAction").''; - } - else - { - print ''.$langs->trans("AddAction").''; - } - } - - print '
'; - - print '
'; - - - if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB)) - { - print '
'; - // 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(); -?> diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 9b3ac059454..fe0187624fe 100755 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -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").')'; diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index 802fe5ab071..254370a4395 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -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")); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 87695a771b3..4fb851ce4d3 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -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"); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index db147ffde86..0f5e7051010 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -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 = '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"); + + } + +} \ No newline at end of file