5 use C4
::AuthoritiesMarc
;
7 use open qw
[ :std
:encoding
(utf8
) ];
8 use Koha
::SearchEngine
;
9 use Koha
::SearchEngine
::Search
;
11 my $dbh=C4
::Context
->dbh;
12 my $datatypes_query = $dbh->prepare(<<ENDSQL);
13 SELECT authtypecode,authtypetext,auth_tag_to_report from auth_types;
15 $datatypes_query->execute;
16 my $datatypes=$datatypes_query->fetchall_arrayref({});
18 map { $authtypes{$_->{'authtypecode'}}={"tag"=> $_->{'auth_tag_to_report'}, "lib"=> $_->{'authtypetext'}};} @
$datatypes;
19 my $data_query = $dbh->prepare(<<ENDSQL);
20 SELECT authid, authtypecode from auth_header
23 my $dataauthorities=$data_query->fetchall_arrayref({});
24 foreach my $authority (@
$dataauthorities){
25 my $marcauthority=GetAuthority
($authority->{'authid'});
27 $query= "an=".$authority->{'authid'};
28 # search for biblios mapped
29 my $searcher = Koha
::SearchEngine
::Search
->new({index => $Koha::SearchEngine
::BIBLIOS_INDEX
});
30 my ($err,undef,$used) = $searcher->simple_search_compat($query,0,1);
34 if ($marcauthority && $marcauthority->field($authtypes{$authority->{'authtypecode'}}->{'tag'})){
35 print qq("),$marcauthority->field($authtypes{$authority->{'authtypecode'}}->{"tag
"})->as_string(),qq(";),qq($authority->{'authid'};"),$authtypes{$authority->{'authtypecode'}}->{'lib'},qq(";$used\n);