#!/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
$tabsysprefs{WebBasedSelfCheck}="Circulation";
$tabsysprefs{CircControl}="Circulation";
$tabsysprefs{finesCalendar}="Circulation";
+ $tabsysprefs{previousIssuesDefaultSortOrder}="Circulation";
+ $tabsysprefs{todaysIssuesDefaultSortOrder}="Circulation";
+
# Staff Client
$tabsysprefs{TemplateEncoding}="StaffClient";
$tabsysprefs{template}="StaffClient";
$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);
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) {
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');
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)
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