From c18c910162cb9d3c7c7599926fe79f784ed1645b Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 17 Dec 2024 17:05:43 +0000 Subject: [PATCH] Bug 38457: Add additional fields to debit display This patch adds the previously added additional fields to the display in the debit types management page table Sponsored-by: PTFS Europe Signed-off-by: Laura_Escamilla --- admin/debit_types.pl | 5 +- .../prog/en/modules/admin/debit_types.tt | 428 +++++++++--------- 2 files changed, 224 insertions(+), 209 deletions(-) diff --git a/admin/debit_types.pl b/admin/debit_types.pl index 6b19f3d8c0..03211d47da 100755 --- a/admin/debit_types.pl +++ b/admin/debit_types.pl @@ -43,6 +43,9 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); +my @additional_fields = Koha::AdditionalFields->search( { tablename => 'account_debit_types' } )->as_list; +$template->param( additional_fields => \@additional_fields, ); + my $debit_type; if ($code) { $debit_type = Koha::Account::DebitTypes->find($code); @@ -67,13 +70,11 @@ if ( $op eq 'add_form' ) { }; } - my @additional_fields = Koha::AdditionalFields->search( { tablename => 'account_debit_types' } )->as_list; my @additional_field_values = $debit_type ? $debit_type->get_additional_field_values_for_template : (); $template->param( debit_type => $debit_type, branches_loop => \@branches_loop, - additional_fields => \@additional_fields, additional_field_values => @additional_field_values, ); } elsif ( $op eq 'cud-add_validate' ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt index 17487e6831..458cdc309b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt @@ -7,18 +7,20 @@ [% SET footerjs = 1 %] [% PROCESS 'accounts.inc' %] [% INCLUDE 'doc-head-open.inc' %] -[% FILTER collapse %] - [% IF op =='add_form' %] - [% IF debit_type.code %] - [% tx("Modify debit type '{debit_type}'", { debit_type = debit_type.code }) | html %] - [% ELSE %] - [% t("New debit type") | html %] - [% END %] › - [% END %] - [% t("Debit types") | html %] › - [% t("Administration") | html %] › - [% t("Koha") | html %] -[% END %] +[% FILTER collapse %] + [% IF op =='add_form' %] + [% IF debit_type.code %] + [% tx("Modify debit type '{debit_type}'", { debit_type = debit_type.code }) | html %] + [% ELSE %] + [% t("New debit type") | html %] + [% END %] + › + [% END %] + [% t("Debit types") | html %] + › [% t("Administration") | html %] › [% t("Koha") | html %] + [% END %] [% INCLUDE 'doc-head-close.inc' %] @@ -44,7 +46,6 @@ New debit type [% END %] [% END %] - [% ELSE %] [% WRAPPER breadcrumb_item bc_active= 1 %] Debit types @@ -55,209 +56,222 @@ [% WRAPPER 'main-container.inc' aside='admin-menu' %] - [% FOREACH m IN messages %] -
- [% SWITCH m.code %] - [% CASE 'success_on_saving' %] - Debit type saved successfully. - [% CASE 'error_on_saving' %] - An error occurred when saving this debit type. Check the logs for details. - [% CASE 'success_on_archive' %] - Debit type archived successfully. - [% CASE 'success_on_restore' %] - Debit type restored successfully. - [% CASE %] - [% m.code | html %] - [% END %] -
- [% END %] + [% FOREACH m IN messages %] +
+ [% SWITCH m.code %] + [% CASE 'success_on_saving' %] + Debit type saved successfully. + [% CASE 'error_on_saving' %] + An error occurred when saving this debit type. Check the logs for details. + [% CASE 'success_on_archive' %] + Debit type archived successfully. + [% CASE 'success_on_restore' %] + Debit type restored successfully. + [% CASE %] + [% m.code | html %] + [% END %] +
+ [% END %] - [% IF op == 'add_form' %] - [% IF debit_type %] -

[% tx("Modify debit type '{debit_type}'", { debit_type = debit_type.code }) | html %]

- [% ELSE %] -

New debit type

- [% END %] + [% IF op == 'add_form' %] + [% IF debit_type %] +

[% tx("Modify debit type '{debit_type}'", { debit_type = debit_type.code }) | html %]

+ [% ELSE %] +

New debit type

+ [% END %] -
- [% INCLUDE 'csrf-token.inc' %] - -
-
    -
  1. - - [% IF debit_type %] - [% debit_type.code | html %] - - [% ELSE %] - Required. Maximum length is 64 letters - [% END %] -
  2. -
  3. - - -
  4. -
  5. - - [% IF debit_type && debit_type.is_system %] - [%- PROCESS debit_type_description debit_type = debit_type -%] - [% ELSE %] - Required - [% END %] -
  6. -
  7. - - [% IF debit_type.can_be_invoiced %] - - [% ELSE %] - - [% END %] -
  8. -
  9. - - [% IF debit_type.can_be_sold %] - - [% ELSE %] - - [% END %] -
  10. -
  11. - - [% IF debit_type.restricts_checkouts %] - - [% ELSE %] - - [% END %] -
  12. -
  13. - - -
    Select 'All libraries' if this debit type should be available at all libraries. Otherwise select libraries you want to associate debit type with.
    -
  14. -
-
- [% IF additional_fields.size %] - [% INCLUDE 'additional-fields-entry.inc' available=additional_fields values=additional_field_values wrap_fieldset=1 %] + + [% INCLUDE 'csrf-token.inc' %] + +
+
    +
  1. + + [% IF debit_type %] + [% debit_type.code | html %] + + [% ELSE %] + Required. Maximum length is 64 letters [% END %] -
    - - Cancel -
    -
  2. - [% END %] + +
  3. + + +
  4. +
  5. + + [% IF debit_type && debit_type.is_system %] + [%- PROCESS debit_type_description debit_type = debit_type -%] + [% ELSE %] + Required + [% END %] +
  6. +
  7. + + [% IF debit_type.can_be_invoiced %] + + [% ELSE %] + + [% END %] +
  8. +
  9. + + [% IF debit_type.can_be_sold %] + + [% ELSE %] + + [% END %] +
  10. +
  11. + + [% IF debit_type.restricts_checkouts %] + + [% ELSE %] + + [% END %] +
  12. +
  13. + + +
    Select 'All libraries' if this debit type should be available at all libraries. Otherwise select libraries you want to associate debit type with.
    +
  14. +
+
+ [% IF additional_fields.size %] + [% INCLUDE 'additional-fields-entry.inc' available=additional_fields values=additional_field_values wrap_fieldset=1 %] + [% END %] +
+ + Cancel +
+ + [% END %] - [% IF op == 'list' %] - + [% IF op == 'list' %] + -

Debit types

- [% IF debit_types.count %] -
- - - - - - - - - - - - - - [% FOREACH debit_type IN debit_types %] - - - - - - - + + + + [% END %] + +
ArchivedSystemCodeDescriptionDefault amountAvailable forLibrary limitationsBlocks checkouts?Actions
[% debit_type.archived | html %][% debit_type.is_system | html %][% debit_type.code | html %][%- PROCESS debit_type_description debit_type = debit_type -%][% debit_type.default_amount | $Price %][% IF debit_type.can_be_invoiced && debit_type.can_be_sold %] - Invoicing, Sale - [% ELSIF debit_type.can_be_invoiced %] - Invoicing - [% ELSIF debit_type.can_be_sold %] - Sale +

Debit types

+ [% IF debit_types.count %] +
+ + + + + + + [% IF additional_fields.size %] + + [% END %] + + + + + + + + [% FOREACH debit_type IN debit_types %] + + + + + + [% IF additional_fields.size %] + - + [% END %] + + + - - - + + [% ELSE %] + No limitation [% END %] - -
ArchivedSystemCodeDescriptionAdditional fieldsDefault amountAvailable forLibrary limitationsBlocks checkouts?Actions
[% debit_type.archived | html %][% debit_type.is_system | html %][% debit_type.code | html %][%- PROCESS debit_type_description debit_type = debit_type -%] + [% IF debit_type.additional_field_values.count > 0 %] + [% FOREACH additional_field IN debit_type.additional_field_values %] +
[% additional_field.field.name | html %]: [% additional_field.value | html %]
[% END %] -
- [% IF debit_type.library_limits.count > 0 %] - [% library_limits_str = "" %] - [% FOREACH library IN debit_type.library_limits %] - [%- IF loop.first -%] - [% library_limits_str = library.branchname _ " (" _ library.branchcode _ ")" %] - [% ELSE %] - [% library_limits_str = library_limits_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %] - [% END %] - [% END %] - - [% IF debit_type.library_limits.count > 1 %] - [% debit_type.library_limits.count | html %] library limitations - [% ELSE %] - [% debit_type.library_limits.count | html %] library limitation - [% END %] + [% ELSE %] + No additional fields + [% END %] + [% debit_type.default_amount | $Price %][% IF debit_type.can_be_invoiced && debit_type.can_be_sold %] + Invoicing, Sale + [% ELSIF debit_type.can_be_invoiced %] + Invoicing + [% ELSIF debit_type.can_be_sold %] + Sale + [% END %] + + [% IF debit_type.library_limits.count > 0 %] + [% library_limits_str = "" %] + [% FOREACH library IN debit_type.library_limits %] + [%- IF loop.first -%] + [% library_limits_str = library.branchname _ " (" _ library.branchcode _ ")" %] [% ELSE %] - No limitation + [% library_limits_str = library_limits_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %] [% END %] - - [% IF debit_type.restricts_checkouts %] - Yes + [% END %] + + [% IF debit_type.library_limits.count > 1 %] + [% debit_type.library_limits.count | html %] library limitations [% ELSE %] - No - [% END %] - - [% IF !debit_type.archived %] - Edit - [% IF !debit_type.is_system %] -
- [% INCLUDE 'csrf-token.inc' %] - - - -
- [% END %] - [% ELSIF debit_type.archived %] -
- [% INCLUDE 'csrf-token.inc' %] - - - -
+ [% debit_type.library_limits.count | html %] library limitation [% END %] -
-
- [% ELSE %] -
- There are no account debit types defined. Create new debit type -
- [% END %] - [% END %] +
+ [% IF debit_type.restricts_checkouts %] + Yes + [% ELSE %] + No + [% END %] + + [% IF !debit_type.archived %] + Edit + [% IF !debit_type.is_system %] +
+ [% INCLUDE 'csrf-token.inc' %] + + + +
+ [% END %] + [% ELSIF debit_type.archived %] +
+ [% INCLUDE 'csrf-token.inc' %] + + + +
+ [% END %] +
+ [% ELSE %] +
There are no account debit types defined. Create new debit type
+ [% END %] + [% END %] [% END %] [% MACRO jsinclude BLOCK %] [% Asset.js("js/admin-menu.js") | $raw %] [% Asset.js("js/additional-fields-entry.js") | $raw %] [% INCLUDE 'datatables.inc' %] - [% END %] -- 2.39.5