my $U = 'OpenILS::Application::AppUtils';
# Check URL to see if this is a new registration or a renewal
-# Do the subroutines have access to this variable???
my $self = shift;
my $path = $self->apache->path_info;
my $update_type = 'register';
return Apache2::Const::OK;
}
-# Create actor.usr perl object and populate column data
+# Create actor.usr perl object and populate column data (for new registration)
sub make_user {
my $self = shift;
my $ctx = $self->ctx;
return $ctx->{user} = $au;
}
-# New sub to update a user
+# If existing account, update instead of create
sub update_user {
my $self = shift;
+ my @extra_flesh = @_;
+ my $e = $self->editor;
my $ctx = $self->ctx;
my $cgi = $self->cgi;
- my $au = Fieldmapper::actor::user->new;
+ # Grab user id, retrieve patron info from db and create patron object
+ my $patron_id = $cgi->param('patron_id');
- # Grab user id - is this how we match the right patron to update?
- $au->id($cgi->param('patron_id'));
+ my $au = $self->editor->retrieve_actor_user([$patron_id,
+ {
+ flesh => 1,
+ flesh_fields => {
+ au => ['billing_address', 'mailing_address', 'groups']
+ }
+ }
+ ]);
- # We need to figure out how to append this value rather than replace
- $au->name_keywords('quipu_renew');
+ # Replace values in patron object with new data
- my $home_ou = $cgi->param('home_ou');
+ # Need to append new keyword for use in reports later
+ $au->name_keywords($au->name_keywords + ' quipu_renew');
# Temp renewal is only 30 days, otherwise use perm_interval
- # Is using '30 days' the right syntax here?
my $temp_renewal = $cgi->param('temp_renewal');
if ($temp_renewal == '1') {
my $self = shift;
my $ctx = $self->ctx;
my $cgi = $self->cgi;
- my $user = $ctx->{user}; #Do we need to change this for renew?
+ my $user = $ctx->{user};
my $resp = $U->simplereq(
'open-ils.actor',