View | Details | Raw Unified | Return to bug 15381
Collapse All | Expand All

(-)a/C4/AuthoritiesMarc.pm (-16 / +6 lines)
Lines 291-301 sub SearchAuthorities { Link Here
291
        my %newline;
291
        my %newline;
292
        $newline{authid} = $authid;
292
        $newline{authid} = $authid;
293
        if ( !$skipmetadata ) {
293
        if ( !$skipmetadata ) {
294
            my $query_auth_tag =
294
            my $auth_tag_to_report = Koha::Authority::Types->find($authtypecode)->auth_tag_to_report;
295
"SELECT auth_tag_to_report FROM auth_types WHERE authtypecode=?";
296
            my $sth = $dbh->prepare($query_auth_tag);
297
            $sth->execute($authtypecode);
298
            my $auth_tag_to_report = $sth->fetchrow;
299
            my $reported_tag;
295
            my $reported_tag;
300
            my $mainentry = $authrecord->field($auth_tag_to_report);
296
            my $mainentry = $authrecord->field($auth_tag_to_report);
301
            if ($mainentry) {
297
            if ($mainentry) {
Lines 848-857 sub FindDuplicateAuthority { Link Here
848
#    warn "IN for ".$record->as_formatted;
844
#    warn "IN for ".$record->as_formatted;
849
    my $dbh = C4::Context->dbh;
845
    my $dbh = C4::Context->dbh;
850
#    warn "".$record->as_formatted;
846
#    warn "".$record->as_formatted;
851
    my $sth = $dbh->prepare("select auth_tag_to_report from auth_types where authtypecode=?");
847
    my $auth_tag_to_report = Koha::Authority::Types->find($authtypecode)->auth_tag_to_report;
852
    $sth->execute($authtypecode);
853
    my ($auth_tag_to_report) = $sth->fetchrow;
854
    $sth->finish;
855
#     warn "record :".$record->as_formatted."  auth_tag_to_report :$auth_tag_to_report";
848
#     warn "record :".$record->as_formatted."  auth_tag_to_report :$auth_tag_to_report";
856
    # build a request for SearchAuthorities
849
    # build a request for SearchAuthorities
857
    my $QParser;
850
    my $QParser;
Lines 1456-1467 sub merge { Link Here
1456
    return "error MARCFROM not a marcrecord ".Data::Dumper::Dumper($MARCfrom) if scalar($MARCfrom->fields()) == 0;
1449
    return "error MARCFROM not a marcrecord ".Data::Dumper::Dumper($MARCfrom) if scalar($MARCfrom->fields()) == 0;
1457
    return "error MARCTO not a marcrecord".Data::Dumper::Dumper($MARCto) if scalar($MARCto->fields()) == 0;
1450
    return "error MARCTO not a marcrecord".Data::Dumper::Dumper($MARCto) if scalar($MARCto->fields()) == 0;
1458
    # search the tag to report
1451
    # search the tag to report
1459
    my $sth = $dbh->prepare("select auth_tag_to_report from auth_types where authtypecode=?");
1452
    my $auth_tag_to_report_from = Koha::Authority::Types->find($authtypecodefrom)->auth_tag_to_report;
1460
    $sth->execute($authtypecodefrom);
1453
    my $auth_tag_to_report_to = Koha::Authority::Types->find($authtypecodeto)->auth_tag_to_report;
1461
    my ($auth_tag_to_report_from) = $sth->fetchrow;
1454
1462
    $sth->execute($authtypecodeto);
1463
    my ($auth_tag_to_report_to) = $sth->fetchrow;
1464
    
1465
    my @record_to;
1455
    my @record_to;
1466
    @record_to = $MARCto->field($auth_tag_to_report_to)->subfields() if $MARCto->field($auth_tag_to_report_to);
1456
    @record_to = $MARCto->field($auth_tag_to_report_to)->subfields() if $MARCto->field($auth_tag_to_report_to);
1467
    my @record_from;
1457
    my @record_from;
Lines 1499-1505 sub merge { Link Here
1499
    #warn scalar(@reccache)." biblios to update";
1489
    #warn scalar(@reccache)." biblios to update";
1500
    # Get All candidate Tags for the change 
1490
    # Get All candidate Tags for the change 
1501
    # (This will reduce the search scope in marc records).
1491
    # (This will reduce the search scope in marc records).
1502
    $sth = $dbh->prepare("select distinct tagfield from marc_subfield_structure where authtypecode=?");
1492
    my $sth = $dbh->prepare("select distinct tagfield from marc_subfield_structure where authtypecode=?");
1503
    $sth->execute($authtypecodefrom);
1493
    $sth->execute($authtypecodefrom);
1504
    my @tags_using_authtype;
1494
    my @tags_using_authtype;
1505
    while (my ($tagfield) = $sth->fetchrow) {
1495
    while (my ($tagfield) = $sth->fetchrow) {
(-)a/admin/auth_subfields_structure.pl (-1 / +4 lines)
Lines 25-30 use CGI qw ( -utf8 ); Link Here
25
use C4::Context;
25
use C4::Context;
26
use C4::Koha;
26
use C4::Koha;
27
27
28
use Koha::Authority::Types;
29
30
use List::MoreUtils qw( uniq );
28
31
29
sub string_search  {
32
sub string_search  {
30
	my ($searchstring,$authtypecode)=@_;
33
	my ($searchstring,$authtypecode)=@_;
Lines 99-105 if ($op eq 'add_form') { Link Here
99
        push @$authorised_values, 'itemtypes';
102
        push @$authorised_values, 'itemtypes';
100
103
101
        # build thesaurus categories list
104
        # build thesaurus categories list
102
        my @authtypes = (sort keys %{C4::Koha::getauthtypes()});
105
        my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search );
103
106
104
	# build value_builder list
107
	# build value_builder list
105
	my @value_builder=('');
108
	my @value_builder=('');
(-)a/admin/marc_subfields_structure.pl (-9 / +4 lines)
Lines 24-29 use C4::Auth; Link Here
24
use CGI qw ( -utf8 );
24
use CGI qw ( -utf8 );
25
use C4::Context;
25
use C4::Context;
26
26
27
use Koha::Authority::Types;
28
29
use List::MoreUtils qw( uniq );
27
30
28
sub string_search {
31
sub string_search {
29
    my ( $searchstring, $frameworkcode ) = @_;
32
    my ( $searchstring, $frameworkcode ) = @_;
Lines 138-151 if ( $op eq 'add_form' ) { Link Here
138
    push( @authorised_values, "cn_source" );
141
    push( @authorised_values, "cn_source" );
139
142
140
    # build thesaurus categories list
143
    # build thesaurus categories list
141
    $sth2->finish;
144
    my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search );
142
    $sth2 = $dbh->prepare("select authtypecode from auth_types");
143
    $sth2->execute;
144
    my @authtypes;
145
    push @authtypes, "";
146
    while ( ( my $authtypecode ) = $sth2->fetchrow_array ) {
147
        push @authtypes, $authtypecode;
148
    }
149
145
150
    # build value_builder list
146
    # build value_builder list
151
    my @value_builder = ('');
147
    my @value_builder = ('');
152
- 

Return to bug 15381