From 45761d67cb8ce119aae1a48bee209af287a3f051 Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Wed, 5 Aug 2009 15:14:13 +0200 Subject: [PATCH] (bug #3505) fix 210c and 225a unimarc's plugins This fix the 2 plugins, make 225a to work with koha 3.0, and fix 210c to be xhtml valid Signed-off-by: Galen Charlton --- .../value_builder/unimarc_field_210c.pl | 45 +---------- .../value_builder/unimarc_field_225a.pl | 81 +++++-------------- .../value_builder/unimarc_field_210c.tmpl | 39 +++++---- .../value_builder/unimarc_field_225a.tmpl | 5 +- 4 files changed, 47 insertions(+), 123 deletions(-) diff --git a/cataloguing/value_builder/unimarc_field_210c.pl b/cataloguing/value_builder/unimarc_field_210c.pl index ffbf644557..995debde39 100755 --- a/cataloguing/value_builder/unimarc_field_210c.pl +++ b/cataloguing/value_builder/unimarc_field_210c.pl @@ -63,51 +63,12 @@ my $function_name= $field_number; #---- 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 ($authid,$isbn) = $sth->fetchrow) { - $sth2->execute($authid); - my ($editor) = $sth2->fetchrow; - push(@editors,"$isbn $authoritysep $editor"); -} + + my $res = " @@ -107,9 +104,8 @@ sub plugin { my $index = $input->param('index'); my $result = $input->param('result'); my $editor_found = $input->param('editor_found'); - my $isbn_found = $input->param('isbn_found'); - my $dbh = C4::Context->dbh; my $authoritysep = C4::Context->preference("authoritysep"); + my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => @@ -125,62 +121,23 @@ sub plugin { # builds collection list : search isbn and editor, in parent, then load collections from bibliothesaurus table # if there is an isbn, complete search my @collections; - 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 ) { - push @collections, $line; + + my @value = ($editor_found,"",""); + my @tags = ("mainentry","",""); + my @and_or = ('and','',''); + my @operator = ('is','',''); + my @excluding = ('','',''); + + + my ($results,$total) = SearchAuthorities( \@tags,\@and_or, + \@excluding, \@operator, \@value, + 0, 20,"EDITORS", "HeadingAsc"); + foreach my $editor (@$results){ + my $authority = GetAuthority($editor->{authid}); + foreach my $col ($authority->subfield('200','c')){ + push @collections, $col; } + } # my @collections = ["test"]; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c.tmpl index 8da1f39c92..4488828b38 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c.tmpl @@ -1,26 +1,31 @@ -
+ +UNIMARC_Field 125b builder + + + +

Authority search results

-
+
- - - - "> -
+ + + + " /> +

Search on

EDITORS

- "> - "> - - "> + " /> + " /> + + " /> @@ -37,21 +42,21 @@

- +

-
-
+
+

-  Results to of

+  Results to of

-   No results found
+   No results found

@@ -74,7 +79,7 @@
-
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_225a.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_225a.tmpl index 19ffb5a114..d3ef3fe198 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_225a.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_225a.tmpl @@ -1,15 +1,16 @@ + UNIMARC_Field 225a builder
-
+

Collection

-

+
-- 2.39.5