Bug 3549

Summary: Framework sorting in addbook
Product: Koha Reporter: Chris Cormack <chris>
Component: CatalogingAssignee: Galen Charlton <gmcharlt>
Status: CLOSED FIXED QA Contact: Jonathan Druart <jonathan.druart+koha>
Severity: enhancement    
Priority: P5 - low CC: bgkriegel, jonathan.druart+koha, mathsabypro, nengard
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: bugfix
Bug 3549 - Framework sorting in addbook
[SIGNED-OFF] Bug 3549 - Framework sorting in addbook
Bug 3549 -[Revised]- Framework sorting in addbook
Bug 3549 -[Revised]- Framework sorting in addbook

Description Chris Cormack 2010-05-21 01:12:01 UTC

---- Reported by jeanandre.santoni@biblibre.com 2009-08-25 08:18:10 ----

In addbook.pl, the framwork options are sorted in random order. They should be sorted in alphabetical order of value or code.

---- Additional Comments From jeanandre.santoni@biblibre.com 2009-08-25 08:27:00 ----

Created an attachment

--- Bug imported by chris@bigballofwax.co.nz 2010-05-21 01:12 UTC  ---

This bug was previously known as _bug_ 3549 at http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=3549
Imported an attachment (id=1407)

Actual time not defined. Setting to 0.0
The original reporter of this bug does not have
   an account here. Reassigning to the person who moved
   it here: chris@bigballofwax.co.nz.
   Previous reporter was jeanandre.santoni@biblibre.com.
The original assignee of this bug does not have
   an account here. Reassigning to the default assignee
   for the component, gmcharlt@gmail.com.
   Previous assignee was jeanandre.santoni@biblibre.com.
Bug reassigned, setting status to "NEW".
   Previous status was "ASSIGNED".
The original submitter of attachment 1407 [details] [review] is unknown.
   Reassigning to the person who moved it here: chris@bigballofwax.co.nz.

Comment 1 Chris Cormack 2010-12-15 07:20:36 UTC
This is in master, please test
Comment 2 Owen Leonard 2011-02-14 17:52:05 UTC
The original patch changes this:

foreach my $thisframeworkcode ( keys %$frameworks ) {

to this:

foreach my $thisframeworkcode ( sort keys %$frameworks ) {

...which worka to have the framework list sorted by framework code, but since the description is what is displayed sorting by code doesn't make much sense. The actual commit made this change:

foreach my $thisframeworkcode ( sort {$frameworks->{$a} cmp $frameworks->{$b}}keys %{$frameworks} ) {

...but this doesn't seem to work at all. Sorting appears random to me.
Comment 3 Jared Camins-Esakov 2012-02-12 23:43:37 UTC
Comment on attachment 1407 [details] [review]

3.0.x is no longer maintained. Marking bug obsolete.
Comment 4 Owen Leonard 2013-01-15 16:06:06 UTC
*** Bug 5469 has been marked as a duplicate of this bug. ***
Comment 5 Bernardo Gonzalez Kriegel 2013-02-21 17:44:26 UTC Comment hidden (obsolete)
Comment 6 Owen Leonard 2013-02-21 17:59:41 UTC Comment hidden (obsolete)
Comment 7 Jonathan Druart 2013-02-28 10:29:09 UTC
QA comment:
This patch changes the order only for 1 page.
It is easy to change the sort order for all pages changing the sql query in C4::Koha::getframeworks
Marked as Failed QA.
Comment 8 Jonathan Druart 2013-02-28 10:30:47 UTC
Forget that, the routine returns a hashref!

However the sort order is not case insensitive (uppercases are sorted before lowercase).
Comment 9 Bernardo Gonzalez Kriegel 2013-02-28 11:11:19 UTC Comment hidden (obsolete)
Comment 10 Bernardo Gonzalez Kriegel 2013-02-28 11:12:18 UTC
Silly mistake. Fixed
Comment 11 Jonathan Druart 2013-02-28 11:31:29 UTC
Thanks Bernardo.

Simple patch, it sorts framework by description.
I am convinced that a rewrite of C4::Koha::getframeworks would be a good thing.
It would return a arrayref (instead of a hashref) with a sorted frameworks list. But it is a bigger patch than this one.

Marked as Passed QA.
Comment 12 Jonathan Druart 2013-02-28 11:32:07 UTC
Created attachment 15762 [details] [review]
Bug 3549 -[Revised]- Framework sorting in addbook

Reviewing Bug 9649, this bug comes up.

This patch correctly sort frameworks by description.

To test:
1) Go to Cataloguing home, button 'New record' shows
unordered list of frameworks
2) Apply the patch
3) refresh, the list must be correctly sorted.

Revised to sort using uppercase.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 13 Jared Camins-Esakov 2013-03-01 00:30:57 UTC
This patch has been pushed to master.
Comment 14 mathieu saby 2013-04-28 19:43:47 UTC
I don't see that as an enhancement. Should be a bugfix.

M. Saby