From: Nahuel ANGELINETTI Date: Wed, 5 Aug 2009 13:14:13 +0000 (+0200) Subject: (bug #3505) fix 210c and 225a unimarc's plugins X-Git-Tag: v3.00.04~318 X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=6b24bfa5a40878e6cf9cfa24a672a4a4e336bc9c;p=koha.git (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 Signed-off-by: Henri-Damien LAURENT --- 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

-

+