Bug 29987: Add register support to manual credits

This patch adds the register and transaction type selection options to
the manual credit page.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2022-06-29 17:19:05 +01:00 committed by Tomas Cohen Arazi
parent dc86053bd8
commit 529341c78b
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 43 additions and 12 deletions

View file

@ -2,11 +2,13 @@
[% USE Asset %]
[% USE Koha %]
[% USE Branches %]
[% USE Registers %]
[% SET footerjs = 1 %]
[% PROCESS 'accounts.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
[% SET registers = Registers.all( { filters => { current_branch => 1 } } ) %]
<title>Create manual credit &rsaquo; Patrons &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
@ -74,6 +76,31 @@
<li><label for="desc">Description: </label><input type="text" name="desc" size="50" id="desc" /></li>
<li><label for="note">Note: </label><input type="text" name="note" size="50" id="note" /></li>
<li><label for="amount">Amount: </label><input type="text" inputmode="decimal" pattern="^\d+(\.\d{2})?$" name="amount" id="amount" required="required" min="0" value=""/> Example: 5.00</li>
[% INCLUDE 'transaction_types.inc' %]
[% IF Koha.Preference('UseCashRegisters') %]
<li>
[% IF Koha.Preference('RequireCashRegister') %]
<label for="cash_register" class="required">
[% ELSE %]
<label for="cash_register">
[% END %]
Cash register:
</label>
[% IF Koha.Preference('RequireCashRegister') %]
<select name="cash_register" id="cash_register" required>
[% ELSE %]
<select name="cash_register" id="cash_register">
[% END %]
<option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
[% PROCESS options_for_registers %]
</select>
[% IF Koha.Preference('RequireCashRegister') %]
<span class="required">Required</span>
[% END %]
</li>
[% END %]
</ol>
</fieldset>

View file

@ -86,21 +86,25 @@ if ($add) {
my $item = Koha::Items->find( { barcode => $barcode } );
$item_id = $item->itemnumber if $item;
}
my $description = $input->param('desc');
my $note = $input->param('note');
my $amount = $input->param('amount') || 0;
my $type = $input->param('type');
my $description = $input->param('desc');
my $note = $input->param('note');
my $amount = $input->param('amount') || 0;
my $type = $input->param('type');
my $payment_type = $input->param('payment_type');
my $cash_register_id = $input->param('cash_register');
my $line = $patron->account->add_credit(
{
amount => $amount,
description => $description,
item_id => $item_id,
library_id => $library_id,
note => $note,
type => $type,
user_id => $logged_in_user->id,
interface => C4::Context->interface
amount => $amount,
description => $description,
item_id => $item_id,
library_id => $library_id,
note => $note,
type => $type,
user_id => $logged_in_user->id,
interface => C4::Context->interface,
payment_type => $payment_type,
cash_register => $cash_register_id
}
);