2
0
forked from Wavyzz/dolibarr

NEW Can edit list of prospect status for customers/prospects. Add a new

entry into dictionary table to manage list fo status.
Removed deprecated files.
This commit is contained in:
Laurent Destailleur
2015-05-06 23:13:07 +02:00
parent e6e263d13f
commit 3a8cf17f3c
52 changed files with 182 additions and 287 deletions

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
@@ -70,7 +70,7 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
$taborder=array(9,0,4,3,2,0,1,8,19,16,0,5,11,0,6,0,10,23,12,13,0,14,0,7,17,0,22,20,18,21,0,15,0,24,0,25,0,26);
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,6,0,10,23,12,13,0,14,0,7,17,0,22,20,18,21,0,15,0,24,0,25,0,26);
// Name of SQL tables of dictionaries
$tabname=array();
@@ -100,6 +100,7 @@ $tabname[23]= MAIN_DB_PREFIX."c_revenuestamp";
$tabname[24]= MAIN_DB_PREFIX."c_type_resource";
$tabname[25]= MAIN_DB_PREFIX."c_email_templates";
$tabname[26]= MAIN_DB_PREFIX."c_units";
$tabname[27]= MAIN_DB_PREFIX."c_stcomm";
// Dictionary labels
$tablib=array();
@@ -128,7 +129,8 @@ $tablib[22]= "DictionarySource";
$tablib[23]= "DictionaryRevenueStamp";
$tablib[24]= "DictionaryResourceType";
$tablib[25]= "DictionaryEMailTemplates";
$tablib[26]= "DictionnaryUnits";
$tablib[26]= "DictionaryUnits";
$tablib[27]= "DictionaryProspectStatus";
// Requests to extract data
$tabsql=array();
@@ -154,10 +156,11 @@ $tabsql[19]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREF
$tabsql[20]= "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_input_method";
$tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_availability AS c";
$tabsql[22]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
$tabsql[23]= "SELECT t.rowid, t.taux, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
$tabsql[23]= "SELECT t.rowid as rowid, t.taux, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
$tabsql[24]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content, active FROM ".MAIN_DB_PREFIX."c_email_templates";
$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
$tabsql[27]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_stcomm";
// Criteria to sort dictionaries
$tabsqlsort=array();
@@ -187,6 +190,7 @@ $tabsqlsort[23]="country ASC, taux ASC";
$tabsqlsort[24]="code ASC,label ASC";
$tabsqlsort[25]="label ASC";
$tabsqlsort[26]="code ASC";
$tabsqlsort[27]="code ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
@@ -216,6 +220,7 @@ $tabfield[23]= "country_id,country,taux,accountancy_code_sell,accountancy_code_b
$tabfield[24]= "code,label";
$tabfield[25]= "label,type_template,private,position,topic,content";
$tabfield[26]= "code,label,short_label";
$tabfield[27]= "code,libelle";
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
@@ -245,6 +250,7 @@ $tabfieldvalue[23]= "country,taux,accountancy_code_sell,accountancy_code_buy,not
$tabfieldvalue[24]= "code,label";
$tabfieldvalue[25]= "label,type_template,private,position,topic,content";
$tabfieldvalue[26]= "code,label,short_label";
$tabfieldvalue[27]= "code,libelle";
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
@@ -274,6 +280,7 @@ $tabfieldinsert[23]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,no
$tabfieldinsert[24]= "code,label";
$tabfieldinsert[25]= "label,type_template,private,position,topic,content";
$tabfieldinsert[26]= "code,label,short_label";
$tabfieldinsert[27]= "code,libelle";
// Nom du rowid si le champ n'est pas de type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on
@@ -305,6 +312,7 @@ $tabrowid[23]= "";
$tabrowid[24]= "";
$tabrowid[25]= "";
$tabrowid[26]= "";
$tabrowid[27]= "id";
// Condition to show dictionary in setup page
$tabcond=array();
@@ -333,7 +341,8 @@ $tabcond[22]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabl
$tabcond[23]= true;
$tabcond[24]= ! empty($conf->resource->enabled);
$tabcond[25]= true; // && ! empty($conf->global->MAIN_EMAIL_EDIT_TEMPLATE_FROM_DIC);
$tabcond[26]= $conf->product->enabled;
$tabcond[26]= ! empty($conf->product->enabled);
$tabcond[27]= ! empty($conf->societe->enabled);
// List of help for fields
$tabhelp=array();
@@ -362,6 +371,8 @@ $tabhelp[22] = array();
$tabhelp[23] = array();
$tabhelp[24] = array();
$tabhelp[25] = array();
$tabhelp[26] = array();
$tabhelp[27] = array();
// List of check for fields (NOT USED YET)
$tabfieldcheck=array();
@@ -390,6 +401,8 @@ $tabfieldcheck[22] = array();
$tabfieldcheck[23] = array();
$tabfieldcheck[24] = array();
$tabfieldcheck[25] = array();
$tabfieldcheck[26] = array();
$tabfieldcheck[27] = array();
// Complete all arrays with entries found into modules
complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck);
@@ -1017,7 +1030,8 @@ if ($id)
if ($id == 4) print getTitleFieldOfList($langs->trans("Favorite"),0,$_SERVER["PHP_SELF"],"favorite",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"active",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
print '<td colspan="3" class="liste_titre">&nbsp;</td>';
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print '</tr>';
// Lines with values

View File

@@ -97,15 +97,13 @@ if (empty($reshook))
$action="";
}
// set accountancy code
if ($action == 'setcustomeraccountancycode')
{
$result=$object->fetch($id);
$object->code_compta=$_POST["customeraccountancycode"];
$result=$object->update($object->id,$user,1,1,0);
if ($result < 0)
{
setEventMessage($object->errors, 'errors');
}
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
}
// conditions de reglement
@@ -113,7 +111,7 @@ if (empty($reshook))
{
$object->fetch($id);
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
if ($result < 0) dol_print_error($db,$object->error);
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
}
// mode de reglement
@@ -121,7 +119,7 @@ if (empty($reshook))
{
$object->fetch($id);
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
if ($result < 0) dol_print_error($db,$object->error);
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
}
// assujetissement a la TVA
@@ -130,7 +128,7 @@ if (empty($reshook))
$object->fetch($id);
$object->tva_assuj=$_POST['assujtva_value'];
$result=$object->update($object->id);
if ($result < 0) dol_print_error($db,$object->error);
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
}
// set prospect level
@@ -139,16 +137,16 @@ if (empty($reshook))
$object->fetch($id);
$object->fk_prospectlevel=GETPOST('prospect_level_id','alpha');
$result=$object->set_prospect_level($user);
if ($result < 0) setEventMessage($object->error,'errors');
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
}
// update prospect level
if ($action == 'cstc')
if ($action == 'setstcomm')
{
$object->fetch($id);
$object->stcomm_id=GETPOST('stcomm','int');
$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
$result=$object->set_commnucation_level($user);
if ($result < 0) setEventMessage($object->error,'errors');
if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
}
// update outstandng limit
@@ -157,7 +155,7 @@ if (empty($reshook))
$object->fetch($id);
$object->outstanding_limit=GETPOST('outstanding_limit');
$result=$object->set_OutstandingBill($user);
if ($result < 0) setEventMessage($object->error,'errors');
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
}
}
@@ -407,7 +405,8 @@ if ($id > 0)
print $form->editfieldval("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer,$limit_field_type,($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
// display amount and link to unpaid bill
$outstandingBills = $object->get_OutstandingBill();
if ($outstandingBills != 0) {
if ($outstandingBills != 0)
{
print ' ('.$langs->trans("CurrentOutstandingBill");
print ' <a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'&search_status=1">';
print price($outstandingBills, '', $langs, 0, -1, -1, $conf->currency);
@@ -457,14 +456,16 @@ if ($id > 0)
print '</tr>';
// Status
print '<tr><td>'.$langs->trans("StatusProsp").'</td><td colspan="2">'.$object->getLibProspCommStatut(4).'</td>';
print '<td>';
if ($object->stcomm_id != -1) print '<a href="card.php?socid='.$object->id.'&amp;stcomm=-1&amp;action=cstc">'.img_action(0,-1).'</a>';
if ($object->stcomm_id != 0) print '<a href="card.php?socid='.$object->id.'&amp;stcomm=0&amp;action=cstc">'.img_action(0,0).'</a>';
if ($object->stcomm_id != 1) print '<a href="card.php?socid='.$object->id.'&amp;stcomm=1&amp;action=cstc">'.img_action(0,1).'</a>';
if ($object->stcomm_id != 2) print '<a href="card.php?socid='.$object->id.'&amp;stcomm=2&amp;action=cstc">'.img_action(0,2).'</a>';
if ($object->stcomm_id != 3) print '<a href="card.php?socid='.$object->id.'&amp;stcomm=3&amp;action=cstc">'.img_action(0,3).'</a>';
print '</td></tr>';
$object->loadCacheOfProspStatus();
print '<tr><td>'.$langs->trans("StatusProsp").'</td><td colspan="3">'.$object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']);
print ' &nbsp; &nbsp; <div class="floatright">';
foreach($object->cacheprospectstatus as $key => $val)
{
$titlealt='default';
if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label'];
if ($object->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&stcomm='.$val['code'].'&action=setstcomm">'.img_action($titlealt,$val['code']).'</a>';
}
print '</div></td></tr>';
}
// Other attributes

View File

@@ -1,172 +0,0 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/comm/prospect/class/prospect.class.php
* \ingroup societe
* \brief Fichier de la classe des prospects
*/
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
/**
* Class to manage prospects
*/
class Prospect extends Societe
{
var $db;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
return 0;
}
/**
* Charge indicateurs this->nb de tableau de bord
*
* @return int <0 if KO, >0 if OK
*/
function load_state_board()
{
global $user;
$this->nb=array("customers" => 0,"prospects" => 0);
$clause = "WHERE";
$sql = "SELECT count(s.rowid) as nb, s.client";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$user->societe_id)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
$clause = "AND";
}
$sql.= " ".$clause." s.client IN (1,2,3)";
$sql.= " AND s.entity IN (".getEntity($this->element, 1).")";
$sql.= " GROUP BY s.client";
$resql=$this->db->query($sql);
if ($resql)
{
while ($obj=$this->db->fetch_object($resql))
{
if ($obj->client == 1 || $obj->client == 3) $this->nb["customers"]+=$obj->nb;
if ($obj->client == 2 || $obj->client == 3) $this->nb["prospects"]+=$obj->nb;
}
$this->db->free($resql);
return 1;
}
else
{
dol_print_error($this->db);
$this->error=$this->db->error();
return -1;
}
}
/**
* Return status of prospect
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Libelle
*/
function getLibProspStatut($mode=0)
{
return $this->LibProspStatut($this->stcomm_id,$mode);
}
/**
* Return label of a given status
*
* @param int $statut Id statut
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle du statut
*/
function LibProspStatut($statut,$mode=0)
{
global $langs;
$langs->load('customers');
if ($mode == 2)
{
if ($statut == -1) return img_action($langs->trans("StatusProspect-1"),-1).' '.$langs->trans("StatusProspect-1");
if ($statut == 0) return img_action($langs->trans("StatusProspect0"), 0).' '.$langs->trans("StatusProspect0");
if ($statut == 1) return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1");
if ($statut == 2) return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2");
if ($statut == 3) return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3");
}
if ($mode == 3)
{
if ($statut == -1) return img_action($langs->trans("StatusProspect-1"),-1);
if ($statut == 0) return img_action($langs->trans("StatusProspect0"), 0);
if ($statut == 1) return img_action($langs->trans("StatusProspect1"), 1);
if ($statut == 2) return img_action($langs->trans("StatusProspect2"), 2);
if ($statut == 3) return img_action($langs->trans("StatusProspect3"), 3);
}
if ($mode == 4)
{
if ($statut == -1) return img_action($langs->trans("StatusProspect-1"),-1).' '.$langs->trans("StatusProspect-1");
if ($statut == 0) return img_action($langs->trans("StatusProspect0"), 0).' '.$langs->trans("StatusProspect0");
if ($statut == 1) return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1");
if ($statut == 2) return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2");
if ($statut == 3) return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3");
}
return "Error, mode/status not found";
}
/**
* Renvoi le libelle du niveau
*
* @return string Libelle
*/
function getLibProspLevel()
{
return $this->LibProspLevel($this->fk_prospectlevel);
}
/**
* Renvoi le libelle du niveau
*
* @param int $fk_prospectlevel Prospect level
* @return string Libelle du niveau
*/
function LibProspLevel($fk_prospectlevel)
{
global $langs;
$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))
{
$lib=$langs->getLabelFromKey($this->db,$fk_prospectlevel,'c_prospectlevel','code','label');
}
return $lib;
}
}

