Change searching for existing accounts/groups which matches anywhere in user name, we need exact match

This commit is contained in:
Nathan Gray 2012-01-26 15:46:37 +00:00
parent ddf0354784
commit 8e0ca08113
2 changed files with 31 additions and 10 deletions

View File

@ -123,11 +123,22 @@ class admin_import_groups_csv implements importexport_iface_import_plugin {
switch ( $condition['type'] ) {
// exists
case 'exists' :
$accounts = $GLOBALS['egw']->accounts->search(array(
'type' => 'groups',
'query' => $record[$condition['string']],
'query_type' => $condition['string']
));
$accounts = array();
// Skip the search if the field is empty
if($record[$condition['string']] !== '') {
$accounts = $GLOBALS['egw']->accounts->search(array(
'type' => 'groups',
'query' => $record[$condition['string']],
'query_type' => $condition['string']
));
}
// Search looks in the given field, but doesn't do an exact match
foreach ( (array)$accounts as $key => $account )
{
if($account[$condition['string']] != $record[$condition['string']]) unset($accounts[$key]);
}
if ( is_array( $accounts ) && count( $accounts ) >= 1 ) {
$account = current($accounts);
// apply action to all contacts matching this exists condition

View File

@ -142,11 +142,21 @@ class admin_import_users_csv implements importexport_iface_import_plugin {
switch ( $condition['type'] ) {
// exists
case 'exists' :
$accounts = $GLOBALS['egw']->accounts->search(array(
'type' => 'accounts',
'query' => $record[$condition['string']],
'query_type' => $condition['string']
));
$accounts = array();
// Skip the search if the field is empty
if($record[$condition['string']] !== '')
{
$accounts = $GLOBALS['egw']->accounts->search(array(
'type' => 'accounts',
'query' => $record[$condition['string']],
'query_type' => $condition['string']
));
}
// Search looks in the given field, but doesn't do an exact match
foreach ( (array)$accounts as $key => $account )
{
if($account[$condition['string']] != $record[$condition['string']]) unset($accounts[$key]);
}
if ( is_array( $accounts ) && count( $accounts ) >= 1 ) {
// apply action to all contacts matching this exists condition
$action = $condition['true'];