diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index d81f306be9e..4d33723a947 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -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);
+$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);
// Name of SQL tables of dictionaries
$tabname=array();
@@ -98,6 +98,7 @@ $tabname[21]= MAIN_DB_PREFIX."c_availability";
$tabname[22]= MAIN_DB_PREFIX."c_input_reason";
$tabname[23]= MAIN_DB_PREFIX."c_revenuestamp";
$tabname[24]= MAIN_DB_PREFIX."c_type_resource";
+$tabname[25]= MAIN_DB_PREFIX."c_email_templates";
// Dictionary labels
$tablib=array();
@@ -125,6 +126,7 @@ $tablib[21]= "DictionaryAvailability";
$tablib[22]= "DictionarySource";
$tablib[23]= "DictionaryRevenueStamp";
$tablib[24]= "DictionaryResourceType";
+$tablib[25]= "DictionaryEMailTemplates";
// Requests to extract data
$tabsql=array();
@@ -152,6 +154,7 @@ $tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX
$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[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";
// Criteria to sort dictionaries
$tabsqlsort=array();
@@ -179,6 +182,7 @@ $tabsqlsort[21]="code ASC, label ASC";
$tabsqlsort[22]="code ASC, label ASC";
$tabsqlsort[23]="country ASC, taux ASC";
$tabsqlsort[24]="code ASC,label ASC";
+$tabsqlsort[25]="label ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
@@ -206,6 +210,7 @@ $tabfield[21]= "code,label";
$tabfield[22]= "code,label";
$tabfield[23]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note";
$tabfield[24]= "code,label";
+$tabfield[25]= "label,type_template,private,position,topic,content";
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
@@ -233,6 +238,7 @@ $tabfieldvalue[21]= "code,label";
$tabfieldvalue[22]= "code,label";
$tabfieldvalue[23]= "country,taux,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldvalue[24]= "code,label";
+$tabfieldvalue[25]= "label,type_template,private,position,topic,content";
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
@@ -260,6 +266,7 @@ $tabfieldinsert[21]= "code,label";
$tabfieldinsert[22]= "code,label";
$tabfieldinsert[23]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldinsert[24]= "code,label";
+$tabfieldinsert[25]= "label,type_template,private,position,topic,content";
// Nom du rowid si le champ n'est pas de type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on
@@ -288,7 +295,8 @@ $tabrowid[20]= "";
$tabrowid[21]= "rowid";
$tabrowid[22]= "rowid";
$tabrowid[23]= "";
-$tabrowid[23]= "";
+$tabrowid[24]= "";
+$tabrowid[25]= "";
// Condition to show dictionary in setup page
$tabcond=array();
@@ -316,6 +324,7 @@ $tabcond[21]= ! empty($conf->propal->enabled);
$tabcond[22]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled));
$tabcond[23]= true;
$tabcond[24]= ! empty($conf->resource->enabled);
+$tabcond[25]= true; // && ! empty($conf->global->MAIN_EMAIL_EDIT_TEMPLATE_FROM_DIC);
// List of help for fields
$tabhelp=array();
@@ -343,6 +352,7 @@ $tabhelp[21] = array();
$tabhelp[22] = array();
$tabhelp[23] = array();
$tabhelp[24] = array();
+$tabhelp[25] = array();
// List of check for fields (NOT USED YET)
$tabfieldcheck=array();
@@ -370,6 +380,7 @@ $tabfieldcheck[21] = array();
$tabfieldcheck[22] = array();
$tabfieldcheck[23] = array();
$tabfieldcheck[24] = array();
+$tabfieldcheck[25] = 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);
@@ -442,7 +453,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$ok=1;
foreach ($listfield as $f => $value)
{
- if ($value == 'country' && in_array($tablib[$id],array('DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory
+ if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
@@ -489,7 +500,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'
';
}*/
}
- if (isset($_POST["country"]) && $_POST["country"]=='0')
+ if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
{
if (in_array($tablib[$id],array('DictionaryCompanyType')))
{
@@ -533,6 +544,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$sql.= $tabfieldinsert[$id];
$sql.=",active)";
$sql.= " VALUES(";
+
// List of values
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
$sql.= $newid.",";
@@ -846,6 +858,13 @@ if ($id)
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
+
+ if ($id == 2) // Special cas for state page
+ {
+ if ($fieldlist[$field]=='region_id') { $valuetoshow=' '; $showfield=1; }
+ if ($fieldlist[$field]=='region') { $valuetoshow=$langs->trans("Country").'/'.$langs->trans("Region"); $showfield=1; }
+ }
+
if ($valuetoshow != '')
{
print '