From f26a88839850dc46e1ef54040159ccd7aa124179 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 24 Oct 2023 02:16:11 +0000 Subject: [PATCH] Bug 23111: Allow switch to Default framework and use selected default when adding New record This ensures that the correct framework is checked when using the 'Change framework' dropdown in the editor. This also ensures that the selected default framework is used when using the New record button in the Cataloguing home page or from a record detail page. You would also still be able to use the Default framework if chosen. Sponsored-by: Catalyst IT --- Koha/Template/Plugin/Biblio.pm | 6 ++++++ cataloguing/addbiblio.pl | 7 ------- koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc | 7 ++++++- .../prog/en/modules/cataloguing/cataloging-home.tt | 8 ++++++-- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Koha/Template/Plugin/Biblio.pm b/Koha/Template/Plugin/Biblio.pm index 92b130ac102..56bcfe20889 100644 --- a/Koha/Template/Plugin/Biblio.pm +++ b/Koha/Template/Plugin/Biblio.pm @@ -65,4 +65,10 @@ sub RecallsCount { return $recalls->count; } +sub DefaultFramework { + my ($self) = @_; + + return Koha::BiblioFrameworks->get_default; +} + 1; diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 2bf820818f6..a11711afd32 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -807,13 +807,6 @@ if ( $record ne '-1' ) { my $title = C4::Context->preference('marcflavour') eq "UNIMARC" ? $record->subfield('200', 'a') : $record->title; $template->param( title => $title ); } -my $default_framework = Koha::BiblioFrameworks->get_default; -if ( defined $default_framework - && defined $frameworkcode - && $frameworkcode eq '' ) -{ - $frameworkcode = $default_framework->frameworkcode; -} $template->param( popup => $mode, frameworkcode => $frameworkcode, diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc index 03bcb38059e..eec16779901 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc @@ -1,4 +1,5 @@ [% USE Context %] +[% USE Biblio %] [% INCLUDE 'blocking_errors.inc' %]
@@ -7,7 +8,11 @@
@@ -233,7 +237,7 @@ $(document).ready(function() { $("#newRecord").click(function(){ - var url = $("a#newRecordDefault").prop("href"); + var url = $("#default-framework") ? $("#default-framework").prop("href") : $("a#newRecordDefault").prop("href"); window.location.href = url; return false; }); -- 2.30.2