demo, coming fast
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 16 May 2005 16:09:14 +0000 (16:09 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 16 May 2005 16:09:14 +0000 (16:09 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@729 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/Rules.pm
Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Open-ILS/src/perlmods/OpenILS/EX.pm
Open-ILS/src/templates/html/img
Open-ILS/src/templates/html/option

index 1ed1a7c..b938982 100644 (file)
@@ -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");
 
index c1bdfe1..aed611d 100644 (file)
@@ -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;
 
index f12e118..362678d 100644 (file)
@@ -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
index efb56a5..4deef52 100644 (file)
@@ -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);
index 9632d75..d6a693b 100644 (file)
@@ -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(); } );
index 3566956..ccdb9e4 100644 (file)
@@ -11,6 +11,7 @@
        IF onmouseout;                                          " onmouseout='" _ onmouseout    _ "'"; END;
        IF onmouseover;                                 " onmouseover='"        _ onmouseover   _ "'"; END;
        IF onclick;                                             " onclick='"    _ onclick       _ "'"; END;
+       IF title;                                               " title='"      _ title _ "'"; END;
 
        "/>";
 %]
index d8457b6..5b03991 100644 (file)
@@ -3,6 +3,7 @@
        "<option";
                IF value;       " value='" _ value _ "'"; END; 
                IF id;          " id='" _ id _ "'"; END;
+               IF selected;            " selected='" _ selected _ "'"; END;
                IF ! content;   "/"; END;
        ">";
        IF content;