From 235aecb3cfc21c7fff2ff4dbbaa6ec3b01ed684e Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Sun, 25 Oct 2020 16:35:50 +1300 Subject: [PATCH] Bug 23111: (follow-up) set default framework on advanced editor This patch ensures the advanced editor considers the default biblio framework. Also fixing bug in atomic update --- .../bug-23111_add-is_default-column-to-biblio_framework.perl | 2 +- koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js | 7 ++++++- koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/editor.tt | 6 +++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug-23111_add-is_default-column-to-biblio_framework.perl b/installer/data/mysql/atomicupdate/bug-23111_add-is_default-column-to-biblio_framework.perl index 42494040759..6655b250980 100644 --- a/installer/data/mysql/atomicupdate/bug-23111_add-is_default-column-to-biblio_framework.perl +++ b/installer/data/mysql/atomicupdate/bug-23111_add-is_default-column-to-biblio_framework.perl @@ -1,6 +1,6 @@ $DBversion = 'XXX'; # will be replaced by the RM if( CheckVersion( $DBversion ) ) { - if( !column_exists( 'biblio_framework', 'default' ) ) { + if( !column_exists( 'biblio_framework', 'is_default' ) ) { $dbh->do(q{ALTER TABLE biblio_framework ADD is_default TINYINT(1) default 0 NOT NULL AFTER frameworktext}); } NewVersion( $DBversion, 23111, "Add is_default column to biblio_framework table"); diff --git a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js index fb0bac5d982..817a23b2e99 100644 --- a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js +++ b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js @@ -686,8 +686,13 @@ define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ], displayRecord: function( record ) { this.cm.setValue( TextMARC.RecordToText(record) ); this.modified = false; + var fwcode = typeof record.frameworkcode !== 'undefined' ? record.frameworkcode : ''; + var defaultfw = $("a[data-default='Y']").data('frameworkcode'); + if ( typeof record.frameworkcode === 'undefined' && defaultfw ){ + fwcode = defaultfw; + } this.setFrameworkCode( - typeof record.frameworkcode !== 'undefined' ? record.frameworkcode : '', + fwcode, false, function ( error ) { if ( typeof error !== 'undefined' ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/editor.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/editor.tt index d28822651fc..0922f5359ea 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/editor.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/editor.tt @@ -56,7 +56,11 @@ [% FOREACH framework IN frameworks %]
  • - + [% IF framework.is_default %] + + [% ELSE %] + + [% END %]   [% framework.frameworktext | html %] -- 2.11.0