Bug 9394: QA Followup

* C4::Reserves::_FixPriority
  - The previous code checked the cancellationdate. If think you never pass
in it with bad parameters, but in order to be sure I added the check on
this value.
  - The reservedates array was never used.

* circ/circulation.tt
There was a bug: it was not possible to remove an hold from the
circulation page. Passing reserve_id fixes the issue.

* C4::Reserves::GetReserveId
This subroutine did not have a unit test.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Jonathan Druart 2013-05-29 14:38:40 +02:00 committed by Galen Charlton
parent 53fbfa2dde
commit dd2185981d
3 changed files with 19 additions and 9 deletions

View File

@ -1466,9 +1466,14 @@ sub AlterPriority {
my $reserve = GetReserve( $reserve_id );
if ( $reserve->{cancellationdate} ) {
warn "I cannot alter the priority for reserve_id $reserve_id, the reserve has been cancelled (".$reserve->{cancellationdate}.')';
return;
}
if ( $where eq 'up' || $where eq 'down' ) {
my $priority = $reserve->{'priority'};
my $priority = $reserve->{'priority'};
$priority = $where eq 'up' ? $priority - 1 : $priority + 1;
_FixPriority( $reserve_id, $priority )
@ -1628,7 +1633,6 @@ sub _FixPriority {
$sth->execute( $reserve_id );
}
my @priority;
my @reservedates;
# get whats left
my $query = "
@ -1641,7 +1645,6 @@ sub _FixPriority {
my $sth = $dbh->prepare($query);
$sth->execute( $res->{'biblionumber'} );
while ( my $line = $sth->fetchrow_hashref ) {
push( @reservedates, $line );
push( @priority, $line );
}

View File

@ -1136,7 +1136,7 @@ No patron matched <span class="ex">[% message %]</span>
</select>
<input type="hidden" name="biblionumber" value="[% reservloo.biblionumber %]" />
<input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
<input type="hidden" name="reservenumber" value="[% reservloo.reservenumber %]" />
<input type="hidden" name="reserve_id" value="[% reservloo.reserve_id %]" />
</td>
<td>[% IF ( reservloo.suspend ) %]Suspended [% IF ( reservloo.suspend_until ) %] until [% reservloo.suspend_until | $KohaDates %][% END %][% END %]</td>
</tr>

View File

@ -4,15 +4,15 @@ use strict;
use warnings;
use C4::Branch;
use Test::More tests => 18;
use Test::More tests => 19;
use MARC::Record;
use C4::Biblio;
use C4::Items;
BEGIN {
use FindBin;
use lib $FindBin::Bin;
use_ok('C4::Reserves');
use FindBin;
use lib $FindBin::Bin;
use_ok('C4::Reserves');
}
my $borrowers_count = 5;
@ -121,6 +121,13 @@ AddReserve(
my $found,
);
( $reserve ) = GetReservesFromBorrowernumber($borrowernumber);
my $reserveid = C4::Reserves::GetReserveId(
{
biblionumber => $biblionumber,
borrowernumber => $borrowernumber
}
);
is( $reserveid, $reserve->{reserve_id}, "Test GetReserveId" );
ModReserveMinusPriority( $itemnumber, $reserve->{'reserve_id'} );
( $reserve ) = GetReservesFromBorrowernumber($borrowernumber);
ok( $reserve->{'itemnumber'} eq $itemnumber, "Test ModReserveMinusPriority()" );