';
-if ($conf->propal->enabled)
+if ($conf->propal->enabled)
{
$var=false;
print '';
@@ -67,14 +67,14 @@ if ($conf->propal->enabled)
/*
* Prospects par status
*
- */
+ */
$sql = "SELECT count(*) as cc, st.libelle, st.id";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st ";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.fk_stcomm = st.id";
-$sql.= " AND s.client = 2";
+$sql.= " AND s.client IN (2, 3)";
$sql.= " AND s.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " GROUP BY st.id";
@@ -184,7 +184,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
if ($socid) $sql.= " AND s.rowid = ".$socid;
$sql.= " ORDER BY p.rowid DESC";
$sql.= $db->plimit(5, 0);
-
+
$resql=$db->query($sql);
if ($resql)
{
@@ -194,17 +194,17 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
if ($num > 0)
{
$var=true;
-
+
print '';
print ''.$langs->trans("ProposalsOpened").' ';
-
+
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$var=!$var;
print "propalid."\">";
print img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.' ';
-
+
print "socid."\">".img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom." \n";
print "";
print dol_print_date($obj->dp,'day')." \n";
@@ -247,7 +247,7 @@ if ( $db->query($sql) )
print '';
print ''.$langs->trans("ProspectToContact").' ';
-
+
while ($i < $num)
{
$obj = $db->fetch_object();
@@ -266,7 +266,7 @@ print '';
print '
';
$db->close();
-
+
llxFooter('$Date$ - $Revision$');
?>
diff --git a/htdocs/comm/prospect/prospects.php b/htdocs/comm/prospect/prospects.php
index 6c2ad22f5b6..0163661f4df 100644
--- a/htdocs/comm/prospect/prospects.php
+++ b/htdocs/comm/prospect/prospects.php
@@ -153,7 +153,7 @@ if ($_GET["action"] == 'cstc')
/*
- * Affichage liste
+ * View
*/
$sql = "SELECT s.rowid, s.nom, s.ville, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea,";
@@ -172,7 +172,7 @@ if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d on (d.rowid = s.fk_departement)";
$sql.= " WHERE s.fk_stcomm = st.id";
-$sql.= " AND s.client = 2";
+$sql.= " AND s.client in (2, 3)";
$sql.= " AND s.entity = ".$conf->entity;
if ($user->societe_id) $sql.= " AND s.rowid = " .$user->societe_id;
// Join for the needed table to filter by sale
diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php
index 838ebc0c9e4..07d20490615 100644
--- a/htdocs/commande/commande.class.php
+++ b/htdocs/commande/commande.class.php
@@ -2178,7 +2178,7 @@ class Commande extends CommonObject
$sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe";
- $sql.= " WHERE client = 1";
+ $sql.= " WHERE client IN (1, 3)";
$sql.= " AND entity = ".$conf->entity;
$sql.= " LIMIT 10";
diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index bf3e83cd9e0..4fb482f2ec4 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -471,7 +471,7 @@ if ($conf->societe->enabled && $user->rights->societe->lire)
$sql = "SELECT s.nom, s.rowid, ".$db->pdate("s.datec")." as dc";
$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 = 1";
+ $sql.= " WHERE s.client IN (1, 3)";
$sql.= " AND s.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid;
diff --git a/htdocs/contact/index.php b/htdocs/contact/index.php
index 5ad9850bde3..4f68ba2f6d3 100644
--- a/htdocs/contact/index.php
+++ b/htdocs/contact/index.php
@@ -78,7 +78,7 @@ if ($type == "o") {
$titre=$langs->trans("ListOfContacts").' ('.$langs->trans("OthersNotLinkedToThirdParty").')';
$urlfiche="";
}
-if ($view == 'phone') { $text="( Vue Telephones)"; }
+if ($view == 'phone') { $text=" (Vue Telephones)"; }
if ($view == 'mail') { $text=" (Vue EMail)"; }
if ($view == 'recent') { $text=" (Recents)"; }
$titre = $titre." $text";
@@ -160,11 +160,11 @@ if ($type == "f") // filtre sur type
}
if ($type == "c") // filtre sur type
{
- $sql .= " AND client = 1";
+ $sql .= " AND client IN (1, 3)";
}
if ($type == "p") // filtre sur type
{
- $sql .= " AND client = 2";
+ $sql .= " AND client IN (2, 3)";
}
if ($sall)
{
diff --git a/htdocs/don.class.php b/htdocs/don.class.php
index 80af95b0d43..dd9f49829b4 100644
--- a/htdocs/don.class.php
+++ b/htdocs/don.class.php
@@ -147,13 +147,13 @@ class Don extends CommonObject
// Charge tableau des id de societe socids
$socids = array();
-
+
$sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe";
- $sql.= " WHERE client = 1";
+ $sql.= " WHERE client IN (1, 3)";
$sql.= " AND entity = ".$conf->entity;
$sql.= " LIMIT 10";
-
+
$resql = $this->db->query($sql);
if ($resql)
{
@@ -294,7 +294,7 @@ class Don extends CommonObject
function create($user)
{
global $conf;
-
+
$this->date = $this->db->idate($this->date);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."don (";
@@ -573,7 +573,7 @@ class Don extends CommonObject
function sum_donations($param)
{
global $conf;
-
+
$result=0;
$sql = "SELECT sum(amount) as total";
diff --git a/htdocs/expedition/expedition.class.php b/htdocs/expedition/expedition.class.php
index 53e7ef0695b..ecd266438fb 100644
--- a/htdocs/expedition/expedition.class.php
+++ b/htdocs/expedition/expedition.class.php
@@ -60,7 +60,7 @@ class Expedition extends CommonObject
$this->db = $DB;
$this->lignes = array();
$this->products = array();
-
+
// List of long language codes for status
$this->statuts[-1] = 'StatusSendingCanceled';
$this->statuts[0] = 'StatusSendingDraft';
@@ -131,7 +131,7 @@ class Expedition extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."expedition";
$sql.= " SET ref = '(PROV".$this->id.")'";
$sql.= " WHERE rowid = ".$this->id;
-
+
dol_syslog("Expedition::create sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
{
@@ -143,7 +143,7 @@ class Expedition extends CommonObject
$error++;
}
}
-
+
if (! $error && $this->id && $this->origin_id)
{
$ret = $this->add_object_linked();
@@ -151,7 +151,7 @@ class Expedition extends CommonObject
{
$error++;
}
-
+
if ($conf->commande->enabled)
{
$ret = $this->setStatut(2,$this->origin_id,$this->origin);
@@ -166,7 +166,7 @@ class Expedition extends CommonObject
$error++;
}
}
-
+
if (! $error)
{
$this->db->commit();
@@ -557,7 +557,7 @@ class Expedition extends CommonObject
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet";
$sql.= " WHERE fk_expedition = ".$this->id;
-
+
if ( $this->db->query($sql) )
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_element";
@@ -568,7 +568,7 @@ class Expedition extends CommonObject
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expedition";
$sql.= " WHERE rowid = ".$this->id;
-
+
if ( $this->db->query($sql) )
{
$this->db->commit();
@@ -733,7 +733,7 @@ class Expedition extends CommonObject
$sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe";
- $sql.= " WHERE client = 1";
+ $sql.= " WHERE client IN (1, 3)";
$sql.= " AND entity = ".$conf->entity;
$sql.= " LIMIT 10";
diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php
index 16f3c007a8c..615d4a88b55 100644
--- a/htdocs/facture.class.php
+++ b/htdocs/facture.class.php
@@ -977,7 +977,7 @@ class Facture extends CommonObject
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_element";
$sql.= " WHERE fk_target = ".$rowid;
$sql.= " AND targettype = '".$this->element."'";
-
+
if ($this->db->query($sql))
{
// On met a jour le lien des remises
@@ -2676,7 +2676,7 @@ class Facture extends CommonObject
$sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe";
- $sql.= " WHERE client = 1";
+ $sql.= " WHERE client IN (1, 3)";
$sql.= " AND entity = ".$conf->entity;
$sql.= " LIMIT 10";
diff --git a/htdocs/fichinter/fichinter.class.php b/htdocs/fichinter/fichinter.class.php
index f80f77f6249..1cbe8a1d17c 100644
--- a/htdocs/fichinter/fichinter.class.php
+++ b/htdocs/fichinter/fichinter.class.php
@@ -675,7 +675,7 @@ class Fichinter extends CommonObject
$socids = array();
$sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe";
- $sql.= " WHERE client = 1";
+ $sql.= " WHERE client IN (1, 3)";
$sql.= " AND entity = ".$conf->entity;
$sql.= " LIMIT 10";
$resql = $this->db->query($sql);
diff --git a/htdocs/includes/boxes/box_clients.php b/htdocs/includes/boxes/box_clients.php
index 58e56807fc7..3c5417c659e 100644
--- a/htdocs/includes/boxes/box_clients.php
+++ b/htdocs/includes/boxes/box_clients.php
@@ -70,7 +70,7 @@ class box_clients extends ModeleBoxes {
$sql = "SELECT s.nom, s.rowid as socid, s.tms";
$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 = 1";
+ $sql.= " WHERE s.client IN (1, 3)";
$sql.= " AND s.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($user->societe_id) $sql.= " AND s.rowid = $user->societe_id";
diff --git a/htdocs/includes/boxes/box_prospect.php b/htdocs/includes/boxes/box_prospect.php
index 6874d5a466d..3fccd9b203f 100644
--- a/htdocs/includes/boxes/box_prospect.php
+++ b/htdocs/includes/boxes/box_prospect.php
@@ -74,7 +74,7 @@ class box_prospect extends ModeleBoxes {
$sql = "SELECT s.nom, s.rowid as socid, s.fk_stcomm, s.tms";
$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 = 2";
+ $sql.= " WHERE s.client IN (2, 3)";
$sql.= " AND s.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
diff --git a/htdocs/includes/modules/mailings/poire.modules.php b/htdocs/includes/modules/mailings/poire.modules.php
index 63f9e321792..f7b0d827de7 100644
--- a/htdocs/includes/modules/mailings/poire.modules.php
+++ b/htdocs/includes/modules/mailings/poire.modules.php
@@ -65,7 +65,7 @@ class mailing_poire extends MailingTargets
$statssql[0].= " WHERE s.rowid = c.fk_soc";
$statssql[0].= " AND s.entity = ".$conf->entity;
$statssql[0].= " AND c.entity = ".$conf->entity;
- $statssql[0].= " AND s.client = 1";
+ $statssql[0].= " AND s.client IN (1, 3)";
$statssql[0].= " AND c.email != ''";
return $statssql;
diff --git a/htdocs/livraison/livraison.class.php b/htdocs/livraison/livraison.class.php
index 368f5265d51..5d164883567 100644
--- a/htdocs/livraison/livraison.class.php
+++ b/htdocs/livraison/livraison.class.php
@@ -67,7 +67,7 @@ class Livraison extends CommonObject
$this->db = $DB;
$this->lignes = array();
$this->products = array();
-
+
// List of short language codes for status
$this->statuts[-1] = 'StatusSendingCanceled';
$this->statuts[0] = 'StatusSendingDraft';
@@ -160,7 +160,7 @@ class Livraison extends CommonObject
{
$error++;
}
-
+
if (! $conf->expedition_bon->enabled)
{
if ($conf->commande->enabled)
@@ -720,7 +720,7 @@ class Livraison extends CommonObject
$sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe";
- $sql.= " WHERE client = 1";
+ $sql.= " WHERE client IN (1, 3)";
$sql.= " AND entity = ".$conf->entity;
$sql.= " LIMIT 10";
diff --git a/htdocs/oscommerce_ws/clients/fiche.php b/htdocs/oscommerce_ws/clients/fiche.php
index 57a4cc9404d..c0c7aa0bc3b 100644
--- a/htdocs/oscommerce_ws/clients/fiche.php
+++ b/htdocs/oscommerce_ws/clients/fiche.php
@@ -113,7 +113,7 @@ if (($_GET["action"] == 'import' ) && ( $_GET["custid"] != '' ) && ($user->right
$societe->siren = '';
$societe->siret = '';
$societe->ape = '';
- $societe->client = 1; // mettre 0 si prospect
+ $societe->client = 1; // put 0 if prospect
}
/* utilisation de la table de transco*/
diff --git a/htdocs/oscommerce_ws/commandes/fiche.php b/htdocs/oscommerce_ws/commandes/fiche.php
index 2226cefbae1..836ba8fce3a 100644
--- a/htdocs/oscommerce_ws/commandes/fiche.php
+++ b/htdocs/oscommerce_ws/commandes/fiche.php
@@ -17,7 +17,7 @@
*
* $Id$
*/
-
+
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
require_once("../includes/configure.php");
@@ -36,7 +36,7 @@ if ($action == '' && !$cancel) {
$result = $osc_order->fetch($_GET["orderid"]);
if ( !$result)
- {
+ {
$osc_prod = new Osc_Product($db);
print 'Fiche commande OSC : '.$osc_order->osc_orderid.'
';
@@ -48,17 +48,17 @@ if ($action == '' && !$cancel) {
print 'M�thode de paiement '.$osc_order->osc_orderpaymet.' ';
print "
";
print '';
- // les articles
+ // les articles
for ($l=0;$l < sizeof($osc_order->osc_lines); $l++)
{
print ''.$osc_order->osc_lines[$l]["products_id"].' '.$osc_prod->get_productid($osc_order->osc_lines[$l]["products_id"]).' '.$osc_order->osc_lines[$l]["products_name"].' '.convert_price($osc_order->osc_lines[$l]["products_price"]).' '.$osc_order->osc_lines[$l]["quantity"].' ';
- }
+ }
print "
";
/* ************************************************************************** */
- /* */
- /* Barre d'action */
- /* */
+ /* */
+ /* Barre d'action */
+ /* */
/* ************************************************************************** */
print "\n \n";
// seule action importer
-
+
}
else
{
@@ -87,7 +87,7 @@ if ($action == '' && !$cancel) {
print "\n \n";
}
}
-/* action Import cr�ation de l'objet commande de dolibarr
+/* action Import cr�ation de l'objet commande de dolibarr
*
*/
if (($_GET["action"] == 'import' ) && ( $_GET["orderid"] != '' ) && $user->rights->commande->creer)
@@ -106,7 +106,7 @@ if ($action == '' && !$cancel) {
}
else {
// v�rifier que la soci�t� est renseign�e, sinon importer le client d'abord
- if ( ! $commande->socid)
+ if ( ! $commande->socid)
{
$osc_cust = new Osc_customer($db, $osc_order->osc_custid);
$result = $osc_cust->fetch($osc_order->osc_custid);
@@ -127,44 +127,45 @@ if ($action == '' && !$cancel) {
$societe->ville = $osc_cust->osc_custcity;
$societe->departement_id = 0;
$societe->pays_code = $osc_cust->osc_custcodecountry;
- $societe->tel = $osc_cust->osc_custtel;
- $societe->fax = $osc_cust->osc_custfax;
- $societe->email = $osc_cust->osc_custmail;
- /* on force */
+ $societe->tel = $osc_cust->osc_custtel;
+ $societe->fax = $osc_cust->osc_custfax;
+ $societe->email = $osc_cust->osc_custmail;
+ /* on force */
$societe->url = '';
$societe->siren = '';
$societe->siret = '';
$societe->ape = '';
- $societe->client = 1; // mettre 0 si prospect
+ $societe->client = 1; // put 0 if prospect
$cl = $societe->create($user);
if ($cl == 0)
{
$commande->socid = $societe->id;
- print 'cr�ation r�ussie nouveau client/prospect : '.$societe->nom;
+ print $langs->trans("CustomerCreated",$societe->nom);
$res = $osc_cust->transcode($osc_cust->osc_custid,$societe->id);
print ' : Id Dolibarr '.$societe->id.' , Id osc : '.$osc_cust->osc_custid.'
';
}
else
{
- print 'cr�ation impossible client : '. $osc_cust->osc_custid .'
';
+ print 'Failed to create customer : '. $osc_cust->osc_custid ;
exit;
}
}
}
-// v�rifier l'existence des produits command�s
+
+ // verifier l'existence des produits commandes
$osc_product = new Osc_Product($db);
$err = 0;
for ($lig = 0; $lig < sizeof($commande->lines); $lig++)
{
// print "traitement de ".$commande->lines[$lig]->fk_product."
";
- if (! $commande->lines[$lig]->fk_product)
+ if (! $commande->lines[$lig]->fk_product)
{
print "Article non trouv� ".$commande->lines[$lig]->libelle." : ".$commande->lines[$lig]->desc."
";
$err ++;
}
- }
+ }
if ($err > 0) {
print (" Des produits de la commande sont inexistants
");
$id =-9;
@@ -201,9 +202,9 @@ if ($action == '' && !$cancel) {
exit;
}
$id = $societe_control->fetch($ref = $osc_order->osc_ref);
-
- if ($id > 0)
- {
+
+ if ($id > 0)
+ {
$id = $societe->update($id, $user);
if ($id < 0) print ' Erreur update '.$id.'';
}
@@ -212,7 +213,7 @@ if ($action == '' && !$cancel) {
print ''.$langs->trans("Retour").'
';
}
}
-
+
}
llxFooter('$Date$ - $Revision$');
diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php
index d6d72941101..41a25810438 100644
--- a/htdocs/propal.class.php
+++ b/htdocs/propal.class.php
@@ -1874,7 +1874,7 @@ class Propal extends CommonObject
$socids = array();
$sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe";
- $sql.= " WHERE client = 1";
+ $sql.= " WHERE client IN (1, 3)";
$sql.= " AND entity = ".$conf->entity;
$sql.= " LIMIT 10";
$resql = $this->db->query($sql);
diff --git a/htdocs/prospect.class.php b/htdocs/prospect.class.php
index ea24e83def2..2241c5f29c2 100644
--- a/htdocs/prospect.class.php
+++ b/htdocs/prospect.class.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville
* Copyright (C) 2006 Laurent Destailleur
* Copyright (C) 2005-2009 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 2 of the License, or
@@ -19,26 +19,24 @@
*/
/**
- \file htdocs/prospect.class.php
- \ingroup societe
- \brief Fichier de la classe des prospects
- \version $Id$
-*/
-
-
-/**
- \class Prospect
- \brief Classe permettant la gestion des prospects
+ * \file htdocs/prospect.class.php
+ * \ingroup societe
+ * \brief Fichier de la classe des prospects
+ * \version $Id$
*/
include_once(DOL_DOCUMENT_ROOT."/societe.class.php");
+/**
+ * \class Prospect
+ * \brief Classe permettant la gestion des prospects
+ */
class Prospect extends Societe
{
var $db;
-
+
/**
* \brief Constructeur de la classe
* \param DB handler acces base de donnees
@@ -47,22 +45,22 @@ class Prospect extends Societe
function Prospect($DB, $id=0)
{
global $config;
-
+
$this->db = $DB;
$this->id = $id;
-
+
return 0;
}
-
+
/**
* \brief Charge indicateurs this->nb de tableau de bord
- * \return int <0 si ko, >0 si ok
+ * \return int <0 if KO, >0 if OK
*/
function load_state_board()
{
global $conf, $user;
-
+
$this->nb=array("customers" => 0,"prospects" => 0);
$clause = "WHERE";
@@ -74,20 +72,21 @@ class Prospect extends Societe
$sql.= " WHERE sc.fk_user = " .$user->id;
$clause = "AND";
}
- $sql.= " ".$clause." s.client in (1,2)";
+ $sql.= " ".$clause." s.client in (1,2,3)";
$sql.= " AND s.entity = ".$conf->entity;
$sql.= " GROUP BY s.client";
+
$resql=$this->db->query($sql);
if ($resql)
{
while ($obj=$this->db->fetch_object($resql))
{
- if ($obj->client == 1) $this->nb["customers"]=$obj->nb;
- if ($obj->client == 2) $this->nb["prospects"]=$obj->nb;
+ if ($obj->client == 1 || $obj->client == 3) $this->nb["customers"]+=$obj->nb;
+ if ($obj->client == 2 || $obj->client == 3) $this->nb["prospects"]+=$obj->nb;
}
return 1;
}
- else
+ else
{
dol_print_error($this->db);
$this->error=$this->db->error();
@@ -95,7 +94,7 @@ class Prospect extends Societe
}
}
-
+
/**
* \brief Return status of prospect
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
@@ -153,7 +152,7 @@ class Prospect extends Societe
{
return $this->LibLevel($this->fk_prospectlevel);
}
-
+
/**
* \brief Renvoi le libelle du niveau
* \param fk_prospectlevel Prospect level
@@ -165,7 +164,7 @@ class Prospect extends Societe
$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))
+ if ($lib == $langs->trans("ProspectLevel".$fk_prospectlevel))
{
$lib=$langs->getLabelFromKey($this->db,$fk_prospectlevel,'c_prospectlevel','code','label');
}
diff --git a/htdocs/soc.php b/htdocs/soc.php
index cbc52efff9e..77f43a7b048 100644
--- a/htdocs/soc.php
+++ b/htdocs/soc.php
@@ -420,7 +420,7 @@ $_GET["action"] == 'create' || $_POST["action"] == 'create')
// Prospect/Customer
print ''.$langs->trans('ProspectCustomer').' ';
print 'client==2?' selected="true"':'').'>'.$langs->trans('Prospect').' ';
- if ($conf->global->SOCIETE_PROSPECTANDCUSTOMER) print 'client==3?' selected="true"':'').'>'.$langs->trans('ProspectCustomer').' ';
+ print 'client==3?' selected="true"':'').'>'.$langs->trans('ProspectCustomer').' ';
print 'client==1?' selected="true"':'').'>'.$langs->trans('Customer').' ';
print 'client==0?' selected="true"':'').'>'.$langs->trans('NorProspectNorCustomer').' ';
print ' ';
@@ -751,7 +751,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
// Prospect/Customer
print ''.$langs->trans('ProspectCustomer').' ';
print 'client==2?' selected="true"':'').'>'.$langs->trans('Prospect').' ';
- if ($conf->global->SOCIETE_PROSPECTANDCUSTOMER) print 'client==3?' selected="true"':'').'>'.$langs->trans('ProspectCustomer').' ';
+ print 'client==3?' selected="true"':'').'>'.$langs->trans('ProspectCustomer').' ';
print 'client==1?' selected="true"':'').'>'.$langs->trans('Customer').' ';
print 'client==0?' selected="true"':'').'>'.$langs->trans('NorProspectNorCustomer').' ';
print ' ';
diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php
index 20335691b61..723e0dfd816 100644
--- a/htdocs/societe.class.php
+++ b/htdocs/societe.class.php
@@ -998,12 +998,18 @@ class Societe extends CommonObject
{
if ($this->id)
{
+ $newclient=1;
+ if ($this->client == 2 || $this->client == 3) $newclient=3; //If prospect, we keep prospect tag
$sql = "UPDATE ".MAIN_DB_PREFIX."societe";
- $sql.= " SET client = 1";
+ $sql.= " SET client = ".$newclient;
$sql.= " WHERE rowid = " . $this->id;
$resql=$this->db->query($sql);
- if ($resql) return 1;
+ if ($resql)
+ {
+ $this->client = $newclient;
+ return 1;
+ }
else return -1;
}
return 0;