From 2095b2600c808e1326e0f5632d67fa127f53c96b Mon Sep 17 00:00:00 2001 From: Terran McCanna Date: Tue, 8 Nov 2022 16:21:06 -0500 Subject: [PATCH] Online Renewal - Now saving and responding okay Signed-off-by: Terran McCanna --- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 6 +--- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm | 40 ++++++++++++++++------ 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index a387f9bc52..476ecefa6a 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -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? diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm index 3ae2189411..d52d6a7425 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm @@ -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; -- 2.11.0