Fix for import / update search for existing record. If new record key (ex ID) was not set, search matched all (calendar doesn't support conditional importing, but it has the bug)

This commit is contained in:
Nathan Gray 2011-03-21 23:01:04 +00:00
parent 9d179bb27e
commit 8a102f94e8

View File

@ -192,16 +192,20 @@ class calendar_import_csv implements importexport_iface_import_plugin {
}
}
}
// Calendar doesn't actually support conditional importing
if ( $_definition->plugin_options['conditions'] ) {
foreach ( $_definition->plugin_options['conditions'] as $condition ) {
$records = array();
switch ( $condition['type'] ) {
// exists
case 'exists' :
$records = $this->bo->search(
);
if($record[$condition['string']]) {
$records = $this->bo->search(
// Calendar doesn't support searching the way we need
);
}
if ( is_array( $records ) && count( array_keys( $records ) >= 1 ) ) {
if ( is_array( $records ) && count( array_keys( $records )) >= 1) {
// apply action to all records matching this exists condition
$action = $condition['true'];
foreach ( (array)$records as $record ) {