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 ''.$langs->trans('JuridicalStatus').''.$societe->forme_juridique.''; - // Level -// print ''.$langs->trans('ProspectLevel').''.$societe->getLibLevel().''; - print ''; - print '
'; - print $langs->trans('ProspectLevel'); - print ''; - if ($user->rights->societe->creer) - print ''.img_edit().''; - else - print ' '; - print '
'; - print ''; - print ''; - print $societe->getLibLevel(); - print ''; + // Level + print ''; + print ''; + print '
'; + print $langs->trans('ProspectLevelShort'); + print ''; + if (($_GET['action'] != 'editlevel') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetLevel'),1).'
'; + print ''; + 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 ""; + print ''; // Status print ''.$langs->trans("Status").''.$societe->getLibStatut(4).''; 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 @@ * Copyright (C) 2003 Xavier Dutoit - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2007 Regis Houssin * Copyright (C) 2006 Jean Heimburger * @@ -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 '
'; + print ''; + print ''; + print ''; + print ''; + print '
'; + + print ''; + + print '
'; + } + + /** * \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;