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

This commit is contained in:
Ralf Becker 2012-03-29 12:06:10 +00:00
parent 5ca6860618
commit ee8fd5b10e
5 changed files with 20 additions and 8 deletions

View File

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

View File

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

View File

@ -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'];
}

View File

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

View File

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