5 use C4
::AuthoritiesMarc
;
7 my $dbh=C4
::Context
->dbh;
8 my $datatypes_query = $dbh->prepare(<<ENDSQL);
9 SELECT authtypecode,authtypetext,auth_tag_to_report from auth_types;
11 $datatypes_query->execute;
12 my $datatypes=$datatypes_query->fetchall_arrayref({});
14 map { $authtypes{$_->{'authtypecode'}}={"tag"=> $_->{'auth_tag_to_report'}, "lib"=> $_->{'authtypetext'}};} @
$datatypes;
15 my $data_query = $dbh->prepare(<<ENDSQL);
16 SELECT authid, authtypecode from auth_header
19 my $dataauthorities=$data_query->fetchall_arrayref({});
20 print "id;authtype;heading;count usage\n";
21 foreach my $authority (@
$dataauthorities){
22 my $marcauthority=GetAuthority
($authority->{'authid'});
23 if ($marcauthority && $marcauthority->field($authtypes{$authority->{'authtypecode'}}->{'tag'})){
24 print qq($authority->{'authid'};"),$authtypes{$authority->{'authtypecode'}}->{'lib'},qq(";"),$marcauthority->field($authtypes{$authority->{'authtypecode'}}->{"tag
"})->as_string(),qq(";), CountUsage
($authority->{authid
}),"\n";