From d578ecdd11eb42aea7d1c0efcca677ab9921c8de Mon Sep 17 00:00:00 2001 From: tipaul Date: Thu, 5 Jan 2006 15:14:47 +0000 Subject: [PATCH] * (UNIMARC specific bugfix) when an editor is entered, with no ISBN, the collection plugin (225a) can find collections attached to the editor name. Note that if there are more than 1 EDITORS authority for a given editor, only the 1st will be used to create collection list. --- .../en/value_builder/unimarc_field_210c.tmpl | 2 +- value_builder/unimarc_field_225a.pl | 31 +++++++++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/default/en/value_builder/unimarc_field_210c.tmpl b/koha-tmpl/intranet-tmpl/default/en/value_builder/unimarc_field_210c.tmpl index 7ca1531a8e..3e944504ee 100644 --- a/koha-tmpl/intranet-tmpl/default/en/value_builder/unimarc_field_210c.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/value_builder/unimarc_field_210c.tmpl @@ -104,7 +104,7 @@ function report(index,summary) { - var regexp= /(\d* - *)(.*)/; + var regexp= /(\d* -+ *)(.*)/; var result=summary.match(regexp); opener.document.f.field_value[index].value=result[2]; self.close(); diff --git a/value_builder/unimarc_field_225a.pl b/value_builder/unimarc_field_225a.pl index 3715c128e7..e696084905 100644 --- a/value_builder/unimarc_field_225a.pl +++ b/value_builder/unimarc_field_225a.pl @@ -118,15 +118,28 @@ my ($input) = @_; # builds collection list : search isbn and editor, in parent, then load collections from bibliothesaurus table # if there is an isbn, complete search my @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' and subfieldvalue=?"); - my $sth2 = $dbh->prepare("select subfieldvalue from auth_subfield_table where tag='200' and subfieldcode='c' and authid=? order by subfieldvalue"); - my @splited = split //, $isbn_found; - my $isbn_rebuild=''; - foreach my $x (@splited) { - $isbn_rebuild.=$x; - $sth->execute($isbn_rebuild); + if ($isbn_found) { + 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=? order by subfieldvalue"); + my @splited = split //, $isbn_found; + my $isbn_rebuild=''; + foreach my $x (@splited) { + $isbn_rebuild.=$x; + $sth->execute($isbn_rebuild); + my ($authid) = $sth->fetchrow; + $sth2->execute($authid); + while (my ($line)= $sth2->fetchrow) { + push @collections,$line; + } + } + } else { + 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='b' and subfieldvalue=?"); + my $sth2 = $dbh->prepare("select subfieldvalue from auth_subfield_table where tag='200' and subfieldcode='c' and authid=? order by subfieldvalue"); + $sth->execute($editor_found); my ($authid) = $sth->fetchrow; $sth2->execute($authid); while (my ($line)= $sth2->fetchrow) {