An easier to use dictionary page to edit email template.

Uniformize look.
This commit is contained in:
Laurent Destailleur 2015-07-04 03:28:52 +02:00
parent 0ac43211ad
commit 9c80735310
9 changed files with 120 additions and 54 deletions

View File

@ -227,7 +227,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";
$tabfield[25]= "label,type_template,position,topic,content";
$tabfield[26]= "code,label,short_label";
$tabfield[27]= "code,libelle";
$tabfield[28]= "code,label,delay,newByMonth,country_id,country";
@ -259,7 +259,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";
$tabfieldvalue[25]= "label,type_template,position,topic,content";
$tabfieldvalue[26]= "code,label,short_label";
$tabfieldvalue[27]= "code,libelle";
$tabfieldvalue[28]= "code,label,delay,newByMonth,country";
@ -291,7 +291,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";
$tabfieldinsert[25]= "label,type_template,position,topic,content";
$tabfieldinsert[26]= "code,label,short_label";
$tabfieldinsert[27]= "code,libelle";
$tabfieldinsert[28]= "code,label,delay,newByMonth,fk_country";
@ -389,7 +389,7 @@ $tabhelp[21] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[22] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[23] = array();
$tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[25] = array('type_template'=>$langs->trans("TemplateFor"),'private'=>$langs->trans("TemplateIsVisibleByYouOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[25] = array('type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[28] = array('delay'=>$langs->trans("MinimumNoticePeriod"), 'newByMonth'=>$langs->trans("NbAddedAutomatically"));
@ -469,6 +469,24 @@ if ($id == 11)
'external' => $langs->trans('External')
);
}
if ($id == 25)
{
// We save list of template type Dolibarr can manage. This list can found by a grep into code on "->param['models']"
$elementList = array(
'propal_send' => $langs->trans('MailToSendProposal'),
'order_send' => $langs->trans('MailToSendOrder'),
'facture_send' => $langs->trans('MailToSendInvoice'),
'shipping_send' => $langs->trans('MailToSendShipment'),
'fichinter_send' => $langs->trans('MailToSendIntervention'),
'askpricesupplier_send' => $langs->trans('MailToSendSupplierRequestForQuotation'),
'order_supplier_send' => $langs->trans('MailToSendSupplierOrder'),
'invoice_supplier_send' => $langs->trans('MailToSendSupplierInvoice'),
'thirdparty' => $langs->trans('MailToThirdparty')
);
}
// Define localtax_typeList (used for dictionary "llx_c_tva")
$localtax_typeList = array();
@ -904,6 +922,7 @@ if ($id)
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($id == 2) // Special cas for state page
{
@ -970,6 +989,8 @@ if ($id)
print '</form>';
// List of available values in database
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
$resql=$db->query($sql);
@ -984,7 +1005,7 @@ if ($id)
if ($num > $listlimit)
{
print '<tr class="none"><td align="right" colspan="'.(3+count($fieldlist)).'">';
print_fleche_navigation($page,$_SERVER["PHP_SELF"],'&id='.$id,($num > $listlimit),$langs->trans("Page").' '.($page+1));
print_fleche_navigation($page, $_SERVER["PHP_SELF"], '&id='.$id, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
print '</td></tr>';
}
@ -1042,6 +1063,7 @@ if ($id)
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
// Affiche nom du champ
if ($showfield)
@ -1097,6 +1119,10 @@ if ($id)
$showfield=1;
$align="left";
$valuetoshow=$obj->$fieldlist[$field];
if ($value == 'type_template')
{
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
}
if ($value == 'element')
{
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
@ -1407,7 +1433,8 @@ function fieldList($fieldlist,$obj='',$tabname='')
foreach ($fieldlist as $field => $value)
{
if ($fieldlist[$field] == 'country') {
if ($fieldlist[$field] == 'country')
{
if (in_array('region_id',$fieldlist))
{
print '<td>';
@ -1420,7 +1447,8 @@ function fieldList($fieldlist,$obj='',$tabname='')
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28);
print '</td>';
}
elseif ($fieldlist[$field] == 'country_id') {
elseif ($fieldlist[$field] == 'country_id')
{
if (! in_array('country',$fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate)
{
$country_id = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0);
@ -1429,22 +1457,32 @@ function fieldList($fieldlist,$obj='',$tabname='')
print '</td>';
}
}
elseif ($fieldlist[$field] == 'region') {
elseif ($fieldlist[$field] == 'region')
{
print '<td>';
$formcompany->select_region($region_id,'region');
print '</td>';
}
elseif ($fieldlist[$field] == 'region_id') {
elseif ($fieldlist[$field] == 'region_id')
{
$region_id = (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:0);
print '<td>';
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">';
print '</td>';
}
elseif ($fieldlist[$field] == 'lang') {
elseif ($fieldlist[$field] == 'lang')
{
print '<td>';
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang');
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)
elseif ($fieldlist[$field] == 'element')
{

View File

@ -992,6 +992,9 @@ else
// Print mail content
print_fiche_titre($langs->trans("EMail"),'','');
dol_fiche_head('');
print '<table class="border" width="100%">';
// Subject
@ -1042,7 +1045,8 @@ else
print '</tr>';
print '</table>';
print "<br>";
dol_fiche_end();
}
else
{

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2005-2015 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
*
@ -408,20 +408,17 @@ if ($object->fetch($id) >= 0)
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder);
// Date sending
if ($object->statut < 2)
{
print '<td class="liste_titre">&nbsp;</td>';
print_liste_field_titre('');
}
else
{
print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print '</tr>';
// Ligne des champs de filtres
@ -458,7 +455,6 @@ if ($object->fetch($id) >= 0)
//Search Icon
print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '&nbsp; ';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Reset"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print '</tr>';
@ -518,9 +514,6 @@ if ($object->fetch($id) >= 0)
{
print '<td align="center">&nbsp;</td>';
print '<td align="right" class="nowrap">'.$langs->trans("MailingStatusNotSent");
if ($user->rights->mailing->creer && $allowaddtarget) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$obj->rowid.$param.'">'.img_delete($langs->trans("RemoveRecipient"));
}
print '</td>';
}
else
@ -532,7 +525,14 @@ if ($object->fetch($id) >= 0)
}
//Sreach Icon
print '<td></td>';
print '<td align="right">';
if ($obj->statut == 0)
{
if ($user->rights->mailing->creer && $allowaddtarget) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$obj->rowid.$param.'">'.img_delete($langs->trans("RemoveRecipient"));
}
}
print '</td>';
print '</tr>';
$i++;
@ -540,7 +540,7 @@ if ($object->fetch($id) >= 0)
}
else
{
print '<tr '.$bc[false].'><td colspan="7">'.$langs->trans("NoTargetYet").'</td></tr>';
print '<tr '.$bc[false].'><td colspan="8">'.$langs->trans("NoTargetYet").'</td></tr>';
}
print "</table><br>";

View File

@ -2288,6 +2288,9 @@ if ($action == 'create')
}
print "<br>\n";
//Select mail models is same action as presend
if (GETPOST('modelselected')) $action = 'presend';
if ($action != 'presend')
{
print '<div class="fichecenter"><div class="fichehalfleft">';
@ -2330,10 +2333,6 @@ if ($action == 'create')
/*
* Action presend
*/
//Select mail models is same action as presend
if (GETPOST('modelselected')) {
$action = 'presend';
}
if ($action == 'presend')
{
$object->fetch_projet();
@ -2369,8 +2368,11 @@ if ($action == 'create')
$file = $fileparams['fullname'];
}
print '<div class="clearboth"></div>';
print '<br>';
print_titre($langs->trans('SendPropalByMail'));
print_titre($langs->trans('SendPropalByMail'), '', 'object_email');
dol_fiche_head('');
// Create form object
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
@ -2439,7 +2441,7 @@ if ($action == 'create')
print $formmail->get_form();
print '<br>';
dol_fiche_end();
}
}

View File

@ -32,6 +32,7 @@
* \ingroup commande
* \brief Page to show customer order
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formorder.class.php';
@ -2362,8 +2363,11 @@ if ($action == 'create' && $user->rights->commande->creer)
$file = $fileparams['fullname'];
}
print '<div class="clearboth"></div>';
print '<br>';
print_titre($langs->trans('SendOrderByMail'));
print_fiche_titre($langs->trans('SendOrderByMail'), '', 'object_email');
dol_fiche_head('');
// Cree l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
@ -2402,8 +2406,10 @@ if ($action == 'create' && $user->rights->commande->creer)
$contactarr = array();
$contactarr = $object->liste_contact(- 1, 'external');
if (is_array($contactarr) && count($contactarr) > 0) {
foreach ($contactarr as $contact) {
if (is_array($contactarr) && count($contactarr) > 0)
{
foreach ($contactarr as $contact)
{
if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label
$contactstatic = new Contact($db);
$contactstatic->fetch($contact ['id']);
@ -2432,7 +2438,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Show form
print $formmail->get_form();
print '<br>';
dol_fiche_end();
}
}
}

View File

@ -2502,8 +2502,8 @@ if ($action == 'create')
}
print '<br>';
}
else if ($id > 0 || ! empty($ref))
}
else if ($id > 0 || ! empty($ref))
{
/*
* Show object in view mode
@ -2860,7 +2860,7 @@ else if ($id > 0 || ! empty($ref))
$outstandingBills = $soc->get_OutstandingBill();
print ' - ' . $langs->trans('CurrentOutstandingBill') . ': ';
print price($outstandingBills, '', $langs, 0, 0, - 1, $conf->currency);
if ($soc->outstanding_limit != '')
if ($soc->outstanding_limit != '')
{
if ($outstandingBills > $soc->outstanding_limit)
print img_warning($langs->trans("OutstandingBillReached"));
@ -2950,7 +2950,7 @@ else if ($id > 0 || ! empty($ref))
} else
print '. ';
}
if ($absolute_creditnote > 0)
if ($absolute_creditnote > 0)
{
// If validated, we show link "add credit note to payment"
if ($object->statut != 1 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) {
@ -3855,8 +3855,9 @@ else if ($id > 0 || ! empty($ref))
$file = $fileparams['fullname'];
}
print '<div class="clearboth"></div>';
print '<br>';
print_titre($langs->trans($titreform));
print_titre($langs->trans($titreform), '', 'object_email');
// Cree l'objet formulaire mail
dol_fiche_head();

View File

@ -276,7 +276,8 @@ class FormMail extends Form
// Get message template
$model_id=0;
if (array_key_exists('models_id',$this->param)) {
if (array_key_exists('models_id',$this->param))
{
$model_id=$this->param["models_id"];
}
$arraydefaultmessage=$this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id);
@ -295,23 +296,26 @@ class FormMail extends Form
}
$result = $this->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs);
if ($result<0) {
if ($result<0)
{
setEventMessage($this->error,'errors');
}
$modelmail_array=array();
foreach($this->lines_model as $line) {
foreach($this->lines_model as $line)
{
$modelmail_array[$line->id]=$line->label;
}
if (count($modelmail_array)>0) {
$out.= '<table class="nobordernopadding" width="100%"><tr><td width="20%">'."\n";
// Zone to select its email template
if (count($modelmail_array)>0)
{
$out.= '<div style="padding: 3px 0 3px 0">'."\n";
$out.= $langs->trans('SelectMailModel').':'.$this->selectarray('modelmailselected', $modelmail_array,$model_id);
$out.= '</td>';
$out.= '<td width="5px">';
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
$out.= '</td>';
$out.= '<td><input class="flat" type="submit" value="'.$langs->trans('Valid').'" name="modelselected" id="modelselected"></td>';
$out.= '</tr></table>';
$out.= ' &nbsp; ';
$out.= '<input class="button" type="submit" value="'.$langs->trans('Valid').'" name="modelselected" id="modelselected">';
$out.= ' &nbsp; ';
$out.= '</div>';
}

View File

@ -2901,11 +2901,11 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
* @param string $file Page URL (in most cases provided with $_SERVER["PHP_SELF"])
* @param string $options Other url paramaters to propagate ("" by default)
* @param integer $nextpage Do we show a next page button
* @param string $betweenarrows HTML content to show between arrows. Must contains '<li> </li>' tags.
* @param string $betweenarrows HTML content to show between arrows. MUST contains '<li> </li>' tags or '<li><span> </span></li>'.
* @param string $afterarrows HTML content to show after arrows. Must NOT contains '<li> </li>' tags.
* @return void
*/
function print_fleche_navigation($page,$file,$options='',$nextpage=0,$betweenarrows='',$afterarrows='')
function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betweenarrows='', $afterarrows='')
{
global $conf, $langs;
@ -2915,8 +2915,10 @@ function print_fleche_navigation($page,$file,$options='',$nextpage=0,$betweenarr
if (empty($conf->dol_use_jmobile)) print '<li class="pagination"><a class="paginationprevious" href="'.$file.'?page='.($page-1).$options.'"><</a></li>';
else print '<li><a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$file.'?page='.($page-1).$options.'">'.$langs->trans("Previous").'</a></li>';
}
//if ($betweenarrows) print ($page > 0?' ':'').$betweenarrows.($nextpage>0?' ':'');
print $betweenarrows;
if ($betweenarrows)
{
print $betweenarrows;
}
if ($nextpage > 0)
{
if (empty($conf->dol_use_jmobile)) print '<li class="pagination"><a class="paginationnext" href="'.$file.'?page='.($page+1).$options.'">></a></li>';

View File

@ -1660,6 +1660,15 @@ SellTaxRate=Sale tax rate
RecuperableOnly=Yes for VAT "Non Perçue Récupérable" dedicated for some state in France. Keep value to "No" in all other cases.
UrlTrackingDesc=If the provider or transport service offer a page or web site to check status of your shipment, you can enter it here. You can use the key {TRACKID} into URL parameters so the system will replace it with value of tracking number user entered into shipment card.
OpportunityPercent=When you create an opportunity, you will defined an estimated amount of project/lead. According to status of opportunity, this amount may be multiplicated by this rate to evaluate global amount all your opportunities may generate. Value is percent (between 0 and 100).
TemplateForElement=This template record is dedicated to which element
TypeOfTemplate=Type of template
TemplateIsVisibleByOwnerOnly=Template is visible by owner only
MailToSendProposal=To send customer proposal
MailToSendOrder=To send customer order
MailToSendInvoice=To send customer invoice
MailToSendShipment=To send shipment
MailToSendIntervention=To send intervention
MailToSendSupplierRequestForQuotation=To send quotation request to supplier
MailToSendSupplierOrder=To send supplier order
MailToSendSupplierInvoice=To send supplier invoice
MailToThirdparty=To send email from thirdparty page