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 *****
For users:
- New: A customer can also be a prospect.
- New: task #9802 : Can link an action to a project.
- New: Initial sold can be conciliated.
- 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)
{
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 '<input type="hidden" name="catMere" value="-1">';
print '<input type="hidden" name="visible" value="1">';

View File

@@ -247,7 +247,7 @@ if ($user->rights->categorie->creer)
else
{
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 '<input type="hidden" name="catMere" 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;
$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";
@@ -106,8 +106,8 @@ class Client extends Societe
{
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;
}

View File

@@ -19,10 +19,10 @@
*/
/**
\file htdocs/comm/clients.php
\ingroup commercial, societe
\brief Liste des clients
\version $Id$
* \file htdocs/comm/clients.php
* \ingroup commercial, societe
* \brief List of customers
* \version $Id$
*/
require("./pre.inc.php");
@@ -60,7 +60,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st";
if (!$user->rights->societe->client->voir) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$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;
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;

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.= " 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 ($type == "c") $sql.= " AND s.client = 1";
if ($type == "p") $sql.= " AND s.client = 2";
if ($type == "c") $sql.= " AND s.client IN (1, 3)";
if ($type == "p") $sql.= " AND s.client IN (2, 3)";
if ($type == "f") $sql.= " AND s.fournisseur = 1";
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.= " FROM ".MAIN_DB_PREFIX."societe as s";
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;
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";
@@ -366,7 +366,9 @@ if ($conf->societe->enabled && $user->rights->societe->lire)
print '<table class="noborder" width="100%">';
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)
{
$company=new Societe($db);
@@ -379,8 +381,9 @@ if ($conf->societe->enabled && $user->rights->societe->lire)
print '<tr '.$bc[$var].'>';
print '<td nowrap="nowrap">'.$company->getNomUrl(1,'customer',48).'</td>';
print '<td align="right" nowrap>';
if ($objp->client == 1) print $langs->trans("Customer");
if ($objp->client == 2) print $langs->trans("Prospect");
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 "</td>";
print '<td align="right" nowrap>'.dol_print_date($db->jdate($objp->tms),'day')."</td>";
print '</tr>';

View File

@@ -19,11 +19,11 @@
*/
/**
\file htdocs/comm/prospect/index.php
\ingroup commercial
\brief Page accueil de la zone prospection
\version $Id$
*/
* \file htdocs/comm/prospect/index.php
* \ingroup commercial
* \brief Page accueil de la zone prospection
* \version $Id$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/agenda.lib.php");
@@ -39,7 +39,7 @@ if ($user->societe_id > 0)
/*
* Affichage zone prospect
* View
*/
llxHeader();
@@ -50,7 +50,7 @@ print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr><td valign="top" width="30%" class="notopnoleft">';
if ($conf->propal->enabled)
if ($conf->propal->enabled)
{
$var=false;
print '<table class="noborder" width="100%">';
@@ -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 '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("ProposalsOpened").'</td></tr>';
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$var=!$var;
print "<tr $bc[$var]><td><a href=\"../propal.php?propalid=".$obj->propalid."\">";
print img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'</a></td>';
print "<td><a href=\"fiche.php?id=".$obj->socid."\">".img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom."</a></td>\n";
print "<td align=\"right\">";
print dol_print_date($obj->dp,'day')."</td>\n";
@@ -247,7 +247,7 @@ if ( $db->query($sql) )
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("ProspectToContact").'</td></tr>';
while ($i < $num)
{
$obj = $db->fetch_object();
@@ -266,7 +266,7 @@ print '</td></tr>';
print '</table>';
$db->close();
llxFooter('$Date$ - $Revision$');
?>

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

View File

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

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.= " 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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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.= " 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;

View File

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

View File

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

View File

@@ -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*/

View File

@@ -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 '<div class="titre">Fiche commande OSC : '.$osc_order->osc_orderid.'</div><br>';
@@ -48,17 +48,17 @@ if ($action == '' && !$cancel) {
print '<tr></tr><td width="20%">M<>thode de paiement</td><td width="80%">'.$osc_order->osc_orderpaymet.'</td></tr>';
print "</table>";
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
// les articles
// les articles
for ($l=0;$l < sizeof($osc_order->osc_lines); $l++)
{
print '<tr><td>'.$osc_order->osc_lines[$l]["products_id"].'</td><td>'.$osc_prod->get_productid($osc_order->osc_lines[$l]["products_id"]).'</td><td>'.$osc_order->osc_lines[$l]["products_name"].'</td><td>'.convert_price($osc_order->osc_lines[$l]["products_price"]).'</td><td>'.$osc_order->osc_lines[$l]["quantity"].'</td></tr>';
}
}
print "</table>";
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print "\n<div class=\"tabsAction\">\n";
@@ -68,7 +68,7 @@ if ($action == '' && !$cancel) {
print '<a class="butAction" href="index.php">'.$langs->trans("Retour").'</a>';
print "\n</div><br>\n";
// seule action importer
}
else
{
@@ -87,7 +87,7 @@ if ($action == '' && !$cancel) {
print "\n</div><br>\n";
}
}
/* action Import cr<63>ation de l'objet commande de dolibarr
/* action Import cr<63>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<63>t<EFBFBD> est renseign<67>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 '<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);
print ' : Id Dolibarr '.$societe->id.' , Id osc : '.$osc_cust->osc_custid.'</p>';
}
else
{
print '<p>cr<EFBFBD>ation impossible client : '. $osc_cust->osc_custid .'</p>';
print 'Failed to create customer : '. $osc_cust->osc_custid ;
exit;
}
}
}
// v<>rifier l'existence des produits command<6E>s
// verifier l'existence des produits commandes
$osc_product = new Osc_Product($db);
$err = 0;
for ($lig = 0; $lig < sizeof($commande->lines); $lig++)
{
// print "<p>traitement de ".$commande->lines[$lig]->fk_product."</p>";
if (! $commande->lines[$lig]->fk_product)
if (! $commande->lines[$lig]->fk_product)
{
print "<p>Article non trouv<75> ".$commande->lines[$lig]->libelle." : ".$commande->lines[$lig]->desc."</p>";
$err ++;
}
}
}
if ($err > 0) {
print ("<p> Des produits de la commande sont inexistants</p>");
$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 '<br>Erreur update '.$id.'</br>';
}
@@ -212,7 +213,7 @@ if ($action == '' && !$cancel) {
print '<p><a class="butAction" href="index.php">'.$langs->trans("Retour").'</a></p>';
}
}
}
llxFooter('$Date$ - $Revision$');

View File

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

View File

@@ -2,7 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
*
*
* 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');
}

View File

@@ -420,7 +420,7 @@ $_GET["action"] == 'create' || $_POST["action"] == 'create')
// Prospect/Customer
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>';
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="0"'.($soc->client==0?' selected="true"':'').'>'.$langs->trans('NorProspectNorCustomer').'</option>';
print '</select></td>';
@@ -751,7 +751,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
// Prospect/Customer
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>';
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="0"'.($soc->client==0?' selected="true"':'').'>'.$langs->trans('NorProspectNorCustomer').'</option>';
print '</select></td>';

View File

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