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

(-)a/C4/AuthoritiesRameau.pm (-6 / +17 lines)
Lines 27-32 use C4::AuthoritiesMarc::MARC21; Link Here
27
use C4::AuthoritiesMarc::UNIMARC;
27
use C4::AuthoritiesMarc::UNIMARC;
28
use C4::Charset;
28
use C4::Charset;
29
use C4::Log;
29
use C4::Log;
30
use C4::Debug;
30
use Koha::Authority;
31
use Koha::Authority;
31
32
32
use vars qw($VERSION @ISA @EXPORT);
33
use vars qw($VERSION @ISA @EXPORT);
Lines 85-91 sub _findLocalAuth { Link Here
85
    $rs = $ctn->search(new ZOOM::Query::CCL2RPN(C4::Context->preference('rameauBnfIdIndex') . '=' . $id, $ctn));
86
    $rs = $ctn->search(new ZOOM::Query::CCL2RPN(C4::Context->preference('rameauBnfIdIndex') . '=' . $id, $ctn));
86
  };
87
  };
87
  if ($@) {
88
  if ($@) {
88
    print "Error searching\n";
89
    $debug and warn "Error searching";
89
    return -1;
90
    return -1;
90
  }
91
  }
91
  if ($rs && $rs->size() == 1) {
92
  if ($rs && $rs->size() == 1) {
Lines 133-139 sub addInternalLinks { Link Here
133
      if (my $kohaauthid = _findLocalAuth($subfield->[1])) {
134
      if (my $kohaauthid = _findLocalAuth($subfield->[1])) {
134
        if ($kohaauthid != -1) {
135
        if ($kohaauthid != -1) {
135
          $found_authid = $kohaauthid;
136
          $found_authid = $kohaauthid;
136
          print "Adding authid $kohaauthid\n";
137
          $debug and warn "Adding authid $kohaauthid";
137
        }
138
        }
138
      }
139
      }
139
    }
140
    }
Lines 149-162 sub rameauProcessing { Link Here
149
  my $marcrecord = shift @_;
150
  my $marcrecord = shift @_;
150
  my $update = 0;
151
  my $update = 0;
151
152
153
  # Getting biblionumber
154
  my ($bntag, $bnsubf) = GetMarcFromKohaField('biblio.biblionumber', '');
155
  my $biblionumber;
156
  if (defined $bnsubf && $bnsubf ne "@") {
157
    $biblionumber = $marcrecord->subfield($bntag, $bnsubf);
158
  } else {
159
    if (defined $marcrecord->field($bntag)) {
160
      $biblionumber = $marcrecord->field($bntag)->data();
161
    }
162
  }
163
152
  my @rameauFields = (600, 601, 602, 606, 607);
164
  my @rameauFields = (600, 601, 602, 606, 607);
153
  foreach my $tag (@rameauFields) {
165
  foreach my $tag (@rameauFields) {
154
    foreach my $field ($marcrecord->field($tag)) {
166
    foreach my $field ($marcrecord->field($tag)) {
155
      if (isRameau($field)) {
167
      if (isRameau($field)) {
156
        if ($marcrecord->field('001')) {
168
        if (defined $biblionumber) {
157
          print "Merging Rameau for biblionumber " . $marcrecord->field('001')->data() . " field $tag\n";
169
          $debug and warn "Merging Rameau for biblionumber $biblionumber field $tag";
158
        } else {
170
        } else {
159
          print "Merging Rameau for an unknown biblionumber field $tag\n";
171
          $debug and warn "Merging Rameau for an unknown biblionumber field $tag";
160
        }
172
        }
161
        addRameau($field);
173
        addRameau($field);
162
        addInternalLinks($field);
174
        addInternalLinks($field);
163
- 

Return to bug 14560