Changeset View
Changeset View
Standalone View
Standalone View
core/units/helpers/csv_helper.php
Show First 20 Lines • Show All 297 Lines • ▼ Show 20 Line(s) | |||||
} | } | ||||
if($fail) continue; | if($fail) continue; | ||||
if($object->Load($key_array)) { | if($object->Load($key_array)) { | ||||
$action = 'Update'; | $action = 'Update'; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
// 2. set object fields | // 2. set object fields. | ||||
foreach($import_data['field_list'] as $position => $field_name) { | foreach ( $import_data['field_list'] as $position => $field_name ) { | ||||
if(isset($data[$position])) { | if ( isset($data[$position]) ) { | ||||
$formatter_class = $object->GetFieldOption($field_name, 'formatter'); | |||||
if ( $formatter_class !== false ) { | |||||
$formatter = $this->Application->recallObject($formatter_class); | |||||
// Date columns from grid are exported as 1 field so read them as 1 field as well. | |||||
if ( $formatter instanceof kDateFormatter ) { | |||||
$object->SetDBField($field_name . '_combined', 1); | |||||
} | |||||
} | |||||
$object->SetField($field_name, $data[$position]); | $object->SetField($field_name, $data[$position]); | ||||
} | } | ||||
} | } | ||||
// 3. validate item and run event | // 3. validate item and run event | ||||
$status = $object->Validate(); | $status = $object->Validate(); | ||||
$import_event->status = $status ? kEvent::erSUCCESS : kEvent::erFAIL; | $import_event->status = $status ? kEvent::erSUCCESS : kEvent::erFAIL; | ||||
$this->Application->HandleEvent($import_event); | $this->Application->HandleEvent($import_event); | ||||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |