[Tickets #6796] "add ... to My Address Book" problems based on composite name field

bugs at horde.org bugs at horde.org
Fri May 30 14:08:40 UTC 2008


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/6796
-----------------------------------------------------------------------
 Ticket             | 6796
 Created By         | liamr at umich.edu
 Summary            | "add ... to My Address Book" problems based on
composite name field
 Queue              | IMP
 Version            | 4.2
 Type               | Bug
 State              | Unconfirmed
 Priority           | 1. Low
 Milestone          |
 Patch              |
 Owners             |
-----------------------------------------------------------------------


liamr at umich.edu (2008-05-30 10:08) wrote:

I wasn't sure if this was a Turba problem or an IMP problem.

The "Add ... to my Address Book" button depends on the "name" field
definition for the source defined by $_prefs['add_source'].

In Turba 2.2, SQL based address books have split the name field up into
it's component fields - first, last, middle, prefix, suffix, etc..  The
default version of "name" is a composite version of all of those fields,
though an abbreviated "first and last only" version is given as an example
in the comments.

If you use the "full" version of the name field definition, "Add ... to my
Address Book" doesn't work, because the SQL it generates tries to match too
many things:

SELECT object_id, owner_id, object_type, object_members, object_uid,
object_firstname, object_lastname, object_middlenames,
object_nameprefix, object_namesuffix, object_alias, object_bday,
object_homestreet, object_homepob, object_homecity,
object_homeprovince, object_homepostalcode, object_homecountry,
object_workstreet, object_workpob, object_workcity,
object_workprovince, object_workpostalcode, object_workcountry,
object_tz, object_email, object_homephone, object_workphone,
object_cellphone, object_fax, object_pager, object_title, object_role,
object_company, object_category, object_notes, object_url,
object_freebusyurl, object_pgppublickey, object_smimepublickey FROM
turba_objects WHERE (
    owner_id = 'liamr'    AND (
        (
            (LOWER(object_nameprefix) LIKE LOWER('%Joe%') OR
LOWER(object_nameprefix) LIKE LOWER('%User%'))
            AND (LOWER(object_firstname) LIKE LOWER('%Joe%') OR
LOWER(object_firstname) LIKE LOWER('%User%'))
            AND (LOWER(object_middlenames) LIKE LOWER('%Joe%') OR
LOWER(object_middlenames) LIKE LOWER('%User%'))
            AND (LOWER(object_lastname) LIKE LOWER('%Joe%') OR
LOWER(object_lastname) LIKE LOWER('%User%'))
            AND (LOWER(object_namesuffix) LIKE
LOWER('%Joe%') OR LOWER(object_namesuffix) LIKE LOWER('%User%'))
        )    AND LOWER(object_email) LIKE LOWER('%juser at example.edu%')
    )
)

I guess it's possible it might work with a name that had all the
components ("Mr. Joseph Xavier User III"), but his SQL won't ever match
when given a name only made up of a first and last name.

Since it doesn't match, "Add ... to my Address Book" will allow you to add
the same address over and over again to your address book.

If you use the shorter version of the composite name field (first and last
only), you can add an address once, and subsequent attempts are met with a
notices that the entry "Already Exists".

Chuck thought it was a bug..

http://marc.info/?l=imp&m=121211283608734&w=2




More information about the bugs mailing list