[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha placerequest.pl request.pl C4/Reserves2.pm... [dev_week]
From: |
Kyle Hall |
Subject: |
[Koha-cvs] koha placerequest.pl request.pl C4/Reserves2.pm... [dev_week] |
Date: |
Wed, 31 Oct 2007 12:14:25 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: dev_week
Changes by: Kyle Hall <kylemhall> 07/10/31 12:14:24
Modified files:
. : placerequest.pl request.pl
C4 : Reserves2.pm
koha-tmpl/intranet-tmpl/ccfls/en: request.tmpl
koha-tmpl/intranet-tmpl/npl/en: request.tmpl
Added files:
koha-tmpl/intranet-tmpl/ccfls/en/images: arrow_down.png
arrow_up.png cross.png
go-bottom.png
go-down.png go-top.png
go-up.png lock.png
lock_open.png
koha-tmpl/intranet-tmpl/npl/en/images: cross.png go-bottom.png
go-down.png go-top.png
go-up.png lock.png
lock_open.png
Log message:
Updating Reserves System.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/placerequest.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.4&r2=1.4.6.1
http://cvs.savannah.gnu.org/viewcvs/koha/request.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.28.2.4.2.3&r2=1.28.2.4.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Reserves2.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.38.4.6&r2=1.38.4.7
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/request.tmpl?cvsroot=koha&only_with_tag=dev_week&r1=1.1.2.1.2.4&r2=1.1.2.1.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/images/arrow_down.png?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/images/arrow_up.png?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/images/cross.png?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/images/go-bottom.png?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/images/go-down.png?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/images/go-top.png?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/images/go-up.png?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/images/lock.png?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/images/lock_open.png?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/npl/en/request.tmpl?cvsroot=koha&only_with_tag=dev_week&r1=1.3.2.2.2.4&r2=1.3.2.2.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/npl/en/images/cross.png?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/npl/en/images/go-bottom.png?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/npl/en/images/go-down.png?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/npl/en/images/go-top.png?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/npl/en/images/go-up.png?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/npl/en/images/lock.png?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/npl/en/images/lock_open.png?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
Patches:
Index: placerequest.pl
===================================================================
RCS file: /sources/koha/koha/Attic/placerequest.pl,v
retrieving revision 1.4
retrieving revision 1.4.6.1
diff -u -b -r1.4 -r1.4.6.1
--- placerequest.pl 15 Jan 2003 03:12:22 -0000 1.4
+++ placerequest.pl 31 Oct 2007 12:14:21 -0000 1.4.6.1
@@ -41,6 +41,13 @@
my $type=$input->param('type');
my $title=$input->param('title');
my $bornum=borrdata($borrower,'');
+my $expireDay = $input->param('expireDay');
+my $expireMonth = $input->param('expireMonth');
+my $expireYear = $input->param('expireYear');
+
+my $expireDate;
+if ( $expireDay && $expireMonth && $expireYear ) { $expireDate =
"$expireYear-$expireMonth-$expireDay"; }
+
if ($type eq 'str8' && $bornum ne ''){
my address@hidden;
@bibitems=sort @bibitems;
@@ -60,12 +67,12 @@
my $const;
if ($input->param('request') eq 'any'){
$const='a';
-
CreateReserve(\$env,$branch,$bornum->{'borrowernumber'},$biblio,$const,address@hidden,$rank[0],$notes,$title);
+
CreateReserve(\$env,$branch,$bornum->{'borrowernumber'},$biblio,$const,address@hidden,
GetNextFreePriority( $biblio ), $notes,$title, '', $expireDate);
} elsif ($reqbib[0] ne ''){
$const='o';
-
CreateReserve(\$env,$branch,$bornum->{'borrowernumber'},$biblio,$const,address@hidden,$rank[0],$notes,$title);
+
CreateReserve(\$env,$branch,$bornum->{'borrowernumber'},$biblio,$const,address@hidden,
GetNextFreePriority( $biblio ), $notes,$title, '', $expireDate);
} else {
-
CreateReserve(\$env,$branch,$bornum->{'borrowernumber'},$biblio,'a',address@hidden,$rank[0],$notes,$title);
+
CreateReserve(\$env,$branch,$bornum->{'borrowernumber'},$biblio,'a',address@hidden,
GetNextFreePriority(), $notes,$title, '', $expireDate);
}
#print @realbi;
Index: request.pl
===================================================================
RCS file: /sources/koha/koha/Attic/request.pl,v
retrieving revision 1.28.2.4.2.3
retrieving revision 1.28.2.4.2.4
diff -u -b -r1.28.2.4.2.3 -r1.28.2.4.2.4
--- request.pl 11 Jun 2007 23:58:59 -0000 1.28.2.4.2.3
+++ request.pl 31 Oct 2007 12:14:21 -0000 1.28.2.4.2.4
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: request.pl,v 1.28.2.4.2.3 2007/06/11 23:58:59 rangi Exp $
+# $Id: request.pl,v 1.28.2.4.2.4 2007/10/31 12:14:21 kylemhall Exp $
#script to place reserves/requests
#writen 2/1/00 by address@hidden
@@ -37,6 +37,8 @@
use CGI;
use C4::Date;
+CancelExpiredReserves();
+
my $input = new CGI;
my ($template, $borrowernumber, $cookie)
= get_template_and_user({template_name => "request.tmpl",
@@ -46,8 +48,59 @@
flagsrequired => {reserveforothers => 1},
});
-# get biblio information....
+# Look for a passed biblionumber
my $bib = $input->param('bib');
+
+# Check for actions
+my $action = $input->param('action');
+
+warn "Action: $action";
+
+if ( $action eq 'move' ) {
+ my $where = $input->param('where');
+ my $borrowernumber = $input->param('borrowernumber');
+ my $biblionumber = $input->param('biblionumber');
+ my $date = $input->param('date');
+
+ $date = convertDate( $date ); ## Convert date from MM/DD/YY to
YYYY-MM-DD
+
+ AlterPriority( $where, $borrowernumber, $biblionumber, $date );
+} elsif ( $action eq 'cancel' ) {
+ my $borrowernumber = $input->param('borrowernumber');
+ my $biblionumber = $input->param('biblionumber');
+ CancelReserve( $biblionumber, '', $borrowernumber );
+} elsif ( $action eq 'lock' ) {
+ my $borrowernumber = $input->param('borrowernumber');
+ my $biblionumber = $input->param('biblionumber');
+ my $date = $input->param('date');
+
+ $date = convertDate( $date );
+
+ TogglePriorityLock( $borrowernumber, $biblionumber, $date );
+} elsif ( $action eq 'setLowestPriority' ) {
+ my $borrowernumber = $input->param('borrowernumber');
+ my $biblionumber = $input->param('biblionumber');
+ my $date = $input->param('date');
+
+ $date = convertDate( $date );
+
+ ToggleLowestPriority( $borrowernumber, $biblionumber, $date );
+} elsif ( $action eq 'updatePickupLocation' ) {
+ my $borrowernumber = $input->param('borrowernumber');
+ my $biblionumber = $input->param('biblionumber');
+ my $date = $input->param('date');
+ my $newBranchcode = $input->param('branchcode');
+
+ $date = convertDate( $date );
+
+ UpdatePickupLocation( $borrowernumber, $biblionumber, $date,
$newBranchcode );
+}
+
+## We need to put the biblionumber into $bib so the rest of the script works.
+$bib = $input->param('biblionumber') if $action;
+FixPriorities( $bib );
+
+# Get biblio information....
my $dat = bibdata($bib);
# get existing reserves .....
@@ -59,19 +112,6 @@
}
}
-# make priorities options
-my $num = $count + 1;
-my $newpriority = $num;
-
-#priorityoptions building
-my @optionloop;
-for (my $i=1; $i<=$num; $i++){
- my %option;
- $option{num}=$i;
- $option{selected}=($i==$num);
- push(@optionloop, \%option);
-}
-
# todays date
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);
$year=$year+1900;
@@ -142,14 +182,6 @@
my $branches = getbranches();
foreach my $res (sort {$a->{'found'} cmp $b->{'found'}} @$reserves){
my %reserve;
-# my $prioropt = priorityoptions($totalcount, $res->{'priority'});
- my @optionloop;
- for (my $i=1; $i<=$totalcount; $i++){
- my %option;
- $option{num}=$i;
- $option{selected}=($i==$res->{'priority'});
- push(@optionloop, \%option);
- }
my @branchloop;
foreach my $br (keys %$branches) {
# (next) unless $branches->{$br}->{'IS'};
@@ -158,7 +190,8 @@
my %abranch;
$abranch{'selected'}=($br eq $res->{'branchcode'});
$abranch{'branch'}=$br;
- $abranch{'branchname'}=$branches->{$br}->{'branchname'};
+ $abranch{'branchname'}=$branches->{$br}->{'branchcode'}; ##
Uncomment this line for branch codes in 'Pickup Location'
+# $abranch{'branchname'}=$branches->{$br}->{'branchname'}; ##
Uncomment this line for full branch names in 'Pickup Location'
push(@branchloop,\%abranch);
}
@@ -182,6 +215,9 @@
}
$reserve{'date'} = format_date($res->{'reservedate'});
+ $reserve{'priority'} = $res->{'priority'};
+ $reserve{'lockPriority'} = $res->{'lockPriority'};
+ $reserve{'lowestPriority'} = $res->{'lowestPriority'};
$reserve{'borrowernumber'}=$res->{'borrowernumber'};
$reserve{'biblionumber'}=$res->{'biblionumber'};
$reserve{'bornum'}=$res->{'borrowernumber'};
@@ -196,7 +232,6 @@
$reserve{'itemtype'}=$res->{'itemtype'};
$reserve{'ccode'}=$res->{'ccode'};
$reserve{'branchloop'address@hidden;
- $reserve{'optionloop'address@hidden;
$reserve{'itemnumber'} = $res->{'itemnumber'};
push(@reserveloop,\%reserve);
}
@@ -206,8 +241,9 @@
my %select_branches;
my ($count2,@branches)=branches();
for (my $i=0;$i<$count2;$i++){
- push @select_branch, $branches[$i]->{'branchcode'};#
- $select_branches{$branches[$i]->{'branchcode'}} =
$branches[$i]->{'branchname'};
+ push @select_branch, $branches[$i]->{'branchcode'};
+# $select_branches{$branches[$i]->{'branchcode'}} =
$branches[$i]->{'branchcode'}; ##Uncomment this one for branch codes
+ $select_branches{$branches[$i]->{'branchcode'}} =
$branches[$i]->{'branchname'}; ##Uncomment this one for full branch names
}
my $CGIbranch=CGI::scrolling_list( -name => 'pickup',
-values => address@hidden,
@@ -219,13 +255,13 @@
my $time = time();
#setup colours
-$template->param( optionloop =>address@hidden,
+$template->param(
CGIbranch =>
$CGIbranch,
reserveloop =>
address@hidden,
'time' => $time,
bibitemloop =>
address@hidden,
date => $date,
- newpriority =>
$newpriority,
+ nextRank => $count+1,
bib => $bib,
title
=>$dat->{title});
@@ -239,3 +275,16 @@
-type => C4::Interface::CGI::Output::guesstype($template->output),
-expires=>'now'
), $template->output;
+
+## Converts a date from MM/DD/YYYY to YYYY-MM-DD
+sub convertDate {
+ my ( $date ) = @_;
+ ## Convert the date to MySQL Format.
+ my @dateParts = split( /\//, $date );
+ my $month = $dateParts[0];
+ my $day = $dateParts[1];
+ my $year = $dateParts[2];
+ $date = "$year-$month-$day";
+
+ return $date;
+}
\ No newline at end of file
Index: C4/Reserves2.pm
===================================================================
RCS file: /sources/koha/koha/C4/Attic/Reserves2.pm,v
retrieving revision 1.38.4.6
retrieving revision 1.38.4.7
diff -u -b -r1.38.4.6 -r1.38.4.7
--- C4/Reserves2.pm 4 Aug 2007 15:54:38 -0000 1.38.4.6
+++ C4/Reserves2.pm 31 Oct 2007 12:14:21 -0000 1.38.4.7
@@ -3,7 +3,7 @@
package C4::Reserves2;
-# $Id: Reserves2.pm,v 1.38.4.6 2007/08/04 15:54:38 rangi Exp $
+# $Id: Reserves2.pm,v 1.38.4.7 2007/10/31 12:14:21 kylemhall Exp $
# Copyright 2000-2002 Katipo Communications
# Copyright 2007 Liblime
@@ -28,8 +28,9 @@
use DBI;
use C4::Context;
use C4::Search;
- # FIXME - C4::Reserves2 uses C4::Search, which uses C4::Reserves2.
- # So Perl complains that all of the functions here get redefined.
+
+# FIXME - C4::Reserves2 uses C4::Search, which uses C4::Reserves2.
+# So Perl complains that all of the functions here get redefined.
#use C4::Accounts;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@@ -56,6 +57,7 @@
=cut
@ISA = qw(Exporter);
+
# FIXME Take out CalcReserveFee after it can be removed from opac-reserves.pl
@EXPORT = qw(
&FindReserves
@@ -71,10 +73,403 @@
&getreservetitle
&getAllreservenotes
&Findgroupreserve
- CanBeReserved
+ &CanBeReserved
+ AlterPriority
+ TogglePriorityLock
+ ToggleLowestPriority
+ GetNextFreePriority
+ FixPriorities
+ UpdatePickupLocation
+ CancelExpiredReserves
);
-# make all your functions, whether exported or not;
+## UpdatePickupLocation
+## Updates the branchcode set as the pickup location for the item
+## Input: Borrowernumber, Biblionumber, Today's Date ( YYYY-MM-DD ),
Branchcode of the new pickup location
+sub UpdatePickupLocation {
+ my ( $borrowernumber, $biblionumber, $date, $newBranchcode ) = @_;
+
+ my $dbh = C4::Context->dbh;
+
+ my $sth = $dbh->prepare(
+ "UPDATE reserves SET branchcode = ?
+ WHERE borrowernumber = ? AND biblionumber = ? and reservedate = ?"
+ );
+
+ $sth->execute( $newBranchcode, $borrowernumber, $biblionumber, $date );
+ $sth->finish;
+}
+
+## CancelExpiredReserves
+## This function finds all expired reserves and cancels them.
+## If the expirationDate field is set, and is <= today, it will be canceled
+sub CancelExpiredReserves {
+ my $dbh = C4::Context->dbh;
+
+ my $sth = $dbh->prepare(
+ "UPDATE reserves SET priority = ?, cancellationdate = CURRENT_DATE()
+ WHERE expirationDate IS NOT NULL
+ AND expirationDate <= CURRENT_DATE()"
+ );
+
+ $sth->execute( 0 );
+ $sth->finish;
+
+}
+
+## TogglePriorityLock
+## This function locks the given reserves priority, or unlocks it if it is
already locked.
+## A side-effect is that the funtion will unset lowestPriority, as
lockPriority and lowestPriority are mutually exclusive.
+## Input: Borrowernumber, Biblionumber, Date reserve was placed
+sub TogglePriorityLock {
+ my ( $borrowernumber, $biblionumber, $date ) = @_;
+
+ my $dbh = C4::Context->dbh;
+
+ ## Find this reserve
+ my $sth =
+ $dbh->prepare(
+'SELECT * FROM reserves WHERE biblionumber = ? AND borrowernumber = ? AND
reservedate = ? AND cancellationdate IS NULL'
+ );
+ $sth->execute( $biblionumber, $borrowernumber, $date );
+ my $reserve = $sth->fetchrow_hashref();
+ $sth->finish();
+
+ my $lockPriority = $reserve->{'lockPriority'};
+
+ my $newLockPriority;
+ if ( $lockPriority == 1 ) {
+ $newLockPriority = 0;
+ }
+ else {
+ $newLockPriority = 1;
+ }
+
+ my $sth = $dbh->prepare(
+ "UPDATE reserves SET lockPriority = ?, lowestPriority = ?
+ WHERE biblionumber = ?
+ AND borrowernumber = ?
+ AND reservedate = ?"
+ );
+ $sth->execute(
+ $newLockPriority, 0, $reserve->{'biblionumber'},
+ $reserve->{'borrowernumber'}, $reserve->{'reservedate'}
+ );
+ $sth->finish;
+
+}
+
+## ToggleLowestPriority
+## This funtion sets the lowestPriority field to true if is false, and false
if it is true.
+## A side-effect is that lockPriority will be set to false, because the two
are mutually exclusive.
+## Input: Borrowernumber, Biblionumber, Date reserve was placed
+sub ToggleLowestPriority {
+ my ( $borrowernumber, $biblionumber, $date ) = @_;
+
+ my $dbh = C4::Context->dbh;
+
+ ## Find this reserve
+ my $sth =
+ $dbh->prepare(
+'SELECT * FROM reserves WHERE biblionumber = ? AND borrowernumber = ? AND
reservedate = ? AND cancellationdate IS NULL'
+ );
+ $sth->execute( $biblionumber, $borrowernumber, $date );
+ my $reserve = $sth->fetchrow_hashref();
+ $sth->finish();
+
+ my $lowestPriority = $reserve->{'lowestPriority'};
+
+ my $newLowestPriority;
+ if ( $lowestPriority == 1 ) {
+ $newLowestPriority = 0;
+ }
+ else {
+ $newLowestPriority = 1;
+ }
+
+ my $sth = $dbh->prepare(
+ "UPDATE reserves SET lowestPriority = ?, lockPriority = ?
+ WHERE biblionumber = ?
+ AND borrowernumber = ?
+ AND reservedate = ?"
+ );
+ $sth->execute(
+ $newLowestPriority, 0, $reserve->{'biblionumber'},
+ $reserve->{'borrowernumber'}, $reserve->{'reservedate'}
+ );
+ $sth->finish;
+
+ FixPriorities( $biblionumber );
+}
+
+## AlterPriority
+## This function changes a reserve's priority up, down, to the top, or to the
bottom.
+## Input: $where is 'up', 'down', 'top' or 'bottom'. Biblionumber, Date
reserve was placed
+## Outpute: None on success, -1 on failure
+sub AlterPriority {
+ my ( $where, $borrowernumber, $biblionumber, $date ) = @_;
+
+ my $newPriority;
+
+ my $dbh = C4::Context->dbh;
+
+ ## Find this reserve
+ my $sth =
+ $dbh->prepare(
+'SELECT * FROM reserves WHERE biblionumber = ? AND borrowernumber = ? AND
reservedate = ? AND cancellationdate IS NULL'
+ );
+ $sth->execute( $biblionumber, $borrowernumber, $date );
+ my $reserve = $sth->fetchrow_hashref();
+ $sth->finish();
+
+ if ( $where eq 'up' || $where eq 'down' ) {
+ my $oldPriority = $reserve->{'priority'};
+ if ( $where eq 'up' ) {
+ $newPriority = $oldPriority - 1;
+ }
+ else {
+ $newPriority = $oldPriority + 1;
+ }
+
+ my $reserveToSwitch;
+ ## Find the reserve that we will be switching priorities with.
+ my $canBeSwitched = 0;
+ while ( !$canBeSwitched ) {
+
+ my $sth =
+ $dbh->prepare(
+ 'SELECT * FROM reserves WHERE biblionumber = ? AND priority =
?'
+ );
+ $sth->execute( $biblionumber, $newPriority );
+ $reserveToSwitch = $sth->fetchrow_hashref();
+ $sth->finish();
+
+ ## If the reserve we want to switch with is locked, we must skip
over it. Find the next unlocked priority.
+ if ( $reserveToSwitch->{'lockPriority'} ) {
+ if ( $where eq 'up' ) {
+ $newPriority--;
+ }
+ else {
+ $newPriority++;
+ }
+ }
+ else {
+ $canBeSwitched = 1;
+ }
+
+ ## If all the reserve ahead of this one are locked in place, we
cannot move it up. Return -1 to signify move failed.
+ if ( $newPriority == 0 ) {
+ return -1;
+ }
+
+ }
+
+ ## Switch the priorties of the two reserves
+ my $sth = $dbh->prepare(
+ "UPDATE reserves SET priority = ?
+ WHERE biblionumber = ?
+ AND borrowernumber = ?
+ AND reservedate = ?"
+ );
+ $sth->execute(
+ $newPriority, $reserve->{'biblionumber'},
+ $reserve->{'borrowernumber'}, $reserve->{'reservedate'}
+ );
+ $sth->finish;
+
+ my $sth = $dbh->prepare(
+ "UPDATE reserves SET priority = ?
+ WHERE biblionumber = ?
+ AND borrowernumber = ?
+ AND reservedate = ?"
+ );
+ $sth->execute(
+ $oldPriority,
+ $reserveToSwitch->{'biblionumber'},
+ $reserveToSwitch->{'borrowernumber'},
+ $reserveToSwitch->{'reservedate'}
+ );
+ $sth->finish;
+
+ }
+
+ if ( $where eq 'top' ) {
+ $newPriority = AlterPriority( 'up', $borrowernumber, $biblionumber,
$date );
+ while ( $newPriority > 1 ) {
+ $newPriority = AlterPriority( $where, $borrowernumber,
$biblionumber, $date );
+ }
+ }
+
+ if ( $where eq 'bottom' ) {
+ my $targetPriority = GetLastUsedPriority( $biblionumber );
+ $newPriority = AlterPriority( 'down', $borrowernumber, $biblionumber,
$date );
+ while ( $newPriority < $targetPriority ) {
+ $newPriority = AlterPriority( 'down', $borrowernumber,
$biblionumber, $date );
+ }
+ }
+
+ return $newPriority;
+
+}
+
+## FixPriorities
+## Renumbers the priorities to all priority numbers are consecutive.
+## Input: Biblionumber
+sub FixPriorities {
+ my ( $biblionumber ) = @_;
+
+ my $dbh = C4::Context->dbh;
+
+ my @lockedPriorities = _GetLockedPriorities($biblionumber);
+
+ my ( $reservesCount, $reserves ) = FindReserves($biblionumber);
+
+ my @lowestPriorityReserves;
+
+ my $workingPriority = 1;
+
+ foreach my $res (@$reserves) {
+ if ( $res->{'lowestPriority'} ) {
+ push( @lowestPriorityReserves, $res );
+ } elsif ( $res->{'found'} eq 'W' ) {
+ ## We don't want to alter the priority of Waiting reserves.
+ ## Do Nothing.
+ } else {
+ unless ( $res->{'lockPriority'} ) {
+
+ my $thisPriorityLocked = 1;
+ while ($thisPriorityLocked) {
+ if ( _inArray( $workingPriority, @lockedPriorities ) ) {
+ $workingPriority++;
+ }
+ else {
+ $thisPriorityLocked = 0;
+ }
+ }
+
+ my $sth = $dbh->prepare(
+ "UPDATE reserves SET priority = ?
+ WHERE biblionumber = ?
+ AND borrowernumber = ?
+ AND reservedate = ?"
+ );
+ $sth->execute(
+ $workingPriority,
+ $res->{'biblionumber'},
+ $res->{'borrowernumber'},
+ $res->{'reservedate'}
+ );
+ $sth->finish;
+ }
+ $workingPriority++;
+ }
+ }
+
+ foreach my $res ( @lowestPriorityReserves ) {
+ my $sth = $dbh->prepare(
+ "UPDATE reserves SET priority = ?
+ WHERE biblionumber = ?
+ AND borrowernumber = ?
+ AND reservedate = ?"
+ );
+ $sth->execute(
+ $workingPriority,
+ $res->{'biblionumber'},
+ $res->{'borrowernumber'},
+ $res->{'reservedate'}
+ );
+
+ $workingPriority++;
+
+ }
+}
+
+## Generic function to test for an element being in an array
+sub _inArray {
+ my ( $elt, @array ) = @_;
+ foreach my $a (@array) {
+ if ( $elt == $a ) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+## Returns a list of reserves priorities wehere lockPriority is set.
+sub _GetLockedPriorities {
+ my ($biblionumber) = @_;
+
+ my $dbh = C4::Context->dbh;
+
+ my $sth =
+ $dbh->prepare(
+"SELECT * FROM reserves WHERE biblionumber = ? AND lockPriority = '1' AND
cancellationdate IS NULL"
+ );
+ $sth->execute($biblionumber);
+
+ my @lockedPriorities;
+ while ( my $reserve = $sth->fetchrow_hashref() ) {
+ push( @lockedPriorities, $reserve->{'priority'} );
+ }
+ $sth->finish();
+
+ return @lockedPriorities;
+}
+
+## Because we can lock a reserves priority, there can be holes in the list of
used priorities.
+## This function counts up until it finds the next unused priority.
+sub GetNextFreePriority {
+ my ($biblionumber) = @_;
+
+ my $dbh = C4::Context->dbh;
+
+ my $isPriorityUsed = 1;
+ my $i = 1;
+
+ while ( $isPriorityUsed ) {
+ my $sth =
+ $dbh->prepare(
+ "SELECT COUNT(*) as priorityUsed FROM reserves WHERE biblionumber =
? AND priority = ? AND ( cancellationdate IS NULL OR cancellationdate <
CURRENT_DATE() )"
+ );
+ $sth->execute( $biblionumber, $i );
+
+
+ my $data = $sth->fetchrow_hashref();
+ my $priorityUsed = $data->{'priorityUsed'};
+ $sth->finish();
+
+ if ( $priorityUsed ) {
+ $i++;
+ } else {
+ $isPriorityUsed = 0;
+ }
+ }
+
+ return $i;
+}
+
+## Returns the lowest priority number currently being used.
+sub GetLastUsedPriority {
+ my ($biblionumber) = @_;
+
+ my $dbh = C4::Context->dbh;
+
+ my $isPriorityUsed = 1;
+ my $i = 1;
+
+ my $sth =
+ $dbh->prepare( ## Everything past biblionumber = ? can probably be
removed
+ "SELECT MAX(priority) as lastPriority FROM reserves WHERE
biblionumber = ? AND ( cancellationdate IS NULL OR cancellationdate <
CURRENT_DATE() )"
+ );
+ $sth->execute( $biblionumber );
+
+
+ my $data = $sth->fetchrow_hashref();
+ my $lastPriority = $data->{'lastPriority'};
+
+ return $lastPriority;
+}
=item FindReserves
@@ -104,19 +499,24 @@
reserves, borrowers, and biblio tables of the Koha database.
=cut
+
#'
sub FindReserves {
- my ($bib,$bor)address@hidden;
+ my ( $bib, $bor ) = @_;
my $dbh = C4::Context->dbh;
+
# Find the desired items in the reserves
- my $query="SELECT *,reserves.branchcode,biblio.title AS btitle,
reserves.timestamp as rtimestamp,itemnumber FROM reserves,borrowers,biblio ";
+ my $query =
+"SELECT *,reserves.branchcode,biblio.title AS btitle, reserves.timestamp as
rtimestamp,itemnumber FROM reserves,borrowers,biblio";
+
# FIXME - These three bits of SQL seem to contain a fair amount of
# redundancy. Wouldn't it be better to have a @clauses array, add
# one or two clauses as necessary, then join(" AND ", @clauses) ?
# FIXME: not keen on quote() and interpolation either, but it looks safe
- if ($bib ne ''){
+ if ( $bib ne '' ) {
$bib = $dbh->quote($bib);
- if ($bor ne ''){
+ if ( $bor ne '' ) {
+
# Both $bib and $bor specified
# Find a particular book for a particular patron
$bor = $dbh->quote($bor);
@@ -126,7 +526,9 @@
and biblio.biblionumber =
$bib
and cancellationdate is NULL
and (found <> 'F' or found is
NULL)";
- } else {
+ }
+ else {
+
# $bib specified, but not $bor
# Find a particular book for all patrons
$query .= " where reserves.borrowernumber =
borrowers.borrowernumber
@@ -135,7 +537,9 @@
and cancellationdate is NULL
and (found <> 'F' or found is NULL)";
}
- } else {
+ }
+ else {
+
# FIXME - Check that $bor was given
# No $bib given.
# Find all books for the given patron.
@@ -145,33 +549,42 @@
and cancellationdate is NULL and
(found <> 'F' or found is NULL)";
}
- $query.=" order by priority";
- my $sth=$dbh->prepare($query);
+ $query .= " order by priority";
+ my $sth = $dbh->prepare($query);
$sth->execute;
my @results;
- while (my $data=$sth->fetchrow_hashref){
+ while ( my $data = $sth->fetchrow_hashref ) {
+
# FIXME - What is this if-statement doing? How do constraints
work?
- if ($data->{'constrainttype'} eq 'o') {
- my $csth=$dbh->prepare("SELECT biblioitemnumber FROM
reserveconstraints
+ if ( $data->{'constrainttype'} eq 'o' ) {
+ my $csth = $dbh->prepare(
+ "SELECT biblioitemnumber FROM reserveconstraints
WHERE biblionumber = ?
AND borrowernumber = ?
- AND reservedate =
?");
- $csth->execute($data->{'biblionumber'},
$data->{'borrowernumber'}, $data->{'reservedate'});
+ AND reservedate = ?"
+ );
+ $csth->execute(
+ $data->{'biblionumber'},
+ $data->{'borrowernumber'},
+ $data->{'reservedate'}
+ );
my ($bibitemno) = $csth->fetchrow_array;
$csth->finish;
+
# Look up the book we just found.
my $bdata = C4::Search::bibitemdata($bibitemno);
+
# Add the results of this latest search to the current
# results.
# FIXME - An 'each' would probably be more efficient.
- foreach my $key (keys %$bdata) {
+ foreach my $key ( keys %$bdata ) {
$data->{$key} = $bdata->{$key};
}
}
push @results, $data;
}
$sth->finish;
- return($#results+1,address@hidden);
+ return ( $#results + 1, address@hidden );
}
=item CheckReserves
@@ -204,44 +617,57 @@
table in the Koha database.
=cut
+
#'
sub CheckReserves {
- my ($item, $barcode) = @_;
+ my ( $item, $barcode ) = @_;
+
#warn "In CheckReserves: itemnumber = $item , barcode: $barcode";
my $dbh = C4::Context->dbh;
- my ( $sth, $query ) ;
- if (C4::Context->preference("item-level_itypes") ) {
- $query = "SELECT items.biblionumber, items.biblioitemnumber,
itemtypes.notforloan, itemtypes.notforreserve
+ my ( $sth, $query );
+ if ( C4::Context->preference("item-level_itypes") ) {
+ $query =
+"SELECT items.biblionumber, items.biblioitemnumber, itemtypes.notforloan,
itemtypes.notforreserve
FROM items, itemtypes
- WHERE items.itype = itemtypes.itemtype " ;
- } else {
- $query = "SELECT items.biblionumber, items.biblioitemnumber,
itemtypes.notforloan, itemtypes.notforreserve
+ WHERE items.itype = itemtypes.itemtype ";
+ }
+ else {
+ $query =
+"SELECT items.biblionumber, items.biblioitemnumber, itemtypes.notforloan,
itemtypes.notforreserve
FROM items, biblioitems, itemtypes
WHERE items.biblioitemnumber =
biblioitems.biblioitemnumber
AND biblioitems.itemtype = itemtypes.itemtype ";
- };
+ }
if ($item) {
$query .= " AND itemnumber= ?"; # .
$dbh->quote($item);
$sth = $dbh->prepare($query);
$sth->execute($item);
- } else {
- $query .= " AND barcode=?"; # .
$dbh->quote($barcode); # the execute() placeholder handles quoting.
+ }
+ else {
+ $query .=
+ " AND barcode=?"
+ ; # . $dbh->quote($barcode); # the execute() placeholder handles
quoting.
$sth = $dbh->prepare($query);
$sth->execute($barcode);
- };
+ }
-# # FIXME - This function uses $item later on. Ought to set it here.
+ # # FIXME - This function uses $item later on. Ought to set it here.
- my ($biblio, $bibitem, $notforloan, $notforreserve) = $sth->fetchrow_array;
+ my ( $biblio, $bibitem, $notforloan, $notforreserve ) =
+ $sth->fetchrow_array;
$sth->finish;
-# if item is not for loan it cannot be reserved either.....
- return (0, 0) if ($notforloan);
+
+ # if item is not for loan it cannot be reserved either.....
+ return ( 0, 0 ) if ($notforloan);
+
# if item cant be reserved
- return (0, 0) if ($notforreserve);
-# get the reserves...
+ return ( 0, 0 ) if ($notforreserve);
+
+ # get the reserves...
# Find this item in the reserves
- my ($count, @reserves) = Findgroupreserve($bibitem, $biblio);
-#warn "Found $count reserves.";
+ my ( $count, @reserves ) = Findgroupreserve( $bibitem, $biblio );
+
+ #warn "Found $count reserves.";
# $priority and $highest are used to find the most important item
# in the list returned by &Findgroupreserve. (The lower $priority,
# the more important the item.)
@@ -250,10 +676,13 @@
my $highest;
if ($count) {
foreach my $res (@reserves) {
+
# FIXME - $item might be undefined or empty: the caller
# might be searching by barcode.
- if ($res->{'itemnumber'} == $item) {
- if ( C4::Context->preference('itemlevelreserves') &&
$res->{'Found'} ne 'W' ) {
+ if ( $res->{'itemnumber'} == $item ) {
+ if ( C4::Context->preference('itemlevelreserves')
+ && $res->{'Found'} ne 'W' )
+ {
return ( "Reserved", $res );
}
else {
@@ -262,10 +691,12 @@
}
}
else {
+
# See if this item is more important than what we've got
# so far.
- if ($res->{'priority'} != 0 && $res->{'priority'} <
$priority) {
- if (
C4::Context->preference('itemlevelreserves') ){
+ if ( $res->{'priority'} != 0 && $res->{'priority'} < $priority
)
+ {
+ if ( C4::Context->preference('itemlevelreserves') ) {
}
else {
$priority = $res->{'priority'};
@@ -281,9 +712,10 @@
# next in line to get this book.
if ($highest) { # FIXME - $highest might be undefined
$highest->{'itemnumber'} = $item;
- return ("Reserved", $highest);
- } else {
- return (0, 0);
+ return ( "Reserved", $highest );
+ }
+ else {
+ return ( 0, 0 );
}
}
@@ -304,47 +736,56 @@
priorities of the other people who are waiting on the book.
=cut
+
#'
sub CancelReserve {
- my ($biblio, $item, $borr) = @_;
+ my ( $biblio, $item, $borr ) = @_;
my $dbh = C4::Context->dbh;
+
#warn "In CancelReserve";
- if (($item and $borr) and (not $biblio)) {
+ if ( ( $item and $borr ) and ( not $biblio ) ) {
+
# removing a waiting reserve record....
# update the database...
- my $sth = $dbh->prepare("update reserves set cancellationdate =
now(),
+ my $sth = $dbh->prepare(
+ "update reserves set cancellationdate = now(),
found = Null,
priority = 0
where
itemnumber = ?
-
and borrowernumber = ?");
- $sth->execute($item,$borr);
+
and borrowernumber = ?"
+ );
+ $sth->execute( $item, $borr );
$sth->finish;
}
- if (($biblio and $borr) and (not $item)) {
+ if ( ( $biblio and $borr ) and ( not $item ) ) {
+
# removing a reserve record....
# get the prioritiy on this record....
my $priority;
- my $sth=$dbh->prepare("SELECT priority FROM reserves
+ my $sth = $dbh->prepare(
+ "SELECT priority FROM reserves
WHERE biblionumber = ?
AND borrowernumber = ?
AND cancellationdate is NULL
-
AND (found <> 'F' or found is NULL)");
- $sth->execute($biblio,$borr);
+
AND (found <> 'F' or found is NULL)"
+ );
+ $sth->execute( $biblio, $borr );
($priority) = $sth->fetchrow_array;
$sth->finish;
# update the database, removing the record...
- $sth = $dbh->prepare("update reserves set cancellationdate =
now(),
+ $sth = $dbh->prepare(
+ "update reserves set cancellationdate = now(),
found = Null,
priority = 0
where
biblionumber = ?
and borrowernumber = ?
and cancellationdate is NULL
-
and (found <> 'F' or found is NULL)");
- $sth->execute($biblio,$borr);
+
and (found <> 'F' or found is NULL)"
+ );
+ $sth->execute( $biblio, $borr );
$sth->finish;
- # now fix the priority on the others....
- fixpriority($priority, $biblio);
+
}
}
@@ -359,6 +800,7 @@
whose keys are fields from the reserves table in the Koha database.
=cut
+
#'
sub FillReserve {
my ($res) = @_;
@@ -366,7 +808,8 @@
# fill in a reserve record....
# FIXME - Remove some of the redundancy here
- my $biblio = $res->{'biblionumber'}; my $qbiblio =$biblio;
+ my $biblio = $res->{'biblionumber'};
+ my $qbiblio = $biblio;
my $borr = $res->{'borrowernumber'};
my $resdate = $res->{'reservedate'};
@@ -377,8 +820,8 @@
WHERE biblionumber = ?
AND borrowernumber = ?
AND reservedate = ?";
- my $sth=$dbh->prepare($query);
- $sth->execute($qbiblio,$borr,$resdate);
+ my $sth = $dbh->prepare($query);
+ $sth->execute( $qbiblio, $borr, $resdate );
($priority) = $sth->fetchrow_array;
$sth->finish;
}
@@ -391,42 +834,23 @@
AND reservedate = ?
AND borrowernumber = ?";
my $sth = $dbh->prepare($query);
- $sth->execute($qbiblio,$resdate,$borr);
+ $sth->execute( $qbiblio, $resdate, $borr );
$sth->finish;
}
- # now fix the priority on the others (if the priority wasn't
- # already sorted!)....
- unless ($priority == 0) {
- fixpriority($priority, $biblio);
- }
-}
-
-# Only used internally
-# Decrements (makes more important) the reserves for all of the
-# entries waiting on the given book, if their priority is > $priority.
-sub fixpriority {
- my ($priority, $biblio) = @_;
- my $dbh = C4::Context->dbh;
- my ($count, $reserves) = FindReserves($biblio);
- foreach my $rec (@$reserves) {
- if ($rec->{'priority'} > $priority) {
- my $sth = $dbh->prepare("UPDATE reserves SET priority = ?
- WHERE biblionumber = ?
- AND borrowernumber = ?
- AND reservedate = ?");
-
$sth->execute($rec->{'priority'},$rec->{'biblionumber'},$rec->{'borrowernumber'},$rec->{'reservedate'});
- $sth->finish;
- }
- }
+ FixPriorities($biblio)
+ ; ## This internal function reflows the priority numbers.
}
# XXX - POD
sub ReserveWaiting {
- my ($item, $borr) = @_;
+warn "Executing Reserves2::ReserveWaiting";
+ my ( $item, $borr ) = @_;
my $dbh = C4::Context->dbh;
-# get priority and biblionumber....
- my $sth = $dbh->prepare("SELECT reserves.priority as priority,
+
+ # get priority and biblionumber....
+ my $sth = $dbh->prepare(
+ "SELECT reserves.priority as priority,
reserves.biblionumber as biblionumber,
reserves.branchcode as branchcode,
reserves.timestamp as timestamp
@@ -435,54 +859,63 @@
AND items.itemnumber = ?
AND reserves.borrowernumber = ?
AND reserves.cancellationdate is NULL
- AND (reserves.found <> 'F' or reserves.found is NULL)");
- $sth->execute($item,$borr);
+ AND (reserves.found <> 'F' or reserves.found is NULL)"
+ );
+ $sth->execute( $item, $borr );
my $data = $sth->fetchrow_hashref;
$sth->finish;
my $biblio = $data->{'biblionumber'};
my $timestamp = $data->{'timestamp'};
-# update reserves record....
- $sth = $dbh->prepare("UPDATE reserves SET priority = 0, found = 'W',
itemnumber = ?
+
+ # update reserves record....
+ $sth = $dbh->prepare(
+ "UPDATE reserves SET priority = 0, found = 'W', itemnumber = ?
WHERE borrowernumber = ?
AND biblionumber = ?
- AND timestamp = ?");
- $sth->execute($item,$borr,$biblio,$timestamp);
+ AND timestamp = ?"
+ );
+ $sth->execute( $item, $borr, $biblio, $timestamp );
$sth->finish;
-# now fix up the remaining priorities....
- fixpriority($data->{'priority'}, $biblio);
+
+ # now fix up the remaining priorities....
+ FixPriorities( $biblio );
my $branchcode = $data->{'branchcode'};
return $branchcode;
}
sub CheckWaiting {
- my ($borr)address@hidden;
+ my ($borr) = @_;
my $dbh = C4::Context->dbh;
my @itemswaiting;
- my $sth = $dbh->prepare("SELECT * FROM reserves
+ my $sth = $dbh->prepare(
+ "SELECT * FROM reserves
WHERE borrowernumber = ?
AND reserves.found = 'W'
- AND cancellationdate is NULL");
+ AND cancellationdate is NULL"
+ );
$sth->execute($borr);
- while (my $data=$sth->fetchrow_hashref) {
- push(@itemswaiting,$data);
+ while ( my $data = $sth->fetchrow_hashref ) {
+ push( @itemswaiting, $data );
}
$sth->finish;
- return (scalar(@itemswaiting),address@hidden);
+ return ( scalar(@itemswaiting), address@hidden );
}
# for SMFPL
sub getAllreservenotes {
- my ($biblionumber)address@hidden;
+ my ($biblionumber) = @_;
my $dbh = C4::Context->dbh;
my @notes;
- my $sth = $dbh->prepare("SELECT borrowernumber, reservenotes, priority
FROM reserves WHERE biblionumber = ?
- AND reserves.found = 'W' AND cancellationdate is
NULL order by priority");
+ my $sth = $dbh->prepare(
+"SELECT borrowernumber, reservenotes, priority FROM reserves WHERE
biblionumber = ?
+ AND reserves.found = 'W' AND cancellationdate is
NULL order by priority"
+ );
$sth->execute($biblionumber);
- while (my $data=$sth->fetchrow_hashref) {
- push(@notes,$data);
+ while ( my $data = $sth->fetchrow_hashref ) {
+ push( @notes, $data );
}
$sth->finish;
- return (address@hidden);
+ return ( address@hidden );
}
=item Findgroupreserve
@@ -504,11 +937,13 @@
C<biblioitemnumber>.
=cut
+
#'
sub Findgroupreserve {
- my ($bibitem,$biblio)address@hidden;
+ my ( $bibitem, $biblio ) = @_;
my $dbh = C4::Context->dbh;
- my $sth=$dbh->prepare("SELECT reserves.biblionumber AS
biblionumber,
+ my $sth = $dbh->prepare(
+ "SELECT reserves.biblionumber AS biblionumber,
reserves.borrowernumber AS borrowernumber,
reserves.reservedate AS reservedate,
reserves.branchcode AS branchcode,
@@ -527,8 +962,9 @@
AND reserves.reservedate
=reserveconstraints.reservedate )
OR reserves.constrainttype='a' )
AND reserves.cancellationdate is NULL
- AND (reserves.found <> 'F' or reserves.found is NULL)");
- if (C4::Context->preference('itemlevelreserves')){
+ AND (reserves.found <> 'F' or reserves.found is NULL)"
+ );
+ if ( C4::Context->preference('itemlevelreserves') ) {
$sth = $dbh->prepare(
"SELECT reserves.biblionumber AS
biblionumber,
reserves.borrowernumber AS borrowernumber,
@@ -548,48 +984,64 @@
$sth->execute($biblio);
}
else {
- $sth->execute($biblio, $bibitem);
+ $sth->execute( $biblio, $bibitem );
}
my @results;
- while (my $data=$sth->fetchrow_hashref){
- push(@results,$data);
+ while ( my $data = $sth->fetchrow_hashref ) {
+ push( @results, $data );
}
$sth->finish;
- return(scalar(@results),@results);
+ return ( scalar(@results), @results );
}
# FIXME - A somewhat different version of this function appears in
# C4::Reserves. Pick one and stick with it.
# XXX - POD
sub CreateReserve {
- my
-($env,$branch,$borrnum,$biblionumber,$constraint,$bibitems,$priority,$notes,$title,$itemnumbers)=
@_;
- my $fee=CalcReserveFee($env,$borrnum,$biblionumber,$constraint,$bibitems);
+ my (
+ $env, $branch, $borrnum, $biblionumber, $constraint,
+ $bibitems, $priority, $notes, $title, $itemnumbers,
$expirationDate
+ )
+ = @_;
+
+ warn "Epiration date: $expirationDate";
+
+ unless ( $expirationDate ) { $expirationDate = 'NULL'; }
+
+ my $fee =
+ CalcReserveFee( $env, $borrnum, $biblionumber, $constraint, $bibitems );
my $dbh = C4::Context->dbh;
- my $const = lc substr($constraint,0,1);
+ my $const = lc substr( $constraint, 0, 1 );
my @datearr = localtime(time);
- my $resdate =(1900+$datearr[5])."-".($datearr[4]+1)."-".$datearr[3];
+ my $resdate =
+ ( 1900 + $datearr[5] ) . "-" . ( $datearr[4] + 1 ) . "-" . $datearr[3];
+
#eval {
# updates take place here
- if ($fee > 0) {
-# print $fee;
- my $nextacctno = _getnextacctno($env,$borrnum,$dbh);
- my $usth = $dbh->prepare("insert into accountlines
+ if ( $fee > 0 ) {
+
+ # print $fee;
+ my $nextacctno = _getnextacctno( $env, $borrnum, $dbh );
+ my $usth = $dbh->prepare(
+ "insert into accountlines
(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding)
values
- (?,?,now(),?,?,'Res',?)");
- $usth->execute($borrnum,$nextacctno,$fee,'Reserve Charge -'.$title,$fee);
+ (?,?,now(),?,?,'Res',?)"
+ );
+ $usth->execute( $borrnum, $nextacctno, $fee,
+ 'Reserve Charge -' . $title, $fee );
$usth->finish;
}
if ( C4::Context->preference('itemlevelreserves') ) {
- my $sth = $dbh->prepare(
- "INSERT INTO reserves
(borrowernumber,biblionumber,reservedate,branchcode,constrainttype,priority,reservenotes,itemnumber)
VALUES (?,?,?,?,?,?,?,?)"
+ my $sth =
+ $dbh->prepare(
+"INSERT INTO reserves
(borrowernumber,biblionumber,reservedate,branchcode,constrainttype,priority,reservenotes,itemnumber,
expirationDate) VALUES (?,?,?,?,?,?,?,?,?)"
);
if ( $constraint ne 'a' ) {
foreach my $item (@$bibitems) {
$sth->execute( $borrnum, $biblionumber,
$resdate, $branch,
- $const, $priority, $notes, $item );
+ $const, $priority, $notes, $item, $expirationDate );
$priority++;
}
$sth->finish();
@@ -602,12 +1054,13 @@
}
}
else {
- my $sth = $dbh->prepare(
- "INSERT INTO reserves
(borrowernumber,biblionumber,reservedate,branchcode,constrainttype,priority,reservenotes)
VALUES (?,?,?,?,?,?,?)"
+ my $sth =
+ $dbh->prepare(
+"INSERT INTO reserves
(borrowernumber,biblionumber,reservedate,branchcode,constrainttype,priority,reservenotes,
expirationDate) VALUES (?,?,?,?,?,?,?,?)"
);
$sth->execute( $borrnum, $biblionumber, $resdate, $branch,
$const,
- $priority, $notes );
+ $priority, $notes, $expirationDate );
$sth->finish;
if ( ( $const eq "o" ) || ( $const eq "e" ) ) {
@@ -615,8 +1068,9 @@
my $i = 0;
while ( $i < $numitems ) {
my $biblioitem = @$bibitems[$i];
- my $sth = $dbh->prepare(
- "INSERT INTO reserveconstraints
(borrowernumber,biblionumber,reservedate,biblioitemnumber) VALUES (?,?,?,?)"
+ my $sth =
+ $dbh->prepare(
+"INSERT INTO reserveconstraints
(borrowernumber,biblionumber,reservedate,biblioitemnumber) VALUES (?,?,?,?)"
);
$sth->execute( $borrnum, $biblionumber, $resdate, $biblioitem
);
$sth->finish;
@@ -624,7 +1078,7 @@
}
}
}
- return();
+ return ();
}
# FIXME - A functionally identical version of this function appears in
@@ -632,45 +1086,56 @@
# XXX - Internal use only
# FIXME - opac-reserves.pl need to use it, temporarily put into @EXPORT
sub CalcReserveFee {
- my ($env,$borrnum,$biblionumber,$constraint,$bibitems) = @_;
+ my ( $env, $borrnum, $biblionumber, $constraint, $bibitems ) = @_;
+
#check for issues;
my $dbh = C4::Context->dbh;
- my $const = lc substr($constraint,0,1);
- my $sth = $dbh->prepare("SELECT * FROM borrowers,categories
+ my $const = lc substr( $constraint, 0, 1 );
+ my $sth = $dbh->prepare(
+ "SELECT * FROM borrowers,categories
WHERE (borrowernumber = ?)
- AND (borrowers.categorycode = categories.categorycode)");
+ AND (borrowers.categorycode = categories.categorycode)"
+ );
$sth->execute($borrnum);
my $data = $sth->fetchrow_hashref;
$sth->finish();
my $fee = $data->{'reservefee'};
- my $cntitems = @->$bibitems;
- if ($fee > 0) {
+ my $cntitems = @- > $bibitems;
+
+ if ( $fee > 0 ) {
+
# check for items on issue
# first find biblioitem records
my @biblioitems;
- my $sth1 = $dbh->prepare("SELECT * FROM biblio,biblioitems
+ my $sth1 = $dbh->prepare(
+ "SELECT * FROM biblio,biblioitems
WHERE (biblio.biblionumber = ?)
- AND (biblio.biblionumber = biblioitems.biblionumber)");
+ AND (biblio.biblionumber = biblioitems.biblionumber)"
+ );
$sth1->execute($biblionumber);
- while (my $data1=$sth1->fetchrow_hashref) {
- if ($const eq "a") {
- push @biblioitems,$data1;
- } else {
+ while ( my $data1 = $sth1->fetchrow_hashref ) {
+ if ( $const eq "a" ) {
+ push @biblioitems, $data1;
+ }
+ else {
my $found = 0;
my $x = 0;
- while ($x < $cntitems) {
- if (@$bibitems->{'biblioitemnumber'} == $data->{'biblioitemnumber'})
{
+ while ( $x < $cntitems ) {
+ if ( @$bibitems->{'biblioitemnumber'} ==
+ $data->{'biblioitemnumber'} )
+ {
$found = 1;
}
$x++;
}
- if ($const eq 'o') {
- if ( $found == 1) {
- push @biblioitems,$data1;
+ if ( $const eq 'o' ) {
+ if ( $found == 1 ) {
+ push @biblioitems, $data1;
}
- } else {
- if ($found == 0) {
- push @biblioitems,$data1;
+ }
+ else {
+ if ( $found == 0 ) {
+ push @biblioitems, $data1;
}
}
}
@@ -680,100 +1145,131 @@
my $issues = 0;
my $x = 0;
my $allissued = 1;
- while ($x < $cntitemsfound) {
+ while ( $x < $cntitemsfound ) {
my $bitdata = $biblioitems[$x];
- my $sth2 = $dbh->prepare("SELECT * FROM items
- WHERE biblioitemnumber = ?");
- $sth2->execute($bitdata->{'biblioitemnumber'});
- while (my $itdata=$sth2->fetchrow_hashref) {
- my $sth3 = $dbh->prepare("SELECT * FROM issues
+ my $sth2 = $dbh->prepare(
+ "SELECT * FROM items
+ WHERE biblioitemnumber = ?"
+ );
+ $sth2->execute( $bitdata->{'biblioitemnumber'} );
+ while ( my $itdata = $sth2->fetchrow_hashref ) {
+ my $sth3 = $dbh->prepare(
+ "SELECT * FROM issues
WHERE itemnumber = ?
- AND returndate IS NULL");
- $sth3->execute($itdata->{'itemnumber'});
- if (my $isdata=$sth3->fetchrow_hashref) {
- } else {
+ AND returndate IS NULL"
+ );
+ $sth3->execute( $itdata->{'itemnumber'} );
+ if ( my $isdata = $sth3->fetchrow_hashref ) {
+ }
+ else {
$allissued = 0;
}
}
$x++;
}
- if ($allissued == 0) {
- my $rsth = $dbh->prepare("SELECT * FROM reserves WHERE biblionumber =
?");
+ if ( $allissued == 0 ) {
+ my $rsth =
+ $dbh->prepare("SELECT * FROM reserves WHERE biblionumber = ?");
$rsth->execute($biblionumber);
- if (my $rdata = $rsth->fetchrow_hashref) {
- } else {
+ if ( my $rdata = $rsth->fetchrow_hashref ) {
+ }
+ else {
$fee = 0;
}
}
}
-# print "fee $fee";
+
+ # print "fee $fee";
return $fee;
}
# XXX - Internal use
sub _getnextacctno {
- my ($env,$bornumber,$dbh)address@hidden;
+ my ( $env, $bornumber, $dbh ) = @_;
my $nextaccntno = 1;
- my $sth = $dbh->prepare("select * from accountlines
+ my $sth = $dbh->prepare(
+ "select * from accountlines
where (borrowernumber = ?)
- order by accountno desc");
+ order by accountno desc"
+ );
$sth->execute($bornumber);
- if (my $accdata=$sth->fetchrow_hashref){
+ if ( my $accdata = $sth->fetchrow_hashref ) {
$nextaccntno = $accdata->{'accountno'} + 1;
}
$sth->finish;
- return($nextaccntno);
+ return ($nextaccntno);
}
# XXX - POD
-sub updatereserves{
+sub updatereserves {
+
#subroutine to update a reserve
- my ($rank,$biblio,$borrower,$del,$branch)address@hidden;
+ my ( $rank, $biblio, $borrower, $del, $branch ) = @_;
my $dbh = C4::Context->dbh;
- if ($del == 0){
- my $sth = $dbh->prepare("Update reserves set priority=?,branchcode=? where
- biblionumber=? and borrowernumber=?");
- $sth->execute($rank,$branch,$biblio,$borrower);
+ if ( $del == 0 ) {
+ my $sth = $dbh->prepare(
+ "Update reserves set priority=?,branchcode=? where
+ biblionumber=? and borrowernumber=?"
+ );
+ $sth->execute( $rank, $branch, $biblio, $borrower );
$sth->finish();
- } else {
- my $sth=$dbh->prepare("Select * from reserves where biblionumber=? and
- borrowernumber=?");
- $sth->execute($biblio,$borrower);
- my $data=$sth->fetchrow_hashref;
+ }
+ else {
+ my $sth = $dbh->prepare(
+ "Select * from reserves where biblionumber=? and
+ borrowernumber=?"
+ );
+ $sth->execute( $biblio, $borrower );
+ my $data = $sth->fetchrow_hashref;
$sth->finish();
- $sth=$dbh->prepare("Select * from reserves where biblionumber=? and
+ $sth = $dbh->prepare(
+ "Select * from reserves where biblionumber=? and
priority > ? and cancellationdate is NULL
- order by priority") || die $dbh->errstr;
- $sth->execute($biblio,$data->{'priority'}) || die $sth->errstr;
- while (my $data=$sth->fetchrow_hashref){
+ order by priority"
+ )
+ || die $dbh->errstr;
+ $sth->execute( $biblio, $data->{'priority'} ) || die $sth->errstr;
+
+ while ( my $data = $sth->fetchrow_hashref ) {
$data->{'priority'}--;
- my $sth3=$dbh->prepare("Update reserves set priority=?
- where biblionumber=? and borrowernumber=?");
-
$sth3->execute($data->{'priority'},$data->{'biblionumber'},$data->{'borrowernumber'})
|| die $sth3->errstr;
+ my $sth3 = $dbh->prepare(
+ "Update reserves set priority=?
+ where biblionumber=? and borrowernumber=?"
+ );
+ $sth3->execute(
+ $data->{'priority'},
+ $data->{'biblionumber'},
+ $data->{'borrowernumber'}
+ )
+ || die $sth3->errstr;
$sth3->finish();
}
$sth->finish();
- $sth=$dbh->prepare("update reserves set cancellationdate=now() where
biblionumber=?
- and borrowernumber=?");
- $sth->execute($biblio,$borrower);
+ $sth = $dbh->prepare(
+ "update reserves set cancellationdate=now() where biblionumber=?
+ and borrowernumber=?"
+ );
+ $sth->execute( $biblio, $borrower );
$sth->finish;
}
}
# XXX - POD
sub UpdateReserve {
+
#subroutine to update a reserve
- my ($rank,$biblio,$borrower,$branch,$itemnumber)address@hidden;
+ my ( $rank, $biblio, $borrower, $branch, $itemnumber ) = @_;
return if $rank eq "W";
return if $rank eq "n";
- if (!$itemnumber){
- $itemnumber=0;
+ if ( !$itemnumber ) {
+ $itemnumber = 0;
}
my $dbh = C4::Context->dbh;
if ( $rank eq "del" ) {
if ( C4::Context->preference('itemlevelreserves') ) {
- if ($itemnumber == 0){
- my $sth = $dbh->prepare( "UPDATE reserves SET
cancellationdate=now() WHERE biblionumber=? AND borrowernumber=?
+ if ( $itemnumber == 0 ) {
+ my $sth = $dbh->prepare(
+"UPDATE reserves SET cancellationdate=now() WHERE biblionumber=? AND
borrowernumber=?
AND cancellationdate is NULL
AND (found <> 'F' or found is NULL) AND (itemnumber is NULL or
itemnumber = 0)"
);
@@ -781,16 +1277,18 @@
$sth->finish();
}
else {
- my $sth = $dbh->prepare(
- "UPDATE reserves SET cancellationdate=now()
WHERE itemnumber=? AND borrowernumber=? AND cancellationdate is NULL AND (found
<> 'F' or found is NULL)"
+ my $sth =
+ $dbh->prepare(
+"UPDATE reserves SET cancellationdate=now() WHERE itemnumber=? AND
borrowernumber=? AND cancellationdate is NULL AND (found <> 'F' or found is
NULL)"
);
$sth->execute( $itemnumber, $borrower );
$sth->finish();
}
}
else {
- my $sth = $dbh->prepare(
- "UPDATE reserves SET cancellationdate=now()
WHERE biblionumber = ? AND borrowernumber = ? AND cancellationdate is NULL
AND (found <> 'F' or found is NULL)"
+ my $sth =
+ $dbh->prepare(
+"UPDATE reserves SET cancellationdate=now() WHERE biblionumber = ? AND
borrowernumber = ? AND cancellationdate is NULL AND (found <> 'F' or found is
NULL)"
);
$sth->execute( $biblio, $borrower );
$sth->finish;
@@ -798,25 +1296,29 @@
}
else {
if ( C4::Context->preference('itemlevelreserves') ) {
- if ($itemnumber == 0){
- my $sth = $dbh->prepare(
- "UPDATE reserves SET priority = ? ,branchcode =
? WHERE biblionumber = ? AND borrowernumber = ? AND cancellationdate is NULL
AND (found <> 'F' or found is NULL) AND (itemnumber is NULL or itemnumber = 0)
limit 1"
+ if ( $itemnumber == 0 ) {
+ my $sth =
+ $dbh->prepare(
+"UPDATE reserves SET priority = ? ,branchcode = ? WHERE biblionumber = ? AND
borrowernumber = ? AND cancellationdate is NULL AND (found <> 'F' or found is
NULL) AND (itemnumber is NULL or itemnumber = 0) limit 1"
);
$sth->execute( $rank, $branch, $biblio,
$borrower );
$sth->finish;
}
else {
- my $sth = $dbh->prepare(
- "UPDATE reserves SET priority = ? ,branchcode =
? WHERE biblionumber = ? AND borrowernumber = ? AND itemnumber= ? AND
cancellationdate is NULL AND (found <> 'F' or found is NULL)"
+ my $sth =
+ $dbh->prepare(
+"UPDATE reserves SET priority = ? ,branchcode = ? WHERE biblionumber = ? AND
borrowernumber = ? AND itemnumber= ? AND cancellationdate is NULL AND (found <>
'F' or found is NULL)"
);
warn $itemnumber;
- $sth->execute( $rank, $branch, $biblio,
$borrower, $itemnumber );
+ $sth->execute( $rank, $branch, $biblio, $borrower,
+ $itemnumber );
$sth->finish;
}
}
else {
- my $sth = $dbh->prepare(
- "UPDATE reserves SET priority = ? ,branchcode =
?, itemnumber = NULL, found = NULL WHERE biblionumber = ? AND borrowernumber
= ? AND cancellationdate is NULL AND (found <> 'F' or found is NULL)"
+ my $sth =
+ $dbh->prepare(
+"UPDATE reserves SET priority = ? ,branchcode = ?, itemnumber = NULL, found =
NULL WHERE biblionumber = ? AND borrowernumber = ? AND cancellationdate is
NULL AND (found <> 'F' or found is NULL)"
);
$sth->execute( $rank, $branch, $biblio, $borrower );
$sth->finish;
@@ -826,31 +1328,34 @@
# XXX - POD
sub getreservetitle {
- my ($biblio,$bor,$date,$timestamp)address@hidden;
+ my ( $biblio, $bor, $date, $timestamp ) = @_;
my $dbh = C4::Context->dbh;
- my $sth=$dbh->prepare("Select * from reserveconstraints,biblioitems where
+ my $sth = $dbh->prepare(
+ "Select * from reserveconstraints,biblioitems where
reserveconstraints.biblioitemnumber=biblioitems.biblioitemnumber
and reserveconstraints.biblionumber=? and reserveconstraints.borrowernumber
= ? and reserveconstraints.reservedate=? and
- reserveconstraints.timestamp=?");
- $sth->execute($biblio,$bor,$date,$timestamp);
- my $data=$sth->fetchrow_hashref;
+ reserveconstraints.timestamp=?"
+ );
+ $sth->execute( $biblio, $bor, $date, $timestamp );
+ my $data = $sth->fetchrow_hashref;
$sth->finish;
- return($data);
+ return ($data);
}
# Checks if an item (or itemtype) can be reserved
sub CanBeReserved {
- my ($itemnumber,$itemtype) = @_;
+ my ( $itemnumber, $itemtype ) = @_;
my $dbh = C4::Context->dbh();
- if ($itemtype){
+ if ($itemtype) {
+
# we have an itemtype so just need to check that
my $query = "SELECT notforreserve FROM itemtypes WHERE itemtype
= ?";
my $sth = $dbh->prepare($query);
$sth->execute($itemtype);
- my $data=$sth->fetchrow_hashref();
- if ($data->{'notforreserve'} == 1){
+ my $data = $sth->fetchrow_hashref();
+ if ( $data->{'notforreserve'} == 1 ) {
return 0;
}
else {
@@ -858,10 +1363,12 @@
}
$sth->finish();
}
- elsif ($itemnumber){
+ elsif ($itemnumber) {
+
# check first at item level then if needed get itemtype and
check that
}
else {
return 0; #nothing passsed in, dont call the function this way
}
}
+
Index: koha-tmpl/intranet-tmpl/ccfls/en/request.tmpl
===================================================================
RCS file:
/sources/koha/koha/koha-tmpl/intranet-tmpl/ccfls/en/Attic/request.tmpl,v
retrieving revision 1.1.2.1.2.4
retrieving revision 1.1.2.1.2.5
diff -u -b -r1.1.2.1.2.4 -r1.1.2.1.2.5
--- koha-tmpl/intranet-tmpl/ccfls/en/request.tmpl 22 May 2007 11:50:38
-0000 1.1.2.1.2.4
+++ koha-tmpl/intranet-tmpl/ccfls/en/request.tmpl 31 Oct 2007 12:14:22
-0000 1.1.2.1.2.5
@@ -48,21 +48,12 @@
<!-- TMPL_VAR Name="author" --></h2>
<div class="data">
<table>
- <tr><th>Rank</th><td>
-<select name="rank-request">
- <!-- TMPL_LOOP Name="optionloop" -->
- <option value="<!-- TMPL_VAR Name="num"
-->"<!-- TMPL_IF Name="selected" --> selected="selected"<!-- /TMPL_IF -->>
- <!-- TMPL_VAR Name="num" -->
- </option>
- <!-- /TMPL_LOOP -->
- </select>
- </td></tr>
-
<tr><th><label for="rsvnotes">Notes</label></th><td><input
type="text" size="20" name="notes" id="rsvnotes"></tr>
<tr><th><label for="date">Date</label></th><td><!-- TMPL_VAR
name="date" --></td></tr>
<tr><th><label for="pickup">Pickup</label></th><td><!--
TMPL_VAR name="CGIbranch" --></td></tr>
<tr><th>Request</th><td><input type="checkbox" name="request"
id="request" value="any" checked="checked" /><label for="request">Next
Available, (or choose from list below)</label></tr>
<tr><th><label for="member">Card Number</label></th><td><input
type="text" size="10" name="member" id="member" /> <a
href="/cgi-bin/koha/members/members-home.pl?quicksearch=1"
onclick="PopWin(this, 'newwin', 300, 400); return false;">(Quick
Search)</a></td></tr>
+ <tr><th><label>Not Needed After:</th><td><input
name="expireMonth" type="text" size="2" max="2" />/<input name="expireDay"
type="text" size="2" max="2" />/<input name="expireYear" type="text" size="4"
max="4" /><i>(Optional: Input Date in the Format MM/DD/YYYY)</i></td></tr>
</table>
</div>
@@ -107,34 +98,51 @@
<input type="submit" name="submit" value="Place New Request" class="submit"
onclick="this.value='Please wait...'; this.disabled=true;" />
</form>
<!-- TMPL_IF NAME="reserveloop" -->
-<form name="T<!-- TMPL_VAR Name="time" -->" action="modrequest.pl"
method="post">
+<form name="updateReservesForm" action="modrequest.pl" method="post">
<h3>Modify Existing Requests</h3>
<div class="table"><table>
<tr>
- <th>Rank</th>
+ <th></th>
+ <th></th>
<th>Patron</th>
<th>Notes</th>
<th>Date</th>
<th>Pickup Location</th>
<th>Request</th>
+ <th><img src="<!-- TMPL_VAR NAME='themelang'
-->/images/lock.png" border="0"/ title="Toggle Lock In Place - If the reserve
is locked in place, it's rank will not change."></th>
+ <th><img src="<!-- TMPL_VAR NAME='themelang'
-->/images/go-bottom.png" border="0"/ title="Toggle Set to Lowest
Priority"></th>
+ <th><img src="<!-- TMPL_VAR NAME='themelang'
-->/images/cross.png" border="0"/ title="Cancel Reserves"></th>
</tr>
<!-- TMPL_LOOP Name="reserveloop" -->
- <tr>
+ <tr width=100>
+ <td style="white-space:nowrap;">
+ <a title="Move Reserve Up"
href="/cgi-bin/koha/request.pl?action=move&where=up&borrowernumber=<!--
TMPL_VAR Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR
Name="biblionumber" -->&date=<!-- TMPL_VAR Name="date" -->">
+ <img src="<!-- TMPL_VAR
NAME='themelang' -->/images/go-up.png" border="0" />
+ </a>
+
+ <a title="Move Reserve To Top"
href="/cgi-bin/koha/request.pl?action=move&where=top&borrowernumber=<!--
TMPL_VAR Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR
Name="biblionumber" -->&date=<!-- TMPL_VAR Name="date" -->">
+ <img src="<!-- TMPL_VAR
NAME='themelang' -->/images/go-top.png" border="0" />
+ </a>
+
+ <a title="Move Reserve To Bottom"
href="/cgi-bin/koha/request.pl?action=move&where=bottom&borrowernumber=<!--
TMPL_VAR Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR
Name="biblionumber" -->&date=<!-- TMPL_VAR Name="date" -->">
+ <img src="<!-- TMPL_VAR
NAME='themelang' -->/images/go-bottom.png" border="0" />
+ </a>
+
+ <a title="Move Reserve Down"
href="/cgi-bin/koha/request.pl?action=move&where=down&borrowernumber=<!--
TMPL_VAR Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR
Name="biblionumber" -->&date=<!-- TMPL_VAR Name="date" -->">
+ <img src="<!-- TMPL_VAR
NAME='themelang' -->/images/go-down.png" border="0" />
+ </a>
+ </td>
+
<td>
<input type="hidden" name="borrowernumber" value="<!--
TMPL_VAR Name="borrowernumber" -->" />
<input type="hidden" name="biblio" value="<!-- TMPL_VAR
Name="biblionumber" -->" />
- <select name="rank-request">
<!-- TMPL_IF Name="wait" -->
- <option value="W"
selected="selected">Consigned</option>
+ Consigned
+ <!-- TMPL_ELSE -->
+ <!-- TMPL_VAR Name="priority" -->
<!-- /TMPL_IF -->
- <!-- TMPL_LOOP Name="optionloop" -->
- <option value="<!-- TMPL_VAR Name="num"
-->"<!-- TMPL_IF Name="selected" --> selected="selected"<!-- /TMPL_IF -->>
- <!-- TMPL_VAR Name="num" -->
- </option>
- <!-- /TMPL_LOOP -->
- <option value="del">Del</option>
- </select></td>
+ </td>
<td>
<a
href="/cgi-bin/koha/members/moremember.pl?bornum=<!-- TMPL_VAR
Name="borrowernumber" -->"><!-- TMPL_VAR Name="firstname" --> <!-- TMPL_VAR
Name="surname" --></a>
</td>
@@ -149,7 +157,7 @@
<!-- /TMPL_IF -->
<!-- TMPL_ELSE -->
- <select name="pickup">
+ <select name="pickup<!-- TMPL_VAR
Name="borrowernumber" -->" id="pickup<!-- TMPL_VAR Name="borrowernumber" -->"
onchange="javascript:location.href =
'/cgi-bin/koha/request.pl?action=updatePickupLocation&borrowernumber=<!--
TMPL_VAR Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR
Name="biblionumber" -->&date=<!-- TMPL_VAR Name="date" -->&branchcode=' +
document.updateReservesForm.pickup<!-- TMPL_VAR Name="borrowernumber"
-->.options[document.updateReservesForm.pickup<!-- TMPL_VAR
Name="borrowernumber" -->.selectedIndex].value;">
<!-- TMPL_LOOP
Name="branchloop" -->
<option value="<!--
TMPL_VAR Name="branch" -->"<!-- TMPL_IF Name="selected" -->
selected="selected"<!-- /TMPL_IF -->>
<!-- TMPL_VAR
Name="branchname" -->
@@ -173,13 +181,40 @@
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
- </td>
+</td>
+
+<td>
+ <a title="Toggle Lock In Place"
href="/cgi-bin/koha/request.pl?action=lock&borrowernumber=<!-- TMPL_VAR
Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR Name="biblionumber"
-->&date=<!-- TMPL_VAR Name="date" -->">
+ <!-- TMPL_IF NAME="lockPriority" -->
+ <img src="<!-- TMPL_VAR NAME='themelang' -->/images/lock.png"
border="0"/>
+ <!-- TMPL_ELSE -->
+ <img src="<!-- TMPL_VAR NAME='themelang'
-->/images/lock_open.png" border="0"/>
+ <!-- /TMPL_IF -->
+ </a>
+</td>
+
+<td>
+ <a title="Toggle Lowest Priority"
href="/cgi-bin/koha/request.pl?action=setLowestPriority&borrowernumber=<!--
TMPL_VAR Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR
Name="biblionumber" -->&date=<!-- TMPL_VAR Name="date" -->">
+ <!-- TMPL_IF NAME="lowestPriority" -->
+ <img src="<!-- TMPL_VAR NAME='themelang'
-->/images/go-bottom.png" border="0"/ title="Unset Lowest Priority" />
+ <!-- TMPL_ELSE -->
+ <img src="<!-- TMPL_VAR NAME='themelang'
-->/images/go-down.png" border="0"/ title="Set To Lowest Priority" />
+ <!-- /TMPL_IF -->
+ </a>
+</td>
+
+<td>
+ <a title="Cancel Reserve"
href="/cgi-bin/koha/request.pl?action=cancel&borrowernumber=<!-- TMPL_VAR
Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR Name="biblionumber"
-->&date=<!-- TMPL_VAR Name="date" -->">
+ <img src="<!-- TMPL_VAR NAME='themelang' -->/images/cross.png"
border="0"/>
+ </a>
+</td>
+
</tr>
<!-- /TMPL_LOOP -->
</table>
-<p>Delete a request by selecting "del" from the rank list.</p>
-<p><input type="submit" name="submit" value="Update List" class="submit"
/></p>
-</div></form><!-- /TMPL_IF -->
+</div>
+</form>
+<!-- /TMPL_IF -->
</div>
</dd>
Index: koha-tmpl/intranet-tmpl/npl/en/request.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/intranet-tmpl/npl/en/Attic/request.tmpl,v
retrieving revision 1.3.2.2.2.4
retrieving revision 1.3.2.2.2.5
diff -u -b -r1.3.2.2.2.4 -r1.3.2.2.2.5
--- koha-tmpl/intranet-tmpl/npl/en/request.tmpl 11 Jun 2007 23:52:00 -0000
1.3.2.2.2.4
+++ koha-tmpl/intranet-tmpl/npl/en/request.tmpl 31 Oct 2007 12:14:23 -0000
1.3.2.2.2.5
@@ -1,8 +1,9 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Catalogue: Add Reserve
for <!-- TMPL_VAR Name="title" --><!-- TMPL_INCLUDE NAME="doc-head-close.inc"
-->
<!-- TMPL_INCLUDE NAME="masthead.inc" -->
<!-- TMPL_INCLUDE NAME="intranet-nav.inc" -->
+
<div id="main">
-<form action="placerequest.pl" method="post" id="requestForm">
+<form action="placerequest.pl" method="post" id="mainform">
<input type="hidden" name="biblio" value="<!-- TMPL_VAR Name="bib" -->" />
<input type="hidden" name="type" value="str8" />
@@ -13,24 +14,12 @@
<!-- TMPL_VAR Name="author" --></h2>
<div class="data">
<table>
- <tr><th>Rank</th><td>
-<!-- TMPL_IF NAME="CAN_user_editcatalogue" --> <!-- FOR SMFPL -->
- <select name="rank-request">
- <!-- TMPL_LOOP Name="optionloop" -->
- <option value="<!-- TMPL_VAR Name="num"
-->"<!-- TMPL_IF Name="selected" --> selected="selected"<!-- /TMPL_IF -->>
- <!-- TMPL_VAR Name="num" -->
- </option>
- <!-- /TMPL_LOOP -->
- </select>
- <!-- TMPL_ELSE --><input type="text" size="2" name="rank-request"
readonly="readonly" value="<!-- TMPL_VAR NAME="newpriority" -->" />
- <!-- /TMPL_IF -->
- </td></tr>
-
<tr><th><label for="rsvnotes">Notes</label></th><td><input
type="text" size="20" name="notes" id="rsvnotes"></tr>
<tr><th><label for="date">Date</label></th><td><!-- TMPL_VAR
name="date" --></td></tr>
<tr><th><label for="pickup">Pickup</label></th><td><!--
TMPL_VAR name="CGIbranch" --></td></tr>
- <tr><th>Request</th><td><input type="checkbox" name="request"
id="request" value="any" /><label for="request">Next Available, (or choose from
list below)</label></tr>
+ <tr><th>Request</th><td><input type="checkbox" name="request"
id="request" value="any" checked="checked" /><label for="request">Next
Available, (or choose from list below)</label></tr>
<tr><th><label for="member">Card Number</label></th><td><input
type="text" size="10" name="member" id="member" /> <a
href="/cgi-bin/koha/members/members-home.pl?quicksearch=1"
onclick="PopWin(this, 'newwin', 300, 400); return false;">(Quick
Search)</a></td></tr>
+ <tr><th><label>Not Needed After:</th><td><input
name="expireMonth" type="text" size="2" max="2" />/<input name="expireDay"
type="text" size="2" max="2" />/<input name="expireYear" type="text" size="4"
max="4" /><i>(Optional: Input Date in the Format MM/DD/YYYY)</i></td></tr>
</table>
</div>
@@ -49,9 +38,8 @@
<!-- TMPL_IF Name="itemlost" -->
Cannot be selected
<!-- TMPL_ELSE -->
- <input type="checkbox" name="reqbib"
value="<!-- TMPL_VAR Name="biblioitemnumber" -->" />
+ <input type="checkbox" name="reqbib"
value="<!-- TMPL_VAR Name="biblioitemnumber" -->" checked="checked" />
<input type="hidden" name="biblioitem"
value="<!-- TMPL_VAR Name="biblioitemnumber" -->" />
- <input type="hidden" name="itemnumber"
value="<!-- TMPL_VAR Name="itemnumber" -->" />
<!-- /TMPL_IF -->
</td>
<td>
@@ -73,40 +61,54 @@
<!-- /TMPL_LOOP -->
</table></div>
-<input type="submit" name="submit" value="Place New Request"
id="requestSubmit" class="submit" />
-
+<input type="submit" name="submit" value="Place New Request" class="submit"
onclick="this.value='Please wait...'; this.disabled=true;" />
</form>
<!-- TMPL_IF NAME="reserveloop" -->
-<form name="T<!-- TMPL_VAR Name="time" -->" action="modrequest.pl"
method="post">
+<form name="updateReservesForm" action="modrequest.pl" method="post">
<h3>Modify Existing Requests</h3>
<div class="table"><table>
<tr>
- <th>Rank</th>
+ <th></th>
+ <th></th>
<th>Patron</th>
<th>Notes</th>
<th>Date</th>
<th>Pickup Location</th>
<th>Request</th>
+ <th><img src="<!-- TMPL_VAR NAME='themelang'
-->/images/lock.png" border="0"/ title="Toggle Lock In Place - If the reserve
is locked in place, it's rank will not change."></th>
+ <th><img src="<!-- TMPL_VAR NAME='themelang'
-->/images/go-bottom.png" border="0"/ title="Toggle Set to Lowest
Priority"></th>
+ <th><img src="<!-- TMPL_VAR NAME='themelang'
-->/images/cross.png" border="0"/ title="Cancel Reserves"></th>
</tr>
<!-- TMPL_LOOP Name="reserveloop" -->
- <tr>
+ <tr width=100>
+ <td style="white-space:nowrap;">
+ <a title="Move Reserve Up"
href="/cgi-bin/koha/request.pl?action=move&where=up&borrowernumber=<!--
TMPL_VAR Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR
Name="biblionumber" -->&date=<!-- TMPL_VAR Name="date" -->">
+ <img src="<!-- TMPL_VAR
NAME='themelang' -->/images/go-up.png" border="0" />
+ </a>
+
+ <a title="Move Reserve To Top"
href="/cgi-bin/koha/request.pl?action=move&where=top&borrowernumber=<!--
TMPL_VAR Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR
Name="biblionumber" -->&date=<!-- TMPL_VAR Name="date" -->">
+ <img src="<!-- TMPL_VAR
NAME='themelang' -->/images/go-top.png" border="0" />
+ </a>
+
+ <a title="Move Reserve To Bottom"
href="/cgi-bin/koha/request.pl?action=move&where=bottom&borrowernumber=<!--
TMPL_VAR Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR
Name="biblionumber" -->&date=<!-- TMPL_VAR Name="date" -->">
+ <img src="<!-- TMPL_VAR
NAME='themelang' -->/images/go-bottom.png" border="0" />
+ </a>
+
+ <a title="Move Reserve Down"
href="/cgi-bin/koha/request.pl?action=move&where=down&borrowernumber=<!--
TMPL_VAR Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR
Name="biblionumber" -->&date=<!-- TMPL_VAR Name="date" -->">
+ <img src="<!-- TMPL_VAR
NAME='themelang' -->/images/go-down.png" border="0" />
+ </a>
+ </td>
+
<td>
<input type="hidden" name="borrowernumber" value="<!--
TMPL_VAR Name="borrowernumber" -->" />
<input type="hidden" name="biblio" value="<!-- TMPL_VAR
Name="biblionumber" -->" />
- <input type="hidden" name="itemnumber" value="<!--
TMPL_VAR Name="itemnumber" -->" />
- <select name="rank-request" <!-- TMPL_UNLESS
NAME="CAN_user_editcatalogue" -->disabled="disabled"<!-- /TMPL_UNLESS --> <!--
FOR SMFPL -->>
-
<!-- TMPL_IF Name="wait" -->
- <option value="W"
selected="selected">Consigned</option>
+ Consigned
+ <!-- TMPL_ELSE -->
+ <!-- TMPL_VAR Name="priority" -->
<!-- /TMPL_IF -->
- <!-- TMPL_LOOP Name="optionloop" -->
- <option value="<!-- TMPL_VAR Name="num"
-->"<!-- TMPL_IF Name="selected" --> selected="selected"<!-- /TMPL_IF -->>
- <!-- TMPL_VAR Name="num" -->
- </option>
- <!-- /TMPL_LOOP -->
- <option value="del">Del</option>
- </select></td>
+ </td>
<td>
<a
href="/cgi-bin/koha/members/moremember.pl?bornum=<!-- TMPL_VAR
Name="borrowernumber" -->"><!-- TMPL_VAR Name="firstname" --> <!-- TMPL_VAR
Name="surname" --></a>
</td>
@@ -121,7 +123,7 @@
<!-- /TMPL_IF -->
<!-- TMPL_ELSE -->
- <select name="pickup">
+ <select name="pickup<!-- TMPL_VAR
Name="borrowernumber" -->" id="pickup<!-- TMPL_VAR Name="borrowernumber" -->"
onchange="javascript:location.href =
'/cgi-bin/koha/request.pl?action=updatePickupLocation&borrowernumber=<!--
TMPL_VAR Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR
Name="biblionumber" -->&date=<!-- TMPL_VAR Name="date" -->&branchcode=' +
document.updateReservesForm.pickup<!-- TMPL_VAR Name="borrowernumber"
-->.options[document.updateReservesForm.pickup<!-- TMPL_VAR
Name="borrowernumber" -->.selectedIndex].value;">
<!-- TMPL_LOOP
Name="branchloop" -->
<option value="<!--
TMPL_VAR Name="branch" -->"<!-- TMPL_IF Name="selected" -->
selected="selected"<!-- /TMPL_IF -->>
<!-- TMPL_VAR
Name="branchname" -->
@@ -140,23 +142,44 @@
Next Available
<!-- TMPL_ELSE -->
<!-- TMPL_IF
Name="constrainttypeo" -->
- <!-- TMPL_IF
NAME="itemnumber" -->
- This Item
only : <!-- TMPL_VAR NAME="barcode" -->
- <!-- TMPL_ELSE -->
This type
only : <!-- TMPL_VAR Name="volumeddesc" --> <!-- TMPL_VAR Name="itemtype" -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
+
+</td>
+
+<td>
+ <a title="Toggle Lock In Place"
href="/cgi-bin/koha/request.pl?action=lock&borrowernumber=<!-- TMPL_VAR
Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR Name="biblionumber"
-->&date=<!-- TMPL_VAR Name="date" -->">
+ <!-- TMPL_IF NAME="lockPriority" -->
+ <img src="<!-- TMPL_VAR NAME='themelang' -->/images/lock.png"
border="0"/>
+ <!-- TMPL_ELSE -->
+ <img src="<!-- TMPL_VAR NAME='themelang'
-->/images/lock_open.png" border="0"/>
<!-- /TMPL_IF -->
+ </a>
+</td>
+
+<td>
+ <a title="Toggle Lowest Priority"
href="/cgi-bin/koha/request.pl?action=setLowestPriority&borrowernumber=<!--
TMPL_VAR Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR
Name="biblionumber" -->&date=<!-- TMPL_VAR Name="date" -->">
+ <!-- TMPL_IF NAME="lowestPriority" -->
+ <img src="<!-- TMPL_VAR NAME='themelang'
-->/images/go-bottom.png" border="0"/ title="Unset Lowest Priority" />
+ <!-- TMPL_ELSE -->
+ <img src="<!-- TMPL_VAR NAME='themelang'
-->/images/go-down.png" border="0"/ title="Set To Lowest Priority" />
+ <!-- /TMPL_IF -->
+ </a>
+</td>
+
+<td>
+ <a title="Cancel Reserve"
href="/cgi-bin/koha/request.pl?action=cancel&borrowernumber=<!-- TMPL_VAR
Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR Name="biblionumber"
-->&date=<!-- TMPL_VAR Name="date" -->">
+ <img src="<!-- TMPL_VAR NAME='themelang' -->/images/cross.png"
border="0"/>
+ </a>
+</td>
- </td>
</tr>
<!-- /TMPL_LOOP -->
</table>
-<!-- TMPL_IF NAME="CAN_user_editcatalogue" --> <!-- FOR SMFPL -->
-<p>Delete a request by selecting "del" from the rank list.</p>
-<p><input type="submit" name="submit" value="Update List" class="submit"
/></p>
-<!-- /TMPL_IF -->
-</div></form><!-- /TMPL_IF -->
</div>
+</form>
+<!-- /TMPL_IF -->
<!-- TMPL_INCLUDE Name="intranet-bottom.inc" -->
+
Index: koha-tmpl/intranet-tmpl/ccfls/en/images/arrow_down.png
===================================================================
RCS file: koha-tmpl/intranet-tmpl/ccfls/en/images/arrow_down.png
diff -N koha-tmpl/intranet-tmpl/ccfls/en/images/arrow_down.png
Binary files /dev/null and /tmp/cvsG82L0K differ
Index: koha-tmpl/intranet-tmpl/ccfls/en/images/arrow_up.png
===================================================================
RCS file: koha-tmpl/intranet-tmpl/ccfls/en/images/arrow_up.png
diff -N koha-tmpl/intranet-tmpl/ccfls/en/images/arrow_up.png
Binary files /dev/null and /tmp/cvsVjU7xL differ
Index: koha-tmpl/intranet-tmpl/ccfls/en/images/cross.png
===================================================================
RCS file: koha-tmpl/intranet-tmpl/ccfls/en/images/cross.png
diff -N koha-tmpl/intranet-tmpl/ccfls/en/images/cross.png
Binary files /dev/null and /tmp/cvsYI28LL differ
Index: koha-tmpl/intranet-tmpl/ccfls/en/images/go-bottom.png
===================================================================
RCS file: koha-tmpl/intranet-tmpl/ccfls/en/images/go-bottom.png
diff -N koha-tmpl/intranet-tmpl/ccfls/en/images/go-bottom.png
Binary files /dev/null and /tmp/cvsDTb5nO differ
Index: koha-tmpl/intranet-tmpl/ccfls/en/images/go-down.png
===================================================================
RCS file: koha-tmpl/intranet-tmpl/ccfls/en/images/go-down.png
diff -N koha-tmpl/intranet-tmpl/ccfls/en/images/go-down.png
Binary files /dev/null and /tmp/cvsSAtRVO differ
Index: koha-tmpl/intranet-tmpl/ccfls/en/images/go-top.png
===================================================================
RCS file: koha-tmpl/intranet-tmpl/ccfls/en/images/go-top.png
diff -N koha-tmpl/intranet-tmpl/ccfls/en/images/go-top.png
Binary files /dev/null and /tmp/cvsxJKkaP differ
Index: koha-tmpl/intranet-tmpl/ccfls/en/images/go-up.png
===================================================================
RCS file: koha-tmpl/intranet-tmpl/ccfls/en/images/go-up.png
diff -N koha-tmpl/intranet-tmpl/ccfls/en/images/go-up.png
Binary files /dev/null and /tmp/cvs28TFgN differ
Index: koha-tmpl/intranet-tmpl/ccfls/en/images/lock.png
===================================================================
RCS file: koha-tmpl/intranet-tmpl/ccfls/en/images/lock.png
diff -N koha-tmpl/intranet-tmpl/ccfls/en/images/lock.png
Binary files /dev/null and /tmp/cvsT5TUHN differ
Index: koha-tmpl/intranet-tmpl/ccfls/en/images/lock_open.png
===================================================================
RCS file: koha-tmpl/intranet-tmpl/ccfls/en/images/lock_open.png
diff -N koha-tmpl/intranet-tmpl/ccfls/en/images/lock_open.png
Binary files /dev/null and /tmp/cvs3gWvKQ differ
Index: koha-tmpl/intranet-tmpl/npl/en/images/cross.png
===================================================================
RCS file: koha-tmpl/intranet-tmpl/npl/en/images/cross.png
diff -N koha-tmpl/intranet-tmpl/npl/en/images/cross.png
Binary files /dev/null and /tmp/cvsUDIL7Q differ
Index: koha-tmpl/intranet-tmpl/npl/en/images/go-bottom.png
===================================================================
RCS file: koha-tmpl/intranet-tmpl/npl/en/images/go-bottom.png
diff -N koha-tmpl/intranet-tmpl/npl/en/images/go-bottom.png
Binary files /dev/null and /tmp/cvswsAhCN differ
Index: koha-tmpl/intranet-tmpl/npl/en/images/go-down.png
===================================================================
RCS file: koha-tmpl/intranet-tmpl/npl/en/images/go-down.png
diff -N koha-tmpl/intranet-tmpl/npl/en/images/go-down.png
Binary files /dev/null and /tmp/cvswtZ4hO differ
Index: koha-tmpl/intranet-tmpl/npl/en/images/go-top.png
===================================================================
RCS file: koha-tmpl/intranet-tmpl/npl/en/images/go-top.png
diff -N koha-tmpl/intranet-tmpl/npl/en/images/go-top.png
Binary files /dev/null and /tmp/cvs1prD2M differ
Index: koha-tmpl/intranet-tmpl/npl/en/images/go-up.png
===================================================================
RCS file: koha-tmpl/intranet-tmpl/npl/en/images/go-up.png
diff -N koha-tmpl/intranet-tmpl/npl/en/images/go-up.png
Binary files /dev/null and /tmp/cvsaCvFOP differ
Index: koha-tmpl/intranet-tmpl/npl/en/images/lock.png
===================================================================
RCS file: koha-tmpl/intranet-tmpl/npl/en/images/lock.png
diff -N koha-tmpl/intranet-tmpl/npl/en/images/lock.png
Binary files /dev/null and /tmp/cvs2KRhKS differ
Index: koha-tmpl/intranet-tmpl/npl/en/images/lock_open.png
===================================================================
RCS file: koha-tmpl/intranet-tmpl/npl/en/images/lock_open.png
diff -N koha-tmpl/intranet-tmpl/npl/en/images/lock_open.png
Binary files /dev/null and /tmp/cvsHjH21S differ
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha placerequest.pl request.pl C4/Reserves2.pm... [dev_week],
Kyle Hall <=