mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-22 05:49:03 +01:00
WIP invoices: adding invoice-number to attachment name and fixing missing attachment/invoice if merging more then one (aka directly sending mail)
This commit is contained in:
parent
8ff5beb78f
commit
4df252b5d6
@ -7125,19 +7125,17 @@ class Mail
|
||||
$errorInfo = $email = '';
|
||||
$sendOK = $openComposeWindow = $openAsDraft = null;
|
||||
//error_log(__METHOD__.' ('.__LINE__.') '.' Id To Merge:'.$val);
|
||||
if (/*$GLOBALS['egw_info']['flags']['currentapp'] == 'addressbook' &&*/
|
||||
(count($SendAndMergeTocontacts) > 1 || $_folder === FALSE) && $val &&
|
||||
if ((count($SendAndMergeTocontacts) > 1 || $_folder === FALSE) && $val &&
|
||||
(is_numeric($val) || $GLOBALS['egw']->accounts->name2id($val))) // do the merge
|
||||
{
|
||||
//error_log(__METHOD__.' ('.__LINE__.') '.array2string($mailObject));
|
||||
|
||||
// Parse destinations for placeholders
|
||||
foreach(Mailer::$type2header as $type => $h)
|
||||
{
|
||||
//error_log('ID ' . $val . ' ' .$type . ': ' . $mailObject->getHeader(Mailer::$type2header[$type]) . ' -> ' .$bo_merge->merge_string($mailObject->getHeader(Mailer::$type2header[$type]),$val,$e,'text/plain',array(),self::$displayCharset));
|
||||
$merged = $bo_merge->merge_string($headers[$type],$val,$e,'text/plain',array(),self::$displayCharset);
|
||||
$merged = empty($headers[$type]) || strpos($headers[$type], '{{') === false ? $headers[$type] :
|
||||
$bo_merge->merge_string($headers[$type],$val,$e,'text/plain',array(),self::$displayCharset);
|
||||
$mailObject->clearAddresses($type);
|
||||
$mailObject->addAddress($merged,'',$type);
|
||||
$mailObject->addAddress($merged,'', $type);
|
||||
if($type == 'to')
|
||||
{
|
||||
$email = $merged;
|
||||
@ -7166,12 +7164,21 @@ class Mail
|
||||
$mailObject->removeHeader('Message-ID');
|
||||
$mailObject->removeHeader('Date');
|
||||
$mailObject->clearCustomHeaders();
|
||||
$mailObject->addHeader('Subject', $bo_merge->merge_string($Subject, $val, $e, 'text/plain', array(), self::$displayCharset));
|
||||
if (strpos($Subject, '{{') !== false)
|
||||
{
|
||||
$mailObject->addHeader('Subject', $bo_merge->merge_string($Subject, $val, $e, 'text/plain', array(), self::$displayCharset));
|
||||
}
|
||||
//error_log(__METHOD__.' ('.__LINE__.') '.' ContentType:'.$mailObject->BodyContentType);
|
||||
if($text_body) $text_body->setContents($bo_merge->merge_string($Body, $val, $e, 'text/plain', array(), self::$displayCharset),array('encoding'=>Horde_Mime_Part::DEFAULT_ENCODING));
|
||||
//error_log(__METHOD__.' ('.__LINE__.') '.' Result:'.$mailObject->Body.' error:'.array2string($e));
|
||||
if($html_body) $html_body->setContents($bo_merge->merge_string($AltBody, $val, $e, 'text/html', array(), self::$displayCharset),array('encoding'=>Horde_Mime_Part::DEFAULT_ENCODING));
|
||||
|
||||
// add attachments from app-specific merge-class
|
||||
foreach($bo_merge->getAttachments($val) as $file)
|
||||
{
|
||||
$mailObject->addAttachment($file);
|
||||
}
|
||||
|
||||
//error_log(__METHOD__.' ('.__LINE__.') '.array2string($mailObject));
|
||||
// set a higher timeout for big messages
|
||||
@set_time_limit(120);
|
||||
@ -7224,7 +7231,10 @@ class Mail
|
||||
$mailObject->addAddress(Horde_Idna::encode($email), $nfn);
|
||||
}
|
||||
}
|
||||
$mailObject->addHeader('Subject', $bo_merge->merge_string($Subject, $val, $e, 'text/plain', array(), self::$displayCharset));
|
||||
if (strpos($Subject, '{{') !== false)
|
||||
{
|
||||
$mailObject->addHeader('Subject', $bo_merge->merge_string($Subject, $val, $e, 'text/plain', array(), self::$displayCharset));
|
||||
}
|
||||
//error_log(__METHOD__.' ('.__LINE__.') '.' ContentType:'.$mailObject->BodyContentType);
|
||||
if (!empty($Body)) $text_body->setContents($bo_merge->merge_string($Body, $val, $e, 'text/plain', array(), self::$displayCharset),array('encoding'=>Horde_Mime_Part::DEFAULT_ENCODING));
|
||||
//error_log(__METHOD__.' ('.__LINE__.') '.' Result:'.$mailObject->Body.' error:'.array2string($e));
|
||||
|
Loading…
Reference in New Issue
Block a user