forked from Wavyzz/dolibarr
Fix add invoice to email
This commit is contained in:
@@ -1278,7 +1278,6 @@ if ($ispaymentok) {
|
||||
$msg = $outputlangs->trans("OrganizationEventPaymentOfRegistrationWasReceived");
|
||||
}
|
||||
|
||||
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty);
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||
|
||||
@@ -1291,7 +1290,22 @@ if ($ispaymentok) {
|
||||
|
||||
$ishtml = dol_textishtml($texttosend); // May contain urls
|
||||
|
||||
$mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml);
|
||||
// Attach a file ?
|
||||
$file = '';
|
||||
$listofpaths = array();
|
||||
$listofnames = array();
|
||||
$listofmimes = array();
|
||||
if (is_object($object)) {
|
||||
$invoicediroutput = $conf->facture->dir_output;
|
||||
$fileparams = dol_most_recent_file($invoicediroutput.'/'.$object->ref, preg_quote($object->ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
|
||||
$listofpaths = array($file);
|
||||
$listofnames = array(basename($file));
|
||||
$listofmimes = array(dol_mimetype($file));
|
||||
}
|
||||
|
||||
$mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, $listofpaths, $listofmimes, $listofnames, '', '', 0, $ishtml);
|
||||
|
||||
$result = $mailfile->sendfile();
|
||||
if ($result) {
|
||||
|
||||
Reference in New Issue
Block a user