diff --git a/addressbook/inc/class.addressbook_export_contacts_csv.inc.php b/addressbook/inc/class.addressbook_export_contacts_csv.inc.php index 807599ebe8..427a657e6e 100644 --- a/addressbook/inc/class.addressbook_export_contacts_csv.inc.php +++ b/addressbook/inc/class.addressbook_export_contacts_csv.inc.php @@ -40,7 +40,11 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi // Addressbook defines its own export imits $limit_exception = bo_merge::is_export_limit_excepted(); - if($GLOBALS['egw_info']['server']['contact_export_limit'] == 'no' && !$limit_exception) { +error_log(__METHOD__.__LINE__.'#'.$GLOBALS['egw_info']['server']['contact_export_limit'].'#'); +error_log(__METHOD__.__LINE__.'#'.bo_merge::getExportLimit().'#'); + $export_limit = $export_object->export_limit = bo_merge::getExportLimit($GLOBALS['egw_info']['server']['contact_export_limit']); +error_log(__METHOD__.__LINE__.'#'.$export_limit.'#'); + if($export_limit == 'no' && !$limit_exception) { return; } @@ -65,8 +69,8 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi } $GLOBALS['egw_info']['flags']['currentapp'] = $old_app; - if($GLOBALS['egw_info']['server']['contact_export_limit'] && !$limit_exception) { - $selection = array_slice($selection, 0, $GLOBALS['egw_info']['server']['contact_export_limit']); + if(bo_merge::hasExportLimit($export_limit,'ISALLOWED') && !$limit_exception) { + $selection = array_slice($selection, 0, $export_limit); } if($options['explode_multiselects']) { $customfields = config::get_customfields('addressbook'); diff --git a/addressbook/inc/class.addressbook_merge.inc.php b/addressbook/inc/class.addressbook_merge.inc.php index 9c5de48f7a..b175edee2a 100644 --- a/addressbook/inc/class.addressbook_merge.inc.php +++ b/addressbook/inc/class.addressbook_merge.inc.php @@ -32,10 +32,7 @@ class addressbook_merge extends bo_merge parent::__construct(); // overwrite global export-limit, if an addressbook one is set - if ($GLOBALS['egw_info']['server']['contact_export_limit']) - { - $this->export_limit = $GLOBALS['egw_info']['server']['contact_export_limit']; - } + $this->export_limit = bo_merge::getExportLimit($GLOBALS['egw_info']['server']['contact_export_limit']); } /** diff --git a/calendar/inc/class.calendar_bo.inc.php b/calendar/inc/class.calendar_bo.inc.php index edf45ec72e..183033acf9 100644 --- a/calendar/inc/class.calendar_bo.inc.php +++ b/calendar/inc/class.calendar_bo.inc.php @@ -1491,7 +1491,7 @@ class calendar_bo { //_debug_array($event); $names = array(); - foreach($event['participants'] as $id => $status) + foreach((array)$event['participants'] as $id => $status) { calendar_so::split_status($status,$quantity,$role); diff --git a/calendar/inc/class.calendar_export_csv.inc.php b/calendar/inc/class.calendar_export_csv.inc.php index 7829b55580..04619bed9d 100644 --- a/calendar/inc/class.calendar_export_csv.inc.php +++ b/calendar/inc/class.calendar_export_csv.inc.php @@ -24,10 +24,9 @@ class calendar_export_csv implements importexport_iface_export_plugin { public function export( $_stream, importexport_definition $_definition) { $options = $_definition->plugin_options; $this->bo = new calendar_bo(); - $config = config::read('phpgwapi'); $limit_exception = bo_merge::is_export_limit_excepted(); - + if (!$limit_exception) $export_limit = bo_merge::getExportLimit($GLOBALS['egw_info']['server']['calendar_export_limit']); // Custom fields need to be specifically requested $cfs = array(); foreach($options['mapping'] as $key => $label) { @@ -39,14 +38,14 @@ class calendar_export_csv implements importexport_iface_export_plugin { 'start' => $options['selection']['start'], 'end' => $options['selection']['end'], 'categories' => $options['categories'] ? $options['categories'] : $options['selection']['categories'], - 'enum_recuring' => false, + //'enum_recuring' => false, // we want the recurring events enumerated for csv export 'daywise' => false, 'users' => $options['selection']['owner'], 'cfs' => $cfs // Otherwise we shouldn't get any custom fields ); - if($config['export_limit'] && !$limit_exception) { + if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { $query['offset'] = 0; - $query['num_rows'] = (int)$config['export_limit']; + $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 } $events =& $this->bo->search($query); } elseif ($options['selection']['select'] == 'search_results') { @@ -57,8 +56,8 @@ class calendar_export_csv implements importexport_iface_export_plugin { $query['start'] = 0; $query['cfs'] = $cfs; - if($config['export_limit'] && !$limit_exception) { - $query['num_rows'] = (int)$config['export_limit']; + if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { + $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 } $ui = new calendar_uilist(); $ui->get_rows($query, $events, $unused); @@ -66,8 +65,8 @@ class calendar_export_csv implements importexport_iface_export_plugin { $query = $GLOBALS['egw']->session->appsession('session_data','calendar'); $query['users'] = explode(',', $query['owner']); $query['num_rows'] = -1; - if($config['export_limit'] && !$limit_exception) { - $query['num_rows'] = (int)$config['export_limit']; + if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { + $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 } $events = array(); @@ -89,8 +88,8 @@ class calendar_export_csv implements importexport_iface_export_plugin { ); } - $bo = new calendar_boupdate(); - $events = $bo->search($query + array( + $boupdate = new calendar_boupdate(); + $events = $boupdate->search($query + array( 'offset' => 0, 'order' => 'cal_start', )); @@ -98,6 +97,7 @@ class calendar_export_csv implements importexport_iface_export_plugin { } $export_object = new importexport_export_csv($_stream, (array)$options); + if (!$limit_exception) $export_object->export_limit = $export_limit; $export_object->set_mapping($options['mapping']); $convert_fields = calendar_egw_record::$types; @@ -111,33 +111,34 @@ class calendar_export_csv implements importexport_iface_export_plugin { 3 => lang('High') ), ); - $record = new calendar_egw_record(); foreach ($events as $event) { - // Get rid of yearly recurring events that don't belong - if($options['selection']['select'] == 'criteria' && ($event['start'] > $query['end'] || $event['end'] < $query['start'])) continue; - + // the condition below (2 lines) may only work on enum_recuring=false and using the iterator to test an recurring event on the given timerange + // Get rid of yearly recurring events that don't belong + //if($options['selection']['select'] == 'criteria' && ($event['start'] > $query['end'] || $event['end'] < $query['start'])) continue; // Add in participants if($options['mapping']['participants']) { $event['participants'] = implode(", ",$this->bo->participants($event,true)); } - - $record->set_record($event); - if($options['mapping']['recurrence']) { - $record->recurrence = $recurrence[$record->recur_type]; - if($record->recur_type != MCAL_RECUR_NONE) $record->recurrence .= ' / '. $record->recur_interval; - } - - // Standard stuff - if($options['convert']) { - importexport_export_csv::convert($record, $convert_fields, 'calendar', $lookups); - } else { - // Implode arrays, so they don't say 'Array' - foreach($record->get_record_array() as $key => $value) { - if(is_array($value)) $record->$key = implode(',', $value); + if (is_array($event)) + { + $record->set_record($event); + if($options['mapping']['recurrence']) { + $record->recurrence = $recurrence[$record->recur_type]; + if($record->recur_type != MCAL_RECUR_NONE) $record->recurrence .= ' / '. $record->recur_interval; } - } - $export_object->export_record($record); + + // Standard stuff + if($options['convert']) { + importexport_export_csv::convert($record, $convert_fields, 'calendar', $lookups); + } else { + // Implode arrays, so they don't say 'Array' + foreach($record->get_record_array() as $key => $value) { + if(is_array($value)) $record->$key = implode(',', $value); + } + } + $export_object->export_record($record); + } } unset($record); } diff --git a/calendar/inc/class.calendar_export_ical.inc.php b/calendar/inc/class.calendar_export_ical.inc.php index 63a01b8f68..0d6bb96f36 100644 --- a/calendar/inc/class.calendar_export_ical.inc.php +++ b/calendar/inc/class.calendar_export_ical.inc.php @@ -33,6 +33,7 @@ class calendar_export_ical extends calendar_export_csv { } $limit_exception = bo_merge::is_export_limit_excepted(); + if (!$limit_exception) $export_limit = bo_merge::getExportLimit($GLOBALS['egw_info']['server']['calendar_export_limit']); if($options['selection']['select'] == 'criteria') { $query = array( @@ -44,9 +45,9 @@ class calendar_export_ical extends calendar_export_csv { 'users' => $options['selection']['owner'], 'cfs' => $cfs // Otherwise we shouldn't get any custom fields ); - if($config['export_limit'] && !$limit_exception) { + if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { $query['offset'] = 0; - $query['num_rows'] = (int)$config['export_limit']; + $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 } $events =& $this->bo->search($query); } elseif ($options['selection']['select'] == 'search_results') { @@ -57,8 +58,8 @@ class calendar_export_ical extends calendar_export_csv { $query['start'] = 0; $query['cfs'] = $cfs; - if($config['export_limit'] && !$limit_exception) { - $query['num_rows'] = (int)$config['export_limit']; + if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { + $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 } $ui = new calendar_uilist(); $ui->get_rows($query, $events, $unused); @@ -66,8 +67,8 @@ class calendar_export_ical extends calendar_export_csv { $query = $GLOBALS['egw']->session->appsession('session_data','calendar'); $query['users'] = explode(',', $query['owner']); $query['num_rows'] = -1; - if($config['export_limit'] && !$limit_exception) { - $query['num_rows'] = (int)$config['export_limit']; + if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { + $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 } $events = array(); @@ -89,8 +90,8 @@ class calendar_export_ical extends calendar_export_csv { ); } - $bo = new calendar_boupdate(); - $events = $bo->search($query + array( + $boupdate = new calendar_boupdate(); + $events = $boupdate->search($query + array( 'offset' => 0, 'order' => 'cal_start', )); diff --git a/calendar/inc/class.calendar_merge.inc.php b/calendar/inc/class.calendar_merge.inc.php index 89289cc77a..c5f02fd163 100644 --- a/calendar/inc/class.calendar_merge.inc.php +++ b/calendar/inc/class.calendar_merge.inc.php @@ -68,6 +68,9 @@ class calendar_merge extends bo_merge { parent::__construct(); + // overwrite global export-limit, if one is set for calendar/appointments + $this->export_limit = bo_merge::getExportLimit($GLOBALS['egw_info']['server']['calendar_export_limit']); + $this->bo = new calendar_boupdate(); self::$range_tags['start'] = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat']; diff --git a/calendar/templates/default/config.tpl b/calendar/templates/default/config.tpl index 93386ffe95..c90ae3c133 100644 --- a/calendar/templates/default/config.tpl +++ b/calendar/templates/default/config.tpl @@ -12,10 +12,10 @@