Koha/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
Tomas Cohen Arazi 1d9d05613b Bug 27069: Adapt uses of holdallowed
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-07 16:08:04 +02:00

1434 lines
84 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[% USE raw %]
[% USE To %]
[% USE Asset %]
[% USE Koha %]
[% USE KohaDates %]
[% USE Branches %]
[% USE Categories %]
[% USE ItemTypes %]
[% USE AuthorisedValues %]
[% USE Price %]
[% USE TablesSettings %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
[% UNLESS ( multi_hold ) %]
<title>Koha &rsaquo; Circulation &rsaquo; Holds &rsaquo; Place a hold on [% INCLUDE 'biblio-title-head.inc' %]</title>
[% ELSE %]
<title>Koha &rsaquo; Circulation &rsaquo; Holds &rsaquo; Confirm holds</title>
[% END %]
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="circ_request" class="catalog">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'circ-search.inc' %]
[% UNLESS ( multi_hold ) %]
<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 hold
</a>
</li>
</ol>
</nav>
[% ELSE %]
<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>
<a href="#" aria-current="page">
Confirm holds
</a>
</li>
</ol>
</nav>
[% END # UNLESS multi_hold %]
<div class="main container-fluid">
<div class="row">
[% IF ( multi_hold ) # No sidebar menu when placing multiple holds %]
<div class="col-md-10 col-md-offset-1">
[% ELSE %]
<div class="col-sm-10 col-sm-push-2">
[% END %]
<main>
[% IF ( noitems ) %]
<div class="dialog alert">
[%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 ( messagetransfert ) %]
<div class="dialog message">
<h2>Hold found for ([% nextreservtitle | html %]), please transfer</h2>
<p>Hold placed by : <strong> [% nextreservsurname | html %] [% nextreservfirstname | html %]</strong> at : <strong> [% branchname | html %] </strong>, Please transfer this item.
</p>
<form name="cancelReservewithtransfert" action="branchreserves.pl" method="post">
<input type="submit" class="button" />
</form>
</div>
[% END %]
[% UNLESS ( multi_hold ) %]
<h1>Place a hold on [% INCLUDE 'biblio-title.inc' link = 1 %]</h1>
[% ELSE %]
<h1>Confirm holds</h1>
[% END %]
[% UNLESS club OR patron OR patron.borrowernumber OR noitems %]
[% IF ( messageborrower ) %]
<div class="dialog alert">
<h3>Patron not found</h3>
<p>No patron with this name, please, try another</p>
</div>
[% END %]
[% IF ( messageclub ) %]
<div class="dialog alert">
<h3>Club not found</h3>
<p>No club with this name, please, try another</p>
</div>
[% END %]
<fieldset class="brief">
<label>Search patrons or clubs</label>
<div id="circ_holds_select" class="toptabs">
<ul>
<li><a href="#holds_patronsearch_pane">Patrons</a></li>
<li><a href="#holds_clubsearch_pane">Clubs</a></li>
</ul>
<div id="holds_patronsearch_pane">
<form id="holds_patronsearch" action="request.pl?biblionumbers=[% biblionumbers | html %]" method="post">
<div class="hint">Enter patron card number or partial name:</div>
<input type="text" size="40" id="patron" class="focus" name="findborrower" autocomplete="off" />
<input type="submit" value="Search" />
[% IF multi_hold %]
<input type="hidden" name="biblionumbers" value="[% biblionumbers | html %]"/>
[% ELSE %]
<input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
[% END %]
</form> <!-- /#holds_patronsearch -->
[% IF borrowers %]
[% INCLUDE 'circ-patron-search-results.inc' destination = "holds" %]
[% END %]
</div>
<div id="holds_clubsearch_pane">
<form id="holds_clubsearch" action="request.pl?biblionumber=[% biblionumber | html %]" method="post">
<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="submit" value="Search" />
[% IF multi_hold %]
<input type="hidden" name="biblionumbers" value="[% biblionumbers | html %]"/>
[% ELSE %]
<input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
[% END %]
</form> <!-- /#holds_patronsearch -->
[% IF clubs %]
[% INCLUDE 'clubs-table.inc' destination = "holds" %]
[% END %]
</div>
</div>
</fieldset>
[% ELSIF club %]
<div class="dialog alert hide 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">
[% IF ( multi_hold ) %]
<input type="hidden" name="biblionumbers" id="multi_hold_bibs" value="[% biblionumbers | html %]"/>
<input type="hidden" name="bad_bibs" id="bad_bibs" value=""/>
<input type="hidden" name="request" value="any"/>
[% FOREACH biblioloo IN biblioloop %]
<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 %]
[% ELSE %]
<input type="hidden" name="biblionumber" value="[% 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">
[% 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><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] ([% patron.cardnumber | html %])</a></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 ( member.expiry ) %]
<div>
<i class="fa fa-warning"></i>
<strong>Account has expired</strong>
</div>
[% END %]
[% IF patron.is_debarred %]
<div>
<i class="fa fa-warning"></i>
<strong>Patron has restrictions</strong>
</div>
[% END %]
[% IF amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') %]
<div>
<i class="fa fa-warning"></i>
<strong>Patron has outstanding fines: [% member.amount_outstanding | $Price %]</strong>
</div>
[% END %]
[% IF ( member.diffbranch ) %]
<div>
<i class="fa fa-warning"></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" value="Place hold" />
</fieldset>
[% ELSE %]
<table id="requesttitles">
<tr>
<th>&nbsp;</th>
<th>Title</th>
[% UNLESS ( item_level_itypes ) %]
<th>Item type</th>
[% END %]
<th>Priority</th>
<th>Information</th>
</tr>
[% FOREACH biblioloo IN biblioloop %]
[% IF ( biblioloo.warn ) %]
<tr class="onissue">
[% ELSE %]
<tr>
[% END %]
<td>
[% UNLESS ( biblioloo.warn ) %]
<input class="multi_hold_item_checkbox" type="checkbox" checked="checked" title="[% biblioloo.biblionumber | html %]"/>
</td>
[% END %]
<td>
<ul>
<li>
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">[% biblioloo.title | html %]</a>
</li>
[% IF ( biblioloo.publicationyear ) %]
<li>
<span class="label">Publication year:</span> [% biblioloo.publicationyear | html %]
</li>
[% END %]
</ul>
[% IF ( biblioloo.warn ) %]
<span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
[% END %]
</td>
[% UNLESS ( item_level_itypes ) %]
<td>
<img src="[% biblioloo.imageurl | html %]" alt="[% biblioloo.itypename | html %]" title="[% biblioloo.itypename | 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>
[% ELSE %]
[% IF ( biblioloo.none_avail ) %]
<ul>
[% END %]
[% END %]
[% IF ( biblioloo.alreadyres ) %]
<li>
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %]</a>
<strong>already has a hold</strong> on this item
</li>
[% END %]
[% IF ( biblioloo.none_avail ) %]
<li> <strong>No items are available</strong> to be placed on hold</li>
[% END %]
[% IF ( biblioloo.alreadyres ) %]
</ul>
[% ELSE %]
[% IF ( biblioloo.none_avail ) %]
</ul>
[% END %]
[% END %]
</td>
</tr>
[% END # /FOREACH biblioloo %]
</table> <!-- /#requesttitles -->
[% END %]
</form>
</fieldset>
[% ELSIF NOT noitems # /UNLESS patron %]
[% IF ( checked_previously && !multi_hold ) %]
<div class="dialog alert">
<ul>
<li>Patron has previously checked out this title</li>
</ul>
</div>
[% END %]
[% IF ( exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || alreadypossession || ageRestricted ) %]
<div class="dialog alert">
[% UNLESS ( multi_hold ) %]
<h3>Cannot place hold</h3>
<ul>
[% IF ( exceeded_maxreserves ) %]
<li><strong>Too many holds: </strong> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] </a> 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> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] </a> can only place a maximum of [% max_holds_for_record | html %] hold(s) on this record.</li>
[% ELSIF ( alreadypossession ) %]
<li> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %]</a> <strong>is already in possession</strong> of one item.</li>
[% ELSIF ( alreadyreserved ) %]
<li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %]</a> <strong>already has a hold</strong> on this item.</li>
[% ELSIF ( ageRestricted ) %]
<li><strong>Age restricted</strong></li>
[% ELSIF ( none_available ) %]
<li> <strong>No items are available</strong> to be placed on hold.</li>
[% ELSIF ( maxreserves ) %]
<li><strong>Too many holds: </strong> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] </a> has too many holds.</li>
[% END # /IF exceeded_maxreserves %]
</ul>
[% ELSE # UNLESS multi_hold %]
<h3>Cannot place hold on some items</h3>
[% IF ( exceeded_maxreserves ) %]
<li><strong>Too many holds: </strong> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] </a> 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> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | html %]">[% patron.firstname | html %] [% patron.surname | html %] </a> can only place a maximum of [% max_holds_for_record | html %] hold(s) on this record.</li>
[% END %]
[% END %]
[% END # /IF exceeded_maxreserves %]
[% END # /UNLESS multi_hold %]
</div>
[% END # /IF ( exceeded_maxreserves || ... %]
[% IF ( expiry || diffbranch || patron.is_debarred || ( amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') ) ) %]
<div class="dialog message">
<ul>
[% IF ( expiry ) %]
<li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %]</a>: <strong>Account has expired</strong></li>
[% END %]
[% IF patron.is_debarred %]
<li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]#reldebarments">[% patron.firstname | html %] [% patron.surname | html %]</a>: <strong>Patron has restrictions</strong></li>
[% END %]
[% IF amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') %]
<li><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %]</a>: <strong>Patron has outstanding fines: [% amount_outstanding | $Price %]</strong></li>
[% END %]
[% IF ( diffbranch ) %]
<li> <strong>Pickup library is different. </strong>Patron: <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %]</a> Patron's home library: ([% Branches.GetName(patron.branchcode) | html %] / [% patron.branchcode | html %] )</li>
[% END %]
</ul> <!-- /.dialog.message -->
</div>
[% END # /IF expiry || diffbranch ... %]
[% IF ( messageborrower ) %]
<div class="dialog alert">
<h3>Patron not found:</h3>
<p>Name or barcode not found. Please try an other </p>
</div>
[% END %]
<div class="dialog alert hide holdalert">
</div>
<fieldset class="rows">
<legend>Hold details</legend>
<form action="placerequest.pl" method="post" name="form" id="hold-request-form">
<input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
<input type="hidden" name="type" value="str8" />
[% IF ( multi_hold ) %]
<input type="hidden" name="biblionumbers" id="multi_hold_bibs" value="[% biblionumbers | html %]"/>
<input type="hidden" name="bad_bibs" id="bad_bibs" value=""/>
<input type="hidden" name="request" value="any"/>
[% FOREACH biblioloo IN biblioloop %]
<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 %]
[% ELSE %]
<input type="hidden" name="biblionumber" value="[% 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">Patron:</span>
[% IF ( patron.borrowernumber ) %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] ([% patron.cardnumber | html %])</a>
[% ELSE %]
Not defined yet
[% END %]
</li>
[% UNLESS ( multi_hold ) %]
<li>
<span class="label">Estimated priority:</span>
<strong>[% fixedRank | html %]</strong>
</li>
[% END %]
<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">
[% UNLESS ( multi_hold ) %]
[% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => biblionumber, patron => patron }, selected => pickup }) %]
[% ELSE %]
[% PROCESS options_for_libraries libraries => Branches.all({ selected => pickup, search_params => { pickup_location => 1 } }) %]
[% END %]
</select>
</li>
[% UNLESS ( multi_hold ) %]
[% 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 %]
[% END # /UNLESS multi_hold %]
[% IF ( reserve_in_future ) %]
<li>
<label for="from">Hold starts on date:</label>
<input name="reserve_date" id="from" size="10" class="datepickerfrom" type="text" >
<input type="hidden" class="datepickerfrom_hidden" />
<a href="#" id="clear-date-from" class="clear-date">Clear date</a>
</li>
[% END %]
<li>
<label for="to">Hold expires on date:</label>
<input name="expiration_date" id="to" size="10" class="datepickerto" type="text" />
<input type="hidden" class="datepickerto_hidden" />
<a href="#" id="clear-date-to" class="clear-date">Clear date</a>
</li>
[% UNLESS ( multi_hold ) %]
<li>
<label for="requestany">Hold next available item </label>
[% IF force_hold_level == 'item' %]
<input type="checkbox" id="requestany" name="request" disabled="true" />
[% ELSIF force_hold_level == 'record' %]
<input type="checkbox" id="requestany" checked="checked" value="Any" disabled="true"/>
<input type="hidden" name="request" value="Any"/>
[% ELSE %]
<input type="checkbox" id="requestany" name="request" checked="checked" value="Any" />
[% END %]
<input type="hidden" name="biblioitem" value="[% biblioitemnumber | html %]" />
<input type="hidden" name="alreadyreserved" value="[% alreadyreserved | html %]" />
</li>
[% IF 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" maxlength="[% remaining_holds_for_record | html %]" value="1" />
</li>
[% ELSE %]
<input type="hidden" name="holds_to_place_count" value="1" />
[% END %]
[% END # /UNLESS multi_hold %]
<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>
[% UNLESS ( multi_hold ) %]
<fieldset class="action">
[% IF ( patron.borrowernumber ) %]
[% IF ( override_required ) %]
<button type="submit" class="btn btn-default warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
[% ELSIF ( none_available ) %]
<button type="submit" disabled="disabled" class="btn btn-default btn-disabled">Place hold</button>
[% ELSE %]
<button type="submit" class="btn btn-default">Place hold</button>
[% END %]
[% END %]
</fieldset>
[% FOREACH bibitemloo IN bibitemloop %]
<ol>
[% UNLESS ( item_level_itypes ) %]
<li>
<span class="label">Item type:</span>
[% bibitemloo.description | html %]
</li>
[% END %]
[% IF ( bibitemloo.publicationyear ) %]
<li>
<span class="label">Publication year:</span>
[% bibitemloo.publicationyear | html %]
</li>
[% END %]
</ol>
<h2 style="padding: 0 1em;">
Place a hold on a specific item
[% IF bibitemloo.force_hold_level == 'item' %]
<span class="error"><em>(Required)</em></span>
[% END %]
</h2>
<table id="requestspecific">
<thead>
<tr>
<th>Hold</th>
[% IF ( item_level_itypes ) %]
<th>Item type</th>
[% END %]
<th>Barcode</th>
<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>
<th>Allowed pickup locations</th>
</tr>
</thead>
<tbody>
[% SET selected = 0 %]
[% FOREACH itemloo IN bibitemloo.itemloop %]
[% UNLESS ( itemloo.hide ) %]
<tr class="[% itemloo.backgroundcolor | html %]">
<td>
[% IF itemloo.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 ( itemloo.available ) %]
<input type="radio" name="checkitem" value="[% itemloo.itemnumber | html %]" />
[% ELSIF ( itemloo.override ) %]
<input type="radio" name="checkitem" class="needsoverride" 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' %]
Item damaged
[% ELSIF itemloo.not_holdable == 'ageRestricted' %]
Age restricted
[% ELSIF itemloo.not_holdable == 'tooManyHoldsForThisRecord' %]
Exceeded max holds per record
[% ELSIF itemloo.not_holdable == 'tooManyReservesToday' %]
Daily hold limit reached for patron
[% ELSIF itemloo.not_holdable == 'tooManyReserves' %]
Too many holds
[% ELSIF itemloo.not_holdable == 'notReservable' %]
Not holdable
[% ELSIF itemloo.not_holdable == 'cannotReserveFromOtherBranches' %]
Patron is from different library
[% ELSIF itemloo.not_holdable == 'branchNotInHoldGroup' %]
Cannot place hold from patron's library
[% ELSIF itemloo.not_holdable == 'itemAlreadyOnHold' %]
Patron already has hold for this item
[% ELSIF itemloo.not_holdable == 'cannotBeTransferred' %]
Cannot be transferred to pickup library
[% ELSIF itemloo.not_holdable == 'pickupNotInHoldGroup' %]
Only pickup locations within the same hold group are allowed
[% ELSE %]
[% itemloo.not_holdable | html %]
[% END %]
[% END %]
</span>
[% END # /IF itemloo.force_hold_level %]
</td>
[% IF ( item_level_itypes ) %]
<td>
[% UNLESS ( noItemTypeImages ) %]
[% IF ( itemloo.imageurl ) %]<img src="[% itemloo.imageurl | html %]" alt="" /> <br /> [% END %]
[% END %]
[% itemloo.itypename | html %]
</td>
[% END %]
<td>
[% itemloo.barcode | html %]
</td>
<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 %]
[% IF ( itemloo.onloan ) %]
<td data-order="[% itemloo.date_due | html %]">
<span class="checkedout">Due [% itemloo.date_due | $KohaDates as_due_date => 1 %]</span>
[% ELSE %]
<td>
[% IF ( itemloo.transfertwhen ) %]
In transit from [% Branches.GetName( itemloo.transfertfrom ) | html %],
to [% Branches.GetName( itemloo.transfertto ) | html %], since [% itemloo.transfertwhen | html %]
[% END %]
[% END %]
[% IF ( itemloo.reservedate ) %]
[% IF ( itemloo.nocancel ) %]
Can't be cancelled when item is in transit
[% ELSE %]
[% IF ( itemloo.waitingdate ) %]Waiting[% ELSE %]On hold[% END %]
[% IF ( itemloo.canreservefromotherbranches ) %]
for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% itemloo.ReservedFor.borrowernumber | uri %]">[% itemloo.ReservedFor.firstname | html %] [% itemloo.ReservedFor.surname | html %]</a>
[% END %]
[% IF ( itemloo.waitingdate ) %]at[% ELSE %]expected at[% END %]
[% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since
[% IF ( itemloo.waitingdate ) %]
[% itemloo.waitingdate | $KohaDates %]
[% ELSE %]
[% IF ( itemloo.reservedate ) %]
[% itemloo.reservedate | html %]
[% END %]
[% END %].
<a class="info cancel-hold" href="modrequest.pl?CancelBiblioNumber=[% itemloo.biblionumber | html %]&amp;CancelBorrowerNumber=[% itemloo.ReservedFor.borrowernumber | html %]&amp;CancelItemnumber=[% itemloo.itemnumber | html %]">Cancel hold</a>
[% 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>
[% END %]
</td>
<td>
[% IF itemloo.any_pickup_location %]
Any library
[% ELSE %]
[% itemloo.pickup_locations | html %]
[% END %]
</td>
</tr>
[% END # / UNLESS itemloo.hide %]
[% END # /FOREACH itemloo %]
</tbody>
</table> <!-- /#requestspecific -->
[% IF ( bibitemloo.hiddencount ) %]
<form>
<p class="hiddencount">
<a href="request.pl?biblionumber=[% bibitemloo.biblionumber | uri %]&amp;borrowernumber=[% bibitemloo.borrowernumber | uri %]&amp;showallitems=1">Show all items ([% bibitemloo.hiddencount | html %] hidden)</a>
</p>
</form>
[% END # /IF bibitemloo.hiddencount %]
[% END # /FOREACH bibitemloo %]
[% ELSE # /UNLESS multi_hold %]
<table id="requesttitles">
<tr>
<th>&nbsp;</th>
<th>Title</th>
[% UNLESS ( item_level_itypes ) %]
<th>Item type</th>
[% END %]
<th>Priority</th>
<th>Information</th>
</tr>
[% FOREACH biblioloo IN biblioloop %]
[% IF ( biblioloo.warn ) %]
<tr class="onissue">
[% ELSE %]
<tr>
[% END %]
<td>
[% UNLESS ( biblioloo.warn ) %]
<input class="multi_hold_item_checkbox" type="checkbox" checked="checked" title="[% biblioloo.biblionumber | html %]"/>
</td>
[% END %]
<td>
<ul>
<li>
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">[% biblioloo.title | html %]</a>
</li>
[% IF ( biblioloo.publicationyear ) %]
<li>
<span class="label">Publication year:</span> [% biblioloo.publicationyear | html %]
</li>
[% END %]
</ul>
[% IF ( biblioloo.warn ) %]
<span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
[% END %]
</td>
[% UNLESS ( item_level_itypes ) %]
<td>
<img src="[% biblioloo.imageurl | html %]" alt="[% biblioloo.itypename | html %]" title="[% biblioloo.itypename | 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>
[% ELSE %]
[% IF ( biblioloo.none_avail ) %]
<ul>
[% END %]
[% END %]
[% IF ( biblioloo.alreadyres ) %]
<li>
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %]</a>
<strong>already has a hold</strong> on this item
</li>
[% END %]
[% IF ( biblioloo.none_avail ) %]
<li> <strong>No items are available</strong> to be placed on hold</li>
[% END %]
[% IF ( biblioloo.alreadyres ) %]
</ul>
[% ELSE %]
[% IF ( biblioloo.none_avail ) %]
</ul>
[% END %]
[% END %]
</td>
</tr>
[% END # /FOREACH biblioloo %]
</table> <!-- /#requesttitles -->
[% END # /UNLESS multi_hold %]
<fieldset class="action">
[% IF ( patron AND patron.borrowernumber ) %]
[% IF ( override_required ) %]
<button type="submit" class="btn btn-default warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
[% ELSIF ( none_available ) %]
<button type="submit" disabled="disabled" class="btn btn-default btn-disabled">Place hold</button>
[% ELSE %]
[% IF ( multi_hold ) %]
<button type="submit" class="btn btn-default" id="multi_hold_submit">Place hold</button>
[% ELSE %]
<button type="submit" class="btn btn-default">Place hold</button>
[% END %]
[% END %]
[% END # /IF patron %]
</fieldset> <!-- /.action -->
</form> <!-- /#hold-request-form -->
</fieldset> <!-- /.rows -->
[% END %]
[% UNLESS ( patron ) %]
[% IF ( reserveloop ) %]
<form id="existing_holds" name="T[% time | html %]" action="modrequest.pl" method="post" style="display:block">
[% IF ( multi_hold ) %]
<input type = "hidden" name="biblionumbers" value="[% biblionumbers | html %]"/>
[% END %]
<h2>Existing holds</h2>
<div id="toolbar" class="btn-toolbar">
<input type="submit" name="submit" value="Update hold(s)" />
<fieldset id="cancellation-reason-fieldset" class="action">
[% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
[% IF hold_cancellation %]
<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 %]
</fieldset>
</div>
[% FOREACH biblioloo IN biblioloop %]
[% IF ( biblioloo.reserveloop ) %]
[% IF ( multi_hold ) %]
<h3>
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">
[% biblioloo.title | html %]
</a>
</h3>
[% END %]
[% IF Koha.Preference('HoldsSplitQueue') == 'branch' %]
[% SET branchcodes = [] %]
[% FOREACH h IN biblioloo.reserveloop %]
[% branchcodes.push( h.branchcode ) %]
[% END %]
[% branchcodes = branchcodes.unique %]
[% FOREACH b IN branchcodes.sort %]
[% SET holds_by_branch = [] %]
[% FOREACH h IN biblioloo.reserveloop %]
[% IF h.branchcode == b %]
[% holds_by_branch.push( h ) %]
[% END %]
[% END %]
<fieldset>
<legend>[% Branches.GetName( b ) | html %]</legend>
[% INCLUDE holds_table.inc holds=holds_by_branch %]
</fieldset>
[% END # /FOREACh b %]
[% ELSIF Koha.Preference('HoldsSplitQueue') == 'itemtype' %]
[% SET itemtypes = [] %]
[% FOREACH h IN biblioloo.reserveloop %]
[% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
[% itemtypes.push( hold_itemtype ) %]
[% END %]
[% itemtypes = itemtypes.unique %]
[% FOREACH i IN itemtypes.sort %]
[% SET holds_by_itemtype = [] %]
[% FOREACH h IN biblioloo.reserveloop %]
[% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
[% IF hold_itemtype == i %]
[% holds_by_itemtype.push( h ) %]
[% END %]
[% END %]
<fieldset>
[% IF i %]
<legend>[% ItemTypes.GetDescription( i ) | html %]</legend>
[% ELSE %]
<legend>Any item type</legend>
[% END %]
[% INCLUDE holds_table.inc holds=holds_by_itemtype %]
</fieldset>
[% END # /FOREACH i %]
[% ELSIF Koha.Preference('HoldsSplitQueue') == 'branch_itemtype' %]
[% SET branchcodes = [] %]
[% FOREACH h IN biblioloo.reserveloop %]
[% branchcodes.push( h.branchcode ) %]
[% END %]
[% branchcodes = branchcodes.unique %]
[% FOREACH b IN branchcodes.sort %]
<fieldset>
<legend>[% Branches.GetName( b ) | html %]</legend>
[% SET holds_by_branch = [] %]
[% FOREACH h IN biblioloo.reserveloop %]
[% IF h.branchcode == b %]
[% holds_by_branch.push( h ) %]
[% END %]
[% END %]
[% SET itemtypes = [] %]
[% FOREACH h IN holds_by_branch %]
[% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
[% itemtypes.push( hold_itemtype ) %]
[% END %]
[% itemtypes = itemtypes.unique %]
[% FOREACH i IN itemtypes.sort %]
[% IF i %]
<h3>[% ItemTypes.GetDescription( i ) | html %]</h3>
[% ELSE %]
<h3>Any item type</h3>
[% END %]
[% SET holds_by_itemtype = [] %]
[% FOREACH h IN holds_by_branch %]
[% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
[% IF hold_itemtype == i %]
[% holds_by_itemtype.push( h ) %]
[% END %]
[% END %]
[% INCLUDE holds_table.inc holds=holds_by_itemtype %]
[% END %]
</fieldset>
[% END # /FOREACH b %]
[% ELSE %]
[% INCLUDE holds_table.inc holds=biblioloo.reserveloop %]
[% END # /IF HoldsSplitQueue %]
[% END # /IF biblioloo.reserveloop %]
[% END # FOREACH biblioloo %]
</fieldset> <!-- /.rows -->
</form> <!-- /name=TTime -->
[% END # IF reserveloop %]
[% END # UNLESS patron %]
</main>
[% IF ( multi_hold ) # No sidebar menu when placing multiple holds %]
</div> <!-- /.col-md-10.col-md-offset-1 -->
[% ELSE %]
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'biblio-view-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
[% END %]
</div> <!-- /.row -->
<div id="cancelModal" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Confirm deletion</h3>
</div>
<div class="modal-body">
<p>Are you sure you want to cancel this hold?</p>
<fieldset class="action">
[% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
[% IF hold_cancellation %]
<label for="cancellation-reason">Cancellation reason: </label>
<select class="cancellation-reason" name="modal-cancellation-reason" id="modal-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 %]
</fieldset>
</div>
<div class="modal-footer">
<button id="cancelModalConfirmBtn" type="button" class="btn btn-danger">Confirm cancellation</button>
<a href="#" data-dismiss="modal">Cancel</a>
</div>
</div>
</div>
</div>
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'columns_settings.inc' %]
[% Asset.js("lib/hc-sticky.js") | $raw %]
[% Asset.js("js/circ-patron-search-results.js") | $raw %]
[% INCLUDE 'select2.inc' %]
<script>
var Sticky;
var biblionumber = "[% biblionumber | $raw %]";
var borrowernumber = "[% patron.borrowernumber | $raw %]";
var patron_homebranch = "[% To.json( Branches.GetName( patron.branchcode ) ) | $raw %]";
var override_items = {[% FOREACH bibitemloo IN bibitemloop %][% FOREACH itemloo IN bibitemloo.itemloop %][% IF ( itemloo.override ) %]
[% itemloo.itemnumber | html %]: {
homebranch: "[% To.json( Branches.GetName( itemloo.homebranch ) ) | $raw %]",
holdallowed: [% itemloo.holdallowed | html %]
},
[% END %][% END %][% END %]
};
var MSG_NO_ITEMS_AVAILABLE = _("A hold cannot be requested on any of these items.");
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"),
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")
}
columns_settings_borrowers_table = [% TablesSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %];
$.fn.select2.defaults.set("width", "100%" );
$.fn.select2.defaults.set("dropdownAutoWidth", true );
$(document).ready(function() {
$('#cancellation-reason-fieldset').hide();
$('.rank-request').on('change', function() {
if ( $(".rank-request option:selected[value='del']").length ) {
$('#cancellation-reason-fieldset').show();
} else {
$('#cancellation-reason-fieldset').hide();
}
});
[% SET active = clubs ? 1 : 0 %]
$('#circ_holds_select').tabs({
active: [% active | $raw %],
activate: function(){
$(this).find("input.focus").focus();
},
create: function(){
$(this).find("input.focus").focus();
}
});
function ToggleHoldsToPlace() {
if ( $("#requestany").prop('checked') ) {
$("#holds_to_place_count").prop('disabled', false);
} else {
$("#holds_to_place_count").prop('disabled', true);
}
}
ToggleHoldsToPlace();
$("#requestany").on('change', function(){
ToggleHoldsToPlace();
});
[% IF Koha.Preference('UseBranchTransferLimits') %]
$("#pickup").on('change', function(){
var pickup = $("#pickup").val();
var url = "?pickup=" + pickup;
url += "&borrowernumber=" + borrowernumber;
url += "&biblionumber=" + biblionumber;
window.location.replace(url);
});
[% END %]
[% IF AutoResumeSuspendedHolds %]
$(".suspend_until_datepicker, .datepickerfrom, .datepickerto").datepicker("option", "minDate", 1);
[% END %]
$(".datepickerto").datepicker("option", "altField", ".datepickerto_hidden");
$(".datepickerto").datepicker("option", "altFormat", "yy-mm-dd");
$(".datepickerfrom").datepicker("option", "altField", ".datepickerfrom_hidden");
$(".datepickerfrom").datepicker("option", "altFormat", "yy-mm-dd");
var my_table = $("#requestspecific").dataTable($.extend(true, {}, dataTablesDefaults, {
'bPaginate': false,
"sDom": '<"top pager"ilf>t',
}));
//Override fieldset styling for dataTables search box
$("div.top.pager").css("margin-left","1em");
$(".dataTables_filter label").css({
"width":"auto",
"margin-right":"0em"
});
$("#club-request-form").on("submit", function() {
let $t = $(this);
$('.clubalert, .holdalert').addClass('hide');
let biblionumbers = [biblionumber];
let biblionumbers_text;
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="borrowernumber"]').length)
data.patron_id = $('input[name="borrowernumber"]').val();
if($('textarea[name="notes"]').length)
data.notes = $('textarea[name="notes"]').val()||null;
if($('.datepickerto_hidden').length)
data.expiration_date = $('.datepickerto_hidden').val()||null;
if($('.datepickerfrom_hidden').length)
data.hold_date = $('.datepickerfrom_hidden').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;
}
if($('input[name="biblionumbers"]').length) {
biblionumbers_text = $('input[name="biblionumbers"]').val();
biblionumbers = biblionumbers_text.replace(/\/$/, '').split('/')
}
const count = $('input[name="holds_to_place_count"]').length?$('input[name="holds_to_place_count"]').val():1;
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) {
let url = 'request.pl?biblionumber='+biblionumber;
if(biblionumbers_text) {
url = 'request.pl?biblionumbers='+biblionumbers_text;
}
document.location = url;
})
.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;
});
[% UNLESS ( multi_hold ) %]
$("#hold-request-form").on("submit", function(){
return check();
});
[% ELSE %]
$("#hold-request-form").on("submit", function(){
return checkMultiHold();
});
[% END %]
function display_pickup_location (state) {
var $text;
if ( state.needs_override === true ) {
$text = $(
'<span>' + state.text + '</span> <span style="float:right;" title="' +
_("This pickup location is not allowed according to circulation rules") +
'"><i class="fa fa-exclamation-circle" aria-hidden="true"></i></span>'
);
}
else {
$text = $('<span>'+state.text+'</span>');
}
return $text;
};
$(".pickup_location_dropdown").each( function () {
var this_dropdown = $(this);
var hold_id = $(this).data('hold_id');
this_dropdown.select2({
allowClear: false,
ajax: {
url: '/api/v1/holds/' + encodeURIComponent(hold_id) + '/pickup_locations',
delay: 300, // wait 300 milliseconds before triggering the request
dataType: 'json',
data: function (params) {
var search_term = (params.term === undefined) ? '' : params.term;
var query = {
"q": JSON.stringify({"name":{"-like":search_term+'%'}}),
"_order_by": "name"
};
return query;
},
processResults: function (data) {
var results = [];
data.forEach( function ( pickup_location ) {
results.push(
{
"id": pickup_location.library_id.escapeHtml(),
"text": pickup_location.name.escapeHtml(),
"needs_override": pickup_location.needs_override
}
);
});
return { "results": results };
}
},
templateResult: display_pickup_location
});
});
});
function check() {
var msg = "";
var count_reserv = 0;
// check if we have checkitem form
if (document.form.checkitem){
for (i=0;i<document.form.checkitem.length;i++){
if (document.form.checkitem[i].checked == true) {
count_reserv++ ;
}
}
// for only one item, check the checkitem without consider the loop checkitem
if (i==0){
if (document.form.checkitem.checked == true) {
count_reserv++;
}
}
}
if (document.form.requestany.checked == true){
count_reserv++ ;
}
if (count_reserv == "0"){
msg += (_("- Please select an item to place a hold") + "\n");
}
if (msg == "") {
$('#hold-request-form').preventDoubleFormSubmit();
return(true);
} else {
alert(msg);
return(false);
}
}
function checkMultiHold() {
var spans = $(".multi_hold_item_checkbox:checked");
if ($(spans).size() == 0) {
alert(MSG_NO_ITEMS_AVAILABLE);
return false;
}
var biblionumbers = "";
$(spans).each(function() {
var bibnum = $(this).attr("title");
biblionumbers += bibnum + "/";
});
var badSpans = $(".not_holdable");
var badBibs = "";
$(badSpans).each(function() {
var bibnum = $(this).attr("title");
badBibs += bibnum + "/";
});
$("#multi_hold_bibs").val(biblionumbers);
$("#bad_bibs").val(badBibs);
$('#hold-request-form').preventDoubleFormSubmit();
return true;
}
$(document).ready(function() {
$("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?") );
});
$("#requestany").click(function() {
if(this.checked){
$("input[name=checkitem]").each(function() {
$(this).prop("checked", false);
});
}
});
$("input[name=checkitem]").click(function() {
onechecked = 0;
$("input[name=checkitem]").each(function() {
if(this.checked){
onechecked = 1;
}
});
if(onechecked == 1){
$("#requestany").prop("checked", false);
$("#holds_to_place_count").prop('disabled', true);
} else {
$("#requestany").prop("checked",true);
$("#holds_to_place_count").prop('disabled', false);
}
});
var prev_rank_request;
$("select[name=rank-request]").on("focus", function() {
prev_rank_request = $(this).val();
var row = $(this).parents("tr:first");
}).change(function() {
var row = $(this).parents("tr:first");
var value = parseInt($(this).val());
var found_holds = $("select[name='rank-request'][disabled='disabled']").length ; //Count how many are found
if( !isNaN(value) ) { //If moved to 'del'
var after = row.parent().find("tr:nth-child("+(value+1+found_holds )+")"); //Go to the row 1 after the new value (and skip found holds)
if (prev_rank_request > value) {
row.insertBefore(after);
} else {
row.insertAfter(after);
}
}
var next_priority = 1;
$("select[name=rank-request]").each(function () {
if( isNaN( $(this).val() ) ){ return true; } //Don't reset found or del holds
$(this).val(next_priority);
next_priority++;
});
});
$(".clear-date").on("click",function(e){
e.preventDefault();
var fieldID = this.id.replace("clear-date-","");
$("#" + fieldID).val("");
});
// Confirm cancellation of hold
let cancel_link;
$(".cancel-hold").on("click",function(e) {
e.preventDefault;
cancel_link = $(this);
$('#cancelModal').modal();
return false;
});
$("#cancelModalConfirmBtn").on("click",function(e) {
let borrowernumber = cancel_link.data('borrowernumber');
let biblionumber = cancel_link.data('biblionumber');
let reserve_id = cancel_link.data('id');
let reason = $("#modal-cancellation-reason").val();
let link = `request.pl?action=cancel&amp;borrowernumber=${ borrowernumber }&amp;biblionumber=${ biblionumber }&amp;reserve_id=${ reserve_id }`;
if ( reason ) {
link += "&amp;cancellation-reason=" + reason
}
window.location.href = link;
return false;
});
[% UNLESS ( patron || patron.borrowernumber || borrowers || noitems ) %]
[% IF ( PatronAutoComplete ) %]
$( "#patron" ).autocomplete({
source: "/cgi-bin/koha/circ/ysearch.pl",
minLength: 3,
select: function( event, ui ) {
$( "#patron" ).val( ui.item.cardnumber );
$( "#holds_patronsearch" ).submit();
return false;
}
})
.data( "ui-autocomplete" )._renderItem = function( ul, item ) {
return $( "<li></li>" )
.data( "ui-autocomplete-item", item )
.append(
"<a>"
+ ( item.surname ? item.surname.escapeHtml() : "" )
+ ", "
+ ( item.firstname ? item.firstname.escapeHtml() : "" )
+ " (" + ( item.cardnumber ? item.cardnumber.escapeHtml() : "" ) + ")"
+ " "
+ "<small>"
+ ( item.address ? item.address.escapeHtml() : "" )
+ " "
+ ( item.city ? item.city.escapeHtml() : "" )
+ " "
+ ( item.zipcode ? item.zipcode.escapeHtml() : "" )
+ " "
+ ( item.country ? item.country.escapeHtml() : "" )
+ "</small>"
+ "</a>" )
.appendTo( ul );
};
[% END %]
[% END %]
Sticky = $("#toolbar");
Sticky.hcSticky({
stickTo: "#existing_holds",
stickyClass: "floating"
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]