Bugzilla – Attachment 143161 Details for
Bug 31692
Let librarians change item level holds to record level holds when possible
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31692: Allow librarians to change hold type in staff client
Bug-31692-Allow-librarians-to-change-hold-type-in-.patch (text/plain), 5.94 KB, created by
David Nind
on 2022-11-03 23:51:25 UTC
(
hide
)
Description:
Bug 31692: Allow librarians to change hold type in staff client
Filename:
MIME Type:
Creator:
David Nind
Created:
2022-11-03 23:51:25 UTC
Size:
5.94 KB
patch
obsolete
>From cc3da87ed6e092b4cb506413a8a023b24826fbdc Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Wed, 5 Oct 2022 16:04:59 +0000 >Subject: [PATCH] Bug 31692: Allow librarians to change hold type in staff > client > >To test: >1. Apply patch >2. Add item level hold to a record/item, make sure patron has no other > holds on that record >3. Go to /cgi-bin/koha/reserve/request.pl?biblionumber=xxx where xxx is > the record you placed the hold for >4. Under "Existing holds" table, in "Details" column you should see > "Only item <barcode>" dropdown >5. Select "Next available" from the dropdown >6. Click Update hold(s) >7. Observe dropdown value has changed from "Only item <barcode>" to > "Next available" >8. Cancel the hold and add two item level holds >9. Under "Existing holds" table, in "Details" column you should see > "Only item <barcode>", but no select dropdown > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../prog/en/includes/holds_table.inc | 20 +++++++++++++++++++ > reserve/modrequest.pl | 16 ++++++++++++++- > reserve/request.pl | 11 ++++++++++ > 3 files changed, 46 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >index 536bd16484..a379d41816 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >@@ -166,6 +166,7 @@ > [%- ELSE -%] > [%- IF ( hold.item_level_hold ) -%] > <em> >+ [%- IF ! hold.change_hold_type_allowed -%] > <span>Only item</span> > <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% hold.biblionumber | uri %]&itemnumber=[% hold.itemnumber | uri %]#item[% hold.itemnumber | uri %]"> > [%- IF ( hold.barcodenumber ) -%] >@@ -175,6 +176,25 @@ > <span>No barcode</span> > [%- END -%] > </a> >+ [%- ELSE -%] >+ <select name="change_hold_type_[% hold.reserve_id | html %]"> >+ <option selected="selected" value="">Only item [%- IF ( hold.barcodenumber ) -%] >+ [%- hold.barcodenumber | html -%] >+ [%- ELSE -%] >+ No barcode >+ [%- END -%] >+ </option> >+ <option value="1">Next available</option> >+ </select> >+ [%- IF ( hold.barcodenumber ) -%] >+ <input type="hidden" name="itemnumber" value="[% hold.itemnumber | html %]" /> >+ [%- END -%] >+ [%- IF hold.itemtype -%] >+ <span style="display:none">Next available [% ItemTypes.GetDescription( hold.itemtype ) | html %] item</span> >+ [%- ELSE -%] >+ <span style="display:none">Next available</span> >+ [%- END -%] >+ [%- END -%] > </em> > [%- ELSE -%] > [%- IF hold.itemtype -%] >diff --git a/reserve/modrequest.pl b/reserve/modrequest.pl >index ec78f683be..bd733dc38e 100755 >--- a/reserve/modrequest.pl >+++ b/reserve/modrequest.pl >@@ -94,7 +94,21 @@ else { > } else { > $_->rethrow; > } >- } >+ }; >+ >+ if ( $query->param( "change_hold_type_" . $reserve_id[$i] ) ) { >+ my $hold = Koha::Holds->find( $reserve_id[$i] ); >+ >+ try { >+ $hold->change_type; >+ } catch { >+ if ($_->isa('Koha::Exceptions::Hold::CannotChangeHoldType')){ >+ warn $_; >+ } else { >+ $_->rethrow; >+ } >+ } >+ }; > } > my @biblio_ids = uniq @biblionumber; > Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( >diff --git a/reserve/request.pl b/reserve/request.pl >index 2c28f2c58f..93abe66a4b 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -593,6 +593,13 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > $template->param( always_show_holds => $always_show_holds ); > my $show_holds_now = $input->param('show_holds_now'); > unless( (defined $always_show_holds && $always_show_holds eq 'DONT') && !$show_holds_now ){ >+ my $holds_count_per_patron = { map { $_->{borrowernumber} => $_->{hold_count} } >+ @{ Koha::Holds->search( { biblionumber=> $biblionumber }, { >+ select => [ "borrowernumber", { count => { distinct => "reserve_id" } } ], >+ as => [ qw( borrowernumber hold_count ) ], >+ group_by => [ qw( borrowernumber ) ] } >+ )->unblessed >+ } }; > my @reserves = Koha::Holds->search( { biblionumber => $biblionumber }, { order_by => 'priority' } )->as_list; > foreach my $res ( > sort { >@@ -643,6 +650,10 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > $reserve{non_priority} = $res->non_priority(); > $reserve{object} = $res; > >+ if ( $holds_count_per_patron->{ $reserve{'borrowernumber'} } == 1 ) { >+ $reserve{'change_hold_type_allowed'} = 1; >+ } >+ > push( @reserveloop, \%reserve ); > } > } >-- >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 31692
:
141388
|
141390
|
142102
|
142103
|
142104
|
142106
|
142107
|
142108
|
142109
|
142114
|
142115
|
142116
|
142117
|
142118
|
142586
|
142587
|
142595
|
142596
|
142818
|
142819
|
143151
|
143160
|
143161
|
143162
|
143614
|
143615
|
143616
|
143617
|
143618
|
143619
|
143627
|
143628
|
143629