Fix message so it is more clear what the feature can do or not.

Fix list of email templates must be hidden for templates of disabled
modules.
This commit is contained in:
Laurent Destailleur 2015-12-18 12:45:04 +01:00
parent b10f9d4ca3
commit 98cd4f8307
7 changed files with 41 additions and 27 deletions

View File

@ -478,20 +478,16 @@ if ($id == 11)
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'),
'supplier_proposal_send' => $langs->trans('MailToSendSupplierRequestForQuotation'),
'order_supplier_send' => $langs->trans('MailToSendSupplierOrder'),
'invoice_supplier_send' => $langs->trans('MailToSendSupplierInvoice'),
'thirdparty' => $langs->trans('MailToThirdparty')
);
$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');
}
// Define localtax_typeList (used for dictionary "llx_c_tva")

View File

@ -329,10 +329,11 @@ if (empty($reshook))
$result=$mailfile->sendfile();
if ($result)
{
$resaction.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain "
$resaction.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)).'<br>'; // Must not contain "
$error=0;
// Insert logs into agenda
foreach($listofqualifiedinvoice as $invid => $object)
{
$actiontypecode='AC_FAC';
@ -357,16 +358,13 @@ if (empty($reshook))
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db);
$result=$interface->run_triggers('BILL_SENTBYMAIL',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
if ($result < 0) { $error++; $errors=$interface->errors; }
// Fin appel triggers
if (! $error)
if ($error)
{
$resaction.=$langs->trans("MailSent").': '.$sendto."<br>\n";
}
else
{
dol_print_error($db);
setEventMessages($db->lasterror(), $errors, 'errors');
dol_syslog("Error in trigger BILL_SENTBYMAIL ".$db->lasterror(), LOG_ERR);
}
$nbsent++;
}
@ -615,7 +613,7 @@ if ($resql)
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
dol_fiche_head(null, '', $langs->trans("SendByMail"));
dol_fiche_head(null, '', '');
$topicmail="SendBillRef";
$modelmail="facture_send";
@ -660,7 +658,7 @@ if ($resql)
$formmail->withtocc=1;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
$formmail->withfile=$langs->trans("EachInvoiceWillBeAttachedToEmail");
$formmail->withfile=$langs->trans("OnlyPDFattachmentSupported");
$formmail->withbody=1;
$formmail->withdeliveryreceipt=1;
$formmail->withcancel=1;

View File

@ -732,7 +732,7 @@ if ($resql)
$formmail->withtocc=1;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
$formmail->withfile=$langs->trans("EachInvoiceWillBeAttachedToEmail");
$formmail->withfile=$langs->trans("OnlyPDFattachmentSupported");
$formmail->withbody=1;
$formmail->withdeliveryreceipt=1;
$formmail->withcancel=1;

View File

@ -264,6 +264,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
}
}
}
// Send mail
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid);
@ -277,6 +278,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
if ($result)
{
$error=0;
// FIXME This must be moved into a trigger for action $trigger_name
if (! empty($conf->dolimail->enabled))
{
$mid = (GETPOST('mid','int') ? GETPOST('mid','int') : 0); // Original mail id is set ?
@ -295,7 +298,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
else setEventMessages($langs->trans("MailMovedToImapFolder_Warning",$folder), null, 'warnings');
}
}
// Initialisation of datas
$object->socid = $sendtosocid; // To link to a company
$object->sendtoid = $sendtoid; // To link to a contact/address

View File

@ -316,10 +316,25 @@ class FormMail extends Form
$out.= $langs->trans('SelectMailModel').': '.$this->selectarray('modelmailselected', $modelmail_array, 0, 1);
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
$out.= ' &nbsp; ';
$out.= '<input class="button" type="submit" value="'.$langs->trans('Valid').'" name="modelselected" id="modelselected">';
$out.= '<input class="button" type="submit" value="'.$langs->trans('Use').'" name="modelselected" id="modelselected">';
$out.= ' &nbsp; ';
$out.= '</div>';
}
elseif (! empty($this->param['models']) && in_array($this->param['models'], array(
'propal_send','order_send','facture_send',
'shipping_send','fichinter_send','supplier_proposal_send','order_supplier_send',
'invoice_supplier_send','thirdparty'
)))
{
$out.= '<div style="padding: 3px 0 3px 0">'."\n";
$out.= $langs->trans('SelectMailModel').': <select name="modelmailselected" disabled="disabled"><option value="none" disabled="disabled">'.$langs->trans("NoTemplateDefined").'</option></select>';
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
$out.= ' &nbsp; ';
$out.= '<input class="button" type="submit" value="'.$langs->trans('Use').'" name="modelselected" disabled="disabled" id="modelselected">';
$out.= ' &nbsp; ';
$out.= '</div>';
}
$out.= '<table class="border" width="100%">'."\n";

View File

@ -81,6 +81,7 @@ ActivateCheckReadKey=Key used to encrypt URL used for "Read Receipt" and "Unsubc
EMailSentToNRecipients=EMail sent to %s recipients.
XTargetsAdded=<b>%s</b> recipients added into target list
EachInvoiceWillBeAttachedToEmail=A document using default invoice document template will be created and attached to each email.
OnlyPDFattachmentSupported=If the PDF document was already generated for the invoice, it will be attached to email. If not, no email will be sent (also, note that only pdf invoice are supported as attachment in mass sending in this version).
MailTopicSendRemindUnpaidInvoices=Reminder of invoice %s (%s)
SendRemind=Send reminder by EMails
RemindSent=%s reminder(s) sent

View File

@ -24,6 +24,7 @@ FormatDateHourSecShort=%m/%d/%Y %I:%M:%S %p
FormatDateHourTextShort=%b %d, %Y, %I:%M %p
FormatDateHourText=%B %d, %Y, %I:%M %p
DatabaseConnection=Database connection
NoTemplateDefined=No template defined for this email type
NoTranslation=No translation
NoRecordFound=No record found
NoError=No error