fix PHP Fatal, if phpgwapi is not installed

This commit is contained in:
Ralf Becker 2016-05-26 11:40:23 +02:00
parent 2b2845fff7
commit a4fb7696d7
2 changed files with 8 additions and 7 deletions

View File

@ -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

View File

@ -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);