From: Go MAEDA Date: Mon, 16 Jan 2023 08:46:18 +0000 (+0000) Subject: Remove code no longer necessary due to r21823 (#37674). X-Git-Tag: 5.1.0~283 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4768bebf3f7fc611739ab1bb63f5d2c8d2b2edfc;p=redmine.git Remove code no longer necessary due to r21823 (#37674). git-svn-id: https://svn.redmine.org/redmine/trunk@22046 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index b2c09e5dc..860a60ccf 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -20,11 +20,6 @@ module UsersHelper include ApplicationHelper - def users_status_options_for_select(selected) - user_count_by_status = User.group('status').count.to_hash - options_for_select([[l(:label_all), '']] + (User.valid_statuses.map {|c| ["#{l('status_' + User::LABEL_BY_STATUS[c])} (#{user_count_by_status[c].to_i})", c]}), selected.to_s) - end - def user_mail_notification_options(user) user.valid_notification_options.collect {|o| [l(o.last), o.first]} end @@ -105,58 +100,4 @@ module UsersHelper end tabs end - - def csv_content(column_name, user) - case column_name - when 'status' - l("status_#{User::LABEL_BY_STATUS[user.status]}") - when 'twofa_scheme' - if user.twofa_active? - l("twofa__#{user.twofa_scheme}__name") - else - l(:label_disabled) - end - else - user.send(column_name) - end - end - - def users_to_csv(users) - Redmine::Export::CSV.generate(:encoding => params[:encoding]) do |csv| - columns = [ - 'login', - 'firstname', - 'lastname', - 'mail', - 'admin', - 'status', - 'twofa_scheme', - 'created_on', - 'updated_on', - 'last_login_on', - 'passwd_changed_on' - ] - user_custom_fields = UserCustomField.sorted - - # csv header fields - csv << columns.map {|column| l('field_' + column)} + user_custom_fields.pluck(:name) - # csv lines - users = users.preload(:custom_values) - users.each do |user| - values = columns.map {|c| csv_content(c, user)} + - user_custom_fields.map {|custom_field| user.custom_value_for(custom_field)} - - csv << values.map do |value| - format_object(value, false) do |v| - case v.class.name - when 'Float' - sprintf('%.2f', v).gsub('.', l(:general_csv_decimal_separator)) - else - v - end - end - end - end - end - end end