#668 cancel reserve on checkout does not work

The reserve was cancelled only under certain circumstances (depending on reserve status)
cancelling everytime.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Paul POULAIN 2007-10-08 14:24:30 -05:00 committed by Joshua Ferraro
parent 2c596cec54
commit 7ec8571d88
2 changed files with 15 additions and 17 deletions

View file

@ -855,7 +855,6 @@ AddIssue does the following things :
sub AddIssue {
my ( $borrower, $barcode, $date, $cancelreserve ) = @_;
my $dbh = C4::Context->dbh;
my $barcodecheck=CheckValidBarcode($barcode);
if ($borrower and $barcode and $barcodecheck ne '0'){
@ -925,20 +924,6 @@ if ($borrower and $barcode and $barcodecheck ne '0'){
my $branches = GetBranches();
my $branchname =
$branches->{ $res->{'branchcode'} }->{'branchname'};
if ($cancelreserve) {
CancelReserve( 0, $res->{'itemnumber'},
$res->{'borrowernumber'} );
}
else {
# set waiting reserve to first in reserve queue as book isn't waiting now
ModReserve(
1,
$res->{'biblionumber'},
$res->{'borrowernumber'},
$res->{'branchcode'}
);
}
}
elsif ( $restype eq "Reserved" ) {
@ -954,6 +939,19 @@ if ($borrower and $barcode and $barcodecheck ne '0'){
$res->{'borrowernumber'} );
}
}
if ($cancelreserve) {
CancelReserve( $res->{'biblionumber'}, 0,
$res->{'borrowernumber'} );
}
else {
# set waiting reserve to first in reserve queue as book isn't waiting now
ModReserve(
1,
$res->{'biblionumber'},
$res->{'borrowernumber'},
$res->{'branchcode'}
);
}
}
# Starting process for transfer job (checking transfert and validate it if we have one)

View file

@ -705,7 +705,7 @@ priorities of the other people who are waiting on the book.
sub CancelReserve {
my ( $biblio, $item, $borr ) = @_;
my $dbh = C4::Context->dbh;
if ( ( $item and $borr ) and ( not $biblio ) ) {
if ( $item and $borr ) {
# removing a waiting reserve record....
# update the database...
my $query = "
@ -720,7 +720,7 @@ sub CancelReserve {
$sth->execute( $item, $borr );
$sth->finish;
}
if ( ( $biblio and $borr ) and ( not $item ) ) {
else {
# removing a reserve record....
# get the prioritiy on this record....
my $priority;