Koha/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt
Owen Leonard 9a321c128f Bug 22536: Display problem in Holds to Pull report
This patch modifies the display of several values in the holds to pull
report so that they can be displayed as lists instead of as chunks of
HTML generated in SQL.

This patch modifies the SQL in pendingreserves.pl so that values can be
formatted in the same way that holding branch is. The better long-term
solution is to remove SQL from pendingreserves.pl altogether, but this
is a quick fix.

This patch also makes a couple of minor markup changes to fix
validation.

To test, apply the patch and go to Circulation -> Holds to pull. To see
the changes the patch makes your holds to pull list should have titles
with multiple items at multiple branches, with call number, copy number,
and enumeration data. These values should all be displayed in bulleted
lists.

Signed-off-by: David Roberts <david.roberts@ptfs-europe.com>
Signed-off-by: Bin Wen <bin.wen@inlibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-03-28 12:33:06 +00:00

306 lines
12 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% USE KohaDates %]
[% USE ColumnsSettings %]
[% USE AuthorisedValues %]
[%- USE Branches -%]
[%- USE ItemTypes -%]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Circulation &rsaquo; Holds to pull</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="circ_pendingreserves" class="circ">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'circ-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo; Holds to pull</div>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% FOR m IN messages %]
<div class="dialog [% m.type | html %]">
[% SWITCH m.code %]
[% CASE 'letter_enqueued' %]
<span>The notice has been correctly enqueued.</span>
[% CASE 'no_email_address' %]
<span>The patron does not have an email address defined.</span>
[% CASE 'no_template_notice' %]
<span>There is no notice template with a code 'CANCEL_HOLD_ON_LOST' defined in your system.</span>
[% CASE 'hold_cancelled' %]
<span>The hold has been correctly cancelled.</span>
[% CASE 'hold_placed_at_biblio_level' %]
<span>The hold has been placed on biblio level. It is not possible to determine the item to mark as lost.</span>
[% CASE %]
[% m.code | html %]
[% END %]
</div>
[% END %]
<h2>Holds to pull placed between [% from | $KohaDates %] and [% to | $KohaDates %]</h2>
<h3>Reported on [% todaysdate | $KohaDates %]</h3>
<p>The following holds have not been filled. Please retrieve them and check them in.</p>
<div id="searchresults">
[% IF ( reserveloop ) %]
<table id="holdst">
<thead>
<tr>
<th>Pull this many items</th>
<th>Items available</th>
<th>Patrons with holds</th>
<th>First patron</th>
<th class="anti-the">Title</th>
<th class="string-sort">Libraries</th>
<th>Available call numbers</th>
<th>Available copy numbers</th>
<th>Available enumeration</th>
<th class="string-sort">Available item types</th>
<th class="string-sort">Available locations</th>
<th class="title-string">Earliest hold date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
[% FOREACH reserveloo IN reserveloop %]
<tr>
[% IF ( reserveloo.borrowernumber ) %]
<td><p><b>[% reserveloo.pullcount | html %]</b></p></td>
<td>[% reserveloo.count | html %]</td>
<td>[% reserveloo.rcount | html %]</td>
<td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% reserveloo.borrowernumber | uri %]">[% reserveloo.firstname | html %] [% reserveloo.surname | html %]</a></td>
<td>
<p>
[% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %]
[% reserveloo.title | html %] [% FOREACH s IN reserveloo.subtitle %] [% s | html %][% END %]</a></p>
[% IF ( reserveloo.author ) %]<p> by [% reserveloo.author | html %]</p>[% END %]
</td>
[% ELSE %]
<td>"</td>
<td>"</td>
<td>"</td>
<td>"</td>
<td>"</td>
[% END %]
<td>
[% IF ( reserveloo.holdingbranches ) %]
<ul>
[% FOREACH holdingbranch IN reserveloo.holdingbranches %]
<li>
[% Branches.GetName ( holdingbranch ) | html %]
</li>
[% END %]
</ul>
[% END %]
</td>
<td>
[% IF ( reserveloo.itemcallnumber ) %]
<ul>
[% FOREACH itemcallnumber IN reserveloo.itemcallnumber %]
<li>
[% itemcallnumber | html %]
</li>
[% END %]
</ul>
[% END %]
</td>
<td>
[% IF ( reserveloo.copyno ) %]
<ul>
[% FOREACH copyno IN reserveloo.copyno %]
<li>
[% copyno | html %]
</li>
[% END %]
</ul>
[% END %]
</td>
<td>
[% IF ( reserveloo.enumchron ) %]
<ul>
[% FOREACH enumchron IN reserveloo.enumchron %]
<li>
[% enumchron | html %]
</li>
[% END %]
</ul>
[% END %]
</td>
<td>
[% FOREACH itemType IN reserveloo.itemTypes %]
[% ItemTypes.GetDescription( itemType ) | html %]
[% END %]
</td>
<td>
[% FOREACH loc IN reserveloo.locations %]
[% AuthorisedValues.GetByCode('LOC', loc) | html %]
[% END %]
</td>
<td>
<span title="[% reserveloo.reservedate | html %]">[% reserveloo.reservedate | $KohaDates %] in [% Branches.GetName ( reserveloo.branch ) | html %]</span>
</td>
<td>
<form name="cancelReserve" action="/cgi-bin/koha/circ/pendingreserves.pl" method="post">
<input type="hidden" name="op" value="cancel_reserve" />
<input type="hidden" name="reserve_id" value="[% reserveloo.reserve_id | html %]" />
[% IF reserveloo.holdingbranch != reserveloo.homebranch %]
<input type="submit" value="Cancel hold and return to : [% Branches.GetName( reserveloo.homebranch ) | html %]" />
[% ELSE %]
<input type="submit" value="Cancel hold" />
[% END %]
</form>
[% IF Koha.Preference('CanMarkHoldsToPullAsLost') != 'do_not_allow' %]
[% IF reserveloo.itemnumber %]
<form name="cancelReserve" action="/cgi-bin/koha/circ/pendingreserves.pl" method="post">
<input type="hidden" name="reserve_id" value="[% reserveloo.reserve_id | html %]" />
[% IF Koha.Preference('CanMarkHoldsToPullAsLost') == 'allow' %]
<input type="hidden" name="op" value="mark_as_lost" />
<input type="submit" value="Mark item as lost" />
[% ELSIF Koha.Preference('CanMarkHoldsToPullAsLost') == 'allow_and_notify' %]
<input type="hidden" name="op" value="mark_as_lost_and_notify" />
<input type="submit" value="Mark lost and notify patron" />
[% END %]
</form>
[% ELSE %]
<span>Biblio level hold.</span>
[% END %]
[% END %]
</td>
</tr>
[% END %]
</tbody>
<tfoot>
<tr>
<td><input type="text" class="filter" data-column_num="0" placeholder="Pull this many items" style="width:95%"/></td>
<td><input type="text" class="filter" data-column_num="1" placeholder="Items available" style="width:95%"/></td>
<td><input type="text" class="filter" data-column_num="2" placeholder="Patron holds" style="width:95%"/></td>
<td><input type="text" class="filter" data-column_num="3" placeholder="Patron name" style="width:95%"/></td>
<td><input type="text" class="filter" data-column_num="4" placeholder="Title" style="width:95%"/></td>
<td id="homebranchfilter"></td>
<td><input type="text" class="filter" data-column_num="6" placeholder="Call number" style="width:95%"/></td>
<td><input type="text" class="filter" data-column_num="7" placeholder="Available copy" style="width:95%"/></td>
<td><input type="text" class="filter" data-column_num="8" placeholder="Available enumeration" style="width:95%"/></td>
<td id="itemtype-filter"></td>
<td id="locationfilter"></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
[% ELSE %]
<b>No items found.</b>
[% END %]
</div>
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
<div id="filters">
<form action="/cgi-bin/koha/circ/pendingreserves.pl" method="post" >
<fieldset class="brief">
<h4>Refine results</h4>
<ol>
<li>
<label for="from">
Start date:
</label>
<input type="text" size="10" id="from" name="from" value="[% from | $KohaDates %]" class="datepickerfrom" />
</li>
<li><label for="to">
End date:
</label>
<input type="text" size="10" id="to" name="to" value="[% to | $KohaDates %]" class="datepickerto" />
</li>
</ol>
[% IF ( HoldsToPullEndDate ) %]
<p><i>(Inclusive, default is [% HoldsToPullStartDate | html %] days ago to [% HoldsToPullEndDate | html %] days ahead. Set other date ranges as needed.)</i></p>
[% ELSE %]
<p><i>(Inclusive, default is [% HoldsToPullStartDate | html %] days ago to today. Set other date ranges as needed.)</i></p>
[% END %]
<fieldset class="action"><input type="submit" name="run_report" value="Submit" class="submit"/></fieldset>
</fieldset>
</form>
</div>
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]
<script>
$(document).ready(function() {
var columns_settings = [% ColumnsSettings.GetColumns('circ', 'holds', 'holds-to-pull', 'json') | $raw %];
var holdst = KohaTable("holdst", {
"aoColumnDefs": [
{ "sType": "anti-the", "aTargets" : [ "anti-the" ] },
{ "sType": "title-string", "aTargets" : [ "title-string" ] },
{ "sType": "string", "aTargets": [ "string-sort" ] }
],
"sPaginationType": "full_numbers"
}, columns_settings);
holdst.fnAddFilters("filter");
[%# add separateData function to cleanse jQuery select lists by breaking apart strings glued with BR tags and then de-duplicating any repeated library codes %]
function separateData ( ColumnData ){
var cD = ColumnData;
var new_array = new Array();
for ( j=0 ; j<cD.length ; j++ ) {
var split_array = cD[j].split(/\n/gi);
for ( k=0 ; k<split_array.length ; k++ ){
var str = $.trim(split_array[k].replace(/[\n\r]/g, ''));
if ($.inArray(str, new_array) == -1 && str.length > 0 ) {
new_array.push(str);
}
}
}
new_array.sort();
return new_array;
}
[%# add SeparateData function into createSelect function, so that it does the createSelect on clean data %]
function createSelect( data ) {
data = separateData(data);
var r='<select style="width:99%"><option value="">' + _("None") + '</option>', i, len=data.length;
for ( i=0 ; i<len ; i++ ) {
r += '<option value="'+data[i]+'">'+data[i]+'</option>';
}
return r+'</select>';
}
$("#homebranchfilter").each( function () {
$(this).html( createSelect( holdst.fnGetColumnData(5) ) );
$('select', this).change( function () {
var filter_value = $(this).val();
holdst.fnFilter( filter_value, 5, true );
});
});
$("#itemtype-filter").each( function () {
$(this).html( createSelect( holdst.fnGetColumnData(9) ) );
$('select', this).change( function () {
holdst.fnFilter( $(this).val(), 9 );
});
});
$("#locationfilter").each( function () {
$(this).html( createSelect( holdst.fnGetColumnData(10) ) );
$('select', this).change( function () {
holdst.fnFilter( $(this).val(), 10 );
});
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]