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
Signed-off-by: Jacob O'Mara <jacob.omara@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Aleisha Amohia 2021-03-15 14:51:25 +13:00 committed by Tomas Cohen Arazi
parent aba00f6cb3
commit cc61cd6313
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
2 changed files with 44 additions and 0 deletions

View File

@ -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,

View File

@ -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 @@
<input type="hidden" name="authid" value="[% authid | html %]" />
<input type="hidden" name="index" value="[% index | html %]" />
<input type="hidden" value="0" id="confirm_not_duplicate" name="confirm_not_duplicate" />
<input type="hidden" name="changed_authtype" value="" />
<div id="toolbar" class="btn-toolbar">
<div class="btn-group"><a href="#" id="addauth" class="btn btn-primary" accesskey="w"><i class="fa fa-save"></i> Save</a></div>
@ -324,6 +335,34 @@
<a class="btn btn-default" id="z3950submit" href="#"><i class="fa fa-search"></i> Z39.50/SRU search</a>
[% END %]
</div>
<div class="btn-group">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-cog"></i> Settings <span class="caret"></span></button>
<ul id="settings-menu" class="dropdown-menu">
<li class="dropdown-header">Change authority type</li>
<li>
<a href="#" class="change-authtype" data-authtypecode="">
[% IF ( authtypecode ) %]
<i class="fa fa-fw">&nbsp;</i>
[% ELSE %]
<i class="fa fa-fw fa-check"></i>
[% END %]
Default
</a>
</li>
[% FOREACH authority_type IN authority_types %]
<li>
<a href="#" class="change-authtype" data-authtypecode="[% authority_type.authtypecode | html %]">
[% IF authority_type.authtypecode == authtypecode %]
<i class="fa fa-fw fa-check"></i>
[% ELSE %]
<i class="fa fa-fw">&nbsp;</i>
[% END %]
[% authority_type.authtypetext | html %]
</a>
</li>
[% END %]
</ul> <!-- /#settings-menu -->
</div> <!-- /.btn-group -->
<div class="btn-group">
[% IF ( authid ) %]
<a class="btn btn-default" id="cancel" href="/cgi-bin/koha/authorities/detail.pl?authid=[% authid | url %]">Cancel</a>