Bug 29983: Display the pretend claim column in overdue.tt
This patch displays the column "Return claims" from the page "moremember.pl" to the page "overdues.pl". Rebase on master. Test plan: 1) Use a patron with at least 1 item who should be checked out soon 2) Home > Patron > Patron details for [name] 3) Click on the 'Checkout' button down the page to show the full table and notice the "Return Claims" column 4) Now go to Home > Circulation > Overdues 5) Find the patron who has to check out and have a look at the table 6) Apply patch and repeat 4) and 5) -> the "Return Claim" column is now displayed on the table 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>
This commit is contained in:
parent
4b875fa936
commit
e56c0dead6
|
|
@ -1505,6 +1505,9 @@ modules:
|
|||
columnname: price
|
||||
-
|
||||
columnname: non-public_note
|
||||
-
|
||||
columnname: claims_returned
|
||||
is_hidden: 1
|
||||
|
||||
print_summary:
|
||||
print-summary-checkouts:
|
||||
|
|
|
|||
|
|
@ -255,12 +255,15 @@ if ($noreport) {
|
|||
items.replacementprice,
|
||||
items.enumchron,
|
||||
items.itemnotes_nonpublic,
|
||||
items.itype
|
||||
items.itype,
|
||||
return_claims.created_on AS return_claim_created_on,
|
||||
return_claims.id AS return_claim_id
|
||||
FROM issues
|
||||
LEFT JOIN borrowers ON (issues.borrowernumber=borrowers.borrowernumber )
|
||||
LEFT JOIN items ON (issues.itemnumber=items.itemnumber)
|
||||
LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber)
|
||||
LEFT JOIN biblio ON (biblio.biblionumber=items.biblionumber )
|
||||
LEFT JOIN return_claims ON (return_claims.borrowernumber=borrowers.borrowernumber AND return_claims.itemnumber=items.itemnumber)
|
||||
WHERE 1=1 "; # placeholder, since it is possible that none of the additional
|
||||
# conditions will be selected by user
|
||||
$strsth.=" AND date_due < '" . $todaysdate . "' " unless ($showall or $datedueto);
|
||||
|
|
@ -308,6 +311,11 @@ if ($noreport) {
|
|||
my $pattrs = $borrowernumber_to_attributes{$data->{borrowernumber}} || {}; # patron attrs for this borrower
|
||||
# $pattrs is a hash { attrcode => [ [value,displayvalue], [value,displayvalue]... ] }
|
||||
|
||||
my $return_claim_created_on = $data->{return_claim_created_on};
|
||||
if ( defined $return_claim_created_on ) {
|
||||
$return_claim_created_on = output_pref({ dt => dt_from_string($return_claim_created_on ) });
|
||||
}
|
||||
|
||||
my @patron_attr_value_loop; # template array [ {value=>v1}, {value=>v2} ... } ]
|
||||
for my $pattr_filter (grep { ! $_->{isclone} } @patron_attr_filter_loop) {
|
||||
my @displayvalues = map { $_->[1] } @{ $pattrs->{$pattr_filter->{code}} }; # grab second value from each subarray
|
||||
|
|
@ -347,6 +355,8 @@ if ($noreport) {
|
|||
itemcallnumber => $data->{itemcallnumber},
|
||||
replacementprice => $data->{replacementprice},
|
||||
itemnotes_nonpublic => $data->{itemnotes_nonpublic},
|
||||
return_claim_created_on => $return_claim_created_on,
|
||||
return_claim_id => $data->{return_claim_id},
|
||||
enumchron => $data->{enumchron},
|
||||
itemtype => $data->{itype},
|
||||
patron_attr_value_loop => \@patron_attr_value_loop,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
[% USE Koha %]
|
||||
[% PROCESS 'modal-claims.inc' %]
|
||||
<div id="checkouts">
|
||||
[% IF ( issuecount ) %]
|
||||
<div id="issues-table-loading-message">
|
||||
|
|
@ -92,6 +93,8 @@
|
|||
</div>
|
||||
|
||||
<!-- Claims Returned Modal -->
|
||||
|
||||
[% PROCESS 'modal-claims-display' %]
|
||||
<div class="modal fade" id="claims-returned-modal" tabindex="-1" role="dialog" aria-labelledby="claims-returned-modal-label">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,104 @@
|
|||
|
||||
[% USE Koha %]
|
||||
<!-- modal-claims.inc -->
|
||||
|
||||
[% BLOCK 'modal-claims-display' %]
|
||||
<!-- Claims Returned Modal -->
|
||||
<div class="modal fade" id="claims-returned-modal" tabindex="-1" role="dialog" aria-labelledby="claims-returned-modal-label">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="claims-returned-modal-label">Claim returned</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="claims-returned-notes" class="control-label">Notes</label>
|
||||
<div>
|
||||
<textarea id="claims-returned-notes" class="form-control" rows="3"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
[% IF Koha.Preference('ClaimReturnedChargeFee') == 'ask' %]
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<label for="claims-returned-charge-lost-fee">
|
||||
<input id="claims-returned-charge-lost-fee" type="checkbox" value="1">
|
||||
Charge lost fee
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
[% END %]
|
||||
|
||||
<input type="hidden" id="claims-returned-itemnumber" />
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="claims-returned-modal-btn-submit" type="button" class="btn btn-primary"><i class="fa fa-exclamation-circle"></i> Make claim</button>
|
||||
<button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
[% END %]
|
||||
|
||||
[% BLOCK 'modal-claims-js' %]
|
||||
<script>
|
||||
|
||||
// Verify if the syspref is defined
|
||||
var ClaimReturnedLostValue = "[% Koha.Preference('ClaimReturnedLostValue') | html %]";
|
||||
|
||||
var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
|
||||
var interface = "[% interface | html %]";
|
||||
var theme = "[% theme | html %]";
|
||||
|
||||
// Handle return claims
|
||||
$(document).on("click", '.claim-returned-btn', function(e){
|
||||
e.preventDefault();
|
||||
itemnumber = $(this).data('itemnumber');
|
||||
|
||||
$('#claims-returned-itemnumber').val(itemnumber);
|
||||
$('#claims-returned-notes').val("");
|
||||
$('#claims-returned-charge-lost-fee').attr('checked', false);
|
||||
$('#claims-returned-modal').modal();
|
||||
});
|
||||
$(document).on("click", '#claims-returned-modal-btn-submit', function(e){
|
||||
let itemnumber = $('#claims-returned-itemnumber').val();
|
||||
let notes = $('#claims-returned-notes').val();
|
||||
let fee = $('#claims-returned-charge-lost-fee').attr('checked') ? true : false;
|
||||
|
||||
$('#claims-returned-modal').modal('hide');
|
||||
|
||||
const button = $('.claim-returned-btn[data-itemnumber="' + itemnumber + '"]');
|
||||
const img = '<img id="return_claim_spinner_' + itemnumber + '" src="' + interface + '/' + theme + '/img/spinner-small.gif" />';
|
||||
button.replaceWith(img);
|
||||
|
||||
params = {
|
||||
item_id: itemnumber,
|
||||
notes: notes,
|
||||
charge_lost_fee: fee,
|
||||
created_by: logged_in_user_borrowernumber,
|
||||
};
|
||||
|
||||
$.post( '/api/v1/return_claims', JSON.stringify(params), function( data ) {
|
||||
|
||||
id = "#return_claim_spinner_" + data.item_id;
|
||||
|
||||
let created_on = new Date(data.created_on);
|
||||
let formated_date = $datetime(created_on);
|
||||
|
||||
let content = "";
|
||||
if ( data.claim_id ) {
|
||||
content = '<span class="badge">' + formated_date + '</span>';
|
||||
$(id).parent().parent().addClass('ok');
|
||||
} else {
|
||||
content = _("Unable to claim as returned");
|
||||
$(id).parent().parent().addClass('warn');
|
||||
}
|
||||
|
||||
$(id).replaceWith( content );
|
||||
|
||||
$('body').trigger('refreshClaimModal');
|
||||
}, "json")
|
||||
});
|
||||
</script>
|
||||
[% END %]
|
||||
|
|
@ -1029,6 +1029,8 @@
|
|||
[% INCLUDE 'columns_settings.inc' %]
|
||||
[% INCLUDE 'select2.inc' %]
|
||||
[% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
|
||||
[% PROCESS 'modal-claims-js' %]
|
||||
|
||||
<script>
|
||||
/* Set some variable needed in circulation.js */
|
||||
var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
[% USE Asset %]
|
||||
[% USE AuthorisedValues %]
|
||||
[% USE KohaDates %]
|
||||
[% USE Koha %]
|
||||
[%- USE Branches -%]
|
||||
[%- USE Price -%]
|
||||
[%- USE ItemTypes -%]
|
||||
|
|
@ -9,6 +10,7 @@
|
|||
[%- USE TablesSettings -%]
|
||||
[% SET footerjs = 1 %]
|
||||
[% INCLUDE 'doc-head-open.inc' %]
|
||||
[% PROCESS 'modal-claims.inc' %]
|
||||
<title>Items overdue as of [% todaysdate | html %] › Circulation › Koha</title>
|
||||
[% INCLUDE 'doc-head-close.inc' %]
|
||||
[% FILTER collapse %]
|
||||
|
|
@ -92,6 +94,7 @@
|
|||
<th>Item type</th>
|
||||
<th>Price</th>
|
||||
<th>Non-public note</th>
|
||||
<th>Return claims</th>
|
||||
</tr>
|
||||
</thead>
|
||||
[%- BLOCK subject -%]Overdue:[%- END -%]
|
||||
|
|
@ -117,12 +120,28 @@
|
|||
<td>[% ItemTypes.GetDescription( overdueloo.itemtype ) | html %]</td>
|
||||
<td>[% overdueloo.replacementprice | $Price %]</td>
|
||||
<td>[% overdueloo.itemnotes_nonpublic | html %]</td>
|
||||
<td>
|
||||
[% IF ( overdueloo.return_claim_created_on ) %]
|
||||
<span class="badge">[% overdueloo.return_claim_created_on | html %]</span>
|
||||
[% ELSIF Koha.Preference('ClaimReturnedLostValue') %]
|
||||
<a class="btn btn-default btn-xs claim-returned-btn" data-itemnumber=[% overdueloo.itemnum | html %]>
|
||||
<i class="fa fa-exclamation-circle"></i> Claim returned
|
||||
</a>
|
||||
[% ELSE %]
|
||||
<a class="btn btn-default btn-xs" disabled="disabled" title="ClaimReturnedLostValue is not set, this feature is disabled">
|
||||
<i class="fa fa-exclamation-circle"></i> Claim returned
|
||||
</a>
|
||||
[% END %]
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Claims Returned Modal -->
|
||||
[% PROCESS 'modal-claims-display' %]
|
||||
|
||||
[% ELSE %]
|
||||
|
||||
<h1>Overdue report</h1>
|
||||
|
|
@ -266,6 +285,8 @@
|
|||
[% INCLUDE 'datatables.inc' %]
|
||||
[% INCLUDE 'columns_settings.inc' %]
|
||||
[% INCLUDE 'select2.inc' %]
|
||||
[% INCLUDE 'js-date-format.inc' %]
|
||||
[% PROCESS 'modal-claims-js' %]
|
||||
<script>
|
||||
function clone_input( node, original_id ) {
|
||||
var original = node;
|
||||
|
|
|
|||
|
|
@ -838,6 +838,7 @@
|
|||
[% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
|
||||
[% INCLUDE 'columns_settings.inc' %]
|
||||
[% INCLUDE 'select2.inc' %]
|
||||
[% PROCESS 'modal-claims-js' %]
|
||||
<script>
|
||||
/* Set some variable needed in circulation.js */
|
||||
var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
|
||||
|
|
|
|||
|
|
@ -897,55 +897,11 @@ $(document).ready(function() {
|
|||
} ).prop('checked', false);
|
||||
}
|
||||
|
||||
// Handle return claims
|
||||
$(document).on("click", '.claim-returned-btn', function(e){
|
||||
e.preventDefault();
|
||||
itemnumber = $(this).data('itemnumber');
|
||||
|
||||
$('#claims-returned-itemnumber').val(itemnumber);
|
||||
$('#claims-returned-notes').val("");
|
||||
$('#claims-returned-charge-lost-fee').attr('checked', false)
|
||||
$('#claims-returned-modal').modal()
|
||||
// Refresh after return claim
|
||||
$('body').on('refreshClaimModal', function () {
|
||||
refreshReturnClaimsTable();
|
||||
issuesTable.api().ajax.reload();
|
||||
});
|
||||
$(document).on("click", '#claims-returned-modal-btn-submit', function(e){
|
||||
let itemnumber = $('#claims-returned-itemnumber').val();
|
||||
let notes = $('#claims-returned-notes').val();
|
||||
let fee = $('#claims-returned-charge-lost-fee').attr('checked') ? true : false;
|
||||
|
||||
$('#claims-returned-modal').modal('hide')
|
||||
|
||||
$('.claim-returned-btn[data-itemnumber="' + itemnumber + '"]').replaceWith('<img id="return_claim_spinner_' + itemnumber + ' src=' + interface + '/' + theme + '/img/spinner-small.gif />');
|
||||
|
||||
params = {
|
||||
item_id: itemnumber,
|
||||
notes: notes,
|
||||
charge_lost_fee: fee,
|
||||
created_by: logged_in_user_borrowernumber,
|
||||
};
|
||||
|
||||
$.post( '/api/v1/return_claims', JSON.stringify(params), function( data ) {
|
||||
|
||||
id = "#return_claim_spinner_" + data.item_id;
|
||||
|
||||
let created_on = new Date(data.created_on);
|
||||
|
||||
let content = "";
|
||||
if ( data.claim_id ) {
|
||||
content = '<span class="badge">' + created_on.toLocaleDateString() + '</span>';
|
||||
$(id).parent().parent().addClass('ok');
|
||||
} else {
|
||||
content = __("Unable to claim as returned");
|
||||
$(id).parent().parent().addClass('warn');
|
||||
}
|
||||
|
||||
$(id).replaceWith( content );
|
||||
|
||||
refreshReturnClaimsTable();
|
||||
issuesTable.api().ajax.reload();
|
||||
}, "json")
|
||||
|
||||
});
|
||||
|
||||
|
||||
// Don't load return claims table unless it is clicked on
|
||||
var returnClaimsTable;
|
||||
|
|
|
|||
Loading…
Reference in New Issue