fixed two mail2infolog problems: 1. instead of default status of email type done was used, 2. long lines of line-chars (-_+=~) stalled the infolog layout, they get now truncated to 40 of these chars

This commit is contained in:
Ralf Becker 2007-09-13 08:12:56 +00:00
parent a10101d640
commit 61270a0e0f

View File

@ -125,6 +125,13 @@ class boinfolog
* @var infolog_tracking * @var infolog_tracking
*/ */
var $tracking; var $tracking;
/**
* Maximum number of line characters (-_+=~) allowed in a mail, to not stall the layout.
* Longer lines / biger number of these chars are truncated to that max. number or chars.
*
* @var int
*/
var $max_line_chars = 40;
/** /**
* Constructor Infolog BO * Constructor Infolog BO
@ -875,15 +882,19 @@ class boinfolog
trim($address->host)); trim($address->host));
$name[] = !empty($address->personal) ? $address->personal : $emailadr; $name[] = !empty($address->personal) ? $address->personal : $emailadr;
} }
// shorten long (> $this->max_line_chars) lines of "line" chars (-_+=~) in mails
$_message = preg_replace_callback('/[-_+=~]{'.$this->max_line_chars.',}/m',
create_function('$matches',"return substr(\$matches[0],0,$this->max_line_chars);"),$_message);
$type = isset($this->enums['type']['email']) ? 'email' : 'note';
$info = array( $info = array(
'info_id' => 0, 'info_id' => 0,
'info_type' => isset($this->enums['type']['email']) ? 'email' : 'note', 'info_type' => $type,
'info_from' => implode(',',$name), 'info_from' => implode(',',$name),
'info_addr' => implode(',',$email), 'info_addr' => implode(',',$email),
'info_subject' => $_subject, 'info_subject' => $_subject,
'info_des' => $_message, 'info_des' => $_message,
'info_startdate' => $_date, 'info_startdate' => $_date,
'info_status' => 'done', 'info_status' => isset($this->status['defaults'][$type]) ? $this->status['defaults'][$type] : 'done',
'info_priority' => 1, 'info_priority' => 1,
'info_percent' => 100, 'info_percent' => 100,
'referer' => false, 'referer' => false,