diff --git a/C4/External/Syndetics.pm b/C4/External/Syndetics.pm index f61a31c7aa..c6d7ecffd7 100644 --- a/C4/External/Syndetics.pm +++ b/C4/External/Syndetics.pm @@ -90,7 +90,7 @@ sub get_syndetics_index { ) unless !$content; my $syndetics_elements; - for my $available_type ('SUMMARY','TOC','FICTION','AWARDS1','SERIES1','SPSUMMARY','SPREVIEW','AVSUMMARY','DBCHAPTER','LJREVIEW','PWREVIEW','SLJREVIEW','CHREVIEW','BLREVIEW','HBREVIEW','KIREVIEW','CRITICASREVIEW','ANOTES') { + for my $available_type ('SUMMARY','TOC','FICTION','AWARDS1','SERIES1','SPSUMMARY','SPREVIEW', 'AVPROFILE', 'AVSUMMARY','DBCHAPTER','LJREVIEW','PWREVIEW','SLJREVIEW','CHREVIEW','BLREVIEW','HBREVIEW','KIREVIEW','CRITICASREVIEW','ANOTES') { if (exists $response->{$available_type} && $response->{$available_type} =~ /$available_type/) { $syndetics_elements->{$available_type} = $available_type; #warn "RESPONSE: $available_type : $response->{$available_type}"; @@ -100,12 +100,13 @@ sub get_syndetics_index { } sub get_syndetics_summary { - my ( $isbn,$upc,$oclc ) = @_; + my ( $isbn, $upc, $oclc, $syndetics_elements ) = @_; # grab the AWSAccessKeyId: mine is '0V5RRRRJZ3HR2RQFNHR2' my $syndetics_client_code = C4::Context->preference('SyndeticsClientCode'); - my $url = "http://www.syndetics.com/index.aspx?isbn=$isbn/SUMMARY.XML&client=$syndetics_client_code&type=xw10&upc=$upc&oclc=$oclc"; + my $summary_type = exists($syndetics_elements->{'AVSUMMARY'}) ? 'AVSUMMARY' : 'SUMMARY'; + my $url = "http://www.syndetics.com/index.aspx?isbn=$isbn/$summary_type.XML&client=$syndetics_client_code&type=xw10&upc=$upc&oclc=$oclc"; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; @@ -117,14 +118,14 @@ sub get_syndetics_summary { my $content = $response->content; warn "could not retrieve $url" unless $content; - my $xmlsimple = XML::Simple->new(); - $response = $xmlsimple->XMLin( - $content, - forcearray => [ qw(Fld520) ], - ) unless !$content; - # manipulate response USMARC VarFlds VarDFlds Notes Fld520 a my $summary; - $summary = \@{$response->{VarFlds}->{VarDFlds}->{Notes}->{Fld520}} if $response; + eval { + my $doc = $parser->parse_string($content); + $summary = $doc->findvalue('//Fld520'); + }; + if ($@) { + warn "Error parsing response from $url"; + } return $summary if $summary; } diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl index 66aa1c426e..39d25d5cd3 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl @@ -233,6 +233,11 @@ Series Information: &type=series&num=1&client=&upc=&oclc=">Click to open in new window + + + Audiovisual Profile: /avprofile.html&client=&upc=&oclc=&type=xw10">Click to open in new window + + Fiction Notes: /fiction.html&client=&upc=&oclc=&type=xw10">Click to open in new window @@ -424,13 +429,11 @@ - - - + +

Enhanced Descriptions from Syndetics:

-

- - +

+ diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index f98f30e449..5b986ac30e 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -333,9 +333,10 @@ if ( C4::Context->preference("SyndeticsEnabled") ) { if ( C4::Context->preference("SyndeticsEnabled") && C4::Context->preference("SyndeticsSummary") - && $syndetics_elements->{'SUMMARY'} =~ /SUMMARY/) { + && ( $syndetics_elements->{'SUMMARY'} =~ /SUMMARY/ + || $syndetics_elements->{'AVSUMMARY'} =~ /AVSUMMARY/ ) ) { eval { - my $syndetics_summary = &get_syndetics_summary($isbn,$upc,$oclc); + my $syndetics_summary = &get_syndetics_summary($isbn,$upc,$oclc, $syndetics_elements); $template->param( SYNDETICS_SUMMARY => $syndetics_summary ); }; warn $@ if $@;