Skip to content
Snippets Groups Projects
Commit 05c9f57f authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Move edition of emails templates out of dictionaries so we would be able

to have templates per user (not reserved to admin).
parent f34e0b1b
Branches
Tags
No related merge requests found
...@@ -86,7 +86,7 @@ $hookmanager->initHooks(array('admin')); ...@@ -86,7 +86,7 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties // 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. // 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,27,0,5,11,0,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26,0,32,0); $taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,0,32,0);
// Name of SQL tables of dictionaries // Name of SQL tables of dictionaries
$tabname=array(); $tabname=array();
...@@ -114,7 +114,7 @@ $tabname[21]= MAIN_DB_PREFIX."c_availability"; ...@@ -114,7 +114,7 @@ $tabname[21]= MAIN_DB_PREFIX."c_availability";
$tabname[22]= MAIN_DB_PREFIX."c_input_reason"; $tabname[22]= MAIN_DB_PREFIX."c_input_reason";
$tabname[23]= MAIN_DB_PREFIX."c_revenuestamp"; $tabname[23]= MAIN_DB_PREFIX."c_revenuestamp";
$tabname[24]= MAIN_DB_PREFIX."c_type_resource"; $tabname[24]= MAIN_DB_PREFIX."c_type_resource";
$tabname[25]= MAIN_DB_PREFIX."c_email_templates"; //$tabname[25]= MAIN_DB_PREFIX."c_email_templates";
$tabname[26]= MAIN_DB_PREFIX."c_units"; $tabname[26]= MAIN_DB_PREFIX."c_units";
$tabname[27]= MAIN_DB_PREFIX."c_stcomm"; $tabname[27]= MAIN_DB_PREFIX."c_stcomm";
$tabname[28]= MAIN_DB_PREFIX."c_holiday_types"; $tabname[28]= MAIN_DB_PREFIX."c_holiday_types";
...@@ -151,7 +151,7 @@ $tablib[21]= "DictionaryAvailability"; ...@@ -151,7 +151,7 @@ $tablib[21]= "DictionaryAvailability";
$tablib[22]= "DictionarySource"; $tablib[22]= "DictionarySource";
$tablib[23]= "DictionaryRevenueStamp"; $tablib[23]= "DictionaryRevenueStamp";
$tablib[24]= "DictionaryResourceType"; $tablib[24]= "DictionaryResourceType";
$tablib[25]= "DictionaryEMailTemplates"; //$tablib[25]= "DictionaryEMailTemplates";
$tablib[26]= "DictionaryUnits"; $tablib[26]= "DictionaryUnits";
$tablib[27]= "DictionaryProspectStatus"; $tablib[27]= "DictionaryProspectStatus";
$tablib[28]= "DictionaryHolidayTypes"; $tablib[28]= "DictionaryHolidayTypes";
...@@ -188,7 +188,7 @@ $tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX ...@@ -188,7 +188,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[22]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
$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[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[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_lines, content, active FROM ".MAIN_DB_PREFIX."c_email_templates WHERE entity IN (".getEntity('email_template',1).")"; //$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content_lines, content, active FROM ".MAIN_DB_PREFIX."c_email_templates WHERE entity IN (".getEntity('email_template',1).")";
$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units"; $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"; $tabsql[27]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_stcomm";
$tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid"; $tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
...@@ -225,7 +225,7 @@ $tabsqlsort[21]="code ASC, label ASC"; ...@@ -225,7 +225,7 @@ $tabsqlsort[21]="code ASC, label ASC";
$tabsqlsort[22]="code ASC, label ASC"; $tabsqlsort[22]="code ASC, label ASC";
$tabsqlsort[23]="country ASC, taux ASC"; $tabsqlsort[23]="country ASC, taux ASC";
$tabsqlsort[24]="code ASC,label ASC"; $tabsqlsort[24]="code ASC,label ASC";
$tabsqlsort[25]="label ASC"; //$tabsqlsort[25]="label ASC";
$tabsqlsort[26]="code ASC"; $tabsqlsort[26]="code ASC";
$tabsqlsort[27]="code ASC"; $tabsqlsort[27]="code ASC";
$tabsqlsort[28]="country ASC, code ASC"; $tabsqlsort[28]="country ASC, code ASC";
...@@ -262,7 +262,7 @@ $tabfield[21]= "code,label"; ...@@ -262,7 +262,7 @@ $tabfield[21]= "code,label";
$tabfield[22]= "code,label"; $tabfield[22]= "code,label";
$tabfield[23]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note"; $tabfield[23]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note";
$tabfield[24]= "code,label"; $tabfield[24]= "code,label";
$tabfield[25]= "label,type_template,private,position,topic,content_lines,content"; //$tabfield[25]= "label,type_template,private,position,topic,content_lines,content";
$tabfield[26]= "code,label,short_label"; $tabfield[26]= "code,label,short_label";
$tabfield[27]= "code,libelle"; $tabfield[27]= "code,libelle";
$tabfield[28]= "code,label,affect,delay,newbymonth,country_id,country"; $tabfield[28]= "code,label,affect,delay,newbymonth,country_id,country";
...@@ -299,7 +299,7 @@ $tabfieldvalue[21]= "code,label"; ...@@ -299,7 +299,7 @@ $tabfieldvalue[21]= "code,label";
$tabfieldvalue[22]= "code,label"; $tabfieldvalue[22]= "code,label";
$tabfieldvalue[23]= "country,taux,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldvalue[23]= "country,taux,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldvalue[24]= "code,label"; $tabfieldvalue[24]= "code,label";
$tabfieldvalue[25]= "label,type_template,private,position,topic,content_lines,content"; //$tabfieldvalue[25]= "label,type_template,private,position,topic,content_lines,content";
$tabfieldvalue[26]= "code,label,short_label"; $tabfieldvalue[26]= "code,label,short_label";
$tabfieldvalue[27]= "code,libelle"; $tabfieldvalue[27]= "code,libelle";
$tabfieldvalue[28]= "code,label,affect,delay,newbymonth,country"; $tabfieldvalue[28]= "code,label,affect,delay,newbymonth,country";
...@@ -336,7 +336,7 @@ $tabfieldinsert[21]= "code,label"; ...@@ -336,7 +336,7 @@ $tabfieldinsert[21]= "code,label";
$tabfieldinsert[22]= "code,label"; $tabfieldinsert[22]= "code,label";
$tabfieldinsert[23]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldinsert[23]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldinsert[24]= "code,label"; $tabfieldinsert[24]= "code,label";
$tabfieldinsert[25]= "label,type_template,private,position,topic,content_lines,content,entity"; //$tabfieldinsert[25]= "label,type_template,private,position,topic,content_lines,content,entity";
$tabfieldinsert[26]= "code,label,short_label"; $tabfieldinsert[26]= "code,label,short_label";
$tabfieldinsert[27]= "code,libelle"; $tabfieldinsert[27]= "code,libelle";
$tabfieldinsert[28]= "code,label,affect,delay,newbymonth,fk_country"; $tabfieldinsert[28]= "code,label,affect,delay,newbymonth,fk_country";
...@@ -375,7 +375,7 @@ $tabrowid[21]= "rowid"; ...@@ -375,7 +375,7 @@ $tabrowid[21]= "rowid";
$tabrowid[22]= "rowid"; $tabrowid[22]= "rowid";
$tabrowid[23]= ""; $tabrowid[23]= "";
$tabrowid[24]= ""; $tabrowid[24]= "";
$tabrowid[25]= ""; //$tabrowid[25]= "";
$tabrowid[26]= ""; $tabrowid[26]= "";
$tabrowid[27]= "id"; $tabrowid[27]= "id";
$tabrowid[28]= ""; $tabrowid[28]= "";
...@@ -412,7 +412,7 @@ $tabcond[21]= ! empty($conf->propal->enabled); ...@@ -412,7 +412,7 @@ $tabcond[21]= ! empty($conf->propal->enabled);
$tabcond[22]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled)); $tabcond[22]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled));
$tabcond[23]= true; $tabcond[23]= true;
$tabcond[24]= ! empty($conf->resource->enabled); $tabcond[24]= ! empty($conf->resource->enabled);
$tabcond[25]= true; // && ! empty($conf->global->MAIN_EMAIL_EDIT_TEMPLATE_FROM_DIC); //$tabcond[25]= true; // && ! empty($conf->global->MAIN_EMAIL_EDIT_TEMPLATE_FROM_DIC);
$tabcond[26]= ! empty($conf->product->enabled); $tabcond[26]= ! empty($conf->product->enabled);
$tabcond[27]= ! empty($conf->societe->enabled); $tabcond[27]= ! empty($conf->societe->enabled);
$tabcond[28]= ! empty($conf->holiday->enabled); $tabcond[28]= ! empty($conf->holiday->enabled);
...@@ -449,7 +449,7 @@ $tabhelp[21] = array('code'=>$langs->trans("EnterAnyCode")); ...@@ -449,7 +449,7 @@ $tabhelp[21] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[22] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[22] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[23] = array(); $tabhelp[23] = array();
$tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[25] = array('topic'=>$langs->trans('SeeSubstitutionVars'),'content'=>$langs->trans('SeeSubstitutionVars'),'content_lines'=>$langs->trans('SeeSubstitutionVars'),'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList")); //$tabhelp[25] = array('topic'=>$langs->trans('SeeSubstitutionVars'),'content'=>$langs->trans('SeeSubstitutionVars'),'content_lines'=>$langs->trans('SeeSubstitutionVars'),'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"),'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically")); $tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"),'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"));
...@@ -486,7 +486,7 @@ $tabfieldcheck[21] = array(); ...@@ -486,7 +486,7 @@ $tabfieldcheck[21] = array();
$tabfieldcheck[22] = array(); $tabfieldcheck[22] = array();
$tabfieldcheck[23] = array(); $tabfieldcheck[23] = array();
$tabfieldcheck[24] = array(); $tabfieldcheck[24] = array();
$tabfieldcheck[25] = array(); //$tabfieldcheck[25] = array();
$tabfieldcheck[26] = array(); $tabfieldcheck[26] = array();
$tabfieldcheck[27] = array(); $tabfieldcheck[27] = array();
$tabfieldcheck[28] = array(); $tabfieldcheck[28] = array();
...@@ -544,29 +544,6 @@ if ($id == 11) ...@@ -544,29 +544,6 @@ if ($id == 11)
'external' => $langs->trans('External') 'external' => $langs->trans('External')
); );
} }
if ($id == 25)
{
// We save list of template email Dolibarr can manage. This list can found by a grep into code on "->param['models']"
$elementList = array();
if ($conf->propal->enabled) $elementList['propal_send']=$langs->trans('MailToSendProposal');
if ($conf->commande->enabled) $elementList['order_send']=$langs->trans('MailToSendOrder');
if ($conf->facture->enabled) $elementList['facture_send']=$langs->trans('MailToSendInvoice');
if ($conf->expedition->enabled) $elementList['shipping_send']=$langs->trans('MailToSendShipment');
if ($conf->ficheinter->enabled) $elementList['fichinter_send']=$langs->trans('MailToSendIntervention');
if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send']=$langs->trans('MailToSendSupplierRequestForQuotation');
if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder');
if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
$parameters=array('elementList'=>$elementList);
$reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks
if ($reshook == 0) {
foreach ($hookmanager->resArray as $item => $value) {
$elementList[$item] = $value;
}
}
}
// Define localtax_typeList (used for dictionary "llx_c_tva") // Define localtax_typeList (used for dictionary "llx_c_tva")
$localtax_typeList = array(); $localtax_typeList = array();
...@@ -1048,7 +1025,6 @@ if ($id) ...@@ -1048,7 +1025,6 @@ if ($id)
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); } if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); } if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); } if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); } if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); } if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); } if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
...@@ -1062,8 +1038,6 @@ if ($id) ...@@ -1062,8 +1038,6 @@ if ($id)
if ($fieldlist[$field]=='font_size') { $valuetoshow=$langs->trans("FontSize"); } if ($fieldlist[$field]=='font_size') { $valuetoshow=$langs->trans("FontSize"); }
if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); } if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); }
if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); } if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); }
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); }
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); } if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); } if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); }
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); } if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
...@@ -1116,36 +1090,19 @@ if ($id) ...@@ -1116,36 +1090,19 @@ if ($id)
if ($id == 3) unset($fieldlist[2]); // Remove field ??? if ??? if ($id == 3) unset($fieldlist[2]); // Remove field ??? if ???
if (empty($reshook)) if (empty($reshook))
{
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates' && $action == 'edit')
{
fieldList($fieldlist,$obj,$tabname[$id],'hide');
}
else
{ {
fieldList($fieldlist,$obj,$tabname[$id],'add'); fieldList($fieldlist,$obj,$tabname[$id],'add');
} }
}
if ($id == 4) print '<td></td>'; if ($id == 4) print '<td></td>';
print '<td colspan="3" align="right">'; print '<td colspan="3" align="right">';
if ($tabname[$id] != MAIN_DB_PREFIX.'c_email_templates' || $action != 'edit') if ($action != 'edit')
{ {
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">'; print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
} }
print '</td>'; print '</td>';
print "</tr>"; print "</tr>";
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates')
{
print '<tr><td colspan="8">* '.$langs->trans("AvailableVariables").": ";
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail=new FormMail($db);
$tmp=$formmail->getAvailableSubstitKey('form');
print implode(', ', $tmp);
print '</td></tr>';
}
$colspan=count($fieldlist)+3; $colspan=count($fieldlist)+3;
if ($id == 4) $colspan++; if ($id == 4) $colspan++;
...@@ -1240,7 +1197,6 @@ if ($id) ...@@ -1240,7 +1197,6 @@ if ($id)
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); } if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); } if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); } if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); } if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); } if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); } if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
...@@ -1254,8 +1210,6 @@ if ($id) ...@@ -1254,8 +1210,6 @@ if ($id)
if ($fieldlist[$field]=='font_size') { $valuetoshow=$langs->trans("FontSize"); } if ($fieldlist[$field]=='font_size') { $valuetoshow=$langs->trans("FontSize"); }
if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); } if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); }
if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); } if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); }
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); }
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); } if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); } if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); }
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); } if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
...@@ -1354,10 +1308,6 @@ if ($id) ...@@ -1354,10 +1308,6 @@ if ($id)
$showfield=1; $showfield=1;
$align="left"; $align="left";
$valuetoshow=$obj->{$fieldlist[$field]}; $valuetoshow=$obj->{$fieldlist[$field]};
if ($value == 'type_template')
{
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
}
if ($value == 'element') if ($value == 'element')
{ {
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow; $valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
...@@ -1726,13 +1676,6 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') ...@@ -1726,13 +1676,6 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang'); print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang');
print '</td>'; print '</td>';
} }
// Le type de template
elseif ($fieldlist[$field] == 'type_template')
{
print '<td>';
print $form->selectarray('type_template', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print '</td>';
}
// Le type de l'element (pour les type de contact) // Le type de l'element (pour les type de contact)
elseif ($fieldlist[$field] == 'element') elseif ($fieldlist[$field] == 'element')
{ {
...@@ -1773,42 +1716,6 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') ...@@ -1773,42 +1716,6 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
elseif (in_array($fieldlist[$field], array('libelle_facture'))) { elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea></td>'; print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea></td>';
} }
elseif (in_array($fieldlist[$field], array('content_lines')))
{
if ($tabname == MAIN_DB_PREFIX.'c_email_templates')
{
print '<td colspan="4"></td></tr><tr class="pair nohover"><td colspan="5">'; // To create an artificial CR for the current tr we are on
}
else print '<td>';
if ($context != 'hide')
{
//print '<input type="text" size="100" class="flat" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
$okforextended=true;
if ($tabname == MAIN_DB_PREFIX.'c_email_templates' && empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 100, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_1, '90%');
print $doleditor->Create(1);
}
else print '&nbsp;';
print '</td>';
}
elseif (in_array($fieldlist[$field], array('content')))
{
if ($tabname == MAIN_DB_PREFIX.'c_email_templates')
{
print '<td colspan="4"></td></tr><tr class="pair nohover"><td colspan="5">'; // To create an artificial CR for the current tr we are on
}
else print '<td>';
if ($context != 'hide')
{
//print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
$okforextended=true;
if ($tabname == MAIN_DB_PREFIX.'c_email_templates' && empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_8, '90%');
print $doleditor->Create(1);
}
else print '&nbsp;';
print '</td>';
}
elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) { elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) {
print '<td><input type="text" class="flat minwidth75" value="'.price((! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')).'" name="'.$fieldlist[$field].'"></td>'; print '<td><input type="text" class="flat minwidth75" value="'.price((! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')).'" name="'.$fieldlist[$field].'"></td>';
} }
......
...@@ -114,17 +114,24 @@ $server=! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_S ...@@ -114,17 +114,24 @@ $server=! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_S
if (! $server) $server='127.0.0.1'; if (! $server) $server='127.0.0.1';
/*
* View
*/
$wikihelp='EN:Setup EMails|FR:Paramétrage EMails|ES:Configuración EMails'; $wikihelp='EN:Setup EMails|FR:Paramétrage EMails|ES:Configuración EMails';
llxHeader('',$langs->trans("Setup"),$wikihelp); llxHeader('',$langs->trans("Setup"),$wikihelp);
print load_fiche_titre($langs->trans("EMailsSetup"),'','title_setup'); print load_fiche_titre($langs->trans("EMailsSetup"),'','title_setup');
print $langs->trans("EMailsDesc")."<br>\n";
print "<br>\n"; $h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/mails.php";
$head[$h][1] = $langs->trans("OutGoingEmailSetup");
$head[$h][2] = 'common';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
$head[$h][1] = $langs->trans("DictionaryEMailTemplates");
$head[$h][2] = 'templates';
$h++;
// List of sending methods // List of sending methods
$listofmethods=array(); $listofmethods=array();
...@@ -221,6 +228,12 @@ if ($action == 'edit') ...@@ -221,6 +228,12 @@ if ($action == 'edit')
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
dol_fiche_head($head, 'common', '');
print $langs->trans("EMailsDesc")."<br>\n";
print "<br>\n";
clearstatcache(); clearstatcache();
$var=true; $var=true;
...@@ -428,6 +441,8 @@ if ($action == 'edit') ...@@ -428,6 +441,8 @@ if ($action == 'edit')
print '</table>'; print '</table>';
dol_fiche_end();
print '<br><div class="center">'; print '<br><div class="center">';
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">'; print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
...@@ -438,6 +453,12 @@ if ($action == 'edit') ...@@ -438,6 +453,12 @@ if ($action == 'edit')
} }
else else
{ {
dol_fiche_head($head, 'common', '');
print $langs->trans("EMailsDesc")."<br>\n";
print "<br>\n";
$var=true; $var=true;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
...@@ -571,9 +592,11 @@ else ...@@ -571,9 +592,11 @@ else
} }
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
dol_fiche_end();
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)) if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
{ {
print '<br>'; print '<br>';
...@@ -619,7 +642,7 @@ else ...@@ -619,7 +642,7 @@ else
print '</div>'; print '</div>';
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && ! in_array($action, array('testconnect', 'test', 'testhtml')))
{ {
$text = $langs->trans("WarningPHPMail"); $text = $langs->trans("WarningPHPMail");
print info_admin($text); print info_admin($text);
......
This diff is collapsed.
...@@ -46,9 +46,10 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; ...@@ -46,9 +46,10 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
$langs->load("errors"); $langs->load("errors");
$langs->load("admin"); $langs->load("admin");
$mode=GETPOST('mode', 'alpha')?GETPOST('mode', 'alpha'):0; $mode=GETPOST('mode', 'alpha');
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
if (empty($mode)) $mode='desc';
if (! $user->admin) if (! $user->admin)
accessforbidden(); accessforbidden();
...@@ -232,17 +233,15 @@ asort($orders); ...@@ -232,17 +233,15 @@ asort($orders);
$h = 0; $h = 0;
$categidx='desc'; // Main
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=desc'; $head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=desc';
$head[$h][1] = $langs->trans("Description"); $head[$h][1] = $langs->trans("Description");
$head[$h][2] = 'desc'; $head[$h][2] = 'desc';
$h++; $h++;
/*$categidx='feature';
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=feature'; $head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=feature';
$head[$h][1] = $langs->trans("Features"); $head[$h][1] = $langs->trans("Features");
$head[$h][2] = 'feature'; $head[$h][2] = 'feature';
$h++;*/ $h++;
$i=0; $i=0;
...@@ -357,9 +356,9 @@ if ($objMod->isCoreOrExternalModule() == 'external') ...@@ -357,9 +356,9 @@ if ($objMod->isCoreOrExternalModule() == 'external')
// Define text of description of module // Define text of description of module
$text=''; $text='';
if ($objMod->getDescLong()) $text.=$objMod->getDesc().'<br>'; if ($mode == 'desc')
{
$text.='<br><strong>'.$langs->trans("Version").':</strong> '.$version; $text.='<strong>'.$langs->trans("Version").':</strong> '.$version;
$textexternal=''; $textexternal='';
if ($objMod->isCoreOrExternalModule() == 'external') if ($objMod->isCoreOrExternalModule() == 'external')
...@@ -379,7 +378,12 @@ if (! empty($conf->global->$const_name)) $text.=dol_print_date($objMod->getLastA ...@@ -379,7 +378,12 @@ if (! empty($conf->global->$const_name)) $text.=dol_print_date($objMod->getLastA
else $text.=$langs->trans("Disabled"); else $text.=$langs->trans("Disabled");
$text.='<br>'; $text.='<br>';
$text.='<br><strong>'.$langs->trans("AddRemoveTabs").':</strong> '; if ($objMod->getDescLong()) $text.=$objMod->getDesc().'<br>';
}
if ($mode == 'feature')
{
$text.='<strong>'.$langs->trans("AddRemoveTabs").':</strong> ';
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs)) if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
{ {
$i=0; $i=0;
...@@ -506,9 +510,10 @@ else $text.=$langs->trans("No"); ...@@ -506,9 +510,10 @@ else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> '; $text.='<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> ';
$text.=$langs->trans("DetectionNotPossible"); $text.=$langs->trans("DetectionNotPossible");
}
print $text;
print $text;
dol_fiche_end(); dol_fiche_end();
......
...@@ -984,7 +984,7 @@ class FormMail extends Form ...@@ -984,7 +984,7 @@ class FormMail extends Form
*/ */
function setSubstitFromObject($object, $outputlangs=null) function setSubstitFromObject($object, $outputlangs=null)
{ {
global $user; global $conf, $user;
$this->substit['__REF__'] = $object->ref; $this->substit['__REF__'] = $object->ref;
$this->substit['__REFCLIENT__'] = isset($object->ref_client) ? $object->ref_client : ''; $this->substit['__REFCLIENT__'] = isset($object->ref_client) ? $object->ref_client : '';
$this->substit['__REFSUPPLIER__'] = isset($object->ref_supplier) ? $object->ref_supplier : ''; $this->substit['__REFSUPPLIER__'] = isset($object->ref_supplier) ? $object->ref_supplier : '';
...@@ -993,6 +993,7 @@ class FormMail extends Form ...@@ -993,6 +993,7 @@ class FormMail extends Form
$this->substit['__DATE_DUE_YMD__'] = isset($object->date_lim_reglement)? dol_print_date($object->date_lim_reglement, 'day', 0, $outputlangs) : ''; $this->substit['__DATE_DUE_YMD__'] = isset($object->date_lim_reglement)? dol_print_date($object->date_lim_reglement, 'day', 0, $outputlangs) : '';
$this->substit['__AMOUNT__'] = price($object->total_ttc); $this->substit['__AMOUNT__'] = price($object->total_ttc);
$this->substit['__AMOUNT_WO_TAX__'] = price($object->total_ht); $this->substit['__AMOUNT_WO_TAX__'] = price($object->total_ht);
$this->substit['__AMOUNT_VAT__'] = price($object->total_tva);
$this->substit['__THIRDPARTY_ID__'] = (is_object($object->thirdparty)?$object->thirdparty->id:''); $this->substit['__THIRDPARTY_ID__'] = (is_object($object->thirdparty)?$object->thirdparty->id:'');
$this->substit['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty)?$object->thirdparty->name:''); $this->substit['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty)?$object->thirdparty->name:'');
...@@ -1005,6 +1006,7 @@ class FormMail extends Form ...@@ -1005,6 +1006,7 @@ class FormMail extends Form
$this->substit['__PERSONALIZED__'] = ''; $this->substit['__PERSONALIZED__'] = '';
$this->substit['__CONTACTCIVNAME__'] = ''; // Will be replace just before sending $this->substit['__CONTACTCIVNAME__'] = ''; // Will be replace just before sending
//Fill substit_lines with each object lines content //Fill substit_lines with each object lines content
if (is_array($object->lines)) if (is_array($object->lines))
{ {
...@@ -1022,10 +1024,10 @@ class FormMail extends Form ...@@ -1022,10 +1024,10 @@ class FormMail extends Form
'__SUBPRICE__' => price($line->subprice), '__SUBPRICE__' => price($line->subprice),
'__AMOUNT__' => price($line->total_ttc), '__AMOUNT__' => price($line->total_ttc),
'__AMOUNT_WO_TAX__' => price($line->total_ht), '__AMOUNT_WO_TAX__' => price($line->total_ht),
//'__PRODUCT_EXTRAFIELD_FIELD__' Done dinamically //'__PRODUCT_EXTRAFIELD_FIELD__' Done dinamically just after
); );
// Create dinamic tags for __PRODUCT_EXTRAFIELD_FIELD__ // Create dynamic tags for __PRODUCT_EXTRAFIELD_FIELD__
if (!empty($line->fk_product)) if (!empty($line->fk_product))
{ {
$extrafields = new ExtraFields($this->db); $extrafields = new ExtraFields($this->db);
...@@ -1045,7 +1047,7 @@ class FormMail extends Form ...@@ -1045,7 +1047,7 @@ class FormMail extends Form
/** /**
* Set substit array from object * Set substit array from object
* *
* @param string $mode 'form' or 'emailing' * @param string $mode 'form', 'formwithlines', 'formforlines' or 'emailing'
* @return void * @return void
*/ */
function getAvailableSubstitKey($mode='form') function getAvailableSubstitKey($mode='form')
...@@ -1054,18 +1056,32 @@ class FormMail extends Form ...@@ -1054,18 +1056,32 @@ class FormMail extends Form
$vars=array(); $vars=array();
if ($mode == 'form') if ($mode == 'form' || $mode == 'formwithlines' || $mode == 'formforlines')
{ {
$vars=array( $vars=array(
'__REF__', '__REF__',
'__REFCLIENT__', '__REFCLIENT__',
'__REFSUPPLIER__',
'__THIRDPARTY_ID__',
'__THIRDPARTY_NAME__', '__THIRDPARTY_NAME__',
'__PROJECT_ID__',
'__PROJECT_REF__', '__PROJECT_REF__',
'__PROJECT_NAME__', '__PROJECT_NAME__',
'__CONTACTCIVNAME__', '__CONTACTCIVNAME__',
'__AMOUNT__',
'__AMOUNT_WO_TAX__',
'__AMOUNT_VAT__',
'__PERSONALIZED__', // Paypal link will be added here in form mode '__PERSONALIZED__', // Paypal link will be added here in form mode
'__SIGNATURE__', '__SIGNATURE__',
); );
if ($mode == 'formwithlines')
{
$vars[] = '__LINES__'; // Will be set by the get_form function
}
if ($mode == 'formforlines')
{
$vars[] = '__QUANTITY__'; // Will be set by the get_form function
}
} }
if ($mode == 'emailing') if ($mode == 'emailing')
{ {
......
...@@ -1623,6 +1623,7 @@ MailToSendIntervention=To send intervention ...@@ -1623,6 +1623,7 @@ MailToSendIntervention=To send intervention
MailToSendSupplierRequestForQuotation=To send quotation request to supplier MailToSendSupplierRequestForQuotation=To send quotation request to supplier
MailToSendSupplierOrder=To send supplier order MailToSendSupplierOrder=To send supplier order
MailToSendSupplierInvoice=To send supplier invoice MailToSendSupplierInvoice=To send supplier invoice
MailToSendContract=To send a contract
MailToThirdparty=To send email from third party page MailToThirdparty=To send email from third party page
ByDefaultInList=Show by default on list view ByDefaultInList=Show by default on list view
YouUseLastStableVersion=You use the latest stable version YouUseLastStableVersion=You use the latest stable version
......
...@@ -150,3 +150,6 @@ AdvTgtCreateFilter=Create filter ...@@ -150,3 +150,6 @@ AdvTgtCreateFilter=Create filter
AdvTgtOrCreateNewFilter=Name of new filter AdvTgtOrCreateNewFilter=Name of new filter
NoContactWithCategoryFound=No contact/address with a category found NoContactWithCategoryFound=No contact/address with a category found
NoContactLinkedToThirdpartieWithCategoryFound=No contact/address with a category found NoContactLinkedToThirdpartieWithCategoryFound=No contact/address with a category found
OutGoingEmailSetup=Outgoing email setup
InGoingEmailSetup=Incoming email setup
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment