From a4fb7696d7e05c3da22fba1b115c314807e7e7ca Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 26 May 2016 11:40:23 +0200 Subject: [PATCH] fix PHP Fatal, if phpgwapi is not installed --- .../inc/class.importexport_basic_import_csv.inc.php | 6 +++--- importexport/inc/class.importexport_schedule_ui.inc.php | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/importexport/inc/class.importexport_basic_import_csv.inc.php b/importexport/inc/class.importexport_basic_import_csv.inc.php index c34ee63796..ce767f0525 100644 --- a/importexport/inc/class.importexport_basic_import_csv.inc.php +++ b/importexport/inc/class.importexport_basic_import_csv.inc.php @@ -192,7 +192,7 @@ abstract class importexport_basic_import_csv implements importexport_iface_impor { set_time_limit(10); } - + // Keep a few records for preview, but process the whole file if($this->dry_run && $import_csv->get_current_position() < $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs']) { @@ -481,7 +481,7 @@ abstract class importexport_basic_import_csv implements importexport_iface_impor if(!is_null($n_given)) $n_given = trim($n_given); if (!is_object($contacts)) { - $contacts =& CreateObject('phpgwapi.contacts'); + $contacts = new Api\Contacts(); } if (!is_null($org_name)) // org_name given? { @@ -649,7 +649,7 @@ error_log("Searching for $custom_field = $value"); public function get_warnings() { return $this->warnings; } - + /** * Returns errors that were encountered during importing * Maximum of one error message per record, but you can append if you need to diff --git a/importexport/inc/class.importexport_schedule_ui.inc.php b/importexport/inc/class.importexport_schedule_ui.inc.php index b6fc2affa2..a7f8c821a9 100644 --- a/importexport/inc/class.importexport_schedule_ui.inc.php +++ b/importexport/inc/class.importexport_schedule_ui.inc.php @@ -36,6 +36,7 @@ class importexport_schedule_ui public function index($content = array()) { + $async = new Api\Asyncservice(); if(is_array($content['scheduled'])) { foreach($content['scheduled'] as $row) @@ -43,11 +44,11 @@ class importexport_schedule_ui if($row['delete']) { $key = urldecode(key($row['delete'])); - ExecMethod('phpgwapi.asyncservice.cancel_timer', $key); + $async->cancel_timer($key); } } } - $async_list = ExecMethod('phpgwapi.asyncservice.read', 'importexport%'); + $async_list = $async->read('importexport%'); $data = array(); if(is_array($async_list)) { @@ -344,7 +345,7 @@ class importexport_schedule_ui { return self::is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); } - + // check tmp file for read/write capabilities $rm = file_exists($path); $f = @fopen($path, 'a'); @@ -618,7 +619,7 @@ class importexport_schedule_ui $async = new Api\Asyncservice(); $jobs = $async->read($id); $job = $jobs[$id]; - + if(is_array($job)) { $async->cancel_timer($id);