2
0
forked from Wavyzz/dolibarr

New: A customer can also be a prospect.

This commit is contained in:
Laurent Destailleur
2010-01-05 20:03:37 +00:00
parent 818394b154
commit c20be36714
26 changed files with 124 additions and 114 deletions

View File

@@ -4,6 +4,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 2.8 compared to 2.7 ***** ***** ChangeLog for 2.8 compared to 2.7 *****
For users: For users:
- New: A customer can also be a prospect.
- New: task #9802 : Can link an action to a project. - New: task #9802 : Can link an action to a project.
- New: Initial sold can be conciliated. - New: Initial sold can be conciliated.
- New: task #9935: Can edit accountancy code. - New: task #9935: Can edit accountancy code.

View File

@@ -152,7 +152,7 @@ print '</td></tr>';
if ($_GET['type'] == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER && !$categorie->id_mere) if ($_GET['type'] == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER && !$categorie->id_mere)
{ {
print '<tr><td>'.$langs->trans ("AssignedToCustomer").'</td><td>'; print '<tr><td>'.$langs->trans ("AssignedToCustomer").'</td><td>';
print $html->select_societes($categorie->socid,'socid','s.client = 1 AND s.fournisseur = 0',1); print $html->select_societes($categorie->socid,'socid','s.client IN (1, 3) AND s.fournisseur = 0',1);
print '</td></tr>'; print '</td></tr>';
print '<input type="hidden" name="catMere" value="-1">'; print '<input type="hidden" name="catMere" value="-1">';
print '<input type="hidden" name="visible" value="1">'; print '<input type="hidden" name="visible" value="1">';

View File

@@ -247,7 +247,7 @@ if ($user->rights->categorie->creer)
else else
{ {
print '<tr><td>'.$langs->trans ("AssignedToCustomer").'</td><td>'; print '<tr><td>'.$langs->trans ("AssignedToCustomer").'</td><td>';
print $html->select_societes($_REQUEST['socid_id'],'socid','s.client = 1 AND s.fournisseur = 0',1); print $html->select_societes($_REQUEST['socid_id'],'socid','s.client IN (1, 3) AND s.fournisseur = 0',1);
print '</td></tr>'; print '</td></tr>';
print '<input type="hidden" name="catMere" value="-1">'; print '<input type="hidden" name="catMere" value="-1">';
print '<input type="hidden" name="visible" value="1">'; print '<input type="hidden" name="visible" value="1">';

View File

@@ -97,7 +97,7 @@ class Client extends Societe
$sql.= " WHERE sc.fk_user = " .$user->id; $sql.= " WHERE sc.fk_user = " .$user->id;
$clause = "AND"; $clause = "AND";
} }
$sql.= " ".$clause." s.client in (1,2)"; $sql.= " ".$clause." s.client in (1,2,3)";
$sql.= " AND s.entity = ".$conf->entity; $sql.= " AND s.entity = ".$conf->entity;
$sql.= " GROUP BY s.client"; $sql.= " GROUP BY s.client";
@@ -106,8 +106,8 @@ class Client extends Societe
{ {
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
if ($obj->client == 1) $this->nb["customers"]=$obj->nb; if ($obj->client == 1 || $obj->client == 3) $this->nb["customers"]+=$obj->nb;
if ($obj->client == 2) $this->nb["prospects"]=$obj->nb; if ($obj->client == 2 || $obj->client == 3) $this->nb["prospects"]+=$obj->nb;
} }
return 1; return 1;
} }

View File

