From 45cf9fce9128c1bec4ae64865a04582cd4a14f56 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 15 Mar 2021 14:51:25 +1300 Subject: [PATCH] Bug 30930: Ability to change auth type while editing record This patch adds the ability to change the authority MARC framework/type being used while editing an authority record. To test: 1) Log into the staff client and go to Authorities 2) Search for an existing authority and edit it 3) Notice there is no way to change this authority type 4) Apply patch, restart services, refresh editor in browser 5) Notice the new Settings dropdown. Click to open 6) Confirm the correct current authority type is selected 7) Select another type to change to that. The page should reload 8) Confirm the page reloads with the correct authority type framework loaded and the MARC data is still correct Sponsored-by: Education Services Australia SCIS --- authorities/authorities.pl | 7 +++- .../prog/en/modules/authorities/authorities.tt | 39 ++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/authorities/authorities.pl b/authorities/authorities.pl index e4063d9d94..507c6bc0ac 100755 --- a/authorities/authorities.pl +++ b/authorities/authorities.pl @@ -550,6 +550,7 @@ my $myindex = $input->param('index'); my $linkid=$input->param('linkid'); my $authtypecode = $input->param('authtypecode'); my $breedingid = $input->param('breedingid'); +my $changed_authtype = $input->param('changed_authtype') // q{}; my $dbh = C4::Context->dbh; @@ -618,7 +619,7 @@ if ($op eq "add") { } exit; } else { - # it may be a duplicate, warn the user and do nothing + # it may be a duplicate, warn the user and do nothing build_tabs($template, $record, $dbh, $encoding,$input); build_hidden_data; $template->param(authid =>$authid, @@ -640,6 +641,10 @@ if ($op eq "duplicate") { $authid = ""; } + if($changed_authtype eq "changed"){ + $record = TransformHtmlToMarc( $input, 0 ); + } + build_tabs ($template, $record, $dbh,$encoding,$input); build_hidden_data; $template->param(oldauthtypetagfield=>$oldauthtypetagfield, oldauthtypetagsubfield=>$oldauthtypetagsubfield, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt index 548b841aa1..d0cb76d48c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt @@ -78,6 +78,16 @@ selectTab( tablink ); window.scrollTo( 0, getScrollto( field, "toolbar" ) ); }); + + $(".change-authtype").on("click", function(){ + var authtypecode = $(this).data("authtypecode"); + var f = document.f; + f.op.value = "[% op | html %]"; + f.authid.value = "[% authid | html %]"; + f.changed_authtype.value = "changed"; + f.authtypecode.value = authtypecode; + f.submit(); + }); }); function selectTab( tablink ){ @@ -311,6 +321,7 @@ +
@@ -322,6 +333,34 @@ [% END %]
+ + +
+
[% IF ( authid ) %] Cancel [% ELSE %] -- 2.11.0