Bug 30609: Reindent serial claims template

This patch updates the serial claims template so that the indentation
is consistent. Tabs are replaced with spaces.

To test you must have at least one subscription with late issues.

- Apply the patch and go to Serials -> Claims and select the vendor
  responsible for your late issue.
- On the "Missing issues" page, confirm that everything looks correct.
- All functionality should be the same: Filters, table sorting, CSV
  export, and claim notification.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 455b3b4a93)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Owen Leonard 2022-04-22 18:31:35 +00:00 committed by Lucas Gass
parent edee82be94
commit 8480a3624a

View file

@ -4,7 +4,7 @@
[% USE Branches %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( supplierid ) -%] Claims for [% suppliername | html %] [% END %] &rsaquo; Claims &rsaquo; Serials &rsaquo; Koha</title>
<title>[% IF ( supplierid ) -%] Claims for [% suppliername | html %] &rsaquo; [% END %] Claims &rsaquo; Serials &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
@ -44,174 +44,190 @@
<div class="col-sm-10 col-sm-push-2">
<main>
<h1>Claims [% IF ( suppliername ) %] for [% suppliername | html %] [% END %]</h1>
<h1>Claims [% IF ( suppliername ) %] for [% suppliername | html %] [% END %]</h1>
[% IF error_claim %]
[% IF error_claim == 'no_vendor_email' %]
<div class="dialog alert">This vendor has no email defined for late issues.</div>
[% ELSIF error_claim == 'bad_or_missing_sender' %]
<div class="dialog alert">Bad or missing sender address; check your branch email address or preference KohaAdminEmailAddress.</div>
[% ELSE %]
<div class="dialog alert">[% error_claim | html %]</div>
[% END %]
[% END %]
[% IF info_claim %]
<div class="dialog message">Email has been sent.</div>
[% END %]
[% IF letters %][% UNLESS ( missingissues ) %][% IF ( supplierid ) %] <div class="dialog alert">No missing issues found.</div>[% ELSE %]<div class="dialog message">Please choose a vendor.</div>[% END %][% END %][% END %]
[% IF ( SHOWCONFIRMATION ) %]
<div class="dialog alert">Your notification has been sent.</div>
[% END %]
[% UNLESS letters %]<div class="dialog alert">No claims notice defined. <a href="/cgi-bin/koha/tools/letter.pl">Please define one</a>.</div>[% END %]
<form id="claims" name="claims" action="claims.pl" method="post">
<fieldset>
<label for="supplierid">Vendor: </label>
<select id="supplierid" name="supplierid">
[% FOREACH suploo IN suploop %]
[% IF ( suploo.selected ) %]
<option value="[% suploo.id | html %]" selected="selected" >
[% ELSE %]
<option value="[% suploo.id | html %]">
[% END %]
[% suploo.name | html %]
([% suploo.count | html %])
</option>
[% END %]
</select>
<input type="submit" value="OK" />
</fieldset>
</form>
[% IF ( missingissues ) %]
<h3>Missing issues</h3>
<form action="claims.pl" id="filter_claims_form">
<fieldset class="rows">
<legend>Filters :</legend>
<ol>
<li>
<label for="from">From:</label>
<input type="text" name="begindate" id="from" value="[% begindate | html %]" size="10" maxlength="10" class="flatpickr" data-date_to="to"/>
<label for="to" style="float:none;">To:</label>
<input type="text" name="enddate" id="to" value="[% enddate | html %]" size="10" maxlength="10" class="flatpickr" />
<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
<input id="filterByDate" type="button" value="OK" />
<a href="#" id="clearfilter"><i class="fa fa-remove"></i> Clear filter</a>
</li>
</ol>
</fieldset>
</form>
<fieldset>
<form action="claims.pl" method="post" id="claims_form">
<table id="claimst">
<thead>
<tr>
<th><input type="checkbox" id="CheckAll"></th>
<th>Vendor</th>
<th>Library</th>
<th class="anti-the">Title</th>
<th>ISSN</th>
<th>Issue number</th>
<th>Status</th>
<th>Since</th>
<th>Claims count</th>
<th>Claim date</th>
[% FOR field IN additional_fields_for_subscription %]
<th>[% field.name | html %]</th>
[% END %]
</tr>
</thead>
<tfoot>
<tr>
<td></td>
<td><input type="text" class="filter" data-column_num="1" placeholder="Search vendor" /></td>
<td><input type="text" class="filter" data-column_num="2" placeholder="Search library" /></td>
<td><input type="text" class="filter" data-column_num="3" placeholder="Search title" /></td>
<td><input type="text" class="filter" data-column_num="4" placeholder="Search ISSN" /></td>
<td><input type="text" class="filter" data-column_num="5" placeholder="Search issue number" /></td>
<td><input type="text" class="filter" data-column_num="6" placeholder="Search status" /></td>
<td><input type="text" class="filter" data-column_num="7" placeholder="Search since" /></td>
<td><input type="text" class="filter" data-column_num="8" placeholder="Search claim count" /></td>
<td><input type="text" class="filter" data-column_num="9" placeholder="Search claim date" /></td>
[% FOR field IN additional_fields_for_subscription %]
<td><input type="text" class="filter" data-column_num="[% loop.count + 9 | html %]" placeholder="Search [% field.name | html %]" /></td>
[% IF error_claim %]
[% IF error_claim == 'no_vendor_email' %]
<div class="dialog alert">This vendor has no email defined for late issues.</div>
[% ELSIF error_claim == 'bad_or_missing_sender' %]
<div class="dialog alert">Bad or missing sender address; check your branch email address or preference KohaAdminEmailAddress.</div>
[% ELSE %]
<div class="dialog alert">[% error_claim | html %]</div>
[% END %]
</tr>
</tfoot>
<tbody>[% FOREACH missingissue IN missingissues %]
<tr>
<td>
[% UNLESS missingissue.cannot_claim %]
<input type="checkbox" name="serialid" value="[% missingissue.serialid | html %]" />
[% END %]
</td>
<td>[% missingissue.name | html %]</td>
<td>
<span class="branch-[% missingissue.branchcode | html %]">[% Branches.GetName( missingissue.branchcode ) | html %]</span>
</td>
<td>
<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% missingissue.subscriptionid | uri %]">[% missingissue.title | html %]</a>
</td>
<td>[% missingissue.issn | html %]</td>
<td>[% missingissue.serialseq | html %]</td>
<td>
[% IF ( missingissue.status1 ) %]<span class="status-expected">Expected</span>[% END %]
[% IF ( missingissue.status3 ) %]<span class="status-late">Late</span>[% END %]
[% IF ( missingissue.status4 ) %]<span class="status-missing">Missing</span>[% END %]
[% IF ( missingissue.status41 ) %]<span class="status-missing_never_received">Missing (never received)</span>[% END %]
[% IF ( missingissue.status42 ) %]<span class="status-missing_sold_out">Missing (sold out)</span>[% END %]
[% IF ( missingissue.status43 ) %]<span class="status-missing_damaged">Missing (damaged)</span>[% END %]
[% IF ( missingissue.status44 ) %]<span class="status-missing_lost">Missing (lost)</span>[% END %]
[% IF ( missingissue.status7 ) %]<span class="status-claimed">Claimed</span>[% END %]
</td>
<td class="planneddate" data-order="[% missingissue.planneddateISO | html %]">
[% missingissue.planneddate | html %]
</td>
<td>[% missingissue.claims_count | html %]</td>
<td data-order="[% missingissue.claimdateISO | html %]">
[% missingissue.claimdate | html %]
</td>
[% FOR field IN additional_fields_for_subscription %]
[% IF field.authorised_value_category %]
<td>[% AuthorisedValues.GetByCode( field.authorised_value_category, missingissue.additional_fields.${field.name} ) | html %]</td>
[% ELSE %]
<td>[% missingissue.additional_fields.${field.name} | html %]</td>
[% END %]
[% END %]
</tr>
[% END %]</tbody>
</table>
[% END %]
[% IF info_claim %]
<div class="dialog message">Email has been sent.</div>
[% END %]
[% IF csv_profiles.count %]
<fieldset class="action">
<label for="csv_code">Select CSV profile:</label>
<select id="csv_profile_for_export">
[% FOR csv IN csv_profiles %]
<option value="[% csv.export_format_id | html %]">[% csv.profile | html %]</option>
[% END %]
</select>
<span class="exportSelected"><a id="ExportSelected" href="/cgi-bin/koha/serials/claims.pl">Download selected claims</a></span>
[% END %]
[% IF letters %]
<fieldset class="action">
<label for="letter_code">Select notice:</label>
<select name="letter_code" id="letter_code">
[% FOREACH letter IN letters %]
<option value="[% letter.code | html %]">[% letter.name | html %]</option>
[% IF letters %]
[% UNLESS ( missingissues ) %]
[% IF ( supplierid ) %]
<div class="dialog alert">No missing issues found.</div>
[% ELSE %]
<div class="dialog message">Please choose a vendor.</div>
[% END %]
</select>
<input type="hidden" name="op" value="send_alert" />
<input type="hidden" name="supplierid" value="[% supplierid | html %]" />
<input type="submit" name="submit" class="button" value="Send notification" />
</fieldset>
[% END %]
</form>
</fieldset>
[% END %]
[% END %]
[% END %]
[% IF ( SHOWCONFIRMATION ) %]
<div class="dialog alert">Your notification has been sent.</div>
[% END %]
[% UNLESS letters %]
<div class="dialog alert">
No claims notice defined. <a href="/cgi-bin/koha/tools/letter.pl">Please define one</a>.
</div>
[% END %]
<form id="claims" name="claims" action="claims.pl" method="post">
<fieldset>
<label for="supplierid">Vendor: </label>
<select id="supplierid" name="supplierid">
[% FOREACH suploo IN suploop %]
[% IF ( suploo.selected ) %]
<option value="[% suploo.id | html %]" selected="selected" >
[% ELSE %]
<option value="[% suploo.id | html %]">
[% END %]
[% suploo.name | html %]
([% suploo.count | html %])
</option>
[% END %]
</select>
<input type="submit" value="OK" />
</fieldset>
</form>
[% IF ( missingissues ) %]
<h3>Missing issues</h3>
<form action="claims.pl" id="filter_claims_form">
<fieldset class="rows">
<legend>Filters :</legend>
<ol>
<li>
<label for="from">From:</label>
<input type="text" name="begindate" id="from" value="[% begindate | html %]" size="10" maxlength="10" class="flatpickr" data-date_to="to"/>
<label for="to" style="float:none;">To:</label>
<input type="text" name="enddate" id="to" value="[% enddate | html %]" size="10" maxlength="10" class="flatpickr" />
<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
<input id="filterByDate" type="button" value="OK" />
<a href="#" id="clearfilter"><i class="fa fa-remove"></i> Clear filter</a>
</li>
</ol>
</fieldset>
</form>
<fieldset>
<form action="claims.pl" method="post" id="claims_form">
<table id="claimst">
<thead>
<tr>
<th><input type="checkbox" id="CheckAll"></th>
<th>Vendor</th>
<th>Library</th>
<th class="anti-the">Title</th>
<th>ISSN</th>
<th>Issue number</th>
<th>Status</th>
<th>Since</th>
<th>Claims count</th>
<th>Claim date</th>
[% FOR field IN additional_fields_for_subscription %]
<th>[% field.name | html %]</th>
[% END %]
</tr>
</thead>
<tbody>
[% FOREACH missingissue IN missingissues %]
<tr>
<td>
[% UNLESS missingissue.cannot_claim %]
<input type="checkbox" name="serialid" value="[% missingissue.serialid | html %]" />
[% END %]
</td>
<td>[% missingissue.name | html %]</td>
<td>
<span class="branch-[% missingissue.branchcode | html %]">[% Branches.GetName( missingissue.branchcode ) | html %]</span>
</td>
<td>
<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% missingissue.subscriptionid | uri %]">[% missingissue.title | html %]</a>
</td>
<td>[% missingissue.issn | html %]</td>
<td>[% missingissue.serialseq | html %]</td>
<td>
[% IF ( missingissue.status1 ) %]<span class="status-expected">Expected</span>[% END %]
[% IF ( missingissue.status3 ) %]<span class="status-late">Late</span>[% END %]
[% IF ( missingissue.status4 ) %]<span class="status-missing">Missing</span>[% END %]
[% IF ( missingissue.status41 ) %]<span class="status-missing_never_received">Missing (never received)</span>[% END %]
[% IF ( missingissue.status42 ) %]<span class="status-missing_sold_out">Missing (sold out)</span>[% END %]
[% IF ( missingissue.status43 ) %]<span class="status-missing_damaged">Missing (damaged)</span>[% END %]
[% IF ( missingissue.status44 ) %]<span class="status-missing_lost">Missing (lost)</span>[% END %]
[% IF ( missingissue.status7 ) %]<span class="status-claimed">Claimed</span>[% END %]
</td>
<td class="planneddate" data-order="[% missingissue.planneddateISO | html %]">
[% missingissue.planneddate | html %]
</td>
<td>[% missingissue.claims_count | html %]</td>
<td data-order="[% missingissue.claimdateISO | html %]">
[% missingissue.claimdate | html %]
</td>
[% FOR field IN additional_fields_for_subscription %]
[% IF field.authorised_value_category %]
<td>[% AuthorisedValues.GetByCode( field.authorised_value_category, missingissue.additional_fields.${field.name} ) | html %]</td>
[% ELSE %]
<td>[% missingissue.additional_fields.${field.name} | html %]</td>
[% END %]
[% END %]
</tr>
[% END %]
</tbody>
<tfoot>
<tr>
<td></td>
<td><input type="text" class="filter" data-column_num="1" placeholder="Search vendor" /></td>
<td><input type="text" class="filter" data-column_num="2" placeholder="Search library" /></td>
<td><input type="text" class="filter" data-column_num="3" placeholder="Search title" /></td>
<td><input type="text" class="filter" data-column_num="4" placeholder="Search ISSN" /></td>
<td><input type="text" class="filter" data-column_num="5" placeholder="Search issue number" /></td>
<td><input type="text" class="filter" data-column_num="6" placeholder="Search status" /></td>
<td><input type="text" class="filter" data-column_num="7" placeholder="Search since" /></td>
<td><input type="text" class="filter" data-column_num="8" placeholder="Search claim count" /></td>
<td><input type="text" class="filter" data-column_num="9" placeholder="Search claim date" /></td>
[% FOR field IN additional_fields_for_subscription %]
<td><input type="text" class="filter" data-column_num="[% loop.count + 9 | html %]" placeholder="Search [% field.name | html %]" /></td>
[% END %]
</tr>
</tfoot>
</table>
[% IF csv_profiles.count %]
<fieldset class="action">
<label for="csv_code">Select CSV profile:</label>
<select id="csv_profile_for_export">
[% FOR csv IN csv_profiles %]
<option value="[% csv.export_format_id | html %]">[% csv.profile | html %]</option>
[% END %]
</select>
<span class="exportSelected"><a id="ExportSelected" href="/cgi-bin/koha/serials/claims.pl">Download selected claims</a></span>
</fieldset>
[% END %]
[% IF letters %]
<fieldset class="action">
<label for="letter_code">Select notice:</label>
<select name="letter_code" id="letter_code">
[% FOREACH letter IN letters %]
<option value="[% letter.code | html %]">[% letter.name | html %]</option>
[% END %]
</select>
<input type="hidden" name="op" value="send_alert" />
<input type="hidden" name="supplierid" value="[% supplierid | html %]" />
<input type="submit" name="submit" class="button" value="Send notification" />
</fieldset>
[% END %]
</form>
</fieldset>
[% END %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
@ -231,10 +247,10 @@
$(document).ready(function() {
sTable = $("#claimst").dataTable($.extend(true, {}, dataTablesDefaults, {
"sDom": 't',
"aoColumnDefs": [
{ "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
{ 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
],
"aoColumnDefs": [
{ "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
{ 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
],
"bPaginate": false
}));
sTable.fnAddFilters("filter", "200");
@ -254,20 +270,20 @@
// We need to use "input[name=serialid]:checked" instead of "input:checked". Otherwise, the "check all" box will pass the value of "on" as a serialid, which produces a SQL error.
var selected = $("input[name=serialid]:checked");
if (selected.length == 0) {
alert(_("Please select at least one item to export."));
return false;
}
if (selected.length == 0) {
alert(_("Please select at least one item to export."));
return false;
}
// Building the url from currently checked boxes
var url = '/cgi-bin/koha/serials/lateissues-export.pl?supplierid=&amp;op=claims';
for (var i = 0; i < selected.length; i++) {
url += '&amp;serialid=' + selected[i].value;
}
url += '&amp;csv_profile=' + $("#csv_profile_for_export option:selected").val();
// And redirecting to the CSV page
location.href = url;
return false;
// Building the url from currently checked boxes
var url = '/cgi-bin/koha/serials/lateissues-export.pl?supplierid=&amp;op=claims';
for (var i = 0; i < selected.length; i++) {
url += '&amp;serialid=' + selected[i].value;
}
url += '&amp;csv_profile=' + $("#csv_profile_for_export option:selected").val();
// And redirecting to the CSV page
location.href = url;
return false;
});
$("#filterByDate").on("click",function(e){
e.preventDefault();
@ -284,13 +300,13 @@
$("#filter_claims_form").on("submit",function(){
return false;
});
});
});
// Checks if the form can be sent (at least one checkbox must be checked)
function checkForm() {
if ($("input:checked").length == 0) {
alert(_("Please select at least one issue."));
return false;
alert(_("Please select at least one issue."));
return false;
}
}
@ -325,14 +341,14 @@
// For each date in the table
$(".planneddate").each(function() {
// We make a JS Date Object, according to the locale
var pdate = Date_from_syspref($(this).text()).getTime();
// We make a JS Date Object, according to the locale
var pdate = Date_from_syspref($(this).text()).getTime();
// And checks if the date is between the beginning and ending dates
if (pdate > beginDate &&
pdate < endDate) {
// If so, we can show the row
$(this).parent().show();
// And checks if the date is between the beginning and ending dates
if (pdate > beginDate &&
pdate < endDate) {
// If so, we can show the row
$(this).parent().show();
}
});
}