* 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

This commit is contained in:
Klaus Leithoff 2011-09-19 10:29:23 +00:00
parent a79e748ac2
commit 06f84a1205
2 changed files with 15 additions and 10 deletions

View File

@ -169,15 +169,20 @@ class addressbook_import_contacts_csv implements importexport_iface_import_plugi
switch ( $condition['type'] ) { switch ( $condition['type'] ) {
// exists // exists
case '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( $contacts = $this->bocontacts->search(
//array( $condition['string'] => $record[$condition['string']],), //array( $condition['string'] => $record[$condition['string']],),
'', '',
$_definition->plugin_options['update_cats'] == 'add' ? false : true, $_definition->plugin_options['update_cats'] == 'add' ? false : true,
'', '', '', false, 'AND', false, '', '', '', false, 'AND', false,
array( $condition['string'] => $record[$condition['string']],) $searchcondition
); );
}
if ( is_array( $contacts ) && count( array_keys( $contacts ) >= 1 ) ) { if ( is_array( $contacts ) && count( array_keys( $contacts ) ) >= 1 ) {
// apply action to all contacts matching this exists condition // apply action to all contacts matching this exists condition
$action = $condition['true']; $action = $condition['true'];
foreach ( (array)$contacts as $contact ) { foreach ( (array)$contacts as $contact ) {

View File

@ -122,7 +122,7 @@ class addressbook_so
var $ldap_search_attributes = array( var $ldap_search_attributes = array(
'n_family','n_middle','n_given','org_name','org_unit', 'n_family','n_middle','n_given','org_name','org_unit',
'adr_one_location','adr_two_location','note', '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 * In SQL we can search all columns, though a view make on real sense