Sorting alphabetically the subfields in additem
Hi, Sometimes when you mess around with the marc structure of the bibliographic frameworks, the subfields of the 952 field are showed in a random manner in the cataloguing section. A possible improvement to display the subfields sorted when you add or edit an item in the intranet at the page /cgi-bin/koha/cataloguing/additem.pl . Just before passing the reference of the array loop_data as a param to the template, add the line of code: @loop_data = map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [ $_, $_->{subfield} ] } @loop_data; to sort alphabetically de code of the subfields and show them clearly. Salva
I ran into this too, my librarians wanted the item fields in a certain order though. So I made a hash of the subfield codes and a sort weight. That did the job for me. On Wed, 2010-08-18 at 18:17 +0200, Salvador Zaragoza Rubio wrote:
Hi,
Sometimes when you mess around with the marc structure of the bibliographic frameworks, the subfields of the 952 field are showed in a random manner in the cataloguing section.
A possible improvement to display the subfields sorted when you add or edit an item in the intranet at the page /cgi-bin/koha/cataloguing/additem.pl .
Just before passing the reference of the array loop_data as a param to the template, add the line of code:
@loop_data = map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [ $_, $_->{subfield} ] } @loop_data;
to sort alphabetically de code of the subfields and show them clearly.
Salva
_______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
-- Michael Hafen Systems Analyst and Programmer Washington County School District Utah, USA for Koha checkout http://development.washk12.org/gitweb/ or git://development.washk12.org/koha
Maybe the right thing to do instead of changing code everyone would be for the koha developers to add a subfield in the marc structure indicating the order you want to display the subfields. It would imply adding a field in the database and change code to sort through this field. I think this would be the perfect solution as everyone could order in the desired manner as Michael Hafen did. El 18/08/2010 19:56, Michael Hafen escribió:
I ran into this too, my librarians wanted the item fields in a certain order though. So I made a hash of the subfield codes and a sort weight. That did the job for me.
On Wed, 2010-08-18 at 18:17 +0200, Salvador Zaragoza Rubio wrote:
Hi,
Sometimes when you mess around with the marc structure of the bibliographic frameworks, the subfields of the 952 field are showed in a random manner in the cataloguing section.
A possible improvement to display the subfields sorted when you add or edit an item in the intranet at the page /cgi-bin/koha/cataloguing/additem.pl .
Just before passing the reference of the array loop_data as a param to the template, add the line of code:
@loop_data = map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [ $_, $_->{subfield} ] } @loop_data;
to sort alphabetically de code of the subfields and show them clearly.
Salva
_______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
-- Salvador Zaragoza Rubio Dept. de Tecnologías y Sistemas de Información C/ Garcilaso, 15-bajo 46003 Valencia Telf: 96 369 41 23 Fax: 96 369 34 39 www.masmedios.com <http://www.masmedios.com/> Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, puede contener información de carácter confidencial exclusivamente dirigida a su(s) destinatario(s). De acuerdo con la LOPD, MASmedios informa de que los datos personales contenidos quedarán sometidos a un tratamiento del que aquélla es responsable. Los interesados consienten el tratamiento de sus datos para estos fines, pudiendo ejercitar sus derechos de acceso, rectificación, cancelación y oposición dirigiéndose por escrito a /MASmedios para la gestión de la información/, calle Garcilaso 15-B 46003 Valencia o en *protecciondatos@masmedios.com*
Salvador Zaragoza Rubio <salvazm@masmedios.com>
Maybe the right thing to do instead of changing code everyone would be for the koha developers to add a subfield in the marc structure indicating the order you want to display the subfields. It would imply adding a field in the database and change code to sort through this field. I think this would be the perfect solution as everyone could order in the desired manner as Michael Hafen did.
Plesae can someone more familiar with cataloguing look at additem.pl (or answer from memory) and say why the fields are ordered as they are? I didn't see how the subfields are "in a random manner", but there are a couple of random numbers generated by sub generate_subfield_form. The current ordering might be random, accidental or it might have some reason (performance, or even a dangerous undeclared dependency) that the reordering may impact. Anyone know for sure? Thanks, -- MJ Ray (slef) Webmaster and developer for hire at | software www.software.coop http://mjr.towers.org.uk | .... co IMO only: see http://mjr.towers.org.uk/email.html | .... op
Current 3.0.x code contains the line to sort the subfields: @loop_data= sort {$a->{subfield} cmp $b->{subfield}} @loop_data; In 3.1.x the problem seems to be resolved. -----Oorspronkelijk bericht----- Van: koha-devel-bounces@lists.koha-community.org [mailto:koha-devel-bounces@lists.koha-community.org] Namens MJ Ray Verzonden: donderdag 19 augustus 2010 12:13 Aan: Salvador Zaragoza Rubio CC: koha-devel@lists.koha-community.org Onderwerp: Re: [Koha-devel] Sorting alphabetically the subfields in additem Salvador Zaragoza Rubio <salvazm@masmedios.com>
Maybe the right thing to do instead of changing code everyone would be for the koha developers to add a subfield in the marc structure indicating the order you want to display the subfields. It would imply adding a field in the database and change code to sort through this field. I think this would be the perfect solution as everyone could order in the desired manner as Michael Hafen did.
Plesae can someone more familiar with cataloguing look at additem.pl (or answer from memory) and say why the fields are ordered as they are? I didn't see how the subfields are "in a random manner", but there are a couple of random numbers generated by sub generate_subfield_form. The current ordering might be random, accidental or it might have some reason (performance, or even a dangerous undeclared dependency) that the reordering may impact. Anyone know for sure? Thanks, -- MJ Ray (slef) Webmaster and developer for hire at | software www.software.coop http://mjr.towers.org.uk | .... co IMO only: see http://mjr.towers.org.uk/email.html | .... op _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
What I see in the version downloaded from the git current development branch is that the fields and subfields are stored in hash data structures so they are randomly accessed if you don't sort them with some method, just what's been done recently: . . . 380: foreach my $tag (sort keys %{$tagslib}) { 381: # loop through each subfield 381: foreach my $subfield (sort keys %{$tagslib->{$tag}}) { . . . After processing them, the data is stored in an array so they are showed sorted afterwards: 555: push (@loop_data, \%subfield_data); In this implementation the subfields are passed (lexically sorted) to the template for displaying purposes. So I think is fixed. Anyway I'll look into the database solution. El 19/08/2010 12:13, MJ Ray escribió:
Salvador Zaragoza Rubio <salvazm@masmedios.com>
Maybe the right thing to do instead of changing code everyone would be for the koha developers to add a subfield in the marc structure indicating the order you want to display the subfields. It would imply adding a field in the database and change code to sort through this field. I think this would be the perfect solution as everyone could order in the desired manner as Michael Hafen did.
Plesae can someone more familiar with cataloguing look at additem.pl (or answer from memory) and say why the fields are ordered as they are?
I didn't see how the subfields are "in a random manner", but there are a couple of random numbers generated by sub generate_subfield_form.
The current ordering might be random, accidental or it might have some reason (performance, or even a dangerous undeclared dependency) that the reordering may impact. Anyone know for sure?
Thanks,
Le 19/08/2010 12:43, Salvador Zaragoza Rubio a écrit :
In this implementation the subfields are passed (lexically sorted) to the template for displaying purposes. So I think is fixed. Anyway I'll look into the database solution.
good idea, as some (few ?) librarians says they would be happy to have by default a sorting that is not alphabetical (like $a$x$y$z$h$i$j) -- Paul POULAIN http://www.biblibre.com Expert en Logiciels Libres pour l'info-doc Tel : (33) 4 91 81 35 08
participants (5)
-
Marcel de Rooy -
Michael Hafen -
MJ Ray -
Paul Poulain -
Salvador Zaragoza Rubio