Permalink
Browse files

Merge branch 'master' into master.ptfs

  • Loading branch information...
2 parents 8ad1d9b + 5a61a3b commit cc0c0f5b236cc3ee913f4ff36edab4b66f73a07d “Martin committed Dec 28, 2012
Showing with 1,284 additions and 5,259 deletions.
  1. +13 −9 C4/Biblio.pm
  2. +211 −1 C4/Breeding.pm
  3. +21 −0 C4/Circulation.pm
  4. +223 −0 C4/HTML5Media.pm
  5. +1 −0 C4/ImportBatch.pm
  6. +1 −1 C4/Installer/PerlDependencies.pm
  7. +2 −95 C4/Letters.pm
  8. +219 −144 C4/Search.pm
  9. +6 −6 C4/Tags.pm
  10. +49 −275 acqui/z3950_search.pl
  11. +7 −0 catalogue/detail.pl
  12. +26 −245 cataloguing/z3950_search.pl
  13. +6 −10 circ/bookcount.pl
  14. +1 −0 docs/history.txt
  15. +7 −0 installer/data/mysql/it-IT/necessari/auth_val.sql
  16. +7 −7 installer/data/mysql/it-IT/necessari/userpermissions.sql
  17. +7 −1 installer/data/mysql/sysprefs.sql
  18. +30 −0 installer/data/mysql/updatedatabase.pl
  19. +4 −0 koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
  20. +0 −148 koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc
  21. +98 −86 koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
  22. +108 −108 koha-tmpl/intranet-tmpl/prog/en/js/members.js
  23. +1 −1 koha-tmpl/intranet-tmpl/prog/en/modules/about.tt
  24. +5 −0 koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref
  25. +16 −0 koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
  26. +14 −0 koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref
  27. +1 −0 koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
  28. +16 −1 koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
  29. +3 −2 koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt
  30. +3 −2 koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
  31. +1 −1 koha-tmpl/intranet-tmpl/prog/en/modules/members/files.tt
  32. +1 −1 koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt
  33. +1 −1 koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt
  34. +1 −1 koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt
  35. +3 −0 koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
  36. +6 −4 koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
  37. +0 −2,013 koha-tmpl/opac-tmpl/ccsr/en/css/sanop.css
  38. +4 −0 koha-tmpl/opac-tmpl/prog/en/css/opac.css
  39. +0 −2,013 koha-tmpl/opac-tmpl/prog/en/css/sanop.css
  40. +4 −0 koha-tmpl/opac-tmpl/prog/en/css/sco.css
  41. +2 −2 koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
  42. +19 −0 koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
  43. +5 −1 koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
  44. +3 −0 koha-tmpl/opac-tmpl/prog/en/modules/sco/help.tt
  45. +2 −0 koha-tmpl/opac-tmpl/prog/en/modules/sco/receipt.tt
  46. +63 −52 koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt
  47. +6 −4 koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl
  48. +1 −1 kohaversion.pl
  49. +3 −1 members/moremember.pl
  50. +2 −2 members/setstatus.pl
  51. +8 −15 misc/cronjobs/overdue_notices.pl
  52. +6 −0 opac/opac-detail.pl
  53. +5 −0 opac/opac-reserve.pl
  54. +10 −0 opac/opac-search.pl
  55. +5 −0 opac/sco/help.pl
  56. +6 −2 opac/sco/sco-main.pl
  57. +10 −2 reserve/request.pl
  58. +1 −1 tools/export.pl
