From d1b34ec48ea133e2f517c87f02a07f02a13a02ce Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Fri, 1 Dec 2023 16:30:34 +0000 Subject: [PATCH] Bug 35471: Add support for selecting parent framework on MARC framework modification screen To test: 1. Navigate to Administration -> MARC bibliographic framework 2. Create MARC framework with frameworkcode "A" 3. Observe new field "Parent framework" when adding a new framework 4. After adding the framework, click Actions -> MARC structure 5. Select "Create framework for A" using "Default", click OK 6. Navigate back to frameworks listing 7. Create framework with frameworkcode "A-1" 8. Select framework you created at step 2 as the parent framework 9. After adding the framework, click Actions -> MARC structure 10. Select "Create framework for A-1" using "Default", click OK --- admin/biblio_framework.pl | 10 +++++++++- .../prog/en/modules/admin/biblio_framework.tt | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/admin/biblio_framework.pl b/admin/biblio_framework.pl index ecad5c2bb2b..60112ee5e31 100755 --- a/admin/biblio_framework.pl +++ b/admin/biblio_framework.pl @@ -45,19 +45,26 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( my $dbh = C4::Context->dbh; if ( $op eq 'add_form' ) { + my $frameworks = Koha::BiblioFrameworks->search( {}, { order_by => ['frameworktext'], } ); my $framework; if ($frameworkcode) { $framework = Koha::BiblioFrameworks->find($frameworkcode); } - $template->param( framework => $framework ); + $template->param( + framework => $framework, + frameworks => $frameworks, + ); } elsif ( $op eq 'cud-add_validate' ) { my $frameworkcode = $input->param('frameworkcode'); my $frameworktext = $input->param('frameworktext'); my $is_a_modif = $input->param('is_a_modif'); + my $parent_frameworkcode = $input->param('parent_frameworkcode'); + $parent_frameworkcode = undef if $input->param('parent_frameworkcode') eq '__undef__'; if ($is_a_modif) { my $framework = Koha::BiblioFrameworks->find($frameworkcode); $framework->frameworktext($frameworktext); + $framework->parent_frameworkcode($parent_frameworkcode); eval { $framework->store; }; if ($@) { push @messages, { type => 'error', code => 'error_on_update' }; @@ -69,6 +76,7 @@ if ( $op eq 'add_form' ) { { frameworkcode => $frameworkcode, frameworktext => $frameworktext, + parent_frameworkcode => $parent_frameworkcode, } ); eval { $framework->store; }; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt index b4a85fe0217..5b0b0fab648 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt @@ -129,6 +129,22 @@ Required + [% END %] +
  • + [% IF frameworks %] + + +
  • [% END %]
  • -- 2.34.1