Aleksander Machniak
2015-06-06 10044b9033060b9409f97edda7d6f291b786b360
Fix Compose action in addressbook for results from multiple addressbooks (#1490413)
2 files modified
14 ■■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
program/steps/addressbook/mailto.inc 13 ●●●●● patch | view | raw | blame | history
CHANGELOG
@@ -12,6 +12,7 @@
- Implemented UI element to jump to specified page of the messages list (#1485235)
- Fix so unrecognized TNEF attachments are displayed on the list of attachments (#1490351)
- Fix "Importing..." message does not hide on error (#1490422)
- Fix Compose action in addressbook for results from multiple addressbooks (#1490413)
RELEASE 1.1.2
-------------
program/steps/addressbook/mailto.inc
@@ -21,7 +21,7 @@
$cids       = rcmail_get_cids();
$mailto     = array();
$recipients = null;
$sources = array();
foreach ($cids as $source => $cid) {
    $CONTACTS = $RCMAIL->get_address_book($source);
@@ -29,7 +29,7 @@
    if ($CONTACTS->ready) {
        $CONTACTS->set_page(1);
        $CONTACTS->set_pagesize(count($cid) + 2); // +2 to skip counting query
        $recipients = $CONTACTS->search($CONTACTS->primary_key, $cid, 0, true, true, 'email');
        $sources[] = $CONTACTS->search($CONTACTS->primary_key, $cid, 0, true, true, 'email');
    }
}
@@ -48,16 +48,19 @@
        $CONTACTS->set_group($group_id);
        $CONTACTS->set_page(1);
        $CONTACTS->set_pagesize(200); // limit somehow
        $recipients = $CONTACTS->list_records();
        $sources[] = $CONTACTS->list_records();
    }
}
if ($recipients) {
    while (is_object($recipients) && ($rec = $recipients->iterate())) {
foreach ($sources as $source) {
    while (is_object($source) && ($rec = $source->iterate())) {
        $emails = $CONTACTS->get_col_values('email', $rec, true);
        if (!empty($emails)) {
        $mailto[] = format_email_recipient($emails[0], $rec['name']);
    }
}
}
if (!empty($mailto)) {
    $mailto_str = join(', ', $mailto);