Fix for bug 1552, fix ordering of issued items

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Chris Cormack 2007-12-30 15:36:42 -06:00 committed by Joshua Ferraro
parent 0a8fcfe53a
commit bcc60a1117
5 changed files with 30 additions and 6 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/perl
#script to administer the systempref table
#written 20/02/2002 by paul.poulain@free.fr
# script to administer the systempref table
# written 20/02/2002 by paul.poulain@free.fr
# This software is placed under the gnu General Public License, v2 (http://www.gnu.org/licenses/gpl.html)
# Copyright 2000-2002 Katipo Communications
@ -136,6 +136,9 @@ my %tabsysprefs;
$tabsysprefs{WebBasedSelfCheck}="Circulation";
$tabsysprefs{CircControl}="Circulation";
$tabsysprefs{finesCalendar}="Circulation";
$tabsysprefs{previousIssuesDefaultSortOrder}="Circulation";
$tabsysprefs{todaysIssuesDefaultSortOrder}="Circulation";
# Staff Client
$tabsysprefs{TemplateEncoding}="StaffClient";
$tabsysprefs{template}="StaffClient";
@ -281,7 +284,7 @@ sub StringSearch {
$sth->finish;
} elsif ($type){
foreach my $syspref (sort keys %tabsysprefs){
foreach my $syspref (sort { lc $a cmp lc $b } keys %tabsysprefs){
if ($tabsysprefs{$syspref} eq $type){
my $sth=$dbh->prepare("Select variable,value,explanation,type,options from systempreferences where (variable like ?) order by variable");
$sth->execute($syspref);

View File

@ -439,11 +439,22 @@ if ($borrower) {
push @previousissues, $it;
}
}
@todaysissues = sort { $b->{'timestamp'} <=> $a->{'timestamp'} } @todaysissues;
@previousissues = sort { $b->{'date_due' } <=> $a->{'date_due' } } @previousissues;
if (C4::Context->preference("todaysIssuesDefaultSortOrder") eq 'asc'){
@todaysissues = sort { $a->{'timestamp'} cmp $b->{'timestamp'} } @todaysissues;
}
else {
@todaysissues = sort { $b->{'timestamp'} cmp $a->{'timestamp'} } @todaysissues;
}
if (C4::Context->preference("previousIssuesDefaultSortOrder") eq 'asc'){
@previousissues = sort { $a->{'date_due' } cmp $b->{'date_due' } } @previousissues;
}
else {
@previousissues = sort { $b->{'date_due' } cmp $a->{'date_due' } } @previousissues;
}
my $i = 1;
foreach my $book (@todaysissues) {
$book->{'togglecolor'} = (++$i % 2) ? 0 : 1 ;
warn $book->{'timestamp'};
}
$i = 1;
foreach my $book (@previousissues) {

View File

@ -164,6 +164,8 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('uppercasesurnames',0,'If ON, surnames are converted to upper case in patron entry form',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('CircControl',"ItemHomeLibrary",'Specify the agency that controls the circulation and fines policy',"PickupLibrary|PatronLibrary|ItemHomeLibrary",'Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('finesCalendar',"noFinesWhenClosed",'Specify whether to use the Calendar in calculating duedates and fines',"ignoreCalendar|noFinesWhenClosed",'Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('previousIssuesDefaultSortOrder',"asc",'Specify the sort order of Previous Issues on the circulation page',"asc|desc",'Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('todaysIssuesDefaultSortOrder',"desc",'Specify the sort order of Todays Issues on the circulation page',"asc|desc",'Choice');

View File

@ -812,6 +812,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
$DBversion = "3.00.00.040";
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('previousIssuesDefaultSortOrder','asc','Specify the sort order of Previous Issues on the circulation page','asc|desc','Choice')");
$dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('todaysIssuesDefaultSortOrder','desc','Specify the sort order of Todays Issues on the circulation page','asc|desc','Choice')");
print "Upgrade to $DBversion done ('add circ sysprefs todaysIssuesDefaultSortOrder and previousIssuesDefaultSortOrder.')\n";
SetVersion ($DBversion);
}
=item DropAllForeignKeys($table)

View File

@ -10,7 +10,7 @@
use strict;
sub kohaversion {
our $VERSION = "3.00.00.039";
our $VERSION = "3.00.00.040";
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install