Adds auto print/auto close functionality to hold transit slip.
[koha.git] / authorities / authorities-list.pl
blob9c472f13f28ecf4081f1a481bf72de5f8af38ce3
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 use C4::Context;
5 use C4::AuthoritiesMarc;
6 use utf8;
7 use open qw( :std :utf8 );
9 my $dbh=C4::Context->dbh;
10 my $datatypes_query = $dbh->prepare(<<ENDSQL);
11 SELECT authtypecode,authtypetext,auth_tag_to_report from auth_types;
12 ENDSQL
13 $datatypes_query->execute;
14 my $datatypes=$datatypes_query->fetchall_arrayref({});
15 my %authtypes;
16 map { $authtypes{$_->{'authtypecode'}}={"tag"=> $_->{'auth_tag_to_report'}, "lib"=> $_->{'authtypetext'}};} @$datatypes;
17 my $data_query = $dbh->prepare(<<ENDSQL);
18 SELECT authid, authtypecode from auth_header
19 ENDSQL
20 $data_query->execute;
21 my $dataauthorities=$data_query->fetchall_arrayref({});
22 foreach my $authority (@$dataauthorities){
23 my $marcauthority=GetAuthority($authority->{'authid'});
24 my $query;
25 $query= "an=".$authority->{'authid'};
26 # search for biblios mapped
27 my ($err,$res,$used) = C4::Search::SimpleSearch($query,0,10);
28 if ($marcauthority && $marcauthority->field($authtypes{$authority->{'authtypecode'}}->{'tag'})){
29 print qq("),$marcauthority->field($authtypes{$authority->{'authtypecode'}}->{"tag"})->as_string(),qq(";),qq($authority->{'authid'};"),$authtypes{$authority->{'authtypecode'}}->{'lib'},qq(";$used\n);