Koha-clms/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt

2077 lines
119 KiB
Plaintext

[% USE raw %]
[% USE To %]
[% USE Asset %]
[% USE JSON.Escape %]
[% USE Koha %]
[% USE Biblio %]
[% USE KohaDates %]
[% USE Branches %]
[% USE Categories %]
[% USE ItemTypes %]
[% USE AuthorisedValues %]
[% USE Price %]
[% USE TablesSettings %]
[% SET reserve_input_type = 'radio' %]
[% IF ( Koha.Preference('DisplayMultiItemHolds') ) %]
[% SET reserve_input_type = 'checkbox' %]
[% END %]
[% PROCESS 'i18n.inc' %]
[% 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" %]
[% PROCESS 'modals/holds_table_modals.inc' %]
<title
>[% FILTER collapse %]
[% UNLESS ( multi_hold ) %]
[% title_in_title = INCLUDE 'biblio-title-head.inc' %]
[% tx("Place hold on {title}", { title = title_in_title }) | html %]
&rsaquo;
[% ELSE %]
[% t("Confirm holds") | html %]
&rsaquo;
[% END %]
[% t("Holds") | html %]
&rsaquo; [% t("Circulation") | html %] &rsaquo; [% t("Koha") | html %]
[% END %]</title
>
[% INCLUDE 'doc-head-close.inc' %]
[% FILTER collapse %]
<style nonce="[% Koha.CSPNonce | $raw %]">
a.hold-arrow {
display: inline-block;
padding: 3px;
}
a.hold-arrow:link,
a.hold-arrow:visited {
color: #538200;
}
a.hold-arrow:hover,
a.hold-arrow:active {
color: #75b700;
}
.hold-arrow:hover i,
.hold-arrow:active i {
border-color: #75b700;
}
a.cancel-hold {
display: inline-block;
padding: 3px;
}
a.cancel-hold:link,
a.cancel-hold:visited {
font-size: 130%;
}
.icon-move-hold-up::before {
content: "\f062";
}
.icon-move-hold-top {
border-top: 2px solid #538200;
display: inline;
}
.icon-move-hold-top::before {
content: "\f062";
}
.icon-move-hold-bottom {
border-bottom: 2px solid #538200;
display: inline;
}
.icon-move-hold-bottom::before {
content: "\f063";
}
.icon-move-hold-down::before {
content: "\f063";
}
.icon-unset-lowest::before {
content: "\f050";
}
.icon-set-lowest::before {
content: "\f04e";
}
:disabled {
opacity: 0.5;
}
.current_priority {
width: 50px;
text-align: left;
margin-top: 5px;
}
.rank-request {
width: 50px;
}
#cancellation-reason-div {
display: flex;
align-items: center;
}
</style>
[% END %]
</head>
<body id="circ_request" class="reserve">
[% WRAPPER 'header.inc' %]
[% INCLUDE 'circ-search.inc' %]
[% END %]
[% WRAPPER 'sub-header.inc' %]
[% WRAPPER breadcrumbs %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
[% END %]
[% UNLESS ( multi_hold ) %]
[% WRAPPER breadcrumb_item %]
[% INCLUDE 'biblio-title.inc' link =1 %]
[% END %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>Place a hold</span>
[% END %]
[% ELSE %]
[% IF ( patron ) %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>Place holds</span>
[% END %]
[% ELSE %]
[% IF clubcount %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>Search patrons or clubs</span>
[% END %]
[% ELSE %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>Search patrons</span>
[% END %]
[% END %]
[% END %]
[% END # UNLESS multi_hold %]
[% END #/ WRAPPER breadcrumbs %]
[% END #/ WRAPPER sub-header.inc %]
[%# No sidebar menu when placing multiple holds or biblio not found %]
[% SET aside = (multi_hold || nobiblio) ? '' : 'biblio-view-menu' %]
[% WRAPPER 'main-container.inc' aside=aside wide_centered=1 %]
<h1>Holds</h1>
[% IF ( nobiblio ) %]
<div class="alert alert-warning">
[% IF (multi_hold) %]
<strong>Cannot place hold:</strong> one or more records don't exist.
[% ELSE %]
<strong>Cannot place hold:</strong> this record doesn't exist.
[% END %]
</div>
[% END %]
[% IF ( noitems ) %]
<div class="alert alert-warning">
[% IF (multi_hold) %]
<strong>Cannot place hold:</strong> one or more records without items attached.
[% ELSE %]
<strong>Cannot place hold:</strong> this record has no items attached.
[% END %]
</div>
[% END %]
[% IF ( hold_move_successes ) %]
<div class="alert alert-success">
<p>Moved the following holds:</p>
<ul>
[% FOREACH hold IN hold_move_successes %]
<li>
<label>Hold ID: </label>
<span>[% hold.hold_id | html %]</span>
<span> - Moved from [%- INCLUDE 'biblio-title.inc' biblio=hold.original_biblio link = 1 -%] to [%- INCLUDE 'biblio-title.inc' biblio=hold.target_biblio link = 1 -%]</span>
</li>
[% END %]
</ul>
</div>
[% END %]
[% IF ( hold_move_failures ) %]
<div class="alert alert-warning">
<strong>One or more holds were not moved due to following errors:</strong>
<ul>
[% FOREACH fail IN hold_move_failures %]
<li>
<label>Hold ID: </label>
<span>[% fail.hold_id | html %]</span>
[% SWITCH fail.error %]
[% CASE 'cannotReserveFromOtherBranches' %]
<span>Target item cannot be placed on hold from other libraries</span>
[% CASE 'ageRestricted' %]
<span>The target record and/or items are age restricted</span>
[% CASE 'alreadypossession' %]
<span>Target item is already checked out to patron</span>
[% CASE 'noReservesAllowed' %]
<span>No holds are allowed on the target item(s)</span>
[% CASE 'tooManyReservesToday' %]
<span>Target item has too many holds placed on it today</span>
[% CASE 'tooManyReserves' %]
<span>Target item has too many holds placed on it</span>
[% CASE 'notReservable' %]
<span>Target item cannot be placed on hold</span>
[% CASE 'branchNotInHoldGroup' %]
<span>Target item is not in the local hold group</span>
[% CASE 'notforloan' %]
<span>Target item is not for loan</span>
[% CASE 'damaged' %]
<span>Target item is damaged</span>
[% CASE 'invalidPickupBranch' %]
<span>Target item or record has an invalid pickup location. Either move the hold onto a valid item type or select a valid pickup location.</span>
[% CASE 'noItemsOnBib' %]
<span>Target record has no items. Move to a record that has items.</span>
[% CASE %]
<span>Error: [% fail.error | html %]</span>
[% END %]
</li>
[% END %]
</ul>
</div>
[% END %]
[% IF ( failed_holds ) %]
<div class="alert alert-warning">
<strong>One or more holds were not placed due to following errors:</strong>
<ul>
[% FOREACH fail IN failed_holds %]
<li>
[% SWITCH fail %]
[% CASE 'damaged' %]
<span>Item is damaged</span>
[% CASE 'ageRestricted' %]
<span>The record and its items are age restricted</span>
[% CASE 'tooManyHoldsForThisRecord' %]
<span>Patron exceeded the number of concurrent holds for this record</span>
[% CASE 'tooManyReservesToday' %]
<span>Patron reached daily holds limit</span>
[% CASE 'tooManyReserves' %]
<span>Too many holds already</span>
[% CASE 'notReservable' %]
<span>Not holdable</span>
[% CASE 'cannotReserveFromOtherBranches' %]
<span>Patron from a different library</span>
[% CASE 'branchNotInHoldGroup' %]
<span>Holds are not allowed from patron's library</span>
[% CASE 'itemAlreadyOnHold' %]
<span>Patron already has a hold for failed item(s)</span>
[% CASE 'cannotBeTransferred' %]
<span>Cannot be transferred to pickup library</span>
[% CASE 'pickupNotInHoldGroup' %]
<span>The chosen pickup location is not allowed</span>
[% CASE 'noReservesAllowed' %]
<span>No holds are allowed on failed item(s)</span>
[% CASE 'libraryNotPickupLocation' %]
<span>Library is not a valid pickup location</span>
[% CASE 'no_valid_pickup_location' %]
<span>No valid pickup location</span>
[% CASE 'notforloan' %]
<span>Not for loan</span>
[% CASE 'items_available' %]
<span>There are items available in the library</span>
[% CASE 'not_placed' %]
<span>Error when placing hold</span>
[% CASE %]
<span>Error: [% fail | html %]</span>
[% END %]
</li>
[% END %]
</ul>
</div>
[% END %]
[% UNLESS ( multi_hold ) %]
<h2>Place hold on [% INCLUDE 'biblio-title.inc' link = 1 %] [% IF biblio.author %]by [% biblio.author | html %][% END %]</h2>
[% IF ( patron && reserve_charge ) %]
<div class="alert alert-warning" id="reserve_fee">
[% IF Koha.Preference('HoldFeeMode') == 'any_time_is_collected' %]
<strong>Note:</strong> [% INCLUDE 'patron-title.inc' patron = patron no_title = 1 no_cardnumber = 1 hide_patron_infos_if_needed = 1 %] will be charged a hold fee of [% reserve_charge | $Price %] when they collect this
item
[% ELSE %]
<strong>Note:</strong> [% INCLUDE 'patron-title.inc' patron = patron no_title = 1 no_cardnumber = 1 hide_patron_infos_if_needed = 1 %] will be charged a hold fee of [% reserve_charge | $Price %] for placing this hold
[% END %]
</div>
[% END %]
[% ELSE %]
<h2>
[% IF ( patron ) %]
<span>Place holds</span>
[% ELSE %]
[% IF clubcount %]
<span>Search patrons or clubs</span>
[% ELSE %]
<span>Search patrons</span>
[% END %]
[% END %]
</h2>
[% END %]
[% UNLESS club OR patron OR patron.borrowernumber OR noitems OR nobiblio %]
[% IF ( messageborrower ) %]
<div class="alert alert-warning">
<h3>Patron not found</h3>
<p>No patron with this name, please, try another</p>
</div>
[% END %]
[% IF ( messageclub ) %]
<div class="alert alert-warning">
<h3>Club not found</h3>
<p>No club with this name, please, try another</p>
</div>
[% END %]
[% IF ( recallerror ) %]
<div class="alert alert-warning">
<h3>Hold cannot be converted to a recall</h3>
<p>A recall cannot be placed for 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 %]
<h2>Search patrons or clubs</h2>
[% ELSE %]
<h2>Search patrons</h2>
[% END %]
[% END %]
[% WRAPPER tabs id= "circ_holds_select" %]
[% WRAPPER tabs_nav %]
[% WRAPPER tab_item tabname= "holds_patronsearch_pane" bt_active= 1 %]<span>Patrons</span>[% END %]
[% IF clubcount %]
[% WRAPPER tab_item tabname= "holds_clubsearch_pane" %]<span>Clubs</span>[% END %]
[% END %]
[% END # /WRAPPER tabs_nav %]
[% WRAPPER tab_panels %]
[% WRAPPER tab_panel tabname="holds_patronsearch_pane" bt_active= 1 %]
[% PROCESS patron_search_filters_simple %]
[% PROCESS patron_search_table table_id => 'table_borrowers', open_on_row_click => 1 %]
[% END # /tab_panel# %]
[% IF clubcount %]
[% WRAPPER tab_panel tabname="holds_clubsearch_pane" %]
<form id="holds_clubsearch" action="request.pl" method="get">
<div class="hint">Enter club ID or partial name:</div>
<input type="text" size="40" id="club" class="focus" name="findclub" autocomplete="off" />
<input type="hidden" name="form_submitted" value="1" />
<input type="submit" class="btn btn-primary" value="Search" />
[% FOREACH biblionumber IN biblionumbers %]
<input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
[% END %]
</form>
<!-- /#holds_patronsearch -->
[% IF clubs %]
[% INCLUDE 'clubs-table.inc' destination = "holds" %]
[% END %]
[% END # /tab_panel# %]
[% END # /IF clubcount %]
[% END # /WRAPPER tab_panels %]
[% END # /WRAPPER tabs %]
</fieldset>
[% ELSIF club %]
<div class="alert alert-warning visually-hidden clubalert"> </div>
<fieldset class="rows">
<legend>Hold details</legend>
<form action="/api/v1/clubs/[% club.id | html %]/holds" method="post" name="form" id="club-request-form">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-noop" />
[% IF ( multi_hold ) %]
<input type="hidden" name="request" value="any" />
[% FOREACH biblioloo IN biblioloop %]
[% UNLESS biblioloo.none_avail %]
<input type="hidden" name="holdable_bibs" id="holdable_bibs" value="[% biblioloo.biblionumber | html %]" />
<input type="hidden" name="title_[% biblioloo.biblionumber | html %]" value="[% biblioloo.title | html %]" />
<input type="hidden" name="rank_[% biblioloo.biblionumber | html %]" value="[% biblioloo.rank | html %]" />
[% END %]
[% END %]
[% ELSE %]
<input type="hidden" name="holdable_bibs" id="holdable_bibs" value="[% biblio.biblionumber | html %]" />
<input type="hidden" name="title" value="[% biblio.title | html %]" />
<input type="hidden" name="rank-request" value="[% fixedRank | html %]" />
[% END # /IF multi_hold %]
<ol>
<li> <span class="label">Club: </span> [% club.name | html %] </li>
<li> <span class="label">Description: </span> [% club.description | html %] </li>
<li>
<label for="pickup">Pickup at:</label>
<select name="pickup" id="pickup_club">
[% PROCESS options_for_libraries libraries => Branches.all({ selected => club.branchcode, search_params => { pickup_location => 1 } }) %]
</select>
</li>
<li>
<label for="default_patron_home">Pickup at patron's home library when possible:</label>
<input type="checkbox" id="default_patron_home" name="default_patron_home" />
</li>
</ol>
<h2 style="padding: 0 1em;">Members</h2>
<ol>
[% FOREACH member IN members %]
[% SET patron = member.patron %]
<li style="padding: 0.5em 1em;">
<div>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %]</div>
[% IF member.exceeded_maxreserves %]
<div>
<i class="fa fa-error"></i>
<strong>Too many holds: </strong> Patron can only place a maximum of [% maxreserves | html %] total holds.
</div>
[% END %]
[% IF ( patron.is_expired ) %]
<div>
<i class="fa-solid fa-triangle-exclamation"></i>
<strong>Account has expired</strong>
</div>
[% END %]
[% IF patron.is_debarred %]
<div>
<i class="fa-solid fa-triangle-exclamation"></i>
<strong>Patron has restrictions</strong>
</div>
[% END %]
[% IF member.amount_outstanding && Koha.Preference('maxoutstanding') && member.amount_outstanding > Koha.Preference('maxoutstanding') %]
<div>
<i class="fa-solid fa-triangle-exclamation"></i>
<strong>Patron has outstanding fines: [% member.amount_outstanding | $Price %]</strong>
</div>
[% END %]
[% IF ( member.diffbranch ) %]
<div>
<i class="fa-solid fa-triangle-exclamation"></i>
<strong>Pickup library is different.</strong> Patron's home library: ([% Branches.GetName(patron.branchcode) | html %] / [% patron.branchcode | html %] )
</div>
[% END %]
</li>
[% END %]
</ol>
[% UNLESS ( multi_hold ) %]
<fieldset class="action">
<input type="submit" class="btn btn-primary" value="Place hold" />
</fieldset>
[% ELSE %]
<table id="requesttitles">
<tr>
<th>&nbsp;</th>
<th>Title</th>
[% UNLESS Koha.Preference('item-level_itypes') %]
<th>Item type</th>
[% END %]
<th>Priority</th>
<th>Information</th>
</tr>
[% FOREACH biblioloo IN biblioloop %]
<tr [% IF biblioloo.warn %]class="onissue"[% END %]>
<td>
[% UNLESS ( biblioloo.warn ) %]
<input class="multi_hold_item_checkbox" type="checkbox" checked="checked" title="[% biblioloo.biblionumber | html %]" />
[% END %]
</td>
<td>
<ul>
<li>
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">[% biblioloo.title | html %]</a>
[% IF biblioloo.author %]by [% biblioloo.author | html %][% END %]
</li>
[% IF ( biblioloo.publicationyear ) %]
<li> <span class="label">Publication year:</span> [% biblioloo.publicationyear | html %] </li>
[% END %]
[% IF ( patron && biblioloo.reserve_charge ) %]
<li>
<span class="label">Hold fee:</span>
[% IF Koha.Preference('HoldFeeMode') == 'any_time_is_collected' %]
[% biblioloo.reserve_charge | $Price %]
(charged when collected)
[% ELSE %]
[% biblioloo.reserve_charge | $Price %]
(charged when placed)
[% END %]
</li>
[% END %]
</ul>
[% IF ( biblioloo.warn ) %]
<span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
[% END %]
</td>
[% UNLESS Koha.Preference('item-level_itypes') %]
<td>
<img
class="itemtype-image"
src="[% biblioloo.itemtype.image_location| html %]"
alt="[% biblioloo.itemtype.translated_description | html %]"
title="[% biblioloo.itemtype.translated_description | html %]"
/>
</td>
[% END %]
<td>[% biblioloo.rank | html %]</td>
<td>
[% IF ( biblioloo.checked_previously ) %]
<span>Patron has previously checked out this title</span><br />
[% END %]
[% IF ( biblioloo.alreadyres ) %]
<ul>
<li> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] <strong>already has a hold</strong> on this item </li>
</ul>
[% END %]
[% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
<ul
><li> <strong>No items are available</strong> to be placed on hold</li></ul
>
[% END %]
</td>
</tr>
[% END # /FOREACH biblioloo %]
</table>
<!-- /#requesttitles -->
[% END %]
</form>
</fieldset>
[% ELSIF NOT ( noitems || nobiblio ) # /UNLESS patron %]
[% IF ( checked_previously && !multi_hold ) %]
<div class="alert alert-warning">
<ul>
<li>Patron has previously checked out this title</li>
</ul>
</div>
[% END %]
[% IF ( no_reserves_allowed || exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || none_available_override || alreadypossession || ageRestricted || recall ) %]
<div class="alert alert-warning">
[% UNLESS ( multi_hold ) %]
<h3>Cannot place hold</h3>
<ul>
[% IF ( no_reserves_allowed ) %]
<li><strong>No holds allowed:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] cannot place a hold on any of these items.</li>
[% ELSIF ( exceeded_maxreserves ) %]
<li
><strong>Too many holds:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can only place a maximum of [% maxreserves | html %] total
holds.</li
>
[% ELSIF ( exceeded_holds_per_record ) %]
<li
><strong>Too many holds for this record:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can only place a maximum of
[% max_holds_for_record | html %] hold(s) on this record.</li
>
[% ELSIF ( alreadypossession ) %]
<li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 hide_patron_infos_if_needed => 1 %] <strong>is already in possession</strong> of one item.</li>
[% ELSIF ( alreadyreserved ) %]
<li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] <strong>already has a hold</strong> on this item.</li>
[% ELSIF ( ageRestricted ) %]
<li><strong>Age restricted</strong></li>
[% ELSIF ( none_available || none_available_override ) %]
<li> <strong>No items are available</strong> to be placed on hold.</li>
[% ELSIF ( maxreserves ) %]
<li
><strong>Too many holds:</strong>
[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] has too many holds.</li
>
[% ELSIF ( recall ) %]
<li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] has <strong>already placed a recall</strong> on this item.</li>
[% END # /IF exceeded_maxreserves %]
</ul>
[% ELSE # UNLESS multi_hold %]
<h3>Cannot place hold on some items</h3>
[% IF (no_reserves_allowed ) %]
<li><strong>No holds allowed:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] cannot place holds on some of these title's items.</li>
[% ELSIF ( exceeded_maxreserves ) %]
<li
><strong>Too many holds:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can place [% new_reserves_allowed | html %] of the requested
[% new_reserves_count | html %] holds for a maximum of [% maxreserves | html %] total holds.</li
>
[% ELSIF ( exceeded_holds_per_record ) %]
[% FOREACH biblioloo IN biblioloop %]
[% IF (biblioloo.tooManyHoldsForThisRecord) %]
<li
><strong>Too many holds for <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]"> [% biblioloo.title | html %]</a>:</strong>
[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can only place a maximum of [% max_holds_for_record | html %] hold(s) on this
record.</li
>
[% END %]
[% END %]
[% ELSIF ( none_available ) %]
<li><strong>No items available: </strong>One or more records have no items that can be held</li>
[% END # /IF exceeded_maxreserves %]
[% END # /UNLESS multi_hold %]
</div>
[% END # /IF ( exceeded_maxreserves || ... %]
[% IF ( patron.is_expired || diffbranch || patron.is_debarred || ( amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') ) ) %]
<div class="alert alert-info">
<ul>
[% IF ( patron.is_expired ) %]
<li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %]: <strong>Account has expired</strong></li>
[% END %]
[% IF patron.is_debarred %]
<li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %]: <strong>Patron has restrictions</strong></li>
[% END %]
[% IF amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') %]
<li
>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 link_to => 'members_pay' %]:
<strong>Patron has outstanding fines: [% amount_outstanding | $Price %]</strong></li
>
[% END %]
[% IF ( diffbranch ) %]
<li>
<strong>Pickup library is different. </strong>
[% UNLESS Koha.Preference('HidePatronName') %]
Patron: [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %]
[% END %]
Patron's home library: [% Branches.GetName(patron.branchcode) | html %] / [% patron.branchcode | html %]
</li>
[% END %]
</ul>
<!-- /.dialog.message -->
</div>
[% END # /IF patron.is_expired || diffbranch ... %]
[% IF ( messageborrower ) %]
<div class="alert alert-warning">
<h3>Patron not found:</h3>
<p>Name or barcode not found. Please try an other </p>
</div>
[% END %]
<div class="alert alert-warning visually-hidden holdalert"> </div>
[% UNLESS ( multi_hold ) %]
<form action="placerequest.pl" method="post" name="form" id="hold-request-form">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-placerequest" />
<fieldset class="rows">
<legend>Hold details</legend>
<input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
[% FOREACH biblionumber IN biblionumbers %]
<input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
[% END %]
[% IF supplyill %]
<input type="hidden" name="supplyill" value="[% supplyill | html %]" />
[% END %]
<input type="hidden" name="holdable_bibs" id="holdable_bibs" value="[% biblio.biblionumber | html %]" />
<input type="hidden" name="title" value="[% biblio.title | html %]" />
<input type="hidden" name="rank-request" value="[% fixedRank | html %]" />
<ol>
<li>
<span class="label">Patron:</span>
[% IF ( patron.borrowernumber ) %]
[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 hide_patron_infos_if_needed => 1 %]
[% ELSE %]
Not defined yet
[% END %]
</li>
<li>
<span class="label">Estimated priority:</span>
<strong>[% fixedRank | html %]</strong>
</li>
<li>
<label for="holdnotes">Notes:</label>
<textarea id="holdnotes" name="notes" cols="30" rows="1"></textarea>
</li>
[% IF Koha.Preference('AllowHoldItemTypeSelection') %]
<li>
<label for="itemtype">Request specific item type:</label>
<select name="itemtype" id="itemtype">
<option value="">Any item type</option>
[%- FOREACH itemtype IN available_itemtypes %]
<option value="[% itemtype | html %]">[% ItemTypes.GetDescription( itemtype ) | html %]</option>
[%- END %]
</select>
</li>
[% END %]
[% IF ( Koha.Preference('AllowHoldDateInFuture') ) %]
<li>
<label for="from">Hold starts on date:</label>
<input id="reserve_date" name="reserve_date" id="from" size="10" type="text" data-date_to="expiration_date" class="flatpickr" data-flatpickr-futureinclusive="true" />
</li>
[% END %]
<li>
<label for="to">Hold expires on date:</label>
<input id="expiration_date" name="expiration_date" id="to" size="10" type="text" class="flatpickr" data-flatpickr-futuredate="true" />
</li>
<li id="non_priority_list_item">
<label for="non_priority">Non priority hold:</label>
<input name="non_priority" id="non_priority" type="checkbox" />
<span class="hint">A non priority hold doesn't prevent a current checkout from renewing</span>
</li>
</ol>
</fieldset>
[% IF supplyill %]
<fieldset class="rows">
<legend>ISO18626 ILL request details</legend>
<p>This hold will be linked to <a target="_blank" href="/cgi-bin/koha/ill/iso18626_requests/[% supplyill | url %]"> supply ILL [% supplyill | html %]</a>. </p
><p>This will update the ILL's status to "ExpectToSupply" and send an ISO18626 message to the requesting agency including the details below.</p>
<li>
<label for="iso18626_messageInfo_note">Message info note:</label>
<textarea id="iso18626_messageInfo_note" name="iso18626_messageInfo_note" cols="30" rows="1"></textarea>
</li>
<li>
<label for="iso18626_statusInfo_expectedDeliveryDate">Status info expected delivery date:</label>
<input id="iso18626_statusInfo_expectedDeliveryDate" name="iso18626_statusInfo_expectedDeliveryDate" size="10" type="text" class="flatpickr" data-flatpickr-enable-time="true" />
</li>
</fieldset>
[% END %]
<fieldset class="rows any_specific">
<legend>
[% IF force_hold_level == 'item' || force_hold_level == 'item_group' %]
<input type="radio" id="requestany" name="request" disabled="true" />
[% ELSIF force_hold_level == 'record' %]
<input type="radio" id="requestany" checked="checked" value="Any" disabled="true" />
<input type="hidden" name="request" value="Any" />
<span class="error"><i>(Required)</i></span>
[% ELSE %]
<input type="radio" id="requestany" name="request" checked="checked" value="Any" />
[% END %]
<label for="requestany" class="inline"> Hold next available item: </label>
</legend>
<input type="hidden" name="alreadyreserved" value="[% alreadyreserved | html %]" />
<fieldset class="enable_request_any disable_request_group disable_request_specific">
[% IF force_hold_level == 'item' # Patron has placed a item level hold previously for this record %]
<span class="error">
<i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
Hold must be item level
</span>
[% ELSIF force_hold_level == 'item_group' # Patron has placed an item group level hold previously for this record %]
<span class="error">
<i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
Hold must be item group level
</span>
[% ELSE %]
<ol>
<li>
<label for="pickup">Pickup at:</label>
<select name="pickup" id="pickup-next-avail" data-biblio-id="[% biblio.biblionumber | html %]" data-patron-id="[% patron.borrowernumber | html %]" data-pickup-location-source="biblio">
[% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => biblionumber, patron => patron }, selected => pickup }) %]
</select>
</li>
[% IF Koha.Preference('AllowHoldItemTypeSelection') %]
<li>
<label for="itemtype">Request specific item type:</label>
<select name="itemtype" id="itemtype">
<option value="">Any item type</option>
[%- FOREACH itemtype IN available_itemtypes %]
<option value="[% itemtype | html %]">[% ItemTypes.GetDescription( itemtype ) | html %]</option>
[%- END %]
</select>
</li>
[% END %]
[% UNLESS remaining_holds_for_record == 1 %]
<li>
<label for="holds_to_place_count">Holds to place (count): </label>
<input type="text" inputmode="numeric" pattern="[0-9]*" id="holds_to_place_count" name="holds_to_place_count" value="1" />
</li>
[% ELSE %]
<input type="hidden" name="holds_to_place_count" value="1" />
[% END %]
</ol>
[% END %]
<fieldset class="action">
[% IF ( patron.borrowernumber ) %]
[% IF ( override_required ) %]
<button type="submit" id="hold_grp_btn" class="btn btn-primary"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
[% ELSIF ( none_available ) %]
<button type="submit" id="hold_grp_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
[% ELSE %]
<button type="submit" id="hold_grp_btn" class="btn btn-primary">Place hold</button>
[% END %]
[% END %]
</fieldset>
</fieldset>
</fieldset>
<hr />
[% biblio_info = biblioloop.0 %]
<!-- ItemGroup level holds -->
[% IF Koha.Preference('EnableItemGroupHolds') && biblio_info.object.item_groups.count %]
<fieldset class="rows any_specific">
<legend>
[% IF force_hold_level == 'item_group' %]
<input type="radio" class="requestgrp" id="requestgrp" name="request" checked="checked" disabled="true" />
<span class="error"><i>(Required)</i></span>
[% ELSIF force_hold_level == 'item' || force_hold_level == 'record' %]
<input type="radio" class="requestgrp" id="requestgrp" name="request" disabled="true" />
[% ELSE %]
<input type="radio" class="requestgrp" id="requestgrp" name="request" />
[% END %]
<label for="requestgrp" class="inline"> Hold next available item from an item group </label>
</legend>
<fieldset class="enable_request_group disable_request_any disable_request_specific">
[% IF force_hold_level == 'record' # Patron has placed a record level hold previously for this record %]
<span class="error">
<i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
Hold must be record level
</span>
[% ELSIF force_hold_level == 'item' # Patron has placed an item level hold previously for this record %]
<span class="error">
<i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
Hold must be item level
</span>
[% ELSE %]
<ul>
<li>
<label for="pickup">Pickup at:</label>
<select name="pickup" id="pickup-item-group" data-biblio-id="[% biblio.biblionumber | html %]" data-patron-id="[% patron.borrowernumber | html %]" data-pickup-location-source="biblio">
[% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => biblionumber, patron => patron }, selected => pickup }) %]
</select>
</li>
<li>
<table id="requestgroup">
<thead>
<tr>
<th>Hold</th>
<th>Item group</th>
<th>Holdable items</th>
</tr>
</thead>
<tbody>
[% FOREACH g IN biblio_info.object.item_groups.search({}, { order_by => ['display_order'] }) %]
[% IF g.items.count %]
<tr>
<td>
<input id="item_group_id_[% g.id | html %]" class="requestgrp" type="radio" name="item_group_id" value="[% g.id | html %]" />
</td>
<td>
<label for="item_group_id_[% g.id | html %]">[% g.description | html %]</label>
</td>
<td>
[% FOREACH i IN g.items %]
<div><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% i.biblionumber | uri %]#item[% i.itemnumber | uri %]">[% i.barcode | html %]</a></div>
[% END %]
</td>
</tr>
[% ELSE %]
<tr>
<td>
<input id="item_group_id_[% g.id | html %]" class="requestgrp" type="radio" name="item_group_id" value="[% g.id | html %]" disabled="disabled" />
</td>
<td>
<label for="item_group_id_[% g.id | html %]">[% g.description | html %]</label>
</td>
<td>
<div class="error">No holdable items in this item group.</div>
</td>
</tr>
[% END %]
[% END %]
</tbody>
</table>
</li>
</ul>
[% END %]
<fieldset class="action">
[% IF ( patron.borrowernumber ) %]
[% IF ( override_required ) %]
<button type="submit" id="hold_any_btn" class="btn btn-primary"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
[% ELSIF ( none_available ) %]
<button type="submit" id="hold_any_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
[% ELSE %]
<button type="submit" id="hold_any_btn" class="btn btn-primary">Place hold</button>
[% END %]
[% END %]
</fieldset>
</fieldset>
</fieldset>
[% END %]
<!-- /ItemGroup level holds -->
<fieldset class="rows any_specific">
<legend>
[% IF force_hold_level == 'item' %]
<input type="radio" id="requestspecificitem" name="request" class="requestspecific" checked="checked" disabled="disabled" />
<span class="error"><em>(Required)</em></span>
[% ELSIF force_hold_level == 'record' || force_hold_level == 'item_group' %]
<input type="radio" id="requestspecificitem" name="request" class="requestspecific" disabled="disabled" />
[% ELSE %]
<input type="radio" id="requestspecificitem" name="request" class="requestspecific" />
[% END %]
<label for="requestspecificitem" class="inline"> Hold a specific item </label>
</legend>
<fieldset class="enable_request_specific disable_request_any disable_request_group">
<ol>
[% UNLESS Koha.Preference('item-level_itypes') %]
<li>
<span class="label">Item type:</span>
[% biblio_info.itemtype.translated_description | html %]
</li>
[% END %]
[% IF ( biblio_info.biblioitem.publicationyear ) %]
<li>
<span class="label">Publication year:</span>
[% biblio_info.biblioitem.publicationyear | html %]
</li>
[% END %]
[% IF ( Koha.Preference('DisplayAddHoldGroups') && Koha.Preference('DisplayMultiItemHolds') ) %]
<li id="hold_group_list_item">
<label for="hold_group">Treat as hold group: </label>
<input name="hold_group" id="hold_group" type="checkbox" />
<span class="hint">Place a hold on the next available title from this group</span>
</li>
[% END %]
</ol>
<table id="requestspecific">
<thead>
<tr>
<th>Hold</th>
<th>Allowed pickup locations</th>
[% IF Koha.Preference('item-level_itypes') %]
<th>Item type</th>
[% END %]
<th>Barcode</th>
[% IF Koha.Preference('EnableItemGroupHolds') && biblio_info.object.item_groups.count %]
<th>Item group</th>
[% END %]
<th>Home library</th>
<th>Last location</th>
[% IF itemdata_ccode %]
<th>Collection</th>
[% END %]
<th>Call number</th>
<th>Copy number</th>
[% IF itemdata_enumchron %]
<th>Vol no.</th>
[% END %]
<th>Information</th>
</tr>
</thead>
<tbody>
[% SET selected = 0 %]
[% FOREACH itemloo IN biblio_info.itemloop %]
[% UNLESS ( itemloo.hide ) %]
<tr class="[% itemloo.backgroundcolor | html %]">
<td>
[% IF force_hold_level == 'record' # Patron has placed a record level hold previously for this record %]
<span class="error">
<i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
Hold must be record level
</span>
[% ELSIF force_hold_level == 'item_group' %]
<span class="error">
<i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
Hold must be item group level
</span>
[% ELSIF ( itemloo.available ) %]
<input type="[% reserve_input_type | html %]" name="checkitem" class="requestspecific" value="[% itemloo.itemnumber | html %]" />
[% ELSIF ( itemloo.override ) %]
<input type="[% reserve_input_type | html %]" name="checkitem" class="needsoverride requestspecific" value="[% itemloo.itemnumber | html %]" />
<i class="fa fa-exclamation-triangle fa-lg" style="color:gold" title="Requires override of hold policy"></i>
[% ELSE %]
<span class="error">
<i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
[% IF itemloo.not_holdable %]
[% IF itemloo.not_holdable == 'damaged' %]
<span>Item damaged</span>
[% ELSIF itemloo.not_holdable == 'ageRestricted' %]
<span>Age restricted</span>
[% ELSIF itemloo.not_holdable == 'tooManyHoldsForThisRecord' %]
<span>Exceeded max holds per record</span>
[% ELSIF itemloo.not_holdable == 'tooManyReservesToday' %]
<span>Daily hold limit reached for patron</span>
[% ELSIF itemloo.not_holdable == 'tooManyReserves' %]
<span>Too many holds</span>
[% ELSIF itemloo.not_holdable == 'notReservable' %]
<span>Not holdable</span>
[% ELSIF itemloo.not_holdable == 'cannotReserveFromOtherBranches' %]
<span>Patron is from different library</span>
[% ELSIF itemloo.not_holdable == 'branchNotInHoldGroup' %]
<span>Cannot place hold from patron's library</span>
[% ELSIF itemloo.not_holdable == 'itemAlreadyOnHold' %]
<span>Patron already has hold for this item</span>
[% ELSIF itemloo.not_holdable == 'cannotBeTransferred' %]
<span>Cannot be transferred to pickup library</span>
[% ELSIF itemloo.not_holdable == 'pickupNotInHoldGroup' %]
<span>Only pickup locations within the same hold group are allowed</span>
[% ELSIF itemloo.not_holdable == 'noReservesAllowed' %]
<span>No holds are allowed on this item</span>
[% ELSIF itemloo.not_holdable == 'libraryNotPickupLocation' %]
<span>Library is not a pickup location</span>
[% ELSIF itemloo.not_holdable == 'no_valid_pickup_location' %]
<span>No valid pickup location</span>
[% ELSIF itemloo.not_holdable == 'notforloan' %]
<span>Not for loan</span>
[% ELSE %]
<span>[% itemloo.not_holdable | html %]</span>
[% END %]
[% END %]
</span>
[% END # /IF force_hold_level %]
</td>
<td>
[% IF (itemloo.pickup_locations_count > 0) || Koha.Preference('AllowHoldPolicyOverride') %]
<select
name="item_pickup_[% itemloo.itemnumber | html %]"
class="pickup_locations requestspecific"
style="width:100%;"
data-item-id="[% itemloo.itemnumber | html %]"
data-patron-id="[% patron.borrowernumber | html %]"
data-pickup-location-source="item"
>
[% IF (itemloo.default_pickup_location) %]
<option value="[% itemloo.default_pickup_location.branchcode | html %]" selected="selected">[% itemloo.default_pickup_location.branchname | html %]</option>
[% END %]
</select>
[% END %]
</td>
[% IF Koha.Preference('item-level_itypes') %]
<td>
[% UNLESS ( noItemTypeImages ) %]
[% IF ( itemloo.itemtype.image_location) %]<img class="itemtype-image" src="[% itemloo.itemtype.image_location | html %]" alt="" /> <br />[% END %]
[% END %]
<span class="itypetext">[% itemloo.itemtype.translated_description | html %]</span>
</td>
[% END %]
<td> [% itemloo.barcode | html %] </td>
[% IF Koha.Preference('EnableItemGroupHolds') && biblio_info.object.item_groups.count %]
<td> [% itemloo.object.item_group.description | html %] </td>
[% END %]
<td> [% Branches.GetName( itemloo.homebranch ) | html %] </td>
<td> [% Branches.GetName( itemloo.holdingbranch ) | html %] </td>
[% IF itemdata_ccode %]
<td> [% IF ( itemloo.ccode ) %][% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => itemloo.ccode ) | html %][% END %] </td>
[% END %]
<td> [% itemloo.itemcallnumber | html %] </td>
<td> [% IF ( itemloo.copynumber ) %][% itemloo.copynumber | html %][% ELSE %]&nbsp;[% END %] </td>
[% IF itemdata_enumchron %]
<td> [% itemloo.enumchron | html %] </td>
[% END %]
<td [% IF itemloo.onloan %]data-order="[% itemloo.date_due | html %]"[% END %]>
[% IF ( itemloo.onloan ) %]
<span class="checkedout">Due [% itemloo.date_due | $KohaDates as_due_date => 1 %]</span>
[% ELSE %]
[% IF ( itemloo.transfertwhen ) %]
<span
>In transit from [% Branches.GetName( itemloo.transfertfrom ) | html %], to [% Branches.GetName( itemloo.transfertto ) | html %], since
[% itemloo.transfertwhen | $KohaDates %]</span
>
[% END %]
[% END %]
[% IF ( itemloo.reservedate ) %]
[% IF ( itemloo.nocancel ) %]
<span>Can't be cancelled when item is in transit</span>
[% ELSE %]
[% IF ( itemloo.waitingdate ) %]
[% IF ( itemloo.canreservefromotherbranches ) %]
<span
>Waiting for [% INCLUDE 'patron-title.inc' patron=itemloo.ReservedFor %] at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since
[% itemloo.waitingdate | $KohaDates %]</span
>
[% ELSE %]
<span>Waiting at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since [% itemloo.waitingdate | $KohaDates %]</span>
[% END %]
[% ELSE %]
[% IF ( itemloo.canreservefromotherbranches ) %]
[% IF itemloo.reservedate %]
<span>On hold for [% INCLUDE 'patron-title.inc' patron=itemloo.ReservedFor %] expected at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since</span>
[% ELSE %]
<span>On hold expected at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %]</span>
[% END %]
[% ELSIF itemloo.reservedate %]
<span>On hold expected at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since [% itemloo.reservedate | $KohaDates %]</span>
[% ELSE %]
<span>On hold expected at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %]</span>
[% END %]
[% END %]
[% END # /IF itemloo.nocancel %]
[% ELSE %]
Not on hold
[% END # /IF itemloo.reservedate %]
[% IF itemloo.item_level_holds == "N" %]
<br />Item level hold not allowed from OPAC
[% ELSIF itemloo.item_level_holds == "F" %]
<br />Item level hold forced from OPAC
[% END %]
[% IF ( itemloo.itemlost ) %]
<span class="lost">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => itemloo.itemlost ) | html %]</span>
[% END %]
[% IF ( itemloo.damaged ) %]
<span class="dmg">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => itemloo.damaged ) | html %]</span>
[% END %]
[% IF ( itemloo.withdrawn ) %]
<span class="wdn">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => itemloo.withdrawn ) | html %]</span>
[% END %]
[% IF ( itemloo.notforloan ) %]
<span class="nfl">Not for loan ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => itemloo.notforloan ) | html %])</span>
[% ELSIF ( itemloo.notforloanitype ) %]
<span class="nfl">Not for loan (Itemtype not for loan)</span>
[% END %]
</td>
</tr>
[% END # / UNLESS itemloo.hide %]
[% END # /FOREACH itemloo %]
</tbody>
</table>
<!-- /#requestspecific -->
[% IF hiddencount %]
<p class="hiddencount">
<a href="request.pl?biblionumber=[% biblio_info.biblionumber | uri %]&amp;borrowernumber=[% borrowernumber | uri %]&amp;showallitems=1">Show all items ([% hiddencount | html %] hidden)</a>
</p>
[% END # /IF hiddencount %]
<fieldset class="action">
[% IF ( patron.borrowernumber ) %]
[% IF ( override_required ) %]
<button type="submit" id="hold_item_btn" class="btn btn-primary"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
[% ELSIF ( none_available ) %]
<button type="submit" id="hold_item_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
[% ELSE %]
<button type="submit" id="hold_item_btn" class="btn btn-primary">Place hold</button>
[% END %]
[% END %]
</fieldset>
</fieldset>
</fieldset>
<!-- /.rows any_specific -->
</form>
<!-- /#hold-request-form -->
[% ELSE # /UNLESS multi_hold %]
<form action="placerequest.pl" method="post" name="form" id="hold-request-form">
<fieldset class="rows">
<legend>Hold details</legend>
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-placerequest" />
<input type="hidden" name="multi_holds" id="multi_holds" value="1" />
<input type="hidden" name="request" value="any" />
<input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
[% FOREACH biblioloo IN biblioloop %]
<input type="hidden" name="biblionumber" id="biblionumber" value="[% biblioloo.biblionumber | html %]" />
[% UNLESS biblioloo.none_avail %]
<input type="hidden" name="title_[% biblioloo.biblionumber | html %]" value="[% biblioloo.title | html %]" />
<input type="hidden" name="rank_[% biblioloo.biblionumber | html %]" value="[% biblioloo.rank | html %]" />
[% END %]
[% END %]
<ol>
<li>
<span class="label">Patron:</span>
[% IF ( patron.borrowernumber ) %]
[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 hide_patron_infos_if_needed => 1 %]
[% ELSE %]
Not defined yet
[% END %]
</li>
<li>
<label for="holdnotes">Notes:</label>
<textarea id="holdnotes" name="notes" cols="30" rows="1"></textarea>
</li>
<li>
<label for="pickup">Pickup at:</label>
<select name="pickup" id="pickup_multi" data-patron-id="[% patron.borrowernumber | html %]">
<option value="" selected="selected"></option>
[% FOREACH pickup_location IN multi_pickup_locations %]
<option value="[% pickup_location.branchcode | html %]">[% pickup_location.branchname | html %]</option>
[% END %]
</select>
</li>
[% IF ( Koha.Preference('AllowHoldDateInFuture') ) %]
<li>
<label for="from">Hold starts on date:</label>
<input id="reserve_date" name="reserve_date" id="from" size="10" type="text" data-date_to="expiration_date" class="flatpickr" data-flatpickr-futureinclusive="true" />
</li>
[% END %]
<li>
<label for="to">Hold expires on date:</label>
<input id="expiration_date" name="expiration_date" id="to" size="10" type="text" class="flatpickr" data-flatpickr-futuredate="true" />
</li>
<li id="non_priority_list_item">
<label for="non_priority">Non priority hold:</label>
<input name="non_priority" id="non_priority" type="checkbox" />
<span class="hint">A non priority hold doesn't prevent a current checkout from renewing</span>
</li>
[% IF ( Koha.Preference('DisplayAddHoldGroups') ) %]
<li id="hold_group_list_item">
<label for="hold_group">Treat as hold group: </label>
<input name="hold_group" id="hold_group" type="checkbox" />
<span class="hint">Place a hold on the next available title from this group</span>
</li>
[% END %]
</ol>
<table id="requesttitles">
<tr>
<th>&nbsp;</th>
<th>Pickup location</th>
<th>Title</th>
[% UNLESS Koha.Preference('item-level_itypes') %]
<th>Item type</th>
[% END %]
<th>Priority</th>
<th>Information</th>
</tr>
[% FOREACH biblioloo IN biblioloop %]
<tr [% IF biblioloo.warn %]class="onissue"[% END %]>
<td>
[% UNLESS ( biblioloo.warn ) %]
<input
id="holdable_bibs"
name="holdable_bibs"
class="multi_hold_item_checkbox"
type="checkbox"
checked="checked"
title="[% biblioloo.biblionumber | html %]"
value="[% biblioloo.biblionumber | html %]"
/>
[% END %]
</td>
<td>
[% UNLESS ( biblioloo.none_avail || biblioloo.noitems ) %]
<select
name="pickup_[% biblioloo.biblionumber | html %]"
class="multi_pickup_select"
data-biblio-id="[% biblioloo.biblionumber | html %]"
data-patron-id="[% patron.borrowernumber | html %]"
data-pickup-locations="[% biblioloo.pickup_locations_codes.json | html %]"
>
<option value=""></option>
[% FOREACH pickup_location IN biblioloo.pickup_locations %]
<option value="[% pickup_location.branchcode | html %]">[% pickup_location.branchname | html %]</option>
[% END %]
</select>
[% END %]
</td>
<td>
<ul>
<li>
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">[% biblioloo.title | html %]</a>
[% IF biblioloo.author %]by [% biblioloo.author | html %][% END %]
</li>
[% IF ( biblioloo.publicationyear ) %]
<li> <span class="label">Publication year:</span> [% biblioloo.publicationyear | html %] </li>
[% END %]
[% IF ( patron && biblioloo.reserve_charge ) %]
<li>
<span class="label">Hold fee:</span>
[% IF Koha.Preference('HoldFeeMode') == 'any_time_is_collected' %]
[% biblioloo.reserve_charge | $Price %]
(charged when collected)
[% ELSE %]
[% biblioloo.reserve_charge | $Price %]
(charged when placed)
[% END %]
</li>
[% END %]
</ul>
[% IF ( biblioloo.warn ) %]
<span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
[% END %]
</td>
[% UNLESS Koha.Preference('item-level_itypes') %]
<td>
<img src="[% biblioloo.itemtype.image_location | html %]" alt="[% biblioloo.itemtype.translated_description | html %]" title="[% biblioloo.itemtype.translated_description | html %]" />
</td>
[% END %]
<td>[% biblioloo.rank | html %]</td>
<td>
[% IF ( biblioloo.checked_previously ) %]
<span>Patron has previously checked out this title</span><br />
[% END %]
[% IF ( biblioloo.alreadyres ) %]
<ul>
<li> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] <strong>already has a hold</strong> on this item </li>
</ul>
[% END %]
[% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
<ul
><li> <strong>No items are available</strong> to be placed on hold</li></ul
>
[% END %]
</td>
</tr>
[% END # /FOREACH biblioloo %]
</table>
<!-- /#requesttitles -->
</fieldset>
<fieldset class="action">
[% IF ( patron AND patron.borrowernumber ) %]
[% IF ( override_required ) %]
<button type="submit" id="hold_multi_btn" class="btn btn-primary "><i class="fa fa-exclamation-triangle "></i> Place holds</button>
[% ELSIF ( no_bibs_available ) %]
<button type="submit" id="hold_multi_btn" class="btn btn-primary btn-disabled" disabled="disabled">Place holds</button>
[% ELSIF ( none_available ) %]
<button type="submit" id="hold_multi_btn" class="btn btn-primary">Place holds</button>
[% ELSE %]
<button type="submit" id="hold_multi_btn" class="btn btn-primary" id="multi_hold_submit">Place holds</button>
[% END %]
[% END # /IF patron %]
</fieldset>
<!-- /.action -->
</form>
<!-- /#hold-request-form -->
[% END # /UNLESS multi_hold %]
[% END %]
[% UNLESS ( patron ) %]
[% UNLESS borrowers %]
[% SET hold_count = biblio.holds.count | html %]
[% IF hold_count %]
<label for="always_show_holds">Always show holds</label>
[% IF always_show_holds == 'DONT' %]
<input type="checkbox" name="always_show_holds" id="always_show_holds" value="DO" />
[% UNLESS total_holds %]
<a class="btn btn-default" value="Show holds" id="show_holds_now" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber | uri %]&show_holds_now=1">Show holds ([% hold_count | html %])</a>
[% END %]
[% ELSE %]
<input type="checkbox" name="always_show_holds" value="DO" id="always_show_holds" checked="checked" />
[% END %]
[% END %]
[% END %]
[% IF ( total_holds ) %]
<form id="existing_holds" name="T[% time | html %]" style="display:block">
[% INCLUDE 'csrf-token.inc' %]
[% IF ( multi_hold ) %]
[% FOREACH biblionumber IN biblionumbers %]
<input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
[% END %]
[% END %]
[% IF enqueued %]
<div class="alert alert-info">
<p>The job has been enqueued! It will be processed as soon as possible.</p>
<p><a href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id=[% job_id | uri %]" title="View detail of the enqueued job">View detail of the enqueued job</a></p>
</div>
[% END %]
<h2>Existing holds</h2>
<div id="toolbar" class="btn-toolbar sticky">
<div class="btn-group">
<button class="btn cancel_selected_holds" data-bulk="true"></button>
</div>
<div id="cancellation-reason-div" style="display:none">
[% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
[% IF hold_cancellation.count %]
<label for="cancellation-reason">Cancellation reason: </label>
<select class="cancellation-reason" name="cancellation-reason" id="cancellation-reason">
<option value="">No reason given</option>
[% FOREACH reason IN hold_cancellation %]
<option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
[% END %]
</select>
[% END %]
</div>
[% IF ( CAN_user_reserveforothers_alter_hold_targets ) %]
<div class="btn-group">
<a class="btn dropdown-toggle move_selected_holds" id="item_record_choice" role="button" data-bs-toggle="dropdown" href="#" aria-expanded="false" disabled="disabled"></a>
<ul class="dropdown-menu" role="menu" aria-labelledby="item_record_choice" style="">
<li><a class="dropdown-item move_hold_item" href="#">Item level holds to a different item</a></li>
<li><a class="dropdown-item move_hold_biblio" href="#">Record level holds to a different record</a></li>
</ul>
</div>
[% END %]
[% IF Koha.Preference('UseRecalls').match('staff') && CAN_user_recalls %]
<div class="btn-group">
<button class="btn convert_selected_holds" data-bulk="true"></button>
</div>
[% END %]
</div>
<div class="page-section">
[% FOREACH biblioloo IN biblioloop %]
[% IF ( biblioloo.total_holds ) %]
<div class="hold_title" id="hold_title_[% biblioloo.biblionumber | html %]">
[% IF ( multi_hold ) %]
<h3>
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]"> [% biblioloo.title | html %] </a>
<span class="badge bg-info-subtle"><span>[% biblioloo.total_holds | html %] [% tn('Hold', 'Holds', biblioloo.total_holds) | $raw %]</span></span>
</h3>
[% END %]
[% IF Koha.Preference('HoldsSplitQueue') == 'branch' %]
[% IF biblioloo.hold_branches.empty %]
<div class="holds_by_library">
<h4>Any library</h4>
[% INCLUDE holds_table.inc biblio_id=biblioloo.biblionumber total_holds=biblioloo.total_holds split_data="any" %]
</div>
[% ELSE %]
[% FOREACH b IN biblioloo.hold_branches %]
<div class="holds_by_library">
<h4>[% Branches.GetName( b ) | html %]</h4>
[% INCLUDE holds_table.inc biblio_id=biblioloo.biblionumber total_holds=biblioloo.total_holds split_data=b %]
</div>
[% END %]
[% END # /IF hold_branches.empty %]
[% ELSIF Koha.Preference('HoldsSplitQueue') == 'itemtype' %]
[% IF biblioloo.hold_itemtypes.empty %]
<div class="holds_by_itemtype">
<h4>Any item type</h4>
[% INCLUDE holds_table.inc biblio_id=biblioloo.biblionumber total_holds=biblioloo.total_holds split_data="any" %]
</div>
[% ELSE %]
[% FOREACH i IN biblioloo.hold_itemtypes %]
<div class="holds_by_itemtype">
[% IF i && i != 'any' %]
<h4>[% ItemTypes.GetDescription( i ) | html %]</h4>
[% ELSE %]
<h4>Any item type</h4>
[% END %]
[% INCLUDE holds_table.inc biblio_id=biblioloo.biblionumber total_holds=biblioloo.total_holds split_data=i %]
</div>
[% END %]
[% END # /IF hold_split.empty %]
[% ELSIF Koha.Preference('HoldsSplitQueue') == 'branch_itemtype' %]
[% FOREACH b IN biblioloo.hold_branches %]
<div class="holds_by_library">
<h4>[% Branches.GetName( b ) | html %]</h4>
[% FOREACH i IN biblioloo.hold_itemtypes %]
<div class="holds_by_itemtype">
[% IF i && i != 'any' %]
<h4>[% ItemTypes.GetDescription( i ) | html %]</h4>
[% ELSE %]
<h4>Any item type</h4>
[% END %]
[% SET split_data = b _ "_" _ i %]
[% INCLUDE holds_table.inc biblio_id=biblioloo.biblionumber total_holds=biblioloo.total_holds split_data=split_data %]
</div>
[% END %]
</div>
[% END %]
[% ELSE %]
[% INCLUDE holds_table.inc biblio_id=biblioloo.biblionumber total_holds=biblioloo.total_holds split_data="any" %]
[% END # /IF HoldsSplitQueue %]
</div>
<!-- /hold_title -->
[% ELSE %]
<div class="note"> There are no holds on this title. </div>
[% END # /IF ( biblioloo.total_holds ) %]
[% END # FOREACH biblioloo %]
</div>
</form>
<!-- /#existing_holds -->
[% END # IF total_holds %]
[% END # UNLESS patron %]
[% END %]
[% PROCESS 'cancel-hold-modal' form_action = 'request.pl' %]
[% PROCESS 'convert-to-recall-modal' form_action = 'modrequest.pl' %]
<div id="moveHoldItemModal" class="modal modal-lg" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title">Move hold(s) to a different item</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div id="move_hold_item_search" class="alert alert-danger" style="display:none;"></div>
<form id="itemSearchForm">
<div id="move_hold_item_searchform">
<h3>Enter the item barcode of new hold target: </h3>
<fieldset class="action d-flex">
<input type="text" class="form-control" name="external_id" id="external_id" required />
<button type="submit" class="btn btn-default">Search</button>
</fieldset>
</div>
</form>
<form id="move_hold_item_form" method="post" action="request.pl">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-move_hold_item" />
<input type="hidden" name="original_biblionumber" value="[% biblio.biblionumber | html %]" />
<input type="hidden" name="biblionumber" value="[% biblio.biblionumber | html %]" />
<div id="itemResultMessage" class="mt-3"> </div>
<div id="move_hold_item_selection">
<h3>Review holds to move</h3>
<table class="table table-striped">
<thead>
<tr>
<th></th>
<th>Hold ID</th>
<th>Original hold</th>
<th>Problem</th>
</tr>
</thead>
<tbody> </tbody>
</table>
</div>
<button id="move_hold_item_confirm" type="submit" class="btn btn-primary" disabled="disabled">Move selected holds</button>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-bs-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
<div id="moveHoldBiblioModal" class="modal modal-lg" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title">Move hold(s) to a different record</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div id="move_hold_bibio_search" class="alert alert-danger" style="display:none;"></div>
<form id="biblioSearchForm">
<div id="move_hold_biblio_searchform">
<h3>Enter the biblionumber of new hold target: </h3>
<fieldset class="action d-flex">
<input type="text" class="form-control" name="biblio_id" id="biblio_id" required />
<button type="submit" class="btn btn-default">Search</button>
</fieldset>
</div>
</form>
<form id="move_hold_biblio_form" method="post" action="request.pl">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-move_hold_biblio" />
<input type="hidden" name="original_biblionumber" value="[% biblio.biblionumber | html %]" />
<input type="hidden" name="biblionumber" value="[% biblio.biblionumber | html %]" />
<div id="biblioResultMessage" class="mt-3"> </div>
<div id="move_hold_biblio_selection">
<h3>Review holds to move</h3>
<table class="table table-striped">
<thead>
<tr>
<th></th>
<th>Hold ID</th>
<th>Original hold</th>
<th>Problem</th>
</tr>
</thead>
<tbody> </tbody>
</table>
</div>
<button id="move_hold_biblio_confirm" type="submit" class="btn btn-primary" disabled="disabled">Move selected holds</button>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-bs-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
<div id="hold-actions">
<form id="hold-actions-form"> [% INCLUDE 'csrf-token.inc' %] </form>
</div>
[% INCLUDE 'hold-group-modal.inc' %]
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'select2.inc' %]
[% SET url_biblio_params = (supplyill ? "supplyill=" _ supplyill _ "&amp;" : "") _ "biblionumber=" _ biblionumbers.join("&amp;biblionumber=") %]
[% IF multi_hold %]
[% SET url_biblio_params = url_biblio_params _ "&amp;multi_hold=1" %]
[% END %]
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
var biblionumbers = [[% biblionumbers.join(', ') | $raw %]];
var hold_branches = {[% FOREACH biblio_info IN biblioloop %] [% biblio_info.biblionumber | html %]: ["[% biblio_info.hold_branches.join('", "') | $raw %]"], [% END %]};
var hold_itemtypes = {[% FOREACH biblio_info IN biblioloop %] [% biblio_info.biblionumber | html %]: ["[% biblio_info.hold_itemtypes.join('", "') | $raw %]"], [% END %]};
var HoldsSplitQueue = "[% Koha.Preference('HoldsSplitQueue') | html %]";
var HoldsSplitQueueNumbering = "[% Koha.Preference('HoldsSplitQueueNumbering') | html %]";
var SuspendHoldsIntranet = [% ( Koha.Preference('SuspendHoldsIntranet') ) ? 1 : 0 | html %];
var AutoResumeSuspendedHolds = [% ( Koha.Preference('AutoResumeSuspendedHolds') ) ? 1 : 0 | html %];
var AllowHoldDateInFuture = [% ( Koha.Preference('AllowHoldDateInFuture') ) ? 1 : 0 | html %];
var HidePatronName = [% ( Koha.Preference('HidePatronName') ) ? 1 : 0 | html %];
var all_libraries = [% To.json(Branches.all) | $raw %].map(e => {
e['_id'] = e.branchcode;
e['_str'] = e.branchname;
return e;
});
var CAN_user_reserveforothers_modify_holds_priority = [%CAN_user_reserveforothers_modify_holds_priority ? 1 : 0 | html %];
var borrowernumber = "[% patron.borrowernumber | $raw %]";
var patron_homebranch = "[% To.json( Branches.GetName( patron.branchcode ) ) | $raw %]";
var override_items = {[% FOREACH biblio_info IN biblioloop %][% FOREACH itemloo IN biblio_info.itemloop %][% IF ( itemloo.override ) %]
[% itemloo.itemnumber | html %]: {
homebranch: "[% To.json( Branches.GetName( itemloo.homebranch ) ) | $raw %]",
holdallowed: "[% itemloo.holdallowed | html %]"
},
[% END %][% END %][% END %]
};
var UseRecalls = [% ( Koha.Preference('UseRecalls').match('staff') ) ? 1 : 0 | html %];
const active_tab = [% clubs ? 1 : 0 | html %];
Koha.addPrefs({
UseBranchTransferLimits: [% Koha.Preference('UseBranchTransferLimits') ? 1 : 0 | html %],
EnableItemGroupHolds: [% Koha.Preference('EnableItemGroupHolds') ? 1 : 0 | html %],
});
const multi_hold = [% multi_hold ? 1 : 0 | html %];
const apply_patron_autocomplete = [% !( patron || patron.borrowernumber || borrowers || noitems || nobiblio ) && PatronAutoComplete ? 1 : 0 | html %];
const url_biblio_params = '[% url_biblio_params | url %]';
hold_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds', 'patron_holds_table', 'json' ) | $raw %];
table_settings = [% TablesSettings.GetTableSettings( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %];
</script>
[% Asset.js("js/holds.js") | $raw %]
[% Asset.js("js/hold-group.js") | $raw %]
[% Asset.js("js/basket.js") | $raw %]
<script nonce="[% Koha.CSPNonce | $raw %]">
$(document).ready( function() {
[% IF successful_biblionumbers && Koha.Preference('AutoDeleteFromCartWhenHoldPlaced').grep('staff').size %]
[% FOREACH success IN successful_biblionumbers.split('\|') %]
delSingleRecord('[% success | html %]');
[% END %]
[% END %]
});
</script>
<script nonce="[% Koha.CSPNonce | $raw %]">
$(document).ready(function () {
$("#patron_holds_table").kohaTable(
{
paging: false,
bKohaColumnsUseNames: true,
},
hold_table_settings
);
});
var ERROR_MAP = {
damaged: _("Item damaged"),
ageRestricted: _("Age restricted"),
tooManyHoldsForThisRecord: _("Exceeded max holds per record"),
tooManyReservesToday: _("Daily hold limit reached for patron"),
tooManyReserves: _("Too many holds"),
notReservable: _("Not holdable"),
noReservesAllowed: _("No holds allowed"),
cannotReserveFromOtherBranches: _("Patron is from different library"),
itemAlreadyOnHold: _("Patron already has hold for this item"),
cannotBeTransferred: _("Cannot be transferred to pickup library"),
pickupNotInHoldGroup: _("Only pickup locations within the same hold group are allowed"),
};
$.fn.select2.defaults.set("width", "100%");
$.fn.select2.defaults.set("dropdownAutoWidth", true);
$(document).ready(function () {
biblionumbers.forEach(function (biblionumber) {
let branches = hold_branches[biblionumber];
let itemtypes = hold_itemtypes[biblionumber];
switch (HoldsSplitQueue) {
case "branch":
branches.forEach(function (branch) {
load_patron_holds_table(biblionumber, { name: HoldsSplitQueue, value: branch });
});
break;
case "itemtype":
itemtypes.forEach(function (itemtype) {
load_patron_holds_table(biblionumber, { name: HoldsSplitQueue, value: itemtype });
});
break;
case "branch_itemtype":
branches.forEach(function (branch) {
itemtypes.forEach(function (itemtype) {
load_patron_holds_table(biblionumber, { name: HoldsSplitQueue, value: branch + "_" + itemtype });
});
});
break;
default:
load_patron_holds_table(biblionumber, { name: "any", value: "any" });
}
});
$("#cancellation-reason-div").hide();
$(".rank-request").on("change", function () {
if ($(".rank-request option:selected[value='del']").length) {
$("#cancellation-reason-div").show();
} else {
$("#cancellation-reason-div").hide();
}
});
if ($("#circ_holds_select").length > 0) {
/* Set active tab based on whether a club search was submitted */
var tabs = $("#circ_holds_select li:eq(" + active_tab + ") a").tab("show");
$(tabs[0].hash).find("input.focus").focus();
/* Change active focus when tabs change */
$("#circ_holds_select a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) {
active_tab = e.target.hash;
$(active_tab).find("input.focus").focus();
});
}
ToggleHoldsToPlace();
$("#requestany,.requestspecific[name='request'],.requestgrp").on("change", function () {
ToggleHoldsToPlace();
});
if (Koha.prefs.UseBranchTransferLimits) {
$("#pickup,#pickup-next-avail,#pickup-item-group").on("change", function () {
var pickup = $(this).val();
var url = "?pickup=" + pickup;
url += "&borrowernumber=" + borrowernumber;
url += "&biblionumber=" + biblionumbers[0];
window.location.replace(url);
});
}
var my_table = $("#requestspecific").kohaTable({
paging: false,
dom: '<"top pager"ilf>t',
});
$("#club-request-form").on("submit", function () {
let $t = $(this);
$(".clubalert, .holdalert").addClass("hide");
const data = {
pickup_library_id: $('select[name="pickup"]').val(),
};
if ($('input[name="checkitem"]:checked').length) data.item_id = $('input[name="checkitem"]:checked').val();
if ($('input[name="item_group_id"]:checked').length) data.item_group_id = $('input[name="item_group_id"]:checked').val();
if ($('input[name="borrowernumber"]').length) data.patron_id = $('input[name="borrowernumber"]').val();
if ($('textarea[name="notes"]').length) data.notes = $('textarea[name="notes"]').val() || null;
if ($('input[name="itemtype"]').length) {
data.item_type = $('input[name="itemtype"]').val() || null;
}
if ($('input[name="default_patron_home"]:checked').length) {
data.default_patron_home = 1;
}
const count = $('input[name="holds_to_place_count"]').length ? $('input[name="holds_to_place_count"]').val() : 1;
var newloc = "request.pl?";
biblionumbers.forEach(function (biblionumber) {
newloc += "&biblionumber=" + biblionumber;
});
biblionumbers.forEach(function (biblionumber) {
data.biblio_id = biblionumber;
let options = {
url: $t.attr("action"),
method: $t.attr("method").toUpperCase(),
contentType: "application/json",
data: JSON.stringify(data),
};
for (let i = 0; i < count; i++) {
$.ajax(options)
.then(function (result) {
document.location = newloc;
})
.fail(function (err) {
var message = err.responseJSON.error;
var match = err.responseJSON.error.match(/Reason: (\w+)\s*$/);
if (match && ERROR_MAP[match[1]]) {
message = "<div><strong>" + _("Cannot place hold") + "</strong></div><div>" + ERROR_MAP[match[1]] + "</div>";
}
$(".clubalert, .holdalert").removeClass("hide").html(message);
});
}
});
return false;
});
if (!multi_hold) {
$("#hold-request-form").on("submit", function (e) {
return check(e, $(this));
});
} else {
$("#hold-request-form").on("submit", function () {
return checkMultiHold();
});
}
$(".pickup_location_dropdown").each(function () {
$(this).pickup_locations_dropdown();
});
$("#pickup_multi").select2({
width: "30%",
allowClear: true,
});
$(".multi_pickup_select").select2({
width: "100%",
allowClear: true,
});
$("#pickup_multi").on("change", function () {
var selection = $(this).val();
if (selection != "") {
$(".multi_pickup_select").each(function () {
var valid_pickup_locations = $(this).data("pickup-locations");
if (valid_pickup_locations.includes(selection)) {
$(this).val(selection);
$(this).trigger("change");
}
});
}
});
$("#pickup,#pickup-item-group,#pickup-next-avail").each(function () {
$(this).pickup_locations_dropdown();
});
$(".pickup_locations").each(function () {
$(this).pickup_locations_dropdown();
});
});
function ToggleHoldsToPlace() {
if ($("#requestany").prop("checked")) {
$(".disable_request_any").prop("disabled", true).addClass("disabled").removeClass("enabled");
$(".enable_request_any").prop("disabled", false).removeClass("disabled").addClass("enabled");
$(".requestspecific,.requestgrp").prop("checked", false);
} else if ($(".requestspecific").prop("checked")) {
$(".disable_request_specific").prop("disabled", true).addClass("disabled").removeClass("enabled");
$(".enable_request_specific").prop("disabled", false).removeClass("disabled").addClass("enabled");
$("#requestany,.requestgrp").prop("checked", false);
} else {
$(".disable_request_group").prop("disabled", true).addClass("disabled").removeClass("enabled");
$(".enable_request_group").prop("disabled", false).removeClass("disabled").addClass("enabled");
$("#requestany,.requestspecific").prop("checked", false);
}
}
$(".any_specific").click(function () {
const fieldset = $(this).find("fieldset:first");
if (fieldset.hasClass("disabled")) {
$(".enable_request_specific, .enable_request_any, .enable_request_group").removeClass("enabled");
const specific_cb = $(this).find("#requestspecificitem");
const any_cb = $(this).find("#requestany");
const itemgroup_cb = $(this).find("#requestgrp");
if (specific_cb.length) {
specific_cb.prop("checked", true);
} else if (any_cb.length) {
any_cb.prop("checked", true);
} else {
itemgroup_cb.prop("checked", true);
}
fieldset.removeClass("disabled").addClass("enabled");
ToggleHoldsToPlace();
}
});
function check(e, table) {
var msg = "";
if ($(".requestspecific").is(":checked")) {
// requestany not selected, go through the item-specific cases
var selected_items = $('#requestspecific input[name="checkitem"]:checked');
if (selected_items.length > 0) {
// got item-specific hold requests in the form!
// verify they have a pickup location selected
if (selected_items.closest("tr").find(".pickup_locations").val() == "") {
msg = _("- Please select a pickup location for the item") + "\n";
}
} else {
msg = _("- Please select an item to place a hold") + "\n";
}
} else if ($("#requestgrp").is(":checked")) {
var selected_group = $('#requestgroup input[type="radio"]:checked');
if (selected_group.length > 0) {
if ($("#pickup-item-group").length < 1 || $("#pickup-item-grp").val() == "") {
msg = _("- Please select a pickup location for this hold" + "\n");
}
} else {
msg = _("- Please select an item group to place a hold") + "\n";
}
} else {
// Requesting next available
if ($("#pickup-next-avail").length < 1 || $("#pickup-next-avail").val() == "" || $("#pickup-next-avail").val() === null) {
msg = _("- Please select a pickup location for this hold") + "\n";
}
}
if (msg == "") {
$("#hold-request-form").preventDoubleFormSubmit();
return true;
} else {
e.preventDefault();
alert(msg);
return false;
}
}
function checkMultiHold() {
var selected_bibs = $(".multi_hold_item_checkbox:checked");
if (selected_bibs.length > 0) {
// there are biblios selected in the form!
// verify they have a pickup location selected
var pickup_not_set = 0;
selected_bibs.each(function () {
if ($(this).closest("tr").find(".multi_pickup_select").val() === "") {
pickup_not_set++;
} else {
var bibnum = $(this).attr("title");
}
});
if (pickup_not_set > 0) {
alert(_("Please make sure all selected titles have a pickup location set") + "\n");
return false;
}
} else {
alert(_("Please select at least one title") + "\n");
return false;
}
$("#hold-request-form").preventDoubleFormSubmit();
return true;
}
$(document).ready(function () {
$("#always_show_holds").change(function () {
if ($(this).prop("checked")) {
document.cookie = "always_show_holds=DO";
} else {
document.cookie = "always_show_holds=DONT";
}
});
$("input.needsoverride").click(function () {
// This must be before the radio button/checkbox switch logic
var itemnumber = this.value;
var msg = "";
switch (override_items[itemnumber].holdallowed) {
case "not_allowed":
msg = _("This item normally cannot be put on hold.");
break;
case "from_home_library":
msg = _("This item normally cannot be put on hold except for patrons from %s.").format(override_items[itemnumber].homebranch);
break;
}
msg += "\n\n" + _("Place hold on this item?");
return confirm(msg);
});
$("button.warning").click(function () {
return confirm(_("None of these items can normally be put on hold for this patron.") + "\n\n" + _("Place hold?"));
});
var prev_rank_request;
$("select[name=rank-request]")
.on("focus", function () {
prev_rank_request = parseInt($(this).val());
})
.change(function () {
var this_rank = $(this);
var new_rank = parseInt(this_rank.val());
var old_rank = prev_rank_request;
if (isNaN(old_rank)) {
$("select[name=rank-request]")
.not("[disabled]")
.not(this_rank)
.each(function () {
var current_rank = parseInt($(this).val());
if (!isNaN(current_rank) && current_rank >= new_rank) {
$(this).val(current_rank + 1);
}
});
prev_rank_request = new_rank;
return;
}
if (isNaN(new_rank)) {
if (!isNaN(old_rank)) {
$("select[name=rank-request]")
.not("[disabled]")
.not(this)
.each(function () {
var current_rank = parseInt($(this).val());
if (!isNaN(current_rank) && current_rank > old_rank) {
$(this).val(current_rank - 1);
}
});
}
prev_rank_request = NaN;
return;
}
//if new rank is old rank, don't continue
if (new_rank === old_rank) return;
// Adjust ranks
$("select[name=rank-request]")
.not("[disabled]")
.not(this)
.each(function () {
var current_rank = parseInt($(this).val());
//if current_rank is NaN, bail
if (isNaN(current_rank)) return;
if (old_rank > new_rank) {
if (current_rank >= new_rank && current_rank < old_rank) {
$(this).val(current_rank + 1);
}
} else {
if (current_rank > old_rank && current_rank <= new_rank) {
$(this).val(current_rank - 1);
}
}
});
prev_rank_request = new_rank;
});
$(".clear-date").on("click", function (e) {
e.preventDefault();
var fieldID = this.id.replace("clear-date-", "");
$("#" + fieldID).val("");
});
if (apply_patron_autocomplete) {
patron_autocomplete($(".search_patron_filter"), { "link-to": "reserve", "url-params": url_biblio_params });
}
if (Koha.prefs.EnableItemGroupHolds) {
$(':radio[name="item_group_id"]').change(function () {
$('input[name="checkitem"]').prop("checked", false);
});
$('input[name="checkitem"]').change(function () {
$(':radio[name="item_group_id"]').prop("checked", false);
});
}
if (!localStorage.selectedHolds || document.referrer.replace(/\?.*/, "") !== document.location.origin + document.location.pathname) {
localStorage.selectedHolds = [];
}
});
</script>
[% UNLESS patron %]
[% SET search_results_block_id = 'holds_patronsearch_pane_panel' %]
[%# adjusting variable for patron-search.inc %]
[% PROCESS patron_search_js table_id => 'table_borrowers', categories => categories, libraries => libraries, columns => columns, open_on_row_click => 1, on_click_url => '/cgi-bin/koha/reserve/request.pl?' _ url_biblio_params, redirect_if_one_result => 1, redirect_url => '/cgi-bin/koha/reserve/request.pl?' _ url_biblio_params, redirect_if_attribute_equal => 'cardnumber' %]
<script nonce="[% Koha.CSPNonce | $raw %]">
$(document).ready(function () {
$("#holds_patronsearch").on("submit", filter);
});
</script>
[% END %]
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]