Bugzilla – Attachment 121065 Details for
Bug 27064
Transferring an item with a hold allows the user to set a hold waiting without transferring to the correct branch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27064: Only allow transferring a hold from the transfers page
Bug-27064-Only-allow-transferring-a-hold-from-the-.patch (text/plain), 8.85 KB, created by
Martin Renvoize (ashimema)
on 2021-05-17 16:24:40 UTC
(
hide
)
Description:
Bug 27064: Only allow transferring a hold from the transfers page
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-05-17 16:24:40 UTC
Size:
8.85 KB
patch
obsolete
>From 0f8e3f0d66490bff86bb73cea0319eb1a154dcd0 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 20 Nov 2020 11:34:11 +0000 >Subject: [PATCH] Bug 27064: Only allow transferring a hold from the transfers > page > >These patches replace the 'Waiting' button on the transfers page with a 'Transfer' button >and correct some other related problem by passing the hold object to the template and >using that to fetch patron info as well as passing the reserve_id through to ensure the correct hold is >affected at all times > >To test: > 1 - Place a hold for delivery at Library B > 2 - Sign in at Library A > 3 - Browse to Circulation->Transfers > 4 - Attempt to transfer an item on the title with the hold to Library B > 5 - You get a notice that hold was found (missing patron/branch info) > 6 - You have the option to set the hold waiting - click it > 7 - The transfer is generated and marked completed > 8 - The hold is marked as waiting, but the item is still at Library A and no transfer is active > 9 - The patron is notified that the hold is waiting >10 - Revert the hold or cancel and place a new one >11 - Apply patches >12 - Attempt transfer again >13 - You now have the option to transfer the hold >14 - Click that >15 - Hold is in transit and transfer is generated correctly >16 - Transfer again and choose 'cancel' >17 - Confirm hold is cancelled and transfer generated > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > circ/branchtransfers.pl | 44 ++++++++++--------- > .../prog/en/modules/circ/branchtransfers.tt | 16 ++++--- > 2 files changed, 34 insertions(+), 26 deletions(-) > >diff --git a/circ/branchtransfers.pl b/circ/branchtransfers.pl >index 95ec789926..59b4f24fec 100755 >--- a/circ/branchtransfers.pl >+++ b/circ/branchtransfers.pl >@@ -77,7 +77,7 @@ my $hold_transferred; > my $hold_processed; > my $reqmessage; > my $cancelled; >-my $setwaiting; >+my $settransit; > > my $request = $query->param('request') || ''; > my $borrowernumber = $query->param('borrowernumber') || 0; >@@ -98,21 +98,20 @@ if ( $request eq "KillWaiting" ) { > $reqmessage = 1; > } # FIXME else? > } >-elsif ( $request eq "SetWaiting" ) { >+elsif ( $request eq "SetTransit" ) { > my $item = $query->param('itemnumber'); >- ModReserveAffect( $item, $borrowernumber ); >+ my $reserve_id = $query->param('reserve_id'); >+ ModReserveAffect( $item, $borrowernumber, 1, $reserve_id ); > $ignoreRs = 1; >- $setwaiting = 1; >+ $settransit = 1; > $reqmessage = 1; > } > elsif ( $request eq 'KillReserved' ) { > my $biblionumber = $query->param('biblionumber'); >- my $holds = Koha::Holds->search({ >- biblionumber => $biblionumber, >- borrowernumber => $borrowernumber >- }); >- if ( $holds->count ) { >- $holds->next->cancel; >+ my $reserve_id = $query->param('reserve_id'); >+ my $hold = Koha::Holds->find({ reserve_id => $reserve_id }); >+ if ( $hold ) { >+ $hold->cancel; > $cancelled = 1; > $reqmessage = 1; > } # FIXME else? >@@ -170,20 +169,24 @@ my $biblionumber; > > ##################### > >-if ($found) { >- my $res = $messages->{'ResFound'}; >- $itemnumber = $res->{'itemnumber'}; >- $borrowernumber = $res->{'borrowernumber'}; >+my $hold; >+if ($found){ >+ $hold = Koha::Holds->find( >+ { reserve_id => $found->{reserve_id} }, >+ { prefetch => ['item','patron'] } >+ ); >+ $itemnumber = $found->{'itemnumber'}; >+ $borrowernumber = $found->{'borrowernumber'}; > >- if ( $res->{'ResFound'} eq "Waiting" ) { >+ if ( $found->{'ResFound'} eq "Waiting" ) { > $waiting = 1; >- } elsif ( $res->{'ResFound'} eq "Transferred" ) { >+ } elsif ( $found->{'ResFound'} eq "Transferred" ) { > $hold_transferred = 1; >- } elsif ( $res->{'ResFound'} eq "Processing" ) { >+ } elsif ( $found->{'ResFound'} eq "Processing" ) { > $hold_processed = 1; >- } elsif ( $res->{'ResFound'} eq "Reserved" ) { >+ } elsif ( $found->{'ResFound'} eq "Reserved" ) { > $reserved = 1; >- $biblionumber = $res->{'biblionumber'}; >+ $biblionumber = $found->{'biblionumber'}; > } > } > >@@ -221,6 +224,7 @@ foreach my $code ( keys %$messages ) { > > $template->param( > found => $found, >+ hold => $hold, > reserved => $reserved, > waiting => $waiting, > transferred => $hold_transferred, >@@ -232,7 +236,7 @@ $template->param( > tobranchcd => $tobranchcd, > reqmessage => $reqmessage, > cancelled => $cancelled, >- setwaiting => $setwaiting, >+ settransit => $settransit, > trsfitemloop => \@trsfitemloop, > errmsgloop => \@errmsgloop, > PatronAutoComplete => C4::Context->preference("PatronAutoComplete"), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt >index e27f7d4b5e..96058fcd88 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt >@@ -40,7 +40,7 @@ > <table> > <caption> > [% IF ( reserved ) %] >- Reserve found for [% name | html %] (<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber | uri %]">[% borrowernumber | html %]</a>). >+ Reserve found for [% INCLUDE 'patron-title.inc' patron => hold.patron | html %] (<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber | uri %]">[% borrowernumber | html %]</a>). > [% END %] > [% IF ( waiting ) %] > Item is marked waiting at [% branchname | html %] for [% name | html %] (<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber | uri %]">[% borrowernumber | html %]</a>). >@@ -51,7 +51,9 @@ > </caption> > <tr> > <th> >- [% IF ( reserved ) %]Set reserve to waiting and transfer book to [% branchname | html %]: [% END %] >+ [% IF ( reserved ) %] >+ Set reserve to transit and transfer book to [% Branches.GetName( hold.branchcode ) | html %]: >+ [% END %] > [% IF ( waiting or transferred ) %]Cancel reservation and then attempt transfer: [% END %] > </th> > <td> >@@ -61,6 +63,7 @@ > <input type="hidden" name="fb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.frombrcd | html %]" /> > <input type="hidden" name="tb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.tobrcd | html %]" /> > [% END %] >+ <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" /> > <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" /> > <input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" /> > <input type="hidden" name="tobranchcd" value="[% tobranchcd | html %]" /> >@@ -70,8 +73,8 @@ > <input type="submit" value="Cancel" /> > [% END %] > [% IF ( reserved ) %] >- <input type="hidden" name="request" value="SetWaiting" /> >- <input type="submit" value="Waiting" /> >+ <input type="hidden" name="request" value="SetTransit" /> >+ <input type="submit" value="Transfer" /> > [% END %] > </form> > </td> >@@ -86,6 +89,7 @@ > <input type="hidden" name="fb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.frombrcd | html %]" /> > <input type="hidden" name="tb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.tobrcd | html %]" /> > [% END %] >+ <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" /> > <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" /> > <input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" /> > <input type="hidden" name="tobranchcd" value="[% tobranchcd | html %]" /> >@@ -120,8 +124,8 @@ > [% IF ( cancelled ) %] > <li>Reserve cancelled</li> > [% END %] >- [% IF ( setwaiting ) %] >- <li>Item should now be waiting at library: [% reqbrchname | html %]</li> >+ [% IF ( settransit ) %] >+ <li>Item is now in transit to [% Branches.GetName(tobranchcd) | html %]</li> > [% END %] > </ul> > </div> >-- >2.20.1
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 27064
:
113877
|
114712
|
120222
|
120759
|
120764
|
121065
|
121066
|
121067
|
121090
|
121091
|
121092
|
121093
|
121141
|
121142
|
121143
|
121144
|
121670
|
121671
|
121672
|
121673
|
121674
|
121675
|
121676
|
121677
|
121678
|
121679
|
121680
|
121681
|
121682
|
121683
|
121684
|
121685
|
121981