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 <[EMAIL PROTECTED]> 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
>
_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches