Bug 15381: Remove getauthtypes and getauthtype
These 2 subroutines are now not necessary anymore, we can use Koha::Authority::Types to retrieve the authority types. This patch won't be easy to test. Indeed, a lot of file are updated. To test it I would suggest to focus on the merge authority You should also confirm that the authtypecode and the authtypetext values are correctly displayed when navigating in the authority module. Signed-off-by: Frédéric Demians <f.demians@tamil.fr> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
This commit is contained in:
parent
e28d54f7d9
commit
7283069a9d
|
|
@ -27,6 +27,7 @@ use C4::AuthoritiesMarc::UNIMARC;
|
|||
use C4::Charset;
|
||||
use C4::Log;
|
||||
use Koha::MetadataRecord::Authority;
|
||||
use Koha::Authority::Types;
|
||||
|
||||
use vars qw($VERSION @ISA @EXPORT);
|
||||
|
||||
|
|
|
|||
63
C4/Koha.pm
63
C4/Koha.pm
|
|
@ -47,7 +47,6 @@ BEGIN {
|
|||
&get_itemtypeinfos_of
|
||||
&getframeworks &getframeworkinfo
|
||||
&GetFrameworksLoop
|
||||
&getauthtypes &getauthtype
|
||||
&getallthemes
|
||||
&getFacets
|
||||
&displayServers
|
||||
|
|
@ -355,68 +354,6 @@ END_SQL
|
|||
return get_infos_of( $query, 'itemtype', undef, \@itemtypes );
|
||||
}
|
||||
|
||||
=head2 getauthtypes
|
||||
|
||||
$authtypes = &getauthtypes();
|
||||
|
||||
Returns information about existing authtypes.
|
||||
|
||||
build a HTML select with the following code :
|
||||
|
||||
=head3 in PERL SCRIPT
|
||||
|
||||
my $authtypes = getauthtypes;
|
||||
my @authtypesloop;
|
||||
foreach my $thisauthtype (keys %$authtypes) {
|
||||
my $selected = 1 if $thisauthtype eq $authtype;
|
||||
my %row =(value => $thisauthtype,
|
||||
selected => $selected,
|
||||
authtypetext => $authtypes->{$thisauthtype}->{'authtypetext'},
|
||||
);
|
||||
push @authtypesloop, \%row;
|
||||
}
|
||||
$template->param(itemtypeloop => \@itemtypesloop);
|
||||
|
||||
=head3 in TEMPLATE
|
||||
|
||||
<form action='<!-- TMPL_VAR name="script_name" -->' method=post>
|
||||
<select name="authtype">
|
||||
<!-- TMPL_LOOP name="authtypeloop" -->
|
||||
<option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="authtypetext" --></option>
|
||||
<!-- /TMPL_LOOP -->
|
||||
</select>
|
||||
<input type=text name=searchfield value="<!-- TMPL_VAR name="searchfield" -->">
|
||||
<input type="submit" value="OK" class="button">
|
||||
</form>
|
||||
|
||||
|
||||
=cut
|
||||
|
||||
sub getauthtypes {
|
||||
|
||||
# returns a reference to a hash of references to authtypes...
|
||||
my %authtypes;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $sth = $dbh->prepare("select * from auth_types order by authtypetext");
|
||||
$sth->execute;
|
||||
while ( my $IT = $sth->fetchrow_hashref ) {
|
||||
$authtypes{ $IT->{'authtypecode'} } = $IT;
|
||||
}
|
||||
return ( \%authtypes );
|
||||
}
|
||||
|
||||
sub getauthtype {
|
||||
my ($authtypecode) = @_;
|
||||
|
||||
# returns a reference to a hash of references to authtypes...
|
||||
my %authtypes;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $sth = $dbh->prepare("select * from auth_types where authtypecode=?");
|
||||
$sth->execute($authtypecode);
|
||||
my $res = $sth->fetchrow_hashref;
|
||||
return $res;
|
||||
}
|
||||
|
||||
=head2 getframework
|
||||
|
||||
$frameworks = &getframework();
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@ use C4::Context;
|
|||
use C4::Output;
|
||||
use C4::Context;
|
||||
|
||||
use Koha::Authority::Types;
|
||||
|
||||
# retrieve parameters
|
||||
my $input = new CGI;
|
||||
my $authtypecode = $input->param('authtypecode') || ''; # set to select framework
|
||||
my $existingauthtypecode = $input->param('existingauthtypecode') || ''; # set when we have to create a new framework (in authtype) by copying an old one (in existingauthtype)
|
||||
|
||||
# my $authtypeinfo = getauthtypeinfo($authtype);
|
||||
my $searchfield = $input->param('searchfield') || 0;
|
||||
my $offset = $input->param('offset') || 0;
|
||||
my $op = $input->param('op') || '';
|
||||
|
|
@ -54,16 +54,7 @@ my ($template, $loggedinuser, $cookie)
|
|||
debug => 1,
|
||||
});
|
||||
|
||||
# get authtype list
|
||||
my $authtypes = getauthtypes;
|
||||
my @authtypesloop = ();
|
||||
foreach my $thisauthtype ( sort keys %{$authtypes} ) {
|
||||
push @authtypesloop,
|
||||
{ value => $thisauthtype,
|
||||
selected => $thisauthtype eq $authtypecode,
|
||||
authtypetext => $authtypes->{$thisauthtype}->{'authtypetext'},
|
||||
};
|
||||
}
|
||||
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypecode'] } );
|
||||
|
||||
my $sth;
|
||||
# check that authtype framework is defined in auth_tag_structure if we are on a default action
|
||||
|
|
@ -83,7 +74,7 @@ if (!$op or $op eq 'authtype_create_confirm') {
|
|||
}
|
||||
}
|
||||
$template->param(script_name => $script_name);
|
||||
$template->param(authtypeloop => \@authtypesloop);
|
||||
$template->param(authority_types => $authority_types );
|
||||
if ($op && $op ne 'authtype_create_confirm') {
|
||||
$template->param($op => 1);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ use C4::AuthoritiesMarc;
|
|||
use C4::Acquisition;
|
||||
use C4::Koha;
|
||||
|
||||
use Koha::Authority::Types;
|
||||
|
||||
my $query = new CGI;
|
||||
my $op = $query->param('op') || '';
|
||||
my $authtypecode = $query->param('authtypecode') || '';
|
||||
|
|
@ -49,18 +51,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
|||
}
|
||||
);
|
||||
|
||||
# Authority types loop
|
||||
my $authtypes = C4::Koha::getauthtypes();
|
||||
my @authtypesloop;
|
||||
foreach my $thisauthtype ( keys %$authtypes ) {
|
||||
my %row = (
|
||||
value => $thisauthtype,
|
||||
selected => ( $thisauthtype eq $authtypecode ),
|
||||
authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
|
||||
index => $index,
|
||||
);
|
||||
push @authtypesloop, \%row;
|
||||
}
|
||||
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypetext'] } );
|
||||
|
||||
# If search form posted
|
||||
if ( $op eq "do_search" ) {
|
||||
|
|
@ -173,7 +164,7 @@ $template->param(
|
|||
value_match => $query->param('value_match') || '',
|
||||
tagid => $tagid,
|
||||
index => $index,
|
||||
authtypesloop => \@authtypesloop,
|
||||
authority_types => $authority_types,
|
||||
authtypecode => $authtypecode,
|
||||
source => $source,
|
||||
relationship => $relationship,
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ use C4::Koha; # XXX subfield_is_koha_internal_p
|
|||
use C4::Biblio;
|
||||
use C4::Search::History;
|
||||
|
||||
use Koha::Authority::Types;
|
||||
|
||||
my $query = new CGI;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $op = $query->param('op') || '';
|
||||
|
|
@ -41,22 +43,7 @@ my $authid = $query->param('authid') || '';
|
|||
|
||||
my ( $template, $loggedinuser, $cookie );
|
||||
|
||||
my $authtypes = getauthtypes;
|
||||
my @authtypesloop;
|
||||
foreach my $thisauthtype (
|
||||
sort {
|
||||
$authtypes->{$a}{'authtypetext'} cmp $authtypes->{$b}{'authtypetext'}
|
||||
}
|
||||
keys %$authtypes
|
||||
)
|
||||
{
|
||||
my %row = (
|
||||
value => $thisauthtype,
|
||||
selected => $thisauthtype eq $authtypecode,
|
||||
authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
|
||||
);
|
||||
push @authtypesloop, \%row;
|
||||
}
|
||||
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypetext'] } );
|
||||
|
||||
if ( $op eq "delete" ) {
|
||||
( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
||||
|
|
@ -201,7 +188,7 @@ if ( $op eq '' ) {
|
|||
}
|
||||
|
||||
$template->param(
|
||||
authtypesloop => \@authtypesloop,
|
||||
authority_types => $authority_types,
|
||||
op => $op,
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ use Date::Calc qw(Today);
|
|||
use MARC::File::USMARC;
|
||||
use MARC::File::XML;
|
||||
use C4::Biblio;
|
||||
use Koha::Authority::Types;
|
||||
use vars qw( $tagslib);
|
||||
use vars qw( $authorised_values_sth);
|
||||
use vars qw( $is_a_modif );
|
||||
|
|
@ -659,23 +660,14 @@ if ($op eq "duplicate")
|
|||
authid => $authid , authtypecode=>$authtypecode, );
|
||||
}
|
||||
|
||||
$template->param(authid => $authid,
|
||||
authtypecode => $authtypecode,
|
||||
linkid=>$linkid,
|
||||
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypetext'] } );
|
||||
|
||||
$template->param(
|
||||
authority_types => $authority_types,
|
||||
authtypecode => $authtypecode,
|
||||
authid => $authid,
|
||||
linkid => $linkid,
|
||||
authtypetext => $authority_types->find($authtypecode)->authtypetext,
|
||||
hide_marc => C4::Context->preference('hide_marc'),
|
||||
);
|
||||
|
||||
my $authtypes = getauthtypes;
|
||||
my @authtypesloop;
|
||||
foreach my $thisauthtype (keys %$authtypes) {
|
||||
my %row =(value => $thisauthtype,
|
||||
selected => $thisauthtype eq $authtypecode,
|
||||
authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
|
||||
);
|
||||
push @authtypesloop, \%row;
|
||||
}
|
||||
|
||||
$template->param(authtypesloop => \@authtypesloop,
|
||||
authtypetext => $authtypes->{$authtypecode}{'authtypetext'},
|
||||
hide_marc => C4::Context->preference('hide_marc'),
|
||||
);
|
||||
output_html_with_http_headers $input, $cookie, $template->output;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ use C4::Koha;
|
|||
# use C4::Biblio;
|
||||
# use C4::Catalogue;
|
||||
|
||||
use Koha::Authority::Types;
|
||||
|
||||
my $query=new CGI;
|
||||
|
||||
|
|
@ -119,18 +120,12 @@ my @fields = $record->fields();
|
|||
}
|
||||
$template->param("0XX" =>\@loop_data);
|
||||
|
||||
my $authtypes = getauthtypes;
|
||||
my @authtypesloop;
|
||||
foreach my $thisauthtype (keys %$authtypes) {
|
||||
my %row =(value => $thisauthtype,
|
||||
selected => $thisauthtype eq $authtypecode,
|
||||
authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
|
||||
);
|
||||
push @authtypesloop, \%row;
|
||||
}
|
||||
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypetext'] } );
|
||||
|
||||
$template->param(authid => $authid,
|
||||
authtypesloop => \@authtypesloop, index => $index,
|
||||
);
|
||||
$template->param(
|
||||
authid => $authid,
|
||||
authority_types => $authority_types,
|
||||
index => $index,
|
||||
);
|
||||
output_html_with_http_headers $query, $cookie, $template->output;
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ use CGI qw ( -utf8 );
|
|||
use MARC::Record;
|
||||
use C4::Koha;
|
||||
|
||||
use Koha::Authority::Types;
|
||||
|
||||
our ($tagslib);
|
||||
|
||||
sub build_tabs {
|
||||
|
|
@ -178,16 +180,7 @@ my $authtypecode = GetAuthTypeCode($authid);
|
|||
$tagslib = &GetTagsLabels(1,$authtypecode);
|
||||
|
||||
# Build list of authtypes for showing them
|
||||
my $authtypes = getauthtypes;
|
||||
my @authtypesloop;
|
||||
|
||||
foreach my $thisauthtype (sort { $authtypes->{$b} cmp $authtypes->{$a} } keys %$authtypes) {
|
||||
my %row =(value => $thisauthtype,
|
||||
selected => $thisauthtype eq $authtypecode,
|
||||
authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
|
||||
);
|
||||
push @authtypesloop, \%row;
|
||||
}
|
||||
my $authority_types = Koha::Authority::Types->search({}, { order_by => ['authtypecode']});
|
||||
|
||||
my $record=GetAuthority($authid);
|
||||
|
||||
|
|
@ -195,7 +188,7 @@ if (not defined $record) {
|
|||
# authid invalid
|
||||
$template->param ( errauthid => $authid,
|
||||
unknownauthid => 1,
|
||||
authtypesloop => \@authtypesloop );
|
||||
authority_types => $authority_types, );
|
||||
output_html_with_http_headers $query, $cookie, $template->output;
|
||||
exit;
|
||||
}
|
||||
|
|
@ -218,12 +211,14 @@ chop $biblio_fields;
|
|||
|
||||
build_tabs ($template, $record, $dbh,"",$query);
|
||||
|
||||
$template->param(authid => $authid,
|
||||
count => $count,
|
||||
biblio_fields => $biblio_fields,
|
||||
authtypetext => $authtypes->{$authtypecode}{'authtypetext'},
|
||||
authtypesloop => \@authtypesloop,
|
||||
);
|
||||
$template->param(
|
||||
authid => $authid,
|
||||
count => $count,
|
||||
biblio_fields => $biblio_fields,
|
||||
authtypetext => $authority_types->find($authtypecode)->authtypetext,
|
||||
authtypecode => $authtypecode,
|
||||
authority_types => $authority_types,
|
||||
);
|
||||
|
||||
$template->{VARS}->{marcflavour} = C4::Context->preference("marcflavour");
|
||||
output_html_with_http_headers $query, $cookie, $template->output;
|
||||
|
|
|
|||
|
|
@ -156,17 +156,13 @@ else {
|
|||
title2 => $recordObj2->authorized_heading,
|
||||
);
|
||||
if ( $recordObj1->authtype ne $recordObj2->authtype ) {
|
||||
my $frameworks = getauthtypes;
|
||||
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypecode'] } );
|
||||
my @frameworkselect;
|
||||
foreach my $thisframeworkcode ( keys %$frameworks ) {
|
||||
while ( my $authority_type = $authority_types->next ) {
|
||||
my %row = (
|
||||
value => $thisframeworkcode,
|
||||
frameworktext =>
|
||||
$frameworks->{$thisframeworkcode}->{'authtypetext'},
|
||||
value => $authority_type->authtypecode,
|
||||
frameworktext => $authority_type->authtypetext,
|
||||
);
|
||||
if ( $recordObj1->authtype eq $thisframeworkcode ) {
|
||||
$row{'selected'} = 1;
|
||||
}
|
||||
push @frameworkselect, \%row;
|
||||
}
|
||||
$template->param(
|
||||
|
|
@ -181,22 +177,8 @@ else {
|
|||
}
|
||||
}
|
||||
|
||||
my $authtypes = getauthtypes;
|
||||
my @authtypesloop;
|
||||
foreach my $thisauthtype (
|
||||
sort {
|
||||
$authtypes->{$a}{'authtypetext'} cmp $authtypes->{$b}{'authtypetext'}
|
||||
}
|
||||
keys %$authtypes
|
||||
)
|
||||
{
|
||||
my %row = (
|
||||
value => $thisauthtype,
|
||||
authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
|
||||
);
|
||||
push @authtypesloop, \%row;
|
||||
}
|
||||
$template->{VARS}->{authtypesloop} = \@authtypesloop;
|
||||
my $authority_types = Koha::Authority::Types->search({}, { order_by => ['authtypetext']});
|
||||
$template->param( authority_types => $authority_types );
|
||||
|
||||
if (@errors) {
|
||||
|
||||
|
|
|
|||
|
|
@ -69,21 +69,6 @@ my ($input) = @_;
|
|||
my ($template, $loggedinuser, $cookie);
|
||||
my $resultsperpage;
|
||||
|
||||
my $authtypes = getauthtypes;
|
||||
my @authtypesloop;
|
||||
foreach my $thisauthtype (keys %$authtypes) {
|
||||
my $selected;
|
||||
if ($thisauthtype eq $authtypecode) {
|
||||
$selected=1;
|
||||
}
|
||||
my %row =(value => $thisauthtype,
|
||||
selected => $selected,
|
||||
authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
|
||||
index => $index,
|
||||
);
|
||||
push @authtypesloop, \%row;
|
||||
}
|
||||
|
||||
if ($op eq "do_search") {
|
||||
my @marclist = $query->param('marclist');
|
||||
my @and_or = $query->param('and_or');
|
||||
|
|
@ -186,7 +171,6 @@ my ($input) = @_;
|
|||
);
|
||||
}
|
||||
|
||||
$template->param(authtypesloop => \@authtypesloop);
|
||||
$template->param(category => $category);
|
||||
|
||||
# Print the page
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@
|
|||
<input type="hidden" name="type" value="intranet" />
|
||||
<select name="authtypecode">
|
||||
[% IF (marcflavour == 'UNIMARC' ) %]<option value="">All authority types</option>[% END %]
|
||||
[% FOREACH authtypesloo IN authtypesloop %]
|
||||
[% IF ( authtypesloo.selected ) %]
|
||||
<option value="[% authtypesloo.value %]" selected="selected">[% authtypesloo.authtypetext %]</option>
|
||||
[% FOREACH authority_type IN authority_types %]
|
||||
[% IF authority_type.authtypecode == authtypecode %]
|
||||
<option value="[% authority_type.value %]" selected="selected">[% authority_type.authtypetext %]</option>
|
||||
[% ELSE %]
|
||||
<option value="[% authtypesloo.value %]">[% authtypesloo.authtypetext %]</option>
|
||||
<option value="[% authority_type.value %]">[% authority_type.authtypetext %]</option>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</select>
|
||||
|
|
@ -81,11 +81,11 @@
|
|||
<input type="hidden" name="type" value="intranet" />
|
||||
<select name="authtypecode">
|
||||
[% IF (marcflavour == 'UNIMARC' ) %]<option value="">All authority types</option>[% END %]
|
||||
[% FOREACH authtypesloo IN authtypesloop %]
|
||||
[% IF ( authtypesloo.selected ) %]
|
||||
<option value="[% authtypesloo.value %]" selected="selected">[% authtypesloo.authtypetext %]</option>
|
||||
[% FOREACH authority_type IN authority_types %]
|
||||
[% IF authority_type.authtypecode == authtypecode %]
|
||||
<option value="[% authority_type.value %]" selected="selected">[% authority_type.authtypetext %]</option>
|
||||
[% ELSE %]
|
||||
<option value="[% authtypesloo.value %]">[% authtypesloo.authtypetext %]</option>
|
||||
<option value="[% authority_type.value %]">[% authority_type.authtypetext %]</option>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</select>
|
||||
|
|
@ -135,13 +135,13 @@
|
|||
<form action="/cgi-bin/koha/authorities/authorities-home.pl" method="get">
|
||||
<input type="hidden" name="op" value="do_search" />
|
||||
<input type="hidden" name="type" value="intranet" />
|
||||
<select name="authtypecode">
|
||||
<select name="authtypecode">
|
||||
[% IF (marcflavour == 'UNIMARC' ) %]<option value="">All authority types</option>[% END %]
|
||||
[% FOREACH authtypesloo IN authtypesloop %]
|
||||
[% IF ( authtypesloo.selected ) %]
|
||||
<option value="[% authtypesloo.value %]" selected="selected">[% authtypesloo.authtypetext %]</option>
|
||||
[% FOREACH authority_type IN authority_types %]
|
||||
[% IF authority_type.authtypecode == authtypecode %]
|
||||
<option value="[% authority_type.value %]" selected="selected">[% authority_type.authtypetext %]</option>
|
||||
[% ELSE %]
|
||||
<option value="[% authtypesloo.value %]">[% authtypesloo.authtypetext %]</option>
|
||||
<option value="[% authority_type.value %]">[% authority_type.authtypetext %]</option>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@
|
|||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
[% FOREACH authtypesloo IN authtypesloop %]
|
||||
<li><a href="/cgi-bin/koha/authorities/authorities.pl?authtypecode=[% authtypesloo.value %]">[% authtypesloo.authtypetext %]</a></li>
|
||||
[% FOREACH authority_type IN authority_types %]
|
||||
<li><a href="/cgi-bin/koha/authorities/authorities.pl?authtypecode=[% authority_type.authtypecode %]">[% authority_type.authtypetext %]</a></li>
|
||||
[% END %]
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -187,13 +187,12 @@
|
|||
<h2>Select an authority framework</h2>
|
||||
<form action="[% script_name %]" method="post">
|
||||
<select name="authtypecode">
|
||||
[% FOREACH authtypeloo IN authtypeloop %]
|
||||
[% IF ( authtypeloo.selected ) %]
|
||||
<option value="[% authtypeloo.value %]" selected="selected">[% authtypeloo.authtypetext %]</option>
|
||||
[% FOREACH authority_type IN authority_types%]
|
||||
[% IF authority_type.authtypecode == authtypecode%]
|
||||
<option value="[% authority_type.value %]" selected="selected">[% authority_type.authtypetext %]</option>
|
||||
[% ELSE %]
|
||||
<option value="[% authtypeloo.value %]">[% authtypeloo.authtypetext %]</option>
|
||||
<option value="[% authority_type.value %]">[% authority_type.authtypetext %]</option>
|
||||
[% END %]
|
||||
|
||||
[% END %]
|
||||
</select>
|
||||
<input type="text" name="searchfield" value="[% searchfield %]" />
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ function changeFramework(fw) {
|
|||
<select name="frameworkcode" id="frameworkcode">
|
||||
<option value="Default">Default</option>
|
||||
[% FOREACH frameworkcodeloo IN frameworkselect %]
|
||||
[% IF ( frameworkcodeloo.selected ) %]
|
||||
[% IF frameworkcodeloo.authtypecode == frameworkcode1 %]
|
||||
<option value="[% frameworkcodeloo.value %]" selected="selected">
|
||||
[% ELSE %]
|
||||
<option value="[% frameworkcodeloo.value %]">
|
||||
|
|
|
|||
|
|
@ -172,12 +172,8 @@ $(document).ready(function() {
|
|||
<label for="authtype">Authority type: </label>
|
||||
<select name="authtype" id="authtype">
|
||||
<option value="">-- All --</option>
|
||||
[% FOREACH authtypeloo IN authtypeloop %]
|
||||
[% IF ( authtypeloo.selected ) %]
|
||||
<option value="[% authtypeloo.value %]" selected="selected">[% authtypeloo.description %]</option>
|
||||
[% ELSE %]
|
||||
<option value="[% authtypeloo.value %]">[% authtypeloo.description %]</option>
|
||||
[% END %]
|
||||
[% FOREACH authority_type IN authority_types %]
|
||||
<option value="[% authtypeloo.value %]">[% authtypeloo.description %]</option>
|
||||
[% END %]
|
||||
</select>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ use C4::AuthoritiesMarc;
|
|||
use C4::Koha; # XXX subfield_is_koha_internal_p
|
||||
use C4::Search::History;
|
||||
|
||||
use Koha::Authority::Types;
|
||||
|
||||
my $query = new CGI;
|
||||
my $op = $query->param('op') || '';
|
||||
my $authtypecode = $query->param('authtypecode') || '';
|
||||
|
|
@ -42,21 +44,7 @@ $startfrom = 0 if ( !defined $startfrom );
|
|||
my ( $template, $loggedinuser, $cookie );
|
||||
my $resultsperpage;
|
||||
|
||||
my $authtypes = getauthtypes();
|
||||
my @authtypesloop = ();
|
||||
foreach my $thisauthtype (
|
||||
sort {
|
||||
$authtypes->{$a}->{'authtypetext'}
|
||||
cmp $authtypes->{$b}->{'authtypetext'}
|
||||
}
|
||||
keys %{$authtypes}
|
||||
) {
|
||||
push @authtypesloop,
|
||||
{ value => $thisauthtype,
|
||||
selected => $thisauthtype eq $authtypecode,
|
||||
authtypetext => $authtypes->{$thisauthtype}->{'authtypetext'},
|
||||
};
|
||||
}
|
||||
my $authority_types = Koha::Authority::Types->search({}, { order_by => ['authtypetext']});
|
||||
|
||||
if ( $op eq "do_search" ) {
|
||||
my @marclist = ($query->param('marclist'));
|
||||
|
|
@ -179,7 +167,7 @@ if ( $op eq "do_search" ) {
|
|||
resultcount => scalar @$results,
|
||||
numbers => \@numbers,
|
||||
authtypecode => $authtypecode,
|
||||
authtypetext => $authtypes->{$authtypecode}{'authtypetext'},
|
||||
authtypetext => $authority_types->find($authtypecode)->authtypetext,
|
||||
isEDITORS => $authtypecode eq 'EDITORS',
|
||||
);
|
||||
|
||||
|
|
@ -197,7 +185,10 @@ else {
|
|||
|
||||
}
|
||||
|
||||
$template->param( authtypesloop => \@authtypesloop );
|
||||
$template->param(
|
||||
authority_types => $authority_types,
|
||||
authtypecode => $authtypecode,
|
||||
);
|
||||
|
||||
# Print the page
|
||||
output_html_with_http_headers $query, $cookie, $template->output;
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ use CGI qw ( -utf8 );
|
|||
use MARC::Record;
|
||||
use C4::Koha;
|
||||
|
||||
use Koha::Authority::Types;
|
||||
|
||||
my $query = new CGI;
|
||||
|
||||
|
|
@ -83,20 +84,13 @@ if ($display_hierarchy){
|
|||
|
||||
my $count = CountUsage($authid);
|
||||
|
||||
|
||||
my $authtypes = getauthtypes();
|
||||
my @authtypesloop = ();
|
||||
foreach my $thisauthtype ( keys %{$authtypes} ) {
|
||||
push @authtypesloop,
|
||||
{ value => $thisauthtype,
|
||||
selected => $thisauthtype eq $authtypecode,
|
||||
authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
|
||||
};
|
||||
}
|
||||
$template->{VARS}->{'authtypesloop'} = \@authtypesloop;
|
||||
$template->{VARS}->{'authtypetext'} = $authtypes->{$authtypecode}{'authtypetext'};
|
||||
$template->{VARS}->{'authid'} = $authid;
|
||||
$template->{VARS}->{'count'} = $count;
|
||||
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypecode'] } );
|
||||
$template->param(
|
||||
authority_types => $authority_types,
|
||||
authtypetext => $authority_types->find($authtypecode)->authtypetext,
|
||||
authid => $authid,
|
||||
count => $count,
|
||||
);
|
||||
|
||||
# find the marc field/subfield used in biblio by this authority
|
||||
if ($show_marc) {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ use C4::Csv;
|
|||
use C4::Koha; # GetItemTypes
|
||||
use C4::Output;
|
||||
|
||||
use Koha::Authority::Types;
|
||||
use Koha::Biblioitems;
|
||||
use Koha::Database;
|
||||
use Koha::DateUtils qw( dt_from_string output_pref );
|
||||
|
|
@ -279,16 +280,7 @@ else {
|
|||
};
|
||||
}
|
||||
|
||||
my $authtypes = getauthtypes;
|
||||
my @authtypesloop;
|
||||
foreach my $thisauthtype ( sort keys %$authtypes ) {
|
||||
next unless $thisauthtype;
|
||||
my %row = (
|
||||
value => $thisauthtype,
|
||||
description => $authtypes->{$thisauthtype}->{'authtypetext'},
|
||||
);
|
||||
push @authtypesloop, \%row;
|
||||
}
|
||||
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypecode'] } );
|
||||
|
||||
if ( $flags->{superlibrarian}
|
||||
&& C4::Context->config('backup_db_via_tools')
|
||||
|
|
@ -313,7 +305,7 @@ else {
|
|||
$template->param(
|
||||
branchloop => \@branchloop,
|
||||
itemtypeloop => \@itemtypesloop,
|
||||
authtypeloop => \@authtypesloop,
|
||||
authority_types => $authority_types,
|
||||
export_remove_fields => C4::Context->preference("ExportRemoveFields"),
|
||||
csv_profiles => C4::Csv::GetCsvProfiles('marc'),
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue