forked from Wavyzz/dolibarr
New: A customer can also be a prospect.
This commit is contained in:
@@ -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.
|
||||||
|
|||||||
@@ -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">';
|
||||||
|
|||||||
@@ -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">';
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -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>';
|
||||||
|
|||||||
@@ -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();
|
||||||
@@ -50,7 +50,7 @@ print '<table border="0" width="100%" class="notopnoleftnoright">';
|
|||||||
|
|
||||||
print '<tr><td valign="top" width="30%" class="notopnoleft">';
|
print '<tr><td valign="top" width="30%" class="notopnoleft">';
|
||||||
|
|
||||||
if ($conf->propal->enabled)
|
if ($conf->propal->enabled)
|
||||||
{
|
{
|
||||||
$var=false;
|
$var=false;
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
@@ -67,14 +67,14 @@ if ($conf->propal->enabled)
|
|||||||
/*
|
/*
|
||||||
* Prospects par status
|
* Prospects par status
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$sql = "SELECT count(*) as cc, st.libelle, st.id";
|
$sql = "SELECT count(*) as cc, st.libelle, st.id";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$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";
|
||||||
@@ -184,7 +184,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
|
|||||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||||
$sql.= " ORDER BY p.rowid DESC";
|
$sql.= " ORDER BY p.rowid DESC";
|
||||||
$sql.= $db->plimit(5, 0);
|
$sql.= $db->plimit(5, 0);
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@@ -194,17 +194,17 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
|
|||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("ProposalsOpened").'</td></tr>';
|
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("ProposalsOpened").'</td></tr>';
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$var]><td><a href=\"../propal.php?propalid=".$obj->propalid."\">";
|
print "<tr $bc[$var]><td><a href=\"../propal.php?propalid=".$obj->propalid."\">";
|
||||||
print img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'</a></td>';
|
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><a href=\"fiche.php?id=".$obj->socid."\">".img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom."</a></td>\n";
|
||||||
print "<td align=\"right\">";
|
print "<td align=\"right\">";
|
||||||
print dol_print_date($obj->dp,'day')."</td>\n";
|
print dol_print_date($obj->dp,'day')."</td>\n";
|
||||||
@@ -247,7 +247,7 @@ if ( $db->query($sql) )
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("ProspectToContact").'</td></tr>';
|
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("ProspectToContact").'</td></tr>';
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object();
|
$obj = $db->fetch_object();
|
||||||
@@ -266,7 +266,7 @@ print '</td></tr>';
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
|
|
||||||
llxFooter('$Date$ - $Revision$');
|
llxFooter('$Date$ - $Revision$');
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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";
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -147,13 +147,13 @@ class Don extends CommonObject
|
|||||||
|
|
||||||
// Charge tableau des id de societe socids
|
// Charge tableau des id de societe socids
|
||||||
$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);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@@ -294,7 +294,7 @@ class Don extends CommonObject
|
|||||||
function create($user)
|
function create($user)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$this->date = $this->db->idate($this->date);
|
$this->date = $this->db->idate($this->date);
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."don (";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."don (";
|
||||||
@@ -573,7 +573,7 @@ class Don extends CommonObject
|
|||||||
function sum_donations($param)
|
function sum_donations($param)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$result=0;
|
$result=0;
|
||||||
|
|
||||||
$sql = "SELECT sum(amount) as total";
|
$sql = "SELECT sum(amount) as total";
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class Expedition extends CommonObject
|
|||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
$this->lignes = array();
|
$this->lignes = array();
|
||||||
$this->products = array();
|
$this->products = array();
|
||||||
|
|
||||||
// List of long language codes for status
|
// List of long language codes for status
|
||||||
$this->statuts[-1] = 'StatusSendingCanceled';
|
$this->statuts[-1] = 'StatusSendingCanceled';
|
||||||
$this->statuts[0] = 'StatusSendingDraft';
|
$this->statuts[0] = 'StatusSendingDraft';
|
||||||
@@ -131,7 +131,7 @@ class Expedition extends CommonObject
|
|||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."expedition";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."expedition";
|
||||||
$sql.= " SET ref = '(PROV".$this->id.")'";
|
$sql.= " SET ref = '(PROV".$this->id.")'";
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
dol_syslog("Expedition::create sql=".$sql, LOG_DEBUG);
|
dol_syslog("Expedition::create sql=".$sql, LOG_DEBUG);
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
@@ -143,7 +143,7 @@ class Expedition extends CommonObject
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error && $this->id && $this->origin_id)
|
if (! $error && $this->id && $this->origin_id)
|
||||||
{
|
{
|
||||||
$ret = $this->add_object_linked();
|
$ret = $this->add_object_linked();
|
||||||
@@ -151,7 +151,7 @@ class Expedition extends CommonObject
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->commande->enabled)
|
if ($conf->commande->enabled)
|
||||||
{
|
{
|
||||||
$ret = $this->setStatut(2,$this->origin_id,$this->origin);
|
$ret = $this->setStatut(2,$this->origin_id,$this->origin);
|
||||||
@@ -166,7 +166,7 @@ class Expedition extends CommonObject
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@@ -557,7 +557,7 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet";
|
||||||
$sql.= " WHERE fk_expedition = ".$this->id;
|
$sql.= " WHERE fk_expedition = ".$this->id;
|
||||||
|
|
||||||
if ( $this->db->query($sql) )
|
if ( $this->db->query($sql) )
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_element";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_element";
|
||||||
@@ -568,7 +568,7 @@ class Expedition extends CommonObject
|
|||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expedition";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expedition";
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
if ( $this->db->query($sql) )
|
if ( $this->db->query($sql) )
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@@ -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";
|
||||||
|
|
||||||
|
|||||||
@@ -977,7 +977,7 @@ class Facture extends CommonObject
|
|||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_element";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_element";
|
||||||
$sql.= " WHERE fk_target = ".$rowid;
|
$sql.= " WHERE fk_target = ".$rowid;
|
||||||
$sql.= " AND targettype = '".$this->element."'";
|
$sql.= " AND targettype = '".$this->element."'";
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
// On met a jour le lien des remises
|
// On met a jour le lien des remises
|
||||||
@@ -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";
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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";
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class Livraison extends CommonObject
|
|||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
$this->lignes = array();
|
$this->lignes = array();
|
||||||
$this->products = array();
|
$this->products = array();
|
||||||
|
|
||||||
// List of short language codes for status
|
// List of short language codes for status
|
||||||
$this->statuts[-1] = 'StatusSendingCanceled';
|
$this->statuts[-1] = 'StatusSendingCanceled';
|
||||||
$this->statuts[0] = 'StatusSendingDraft';
|
$this->statuts[0] = 'StatusSendingDraft';
|
||||||
@@ -160,7 +160,7 @@ class Livraison extends CommonObject
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $conf->expedition_bon->enabled)
|
if (! $conf->expedition_bon->enabled)
|
||||||
{
|
{
|
||||||
if ($conf->commande->enabled)
|
if ($conf->commande->enabled)
|
||||||
@@ -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";
|
||||||
|
|
||||||
|
|||||||
@@ -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*/
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
|
||||||
require_once("../includes/configure.php");
|
require_once("../includes/configure.php");
|
||||||
@@ -36,7 +36,7 @@ if ($action == '' && !$cancel) {
|
|||||||
$result = $osc_order->fetch($_GET["orderid"]);
|
$result = $osc_order->fetch($_GET["orderid"]);
|
||||||
|
|
||||||
if ( !$result)
|
if ( !$result)
|
||||||
{
|
{
|
||||||
$osc_prod = new Osc_Product($db);
|
$osc_prod = new Osc_Product($db);
|
||||||
print '<div class="titre">Fiche commande OSC : '.$osc_order->osc_orderid.'</div><br>';
|
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 '<tr></tr><td width="20%">M<>thode de paiement</td><td width="80%">'.$osc_order->osc_orderpaymet.'</td></tr>';
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
|
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
|
||||||
// les articles
|
// les articles
|
||||||
for ($l=0;$l < sizeof($osc_order->osc_lines); $l++)
|
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 '<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>";
|
print "</table>";
|
||||||
|
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* Barre d'action */
|
/* Barre d'action */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
print "\n<div class=\"tabsAction\">\n";
|
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 '<a class="butAction" href="index.php">'.$langs->trans("Retour").'</a>';
|
||||||
print "\n</div><br>\n";
|
print "\n</div><br>\n";
|
||||||
// seule action importer
|
// seule action importer
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -87,7 +87,7 @@ if ($action == '' && !$cancel) {
|
|||||||
print "\n</div><br>\n";
|
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)
|
if (($_GET["action"] == 'import' ) && ( $_GET["orderid"] != '' ) && $user->rights->commande->creer)
|
||||||
@@ -106,7 +106,7 @@ if ($action == '' && !$cancel) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// v<>rifier que la soci<63>t<EFBFBD> est renseign<67>e, sinon importer le client d'abord
|
// 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);
|
$osc_cust = new Osc_customer($db, $osc_order->osc_custid);
|
||||||
$result = $osc_cust->fetch($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->ville = $osc_cust->osc_custcity;
|
||||||
$societe->departement_id = 0;
|
$societe->departement_id = 0;
|
||||||
$societe->pays_code = $osc_cust->osc_custcodecountry;
|
$societe->pays_code = $osc_cust->osc_custcodecountry;
|
||||||
$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;
|
||||||
|
|
||||||
for ($lig = 0; $lig < sizeof($commande->lines); $lig++)
|
for ($lig = 0; $lig < sizeof($commande->lines); $lig++)
|
||||||
{
|
{
|
||||||
// print "<p>traitement de ".$commande->lines[$lig]->fk_product."</p>";
|
// 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>";
|
print "<p>Article non trouv<75> ".$commande->lines[$lig]->libelle." : ".$commande->lines[$lig]->desc."</p>";
|
||||||
$err ++;
|
$err ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($err > 0) {
|
if ($err > 0) {
|
||||||
print ("<p> Des produits de la commande sont inexistants</p>");
|
print ("<p> Des produits de la commande sont inexistants</p>");
|
||||||
$id =-9;
|
$id =-9;
|
||||||
@@ -201,9 +202,9 @@ if ($action == '' && !$cancel) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$id = $societe_control->fetch($ref = $osc_order->osc_ref);
|
$id = $societe_control->fetch($ref = $osc_order->osc_ref);
|
||||||
|
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
$id = $societe->update($id, $user);
|
$id = $societe->update($id, $user);
|
||||||
if ($id < 0) print '<br>Erreur update '.$id.'</br>';
|
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>';
|
print '<p><a class="butAction" href="index.php">'.$langs->trans("Retour").'</a></p>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
llxFooter('$Date$ - $Revision$');
|
llxFooter('$Date$ - $Revision$');
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
@@ -19,26 +19,24 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\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;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur de la classe
|
* \brief Constructeur de la classe
|
||||||
* \param DB handler acces base de donnees
|
* \param DB handler acces base de donnees
|
||||||
@@ -47,22 +45,22 @@ class Prospect extends Societe
|
|||||||
function Prospect($DB, $id=0)
|
function Prospect($DB, $id=0)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \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()
|
||||||
{
|
{
|
||||||
global $conf, $user;
|
global $conf, $user;
|
||||||
|
|
||||||
$this->nb=array("customers" => 0,"prospects" => 0);
|
$this->nb=array("customers" => 0,"prospects" => 0);
|
||||||
$clause = "WHERE";
|
$clause = "WHERE";
|
||||||
|
|
||||||
@@ -74,20 +72,21 @@ 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;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
@@ -95,7 +94,7 @@ class Prospect extends Societe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return status of prospect
|
* \brief Return status of prospect
|
||||||
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
|
* \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);
|
return $this->LibLevel($this->fk_prospectlevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoi le libelle du niveau
|
* \brief Renvoi le libelle du niveau
|
||||||
* \param fk_prospectlevel Prospect level
|
* \param fk_prospectlevel Prospect level
|
||||||
@@ -165,7 +164,7 @@ class Prospect extends Societe
|
|||||||
|
|
||||||
$lib=$langs->trans("ProspectLevel".$fk_prospectlevel);
|
$lib=$langs->trans("ProspectLevel".$fk_prospectlevel);
|
||||||
// If lib not found in language file, we get label from cache/databse
|
// 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');
|
$lib=$langs->getLabelFromKey($this->db,$fk_prospectlevel,'c_prospectlevel','code','label');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>';
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user