Fix selection of email templates
This commit is contained in:
parent
59721bf8ed
commit
75172966c2
@ -160,7 +160,8 @@ if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$lang
|
|||||||
if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
|
if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
|
||||||
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
|
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
|
||||||
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
|
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
|
||||||
$elementList['other']=$langs->trans('Other');
|
$elementList['all']=$langs->trans('VisibleEverywhere');
|
||||||
|
$elementList['none']=$langs->trans('VisibleNowhere');
|
||||||
|
|
||||||
|
|
||||||
$parameters=array('elementList'=>$elementList);
|
$parameters=array('elementList'=>$elementList);
|
||||||
|
|||||||
@ -313,7 +313,7 @@ class FormMail extends Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs);
|
$result = $this->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs);
|
||||||
if ($result<0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
setEventMessages($this->error, $this->errors, 'errors');
|
setEventMessages($this->error, $this->errors, 'errors');
|
||||||
}
|
}
|
||||||
@ -321,6 +321,9 @@ class FormMail extends Form
|
|||||||
foreach($this->lines_model as $line)
|
foreach($this->lines_model as $line)
|
||||||
{
|
{
|
||||||
$modelmail_array[$line->id]=$line->label;
|
$modelmail_array[$line->id]=$line->label;
|
||||||
|
if ($line->lang) $modelmail_array[$line->id].=' ('.$line->lang.')';
|
||||||
|
if ($line->private) $modelmail_array[$line->id].=' - '.$langs->trans("Private");
|
||||||
|
//if ($line->fk_user != $user->id) $modelmail_array[$line->id].=' - '.$langs->trans("By").' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zone to select its email template
|
// Zone to select its email template
|
||||||
@ -337,11 +340,11 @@ class FormMail extends Form
|
|||||||
elseif (! empty($this->param['models']) && in_array($this->param['models'], array(
|
elseif (! empty($this->param['models']) && in_array($this->param['models'], array(
|
||||||
'propal_send','order_send','facture_send',
|
'propal_send','order_send','facture_send',
|
||||||
'shipping_send','fichinter_send','supplier_proposal_send','order_supplier_send',
|
'shipping_send','fichinter_send','supplier_proposal_send','order_supplier_send',
|
||||||
'invoice_supplier_send','thirdparty'
|
'invoice_supplier_send','thirdparty','all'
|
||||||
)))
|
)))
|
||||||
{
|
{
|
||||||
$out.= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
|
$out.= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
|
||||||
$out.= $langs->trans('SelectMailModel').': <select name="modelmailselected" disabled="disabled"><option value="none">'.$langs->trans("NoTemplateDefined").'</option></select>'; // Do not put disabled on option, it is already on select and it makes chrome crazy.
|
$out.= $langs->trans('SelectMailModel').': <select name="modelmailselected" disabled="disabled"><option value="none">'.$langs->trans("NoTemplateDefined").'</option></select>'; // Do not put 'disabled' on 'option' tag, it is already on 'select' and it makes chrome crazy.
|
||||||
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')),1);
|
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')),1);
|
||||||
$out.= ' ';
|
$out.= ' ';
|
||||||
$out.= '<input class="button" type="submit" value="'.$langs->trans('Apply').'" name="modelselected" disabled="disabled" id="modelselected">';
|
$out.= '<input class="button" type="submit" value="'.$langs->trans('Apply').'" name="modelselected" disabled="disabled" id="modelselected">';
|
||||||
@ -373,7 +376,7 @@ class FormMail extends Form
|
|||||||
{
|
{
|
||||||
$out.= '<input type="hidden" id="fromname" name="fromname" value="'.$this->fromname.'" />';
|
$out.= '<input type="hidden" id="fromname" name="fromname" value="'.$this->fromname.'" />';
|
||||||
$out.= '<input type="hidden" id="frommail" name="frommail" value="'.$this->frommail.'" />';
|
$out.= '<input type="hidden" id="frommail" name="frommail" value="'.$this->frommail.'" />';
|
||||||
$out.= '<tr><td width="180">'.$langs->trans("MailFrom").'</td><td>';
|
$out.= '<tr><td width="180" class="fieldrequired">'.$langs->trans("MailFrom").'</td><td>';
|
||||||
|
|
||||||
if (! ($this->fromtype === 'user' && $this->fromid > 0)
|
if (! ($this->fromtype === 'user' && $this->fromid > 0)
|
||||||
&& ! ($this->fromtype === 'company')
|
&& ! ($this->fromtype === 'company')
|
||||||
@ -939,7 +942,7 @@ class FormMail extends Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find if template exists
|
* Find if template exists and are available for current user, then set them into $this->lines_module.
|
||||||
* Search into table c_email_templates
|
* Search into table c_email_templates
|
||||||
*
|
*
|
||||||
* @param string $type_template Get message for key module
|
* @param string $type_template Get message for key module
|
||||||
@ -952,13 +955,13 @@ class FormMail extends Form
|
|||||||
{
|
{
|
||||||
$ret=array();
|
$ret=array();
|
||||||
|
|
||||||
$sql = "SELECT rowid, label, topic, content, content_lines, lang, position";
|
$sql = "SELECT rowid, label, topic, content, content_lines, lang, fk_user, private, position";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
|
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
|
||||||
$sql.= " WHERE type_template='".$this->db->escape($type_template)."'";
|
$sql.= " WHERE type_template IN ('".$this->db->escape($type_template)."', 'all')";
|
||||||
$sql.= " AND entity IN (".getEntity('c_email_templates', 0).")";
|
$sql.= " AND entity IN (".getEntity('c_email_templates', 0).")";
|
||||||
$sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")";
|
$sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // See all public templates or templates I own.
|
||||||
if ($active >= 0) $sql.=" AND active = ".$active;
|
if ($active >= 0) $sql.=" AND active = ".$active;
|
||||||
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
|
//if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')"; // Return all languages
|
||||||
$sql.= $this->db->order("position,lang,label","ASC");
|
$sql.= $this->db->order("position,lang,label","ASC");
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
@ -972,10 +975,13 @@ class FormMail extends Form
|
|||||||
$line = new ModelMail();
|
$line = new ModelMail();
|
||||||
$line->id=$obj->rowid;
|
$line->id=$obj->rowid;
|
||||||
$line->label=$obj->label;
|
$line->label=$obj->label;
|
||||||
|
$line->lang=$obj->lang;
|
||||||
|
$line->fk_user=$obj->fk_user;
|
||||||
|
$line->private=$obj->private;
|
||||||
|
$line->position=$obj->position;
|
||||||
$line->topic=$obj->topic;
|
$line->topic=$obj->topic;
|
||||||
$line->content=$obj->content;
|
$line->content=$obj->content;
|
||||||
$line->content_lines=$obj->content_lines;
|
$line->content_lines=$obj->content_lines;
|
||||||
$line->lang=$obj->lang;
|
|
||||||
$this->lines_model[]=$line;
|
$this->lines_model[]=$line;
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|||||||
@ -1674,6 +1674,8 @@ OpportunityPercent=When you create an opportunity, you will defined an estimated
|
|||||||
TemplateForElement=This template record is dedicated to which element
|
TemplateForElement=This template record is dedicated to which element
|
||||||
TypeOfTemplate=Type of template
|
TypeOfTemplate=Type of template
|
||||||
TemplateIsVisibleByOwnerOnly=Template is visible by owner only
|
TemplateIsVisibleByOwnerOnly=Template is visible by owner only
|
||||||
|
VisibleEverywhere=Visible everywhere
|
||||||
|
VisibleNowhere=Visible nowhere
|
||||||
FixTZ=TimeZone fix
|
FixTZ=TimeZone fix
|
||||||
FillFixTZOnlyIfRequired=Example: +2 (fill only if problem experienced)
|
FillFixTZOnlyIfRequired=Example: +2 (fill only if problem experienced)
|
||||||
ExpectedChecksum=Expected Checksum
|
ExpectedChecksum=Expected Checksum
|
||||||
|
|||||||
@ -24,7 +24,7 @@ FormatDateHourSecShort=%m/%d/%Y %I:%M:%S %p
|
|||||||
FormatDateHourTextShort=%b %d, %Y, %I:%M %p
|
FormatDateHourTextShort=%b %d, %Y, %I:%M %p
|
||||||
FormatDateHourText=%B %d, %Y, %I:%M %p
|
FormatDateHourText=%B %d, %Y, %I:%M %p
|
||||||
DatabaseConnection=Database connection
|
DatabaseConnection=Database connection
|
||||||
NoTemplateDefined=No template defined for this email type
|
NoTemplateDefined=No template available for this email type
|
||||||
AvailableVariables=Available substitution variables
|
AvailableVariables=Available substitution variables
|
||||||
NoTranslation=No translation
|
NoTranslation=No translation
|
||||||
NoRecordFound=No record found
|
NoRecordFound=No record found
|
||||||
@ -835,7 +835,7 @@ ShortThursday=T
|
|||||||
ShortFriday=F
|
ShortFriday=F
|
||||||
ShortSaturday=S
|
ShortSaturday=S
|
||||||
ShortSunday=S
|
ShortSunday=S
|
||||||
SelectMailModel=Select email template
|
SelectMailModel=Select an email template
|
||||||
SetRef=Set ref
|
SetRef=Set ref
|
||||||
Select2ResultFoundUseArrows=Some results found. Use arrows to select.
|
Select2ResultFoundUseArrows=Some results found. Use arrows to select.
|
||||||
Select2NotFound=No result found
|
Select2NotFound=No result found
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user