Bugzilla – Attachment 175631 Details for
Bug 38457
Add custom field in debit type to allow for external finance system codes to be added
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38457: Add additional fields to debit types
Bug-38457-Add-additional-fields-to-debit-types.patch (text/plain), 6.24 KB, created by
Martin Renvoize (ashimema)
on 2024-12-17 16:43:09 UTC
(
hide
)
Description:
Bug 38457: Add additional fields to debit types
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-12-17 16:43:09 UTC
Size:
6.24 KB
patch
obsolete
>From d6a456ca27080b90e575143f540c5037d1194702 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 17 Dec 2024 14:27:42 +0000 >Subject: [PATCH] Bug 38457: Add additional fields to debit types > >Test plan, k-t-d: >1) Before defining any additional fields for account_debit_types, > confirm that the 'Additional fields' section does not appear when > attempting to add a new or edit an existing debit type. >2) Add a new additional field to 'account_debit_types': > <staff_url>/cgi-bin/koha/admin/additional-fields.pl?tablename=account_debit_types >3) Click 'New field'. Add a name. Click Save. >4) Repeat step 2 but repeatable. Repeat again for 2 more of AV category > (one repeatable, one not repeatable) >5) Edit an account debit type: > <staff_url>/cgi-bin/koha/admin/debit_types.pl?op=add_form&code=MANUAL >6) Input various values in the different additional fields. Click > 'Submit' >7) Edit the same debit type again and note the additional fields added > in the previous step are visible > <staff_url>/cgi-bin/koha/admin/debit_types.pl?op=add_form&code=MANUAL >--- > Koha/Account/DebitType.pm | 2 +- > Koha/Account/DebitTypes.pm | 2 +- > admin/debit_types.pl | 14 ++++++++++++-- > .../prog/en/modules/admin/additional-fields.tt | 7 ++++++- > .../prog/en/modules/admin/debit_types.tt | 5 ++++- > 5 files changed, 24 insertions(+), 6 deletions(-) > >diff --git a/Koha/Account/DebitType.pm b/Koha/Account/DebitType.pm >index 1d5f7f14189..af04a646229 100644 >--- a/Koha/Account/DebitType.pm >+++ b/Koha/Account/DebitType.pm >@@ -22,7 +22,7 @@ use Modern::Perl; > use Koha::Database; > use Koha::Exceptions; > >-use base qw(Koha::Object Koha::Object::Limit::Library); >+use base qw(Koha::Object::Mixin::AdditionalFields Koha::Object Koha::Object::Limit::Library); > > =head1 NAME > >diff --git a/Koha/Account/DebitTypes.pm b/Koha/Account/DebitTypes.pm >index 3860264d50e..200f990a5f6 100644 >--- a/Koha/Account/DebitTypes.pm >+++ b/Koha/Account/DebitTypes.pm >@@ -22,7 +22,7 @@ use Modern::Perl; > use Koha::Database; > use Koha::Account::DebitType; > >-use base qw(Koha::Objects Koha::Objects::Limit::Library); >+use base qw(Koha::Objects::Mixin::AdditionalFields Koha::Objects Koha::Objects::Limit::Library); > > =head1 NAME > >diff --git a/admin/debit_types.pl b/admin/debit_types.pl >index 597afcbf574..925cbc78272 100755 >--- a/admin/debit_types.pl >+++ b/admin/debit_types.pl >@@ -27,6 +27,7 @@ use C4::Output qw( output_html_with_http_headers ); > > use Koha::Account::DebitType; > use Koha::Account::DebitTypes; >+use Koha::AdditionalFields; > > my $input = CGI->new; > my $code = $input->param('code'); >@@ -67,9 +68,14 @@ 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 >+ debit_type => $debit_type, >+ branches_loop => \@branches_loop, >+ additional_fields => \@additional_fields, >+ additional_field_values => @additional_field_values, > ); > } > elsif ( $op eq 'cud-add_validate' ) { >@@ -92,6 +98,10 @@ elsif ( $op eq 'cud-add_validate' ) { > try { > $debit_type->store; > $debit_type->replace_library_limits( \@branches ); >+ >+ my @additional_fields = $debit_type->prepare_cgi_additional_field_values( $input, 'account_debit_types' ); >+ $debit_type->set_additional_fields( \@additional_fields ); >+ > push @messages, { type => 'message', code => 'success_on_saving' }; > } > catch { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt >index 8ccf3bae65a..d542007d7ec 100755 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt >@@ -149,11 +149,16 @@ > [% WRAPPER table_option value="erm_packages" %]Packages[% END %] > </ul> > [% END %] >- [% IF CAN_user_updatecharges_remaining_permissions %] >+ [% IF CAN_user_updatecharges_remaining_permissions || CAN_user_parameters_manage_accounts %] > <h3>Members</h3> > <ul> >+ [% IF CAN_user_updatecharges_remaining_permissions %] > [% WRAPPER table_option value="accountlines:credit" %]Account lines (credit)[% END %] > [% WRAPPER table_option value="accountlines:debit" %]Account lines (debit)[% END %] >+ [% END %] >+ [% IF ( CAN_user_parameters_manage_accounts ) %] >+ [% WRAPPER table_option value="account_debit_types" %]Account debit types[% END %] >+ [% END %] > </ul> > [% END %] > [% IF CAN_user_serials_edit_subscription %] >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 e0aa3a7bd4e..f9486e7251e 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 >@@ -148,7 +148,9 @@ > </li> > </ol> > </fieldset> >- >+ [% IF additional_fields.size %] >+ [% INCLUDE 'additional-fields-entry.inc' available=additional_fields values=additional_field_values wrap_fieldset=1 %] >+ [% END %] > <fieldset class="action"> > <button id="save_debit_type" class="btn btn-primary">Save</button> > <a class="cancel" href="/cgi-bin/koha/admin/debit_types.pl">Cancel</a> >@@ -262,6 +264,7 @@ > > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/admin-menu.js") | $raw %] >+ [% Asset.js("js/additional-fields-entry.js") | $raw %] > [% INCLUDE 'datatables.inc' %] > > <script> >-- >2.47.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38457
:
175630
| 175631 |
175633