[Koha-patches] [PATCH] Update holdings sort to sort by items.enumchron if there's no serial record and the biblio.serial flag is set.
Joe Atzberger
joe.atzberger at liblime.com
Fri Jul 25 17:39:35 CEST 2008
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:
sub sort_pubdate {
$b->{publisheddate} cmp $a->{publisheddate};
}
sub sort_enum {
$b->{enumchron} cmp $a->{enumchron} ;
}
sub sort_either {
($b->{publisheddate} || $b->{enumchron})
cmp
($a->{publisheddate} || $a->{enumchron}) ;
}
return( sort @results );
--joe
On Wed, Jul 23, 2008 at 4:04 PM, Ryan Higgins <rch at liblime.com> wrote:
> ---
> C4/Items.pm | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/C4/Items.pm b/C4/Items.pm
> index fa31f52..74196e9 100644
> --- a/C4/Items.pm
> +++ b/C4/Items.pm
> @@ -1261,7 +1261,7 @@ sub GetItemsInfo {
> }
> $sth->finish;
> if($serial) {
> - return( sort { $b->{'publisheddate'} cmp
> $a->{'publisheddate'} } @results );
> + return( sort { ($b->{'publisheddate'} || $b->{'enumchron'})
> cmp ($a->{'publisheddate'} || $a->{'enumchron'}) } @results );
> } else {
> return (@results);
> }
> --
> 1.5.5.GIT
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/koha-patches/attachments/20080725/211b7e61/attachment-0002.htm>
More information about the Koha-patches
mailing list