mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
Double check that field matches, accounts search matches anywhere inside
This commit is contained in:
parent
642ae665f8
commit
0482bfb898
@ -142,16 +142,28 @@ class admin_import_users_csv implements importexport_iface_import_plugin {
|
|||||||
switch ( $condition['type'] ) {
|
switch ( $condition['type'] ) {
|
||||||
// exists
|
// exists
|
||||||
case 'exists' :
|
case 'exists' :
|
||||||
$accounts = $GLOBALS['egw']->accounts->search(array(
|
$accounts = array();
|
||||||
'type' => 'accounts',
|
// Skip the search if the field is empty
|
||||||
'query' => $record[$condition['string']],
|
if($record[$condition['string']] !== '')
|
||||||
'query_type' => $condition['string']
|
{
|
||||||
));
|
$accounts = $GLOBALS['egw']->accounts->search(array(
|
||||||
|
'type' => 'accounts',
|
||||||
|
'query' => $record[$condition['string']],
|
||||||
|
'query_type' => $condition['string']
|
||||||
|
));
|
||||||
|
}
|
||||||
if ( is_array( $accounts ) && count( $accounts ) >= 1 ) {
|
if ( is_array( $accounts ) && count( $accounts ) >= 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)$accounts as $account ) {
|
foreach ( (array)$accounts as $account ) {
|
||||||
$record['account_id'] = $account['account_id'];
|
if($account[$condition['string']] == $record[$condition['string']]) {
|
||||||
|
$record['account_id'] = $account['account_id'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// It didn't match after all
|
||||||
|
$action = $condition['false'];
|
||||||
|
}
|
||||||
$success = $this->action( $action['action'], $record, $import_csv->get_current_position() );
|
$success = $this->action( $action['action'], $record, $import_csv->get_current_position() );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user