From 9eac92127c3bae0d9af4cc99a52ed70df4da65f5 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 16 May 2005 16:09:14 +0000 Subject: [PATCH 1/1] demo, coming fast git-svn-id: svn://svn.open-ils.org/ILS/trunk@729 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Actor.pm | 18 ++++++++++--- .../src/perlmods/OpenILS/Application/Cat.pm | 13 ++++++---- .../OpenILS/Application/Circ/Rules.pm | 18 ++++++++++++- .../OpenILS/Application/Search/Biblio.pm | 25 ++++++++++++++----- Open-ILS/src/perlmods/OpenILS/EX.pm | 1 + Open-ILS/src/templates/html/img | 1 + Open-ILS/src/templates/html/option | 1 + 7 files changed, 62 insertions(+), 15 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm index 1ed1a7ce8b..b938982681 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm @@ -72,9 +72,21 @@ sub update_patron { } +__PACKAGE__->register_method( + method => "user_retrieve_fleshed_by_id", + api_name => "open-ils.actor.user.fleshed.retrieve",); + +sub user_retrieve_fleshed_by_id { + my( $self, $client, $user_session, $user_id ) = @_; + my $user_obj = $apputils->check_user_session( $user_session ); + return flesh_user($user_id); +} + + sub flesh_user { my $id = shift; my $session = shift; + my $kill = 0; if(!$session) { @@ -437,12 +449,12 @@ sub search_username { __PACKAGE__->register_method( method => "user_retrieve_by_barcode", - api_name => "open-ils.actor.user.fleshed.retrieve_by_barcode", -); + api_name => "open-ils.actor.user.fleshed.retrieve_by_barcode",); sub user_retrieve_by_barcode { - my($self, $client, $barcode) = @_; + my($self, $client, $user_session, $barcode) = @_; warn "Searching for user with barcode $barcode\n"; + my $user_obj = $apputils->check_user_session( $user_session ); my $session = OpenSRF::AppSession->create("open-ils.storage"); diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm b/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm index c1bdfe15b3..aed611d137 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm @@ -33,18 +33,21 @@ sub biblio_record_tree_import { # copy the doc so that we can mangle the namespace. my $marcxml = OpenILS::Utils::FlatXML->new()->nodeset_to_xml($nodeset); - my $copy_marcxml = XML::LibXML->new->parse_string($marcxml); + my $copy_marcxml = XML::LibXML->new->parse_string($marcxml->toString); $marcxml->documentElement->setNamespace( "http://www.loc.gov/MARC21/slim", "marc", 1 ); my $tcn; + + warn "Starting db session in import\n"; + my $session = $apputils->start_db_session(); + my $source = 2; # system local source + my $xpath = '//controlfield[@tag="001"]'; $tcn = $marcxml->documentElement->findvalue($xpath); + if(_tcn_exists($session, $tcn)) {$tcn = undef;} my $tcn_source = "External"; - my $source = 2; # system local source - warn "Starting db session in import\n"; - my $session = $apputils->start_db_session(); if(!$tcn) { $xpath = '//datafield[@tag="020"]'; @@ -74,7 +77,7 @@ sub biblio_record_tree_import { if(_tcn_exists($session, $tcn)) {$tcn = undef;} } - warn "Record import with tcn: $tcn\n"; + warn "Record import with tcn: $tcn and source $tcn_source\n"; my $record = Fieldmapper::biblio::record_entry->new; diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Rules.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Rules.pm index f12e118c68..362678dded 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Rules.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Rules.pm @@ -4,6 +4,7 @@ use strict; use warnings; use OpenSRF::Utils::SettingsClient; use OpenILS::Utils::Fieldmapper; +use OpenILS::EX; use Template qw(:template); use Template::Stash; @@ -361,6 +362,16 @@ sub run_circ_scripts { my $copy = $circ_objects->{copy}; + use Data::Dumper; + warn "Building a new circulation object with\n". + "=> copy " . Dumper($copy) . + "=> duration_rule " . Dumper($duration_rule) . + "=> rec_files_rule " . Dumper($rec_fines_rule) . + "=> duration " . Dumper($duration) . + "=> recurring " . Dumper($recurring) . + "=> max " . Dumper($max); + + # build the new circ object my $circ = build_circ_object($session, $copy, $duration_rule->[1], $rec_fines_rule->[1], $duration, $recurring, $max ); @@ -415,7 +426,7 @@ __PACKAGE__->register_method( ); sub checkin { - my( $self, $user_session, $client, $barcode ) = @_; + my( $self, $client, $user_session, $barcode ) = @_; my $err; my $copy; @@ -437,6 +448,11 @@ sub checkin { "open-ils.storage.direct.asset.copy.search.barcode", $barcode ); $copy = $copy_req->gather(1)->[0]; + if(!$copy) { + $client->respond_complete( + OpenILS::EX->new("UNKNOWN_BARCODE")->ex); + } + $copy->status(0); # find circ's where the transaction is still open for the diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm index efb56a506e..4deef5230d 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm @@ -381,7 +381,12 @@ sub biblio_barcode_to_title { "open-ils.storage.biblio.record_entry.retrieve_by_barcode", $barcode ); - return { ids => $title->id, count => 1 }; + if($title) { + return { ids => $title->id, count => 1 }; + } else { + return { count => 0 }; + } + =head my $u = OpenILS::Utils::ModsParser->new(); @@ -390,6 +395,7 @@ sub biblio_barcode_to_title { $mods->doc_id($title->id()); return $mods; =cut + } @@ -621,8 +627,11 @@ sub biblio_search_class_count { # grab the mr id's from storage - my $method = "open-ils.storage.metabib.$class.search_fts.metarecord_count"; - if($self->api_name =~ /staff/) { $method = "$method.staff"; } + my $method = "open-ils.storage.cachable.metabib.$class.search_fts.metarecord_count"; + if($self->api_name =~ /staff/) { + $method = "$method.staff"; + $method =~ s/\.cachable//o; + } warn "Performing count method $method\n"; warn "API name " . $self->api_name() . "\n"; @@ -631,6 +640,7 @@ sub biblio_search_class_count { my $request = $session->request( $method, term => $string, org_unit => $org_id, + cache_page_size => 1, depth =>$org_type ); my $count = $request->gather(1); @@ -698,14 +708,17 @@ sub biblio_search_class { throw OpenSRF::EX::InvalidArg ("Not a valid search class: $class") } - my $method = "open-ils.storage.metabib.$class.search_fts.metarecord.atomic"; + #my $method = "open-ils.storage.metabib.$class.search_fts.metarecord.atomic"; + my $method = "open-ils.storage.cachable.metabib.$class.search_fts.metarecord.atomic"; if($self->api_name =~ /order/) { - $method = "open-ils.storage.metabib.$class.search_fts.metarecord.unordered.atomic"; + $method = "open-ils.storage.cachable.metabib.$class.search_fts.metarecord.unordered.atomic", + #$method = "open-ils.storage.metabib.$class.search_fts.metarecord.unordered.atomic"; } if($self->api_name =~ /staff/) { $method =~ s/atomic/staff\.atomic/og; + $method =~ s/\.cachable//o; } warn "Performing search method $method\n"; @@ -715,13 +728,13 @@ sub biblio_search_class { warn "Search making request " . time() . "\n"; my $request = $session->request( - #"open-ils.storage.cachable.metabib.$class.search_fts.metarecord.atomic", $method, term => $string, org_unit => $org_id, depth => $org_type, limit => $limit, offset => $offset, + cache_page_size => 200, ); my $records = $request->gather(1); diff --git a/Open-ILS/src/perlmods/OpenILS/EX.pm b/Open-ILS/src/perlmods/OpenILS/EX.pm index 9632d750d8..d6a693b2e6 100644 --- a/Open-ILS/src/perlmods/OpenILS/EX.pm +++ b/Open-ILS/src/perlmods/OpenILS/EX.pm @@ -11,6 +11,7 @@ use OpenILS::Utils::Fieldmapper; my %ex_types = ( UNKNOWN => 1, SEARCH_TOO_LARGE => 2, + UNKNOWN_BARCODE => 3, ); use overload ( '""' => sub { $_[0]->ex()->err_msg(); } ); diff --git a/Open-ILS/src/templates/html/img b/Open-ILS/src/templates/html/img index 35669566e1..ccdb9e4eb3 100644 --- a/Open-ILS/src/templates/html/img +++ b/Open-ILS/src/templates/html/img @@ -11,6 +11,7 @@ IF onmouseout; " onmouseout='" _ onmouseout _ "'"; END; IF onmouseover; " onmouseover='" _ onmouseover _ "'"; END; IF onclick; " onclick='" _ onclick _ "'"; END; + IF title; " title='" _ title _ "'"; END; "/>"; %] diff --git a/Open-ILS/src/templates/html/option b/Open-ILS/src/templates/html/option index d8457b64cd..5b039916d7 100644 --- a/Open-ILS/src/templates/html/option +++ b/Open-ILS/src/templates/html/option @@ -3,6 +3,7 @@ ""; IF content; -- 2.43.2