View
@@ -1288,7 +1288,7 @@ sub GetMarcBiblio {
my $marcxml = GetXmlBiblio($biblionumber);
Returns biblioitems.marcxml of the biblionumber passed in parameter.
-The XML contains both biblio & item datas
+The XML should only contain biblio information (item information is no longer stored in marcxml field)
=cut
@@ -1719,15 +1719,19 @@ sub GetMarcNotes {
my $note = "";
my $tag = "";
my $marcnote;
+ my %blacklist = map { $_ => 1 } split(/,/,C4::Context->preference('NotesBlacklist'));
foreach my $field ( $record->field($scope) ) {
- my $value = $field->as_string();
- if ( $note ne "" ) {
- $marcnote = { marcnote => $note, };
- push @marcnotes, $marcnote;
- $note = $value;
- }
- if ( $note ne $value ) {
- $note = $note . " " . $value;
+ my $tag = $field->tag();
+ if (!$blacklist{$tag}) {
+ my $value = $field->as_string();
+ if ( $note ne "" ) {
+ $marcnote = { marcnote => $note, };
+ push @marcnotes, $marcnote;
+ $note = $value;
+ }
+ if ( $note ne $value ) {
+ $note = $note . " " . $value;
+ }
}
}
View
@@ -33,7 +33,7 @@ BEGIN {
$VERSION = 3.07.00.049;
require Exporter;
@ISA = qw(Exporter);
- @EXPORT = qw(&ImportBreeding &BreedingSearch);
+ @EXPORT = qw(&ImportBreeding &BreedingSearch &Z3950Search);
}
=head1 NAME
@@ -213,6 +213,216 @@ sub BreedingSearch {
return($count, @results);
} # sub breedingsearch
+
+=head2 Z3950Search
+
+Z3950Search($pars, $template);
+
+Parameters for Z3950 search are all passed via the $pars hash. It may contain isbn, title, author, dewey, subject, lccall, controlnumber, stdid, srchany.
+Also it should contain an arrayref id that points to a list of id's of the z3950 targets to be queried (see z3950servers table).
+This code is used in acqui/z3950_search and cataloging/z3950_search.
+The second parameter $template is a Template object. The routine uses this parameter to store the found values into the template.
+
+=cut
+
+sub Z3950Search {
+ my ($pars, $template)= @_;
+
+ my $dbh = C4::Context->dbh;
+ my @id= @{$pars->{id}};
+ my $random= $pars->{random};
+ my $page= $pars->{page};
+ my $biblionumber= $pars->{biblionumber};
+
+ my $isbn= $pars->{isbn};
+ my $issn= $pars->{issn};
+ my $title= $pars->{title};
+ my $author= $pars->{author};
+ my $dewey= $pars->{dewey};
+ my $subject= $pars->{subject};
+ my $lccn= $pars->{lccn};
+ my $lccall= $pars->{lccall};
+ my $controlnumber= $pars->{controlnumber};
+
+ my $show_next = 0;
+ my $total_pages = 0;
+
+ my $attr = '';
+ my $term;
+ my $host;
+ my $server;
+ my $database;
+ my $port;
+ my $marcdata;
+ my @encoding;
+ my @results;
+ my $count;
+ my $record;
+ my $oldbiblio;
+ my @serverhost;
+ my @servername;
+ my @breeding_loop = ();
+
+ my @oConnection;
+ my @oResult;
+ my @errconn;
+ my $s = 0;
+ my $query;
+ my $nterms=0;
+ if ($isbn) {
+ $term=$isbn;
+ $query .= " \@attr 1=7 \@attr 5=1 \"$term\" ";
+ $nterms++;
+ }
+ if ($issn) {
+ $term=$issn;
+ $query .= " \@attr 1=8 \@attr 5=1 \"$term\" ";
+ $nterms++;
+ }
+ if ($title) {
+ utf8::decode($title);
+ $query .= " \@attr 1=4 \"$title\" ";
+ $nterms++;
+ }
+ if ($author) {
+ utf8::decode($author);
+ $query .= " \@attr 1=1003 \"$author\" ";
+ $nterms++;
+ }
+ if ($dewey) {
+ $query .= " \@attr 1=16 \"$dewey\" ";
+ $nterms++;
+ }
+ if ($subject) {
+ utf8::decode($subject);
+ $query .= " \@attr 1=21 \"$subject\" ";
+ $nterms++;
+ }
+ if ($lccn) {
+ $query .= " \@attr 1=9 $lccn ";
+ $nterms++;
+ }
+ if ($lccall) {
+ $query .= " \@attr 1=16 \@attr 2=3 \@attr 3=1 \@attr 4=1 \@attr 5=1 \@attr 6=1 \"$lccall\" ";
+ $nterms++;
+ }
+ if ($controlnumber) {
+ $query .= " \@attr 1=12 \"$controlnumber\" ";
+ $nterms++;
+ }
+ for my $i (1..$nterms-1) {
+ $query = "\@and " . $query;
+ }
+
+ foreach my $servid (@id) {
+ my $sth = $dbh->prepare("select * from z3950servers where id=?");
+ $sth->execute($servid);
+ while ( $server = $sth->fetchrow_hashref ) {
+ my $option1 = new ZOOM::Options();
+ $option1->option( 'async' => 1 );
+ $option1->option( 'elementSetName', 'F' );
+ $option1->option( 'databaseName', $server->{db} );
+ $option1->option( 'user', $server->{userid} ) if $server->{userid};
+ $option1->option( 'password', $server->{password} )
+ if $server->{password};
+ $option1->option( 'preferredRecordSyntax', $server->{syntax} );
+ $option1->option( 'timeout', $server->{timeout} ) if $server->{timeout};
+ $oConnection[$s] = create ZOOM::Connection($option1);
+ $oConnection[$s]->connect( $server->{host}, $server->{port} );
+ $serverhost[$s] = $server->{host};
+ $servername[$s] = $server->{name};
+ $encoding[$s] = ($server->{encoding}?$server->{encoding}:"iso-5426");
+ $s++;
+ } ## while fetch
+ } # foreach
+ my $nremaining = $s;
+
+ for ( my $z = 0 ; $z < $s ; $z++ ) {
+ $oResult[$z] = $oConnection[$z]->search_pqf($query);
+ }
+
+ while ( $nremaining-- ) {
+ my $k;
+ my $event;
+ while ( ( $k = ZOOM::event( \@oConnection ) ) != 0 ) {
+ $event = $oConnection[ $k - 1 ]->last_event();
+ last if $event == ZOOM::Event::ZEND;
+ }
+
+ if ( $k != 0 ) {
+ $k--;
+ my ($error, $errmsg, $addinfo, $diagset)= $oConnection[$k]->error_x();
+ if ($error) {
+ if ($error =~ m/^(10000|10007)$/ ) {
+ push(@errconn, {'server' => $serverhost[$k]});
+ }
+ }
+ else {
+ my $numresults = $oResult[$k]->size();
+ my $i;
+ my $result = '';
+ if ( $numresults > 0 and $numresults >= (($page-1)*20)) {
+ $show_next = 1 if $numresults >= ($page*20);
+ $total_pages = int($numresults/20)+1 if $total_pages < ($numresults/20);
+ for ($i = ($page-1)*20; $i < (($numresults < ($page*20)) ? $numresults : ($page*20)); $i++) {
+ my $rec = $oResult[$k]->record($i);
+ if ($rec) {
+ my $marcrecord;
+ $marcdata = $rec->raw();
+ my ($charset_result, $charset_errors);
+ ($marcrecord, $charset_result, $charset_errors)= MarcToUTF8Record($marcdata, C4::Context->preference('marcflavour'), $encoding[$k]);
+ # Normalize the record so it doesn't have separated diacritics
+ SetUTF8Flag($marcrecord);
+ my $oldbiblio = TransformMarcToKoha( $dbh, $marcrecord, "" );
+ $oldbiblio->{isbn} =~ s/ |-|\.//g if $oldbiblio->{isbn};
+ # pad | and ( with spaces to allow line breaks in the HTML
+ $oldbiblio->{isbn} =~ s/\|/ \| /g if $oldbiblio->{isbn};
+ $oldbiblio->{isbn} =~ s/\(/ \(/g if $oldbiblio->{isbn};
+ $oldbiblio->{issn} =~ s/ |-|\.//g if $oldbiblio->{issn};
+ # pad | and ( with spaces to allow line breaks in the HTML
+ $oldbiblio->{issn} =~ s/\|/ \| /g if $oldbiblio->{issn};
+ $oldbiblio->{issn} =~ s/\(/ \(/g if $oldbiblio->{issn};
+ my ($notmarcrecord, $alreadyindb, $alreadyinfarm, $imported, $breedingid)= ImportBreeding( $marcdata, 2, $serverhost[$k], $encoding[$k], $random, 'z3950' );
+ my %row_data;
+ $row_data{server} = $servername[$k];
+ $row_data{isbn} = $oldbiblio->{isbn};
+ $row_data{lccn} = $oldbiblio->{lccn};
+ $row_data{title} = $oldbiblio->{title};
+ $row_data{author} = $oldbiblio->{author};
+ $row_data{date} = $oldbiblio->{copyrightdate};
+ $row_data{edition} = $oldbiblio->{editionstatement};
+ $row_data{breedingid} = $breedingid;
+ $row_data{biblionumber} = $biblionumber;
+ push( @breeding_loop, \%row_data );
+ }
+ else {
+ push(@breeding_loop,{'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1,'biblionumber'=>-1});
+ }
+ }
+ } #if $numresults
+ }
+ } # if $k !=0
+
+ $template->param(
+ numberpending => $nremaining,
+ current_page => $page,
+ total_pages => $total_pages,
+ show_nextbutton => $show_next?1:0,
+ show_prevbutton => $page!=1,
+ );
+ } # while nremaining
+
+ my @servers = ();
+ foreach my $id (@id) {
+ push @servers, {id => $id};
+ }
+ $template->param(
+ breeding_loop => \@breeding_loop,
+ servers => \@servers,
+ errconn => \@errconn
+ );
+}
+
1;
__END__
View
@@ -83,6 +83,7 @@ BEGIN {
&GetBiblioIssues
&GetOpenIssue
&AnonymiseIssueHistory
+ &CheckIfIssuedToPatron
);
# subs to deal with returns
@@ -3445,6 +3446,26 @@ sub TransferSlip {
);
}
+=head2 CheckIfIssuedToPatron
+
+ CheckIfIssuedToPatron($borrowernumber, $biblionumber)
+
+ Return 1 if any record item is issued to patron, otherwise return 0
+
+=cut
+
+sub CheckIfIssuedToPatron {
+ my ($borrowernumber, $biblionumber) = @_;
+
+ my $items = GetItemsByBiblioitemnumber($biblionumber);
+
+ foreach my $item (@{$items}) {
+ return 1 if ($item->{borrowernumber} && $item->{borrowernumber} eq $borrowernumber);
+ }
+
+ return;
+}
+
1;
Oops, something went wrong.

0 comments on commit cc0c0f5

Please sign in to comment.