Online Renewal - Now saving and responding okay
authorTerran McCanna <tmccanna@georgialibraries.org>
Tue, 8 Nov 2022 21:21:06 +0000 (16:21 -0500)
committerTerran McCanna <tmccanna@georgialibraries.org>
Tue, 8 Nov 2022 21:21:06 +0000 (16:21 -0500)
Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm

index a387f9b..476ecef 100644 (file)
@@ -182,15 +182,11 @@ sub load {
 
     $self->load_simple("myopac") if $path =~ m:opac/myopac:; # A default page for myopac parts
 
-    # maybe make these optional parts of load_patron_reg?
-    #return $self->load_ecard_form if $path =~ m|opac/ecard/form|;
+    # PINES - online account registration
     return $self->load_ecard_submit if $path =~ m|opac/ecard/submit|;
-    # this line is only used if verifying by email (from KCLS code):
-    # return $self->load_ecard_verify if $path =~ m|opac/ecard/verify|;
 
     # PINES - online account renewal
     return $self->load_simple("renew-account") if $path =~ m|opac/renew-account|;
-    return $self->load_ecard_submit if $path =~ m|opac/renew/submit|;
 
     if($path =~ m|opac/login|) {
         return $self->load_login unless $self->editor->requestor; # already logged in?
index 3ae2189..d52d6a7 100644 (file)
@@ -103,6 +103,9 @@ sub log_params {
     }
     $logger->info("ECARD: Submit params: $msg");
 
+#TERRAN - dump out all incoming stuff from form
+$logger->error("TERRAN - all incoming params: $msg");
+
 }
 
 sub handle_testmode_api {
@@ -153,13 +156,15 @@ sub load_ecard_submit {
     my $cgi = $self->cgi;
 
     #determine whether this is a new registration or a renewal
-    my $refpath = $self->apache->path_info;
-    if ($refpath =~ m|opac/renew/submit|) {
+    if ($cgi->param('patron_id') > 1) {
         $update_type = 'renew';
     } else {
         $update_type = 'register';
     }
 
+    #TERRAN TEST ECARD CONNECTION
+    $logger->error("TERRAN ACTION TYPE: $update_type");
+
     $self->log_params;
 
     my $testmode = $cgi->param('testmode') || '';
@@ -207,12 +212,18 @@ sub load_ecard_submit {
         return $self->compile_response unless $self->save_user;
         return $self->compile_response if $ctx->{response}->{status};
     }
-    
+
+
+# Add extra info to response message
     $ctx->{response}->{status} = 'OK';
-    $ctx->{response}->{barcode} = $ctx->{user}->card->barcode;
+
     if ($update_type eq 'renew') {
         $ctx->{response}->{expire_date} = $ctx->{user}->expire_date;
-    }
+        # TERRAN - Add code if this is a temp renewal
+        # TERRAN - Add home library code
+    } else {
+        $ctx->{response}->{barcode} = $ctx->{user}->card->barcode;
+       }
 
     return $self->compile_response;
 }
@@ -263,7 +274,7 @@ sub compile_response {
     $logger->info("ECARD responding with " . $ctx->{response});
 
 #TERRAN TEST
-$logger->error("TERRAN response being sent to Quipu is: " . $ctx->{response});
+    $logger->error("TERRAN - compiled response is " . $ctx->{response});
 
     return Apache2::Const::OK;
 }
@@ -280,12 +291,17 @@ sub make_user {
     $au->isnew(1);
     $au->net_access_level(1); # Filtered
     $au->name_keywords($in_house ? 'quipu_inhouse' : 'quipu_remote');
-    my $home_ou = $cgi->param('home_ou');
 
-    my $perm_grp = $U->ou_ancestor_setting_value(
-        $home_ou,
-        'lib.ecard_patron_profile'
-    );
+# TERRAN - for testing purposes, hardcoding the home_ou temporarily
+#    my $home_ou = $cgi->param('home_ou');
+    my $home_ou = '4';
+
+# TERRAN - for testing purposes, hardcoding perm_grp temporarily
+#    my $perm_grp = $U->ou_ancestor_setting_value(
+#        $home_ou,
+#        'lib.ecard_patron_profile'
+#    );
+    my $perm_grp = '2';
 
     $au->profile($perm_grp);
     my $grp = new_editor()->retrieve_permission_grp_tree($perm_grp);
@@ -313,6 +329,7 @@ sub make_user {
 
         $val = undef if $field eq 'day_phone' && $val eq '--';
         $self->verify_dob($val) if $field eq 'dob' && $val;
+
         $au->$field($val);
     }
 
@@ -323,6 +340,7 @@ sub make_user {
 
 # If existing account, update instead of create
 sub update_user {
+
     my $self = shift;
     my @extra_flesh = @_;
     my $e = $self->editor;