View File

@@ -1,11 +1,11 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
@@ -28,7 +28,7 @@
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/prospect/class/prospect.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$langs->load("propal");
@@ -41,7 +41,8 @@ $result = restrictedArea($user, 'societe',$socid,'');
$action = GETPOST('action','alpha');
$socname = GETPOST("socname",'alpha');
$stcomm = GETPOST("stcomm",'int');
$stcomm = GETPOST("stcomm",'alpha'); // code
$search_stcomm = GETPOST("search_stcomm",'int');
$search_nom = GETPOST("search_nom");
$search_zipcode = GETPOST("search_zipcode");
$search_town = GETPOST("search_town");
@@ -159,6 +160,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
{
$socname="";
$stcomm="";
$search_stcomm="";
$search_nom="";
$search_zipcode="";
$search_town="";
@@ -170,6 +172,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
if ($search_status=='') $search_status=1; // always display active customer first
/*
* Actions
*/
@@ -178,12 +182,17 @@ $parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) {
if ($action == 'cstc')
if (empty($reshook))
{
if ($action == 'setstcomm')
{
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$_GET["pstcomm"];
$sql .= " WHERE rowid = ".$_GET["socid"];
$result=$db->query($sql);
$object = new Client($db);
$result=$object->fetch($socid);
$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
$result=$object->set_commnucation_level($user);
if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
$action=''; $socid=0;
}
}
@@ -195,8 +204,9 @@ if (empty($reshook)) {
$formother=new FormOther($db);
$form=new Form($db);
$sql = "SELECT s.rowid, s.nom as name, s.zip, s.town, s.datec, s.status as status, s.code_client, s.client,";
$sql.= " st.libelle as stcomm, s.prefix_comm, s.fk_stcomm, s.fk_prospectlevel,";
$sql = "SELECT s.rowid as socid, s.nom as name, s.zip, s.town, s.datec, s.status as status, s.code_client, s.client,";
$sql.= " s.prefix_comm, s.fk_prospectlevel, s.fk_stcomm as stcomm_id,";
$sql.= " st.libelle as stcomm_label,";
$sql.= " d.nom as departement";
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
$sql .= " FROM ".MAIN_DB_PREFIX."c_stcomm as st";
@@ -209,7 +219,7 @@ $sql.= " AND s.client IN (2, 3)";
$sql.= ' AND s.entity IN ('.getEntity('societe', 1).')';
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc";
if ($socid) $sql.= " AND s.rowid = " .$socid;
if (isset($stcomm) && $stcomm != '') $sql.= " AND s.fk_stcomm=".$stcomm;
if ($search_stcomm != '') $sql.= " AND s.fk_stcomm=".$search_stcomm;
if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
@@ -260,7 +270,7 @@ if ($resql)
if ($num == 1 && $socname)
{
$obj = $db->fetch_object($resql);
header("Location: card.php?socid=".$obj->rowid);
header("Location: card.php?socid=".$obj->socid);
exit;
}
else
@@ -269,23 +279,23 @@ if ($resql)
llxHeader('',$langs->trans("ThirdParty"),$help_url);
}
$param='&amp;stcomm='.$stcomm.'&amp;search_nom='.urlencode($search_nom).'&amp;search_zipcode='.urlencode($search_zipcode).'&amp;search_town='.urlencode($search_town);
$param='&search_stcomm='.$search_stcomm.'&search_nom='.urlencode($search_nom).'&search_zipcode='.urlencode($search_zipcode).'&search_town='.urlencode($search_town);
// Store the status filter in the URL
if (isSet($search_cstc))
if (isSet($search_setstcomm))
{
foreach ($search_cstc as $key => $value)
foreach ($search_setstcomm as $key => $value)
{
if ($value == 'true')
$param.='&amp;search_cstc['.((int) $key).']=true';
$param.='&search_setstcomm['.((int) $key).']=true';
else
$param.='&amp;search_cstc['.((int) $key).']=false';
$param.='&search_setstcomm['.((int) $key).']=false';
}
}
if ($search_level_from != '') $param.='&amp;search_level_from='.$search_level_from;
if ($search_level_to != '') $param.='&amp;search_level_to='.$search_level_to;
if ($search_categ != '') $param.='&amp;search_categ='.$search_categ;
if ($search_sale > 0) $param.='&amp;search_sale='.$search_sale;
if ($search_status != '') $param.='&amp;search_status='.$search_status;
if ($search_level_from != '') $param.='&search_level_from='.$search_level_from;
if ($search_level_to != '') $param.='&search_level_to='.$search_level_to;
if ($search_categ != '') $param.='&search_categ='.$search_categ;
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
if ($search_status != '') $param.='&search_status='.$search_status;
// $param and $urladd should have the same value
$urladd = $param;
@@ -326,9 +336,9 @@ if ($resql)
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ProspectLevelShort"),$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("StatusProsp"),$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder);
print '<td class="liste_titre">&nbsp;</td>';
print_liste_field_titre('');
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
print '<td class="liste_titre">&nbsp;</td>';
print_liste_field_titre('');
$parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
@@ -408,8 +418,9 @@ if ($resql)
$i = 0;
$var=true;
$prospectstatic=new Prospect($db);
$prospectstatic=new Client($db);
$prospectstatic->client=2;
$prospectstatic->loadCacheOfProspStatus();
while ($i < min($num,$conf->liste_limit))
{
@@ -419,7 +430,7 @@ if ($resql)
print '<tr '.$bc[$var].'>';
print '<td>';
$prospectstatic->id=$obj->rowid;
$prospectstatic->id=$obj->socid;
$prospectstatic->name=$obj->name;
$prospectstatic->status=$obj->status;
$prospectstatic->code_client=$obj->code_client;
@@ -427,8 +438,8 @@ if ($resql)
$prospectstatic->fk_prospectlevel=$obj->fk_prospectlevel;
print $prospectstatic->getNomUrl(1,'prospect');
print '</td>';
print "<td>".$obj->zip."&nbsp;</td>";
print "<td>".$obj->town."&nbsp;</td>";
print "<td>".$obj->zip."</td>";
print "<td>".$obj->town."</td>";
print '<td align="center">'.$obj->departement.'</td>';
// Creation date
print '<td align="center">'.dol_print_date($db->jdate($obj->datec)).'</td>';
@@ -438,19 +449,15 @@ if ($resql)
print "</td>";
// Statut
print '<td align="center" class="nowrap">';
print $prospectstatic->LibProspStatut($obj->fk_stcomm,2);
print $prospectstatic->LibProspCommStatut($obj->stcomm_id,2,$prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']);
print "</td>";
//$sts = array(-1,0,1,2,3);
print '<td align="right" class="nowrap">';
foreach ($sts as $key => $value)
foreach($prospectstatic->cacheprospectstatus as $key => $val)
{
if ($value <> $obj->fk_stcomm)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?socid='.$obj->rowid.'&amp;pstcomm='.$value.'&amp;action=cstc&amp;'.$param.($page?'&amp;page='.$page:'').'">';
print img_action(0,$value);
print '</a>&nbsp;';
}
$titlealt='default';
if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label'];
if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?socid='.$obj->socid.'&stcomm='.$val['code'].'&action=setstcomm'.$param.($page?'&page='.urlencode($page):'').'">'.img_action($titlealt,$val['code']).'</a>';
}
print '</td>';

View File

@@ -26,7 +26,7 @@
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
include_once DOL_DOCUMENT_ROOT.'/comm/prospect/class/prospect.class.php';
include_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
/**
@@ -74,8 +74,7 @@ class box_prospect extends ModeleBoxes
$this->max=$max;
include_once DOL_DOCUMENT_ROOT.'/comm/prospect/class/prospect.class.php';
$thirdpartystatic=new Prospect($db);
$thirdpartystatic=new Client($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedProspects",$max));
@@ -130,7 +129,7 @@ class box_prospect extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => str_replace('img ','img height="14" ',$thirdpartystatic->LibProspStatut($objp->fk_stcomm,3)),
'text' => str_replace('img ','img height="14" ',$thirdpartystatic->LibProspCommStatut($objp->fk_stcomm,3)),
);
$this->info_box_contents[$line][] = array(

View File

@@ -614,10 +614,10 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
if (! empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create))
{
$colspan++;
print '<td>&nbsp;</td>';
print_liste_field_titre('');
}
// Edit
print '<td>&nbsp;</td>';
print_liste_field_titre('');
print "</tr>";

View File

@@ -2046,22 +2046,24 @@ function img_picto_common($titlealt, $picto, $options = '', $pictoisfullpath = 0
/**
* Show logo action
*
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param int $numaction Action to show
* @return string Return an img tag
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param string $numaction Action id or code to show
* @return string Return an img tag
*/
function img_action($titlealt, $numaction)
{
global $conf, $langs;
if ($titlealt == 'default')
if (empty($titlealt) || $titlealt == 'default')
{
if ($numaction == -1) $titlealt = $langs->transnoentitiesnoconv('ChangeDoNotContact');
if ($numaction == 0) $titlealt = $langs->transnoentitiesnoconv('ChangeNeverContacted');
if ($numaction == 1) $titlealt = $langs->transnoentitiesnoconv('ChangeToContact');
if ($numaction == 2) $titlealt = $langs->transnoentitiesnoconv('ChangeContactInProcess');
if ($numaction == 3) $titlealt = $langs->transnoentitiesnoconv('ChangeContactDone');
if ($numaction == '-1' || $numaction == 'ST_NO') { $numaction = -1; $titlealt = $langs->transnoentitiesnoconv('ChangeDoNotContact'); }
elseif ($numaction == '0' || $numaction == 'ST_NEVER') { $numaction = 0; $titlealt = $langs->transnoentitiesnoconv('ChangeNeverContacted'); }
elseif ($numaction == '1' || $numaction == 'ST_TODO') { $numaction = 1; $titlealt = $langs->transnoentitiesnoconv('ChangeToContact'); }
elseif ($numaction == '2' || $numaction == 'ST_PEND') { $numaction = 2; $titlealt = $langs->transnoentitiesnoconv('ChangeContactInProcess'); }
elseif ($numaction == '3' || $numaction == 'ST_DONE') { $numaction = 3; $titlealt = $langs->transnoentitiesnoconv('ChangeContactDone'); }
else { $titlealt = $langs->transnoentitiesnoconv('ChangeStatus '.$numaction); $numaction = 0; }
}
if (! is_numeric($numaction)) $numaction=0;
return img_picto($titlealt, 'stcomm'.$numaction.'.png');
}

View File

@@ -161,7 +161,7 @@ if (empty($user->societe_id))
! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire);
// Class file containing the method load_state_board for each line
$includes=array(DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
DOL_DOCUMENT_ROOT."/comm/prospect/class/prospect.class.php",
DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php",
DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php",
DOL_DOCUMENT_ROOT."/product/class/product.class.php",
@@ -174,7 +174,7 @@ if (empty($user->societe_id))
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php");
// Name class containing the method load_state_board for each line
$classes=array('Client',
'Prospect',
'Client',
'Fournisseur',
'Adherent',
'Product',

View File

@@ -817,6 +817,8 @@ DictionarySource=Origin of proposals/orders
DictionaryAccountancyplan=Chart of accounts
DictionaryAccountancysystem=Models for chart of accounts
DictionaryEMailTemplates=Emails templates
DictionaryUnits=Units
DictionaryProspectStatus=Prospection status
SetupSaved=Setup saved
BackToModuleList=Back to modules list
BackToDictionaryList=Back to dictionaries list

View File

@@ -189,7 +189,6 @@ CustomCode=Customs code
CountryOrigin=Origin country
HiddenIntoCombo=Hidden into select lists
Nature=Nature
DictionnaryUnits=Units
ShortLabel=Short label
Unit=Unit
p=u.

View File

@@ -25,15 +25,17 @@ include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
/**
* Class to manage customers
* Class to manage customers or prospects
*/
class Client extends Societe
{
var $db;
var $next_prev_filter="te.client in (1,2,3)"; // Used to add a filter in Form::showrefnav method
var $cacheprospectstatus=array();
/**
* Constructor
*
@@ -51,7 +53,7 @@ class Client extends Societe
*/
function load_state_board()
{
global $conf, $user;
global $user;
$this->nb=array("customers" => 0,"prospects" => 0);
$clause = "WHERE";
@@ -82,10 +84,34 @@ class Client extends Societe
else
{
dol_print_error($this->db);
$this->error=$this->db->error();
$this->error=$this->db->lasterror();
return -1;
}
}
/**
* Load array of prospect status
*
* @param int $active 1=Active only, 0=Not active only, -1=All
* @return int <0 if KO, >0 if OK
*/
function loadCacheOfProspStatus($active=1)
{
global $langs;
$sql="SELECT id, code, libelle as label FROM ".MAIN_DB_PREFIX."c_stcomm";
if ($active >= 0) $sql.=" WHERE active = ".$active;
$resql=$this->db->query($sql);
$num=$this->db->num_rows($resql);
$i=0;
while ($i < $num)
{
$obj=$this->db->fetch_object($resql);
$this->cacheprospectstatus[$obj->id]=array('id'=>$obj->id, 'code'=>$obj->code, 'label'=> $langs->trans("aaa")?$obj->label:'');
$i++;
}
return 1;
}
}

View File

@@ -3084,48 +3084,62 @@ class Societe extends CommonObject
* Return status of prospect
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @param string $label Label to use for status for added status
* @return string Libelle
*/
function getLibProspCommStatut($mode=0)
function getLibProspCommStatut($mode=0, $label='')
{
return $this->LibProspCommStatut($this->stcomm_id,$mode);
return $this->LibProspCommStatut($this->stcomm_id, $mode, $label);
}
/**
* Return label of a given status
*
* @param int $statut Id statut
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle du statut
* @param int|string $statut Id or code for prospection status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @param string $label Label to use for status for added status
* @return string Libelle du statut
*/
function LibProspCommStatut($statut,$mode=0)
function LibProspCommStatut($statut, $mode=0, $label='')
{
global $langs;
$langs->load('customers');
if ($mode == 2)
{
if ($statut == -1) return img_action($langs->trans("StatusProspect-1"),-1).' '.$langs->trans("StatusProspect-1");
if ($statut == 0) return img_action($langs->trans("StatusProspect0"), 0).' '.$langs->trans("StatusProspect0");
if ($statut == 1) return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1");
if ($statut == 2) return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2");
if ($statut == 3) return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3");
if ($statut == '-1' || $statut == 'ST_NO') return img_action($langs->trans("StatusProspect-1"),-1).' '.$langs->trans("StatusProspect-1");
elseif ($statut == '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0).' '.$langs->trans("StatusProspect0");
elseif ($statut == '1' || $statut == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1");
elseif ($statut == '2' || $statut == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2");
elseif ($statut == '3' || $statut == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3");
else
{
return img_action(($langs->trans("StatusProspect".$statut) != "StatusProspect".$statut) ? $langs->trans("StatusProspect".$statut) : $label, 0).' '.(($langs->trans("StatusProspect".$statut) != "StatusProspect".$statut) ? $langs->trans("StatusProspect".$statut) : $label);
}
}
if ($mode == 3)
{
if ($statut == -1) return img_action($langs->trans("StatusProspect-1"),-1);
if ($statut == 0) return img_action($langs->trans("StatusProspect0"), 0);
if ($statut == 1) return img_action($langs->trans("StatusProspect1"), 1);
if ($statut == 2) return img_action($langs->trans("StatusProspect2"), 2);
if ($statut == 3) return img_action($langs->trans("StatusProspect3"), 3);
if ($statut == '-1' || $statut == 'ST_NO') return img_action($langs->trans("StatusProspect-1"),-1);
elseif ($statut == '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0);
elseif ($statut == '1' || $statut == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1);
elseif ($statut == '2' || $statut == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2);
elseif ($statut == '3' || $statut == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3);
else
{
return img_action(($langs->trans("StatusProspect".$statut) != "StatusProspect".$statut) ? $langs->trans("StatusProspect".$statut) : $label, 0);
}
}
if ($mode == 4)
{
if ($statut == -1) return img_action($langs->trans("StatusProspect-1"),-1).' '.$langs->trans("StatusProspect-1");
if ($statut == 0) return img_action($langs->trans("StatusProspect0"), 0).' '.$langs->trans("StatusProspect0");
if ($statut == 1) return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1");
if ($statut == 2) return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2");
if ($statut == 3) return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3");
if ($statut == '-1' || $statut == 'ST_NO') return img_action($langs->trans("StatusProspect-1"),-1).' '.$langs->trans("StatusProspect-1");
elseif ($statut == '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0).' '.$langs->trans("StatusProspect0");
elseif ($statut == '1' || $statut == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1");
elseif ($statut == '2' || $statut == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2");
elseif ($statut == '3' || $statut == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3");
else
{
return img_action(($langs->trans("StatusProspect".$statut) != "StatusProspect".$statut) ? $langs->trans("StatusProspect".$statut) : $label, 0).' '.(($langs->trans("StatusProspect".$statut) != "StatusProspect".$statut) ? $langs->trans("StatusProspect".$statut) : $label);
}
}
return "Error, mode/status not found";
@@ -3154,7 +3168,7 @@ class Societe extends CommonObject
if (! $resql)
{
$this->db->rollback();
$this->error=$this->db->error();
$this->error=$this->db->lasterror();
return -1;
}
@@ -3232,7 +3246,7 @@ class Societe extends CommonObject
$paiement = $facturestatic->getSommePaiement();
$creditnotes = $facturestatic->getSumCreditNotesUsed();
$deposits = $facturestatic->getSumDepositsUsed();
$outstandingBill+= $obj->total_ttc - $paiement - $creditnotes - $deposits;
}
return $outstandingBill;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B

After

Width:  |  Height:  |  Size: 914 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 782 B

After

Width:  |  Height:  |  Size: 914 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 B

After

Width:  |  Height:  |  Size: 914 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 596 B

After

Width:  |  Height:  |  Size: 914 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 431 B

After

Width:  |  Height:  |  Size: 903 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 782 B

After

Width:  |  Height:  |  Size: 914 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

View File

@@ -247,9 +247,8 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla
font-size: <?php print $fontsize ?>px;
font-family: <?php print $fontlist ?>;
background: #FDFDFD;
color: #444;
color: #111;
border: 1px solid #C0C0C0;
/*padding: 1px 1px 1px 1px; */
margin: 0px 0px 0px 0px;
}
@@ -545,6 +544,10 @@ margin : 0px auto;
margin-right: 8px;
margin-bottom: 4px;
}
.pictosubstatus {
padding-left: 2px;
padding-right: 2px;
}
/* ============================================================================== */

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 782 B

After

Width:  |  Height:  |  Size: 914 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B