squashing bugs
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 18 May 2005 01:48:37 +0000 (01:48 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 18 May 2005 01:48:37 +0000 (01:48 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@741 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/css/opac/nav_bar.css
Evergreen/css/opac/record_result.css
Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Open-ILS/src/perlmods/OpenILS/EX.pm
Open-ILS/src/templates/strings/ex.ttk

index c21b389..d951585 100644 (file)
@@ -58,7 +58,7 @@
 #now_searching_cell{
        text-align:left;
        padding-left: 5px;
-       font-size: .75em;  
+/*     font-size: .75em;  */
 }
 
 .front_now_searching {
index ab12cc2..0ecba00 100644 (file)
 .copy_count_cell {
        vertical-align: middle;
        text-align: center;
-       border-bottom: 1px solid #FFF;
+       /*border-bottom: 1px solid #FFF;*/
+       border-bottom: 1px dashed #99C;
 }
 
 .record_result_thead_header{ 
 
 .record_misc_row {
        padding-bottom: 4px;
+       /*border-bottom: 1px dashed #99C;*/
 }
 
 .hit_count_selector_div {
index b938982..a17e9b9 100644 (file)
@@ -2,14 +2,17 @@ package OpenILS::Application::Actor;
 use base qw/OpenSRF::Application/;
 use strict; use warnings;
 use Data::Dumper;
+
 use OpenSRF::EX qw(:try);
+use OpenILS::EX;
+
 use OpenILS::Application::AppUtils;
 use OpenILS::Utils::Fieldmapper;
 use OpenILS::Application::Search::Actor;
 
 my $apputils = "OpenILS::Application::AppUtils";
 sub _d { warn "Patron:\n" . Dumper(shift()); }
-my $cache_client = OpenSRF::Utils::Cache->new( "global", 0 );
+my $cache_client = OpenSRF::Utils::Cache->new("global", 0);
 
 
 __PACKAGE__->register_method(
@@ -39,19 +42,30 @@ sub update_patron {
 
        my $new_patron;
 
-       try {
+       #try {
                # create/update the patron first so we can use his id
                if($patron->isnew()) {
                        $new_patron = _add_patron(
                                        $session, _clone_patron($patron));
+                       if(UNIVERSAL::isa($new_patron, "OpenILS::EX")) {
+                               $client->respond_complete($new_patron->ex);
+                               return undef;
+                       }
+
                } else { 
                        $new_patron = $patron; 
                }
 
                $new_patron = _add_update_addresses($session, $patron, $new_patron);
                $new_patron = _add_update_cards($session, $patron, $new_patron);
+
+               if(UNIVERSAL::isa($new_patron,"OpenILS::EX")) {
+                       $client->respond_complete($new_patron->ex);
+                       return undef;
+               }
+
                $new_patron = _add_survey_responses($session, $patron, $new_patron);
-               $new_patron     = _create_stat_maps($user_session, $patron, $new_patron);
+               $new_patron     = _create_stat_maps($session, $user_session, $patron, $new_patron);
 
                # re-update the patron if anything has happened to him during this process
                if($new_patron->ischanged()) {
@@ -59,6 +73,7 @@ sub update_patron {
                }
                $apputils->commit_db_session($session);
 
+=head
        } catch Error with { 
                my $e = shift;
                $err =  "-*- Failure adding user: $e";
@@ -67,6 +82,8 @@ sub update_patron {
        };
 
        if($err) { throw OpenSRF::EX::ERROR ($err); }
+=cut
+
        warn "Patron Update/Create complete\n";
        return flesh_user($new_patron->id());
 }
@@ -165,7 +182,9 @@ sub _add_patron {
        my $req = $session->request(
                "open-ils.storage.direct.actor.user.create",$patron);
        my $id = $req->gather(1);
-       if(!$id) { throw OpenSRF::EX::ERROR ("Unable to create new user"); }
+       if(!$id) { 
+               return OpenILS::EX->new("DUPLICATE_USER_USERNAME");
+       }
        warn "Created new patron with id $id\n";
 
        # retrieve the patron from the db to collect defaults
@@ -302,6 +321,9 @@ sub _add_update_cards {
 
                        $virtual_id = $card->id();
                        $card = _add_card($session,$card);
+                       if(UNIVERSAL::isa($card,"OpenILS::EX")) {
+                               return $card;
+                       }
 
                        if($patron->card() == $virtual_id) {
                                $new_patron->card($card->id());
@@ -329,8 +351,7 @@ sub _add_card {
 
        my $id = $req->gather(1);
        if(!$id) { 
-               throw OpenSRF::EX::ERROR 
-                       ("Unknown error creating card"); 
+               return OpenILS::EX->new("DUPLICATE_INVALID_USER_BARCODE");
        }
 
        $card->id($id);
@@ -396,24 +417,24 @@ sub _add_survey_responses {
 
 sub _create_stat_maps {
 
-       my($user_session, $patron, $new_patron) = @_;
-       my $maps = $patron->stat_cat_entries();
+       my($session, $user_session, $patron, $new_patron) = @_;
 
-       my $session = OpenSRF::AppSession->create("open-ils.circ");
+       my $maps = $patron->stat_cat_entries();
 
        for my $map (@$maps) {
 
                next unless($map->isnew() || $map->ischanged());
 
-               my $method = "open-ils.circ.stat_cat.actor.user_map.update";
+               my $method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.update";
                if($map->isnew()) {
-                       $method = "open-ils.circ.stat_cat.actor.user_map.create";
+                       $method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.create";
                }
 
-               warn "Updating stat entry with method $method and 
-                       session $user_session and map $map\n";
+               $map->target_usr($new_patron->id);
 
-               my $req = $session->request($method, $user_session, $map);
+               warn "Updating stat entry with method $method and session $user_session and map $map\n";
+
+               my $req = $session->request($method, $map);
                my $status = $req->gather(1);
 
                warn "Updated\n";
@@ -424,7 +445,6 @@ sub _create_stat_maps {
                }
        }
 
-       $session->disconnect();
        return $new_patron;
 }
 
index fdd75ff..1cd6711 100644 (file)
@@ -383,21 +383,11 @@ sub biblio_barcode_to_title {
                $barcode );
 
        if($title) {
-               return { ids => $title->id, count => 1 };
+               return { ids => [ $title->id ], count => 1 };
        } else {
                return { count => 0 };
        }
 
-
-=head
-       my $u = OpenILS::Utils::ModsParser->new();
-       $u->start_mods_batch( $title->marc );
-       my $mods = $u->finish_mods_batch();
-       $mods->doc_id($title->id());
-       return $mods;
-=cut
-
-       
 }
 
 
index d6a693b..3f0e18d 100644 (file)
@@ -9,9 +9,11 @@ use OpenILS::Utils::Fieldmapper;
 # ----------------------------------------------------------------------------------
 
 my %ex_types = (
-       UNKNOWN                         => 1,
-       SEARCH_TOO_LARGE        => 2,
-       UNKNOWN_BARCODE => 3,
+       UNKNOWN                                                 => 1,
+       SEARCH_TOO_LARGE                                => 2,
+       UNKNOWN_BARCODE                         => 3,
+       DUPLICATE_INVALID_USER_BARCODE  => 4,
+       DUPLICATE_USER_USERNAME         => 5,
 );
 
 use overload ( '""' => sub { $_[0]->ex()->err_msg(); } );
index 831178f..39bcf7c 100644 (file)
        IF type == ex_types.UNKNOWN_BARCODE;
                ret("Barcode does not exist in the database");  END;
 
+       IF type == ex_types.DUPLICATE_INVALID_USER_BARCODE;
+               ret("Barcode is a duplicate or is not valid");  END;
+
+       IF type == ex_types.DUPLICATE_USER_USERNAME;
+               ret("Username is a duplicate"); END;
+
 -%]