Bug 35044: Update: Manual invoices, manual credits and accountlines

Test plan, k-t-d:

Preparation: Create additional fields for table 'accountlines:credit',
visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=accountlines%3Acredit

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new manual credit for admin borrower:
/cgi-bin/koha/members/mancredit.pl?borrowernumber=51
2) Set the mandatory "Amount" input (e.g. '5'). Click the 'Next' and
   press 'Ok' on the alert box.
3) Fill in all additional fields, click the '+New' and 'Clear' links,
   hit 'Save'
4) On the table, click "Details" for the for account line we just
   created.
5) Notice the additional fields are there, repeated fields are comma
   separated.
6) Repeat the above test plan, but for accountlines:debit instead,
   visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=accountlines%3Adebit
7) To add a manual invoice, visit:
   /cgi-bin/koha/members/maninvoice.pl?borrowernumber=51

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Pedro Amorim 2023-10-17 13:02:22 +00:00 committed by Katrin Fischer
parent 2fec74f6d1
commit 10b9888936
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
8 changed files with 25 additions and 29 deletions

View file

@ -68,7 +68,6 @@
[% IF accountline %]
<div class="page-section">
[% af_values = accountline.additional_field_values %]
[% IF accountline.credit_type_code %]
<h2>Details of credit</h2>
[% ELSIF accountline.debit_type_code %]
@ -84,8 +83,8 @@
<th>Due date</th>
<th>Return date</th>
<th>Note</th>
[% FOREACH value IN af_values %]
<th>[% value.field.name | html %]</th>
[% FOREACH field IN available_additional_fields %]
<th>[% field.name | html %]</th>
[% END %]
<th>Amount</th>
<th>Outstanding</th>
@ -135,16 +134,7 @@
<td>
[% accountline.note | html_line_break %]
</td>
[% FOREACH value IN af_values %]
<td>
[% IF value.field.authorised_value_category %]
[% AuthorisedValues.GetByCode( value.field.authorised_value_category, value.value ) | html %]
[% ELSE %]
[% value.value | html %]
[% END %]
</td>
[% END %]
[% INCLUDE 'additional-fields-display.inc' available=available_additional_fields values=additional_field_values value_only=1 is_table_cell=1 %]
<td>
[% accountline.amount | $Price %]

View file

@ -136,6 +136,7 @@
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") | $raw %]
[% Asset.js("js/additional-fields-entry.js") | $raw %]
<script>
$(document).ready(function(){
$('#mancredit').preventDoubleFormSubmit();

View file

@ -130,6 +130,7 @@
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") | $raw %]
[% Asset.js("js/additional-fields-entry.js") | $raw %]
<script>
var type_fees = {};
[% FOREACH debit_type IN debit_types %]

View file

@ -434,6 +434,7 @@
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") | $raw %]
[% Asset.js("js/additional-fields-entry.js") | $raw %]
<script>
$(document).ready(function() {
[% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]

View file

@ -60,6 +60,9 @@ if ($accountline) {
$template->param(
accountline => $accountline,
account_offsets => $account_offsets,
additional_field_values => $accountline->get_additional_field_values_for_template,
available_additional_fields => Koha::AdditionalFields->search(
{ tablename => $accountline->credit_type_code ? 'accountlines:credit' : 'accountlines:debit' } ),
);
my $patron = Koha::Patrons->find( $accountline->borrowernumber );

View file

@ -102,12 +102,12 @@ if ( $op eq 'cud-add' ) {
my @additional_fields;
my $accountline_fields = Koha::AdditionalFields->search({ tablename => 'accountlines:credit' });
while ( my $field = $accountline_fields->next ) {
my $value = $input->param('additional_field_' . $field->id);
if (defined $value) {
my @field_values = $input->param( 'additional_field_' . $field->id );
foreach my $value (@field_values) {
push @additional_fields, {
id => $field->id,
id => $field->id,
value => $value,
};
} if $value;
}
}
if (@additional_fields) {

View file

@ -164,12 +164,12 @@ if ( $op eq 'cud-add' ) {
my @additional_fields;
my $accountline_fields = Koha::AdditionalFields->search({ tablename => 'accountlines:debit' });
while ( my $field = $accountline_fields->next ) {
my $value = $input->param('additional_field_' . $field->id);
if (defined $value) {
my @field_values = $input->param( 'additional_field_' . $field->id );
foreach my $value (@field_values) {
push @additional_fields, {
id => $field->id,
id => $field->id,
value => $value,
};
} if $value;
}
}
if (@additional_fields) {

View file

@ -173,12 +173,12 @@ if ( $total_paid and $total_paid ne '0.00' ) {
my @additional_fields;
my $accountline_fields = Koha::AdditionalFields->search({ tablename => 'accountlines:credit' });
while ( my $field = $accountline_fields->next ) {
my $value = $input->param('additional_field_' . $field->id);
if (defined $value) {
my @field_values = $input->param( 'additional_field_' . $field->id );
foreach my $value (@field_values) {
push @additional_fields, {
id => $field->id,
id => $field->id,
value => $value,
};
} if $value;
}
}
if (@additional_fields) {
@ -251,12 +251,12 @@ if ( $total_paid and $total_paid ne '0.00' ) {
my @additional_fields;
my $accountline_fields = Koha::AdditionalFields->search({ tablename => 'accountlines:credit' });
while ( my $field = $accountline_fields->next ) {
my $value = $input->param('additional_field_' . $field->id);
if (defined $value) {
my @field_values = $input->param( 'additional_field_' . $field->id );
foreach my $value (@field_values) {
push @additional_fields, {
id => $field->id,
id => $field->id,
value => $value,
};
} if $value;
}
}
if (@additional_fields) {