Znuny icon indicating copy to clipboard operation
Znuny copied to clipboard

Sort attribute of a parameter of static report is not passed to BuildSelection function

Open BuilderNSV opened this issue 2 years ago • 2 comments

Environment

  • Server OS: Linux Ubuntu
  • Browser: Firefox
  • Znuny version: 7.0.16

Expected behavior

I want to see list of some defined parameter of static report sorted by not default method. As example, I have

my @Params = ( { Frontend => 'Month', Name => 'Month', Multiple => 0, Size => 0, SelectedID => 'None', **Sort => 'AlphanumericKey',** Data => { 'None' => 'None', '01 January' => 'January', '02 February' => 'February', '03 March' => 'March', '04 April' => 'April', }, });

And I expected to see values in dropdown list in the same order

Actual behavior

Actually I see values sorted alphabetically - April, Match, January and so on

How to reproduce

Create a static report with parameter describe above and see values order in dropdown list

Additional information

As I can see Sort atribute does not passed at all to BuildSelection() call in Kernel\Output\HTML\Statistics\View.pm for report of static type

BuilderNSV avatar Apr 19 '24 03:04 BuilderNSV

Please provide us with the static report you are testing, an we will review it. Also check the current version please.

dignin avatar May 14 '25 07:05 dignin

I've attached my version of static report for verification. Please, take a look on Month field values sorting. StateAction_sort.zip

There is actual for ther latest vesrion of Znuny because it has been made nothing regarding this enhancement.

if you make changes in znuny-7.1.7\Kernel\Output\HTML\Statistics\View.pm line 242

                    Field => $LayoutObject->BuildSelection(
                        Data       => $ParamItem->{Data},
                        Name       => $ParamItem->{Name},
                        SelectedID => $LocalGetParam->( Param => $ParamItem->{Name} ) // $ParamItem->{SelectedID} || '',
                        Multiple   => $ParamItem->{Multiple} || 0,
                        Size       => $ParamItem->{Size} || '',
+                        Sort       => $ParamItem->{Sort},
                        Class      => 'Modernize',
                    ),

and uncomment line "Sort => 'AlphanumericKey'," in my report, you will see the months sorted as they go on the calendar.

BuilderNSV avatar May 15 '25 05:05 BuilderNSV