From 6989d59ba6eed9f0df2d62e2934fe04d94c541bf Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 30 Oct 2009 11:18:47 +0000 Subject: [PATCH] fixed no or only partial export of custom fields via nextmatch csv export --- addressbook/inc/class.addressbook_ui.inc.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index 4f8c7127a4..a19fb9ad24 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -762,7 +762,7 @@ class addressbook_ui extends addressbook_bo $do_email = $query['do_email']; $what = $query['sitemgr_display'] ? $query['sitemgr_display'] : ($do_email ? 'email' : 'index'); - if (!$id_only) + if (!$id_only && !$query['csv_export']) // do NOT store state for csv_export or querying id's (no regular view) { $old_state = $GLOBALS['egw']->session->appsession($what,'addressbook',$query); } @@ -880,12 +880,14 @@ class addressbook_ui extends addressbook_bo if ($query['sitemgr_display']) { $query['template'] = $query['sitemgr_display'].'.rows'; - } else { + } + else + { $query['template'] = $do_email ? 'addressbook.email.rows' : 'addressbook.index.rows'; } if ($query['org_view']) // view the contacts of one organisation only { - if (strpos($query['org_view'],'*AND*')!== false) $query['org_view'] = str_replace('*AND*','&',$query['org_view']); + if (strpos($query['org_view'],'*AND*') !== false) $query['org_view'] = str_replace('*AND*','&',$query['org_view']); foreach(explode('|||',$query['org_view']) as $part) { list($name,$value) = explode(':',$part,2); @@ -941,14 +943,15 @@ class addressbook_ui extends addressbook_bo $order,'',$wildcard,false,$op,array((int)$query['start'],(int) $query['num_rows']),$query['col_filter']); // do we need to read the custom fields, depends on the column is enabled and customfields exist + // $query['csv_export'] allways needs to read ALL cf's $columselection = $this->prefs['nextmatch-addressbook.'.($do_email ? 'email' : 'index').'.rows']; $available_distib_lists=$this->get_lists(EGW_ACL_READ); - $columselection = $columselection ? explode(',',$columselection) : array(); + $columselection = $columselection && !$query['csv_export'] ? explode(',',$columselection) : array(); if (!$id_only && $rows) { - $show_custom_fields = (!$columselection || in_array('customfields',$columselection)) && $this->customfields; + $show_custom_fields = (!$columselection || in_array('customfields',$columselection) || $query['csv_export']) && $this->customfields; $show_calendar = !$columselection || in_array('calendar_calendar',$columselection); - $show_distributionlist = !$columselection || in_array('distrib_lists',$columselection) ||count($available_distib_lists); + $show_distributionlist = !$columselection || in_array('distrib_lists',$columselection) || count($available_distib_lists); if ($show_calendar || $show_custom_fields || $show_distributionlist) { foreach($rows as $val)