From de8cb53df3bc0aa093e1ee1c17434f9b809fe09d 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 | 5 +++ .../prog/en/modules/authorities/authorities.tt | 39 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/authorities/authorities.pl b/authorities/authorities.pl index 538f7cdb7b9..34554b5ecee 100755 --- a/authorities/authorities.pl +++ b/authorities/authorities.pl @@ -543,6 +543,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; @@ -634,6 +635,10 @@ if ($op eq "duplicate") { $authid = ""; } + if($changed_authtype eq "changed"){ + $record = TransformHtmlToMarc( $input, 0 ); + } + build_tabs ($template, $record, $dbh, $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 947821c647f..06a3e0549f4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt @@ -79,6 +79,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 ){ @@ -314,6 +324,7 @@ +
@@ -325,6 +336,34 @@ [% END %]
+ + +
+
[% IF ( authid ) %] Cancel [% ELSE %] -- 2.11.0