From ee8fd5b10e6e3580546496237dc84c477734f034 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 29 Mar 2012 12:06:10 +0000 Subject: [PATCH] found a lot more calls to get_rows missing to set csv_export flag and fixed code in nextmatch dealing with situation if num_rows=-1 got stored in prefs anyway --- .../inc/class.addressbook_export_contacts_csv.inc.php | 5 +++-- calendar/inc/class.calendar_export_csv.inc.php | 6 ++++-- etemplate/inc/class.nextmatch_widget.inc.php | 7 +++++-- resources/inc/class.resources_export_csv.inc.php | 2 ++ timesheet/inc/class.timesheet_export_csv.inc.php | 8 ++++++-- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/addressbook/inc/class.addressbook_export_contacts_csv.inc.php b/addressbook/inc/class.addressbook_export_contacts_csv.inc.php index b652b99e90..271fcec53f 100644 --- a/addressbook/inc/class.addressbook_export_contacts_csv.inc.php +++ b/addressbook/inc/class.addressbook_export_contacts_csv.inc.php @@ -54,6 +54,7 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi // uicontacts selection with checkbox 'use_all' $query = $GLOBALS['egw']->session->appsession('index','addressbook'); $query['num_rows'] = -1; // all + $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session $uicontacts->get_rows($query,$selection,$readonlys, true); // only return the ids } elseif ( $options['selection'] == 'all_contacts' ) { @@ -268,11 +269,11 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi /** * Convert some internal data to something with more meaning - * + * * Dates, times, user IDs, category IDs */ public static function convert(addressbook_egw_record &$record, $options) { - + if ($record->tel_prefer) { $field = $record->tel_prefer; $record->tel_prefer = $record->$field; diff --git a/calendar/inc/class.calendar_export_csv.inc.php b/calendar/inc/class.calendar_export_csv.inc.php index 3a85a3d101..0fd71ef999 100644 --- a/calendar/inc/class.calendar_export_csv.inc.php +++ b/calendar/inc/class.calendar_export_csv.inc.php @@ -25,7 +25,7 @@ class calendar_export_csv implements importexport_iface_export_plugin { $options = $_definition->plugin_options; $this->bo = new calendar_bo(); - $limit_exception = bo_merge::is_export_limit_excepted(); + $limit_exception = bo_merge::is_export_limit_excepted(); if (!$limit_exception) $export_limit = bo_merge::getExportLimit('calendar'); // Custom fields need to be specifically requested $cfs = array(); @@ -53,6 +53,7 @@ class calendar_export_csv implements importexport_iface_export_plugin { if($states['view'] == 'listview') { $query = $GLOBALS['egw']->session->appsession('calendar_list','calendar'); $query['num_rows'] = -1; // all + $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session $query['start'] = 0; $query['cfs'] = $cfs; @@ -114,7 +115,7 @@ class calendar_export_csv implements importexport_iface_export_plugin { $record = new calendar_egw_record(); foreach ($events as $event) { // 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 + // 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']) { @@ -201,6 +202,7 @@ class calendar_export_csv implements importexport_iface_export_plugin { // Use UI to get dates $ui = new calendar_uilist(); + $list['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session $ui->get_rows($list); if($ui->first) $start = $ui->first; if($ui->last) $end = $ui->last; diff --git a/etemplate/inc/class.nextmatch_widget.inc.php b/etemplate/inc/class.nextmatch_widget.inc.php index 0e6025802d..7ff3354f14 100644 --- a/etemplate/inc/class.nextmatch_widget.inc.php +++ b/etemplate/inc/class.nextmatch_widget.inc.php @@ -292,6 +292,10 @@ class nextmatch_widget if ($n-5 <= $max && $max <= $n+5) $n = $max; $row_options[$n] = $n; } + if (!isset($value['num_rows']) || $value['num_rows'] <= 0) // can be -1 if importexport crashes + { + $extension_data['num_rows'] = $value['num_rows'] = $max; + } if (!isset($row_options[$max]) || !isset($row_options[$value['num_rows']])) { $row_options[$max] = $max; @@ -300,8 +304,7 @@ class nextmatch_widget } $value['options-num_rows'] =& $row_options; - if (!isset($value['num_rows'])) $extension_data['num_rows'] = $value['num_rows'] = $max; - if ($value['num_rows'] != $max || $value['num_rows'] <= 0) // can be -1 if importexport crashes + if ($value['num_rows'] != $max) { $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] = $max = (int)$value['num_rows']; } diff --git a/resources/inc/class.resources_export_csv.inc.php b/resources/inc/class.resources_export_csv.inc.php index 0c7d9b0343..7169247b04 100644 --- a/resources/inc/class.resources_export_csv.inc.php +++ b/resources/inc/class.resources_export_csv.inc.php @@ -31,11 +31,13 @@ class resources_export_csv implements importexport_iface_export_plugin { $query = egw_cache::getSession('resources', 'get_rows'); $query['num_rows'] = -1; // all unset($query['store_state']); + $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session $bo->get_rows($query,$selection,$readonlys); } elseif ( $options['selection'] == 'all' ) { $query = array( 'num_rows' => -1, + 'csv_export' => true, // so get_rows method _can_ produce different content or not store state in the session ); // all $bo->get_rows($query,$selection,$readonlys); } else { diff --git a/timesheet/inc/class.timesheet_export_csv.inc.php b/timesheet/inc/class.timesheet_export_csv.inc.php index c6185e8f31..87baec5091 100644 --- a/timesheet/inc/class.timesheet_export_csv.inc.php +++ b/timesheet/inc/class.timesheet_export_csv.inc.php @@ -30,11 +30,15 @@ class timesheet_export_csv implements importexport_iface_export_plugin { if($options['selection'] == 'selected') { $query = $GLOBALS['egw']->session->appsession('index',TIMESHEET_APP); $query['num_rows'] = -1; // all records + $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session $uitimesheet->get_rows($query,$selection,$readonlys,true); // true = only return the id's } elseif($options['selection'] == 'all') { - $query = array('num_rows' => -1); + $query = array( + 'num_rows' => -1, + 'csv_export' => true, // so get_rows method _can_ produce different content or not store state in the session + ); $uitimesheet->get_rows($query,$selection,$readonlys,true); // true = only return the id's - } + } $options['begin_with_fieldnames'] = true;