mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
Let calendar import return import errors
This commit is contained in:
parent
e377d1914c
commit
444f714020
@ -81,6 +81,11 @@ class import_events_csv implements iface_import_plugin {
|
|||||||
*/
|
*/
|
||||||
private $user = null;
|
private $user = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of import errors
|
||||||
|
*/
|
||||||
|
protected $errors = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* imports entries according to given definition object.
|
* imports entries according to given definition object.
|
||||||
* @param resource $_stream
|
* @param resource $_stream
|
||||||
@ -132,6 +137,8 @@ class import_events_csv implements iface_import_plugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->errors = array();
|
||||||
|
|
||||||
while ( $record = $import_csv->get_record() ) {
|
while ( $record = $import_csv->get_record() ) {
|
||||||
|
|
||||||
// don't import empty events
|
// don't import empty events
|
||||||
@ -224,7 +231,12 @@ class import_events_csv implements iface_import_plugin {
|
|||||||
if ( $this->dry_run ) {
|
if ( $this->dry_run ) {
|
||||||
print_r($_data);
|
print_r($_data);
|
||||||
} else {
|
} else {
|
||||||
return $this->bocalupdate->update( $_data, true, !$_data['modified'], $this->is_admin);
|
$messages = array();
|
||||||
|
$result = $this->bocalupdate->update( $_data, true, !$_data['modified'], $this->is_admin, true, $messages);
|
||||||
|
if(!$result) {
|
||||||
|
$this->errors = implode(',', $messages);
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'delete' :
|
case 'delete' :
|
||||||
@ -283,5 +295,17 @@ class import_events_csv implements iface_import_plugin {
|
|||||||
// lets do it!
|
// lets do it!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns errors that were encountered during importing
|
||||||
|
* Maximum of one error message per record, but you can append if you need to
|
||||||
|
*
|
||||||
|
* @return Array (
|
||||||
|
* record_# => error message
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
public function get_errors() {
|
||||||
|
return $this->errors;
|
||||||
|
}
|
||||||
|
|
||||||
} // end of iface_export_plugin
|
} // end of iface_export_plugin
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user