Bugzilla – Attachment 158387 Details for
Bug 17798
Checking out an item on hold for another patron prints a slip but does not update hold
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17798: Confirm hold when printing slip from another patron's account
Bug-17798-Confirm-hold-when-printing-slip-from-ano.patch (text/plain), 8.78 KB, created by
Katrin Fischer
on 2023-11-04 17:42:53 UTC
(
hide
)
Description:
Bug 17798: Confirm hold when printing slip from another patron's account
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2023-11-04 17:42:53 UTC
Size:
8.78 KB
patch
obsolete
>From a7d14049d3c5a172395a4a93b47307fe349239ad Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 2 Nov 2023 19:05:16 +0000 >Subject: [PATCH] Bug 17798: Confirm hold when printing slip from another > patron's account > >This patch adds a few pieces of information to the print slip button >and makes the code confirm the hold > >As we are printing before the confirm, we also add the ability to pass >in the itemnumber to 'ReserveSlip' > >This is slightly hacky, however, I don't see another way to allow >printing without an additional page reload. > >To test: > 1 - Place a title level hold for patron A, for delivery to library B > 2 - Attempt to checkout an item from the record above to Patron B from > library A > 3 - You receive an alert about the hold > 4 - Click "Don't check out, confirm hold, and print slip" > 5 - Confirm the slip looks correct and has item info > 6 - Confirm that item is in transit to fill hold > 7 - Revert transit status > 8 - Attempt to checkout the item to Patron B from Library B > 9 - Click "Don't check out, confirm hold, and print slip" >10 - Confirm slip is correct >11 - Confirm item is marked waiting > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/Reserves.pm | 3 +- > circ/circulation.pl | 22 ++++++++-- > .../prog/en/modules/circ/circulation.tt | 8 +++- > t/db_dependent/Reserves/ReserveSlip.t | 42 ++++++++++++++++++- > 4 files changed, 67 insertions(+), 8 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index da7e13a75b..d86e9f46f9 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -2179,6 +2179,7 @@ sub ReserveSlip { > my ($args) = @_; > my $branchcode = $args->{branchcode}; > my $reserve_id = $args->{reserve_id}; >+ my $itemnumber = $args->{itemnumber}; > > my $hold = Koha::Holds->find($reserve_id); > return unless $hold; >@@ -2197,7 +2198,7 @@ sub ReserveSlip { > 'borrowers' => $reserve->{borrowernumber}, > 'biblio' => $reserve->{biblionumber}, > 'biblioitems' => $reserve->{biblionumber}, >- 'items' => $reserve->{itemnumber}, >+ 'items' => $reserve->{itemnumber} || $itemnumber, > }, > ); > } >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 83d393d6c0..63ad77fdff 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -38,7 +38,7 @@ use C4::Circulation qw( barcodedecode CanBookBeIssued AddIssue ); > use C4::Members; > use C4::Biblio qw( TransformMarcToKoha ); > use C4::Search qw( new_record_from_zebra ); >-use C4::Reserves; >+use C4::Reserves qw( ModReserveAffect ); > use Koha::Holds; > use C4::Context; > use CGI::Session; >@@ -69,6 +69,10 @@ my $override_high_holds_tmp = $query->param('override_high_holds_tmp'); > my $sessionID = $query->cookie("CGISESSID") ; > my $session = get_session($sessionID); > >+my $userenv = C4::Context->userenv; >+my $branch = $userenv->{'branch'} // ''; >+my $desk_id = $userenv->{"desk_id"} || ''; >+ > my $barcodes = []; > my $barcode = $query->param('barcode'); > my $findborrower; >@@ -88,6 +92,18 @@ if (C4::Context->preference("AutoSwitchPatron") && $barcode) { > $findborrower ||= $query->param('findborrower') || q{}; > $findborrower =~ s|,| |g; > >+if ( $query->param('confirm_hold') ) { >+ my $reserve_id = $query->param('confirm_hold'); >+ my $hold_branch = $query->param('hold_branch'); >+ my $hold_itemnumber = $query->param('hold_itemnumber'); >+ my $hold_borrowernumber = $query->param('hold_borrowernumber'); >+ my $diffBranchSend = ( $branch ne $hold_branch ); >+ >+ # diffBranchSend tells ModReserveAffect whether document is expected in this library or not, >+ # i.e., whether to apply waiting status >+ ModReserveAffect( $hold_itemnumber, $hold_borrowernumber, $diffBranchSend, $reserve_id, $desk_id ); >+} >+ > # Barcode given by user could be '0' > if ( $barcode || ( defined($barcode) && $barcode eq '0' ) ) { > $barcodes = [ $barcode ]; >@@ -134,7 +150,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user ( > my $logged_in_user = Koha::Patrons->find( $loggedinuser ); > > my $force_allow_issue = $query->param('forceallow') || 0; >-if (!C4::Auth::haspermission( C4::Context->userenv->{id} , { circulate => 'force_checkout' } )) { >+if (!C4::Auth::haspermission( $userenv->{id} , { circulate => 'force_checkout' } )) { > $force_allow_issue = 0; > } > my $onsite_checkout = $query->param('onsite_checkout'); >@@ -151,8 +167,6 @@ my @failedreturns = $query->multi_param('failedreturn'); > our %return_failed = (); > for (@failedreturns) { $return_failed{$_} = 1; } > >-my $branch = C4::Context->userenv->{'branch'}; >- > for my $barcode ( @$barcodes ) { > $barcode = barcodedecode( $barcode ) if $barcode; > } >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 cdd223688f..5b31196b06 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -391,12 +391,16 @@ > [% END # /IF ADDITIONAL_MATERIALS %] > > [% IF ( RESERVED or RESERVE_WAITING or TRANSFERRED or PROCESSING ) %] >- <form method="get" action="/cgi-bin/koha/circ/circulation.pl"> >+ <form method="post" action="/cgi-bin/koha/circ/circulation.pl"> > <input type="hidden" name="restoreduedatespec" /> > <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" /> > <input type="hidden" name="duedatespec" value="[% duedatespec | html %]" /> >+ <input type="hidden" name="confirm_hold" value="[% reserve_id | html %]" /> >+ <input type="hidden" name="hold_branch" value="[% resbranchcode | html %]" /> >+ <input type="hidden" name="hold_borrower" value="[% resborrowernumber | html %]" /> >+ <input type="hidden" name="hold_itemnumber" value="[% item.itemnumber | html %]" /> > <input type="hidden" name="stickyduedate" value="[% stickyduedate | html %]" /> >- <button class="print" type="submit" onclick="Dopop('hold-transfer-slip.pl?reserve_id=[% reserve_id | uri %]');this.form.submit();"><i class="fa fa-print"></i> Don't check out and print slip (P)</button> >+ <button class="print" type="submit" onclick="Dopop('hold-transfer-slip.pl?reserve_id=[% reserve_id | uri %]&itemnumber=[% item.id | html %]');this.form.submit();"><i class="fa fa-print"></i> Don't check out, confirm hold, and print slip (P)</button> > </form> > [% END %] > >diff --git a/t/db_dependent/Reserves/ReserveSlip.t b/t/db_dependent/Reserves/ReserveSlip.t >index 03b5731644..664f9a1b0c 100755 >--- a/t/db_dependent/Reserves/ReserveSlip.t >+++ b/t/db_dependent/Reserves/ReserveSlip.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 4; > use t::lib::TestBuilder; > > use C4::Reserves qw( ReserveSlip ); >@@ -111,6 +111,46 @@ is (ReserveSlip({ > })->{content}, > sprintf( "Hold found for %s: Please pick up %s with barcode %s at %s.", $patron->{firstname}, $biblio->title, $item1->barcode, $library->{branchcode}),"Hold slip contains correctly parsed content"); > >+subtest 'title level hold' => sub { >+ plan tests => 2; >+ >+ my $biblio = $builder->build_sample_biblio; >+ my $item = $builder->build_sample_item( >+ { >+ biblionumber => $biblio->biblionumber, >+ library => $library->{branchcode}, >+ } >+ ); >+ my $hold = $builder->build_object( >+ { >+ class => 'Koha::Holds', >+ value => { >+ branchcode => $library->{branchcode}, >+ borrowernumber => $patron->{borrowernumber}, >+ biblionumber => $biblio->id, >+ itemnumber => undef, >+ } >+ } >+ ); >+ >+ my $slip = ReserveSlip( >+ { >+ branchcode => $hold->branchcode, >+ reserve_id => $hold->id, >+ itemnumber => $item->id >+ } >+ ); >+ is( $slip->{code}, 'HOLD_SLIP', "We get expected letter" ); >+ is( >+ $slip->{content}, >+ sprintf( >+ "Hold found for %s: Please pick up %s with barcode %s at %s.", $patron->{firstname}, $biblio->title, >+ $item->barcode, $library->{branchcode} >+ ), >+ "Hold slip contents correctly use the passed item" >+ ); >+}; >+ > $schema->storage->txn_rollback; > > 1; >-- >2.30.2
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 17798
:
158281
|
158282
|
158330
|
158331
|
158332
| 158387 |
158388
|
158389