Bugzilla – Attachment 18466 Details for
Bug 9394
Use reserve_id where possible
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9394: QA Followup
Bug-9394-QA-Followup.patch (text/plain), 4.11 KB, created by
Jonathan Druart
on 2013-05-29 13:04:00 UTC
(
hide
)
Description:
Bug 9394: QA Followup
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-05-29 13:04:00 UTC
Size:
4.11 KB
patch
obsolete
>From a15369c50870d77f93e5099714798fd95cc26790 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 29 May 2013 14:38:40 +0200 >Subject: [PATCH] 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> >--- > C4/Reserves.pm | 11 +++++++---- > .../intranet-tmpl/prog/en/modules/circ/circulation.tt | 2 +- > t/db_dependent/Holds.t | 16 ++++++++++++---- > 3 files changed, 20 insertions(+), 9 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 813b1cc..13787fc 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -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 ); > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index 42a9b27..6d3d84c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -1130,7 +1130,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> >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index 801a55c..4c95508 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -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,14 @@ AddReserve( > my $found, > ); > ( $reserve ) = GetReservesFromBorrowernumber($borrowernumber); >+my $reserveid = C4::Reserves::GetReserveId( >+ { >+ biblionumber => $biblionumber, >+ itemnumber => $itemnumber, >+ borrowernumber => $borrowernumber >+ } >+); >+is( $reserveid, $reserve->{reserve_id}, "Test GetReserveId" ); > ModReserveMinusPriority( $itemnumber, $reserve->{'reserve_id'} ); > ( $reserve ) = GetReservesFromBorrowernumber($borrowernumber); > ok( $reserve->{'itemnumber'} eq $itemnumber, "Test ModReserveMinusPriority()" ); >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9394
:
14601
|
14860
|
14863
|
15730
|
15733
|
16676
|
17447
|
18216
|
18318
|
18465
|
18466
|
18492
|
18621
|
19893
|
19894
|
19895
|
19896
|
19897
|
19898
|
19899
|
19902
|
19904
|
19905
|
19906
|
19907
|
19908
|
19909