Thomas Bruederli
2013-01-25 c4a1d3fe5ddfba37d94680c86614e8fc447955a0
Move rcmail_contact_key() to rcube_addressbook::compose_contact_key()
6 files modified
42 ■■■■ changed files
program/lib/Roundcube/rcube_addressbook.php 16 ●●●●● patch | view | raw | blame | history
program/steps/addressbook/delete.inc 2 ●●● patch | view | raw | blame | history
program/steps/addressbook/export.inc 2 ●●● patch | view | raw | blame | history
program/steps/addressbook/func.inc 18 ●●●●● patch | view | raw | blame | history
program/steps/addressbook/list.inc 2 ●●● patch | view | raw | blame | history
program/steps/addressbook/search.inc 2 ●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_addressbook.php
@@ -524,6 +524,22 @@
    }
    /**
     * Create a unique key for sorting contacts
     */
    public static function compose_contact_key($contact, $sort_col)
    {
        $key = $contact[$sort_col] . ':' . $row['sourceid'];
        // add email to a key to not skip contacts with the same name (#1488375)
        if (!empty($contact['email'])) {
             $key .= ':' . implode(':', (array)$contact['email']);
         }
         return $key;
    }
    /**
     * Compare search value with contact data
     *
     * @param string       $colname Data name
program/steps/addressbook/delete.inc
@@ -93,7 +93,7 @@
        while ($row = $result->next()) {
            $row['sourceid'] = $s;
            $key = rcmail_contact_key($row, $sort_col);
            $key = rcube_addressbook::compose_contact_key($row, $sort_col);
            $records[$key] = $row;
        }
        unset($result);
program/steps/addressbook/export.inc
@@ -42,7 +42,7 @@
        while ($row = $result->next()) {
            $row['sourceid'] = $s;
            $key = rcmail_contact_key($row, $sort_col);
            $key = rcube_addressbook::compose_contact_key($row, $sort_col);
            $records[$key] = $row;
        }
        unset($result);
program/steps/addressbook/func.inc
@@ -733,24 +733,6 @@
}
function rcmail_contact_key($row, $sort_col)
{
    $key = $row[$sort_col] . ':' . $row['sourceid'];
    // add email to a key to not skip contacts with the same name (#1488375)
    if (!empty($row['email'])) {
         if (is_array($row['email'])) {
             $key .= ':' . implode(':', $row['email']);
         }
         else {
             $key .= ':' . $row['email'];
         }
     }
     return $key;
}
/**
 * Returns contact ID(s) and source(s) from GET/POST data
 *
program/steps/addressbook/list.inc
@@ -49,7 +49,7 @@
        while ($row = $result->next()) {
            $row['sourceid'] = $s;
            $key = rcmail_contact_key($row, $sort_col);
            $key = rcube_addressbook::compose_contact_key($row, $sort_col);
            $records[$key] = $row;
        }
        unset($result);
program/steps/addressbook/search.inc
@@ -184,7 +184,7 @@
        while ($row = $result->next()) {
            $row['sourceid'] = $s['id'];
            $key = rcmail_contact_key($row, $sort_col);
            $key = rcube_addressbook::compose_contact_key($row, $sort_col);
            $records[$key] = $row;
        }