From 389fa92767869282be0f2158c8c31e220f18e113 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 Sponsored-by: Hypernova Oy --- admin/biblio_framework.pl | 10 +++++++++- .../prog/en/modules/admin/biblio_framework.tt | 12 ++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/admin/biblio_framework.pl b/admin/biblio_framework.pl index d8988e0ecd..7c2ed46885 100755 --- a/admin/biblio_framework.pl +++ b/admin/biblio_framework.pl @@ -44,19 +44,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 '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' }; @@ -67,6 +74,7 @@ if ( $op eq 'add_form' ) { my $framework = Koha::BiblioFramework->new( { 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 540988a26d..dc42c953c2 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 @@ -130,6 +130,18 @@ Required [% END %] +
  • + [% IF frameworks %] + + +
  • + [% END %]
  • -- 2.34.1