From eb0d6b31bd870ffbb7048d8407ee205a6f1d8013 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Mon, 19 Sep 2011 10:17:15 +0000 Subject: [PATCH] * addressbook/csv-import: fix/enable update of account - userdata when accounts are stored with ldap. If the condition is on account_id, we supplement the condition with owner=0 (this is needed to correctly determine the storage engine (ldap/sql) for accounts); we strongly recomment NOT to try to use this for adding accounts: use admin import definitions for that task --- .../inc/class.addressbook_import_contacts_csv.inc.php | 6 +++++- addressbook/inc/class.addressbook_so.inc.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/addressbook/inc/class.addressbook_import_contacts_csv.inc.php b/addressbook/inc/class.addressbook_import_contacts_csv.inc.php index 028da17b6a..437edcd74d 100644 --- a/addressbook/inc/class.addressbook_import_contacts_csv.inc.php +++ b/addressbook/inc/class.addressbook_import_contacts_csv.inc.php @@ -212,12 +212,16 @@ class addressbook_import_contacts_csv implements importexport_iface_import_plugi // exists case 'exists' : if($record[$condition['string']]) { + $searchcondition = array( $condition['string'] => $record[$condition['string']]); + // if we use account_id for the condition, we need to set the owner for filtering, as this + // enables addressbook_so to decide what backend is to be used + if ($condition['string']=='account_id') $searchcondition['owner']=0; $contacts = $this->bocontacts->search( //array( $condition['string'] => $record[$condition['string']],), '', $_definition->plugin_options['update_cats'] == 'add' ? false : true, '', '', '', false, 'AND', false, - array( $condition['string'] => $record[$condition['string']]) + $searchcondition ); } if ( is_array( $contacts ) && count( array_keys( $contacts ) ) >= 1 ) { diff --git a/addressbook/inc/class.addressbook_so.inc.php b/addressbook/inc/class.addressbook_so.inc.php index f649df03b4..f3ba3be8be 100755 --- a/addressbook/inc/class.addressbook_so.inc.php +++ b/addressbook/inc/class.addressbook_so.inc.php @@ -122,7 +122,7 @@ class addressbook_so var $ldap_search_attributes = array( 'n_family','n_middle','n_given','org_name','org_unit', 'adr_one_location','adr_two_location','note', - 'email','mozillasecondemail', + 'email','mozillasecondemail','uidnumber', ); /** * In SQL we can search all columns, though a view make on real sense