diff --git a/ChangeLog b/ChangeLog index 33bcba2d4f4..bd883f70196 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 0fbd9b93112..396c1e81681 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -152,7 +152,7 @@ print ''; if ($_GET['type'] == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER && !$categorie->id_mere) { print ''.$langs->trans ("AssignedToCustomer").''; - 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 ''; print ''; print ''; diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index f8046b3d0b4..6df86f1c8f3 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -247,7 +247,7 @@ if ($user->rights->categorie->creer) else { print ''.$langs->trans ("AssignedToCustomer").''; - 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 ''; print ''; print ''; diff --git a/htdocs/client.class.php b/htdocs/client.class.php index 60833ade683..d685799025e 100644 --- a/htdocs/client.class.php +++ b/htdocs/client.class.php @@ -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; } diff --git a/htdocs/comm/clients.php b/htdocs/comm/clients.php index 5ee074c63ea..79177505b38 100644 --- a/htdocs/comm/clients.php +++ b/htdocs/comm/clients.php @@ -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; diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index dfa257bc2d7..a744cd46157 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -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; diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 64e0b9883f5..d0dcfa947ed 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -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 ''; print ''; - print ''; + print ''; + print ''; + print ''; if ($num) { $company=new Societe($db); @@ -379,8 +381,9 @@ if ($conf->societe->enabled && $user->rights->societe->lire) print ''; print ''; print '"; print '"; print ''; diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index cb1934d7607..4e27b0e54cf 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -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 '
'.$langs->trans("BoxTitleLastCustomersOrProspects",$max).'
'.$langs->trans("BoxTitleLastCustomersOrProspects",$max).''.$langs->trans("DateModificationShort").'
'.$company->getNomUrl(1,'customer',48).''; - 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 "'.dol_print_date($db->jdate($objp->tms),'day')."
'; print ''; print "
'; -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 ''; - + while ($i < $num) { $obj = $db->fetch_object($resql); $var=!$var; print "'; - + print "\n"; print "\n"; @@ -247,7 +247,7 @@ if ( $db->query($sql) ) print '
'.$langs->trans("ProposalsOpened").'
propalid."\">"; print img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'socid."\">".img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.""; print dol_print_date($obj->dp,'day')."
'; print ''; - + while ($i < $num) { $obj = $db->fetch_object(); @@ -266,7 +266,7 @@ print ''; print '
'.$langs->trans("ProspectToContact").'
'; $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 ''; - // les articles + // les articles for ($l=0;$l < sizeof($osc_order->osc_lines); $l++) { print ''; - } + } 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"].'
"; /* ************************************************************************** */ - /* */ - /* Barre d'action */ - /* */ + /* */ + /* Barre d'action */ + /* */ /* ************************************************************************** */ print "\n
\n"; @@ -68,7 +68,7 @@ if ($action == '' && !$cancel) { print ''.$langs->trans("Retour").''; 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').''; @@ -751,7 +751,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit') // Prospect/Customer print ''.$langs->trans('ProspectCustomer').''; 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;