Support equal import condition

This commit is contained in:
Nathan Gray 2014-06-16 16:22:18 +00:00
parent e7caf2a9f0
commit c3e673b747
2 changed files with 28 additions and 11 deletions

View File

@ -21,7 +21,7 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
* *
* @var array * @var array
*/ */
protected static $conditions = array( 'exists' ); protected static $conditions = array( 'exists', 'equal' );
/** /**
* @var bocontacts * @var bocontacts
@ -186,6 +186,22 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
$success = ($this->action( $action['action'], $record->get_record_array(), $import_csv->get_current_position() )); $success = ($this->action( $action['action'], $record->get_record_array(), $import_csv->get_current_position() ));
} }
break; break;
case 'equal':
// Match on field
$result = $this->equal($record, $condition, $matches);
if($result)
{
// Apply true action to any matching records found
$action = $condition['true'];
$success = ($this->action( $action['action'], $record->get_record_array(), $import_csv->get_current_position() ));
}
else
{
// Apply false action if no matching records found
$action = $condition['false'];
$success = ($this->action( $action['action'], $record->get_record_array(), $import_csv->get_current_position() ));
}
break;
// not supported action // not supported action
default : default :

View File

@ -63,6 +63,7 @@ class addressbook_wizard_import_contacts_csv extends importexport_wizard_basic_i
// Conditions // Conditions
$this->conditions = array( $this->conditions = array(
'exists' => lang('exists'), 'exists' => lang('exists'),
'equal' => '='
); );
} }