Bugzilla – Attachment 139444 Details for
Bug 31391
Staff-side recalls
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Issue 1: Convert reserves to recalls on staff client
Issue-1-Convert-reserves-to-recalls-on-staff-clien.patch (text/plain), 28.49 KB, created by
Aleisha Amohia
on 2022-08-18 23:41:06 UTC
(
hide
)
Description:
Issue 1: Convert reserves to recalls on staff client
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2022-08-18 23:41:06 UTC
Size:
28.49 KB
patch
obsolete
>From 7fdfb4a0cdfa0220e87083bcbef3a323c2bccc14 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Mon, 4 Oct 2021 17:22:38 +1300 >Subject: [PATCH] Issue 1: Convert reserves to recalls on staff client > >(cherry picked from commit 1c6c784e4c392ca5d12bd003559146fce60dcaed) > >Issue 1: Convert recalls and place staff-side recalls > >(cherry picked from commit 3a02cb1c0769213d9a5988600fadf7e305cc3637) > >https://bugs.koha-community.org/show_bug.cgi?id=31391 >--- > C4/Reserves.pm | 20 ++ > Koha/Item.pm | 4 +- > .../intranet-tmpl/prog/en/includes/holds_table.inc | 6 + > .../prog/en/modules/recalls/request.tt | 233 +++++++++++++++++++-- > .../prog/en/modules/reserve/request.tt | 8 + > .../intranet-tmpl/prog/js/patron-autocomplete.js | 5 +- > recalls/request.pl | 107 +++++++++- > reserve/modrequest.pl | 11 + > reserve/request.pl | 5 + > 9 files changed, 375 insertions(+), 24 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index d5e01f283d..3fd3618af4 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -1119,6 +1119,26 @@ sub ModReserve { > if ( $rank eq "del" ) { > $hold->cancel({ cancellation_reason => $cancellation_reason }); > } >+ elsif ( $rank eq "recall" ) { >+ if ( !$biblionumber ) { >+ $biblionumber = $hold->biblionumber; >+ } >+ my $biblio = Koha::Biblios->find( $biblionumber ); >+ if ( !$borrowernumber ) { >+ $borrowernumber = $hold->borrowernumber; >+ } >+ my $patron = Koha::Patrons->find( $borrowernumber ); >+ if ( $biblio->can_be_recalled({ patron => $patron }) ) { >+ my ( $recall, $due_interval, $due_date ) = Koha::Recalls->add_recall({ >+ patron => $patron, >+ biblio => $biblio, >+ branchcode => $branchcode, >+ expirationdate => $date, >+ interface => 'intranet', >+ }); >+ $hold->cancel({ cancellation_reason => 'RECALLED' }); >+ } >+ } > elsif ($hold->found && $hold->priority eq '0' && $date) { > logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold ) > if C4::Context->preference('HoldsLog'); >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 653eb73d79..b31701ba62 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -1839,10 +1839,12 @@ sub can_be_waiting_recall { > $branchcode = ( C4::Context->preference('HomeOrHoldingBranch') eq 'homebranch' ) ? $self->homebranch : $self->holdingbranch; > } > >+ my $maybe_recall = $self->check_recalls; >+ > # Check the circulation rule for each relevant itemtype for this item > my $rule = Koha::CirculationRules->get_effective_rules({ > branchcode => $branchcode, >- categorycode => undef, >+ categorycode => $maybe_recall ? $maybe_recall->patron->categorycode : undef, > itemtype => $self->effective_itemtype, > rules => [ > 'recalls_allowed', >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 0eebedc585..8f0a96f3dd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >@@ -64,6 +64,9 @@ > <option value="[% hold.priority | html %]" selected="selected">[% this_priority | html %]</option> > [% END %] > <option value="del">del</option> >+ [% IF Koha.Preference('UseRecalls') AND Koha.Preference('RecallsInterface') != 'opac' %] >+ <option value="recall">recall</option> >+ [% END %] > </select> > [% ELSE %] > <input type="hidden" name="rank-request" class="rank-request" value="[% hold.priority | html %]" data-hold-id="[% hold.reserve_id | html %]"> >@@ -79,6 +82,9 @@ > [% ELSE %] > <option value="[% hold.priority | html %]" selected="selected">[% this_priority | html %]</option> > [% END %] >+ [% IF Koha.Preference('UseRecalls') AND Koha.Preference('RecallsInterface') != 'opac' %] >+ <option value="recall">recall</option> >+ [% END %] > </select> > [% END %] > [% ELSE %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/request.tt >index 2f4a573cf8..3da6909bd2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/request.tt >@@ -2,8 +2,17 @@ > [% USE Asset %] > [% USE Koha %] > [% USE KohaDates %] >+[% USE TablesSettings %] >+[% USE Branches %] >+[% USE Categories %] >+[% USE AuthorisedValues %] >+[% USE ItemTypes %] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] >+[% SET libraries = Branches.all %] >+[% SET categories = Categories.all.unblessed %] >+[% SET columns = ['name', 'cardnumber', 'dateofbirth', 'category', 'branch', 'address', 'phone'] %] >+[% PROCESS "patron-search.inc" %] > <title>Confirm recalls › Recalls › Koha</title> > [% INCLUDE 'doc-head-close.inc' %] > </head> >@@ -11,35 +20,193 @@ > [% INCLUDE 'header.inc' %] > [% INCLUDE 'circ-search.inc' %] > >-<div id="breadcrumbs"> >- <a href="/cgi-bin/koha/mainpage.pl">Home</a> › >- <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> › >- <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | uri %]">[% biblio.title | html %]</a> › >- Confirm recalls on [% biblio.title | html %] >-</div> >+<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb"> >+ <ol> >+ <li> >+ <a href="/cgi-bin/koha/mainpage.pl">Home</a> >+ </li> >+ <li> >+ <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> >+ </li> >+ <li> >+ [% INCLUDE 'biblio-title.inc' link =1 %] >+ </li> >+ <li> >+ <a href="#" aria-current="page"> >+ Place a recall >+ </a> >+ </li> >+ </ol> >+</nav> > > <div class="main container-fluid"> > <div class="row"> > <div class="col-sm-10 col-sm-push-2"> > <main> > >- <h1>Existing recalls</h1> >+ <h1>Place a recall on [% INCLUDE 'biblio-title.inc' link = 1 %]</h1> > >- [% IF Koha.Preference('UseRecalls') %] >- [% IF recalls.count %] >- <form method="post" action="/cgi-bin/koha/recalls/request.pl"> >- <input type="hidden" name="op" value="cancel_multiple_recalls"> >- <input type="checkbox" id="select_all"> <span id="select_all_text">Select all</span> >- [% INCLUDE 'recalls.inc' %] >+ [% IF patron %] >+ >+ [% IF error %] >+ <div class="dialog alert"> >+ Unable to place a recall. Check your circulation rules. >+ </div> >+ [% END %] >+ >+ <fieldset class="rows"> >+ <legend>Recall details</legend> >+ <form id="recallform" action="/cgi-bin/koha/recalls/request.pl" method="post"> >+ <input type="hidden" name="biblionumber" value="[% biblio.biblionumber | html %]"> >+ >+ <ol> >+ <li> >+ <label for="borrowernumber">Patron:</label> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% INCLUDE 'patron-title.inc' %]</a> >+ <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]"> >+ </li> >+ >+ [% UNLESS ( single_branch_mode ) %]<li> >+ <label for="pickup">Pick up location:</label> >+ <select name="pickup" id="pickup"> >+ [% FOREACH branch IN branches %] >+ [% IF branch.branchcode == patron.branchcode %] >+ <option value="[% branch.branchcode | html %]" selected>[% Branches.GetName( branch.branchcode ) | html %]</option> >+ [% ELSE %] >+ <option value="[% branch.branchcode | html %]">[% Branches.GetName( branch.branchcode ) | html %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li>[% END %] >+ >+ <li><label for="expirationdate">Recall not needed after:</label> <input type="text" name="expirationdate" id="expirationdate" size="20" class="flatpickr"> <a id="cleartext" style="display:none;">Clear text</a><span id="expiration-hint">[% INCLUDE 'date-format.inc' %]</span></li> >+ <li class="level-option" style="display:none;"><label for="bibliolevel">Recall next available item</label> <input type="radio" name="type" id="bibliolevel" value="bibliolevel" checked></li> >+ <li class="level-option" style="display:none;"><label for="itemlevel">Recall a specific item</label> <input type="radio" name="type" id="itemlevel" value="itemlevel"></li> >+ >+ <table id="items"> >+ <caption>Select a specific item:</caption> >+ <tr> >+ <th> </th> >+ <th>Item type</th> >+ <th>Barcode</th> >+ [% UNLESS ( single_branch_mode ) %] >+ <th>Home library</th> >+ <th>Last location</th> >+ [% END %] >+ <th>Collection</th> >+ <th>Call number</th> >+ <th>Copy number</th> >+ <th>Vol info</th> >+ <th>Information</th> >+ </tr> >+ [% FOREACH item IN items %]<tr> >+ <td> >+ [% IF item.can_be_recalled( patron => patron ) %] >+ <input type="radio" class="itemnumber" name="itemnumber" value="[% item.itemnumber | html %]"> >+ [% ELSE %] >+ <input disabled="disabled" type="radio" class="itemnumber" name="itemnumber" value="[% item.itemnumber | html %]" style="display:none;" /> >+ <img src="[% interface | html %]/lib/famfamfam/cross.png" alt="Cannot be recalled" title="Cannot be recalled" /> >+ [% END %] >+ </td> >+ <td>[% ItemTypes.GetDescription( item.effective_itemtype ) | html %]</td> >+ <td>[% item.barcode | html %]</td> >+ [% UNLESS ( single_branch_mode ) %] >+ <td>[% Branches.GetName( item.homebranch ) | html %]</td> >+ <td>[% Branches.GetName( item.holdingbranch) | html %]</td> >+ [% END %] >+ <td>[% AuthorisedValues.GetByCode( 'CCODE', item.ccode, 1 ) | html %]</td> >+ <td>[% item.itemcallnumber | html %]</td> >+ <td>[% item.copynumber | html %]</td> >+ <td>[% item.enumchron | html %]</td> >+ <td> >+ [% IF ( item.checkout ) %] >+ <span class="checkedout">Due [% item.checkout.date_due | $KohaDates %]</span> >+ [% ELSIF ( item.get_transfer ) %] >+ <span class="intransit">In transit from [% Branches.GetName( item.get_transfer.frombranch ) | html %] to [% Branches.GetName( item.get_transfer.tobranch ) | html %] since [% item.get_transfer.datesent | $KohaDates %]</span> >+ [% END %] >+ [% IF ( item.itemlost || item.withdrawn ) %] >+ <span class="lost">Unavailable (lost or missing)</span> >+ [% END %] >+ [% IF ( item.notforloan ) %] >+ <span class="notforloan">Not for loan ([% item.notforloan | html %])</span> >+ [% END %] >+ [% hold = item.current_holds.next %] >+ [% IF ( item.recall ) %] >+ <span class="waiting"> >+ [% IF ( item.recall.waitingdate ) %] >+ Waiting for patron at [% Branches.GetName( item.recall.branchcode ) | html %] since [% item.recall.waitingdate | $KohaDates %]. >+ [% ELSIF ( item.recall.itemnumber == item.itemnumber ) %] >+ Recalled by patron expected at [% Branches.GetName( item.recall.branchcode ) | html %] since [% item.recall.recalldate | $KohaDates %]. >+ [% END %] >+ </span> >+ [% ELSIF ( hold.waitingdate ) %] >+ <span class="waiting"> >+ Waiting for patron at [% Branches.GetName( hold.branchcode ) | html %] since [% hold.waitingdate | $KohaDates %]. >+ </span> >+ [% ELSIF ( hold.borrowernumber == logged_in_user.borrowernumber ) %] >+ <span class="waiting"> >+ Patron has already placed a <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% patron.borrowernumber | uri %]#reserves">reserve</a> on this item. >+ </span> >+ [% END # / IF ( item.recall or hold ) %] >+ </td> >+ </tr>[% END %] >+ </table> >+ </fieldset> > <fieldset class="action"> >- <button type="submit" id="cancel_selected" class="btn btn-default btn-sm">Cancel selected recalls</button> >+ <input type="hidden" name="op" value="request"> >+ <input type="hidden" name="biblionumber" value="[% biblio.biblionumber | html %]"> >+ [% IF error %] >+ <input type="submit" class="btn btn-primary" value="Confirm" disabled="disabled"> >+ [% ELSE %] >+ <input type="submit" class="btn btn-primary" value="Confirm"> >+ [% END %] >+ <a href="/cgi-bin/koha/recalls/request.pl?biblionumber=[% biblio.biblionumber | uri %]" class="cancel">Cancel</a> > </fieldset> > </form> >+ >+ [% ELSE %] >+ >+ [% IF Koha.Preference('RecallsInterface') == 'opac' %] >+ <div class="dialog alert"> >+ Due to the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RecallsInterface">RecallsInterface system preference</a>, recalls cannot be placed through the staff client. >+ </div> > [% ELSE %] >- <div class="dialog message">No recalls have been made.</div> >+ >+ <fieldset> >+ <h2>Search patrons</h2> >+ <div id="circ_recalls_select" class="toptabs"> >+ <ul class="nav nav-tabs" role="tablist"> >+ <li role="presentation" class="active"><a href="#recalls_patronsearch_pane" aria-controls="recalls_patronsearch_pane" role="tab" data-toggle="tab">Patrons</a></li> >+ </ul> >+ <div class="tab-content"> >+ <div id="recalls_patronsearch_pane" role="tabpanel" class="tab-pane active"> >+ [% PROCESS patron_search_filters_simple %] >+ [% PROCESS patron_search_table table_id => 'table_borrowers', open_on_row_click => 1 %] >+ </div> >+ </div> <!-- /.tab-content --> >+ </div> >+ </fieldset> >+ > [% END %] >- [% ELSE %] >- <div class="dialog message">Recalls have not been enabled. Enable the <a href="/cgi-bin/koha/admin/preferences.pl?tab=circulation">UseRecalls</a> system preference to use recalls.</div> >+ >+ <h2>Existing recalls</h2> >+ >+ [% IF Koha.Preference('UseRecalls') %] >+ [% IF recalls.count %] >+ <form method="post" action="/cgi-bin/koha/recalls/request.pl"> >+ <input type="hidden" name="op" value="cancel_multiple_recalls"> >+ <input type="checkbox" id="select_all"> <span id="select_all_text">Select all</span> >+ [% INCLUDE 'recalls.inc' %] >+ <fieldset class="action"> >+ <button type="submit" id="cancel_selected" class="btn btn-default btn-sm">Cancel selected recalls</button> >+ </fieldset> >+ </form> >+ [% ELSE %] >+ <div class="dialog message">No recalls have been made.</div> >+ [% END %] >+ [% ELSE %] >+ <div class="dialog message">Recalls have not been enabled. Enable the <a href="/cgi-bin/koha/admin/preferences.pl?tab=circulation">UseRecalls</a> system preference to use recalls.</div> >+ [% END %] >+ > [% END %] > > </main> >@@ -58,6 +225,38 @@ > [% Asset.js("js/recalls.js") | $raw %] > [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'columns_settings.inc' %] >+ [% INCLUDE 'calendar.inc' %] >+ [% SET url_biblio_params = "biblionumber=" _ biblionumbers.join("&biblionumber=") %] >+ [% PROCESS patron_search_js table_id => 'table_borrowers', categories => categories, libraries => libraries, extended_attribute_types => attribute_type_codes, columns => columns, open_on_row_click => 1, on_click_url => '/cgi-bin/koha/recalls/request.pl?' _ url_biblio_params, redirect_if_one_result => 1, redirect_url => '/cgi-bin/koha/recalls/request.pl?' _ url_biblio_params, redirect_if_attribute_equal => 'cardnumber' %] >+ <script> >+ table_settings = [% TablesSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %]; >+ $(document).ready(function(){ >+ [% UNLESS findborrower %] >+ [% IF ( PatronAutoComplete ) %] >+ patron_autocomplete($("#search_patron_filter"), { 'link-to': 'recall', 'url-params': '[% url_biblio_params | url %]' }); >+ [% END %] >+ [% END %] >+ $(".level-option").show(); >+ $("#cleartext").show(); >+ $("#items").hide(); >+ $("#expiration-hint").hide(); >+ $("#cleartext").click(function(){ >+ $(this).siblings("input").val(""); >+ }); >+ $("#itemlevel").click(function(){ >+ if ( $("#itemlevel").is(':checked') ){ >+ $("#items").show(); >+ $("input:radio[name='itemnumber']:not(:disabled)").first().attr("checked", "checked"); // selects first item in table >+ } >+ }); >+ $("#bibliolevel").click(function(){ >+ if ( $("#bibliolevel").is(':checked') ){ >+ $("#items").hide(); >+ } >+ }); >+ $("#recalls_patronsearch").on("submit", filter); >+ }); >+ </script> > [% END %] > > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >index 4003c1cb0b..496b75ad77 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -216,6 +216,14 @@ > <p>No club with this name, please, try another</p> > </div> > [% END %] >+ >+ [% IF ( recallerror ) %] >+ <div class="dialog alert"> >+ <h3>Hold cannot be converted to a recall</h3> >+ <p>A recall cannot be placed on one or more holds. Check your <a href="/cgi-bin/koha/admin/smart-rules.pl">circulation and fine rules</a>.</p> >+ </div> >+ [% END %] >+ > <fieldset> > [% UNLESS multi_hold %] > [% IF clubcount %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js b/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js >index 6057cb8473..cf96f0067f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js >@@ -13,6 +13,7 @@ function patron_autocomplete(node, options) { > on_select_callback = options['on-select-callback']; > } > } >+ console.log(link_to); > const search_fields = ['me.surname', 'me.firstname', 'me.cardnumber']; > return node.autocomplete({ > source: function( request, response ) { >@@ -67,7 +68,9 @@ function patron_autocomplete(node, options) { > ? "/cgi-bin/koha/circ/circulation.pl" > : link_to == 'reserve' > ? "/cgi-bin/koha/reserve/request.pl" >- : "/cgi-bin/koha/members/moremember.pl"; >+ : link_to == 'recall' >+ ? "/cgi-bin/koha/recalls/request.pl" >+ : "/cgi-bin/koha/members/moremember.pl"; > item.link += ( url_params ? '?' + url_params + '&' : "?" ) + 'borrowernumber=' + item.patron_id; > } else { > item.link = null; >diff --git a/recalls/request.pl b/recalls/request.pl >index 222f7ab38b..eec78148f3 100755 >--- a/recalls/request.pl >+++ b/recalls/request.pl >@@ -38,26 +38,123 @@ my ($template, $loggedinuser, $cookie)= get_template_and_user( > my $op = $input->param('op') || 'list'; > my @recall_ids = $input->multi_param('recall_ids'); > my $biblionumber = $input->param('biblionumber'); >-my $recalls = Koha::Recalls->search({ biblio_id => $biblionumber, completed => 0 }); > my $biblio = Koha::Biblios->find( $biblionumber ); >+my $findborrower = $input->param('findborrower'); >+$findborrower = '' unless defined $findborrower; >+$findborrower =~ s|,| |g; >+my $error = $input->param('error'); > > if ( $op eq 'cancel_multiple_recalls' ) { > foreach my $id ( @recall_ids ) { >- Koha::Recalls->find( $id )->set_cancelled; >+ my $recall = Koha::Recalls->find( $id )->set_cancelled; >+ $biblionumber = $recall->biblionumber; > } >- $op = 'list' > } >+elsif ( $op eq 'patron_select' ) { >+ if ( $findborrower ) { >+ my $patron = Koha::Patrons->find( $findborrower ); >+ $biblionumber = $input->param('biblionumber'); >+ $biblio = Koha::Biblios->find( $biblionumber ); >+ >+ if ( C4::Context->preference('UseRecalls') and C4::Context->preference('RecallsInterface') ne 'opac' and $patron and $patron->borrowernumber ) { >+ if ( !$biblio->can_be_recalled({ patron => $patron }) ) { >+ $error = 1; >+ } > >-if ( $op eq 'list' ) { >- $recalls = Koha::Recalls->search({ biblio_id => $biblionumber, completed => 0 }); >+ $template->param( >+ patron => $patron, >+ error => $error, >+ ); >+ } >+ } else { >+ print $input->redirect("/cgi-bin/koha/recalls/request.pl?biblionumber=$biblionumber"); >+ } >+} >+elsif ( $op eq 'request' ) { >+ my $pickuploc = $input->param('pickup'); >+ my $expdate = $input->param('expirationdate'); >+ my $level = $input->param('type'); >+ my $itemnumber = $input->param('itemnumber'); >+ my $borrowernumber = $input->param('borrowernumber'); >+ $biblionumber = $input->param('biblionumber'); > $biblio = Koha::Biblios->find( $biblionumber ); >+ >+ if ( C4::Context->preference('UseRecalls') and C4::Context->preference('RecallsInterface') ne 'opac' and $borrowernumber ) { >+ my $patron = Koha::Patrons->find( $borrowernumber ); >+ >+ unless ( $biblio->can_be_recalled({ patron => $patron }) ) { $error = 'unavailable'; } >+ my $items = Koha::Items->search({ biblionumber => $biblionumber }); >+ >+ # check if already recalled >+ my $recalled = scalar $biblio->recalls; >+ if ( defined $recalled and $recalled > 0 ) { >+ my $recalls_per_record = Koha::CirculationRules->get_effective_rule({ >+ categorycode => $patron->categorycode, >+ branchcode => undef, >+ itemtype => undef, >+ rule_name => 'recalls_per_record' >+ }); >+ if ( defined $recalls_per_record and $recalls_per_record->rule_value and $recalled >= $recalls_per_record->rule_value ){ >+ $error = 'duplicate'; >+ } >+ } >+ >+ # submitting recall request >+ if ( defined $error and $error eq 'unavailable' ){ >+ # no items available for recall >+ print $input->redirect("/cgi-bin/koha/recalls/request.pl?biblionumber=$biblionumber&error=unavailable"); >+ >+ } elsif ( !defined $error ){ >+ my ( $recall, $due_interval, $due_date ); >+ if ( $level eq 'itemlevel' and defined $itemnumber ) { >+ my $item = Koha::Items->find( $itemnumber ); >+ if ( $item->can_be_recalled({ patron => $patron }) ) { >+ ( $recall, $due_interval, $due_date ) = Koha::Recalls->add_recall({ >+ patron => $patron, >+ biblio => $biblio, >+ branchcode => $pickuploc, >+ item => $item, >+ expirationdate => $expdate, >+ interface => 'staff', >+ }); >+ } else { >+ $error = 'cannot'; >+ } >+ } else { >+ if ( $biblio->can_be_recalled({ patron => $patron }) ) { >+ ( $recall, $due_interval, $due_date ) = Koha::Recalls->add_recall({ >+ patron => $patron, >+ biblio => $biblio, >+ branchcode => $pickuploc, >+ expirationdate => $expdate, >+ interface => 'staff', >+ }); >+ } else { >+ $error = 'cannot'; >+ } >+ } >+ if ( !defined $recall ) { >+ $error = 'failed'; >+ } >+ } >+ } > } > >+my $recalls = Koha::Recalls->search({ biblio_id => $biblionumber, completed => 0 }); >+my $branches = Koha::Libraries->search; >+my $single_branch_mode = $branches->count == 1; >+my $items = Koha::Items->search({ biblionumber => $biblionumber }); >+ > $template->param( > recalls => $recalls, > recallsview => 1, > biblio => $biblio, > checkboxes => 1, >+ findborrower => $findborrower, >+ single_branch_mode => $single_branch_mode, >+ branches => $branches, >+ items => $items, >+ error => $error, > C4::Search::enabled_staff_search_views, > ); > >diff --git a/reserve/modrequest.pl b/reserve/modrequest.pl >index 8fa885dd23..919375fbf4 100755 >--- a/reserve/modrequest.pl >+++ b/reserve/modrequest.pl >@@ -53,6 +53,7 @@ my @branch = $query->multi_param('pickup'); > my @itemnumber = $query->multi_param('itemnumber'); > my @biblionumber = $query->multi_param('biblionumber'); > my $count=@rank; >+my $recallerror=0; > > @biblionumber = uniq @biblionumber; > >@@ -87,6 +88,13 @@ else { > $params->{reservedate} = $reservedates[$i] ? dt_from_string($reservedates[$i]) : undef; > } > >+ if ( $rank[$i] eq 'recall' and $recallerror == 0 ) { >+ my $hold = Koha::Holds->find( $reserve_id[$i] ); >+ if ( !$hold->biblio->can_be_recalled({ patron => $hold->patron }) ) { >+ $recallerror++; >+ } >+ } >+ > try { > ModReserve($params); > } catch { >@@ -114,5 +122,8 @@ if ( $from eq 'borrower'){ > } else { > my $url = URI->new("/cgi-bin/koha/reserve/request.pl"); > $url->query_form( biblionumber => [@biblionumber]); >+ if ( $recallerror ) { >+ $url->query_form( recallerror => 1 ); >+ } > print $query->redirect($url); > } >diff --git a/reserve/request.pl b/reserve/request.pl >index 12c675240f..49a301af92 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -727,6 +727,11 @@ $template->param( > borrowernumber => $borrowernumber_hold, > ); > >+my $recallerror = $input->param('recallerror'); >+if ( $recallerror ) { >+ $template->param( recallerror => 1 ); >+} >+ > # printout the page > output_html_with_http_headers $input, $cookie, $template->output; > >-- >2.11.0
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 31391
:
139442
|
139443
|
139444
|
139446
|
139642
|
139643
|
139644
|
139645
|
141474
|
142594
|
143155
|
144104
|
144105
|
144131
|
144132
|
144133
|
144134
|
144135
|
144136
|
147581
|
147582
|
150485
|
150486
|
150487
|
150488
|
150489
|
150490
|
150491
|
156995
|
156996
|
156997
|
156998
|
156999
|
157000
|
157001
|
158691
|
158692
|
158693
|
158694
|
158695
|
158825
|
158826
|
158827
|
158828
|
158829
|
158830
|
158831
|
158832
|
172166
|
172167
|
172168
|
172169
|
172170
|
172171
|
172172
|
172173
|
172174
|
172175
|
173839
|
173840
|
173841
|
173842
|
173843
|
173844
|
173845
|
173846
|
173847
|
174396
|
174822
|
174823
|
174824
|
174825
|
174826
|
174827
|
174828
|
174829
|
174830
|
174831