@@ -, +, @@ --- Koha/BiblioFramework.pm | 18 ++++++++++++++++ admin/preferences.pl | 9 ++++++++ cataloguing/addbiblio.pl | 8 +++++++- ...r290627_set_default_bibliographic_framework.sql | 1 + .../en/modules/admin/preferences/cataloguing.pref | 5 +++++ .../prog/en/modules/tools/manage-marc-import.tt | 24 +++++++++++++++------- tools/manage-marc-import.pl | 6 ++++++ 7 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/wr290627_set_default_bibliographic_framework.sql --- a/Koha/BiblioFramework.pm +++ a/Koha/BiblioFramework.pm @@ -41,4 +41,22 @@ sub _type { return 'BiblioFramework'; } +=head2 GetFrameworkSources + my $sources = GetFrameworkSources(); + + Returns reference to hash of references to + the framework sources, keyed on frameworkcode. +=cut + +sub GetFrameworkSources { + my %framework_sources = (); + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare("SELECT * FROM `biblio_framework`"); + $sth->execute(); + while (my $source = $sth->fetchrow_hashref) { + $framework_sources{ $source->{'frameworkcode'} } = $source; + } + return \%framework_sources; + } + 1; --- a/admin/preferences.pl +++ a/admin/preferences.pl @@ -29,6 +29,7 @@ use C4::Log; use C4::Output; use C4::Templates; use Koha::Acquisition::Currencies; +use Koha::BiblioFramework; use File::Spec; use IO::File; use YAML::Syck qw(); @@ -89,6 +90,14 @@ sub _get_chunk { if ( $options{'choices'} eq 'class-sources' ) { my $sources = GetClassSources(); $options{'choices'} = { map { $_ => $sources->{$_}->{'description'} } keys %$sources }; + } elsif ( $options{'choices'} eq 'framework-sources' ) { + my $sources = Koha::BiblioFramework::GetFrameworkSources(); + + #Add framework to syspref dropdown with a frameworkcode of 'Default' so users can choose to not use + #custom bibliographic frameworks as default bib framework + $sources->{'Default'}->{'frameworkcode'} = 'Default'; + + $options{'choices'} = { map { $_ => $sources->{$_}->{'frameworkcode'} } keys %$sources }; } elsif ( $options{'choices'} eq 'opac-templates' ) { $options{'choices'} = { map { $_ => $_ } getallthemes( 'opac' ) } } elsif ( $options{'choices'} eq 'staff-templates' ) { --- a/cataloguing/addbiblio.pl +++ a/cataloguing/addbiblio.pl @@ -35,6 +35,7 @@ use C4::ClassSource; use C4::ImportBatch; use C4::Charset; use Koha::BiblioFrameworks; +use Koha::BiblioFramework; use Koha::DateUtils; use Koha::ItemTypes; @@ -709,7 +710,12 @@ if ($frameworkcode eq 'FA'){ $userflags = 'fast_cataloging'; } -$frameworkcode = '' if ( $frameworkcode eq 'Default' ); +if (( C4::Context->preference("DefaultBibliographicFramework") && C4::Context->preference("DefaultBibliographicFramework") ne 'Default' )) { + $frameworkcode = C4::Context->preference("DefaultBibliographicFramework"); +} else { + $frameworkcode = '' if ( $frameworkcode eq 'Default' ); +} + my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => "cataloguing/addbiblio.tt", --- a/installer/data/mysql/atomicupdate/wr290627_set_default_bibliographic_framework.sql +++ a/installer/data/mysql/atomicupdate/wr290627_set_default_bibliographic_framework.sql @@ -0,0 +1, @@ +INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('DefaultBibliographicFramework','Default',NULL,'Default bibliographic framework used by the Cataloging framework','FrameworkSources'); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref @@ -7,6 +7,11 @@ Cataloging: choices: class-sources - as the default classification source. - + - Use + - pref: DefaultBibliographicFramework + choices: framework-sources + - as the default bibliographic framework to be used by cataloging module. + - - pref: advancedMARCeditor choices: yes: "Don't display" --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt @@ -1,5 +1,6 @@ [% USE raw %] [% USE Asset %] +[% USE Koha %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %]