[%# This Source Code Form is subject to the terms of the Mozilla Public
  # License, v. 2.0. If a copy of the MPL was not distributed with this
  # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  #
  # This Source Code Form is "Incompatible With Secondary Licenses", as
  # defined by the Mozilla Public License, v. 2.0.
  #%]

[% colsepchar = user.settings.csv_colsepchar.value %]

[% IF human %]
  [% field_descs.bug_id FILTER csv %]
  [% FOREACH column = displaycolumns %]
    [% colsepchar %][% field_descs.$column FILTER csv %]
  [% END %]
[% ELSE %]
  bug_id
  [% FOREACH column = displaycolumns %]
    [% colsepchar %][% column FILTER csv %]
  [% END %]
[% END %]

[% FOREACH bug = bugs %]
  [% bug.bug_id %]
    [% FOREACH column = displaycolumns %]
      [% colsepchar %]
      [% IF column == "opendate" OR column == "changeddate" %]
        [% rawcolumn = column.replace("date", "time") %]
        [% bug.$column = bug.$rawcolumn FILTER time("%Y-%m-%d %H:%M:%S") %]
      [% ELSIF column == 'bug_status' %]
        [% bug.$column = display_value("bug_status", bug.$column) %]
      [% ELSIF column == 'resolution' %]
        [%- bug.$column = display_value("resolution", bug.$column) %]
      [% END %]
      [% bug.$column FILTER csv %]
    [% END %]

[% END %]
