Fix bug that ignored 'stop' in import condition, default definition

This commit is contained in:
Nathan Gray 2012-05-29 14:37:19 +00:00
parent 57be9157d5
commit de8bc4771c
2 changed files with 7 additions and 18 deletions

View File

@ -190,7 +190,8 @@ class addressbook_import_contacts_csv implements importexport_iface_import_plugi
// Also handle categories in their own field // Also handle categories in their own field
$more_categories = array(); $more_categories = array();
foreach($_definition->plugin_options['field_mapping'] as $number => $field_name) { foreach($_definition->plugin_options['field_mapping'] as $number => $field_name) {
if(substr($field_name,0,3) != 'cat' || !$record[$field_name] || $field_name == 'cat_id') continue; if(!array_key_exists($field_name, $record) ||
substr($field_name,0,3) != 'cat' || !$record[$field_name] || $field_name == 'cat_id') continue;
list($cat, $cat_id) = explode('-', $field_name); list($cat, $cat_id) = explode('-', $field_name);
if(is_numeric($record[$field_name]) && $record[$field_name] != 1) { if(is_numeric($record[$field_name]) && $record[$field_name] != 1) {
// Column has a single category ID // Column has a single category ID
@ -258,7 +259,7 @@ class addressbook_import_contacts_csv implements importexport_iface_import_plugi
die('condition / action not supported!!!'); die('condition / action not supported!!!');
break; break;
} }
if ($action['last']) break; if ($action['stop']) break;
} }
} else { } else {
// unconditional insert // unconditional insert

View File

@ -240,25 +240,13 @@
<entry type="string" name="stop">1</entry> <entry type="string" name="stop">1</entry>
</entry> </entry>
</entry> </entry>
<entry type="array" name="1">
<entry type="string" name="string">id</entry>
<entry type="string" name="type">exists</entry>
<entry type="array" name="true">
<entry type="string" name="action">update</entry>
<entry type="string" name="stop">1</entry>
</entry>
<entry type="array" name="false">
<entry type="string" name="action">insert</entry>
<entry type="string" name="stop">1</entry>
</entry>
</entry>
</entry> </entry>
<entry type="string" name="owner_from_csv">1</entry> <entry type="string" name="owner_from_csv">1</entry>
<entry type="string" name="contact_owner">personal</entry> <entry type="string" name="contact_owner">personal</entry>
<entry type="string" name="change_owner">0</entry> <entry type="string" name="change_owner">0</entry>
<entry type="string" name="convert">1</entry> <entry type="string" name="convert">1</entry>
</entry> </entry>
<entry type="string" name="modified">2012-05-15 16:46:54</entry> <entry type="string" name="modified">2012-05-29 16:00:00</entry>
</entry> </entry>
</entry> </entry>
</entry> </entry>