Attaching sent mails through mail manager
if using the integrated mail manager imap client and working with sent emails the system uses the from address rather than the to address for searching related records and creating records
Designs
- Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Link issues together to show that they're related.
Learn more.
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
well this is roughly the patch required, however MailManager is distributed in a package. Not quite sure how to contribute a fix for that.
diff --git a/layouts/vlayout/modules/MailManager/resources/MailManager.js b/layouts/vlayout/modules/MailManager/resources/MailManager.js index ecc7388..d65412f 100644 --- a/layouts/vlayout/modules/MailManager/resources/MailManager.js +++ b/layouts/vlayout/modules/MailManager/resources/MailManager.js @@ -766,6 +766,7 @@ if (typeof(MailManager) == 'undefined') { var meta = MailManager.mail_open_meta; AppConnector.request(MailManager._baseurl() + "_operation=relation&_operationarg=find&_mfrom=" + encodeURIComponent(meta['from']) + + '&_msendto='+ encodeURIComponent(meta['sendto']) + '&_folder=' +encodeURIComponent(meta['folder']) +'&_msgno=' +encodeURIComponent(meta['msgno']) +'&_msguid=' + encodeURIComponent(meta['msguid'].replace('<', '<').replace('>', '>'))).then(function(responseJSON) { responseJSON = JSON.parse(responseJSON); diff --git a/modules/MailManager/views/Mail.php b/modules/MailManager/views/Mail.php index 51b1757..a36ca49 100644 --- a/modules/MailManager/views/Mail.php +++ b/modules/MailManager/views/Mail.php @@ -39,6 +39,7 @@ class MailManager_Mail_View extends MailManager_Abstract_View { $metainfo = array( 'from' => $mail->from(), 'subject' => $mail->subject(), + 'sendto'=>$mail->to(), 'msgno' => $mail->msgNo(), 'msguid' => $mail->uniqueid(), 'folder' => $foldername ); @@ -323,4 +324,4 @@ class MailManager_Mail_View extends MailManager_Abstract_View { return $request->validateReadAccess(); } } -?> \ No newline at end of file +?> diff --git a/modules/MailManager/views/Relation.php b/modules/MailManager/views/Relation.php index 78e1717..6ce160e 100644 --- a/modules/MailManager/views/Relation.php +++ b/modules/MailManager/views/Relation.php @@ -55,7 +55,13 @@ class MailManager_Relation_View extends MailManager_Abstract_View { // Check if the message is already linked. $linkedto = MailManager_Relate_Action::associatedLink($request->get('_msguid')); - // If the message was not linked, lookup for matching records, using FROM address + // If the message was not linked, lookup for matching records, using FROM address unless it is in the sent folder + $folder=$request->get('_folder'); + if ($folder=="Sent"){ + $contacts=$request->get('_msendto'); + }else{ + $contacts=$request->get('_mfrom'); + } if (empty($linkedto)) { $results = array(); $modules = array(); @@ -63,10 +69,8 @@ class MailManager_Relation_View extends MailManager_Abstract_View { foreach (self::$MODULES as $MODULE) { if(!in_array($MODULE, $allowedModules)) continue; - $from = $request->get('_mfrom'); - if(empty($from)) continue; - - $results[$MODULE] = $this->lookupModuleRecordsWithEmail($MODULE, $from); + if(empty($contacts)) continue; + $results[$MODULE] = $this->lookupModuleRecordsWithEmail($MODULE, $contacts); $describe = $this->ws_describe($MODULE); $modules[$MODULE] = array('label' => $describe['label'], 'name' => textlength_check($describe['name']), 'id' => $describe['idPrefix'] ); @@ -417,21 +421,23 @@ class MailManager_Relation_View extends MailManager_Abstract_View { * @param Email Address $email * @return Array */ - public function lookupModuleRecordsWithEmail($module, $email) { + public function lookupModuleRecordsWithEmail($module, $emails) { $currentUserModel = vglobal('current_user'); - $query = $this->buildSearchQuery($module, $email, 'EMAIL'); - $qresults = vtws_query( $query, $currentUserModel ); - $describe = $this->ws_describe($module); - $labelFields = explode(',', $describe['labelFields']); - + //could be to multiple email addresses $results = array(); - foreach($qresults as $qresult) { - $labelValues = array(); - foreach($labelFields as $fieldname) { - if(isset($qresult[$fieldname])) $labelValues[] = $qresult[$fieldname]; + foreach(explode(",",$emails) as $email){ + $query = $this->buildSearchQuery($module, $email, 'EMAIL'); + $qresults = vtws_query( $query, $currentUserModel ); + $describe = $this->ws_describe($module); + $labelFields = explode(',', $describe['labelFields']); + foreach($qresults as $qresult) { + $labelValues = array(); + foreach($labelFields as $fieldname) { + if(isset($qresult[$fieldname])) $labelValues[] = $qresult[$fieldname]; + } + $ids = vtws_getIdComponents($qresult['id']); + $results[] = array( 'wsid' => $qresult['id'], 'id' => $ids[1], 'label' => implode(' ', $labelValues)); } - $ids = vtws_getIdComponents($qresult['id']); - $results[] = array( 'wsid' => $qresult['id'], 'id' => $ids[1], 'label' => implode(' ', $labelValues)); } return $results; }
- Alan Bell mentioned in merge request !50 (closed)
mentioned in merge request !50 (closed)
OK, done. I wonder if it would be possible to tweak the module manager stuff so that uncompressed directories could be treated as modules equivalent to zip files, would look much better here if the packages directory wasn't zip files, much easier to create and review diffs.
- Alan Bell mentioned in merge request !56 (merged)
mentioned in merge request !56 (merged)
- Alan Bell Status changed to closed
Status changed to closed
Please register or sign in to reply