@@ -19,10 +19,10 @@
*/ */
/** /**
\file htdocs/comm/clients.php * \file htdocs/comm/clients.php
\ingroup commercial, societe * \ingroup commercial, societe
\brief Liste des clients * \brief List of customers
\version $Id$ * \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@@ -60,7 +60,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st"; $sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st";
if (!$user->rights->societe->client->voir) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.fk_stcomm = st.id"; $sql.= " WHERE s.fk_stcomm = st.id";
$sql.= " AND s.client=1"; $sql.= " AND s.client IN (1, 3)";
$sql.= " AND s.entity = ".$conf->entity; $sql.= " AND s.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid; if ($socid) $sql.= " AND s.rowid = ".$socid;

View File

@@ -82,8 +82,8 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
$sql.= " WHERE s.fk_stcomm = st.id"; $sql.= " WHERE s.fk_stcomm = st.id";
$sql.= " AND p.entity = ".$conf->entity; $sql.= " AND p.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($type == "c") $sql.= " AND s.client = 1"; if ($type == "c") $sql.= " AND s.client IN (1, 3)";
if ($type == "p") $sql.= " AND s.client = 2"; if ($type == "p") $sql.= " AND s.client IN (2, 3)";
if ($type == "f") $sql.= " AND s.fournisseur = 1"; if ($type == "f") $sql.= " AND s.fournisseur = 1";
if ($socid) $sql.= " AND s.rowid = ".$socid; if ($socid) $sql.= " AND s.rowid = ".$socid;

View File

@@ -350,7 +350,7 @@ if ($conf->societe->enabled && $user->rights->societe->lire)
$sql = "SELECT s.rowid,s.nom,s.client,s.tms"; $sql = "SELECT s.rowid,s.nom,s.client,s.tms";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.client IN (1,2)"; $sql.= " WHERE s.client IN (1, 2, 3)";
$sql.= " AND s.entity = ".$conf->entity; $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; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = $socid"; if ($socid) $sql.= " AND s.rowid = $socid";
@@ -366,7 +366,9 @@ if ($conf->societe->enabled && $user->rights->societe->lire)
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("BoxTitleLastCustomersOrProspects",$max).'</td></tr>'; print '<td colspan="2">'.$langs->trans("BoxTitleLastCustomersOrProspects",$max).'</td>';
print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
print '</tr>';
if ($num) if ($num)
{ {
$company=new Societe($db); $company=new Societe($db);
@@ -379,8 +381,9 @@ if ($conf->societe->enabled && $user->rights->societe->lire)
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td nowrap="nowrap">'.$company->getNomUrl(1,'customer',48).'</td>'; print '<td nowrap="nowrap">'.$company->getNomUrl(1,'customer',48).'</td>';
print '<td align="right" nowrap>'; print '<td align="right" nowrap>';
if ($objp->client == 1) print $langs->trans("Customer"); if ($objp->client == 2 || $objp->client == 3) print $langs->trans("Prospect");
if ($objp->client == 2) print $langs->trans("Prospect"); if ($objp->client == 3) print ' / ';
if ($objp->client == 1 || $objp->client == 3) print $langs->trans("Customer");
print "</td>"; print "</td>";
print '<td align="right" nowrap>'.dol_print_date($db->jdate($objp->tms),'day')."</td>"; print '<td align="right" nowrap>'.dol_print_date($db->jdate($objp->tms),'day')."</td>";
print '</tr>'; print '</tr>';

View File

@@ -19,11 +19,11 @@
*/ */
/** /**
\file htdocs/comm/prospect/index.php * \file htdocs/comm/prospect/index.php
\ingroup commercial * \ingroup commercial
\brief Page accueil de la zone prospection * \brief Page accueil de la zone prospection
\version $Id$ * \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/agenda.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/agenda.lib.php");
@@ -39,7 +39,7 @@ if ($user->societe_id > 0)
/* /*
* Affichage zone prospect * View
*/ */
llxHeader(); llxHeader();
@@ -74,7 +74,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st "; $sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st ";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.fk_stcomm = st.id"; $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; $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; 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"; $sql.= " GROUP BY st.id";

View File

@@ -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,"; $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.= ", ".MAIN_DB_PREFIX."societe as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d on (d.rowid = s.fk_departement)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d on (d.rowid = s.fk_departement)";
$sql.= " WHERE s.fk_stcomm = st.id"; $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; $sql.= " AND s.entity = ".$conf->entity;
if ($user->societe_id) $sql.= " AND s.rowid = " .$user->societe_id; if ($user->societe_id) $sql.= " AND s.rowid = " .$user->societe_id;
// Join for the needed table to filter by sale // Join for the needed table to filter by sale

View File

@@ -2178,7 +2178,7 @@ class Commande extends CommonObject
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe"; $sql.= " FROM ".MAIN_DB_PREFIX."societe";
$sql.= " WHERE client = 1"; $sql.= " WHERE client IN (1, 3)";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$sql.= " LIMIT 10"; $sql.= " LIMIT 10";

