From 0731731e279250d1cdd8dbc68f0474295e2c676c Mon Sep 17 00:00:00 2001 From: nathangray Date: Wed, 10 Jul 2019 15:50:31 -0600 Subject: [PATCH] Admin - fix missing/incorrect filter options in user export definition --- .../inc/class.admin_export_users_csv.inc.php | 30 +++++++++++++++---- .../etemplate/et2_extension_customfields.js | 4 +++ 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/admin/inc/class.admin_export_users_csv.inc.php b/admin/inc/class.admin_export_users_csv.inc.php index 1ebcd83003..0e27dc4d1a 100644 --- a/admin/inc/class.admin_export_users_csv.inc.php +++ b/admin/inc/class.admin_export_users_csv.inc.php @@ -16,6 +16,22 @@ */ class admin_export_users_csv implements importexport_iface_export_plugin { + protected $lookups = array( + 'account_status' => array('A' => 'Active', '' => 'Disabled', 'D' => 'Disabled'), + ); + + public function __construct() { + foreach($this->lookups as $select => &$options) + { + foreach($options as $key => &$label) + { + if(is_string($label)) + { + $label = lang($label); + } + } + } + } /** * Exports records as defined in $_definition * @@ -38,10 +54,6 @@ class admin_export_users_csv implements importexport_iface_export_plugin $export_object = new importexport_export_csv($_stream, (array)$options); $export_object->set_mapping($options['mapping']); - $lookups = array( - 'account_status' => array('A' => lang('Active'), '' => lang('Disabled'), 'D' => lang('Disabled')), - ); - // $_record is an array, that's what search() returns foreach ($selection as $_record) { @@ -49,7 +61,7 @@ class admin_export_users_csv implements importexport_iface_export_plugin if($options['convert']) { $never_expires = ($record->account_expires == -1); - importexport_export_csv::convert($record, admin_egw_user_record::$types, 'admin', $lookups); + importexport_export_csv::convert($record, admin_egw_user_record::$types, 'admin', $this->lookups); if($never_expires) $record->account_expires = 'never'; // Has to be 'never' for admin_cmd_edit_user to parse it } else @@ -138,4 +150,12 @@ class admin_export_users_csv implements importexport_iface_export_plugin { return 'admin_egw_user_record'; } + + public function get_filter_fields(&$fields) + { + $fields['account_primary_group']['account_type'] = 'groups'; + $fields['account_groups']['account_type'] = 'groups'; + + $fields['account_status']['values'] = $this->lookups['account_status']; + } } diff --git a/api/js/etemplate/et2_extension_customfields.js b/api/js/etemplate/et2_extension_customfields.js index 9c38972669..8e96688f01 100644 --- a/api/js/etemplate/et2_extension_customfields.js +++ b/api/js/etemplate/et2_extension_customfields.js @@ -489,6 +489,10 @@ var et2_customfields_list = (function(){ "use strict"; return et2_valueWidget.ex }, _setup_select_account: function(field_name, field, attrs) { attrs.empty_label = egw.lang('Select'); + if(field.account_type) + { + attrs.account_type = field.account_type; + } return this._setup_select(field_name, field, attrs); },