[Koha-patches] [PATCH] Update holdings sort to sort by items.enumchron if there's no serial record and the biblio.serial flag is set.
Joshua Ferraro
jmf at liblime.com
Sun Jul 27 13:31:29 CEST 2008
OK, so I won't push this patch, pending resolution on the issues Joe
raises.
Josh
On Fri, Jul 25, 2008 at 01:59:28PM -0400, Ryan Higgins wrote:
> You're right, Joe, this was an error on my part. I was hoping to allow for
> the case of a library
> with a large number of migrated item records that wished to begin using the
> serials module
> for future acquisitions. This won't work, as the sort is by the publication
> date, not by the caption,
> which is stored in serialseq. It would work, however, if the library
> migrated their previous holdings
> with enumchron prefixed by the date of publication in iso format.
>
> All that aside, I'm not sure that your sort would return different results
> than mine, but I'm not
> so familiar with perl's sort internals. It looks to me that item-by-item,
> the sort function you've provided
> would return the same value as just calling sort_either, or am I mistaken ?
>
> It is not at all uncommon, though, for libraries to have a record with some
> items attached to a serial issue
> record and some not (those without a serial issue record would have all
> serial publication data stored as the caption
> in items.enumchron).
>
> Ryan
>
>
> On Fri, Jul 25, 2008 at 11:47 AM, Joe Atzberger <joe.atzberger at liblime.com>
> wrote:
>
> > Sorry, that got sent before I was done editing it.
> >
> > On Fri, Jul 25, 2008 at 11:39 AM, Joe Atzberger <joe.atzberger at liblime.com>
> > wrote:
> > Is there a problem when one item has publisheddate and another only has
> > enumchron? I still don't really understand enumchron, but I think we want a
> > failover between two sets of comparisons, not two failovers of criteria.
> > That is, unless I misunderstand and publisheddate and enumchron really are
> > interchangeable to that degree. Can you confirm, Ryan?
> >
> > Otherwise I would propose something like :
> > sub sort_pubdate {
> > my $key = 'publisheddate';
> > $b->{$key} and $a->{$key} or return 0;
> > $b->{$key} cmp $a->{$key};
> > }
> > sub sort_enum {
> > my $key = 'enumchron';
> > $b->{$key} and $a->{$key} or return 0;
> > $b->{$key} cmp $a->{$key};
> > }
> > sub sort_either {
> > ($b->{publisheddate} || $b->{enumchron})
> > cmp
> > ($a->{publisheddate} || $a->{enumchron}) ;
> > }
> > ...
> > return( sort {&sort_pubdate || &sort_enum || &sort_either } @results );
> >
> > --joe
> >
>
>
>
> --
> Ryan Higgins
>
> LibLime * Open-Source Solutions for Libraries
> Featuring KohaZOOM ILS
> 888-564-2457 x704
> _______________________________________________
> Koha-patches mailing list
> Koha-patches at lists.koha.org
> http://lists.koha.org/mailman/listinfo/koha-patches
More information about the Koha-patches
mailing list