From 2558694ea6f788013c1f36cd3a8f4b50a7dbd244 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Sun, 2 Mar 2008 19:55:43 +0000 Subject: [PATCH] =?UTF-8?q?Le=20niveau=20de=20potentiel=20des=20prospects?= =?UTF-8?q?=20est=20pleinement=20g=E9r=E9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/admin/dict.php | 11 +++- htdocs/comm/prospect/fiche.php | 46 +++++++++++------ htdocs/conf/conf.class.php | 12 ++--- htdocs/html.form.class.php | 50 +++++++++++++++++++ htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/fr_FR/admin.lang | 3 +- htdocs/societe.class.php | 22 ++++---- .../telephonie/sql}/llx_societe_perms.sql | 0 mysql/data/data.sql | 2 +- mysql/migration/2.2.0-2.4.0.sql | 2 +- 10 files changed, 114 insertions(+), 35 deletions(-) rename {mysql/tables => htdocs/telephonie/sql}/llx_societe_perms.sql (100%) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 9fe02a638b3..f6e2dfd9628 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -46,7 +46,7 @@ $active = 1; // Mettre ici tous les caract�ristiques des dictionnaires // Ordres d'affichage des dictionnaires (0 pour espace) -$taborder=array(9,0,4,3,2,0,1,8,0,5,11,0,6,0,10,12,13,0,14,0,7,0,15); +$taborder=array(9,0,4,3,2,0,1,8,16,0,5,11,0,6,0,10,12,13,0,14,0,7,0,15); // Nom des tables des dictionnaires $tabname[1] = MAIN_DB_PREFIX."c_forme_juridique"; @@ -64,6 +64,7 @@ $tabname[12]= MAIN_DB_PREFIX."cond_reglement"; $tabname[13]= MAIN_DB_PREFIX."c_paiement"; $tabname[14]= MAIN_DB_PREFIX."c_ecotaxe"; $tabname[15]= MAIN_DB_PREFIX."c_paper_format"; +$tabname[16]= MAIN_DB_PREFIX."c_prospectlevel"; // Libell� des dictionnaires $tablib[1] = $langs->trans("DictionnaryCompanyJuridicalType"); @@ -81,6 +82,7 @@ $tablib[12]= $langs->trans("DictionnaryPaymentConditions"); $tablib[13]= $langs->trans("DictionnaryPaymentModes"); $tablib[14]= $langs->trans("DictionnaryEcotaxe"); $tablib[15]= $langs->trans("DictionnaryPaperFormat"); +$tablib[16]= $langs->trans("DictionnaryProspectLevel"); // Requete pour extraction des donn�es des dictionnaires $tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, p.libelle as pays, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_pays as p WHERE f.fk_pays=p.rowid"; @@ -98,6 +100,7 @@ $tabsql[12]= "SELECT c.rowid as rowid, code, sortorder, c.libelle, c.libelle_fac $tabsql[13]= "SELECT id as rowid, code, c.libelle, type, active FROM ".MAIN_DB_PREFIX."c_paiement AS c"; $tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as pays_id, p.libelle as pays, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_pays as p WHERE e.fk_pays=p.rowid and p.active=1"; $tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format"; +$tabsql[16]= "SELECT code, label as libelle, active FROM ".MAIN_DB_PREFIX."c_prospectlevel"; // Critere de tri du dictionnaire $tabsqlsort[1] ="pays, code ASC"; @@ -115,6 +118,7 @@ $tabsqlsort[12]="sortorder ASC, code ASC"; $tabsqlsort[13]="code ASC"; $tabsqlsort[14]="pays, e.organization ASC, code ASC"; $tabsqlsort[15]="rowid ASC"; +$tabsqlsort[16]="sortorder ASC"; // Nom des champs en resultat de select pour affichage du dictionnaire $tabfield[1] = "code,libelle,pays"; @@ -132,6 +136,7 @@ $tabfield[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage"; $tabfield[13]= "code,libelle,type"; $tabfield[14]= "code,libelle,price,organization,pays_id,pays"; $tabfield[15]= "code,libelle,width,height,unit"; +$tabfield[16]= "code,libelle"; // Nom des champs d'�dition pour modification du dictionnaire $tabfieldvalue[1] = "code,libelle,pays"; @@ -149,6 +154,7 @@ $tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage"; $tabfieldvalue[13]= "code,libelle,type"; $tabfieldvalue[14]= "code,libelle,price,organization,pays"; $tabfieldvalue[15]= "code,libelle,width,height,unit"; +$tabfieldvalue[16]= "code,libelle"; // Nom des champs dans la table pour insertion d'un enregistrement $tabfieldinsert[1] = "code,libelle,fk_pays"; @@ -166,6 +172,7 @@ $tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage"; $tabfieldinsert[13]= "code,libelle,type"; $tabfieldinsert[14]= "code,libelle,price,organization,fk_pays"; $tabfieldinsert[15]= "code,label,width,height,unit"; +$tabfieldinsert[16]= "code,label"; // Nom du rowid si le champ n'est pas de type autoincr�ment $tabrowid[1] = ""; @@ -183,6 +190,7 @@ $tabrowid[12]= "rowid"; $tabrowid[13]= "id"; $tabrowid[14]= ""; $tabrowid[15]= ""; +$tabrowid[16]= "code"; // Condition to show dictionnary in setup page $tabcond[1] = true; @@ -200,6 +208,7 @@ $tabcond[12]= $conf->facture->enabled||$conf->fournisseur->enabled; $tabcond[13]= $conf->facture->enabled||$conf->fournisseur->enabled; $tabcond[14]= $conf->produit->enabled&&$conf->global->PRODUIT_USE_ECOTAXE; $tabcond[15]= true; +$tabcond[16]= $conf->societe->enabled; $msg=''; diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php index ccd83da46e3..64b7ae17b28 100644 --- a/htdocs/comm/prospect/fiche.php +++ b/htdocs/comm/prospect/fiche.php @@ -51,6 +51,17 @@ if ($_GET["action"] == 'cstc') $sql .= " WHERE rowid = ".$_GET["socid"]; $db->query($sql); } +// set prospect level +if ($_POST["action"] == 'setprospectlevel' && $user->rights->societe->creer) +{ + + $societe = new Societe($db, $_GET["socid"]); + $societe->fk_prospectlevel=$_POST['prospect_level_id']; + $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_prospectlevel='".$_POST['prospect_level_id']; + $sql.= "' WHERE rowid='".$_GET["socid"]."'"; + $result = $db->query($sql); + if (! $result) dolibarr_print_error($result); +} /********************************************************************************* @@ -60,6 +71,7 @@ if ($_GET["action"] == 'cstc') *********************************************************************************/ llxHeader(); +$form=new Form($db); if ($socid > 0) { @@ -99,21 +111,25 @@ if ($socid > 0) print '<tr><td>'.$langs->trans('JuridicalStatus').'</td><td colspan="3">'.$societe->forme_juridique.'</td></tr>'; - // Level -// print '<tr><td>'.$langs->trans('ProspectLevel').'</td><td colspan="3">'.$societe->getLibLevel().'</td></tr>'; - print '<tr><td>'; - print '<table width="100%" class="nobordernopadding"><tr><td>'; - print $langs->trans('ProspectLevel'); - print '<td><td align="right">'; - if ($user->rights->societe->creer) - print '<a href="'.DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$societe->id.'">'.img_edit().'</a>'; - else - print ' '; - print '</td></tr></table>'; - print '</td>'; - print '<td colspan="3">'; - print $societe->getLibLevel(); - print '</td></tr>'; + // Level + print '<tr><td nowrap>'; + print '<table width="100%" class="nobordernopadding"><tr><td nowrap>'; + print $langs->trans('ProspectLevelShort'); + print '<td>'; + if (($_GET['action'] != 'editlevel') && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editlevel&socid='.$societe->id.'">'.img_edit($langs->trans('SetLevel'),1).'</a></td>'; + print '</tr></table>'; + print '</td><td colspan="3">'; + if ($_GET['action'] == 'editlevel') + { + $form->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$societe->id,$societe->fk_prospectlevel,'prospect_level_id',1); + } + else + { + print $societe->getLibLevel(); + //$html->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$objsoc->id,$objsoc->mode_reglement,'none'); + } + print "</td>"; + print '</tr>'; // Status print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">'.$societe->getLibStatut(4).'</td>'; diff --git a/htdocs/conf/conf.class.php b/htdocs/conf/conf.class.php index 2802da1c1c3..102f1f232fe 100644 --- a/htdocs/conf/conf.class.php +++ b/htdocs/conf/conf.class.php @@ -1,7 +1,7 @@ <?php /* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com> - * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2006 Jean Heimburger <jean@tiaris.info> * @@ -18,15 +18,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ */ /** - \file htdocs/conf/conf.class.php - \brief Fichier de la classe de stockage de la config courante - \remarks La config est stockee dans le fichier conf/conf.php - \version $Revision$ + \file htdocs/conf/conf.class.php + \brief Fichier de la classe de stockage de la config courante + \remarks La config est stockee dans le fichier conf/conf.php + \version $Id$ */ diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index be7c006c896..7cdc3b26d11 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -1964,6 +1964,56 @@ class Form } + /** + * \brief Affiche formulaire de selection des modes de reglement + * \param page Page + * \param selected Id or code preselected + * \param htmlname Nom du formulaire select + * \param empty Add empty value in list + */ + function form_prospect_level($page, $selected='', $htmlname='prospect_level_id', $empty=0) + { + global $langs; + + print '<form method="post" action="'.$page.'">'; + print '<input type="hidden" name="action" value="setprospectlevel">'; + print '<table class="noborder" cellpadding="0" cellspacing="0">'; + print '<tr><td>'; + + print '<select class="flat" name="'.$htmlname.'">'; + if ($empty) print '<option value=""> </option>'; + + dolibarr_syslog('Form::form_prospect_level',LOG_DEBUG); + $sql = "SELECT code, label"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_prospectlevel"; + $sql.= " WHERE active > 0"; + $sql.= " ORDER BY label"; + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $obj = $this->db->fetch_object($resql); + + print '<option value="'.$obj->code.'"'; + if ($selected == $obj->code) print ' selected="true"'; + print '>'; + print $obj->label; + print '</option>'; + + $i++; + } + } + print '</select>'; + + print '</td>'; + print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; + print '</tr></table></form>'; + } + + /** * \brief Affiche formulaire de selection de la remise relative * \param page Page diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b528d3f7392..b8878216add 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -406,6 +406,7 @@ Permission2405=Create/modify/delete actions/tasks of others Permission2410=Read Dolibarr audit events DictionnaryCompanyType=Company types DictionnaryCompanyJuridicalType=Juridical kinds of company +DictionnaryProspectLevel=Prospect potential level DictionnaryCanton=Cantons DictionnaryRegion=Regions DictionnaryCountry=Countries diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index ebf99d1759d..73cf65a65c9 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -405,6 +405,7 @@ Permission2405=Creer/modifier/supprimer les actions/taches pour les autres Permission2410=Voir l'audit des �venements Dolibarr DictionnaryCompanyType=Types de soci�t�s DictionnaryCompanyJuridicalType=Formes juridiques +DictionnaryProspectLevel=Niveau de potentiel des prospects DictionnaryCanton=D�partements/Provinces/Cantons DictionnaryRegion=R�gions DictionnaryCountry=Pays @@ -426,7 +427,7 @@ VATIsUsedDesc=Le taux de TVA propos VATIsNotUsedDesc=Le taux de TVA propos� par d�faut est 0. C'est le cas d'associations, particuliers ou certaines petites soci�t�s. VATIsUsedExampleFR=En France, il s'agit des soci�t�s ou organismes ayant choisi un r�gime fiscale r�el (R�el simplifi� ou R�el normal), r�gime dans lequel la TVA est d�clar�e. VATIsNotUsedExampleFR=En France, il s'agit des associations ne d�clarant pas de TVA ou soci�t�s, organismes ou professions lib�rales ayant choisi le r�gime fiscal micro entreprise (TVA en franchise) et payant une TVA en franchise sans faire de d�claration de TVA. Ce choix fait de plus apparaitre la mention "TVA non applicable - art-293B du CGI" sur les factures. -LabelUsedByDefault=Libell� qui sera utilis� si aucune traduction n'est trouv� pour ce code +LabelUsedByDefault=Libell� qui sera utilis� si aucune traduction n'est trouv�e pour ce code LabelOnDocuments=Libell� sur documents NbOfDays=Nbre de jours AtEndOfMonth=En fin de mois diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index 28946431293..3c41b899f21 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -495,9 +495,10 @@ class Societe extends CommonObject global $langs; global $conf; - /* Lecture des permissions */ - if ($user <> 0) + // Init data for telephonie module + if ($this->telephonie->enabled && $user && $user->id) { + /* Lecture des permissions */ $sql = "SELECT p.pread, p.pwrite, p.pperms"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_perms as p"; $sql .= " WHERE p.fk_user = '".$user->id."'"; @@ -514,19 +515,20 @@ class Societe extends CommonObject } } - $sql = 'SELECT s.rowid, s.nom, s.address,'.$this->db->pdate('s.datec').' as dc, prefix_comm'; - // multiprix - if($conf->global->PRODUIT_MULTIPRICES == 1) - $sql .= ', s.price_level'; + $sql = 'SELECT s.rowid, s.nom, s.address,'.$this->db->pdate('s.datec').' as dc, s.prefix_comm'; + if ($conf->global->PRODUIT_MULTIPRICES == 1) $sql .= ', s.price_level'; $sql .= ','. $this->db->pdate('s.tms').' as date_update'; - $sql .= ', s.tel, s.fax, s.email, s.url, s.cp, s.ville, s.note, client, fournisseur'; + $sql .= ', s.tel, s.fax, s.email, s.url, s.cp, s.ville, s.note, s.client, s.fournisseur'; $sql .= ', s.siren, s.siret, s.ape, s.idprof4'; $sql .= ', s.capital, s.tva_intra, s.rubrique'; $sql .= ', s.fk_typent as typent_id'; - $sql .= ', s.fk_effectif as effectif_id, e.libelle as effectif'; - $sql .= ', s.fk_forme_juridique as forme_juridique_code, fj.libelle as forme_juridique'; + $sql .= ', s.fk_effectif as effectif_id'; + $sql .= ', s.fk_forme_juridique as forme_juridique_code'; $sql .= ', s.code_client, s.code_compta, s.code_fournisseur, s.parent'; $sql .= ', s.fk_departement, s.fk_pays, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj'; + $sql .= ', s.fk_prospectlevel'; + $sql .= ', fj.libelle as forme_juridique'; + $sql .= ', e.libelle as effectif'; $sql .= ', p.code as pays_code, p.libelle as pays'; $sql .= ', d.code_departement as departement_code, d.nom as departement'; $sql .= ', st.libelle as stcomm'; @@ -603,6 +605,8 @@ class Societe extends CommonObject $this->forme_juridique_code= $obj->forme_juridique_code; $this->forme_juridique = $obj->forme_juridique_code?$obj->forme_juridique:''; + $this->fk_prospectlevel = $obj->fk_prospectlevel; + $this->prefix_comm = $obj->prefix_comm; $this->remise_client = $obj->remise_client; diff --git a/mysql/tables/llx_societe_perms.sql b/htdocs/telephonie/sql/llx_societe_perms.sql similarity index 100% rename from mysql/tables/llx_societe_perms.sql rename to htdocs/telephonie/sql/llx_societe_perms.sql diff --git a/mysql/data/data.sql b/mysql/data/data.sql index c7e87fdf042..ad127d78b72 100644 --- a/mysql/data/data.sql +++ b/mysql/data/data.sql @@ -1369,4 +1369,4 @@ delete from llx_c_prospectlevel; insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_UNKOWN', 'Unknown', 1); insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_LOW', 'Low', 2); insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_MEDIUM', 'Medium', 3); -insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_HIGH', 'Eleve', 4); +insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_HIGH', 'High', 4); diff --git a/mysql/migration/2.2.0-2.4.0.sql b/mysql/migration/2.2.0-2.4.0.sql index c75336fdfb4..72549877497 100644 --- a/mysql/migration/2.2.0-2.4.0.sql +++ b/mysql/migration/2.2.0-2.4.0.sql @@ -214,7 +214,7 @@ create table llx_c_prospectlevel insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_UNKOWN', 'Unknown', 1); insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_LOW', 'Low', 2); insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_MEDIUM', 'Medium', 3); -insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_HIGH', 'Eleve', 4); +insert into llx_c_prospectlevel (code,label,sortorder) values ('PL_HIGH', 'High', 4); alter table llx_societe add column fk_prospectlevel varchar(12) after fournisseur; -- GitLab