Bug 37211: Make notes in patron transactions table editable
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
79e1f87a16
commit
8a77899cf0
|
|
@ -132,6 +132,21 @@
|
|||
[% account.checkout.library.branchname | html %]
|
||||
[% END %]
|
||||
</td>
|
||||
<td>
|
||||
[% account.note | html_line_break %]
|
||||
[% IF CAN_user_updatecharges_edit_notes %]
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-default btn-xs edit-action"
|
||||
data-toggle="modal"
|
||||
data-target="#editNoteModal"
|
||||
data-accountline="[% account.accountlines_id | html %]"
|
||||
data-note="[% account.note | html %]"
|
||||
data-member="[% account.borrowernumber | html %]"
|
||||
><i class="fa-solid fa-pen"></i> Edit</button
|
||||
>
|
||||
[% END %]
|
||||
</td>
|
||||
<td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
|
||||
<td>[% account.note | html_line_break %]</td>
|
||||
[% IF account.amount <= 0 %]
|
||||
|
|
@ -477,6 +492,50 @@
|
|||
</div>
|
||||
<!-- /#voidPaymentModal -->
|
||||
|
||||
<!-- Edit note modal -->
|
||||
<div class="modal" id="editNoteModal" tabindex="-1" role="dialog" aria-labelledby="editNoteLabel">
|
||||
<form id="edit_form" action="/cgi-bin/koha/members/boraccount.pl" method="post" enctype="multipart/form-data" class="validated">
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<input type="hidden" name="accountlines_id" value="" id="noteline" />
|
||||
<input type="hidden" name="op" value="cud-edit_note" />
|
||||
<input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]" />
|
||||
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title" id="editNoteLabel">Edit note</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<fieldset class="rows">
|
||||
<ol>
|
||||
<li>
|
||||
<label for="edited_note">Note: </label>
|
||||
<input name="edited_note" id="edited_note" value="" />
|
||||
</li>
|
||||
</ol>
|
||||
</fieldset>
|
||||
<!-- /.rows -->
|
||||
</div>
|
||||
<!-- /.modal-body -->
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-default">Confirm</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
</div>
|
||||
<!-- /.modal-footer -->
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</form>
|
||||
<!-- /#void_form -->
|
||||
</div>
|
||||
<!-- /#editNoteModal -->
|
||||
|
||||
<!-- Cancel charge modal -->
|
||||
<div class="modal" id="cancelChargeModal" tabindex="-1" role="dialog" aria-labelledby="cancelChangreLabel">
|
||||
<form method="post" action="/cgi-bin/koha/members/cancel-charge.pl">
|
||||
|
|
@ -606,6 +665,18 @@
|
|||
$('#accountlines_id').val(item);
|
||||
});
|
||||
|
||||
$("#editNoteModal").on("shown.bs.modal", function(e) {
|
||||
var button = $(e.relatedTarget);
|
||||
var item = button.data('item');
|
||||
$("#item + span").replaceWith(item);
|
||||
|
||||
var accountline = button.data('accountline');
|
||||
$('#noteline').val(accountline);
|
||||
|
||||
var note = button.data('note');
|
||||
$('#edited_note').val(note);
|
||||
});
|
||||
|
||||
$(".receipt-email-action").on("click", function(e){
|
||||
e.preventDefault();
|
||||
return $(this).siblings('form').submit();
|
||||
|
|
|
|||
|
|
@ -226,6 +226,28 @@ if ( $op eq 'cud-send_receipt' ) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( $op eq 'cud-edit_note' ) {
|
||||
|
||||
output_and_exit_if_error( $input, $cookie, $template, { check => 'csrf_token' } );
|
||||
|
||||
my $payment_id = scalar $input->param('accountlines_id');
|
||||
my $note = scalar $input->param('edited_note');
|
||||
|
||||
my $payment = Koha::Account::Lines->find($payment_id);
|
||||
|
||||
$schema->txn_do(
|
||||
sub {
|
||||
# Update the note and date in the account line
|
||||
$payment->set(
|
||||
{
|
||||
date => \'NOW()',
|
||||
note => $note
|
||||
}
|
||||
)->store();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#get account details
|
||||
my $total = $patron->account->balance;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue