From 86b2a32c69a3ff742a15d6c25ddb213945279837 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Sat, 1 Mar 2008 01:12:55 +0000 Subject: [PATCH] New: Ajout du "potentiel" des prospects --- htdocs/comm/action/listevents.php | 8 +++--- htdocs/comm/prospect/fiche.php | 32 +++++++++++++++------ htdocs/comm/prospect/prospects.php | 37 +++++++++++++++--------- htdocs/langs/en_US/companies.lang | 6 ++++ htdocs/langs/fr_FR/companies.lang | 6 ++++ htdocs/lib/company.lib.php | 2 +- htdocs/prospect.class.php | 43 +++++++++++++++++++++------- htdocs/societe.class.php | 2 +- htdocs/societe/commerciaux.php | 7 ++--- htdocs/translate.class.php | 42 +++++++++++++++++++++++++-- mysql/data/data.sql | 13 ++++++++- mysql/migration/2.2.0-2.4.0.sql | 16 +++++++++++ mysql/tables/llx_c_prospectlevel.sql | 28 ++++++++++++++++++ mysql/tables/llx_societe.key.sql | 2 ++ mysql/tables/llx_societe.sql | 3 +- 15 files changed, 201 insertions(+), 46 deletions(-) create mode 100644 mysql/tables/llx_c_prospectlevel.sql diff --git a/htdocs/comm/action/listevents.php b/htdocs/comm/action/listevents.php index f4e3c2d8f27..9df7b11b649 100644 --- a/htdocs/comm/action/listevents.php +++ b/htdocs/comm/action/listevents.php @@ -65,9 +65,9 @@ $sql.= " c.code as acode, c.libelle,"; $sql.= " ut.login as logintodo, ut.rowid as useridtodo,"; $sql.= " ud.login as logindone, ud.rowid as useriddone,"; $sql.= " sp.name, sp.firstname"; -if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."societe as s,"; -if (!$user->rights->commercial->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.= " ".MAIN_DB_PREFIX."actioncomm as a"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ut ON a.fk_user_action = ut.rowid"; @@ -85,7 +85,7 @@ if ($socid) { $sql .= " AND s.rowid = ".$socid; } -if (!$user->rights->commercial->client->voir && !$socid) //restriction +if (!$user->rights->societe->client->voir && !$socid) //restriction { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; } @@ -164,7 +164,7 @@ if ($resql) print $obj->label; print '</td>'; - // Soci�t� + // Soci�t� print '<td>'; $societestatic->id=$obj->socid; $societestatic->client=$obj->client; diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php index cd94d224f01..bde1b611068 100644 --- a/htdocs/comm/prospect/fiche.php +++ b/htdocs/comm/prospect/fiche.php @@ -48,7 +48,7 @@ $result = restrictedArea($user, 'societe',$socid,'',1); if ($_GET["action"] == 'cstc') { $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$_GET["stcomm"]; - $sql .= " WHERE rowid = ".$_GET["id"]; + $sql .= " WHERE rowid = ".$_GET["socid"]; $db->query($sql); } @@ -77,7 +77,7 @@ if ($socid > 0) */ $head = societe_prepare_head($societe); - dolibarr_fiche_head($head, 'prospect', $societe->nom); + dolibarr_fiche_head($head, 'prospect', $langs->trans("ThirdParty")); print "<table width=\"100%\">\n"; print '<tr><td valign="top" width="50%">'; @@ -99,14 +99,30 @@ if ($socid > 0) print '<tr><td>'.$langs->trans('JuridicalStatus').'</td><td colspan="3">'.$societe->forme_juridique.'</td></tr>'; - // Status + // 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>'; + + // Status print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">'.$societe->getLibStatut(4).'</td>'; print '<td>'; - if ($societe->stcomm_id != -1) print '<a href="fiche.php?id='.$societe->id.'&stcomm=-1&action=cstc">'.img_action(0,-1).'</a>'; - if ($societe->stcomm_id != 0) print '<a href="fiche.php?id='.$societe->id.'&stcomm=0&action=cstc">'.img_action(0,0).'</a>'; - if ($societe->stcomm_id != 1) print '<a href="fiche.php?id='.$societe->id.'&stcomm=1&action=cstc">'.img_action(0,1).'</a>'; - if ($societe->stcomm_id != 2) print '<a href="fiche.php?id='.$societe->id.'&stcomm=2&action=cstc">'.img_action(0,2).'</a>'; - if ($societe->stcomm_id != 3) print '<a href="fiche.php?id='.$societe->id.'&stcomm=3&action=cstc">'.img_action(0,3).'</a>'; + if ($societe->stcomm_id != -1) print '<a href="fiche.php?socid='.$societe->id.'&stcomm=-1&action=cstc">'.img_action(0,-1).'</a>'; + if ($societe->stcomm_id != 0) print '<a href="fiche.php?socid='.$societe->id.'&stcomm=0&action=cstc">'.img_action(0,0).'</a>'; + if ($societe->stcomm_id != 1) print '<a href="fiche.php?socid='.$societe->id.'&stcomm=1&action=cstc">'.img_action(0,1).'</a>'; + if ($societe->stcomm_id != 2) print '<a href="fiche.php?socid='.$societe->id.'&stcomm=2&action=cstc">'.img_action(0,2).'</a>'; + if ($societe->stcomm_id != 3) print '<a href="fiche.php?socid='.$societe->id.'&stcomm=3&action=cstc">'.img_action(0,3).'</a>'; print '</td></tr>'; print '</table>'; diff --git a/htdocs/comm/prospect/prospects.php b/htdocs/comm/prospect/prospects.php index 3ae9dab08e1..a1d486139c2 100644 --- a/htdocs/comm/prospect/prospects.php +++ b/htdocs/comm/prospect/prospects.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * * 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 @@ -55,8 +55,8 @@ $pagenext = $page + 1; if ($_GET["action"] == 'cstc') { $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$_GET["pstcomm"]; - $sql .= " WHERE rowid = ".$_GET["pid"]; - $db->query($sql); + $sql .= " WHERE rowid = ".$_GET["socid"]; + $result=$db->query($sql); } @@ -64,14 +64,15 @@ if ($_GET["action"] == 'cstc') * Affichage liste */ -$sql = "SELECT s.rowid, s.nom, s.ville, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, st.libelle as stcomm, s.prefix_comm, s.fk_stcomm "; -$sql .= ", d.nom as departement"; +$sql = "SELECT s.rowid, s.nom, s.ville, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea,"; +$sql.= " st.libelle as stcomm, s.prefix_comm, s.fk_stcomm, s.fk_prospectlevel,"; +$sql.= " d.nom as departement"; if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."c_stcomm as st"; if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d on (d.rowid = s.fk_departement)"; -$sql .= " WHERE s.fk_stcomm = st.id AND s.client = 2"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d on (d.rowid = s.fk_departement)"; +$sql.= " WHERE s.fk_stcomm = st.id AND s.client = 2"; if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (isset($stcomm)) @@ -132,6 +133,7 @@ if ($resql) print_liste_field_titre($langs->trans("Town"),"prospects.php","s.ville","","","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("State"),"prospects.php","s.fk_departement","","","align=\"center\"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateCreation"),"prospects.php","s.datec","","","align=\"center\"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ProspectLevelShort"),"prospects.php","s.fk_prospectlevel","","","align=\"center\"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),"prospects.php","s.fk_stcomm","","","align=\"center\"",$sortfield,$sortorder); print '<td class="liste_titre" colspan="4"> </td>'; print "</tr>\n"; @@ -152,7 +154,8 @@ if ($resql) $var=true; $prospectstatic=new Prospect($db); - + $prospectstatic->client=2; + while ($i < min($num,$conf->liste_limit)) { $obj = $db->fetch_object($resql); @@ -160,25 +163,31 @@ if ($resql) $var=!$var; print "<tr $bc[$var]>"; - print '<td><a href="'.DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$obj->rowid.'">'; - print img_object($langs->trans("ShowProspect"),"company"); - print ' '.dolibarr_trunc($obj->nom,44).'</a></td>'; + print '<td>'; + $prospectstatic->id=$obj->rowid; + $prospectstatic->nom=$obj->nom; + print $prospectstatic->getNomUrl(1); + print '</td>'; print "<td>".$obj->ville." </td>"; print "<td align=\"center\">$obj->departement</td>"; - // Date cr�ation + // Creation date print "<td align=\"center\">".dolibarr_print_date($obj->datec)."</td>"; + // Level + print "<td align=\"center\">"; + print $prospectstatic->LibLevel($obj->fk_prospectlevel); + print "</td>"; // Statut print "<td align=\"center\">"; print $prospectstatic->LibStatut($obj->fk_stcomm,2); print "</td>"; - + $sts = array(-1,0,1,2,3); print '<td align="right" nowrap>'; foreach ($sts as $key => $value) { if ($value <> $obj->fk_stcomm) { - print '<a href="prospects.php?pid='.$obj->rowid.'&pstcomm='.$value.'&action=cstc&'.$urladd.'">'; + print '<a href="prospects.php?socid='.$obj->rowid.'&pstcomm='.$value.'&action=cstc&'.$urladd.'">'; print img_action(0,$value); print '</a> '; } diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 97a11f157af..0b284d39933 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -183,6 +183,12 @@ ErrorVATCheckMS_UNAVAILABLE=Check not possible. Check service is not provided by NorProspectNorCustomer=Nor prospect, nor customer JuridicalStatus=Juridical status Staff=Staff +ProspectLevelShort=Potentiel +ProspectLevel=Prospect potential +PL_UNKNOWN=Unknown +PL_LOW=Low +PL_MEDIUM=Medium +PL_HIGH=High TE_STARTUP=Startup TE_GROUP=Large company TE_MEDIUM=Medium company diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index 6d11e4ff0af..48ad59484f5 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -183,6 +183,12 @@ ErrorVATCheckMS_UNAVAILABLE=V NorProspectNorCustomer=Ni client, ni prospect JuridicalStatus=Forme juridique Staff=Effectif +ProspectLevelShort=Potentiel +ProspectLevel=Potentiel du prospect +PL_UNKNOWN=Ind�termin� +PL_LOW=Faible +PL_MEDIUM=Moyen +PL_HIGH=Elev� TE_STARTUP=Startup TE_GROUP=Grand compte TE_MEDIUM=PME/PMI diff --git a/htdocs/lib/company.lib.php b/htdocs/lib/company.lib.php index b23fd244bab..389b0127a0e 100644 --- a/htdocs/lib/company.lib.php +++ b/htdocs/lib/company.lib.php @@ -46,7 +46,7 @@ function societe_prepare_head($objsoc) } if ($objsoc->client==2) { - $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$objsoc->id; + $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$objsoc->id; $head[$h][1] = $langs->trans("Prospect"); $head[$h][2] = 'prospect'; $h++; diff --git a/htdocs/prospect.class.php b/htdocs/prospect.class.php index 3f85b8c5ed1..460f3c63f4b 100644 --- a/htdocs/prospect.class.php +++ b/htdocs/prospect.class.php @@ -15,16 +15,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$ - * $Source$ */ /** \file htdocs/prospect.class.php \ingroup societe \brief Fichier de la classe des prospects - \version $Revision$ + \version $Id$ */ @@ -43,7 +40,7 @@ class Prospect extends Societe /** * \brief Constructeur de la classe - * \param DB handler acc�s base de donn�es + * \param DB handler acc�s base de donn�es * \param id id societe (0 par defaut) */ function Prospect($DB, $id=0) @@ -98,8 +95,8 @@ class Prospect extends Societe /** - * \brief Retourne le libell� du statut d'une facture (brouillon, valid�e, abandonn�e, pay�e) - * \param mode 0=libell� long, 1=libell� court, 2=Picto + Libell� court, 3=Picto, 4=Picto + Libell� long + * \brief Retourne le libell� du statut d'une facture (brouillon, valid�e, abandonn�e, pay�e) + * \param mode 0=libell� long, 1=libell� court, 2=Picto + Libell� court, 3=Picto, 4=Picto + Libell� long * \return string Libelle */ function getLibStatut($mode=0) @@ -108,10 +105,10 @@ class Prospect extends Societe } /** - * \brief Renvoi le libell� d'un statut donn� + * \brief Renvoi le libelle d'un statut donne * \param statut Id statut - * \param mode 0=libell� long, 1=libell� court, 2=Picto + Libell� court, 3=Picto, 4=Picto + Libell� long, 5=Libell� court + Picto - * \return string Libell� du statut + * \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * \return string Libelle du statut */ function LibStatut($statut,$mode=0) { @@ -146,5 +143,31 @@ class Prospect extends Societe return "Error, mode/status not found"; } + /** + * \brief Renvoi le libelle du niveau + * \return string Libelle + */ + function getLibLevel() + { + return $this->LibLevel($this->fk_prospectlevel); + } + + /** + * \brief Renvoi le libelle du niveau + * \param fk_prospectlevel Prospect level + * \return string Libelle du niveau + */ + function LibLevel($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; + } } ?> diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index 3d39e134862..ee143f5523b 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -1148,7 +1148,7 @@ class Societe extends CommonObject } elseif($this->client == 2) { - $lien= '<a href="'.DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$this->id.'">'; + $lien= '<a href="'.DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$this->id.'">'; $lienfin='</a>'; } else diff --git a/htdocs/societe/commerciaux.php b/htdocs/societe/commerciaux.php index 53bbb7cdbfe..650406a9686 100644 --- a/htdocs/societe/commerciaux.php +++ b/htdocs/societe/commerciaux.php @@ -97,7 +97,7 @@ if ($_GET["socid"]) dolibarr_fiche_head($head, 'salesrepresentative', $langs->trans("ThirdParty")); /* - * Fiche soci�t� en mode visu + * Fiche soci�t� en mode visu */ print '<table class="border" width="100%">'; @@ -144,7 +144,7 @@ if ($_GET["socid"]) { $obj = $db->fetch_object($resql); - if (!$user->rights->commercial->client->voir) + if (!$user->rights->societe->client->voir) { print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">'; print img_object($langs->trans("ShowUser"),"user").' '; @@ -179,8 +179,7 @@ if ($_GET["socid"]) print "</div>\n"; - - if ($user->rights->societe->creer && $user->rights->commercial->client->voir) + if ($user->rights->societe->creer && $user->rights->societe->client->voir) { /* * Liste diff --git a/htdocs/translate.class.php b/htdocs/translate.class.php index 6f81a922c92..c983badd4aa 100644 --- a/htdocs/translate.class.php +++ b/htdocs/translate.class.php @@ -39,8 +39,10 @@ class Translate { var $tab_loaded=array(); // Tableau pour signaler les fichiers deja charges var $tab_translate=array(); // Tableau des traductions - - var $charset_inputfile='ISO-8859-1'; // Codage du contenu du fichier langue + + var $cache_labels=array(); // Cache for labels + + var $charset_inputfile='ISO-8859-1'; // Codage du contenu du fichier langue var $charset_output='ISO-8859-1'; // Codage par defaut de la sortie de la methode trans @@ -445,6 +447,42 @@ class Translate { return false; } + /** + * \brief Return a label for a key. Store key-label in a cache. + * \param db Database handler + * \param key Key to get label + * \param tablename Table name + * \param fieldkey Field for key + * \param fieldlabel Field for label + * \return string Label + */ + function getLabelFromKey($db,$key,$tablename,$fieldkey,$fieldlabel) + { + // Check in cache + if (! empty($this->cache_labels[$tablename][$key])) + { + return $this->cache_labels[$tablename][$key]; // Found in cache + } + + $sql = "SELECT ".$fieldlabel." as label"; + $sql.= " FROM ".MAIN_DB_PREFIX.$tablename; + $sql.= " WHERE ".$fieldkey." = '".$key."'"; + + dolibarr_syslog('Translate::getLabelFromKey ',LOG_DEBUG); + $resql = $db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + $this->cache_labels[$tablename][$key]=$obj->label; + return $this->cache_labels[$tablename][$key]; + } + else + { + dolibarr_print_error($db); + return -1; + } + } + } ?> diff --git a/mysql/data/data.sql b/mysql/data/data.sql index 2afe4a1cdc3..c7e87fdf042 100644 --- a/mysql/data/data.sql +++ b/mysql/data/data.sql @@ -1358,4 +1358,15 @@ INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (6, 'A3', 'Format A3', '297', '420', 'mm', 1); INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (7, 'A4', 'Format A4', '210', '297', 'mm', 1); INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (8, 'A5', 'Format A5', '148', '210', 'mm', 1); -INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (9, 'A6', 'Format A6', '105', '148', 'mm', 1); \ No newline at end of file +INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (9, 'A6', 'Format A6', '105', '148', 'mm', 1); + + +-- +-- Prospect level +-- + +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); diff --git a/mysql/migration/2.2.0-2.4.0.sql b/mysql/migration/2.2.0-2.4.0.sql index c2f83c2ee61..0c984ee1715 100644 --- a/mysql/migration/2.2.0-2.4.0.sql +++ b/mysql/migration/2.2.0-2.4.0.sql @@ -202,3 +202,19 @@ ALTER TABLE llx_facture_fourn_det ADD product_type integer DEFAULT NULL a -- V4.1 update llx_facture_fourn_det set product_type = 1 where fk_product in (select rowid from llx_product where fk_product_type = 1); -- V4.1 update llx_facturedet set product_type = 1 where product_type is null; -- V4.1 update llx_facture_fourn_det set product_type = 1 where product_type is null; + +create table llx_c_prospectlevel +( + code varchar(12) PRIMARY KEY, + label varchar(30), + sortorder smallint, + active smallint DEFAULT 1 NOT NULL +) type=innodb; + +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); + + +alter table llx_societe add column fk_prospectlevel varchar(12) after fournisseur; diff --git a/mysql/tables/llx_c_prospectlevel.sql b/mysql/tables/llx_c_prospectlevel.sql new file mode 100644 index 00000000000..38329ae456e --- /dev/null +++ b/mysql/tables/llx_c_prospectlevel.sql @@ -0,0 +1,28 @@ +-- =================================================================== +-- Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net> +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (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, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- =================================================================== + +create table llx_c_prospectlevel +( + code varchar(12) PRIMARY KEY, + label varchar(30), + sortorder smallint, + active smallint DEFAULT 1 NOT NULL +) type=innodb; + diff --git a/mysql/tables/llx_societe.key.sql b/mysql/tables/llx_societe.key.sql index 81230517510..cfb904b7507 100644 --- a/mysql/tables/llx_societe.key.sql +++ b/mysql/tables/llx_societe.key.sql @@ -24,3 +24,5 @@ ALTER TABLE llx_societe ADD UNIQUE uk_societe_code_client(code_client); ALTER TABLE llx_societe ADD INDEX idx_societe_user_creat(fk_user_creat); ALTER TABLE llx_societe ADD INDEX idx_societe_user_modif(fk_user_modif); + +--ALTER TABLE llx_societe ADD FOREIGN KEY fk_prospectlevel llx_c_prospectlevel(code); diff --git a/mysql/tables/llx_societe.sql b/mysql/tables/llx_societe.sql index ad067a8dd6f..23417cdb07d 100644 --- a/mysql/tables/llx_societe.sql +++ b/mysql/tables/llx_societe.sql @@ -51,13 +51,14 @@ create table llx_societe tva_intra varchar(20), -- tva capital real, -- capital de la soci�t� description text, -- - fk_stcomm tinyint DEFAULT 0, -- commercial statut + fk_stcomm smallint DEFAULT 0, -- commercial statut note text, -- services tinyint DEFAULT 0, -- prefix_comm varchar(5), -- prefix commercial client tinyint DEFAULT 0, -- client 0/1/2 fournisseur tinyint DEFAULT 0, -- fournisseur 0/1 supplier_account varchar(32), -- compte client chez un fournisseur + fk_prospectlevel varchar(12), -- prospect level (in llx_c_prospectlevel) customer_bad tinyint DEFAULT 0, -- mauvais payeur 0/1 customer_rate real DEFAULT 0, -- taux fiabili� client (0 � 1) supplier_rate real DEFAULT 0, -- taux fiabili� fournisseur (0 � 1) -- GitLab