Move rcmail_contact_key() to rcube_addressbook::compose_contact_key()
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | |
| | | 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); |
| | |
| | | |
| | | 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); |
| | |
| | | } |
| | | |
| | | |
| | | 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 |
| | | * |
| | |
| | | |
| | | 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); |
| | |
| | | |
| | | 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; |
| | | } |
| | | |