View File

@@ -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 = "SELECT s.nom, s.rowid, ".$db->pdate("s.datec")." as dc";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $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"; 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; $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->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; if ($socid) $sql.= " AND s.rowid = ".$socid;

View File

@@ -78,7 +78,7 @@ if ($type == "o") {
$titre=$langs->trans("ListOfContacts").' ('.$langs->trans("OthersNotLinkedToThirdParty").')'; $titre=$langs->trans("ListOfContacts").' ('.$langs->trans("OthersNotLinkedToThirdParty").')';
$urlfiche=""; $urlfiche="";
} }
if ($view == 'phone') { $text="( Vue Telephones)"; } if ($view == 'phone') { $text=" (Vue Telephones)"; }
if ($view == 'mail') { $text=" (Vue EMail)"; } if ($view == 'mail') { $text=" (Vue EMail)"; }
if ($view == 'recent') { $text=" (Recents)"; } if ($view == 'recent') { $text=" (Recents)"; }
$titre = $titre." $text"; $titre = $titre." $text";
@@ -160,11 +160,11 @@ if ($type == "f") // filtre sur type
} }
if ($type == "c") // 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 if ($type == "p") // filtre sur type
{ {
$sql .= " AND client = 2"; $sql .= " AND client IN (2, 3)";
} }
if ($sall) if ($sall)
{ {

View File

@@ -150,7 +150,7 @@ class Don extends CommonObject
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe"; $sql.= " FROM ".MAIN_DB_PREFIX."societe";
$sql.= " WHERE client = 1"; $sql.= " WHERE client IN (1, 3)";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$sql.= " LIMIT 10"; $sql.= " LIMIT 10";

View File

@@ -733,7 +733,7 @@ class Expedition extends CommonObject
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe"; $sql.= " FROM ".MAIN_DB_PREFIX."societe";
$sql.= " WHERE client = 1"; $sql.= " WHERE client IN (1, 3)";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$sql.= " LIMIT 10"; $sql.= " LIMIT 10";

View File

@@ -2676,7 +2676,7 @@ class Facture extends CommonObject
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe"; $sql.= " FROM ".MAIN_DB_PREFIX."societe";
$sql.= " WHERE client = 1"; $sql.= " WHERE client IN (1, 3)";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$sql.= " LIMIT 10"; $sql.= " LIMIT 10";

View File

@@ -675,7 +675,7 @@ class Fichinter extends CommonObject
$socids = array(); $socids = array();
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe"; $sql.= " FROM ".MAIN_DB_PREFIX."societe";
$sql.= " WHERE client = 1"; $sql.= " WHERE client IN (1, 3)";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$sql.= " LIMIT 10"; $sql.= " LIMIT 10";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);

View File

@@ -70,7 +70,7 @@ class box_clients extends ModeleBoxes {
$sql = "SELECT s.nom, s.rowid as socid, s.tms"; $sql = "SELECT s.nom, s.rowid as socid, s.tms";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $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"; 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; $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->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"; if ($user->societe_id) $sql.= " AND s.rowid = $user->societe_id";

View File

@@ -74,7 +74,7 @@ class box_prospect extends ModeleBoxes {
$sql = "SELECT s.nom, s.rowid as socid, s.fk_stcomm, s.tms"; $sql = "SELECT s.nom, s.rowid as socid, s.fk_stcomm, s.tms";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $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"; 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; $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->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; if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;

View File

@@ -65,7 +65,7 @@ class mailing_poire extends MailingTargets
$statssql[0].= " WHERE s.rowid = c.fk_soc"; $statssql[0].= " WHERE s.rowid = c.fk_soc";
$statssql[0].= " AND s.entity = ".$conf->entity; $statssql[0].= " AND s.entity = ".$conf->entity;
$statssql[0].= " AND c.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 != ''"; $statssql[0].= " AND c.email != ''";
return $statssql; return $statssql;

View File

@@ -720,7 +720,7 @@ class Livraison extends CommonObject
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe"; $sql.= " FROM ".MAIN_DB_PREFIX."societe";
$sql.= " WHERE client = 1"; $sql.= " WHERE client IN (1, 3)";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$sql.= " LIMIT 10"; $sql.= " LIMIT 10";

View File

@@ -113,7 +113,7 @@ if (($_GET["action"] == 'import' ) && ( $_GET["custid"] != '' ) && ($user->right
$societe->siren = ''; $societe->siren = '';
$societe->siret = ''; $societe->siret = '';
$societe->ape = ''; $societe->ape = '';
$societe->client = 1; // mettre 0 si prospect $societe->client = 1; // put 0 if prospect
} }
/* utilisation de la table de transco*/ /* utilisation de la table de transco*/

View File

@@ -130,29 +130,30 @@ if ($action == '' && !$cancel) {
$societe->tel = $osc_cust->osc_custtel; $societe->tel = $osc_cust->osc_custtel;
$societe->fax = $osc_cust->osc_custfax; $societe->fax = $osc_cust->osc_custfax;
$societe->email = $osc_cust->osc_custmail; $societe->email = $osc_cust->osc_custmail;
/* on force */ /* on force */
$societe->url = ''; $societe->url = '';
$societe->siren = ''; $societe->siren = '';
$societe->siret = ''; $societe->siret = '';
$societe->ape = ''; $societe->ape = '';
$societe->client = 1; // mettre 0 si prospect $societe->client = 1; // put 0 if prospect
$cl = $societe->create($user); $cl = $societe->create($user);
if ($cl == 0) if ($cl == 0)
{ {
$commande->socid = $societe->id; $commande->socid = $societe->id;
print '<p>cr<63>ation r<>ussie nouveau client/prospect : '.$societe->nom; print $langs->trans("CustomerCreated",$societe->nom);
$res = $osc_cust->transcode($osc_cust->osc_custid,$societe->id); $res = $osc_cust->transcode($osc_cust->osc_custid,$societe->id);
print ' : Id Dolibarr '.$societe->id.' , Id osc : '.$osc_cust->osc_custid.'</p>'; print ' : Id Dolibarr '.$societe->id.' , Id osc : '.$osc_cust->osc_custid.'</p>';
} }
else else
{ {
print '<p>cr<EFBFBD>ation impossible client : '. $osc_cust->osc_custid .'</p>'; print 'Failed to create customer : '. $osc_cust->osc_custid ;
exit; exit;
} }
} }
} }
// v<>rifier l'existence des produits command<6E>s
// verifier l'existence des produits commandes
$osc_product = new Osc_Product($db); $osc_product = new Osc_Product($db);
$err = 0; $err = 0;

