Bugzilla – Attachment 22724 Details for
Bug 8868
ILS-DI: CancelHold needs to take a reserve_id
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8868: ILS-DI: CancelHold needs to take a reserve_id (follow-up)
Bug-8868-ILS-DI-CancelHold-needs-to-take-a-reserve.patch (text/plain), 4.04 KB, created by
Julian Maurice
on 2013-11-05 14:34:41 UTC
(
hide
)
Description:
Bug 8868: ILS-DI: CancelHold needs to take a reserve_id (follow-up)
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2013-11-05 14:34:41 UTC
Size:
4.04 KB
patch
obsolete
>From 9eb6142b5ca4f805e15295280d465c21241282df Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Thu, 13 Jun 2013 09:51:51 +0000 >Subject: [PATCH] Bug 8868: ILS-DI: CancelHold needs to take a reserve_id > (follow-up) > >- Fix the text in the ilsdi.pl?service=Describe&verb=CancelHold page >- Unit tests for CancelReservedFromId and GetReserve >- Do not delete row in reserves table if insert in old_reserves fails >--- > C4/Reserves.pm | 21 +++++++++++++-------- > koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt | 2 +- > t/db_dependent/Reserves.t | 22 +++++++++++++++++++++- > 3 files changed, 35 insertions(+), 10 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 1280ccf..664b1da 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -1100,14 +1100,19 @@ sub CancelReserveFromId { > WHERE reserve_id = ? > }; > $sth = $dbh->prepare($query); >- $sth->execute($reserve_id); >- >- $query = qq{ >- DELETE FROM reserves >- WHERE reserve_id = ? >- }; >- $sth = $dbh->prepare($query); >- $sth->execute($reserve_id); >+ my $rv = $sth->execute($reserve_id); >+ >+ if ($rv) { >+ $query = qq{ >+ DELETE FROM reserves >+ WHERE reserve_id = ? >+ }; >+ $sth = $dbh->prepare($query); >+ $sth->execute($reserve_id); >+ } else { >+ warn "ERROR: Failed to move reserve $reserve_id to table old_reserves."; >+ return; >+ } > > # now fix the priority on the others... > _FixPriority( $reserve->{biblionumber}, $reserve->{borrowernumber} ); >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt b/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt >index a727b29..decf7a7 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt >@@ -671,7 +671,7 @@ > <dt><strong>patron_id</strong> (Required)</dt> > <dd>the unique patron identifier in the ILS; the same identifier returned by LookupPatron or AuthenticatePatron</dd> > <dt><strong>item_id</strong> (Required)</dt> >- <dd>system item identifier</dd> >+ <dd>system hold identifier (returned by GetRecords and GetPatronInfo into element 'reserve_id')</dd> > </dl> > <h4>Example call</h4> > <a href="ilsdi.pl?service=CancelHold&patron_id=1&item_id=1"> >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index ad50619..4b31b8c 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -2,7 +2,7 @@ > > use Modern::Perl; > >-use Test::More tests => 17; >+use Test::More tests => 25; > use MARC::Record; > use DateTime::Duration; > >@@ -215,6 +215,26 @@ is( $messages->{ResFound}->{borrowernumber}, > $requesters{'RPL'}, > 'for generous library, its items fill first hold request in line (bug 10272)'); > >+my (undef, $reserves) = GetReservesFromBiblionumber($biblionumber); >+isa_ok($reserves, 'ARRAY'); >+is(scalar @$reserves, 1, "Only one reserves for this biblio"); >+my $reserve_id = $reserves->[0]->{reserve_id}; >+ >+$reserve = GetReserve($reserve_id); >+isa_ok($reserve, 'HASH', "GetReserve return"); >+is($reserve->{biblionumber}, $biblionumber); >+ >+$reserve = CancelReserveFromId($reserve_id); >+isa_ok($reserve, 'HASH', "CancelReserveFromId return"); >+is($reserve->{biblionumber}, $biblionumber); >+ >+$reserve = GetReserve($reserve_id); >+is($reserve, undef, "GetReserve returns undef after deletion"); >+ >+$reserve = CancelReserveFromId($reserve_id); >+is($reserve, undef, "CancelReserveFromId return undef if reserve does not exist"); >+ >+ > # Tests for bug 9761 (ConfirmFutureHolds): new CheckReserves lookahead parameter, and corresponding change in AddReturn > # Note that CheckReserve uses its lookahead parameter and does not check ConfirmFutureHolds pref (it should be passed if needed like AddReturn does) > # Test 9761a: Add a reserve without date, CheckReserve should return it >-- >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 8868
:
12657
|
16313
|
16527
|
18921
|
21337
|
21338
|
22723
|
22724
|
24879
|
26150
|
26271
|
26333
|
26645
|
27023
|
27024
|
27771
|
27947
|
30881
|
30908
|
30909