diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 9ecfc338661..899aba82057 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -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")
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 0d0d1835732..2c8bf65fe4a 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -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)).'
'; // 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."
\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;
diff --git a/htdocs/compta/facture/mergepdftool.php b/htdocs/compta/facture/mergepdftool.php
index 5d18dc05433..b6044e75d67 100644
--- a/htdocs/compta/facture/mergepdftool.php
+++ b/htdocs/compta/facture/mergepdftool.php
@@ -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;
diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php
index 146fb231b4c..58c48d5b254 100644
--- a/htdocs/core/actions_sendmails.inc.php
+++ b/htdocs/core/actions_sendmails.inc.php
@@ -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
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index c9e8ab7899d..bc185ef6d71 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -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.= ' ';
- $out.= '';
+ $out.= '';
$out.= ' ';
$out.= '';
}
+ 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.= '