BUG-12282 attach documents into emails using original name doesn't work SOLVED
- Cuando se esta enviando un email y guardar el mismo los attach documents se guardaban como cadenas solo con el path. - se cambio la forma de guardado desde ahora se guarda un serializado de los datos donde puede haber un array asociativo donde si el key es numerico envia sin nombre y si tuviera otro valor lo asocia como el nombre del file en el email.
This commit is contained in:
@@ -138,10 +138,8 @@ class spoolRun
|
||||
*/
|
||||
public function create ($aData)
|
||||
{
|
||||
if (is_array($aData['app_msg_attach'])) {
|
||||
$attachment = implode(",", $aData['app_msg_attach']);
|
||||
$aData['app_msg_attach'] = $attachment;
|
||||
}
|
||||
$attachment = (is_array($aData['app_msg_attach'])) ? $aData['app_msg_attach'] : unserialize($aData['app_msg_attach']);
|
||||
$aData['app_msg_attach'] = serialize($attachment);
|
||||
$aData['app_msg_show_message'] = (isset($aData['app_msg_show_message'])) ? $aData['app_msg_show_message'] : 1;
|
||||
$sUID = $this->db_insert( $aData );
|
||||
|
||||
@@ -184,7 +182,7 @@ class spoolRun
|
||||
$this->fileData['cc'] = $sCC;
|
||||
$this->fileData['bcc'] = $sBCC;
|
||||
$this->fileData['template'] = $sTemplate;
|
||||
$this->fileData['attachments'] = is_array( $aAttachment ) ? $aAttachment : ($aAttachment != '' ? explode( ',', $aAttachment ) : array ());
|
||||
$this->fileData['attachments'] = is_string($aAttachment) ? $aAttachment : (is_array($aAttachment) ? $aAttachment : (($aAttachment != '') ? explode(',', $aAttachment) : array()));
|
||||
$this->fileData['envelope_to'] = array ();
|
||||
$this->fileData["contentTypeIsHtml"] = $bContentTypeIsHtml;
|
||||
|
||||
@@ -443,8 +441,13 @@ class spoolRun
|
||||
|
||||
$oPHPMailer->Body = $msBody;
|
||||
|
||||
if (is_array( $this->fileData['attachments'] )) {
|
||||
foreach ($this->fileData['attachments'] as $key => $fileAttach) {
|
||||
if (is_array($this->fileData['attachments'])) {
|
||||
$attachment = $this->fileData['attachments'];
|
||||
} else {
|
||||
$attachment = unserialize($this->fileData['attachments']);
|
||||
}
|
||||
if (is_array($attachment)) {
|
||||
foreach ($attachment as $key => $fileAttach) {
|
||||
if (file_exists( $fileAttach )) {
|
||||
$oPHPMailer->AddAttachment( $fileAttach, is_int( $key ) ? '' : $key );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user