View File

@@ -1874,7 +1874,7 @@ class Propal extends CommonObject
$socids = array(); $socids = array();
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe"; $sql.= " FROM ".MAIN_DB_PREFIX."societe";
$sql.= " WHERE client = 1"; $sql.= " WHERE client IN (1, 3)";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$sql.= " LIMIT 10"; $sql.= " LIMIT 10";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);

View File

@@ -19,21 +19,19 @@
*/ */
/** /**
\file htdocs/prospect.class.php * \file htdocs/prospect.class.php
\ingroup societe * \ingroup societe
\brief Fichier de la classe des prospects * \brief Fichier de la classe des prospects
\version $Id$ * \version $Id$
*/
/**
\class Prospect
\brief Classe permettant la gestion des prospects
*/ */
include_once(DOL_DOCUMENT_ROOT."/societe.class.php"); include_once(DOL_DOCUMENT_ROOT."/societe.class.php");
/**
* \class Prospect
* \brief Classe permettant la gestion des prospects
*/
class Prospect extends Societe class Prospect extends Societe
{ {
var $db; var $db;
@@ -57,7 +55,7 @@ class Prospect extends Societe
/** /**
* \brief Charge indicateurs this->nb de tableau de bord * \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() function load_state_board()
{ {
@@ -74,16 +72,17 @@ class Prospect extends Societe
$sql.= " WHERE sc.fk_user = " .$user->id; $sql.= " WHERE sc.fk_user = " .$user->id;
$clause = "AND"; $clause = "AND";
} }
$sql.= " ".$clause." s.client in (1,2)"; $sql.= " ".$clause." s.client in (1,2,3)";
$sql.= " AND s.entity = ".$conf->entity; $sql.= " AND s.entity = ".$conf->entity;
$sql.= " GROUP BY s.client"; $sql.= " GROUP BY s.client";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
if ($obj->client == 1) $this->nb["customers"]=$obj->nb; if ($obj->client == 1 || $obj->client == 3) $this->nb["customers"]+=$obj->nb;
if ($obj->client == 2) $this->nb["prospects"]=$obj->nb; if ($obj->client == 2 || $obj->client == 3) $this->nb["prospects"]+=$obj->nb;
} }
return 1; return 1;
} }

View File

@@ -420,7 +420,7 @@ $_GET["action"] == 'create' || $_POST["action"] == 'create')
// Prospect/Customer // Prospect/Customer
print '<tr><td width="25%">'.$langs->trans('ProspectCustomer').'</td><td width="25%"><select class="flat" name="client">'; print '<tr><td width="25%">'.$langs->trans('ProspectCustomer').'</td><td width="25%"><select class="flat" name="client">';
print '<option value="2"'.($soc->client==2?' selected="true"':'').'>'.$langs->trans('Prospect').'</option>'; print '<option value="2"'.($soc->client==2?' selected="true"':'').'>'.$langs->trans('Prospect').'</option>';
if ($conf->global->SOCIETE_PROSPECTANDCUSTOMER) print '<option value="3"'.($soc->client==3?' selected="true"':'').'>'.$langs->trans('ProspectCustomer').'</option>'; print '<option value="3"'.($soc->client==3?' selected="true"':'').'>'.$langs->trans('ProspectCustomer').'</option>';
print '<option value="1"'.($soc->client==1?' selected="true"':'').'>'.$langs->trans('Customer').'</option>'; print '<option value="1"'.($soc->client==1?' selected="true"':'').'>'.$langs->trans('Customer').'</option>';
print '<option value="0"'.($soc->client==0?' selected="true"':'').'>'.$langs->trans('NorProspectNorCustomer').'</option>'; print '<option value="0"'.($soc->client==0?' selected="true"':'').'>'.$langs->trans('NorProspectNorCustomer').'</option>';
print '</select></td>'; print '</select></td>';
@@ -751,7 +751,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
// Prospect/Customer // Prospect/Customer
print '<tr><td width="25%">'.$langs->trans('ProspectCustomer').'</td><td width="25%"><select class="flat" name="client">'; print '<tr><td width="25%">'.$langs->trans('ProspectCustomer').'</td><td width="25%"><select class="flat" name="client">';
print '<option value="2"'.($soc->client==2?' selected="true"':'').'>'.$langs->trans('Prospect').'</option>'; print '<option value="2"'.($soc->client==2?' selected="true"':'').'>'.$langs->trans('Prospect').'</option>';
if ($conf->global->SOCIETE_PROSPECTANDCUSTOMER) print '<option value="3"'.($soc->client==3?' selected="true"':'').'>'.$langs->trans('ProspectCustomer').'</option>'; print '<option value="3"'.($soc->client==3?' selected="true"':'').'>'.$langs->trans('ProspectCustomer').'</option>';
print '<option value="1"'.($soc->client==1?' selected="true"':'').'>'.$langs->trans('Customer').'</option>'; print '<option value="1"'.($soc->client==1?' selected="true"':'').'>'.$langs->trans('Customer').'</option>';
print '<option value="0"'.($soc->client==0?' selected="true"':'').'>'.$langs->trans('NorProspectNorCustomer').'</option>'; print '<option value="0"'.($soc->client==0?' selected="true"':'').'>'.$langs->trans('NorProspectNorCustomer').'</option>';
print '</select></td>'; print '</select></td>';

View File

@@ -998,12 +998,18 @@ class Societe extends CommonObject
{ {
if ($this->id) 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 = "UPDATE ".MAIN_DB_PREFIX."societe";
$sql.= " SET client = 1"; $sql.= " SET client = ".$newclient;
$sql.= " WHERE rowid = " . $this->id; $sql.= " WHERE rowid = " . $this->id;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) return 1; if ($resql)
{
$this->client = $newclient;
return 1;
}
else return -1; else return -1;
} }
return 0; return 0;