diff --git a/value_builder/unimarc_field_210c.pl b/value_builder/unimarc_field_210c.pl index 99a7d87c60..3fbd075290 100644 --- a/value_builder/unimarc_field_210c.pl +++ b/value_builder/unimarc_field_210c.pl @@ -57,14 +57,20 @@ my $function_name= "210c".(int(rand(100000))+1); #---- build editors list. #---- the editor list is built from the "EDITORS" thesaurus #---- this thesaurus category must be filled as follow : -#---- isbn_identifier authorityseparator editor authorityseparator collection -#---- sample : 2224 -- Cerf -- Sources chrétiennes -my $sth = $dbh->prepare("select father,stdlib from bibliothesaurus where category='EDITORS' and level=2"); +#---- 200$a for isbn +#---- 200$b for editor +#---- 200$c (repeated) for collections +my $sth = $dbh->prepare("select auth_subfield_table.authid,subfieldvalue from auth_subfield_table + left join auth_header on auth_subfield_table.authid=auth_header.authid + where authtypecode='EDITORS' and tag='200' and subfieldcode='a'"); +my $sth2 = $dbh->prepare("select subfieldvalue from auth_subfield_table where tag='200' and subfieldcode='b' and authid=?"); $sth->execute; my @editors; my $authoritysep = C4::Context->preference("authoritysep"); -while (my ($father,$stdlib) = $sth->fetchrow) { - push(@editors,"$father $stdlib"); +while (my ($authid,$isbn) = $sth->fetchrow) { + $sth2->execute($authid); + my ($editor) = $sth2->fetchrow; + push(@editors,"$isbn $authoritysep $editor"); } my $res = " diff --git a/value_builder/unimarc_field_225a.pl b/value_builder/unimarc_field_225a.pl index 3e7f4cab57..c61d88eca9 100644 --- a/value_builder/unimarc_field_225a.pl +++ b/value_builder/unimarc_field_225a.pl @@ -119,13 +119,18 @@ my ($input) = @_; # if there is an isbn, complete search my @collections; if ($isbn_found) { - my $sth = $dbh->prepare("select stdlib from bibliothesaurus where father=? and category='EDITORS' order by stdlib"); + my $sth = $dbh->prepare("select auth_subfield_table.authid,subfieldvalue from auth_subfield_table + left join auth_header on auth_subfield_table.authid=auth_header.authid + where authtypecode='EDITORS' and tag='200' and subfieldcode='a' and subfieldvalue=?"); + my $sth2 = $dbh->prepare("select subfieldvalue from auth_subfield_table where tag='200' and subfieldcode='c' and authid=?"); my @splited = split //, $isbn_found; my $isbn_rebuild=''; foreach my $x (@splited) { $isbn_rebuild.=$x; - $sth->execute("$isbn_rebuild $authoritysep $editor_found $authoritysep"); - while (my ($line)= $sth->fetchrow) { + $sth->execute($isbn_rebuild); + my ($authid) = $sth->fetchrow; + $sth2->execute($authid); + while (my ($line)= $sth2->fetchrow) { push @collections,$line; } }