</fields>
</class>
+ <class id="stgs" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="staging::setting_stage" oils_persist:tablename="staging.setting_stage" reporter:label="User Setting Stage">
+ <fields oils_persist:primary="row_id" oils_persist:sequence="staging.setting_stage_row_id_seq">
+ <field reporter:label="Row ID" name="row_id" reporter:datatype="id"/>
+ <field reporter:label="Row Date" name="row_date" reporter:datatype="timestamp"/>
+ <field reporter:label="User Name" name="usrname" reporter:datatype="text"/>
+ <field reporter:label="User Setting Code" name="setting" reporter:datatype="text"/>
+ <field reporter:label="User Setting Value" name="value" reporter:datatype="text"/>
+ <field reporter:label="Complete" name="complete" reporter:datatype="bool"/>
+ </fields>
+ </class>
+
<class id="afs" controller="open-ils.cstore" oils_obj:fieldmapper="action::fieldset" oils_persist:tablename="action.fieldset" reporter:label="Fieldset">
<fields oils_persist:primary="id" oils_persist:sequence="action.fieldset_id_seq">
<field reporter:label="Fieldset ID" name="id" reporter:datatype="id"/>
api_name => 'open-ils.actor.user.stage.create',
signature => {
desc => q/
- Creates a new pending user account including addresses and statcats.
+ Creates a new pending user account including addresses, statcats, and
+ settings.
Users are added to staging tables pending staff review.
/,
params => [
{desc => 'Mailing address. Optional', type => 'object', class => 'stgma'},
{desc => 'Billing address. Optional', type => 'object', class => 'stgba'},
{desc => 'Statcats. Optional. This is an array of "stgsc" objects', type => 'array'},
+ {desc => 'Settings. Optional. This is an array of "stgs" objects', type => 'array'},
],
return => {
desc => 'username on success, Event on error',
);
sub create_user_stage {
- my($self, $conn, $user, $mail_addr, $bill_addr, $statcats) = @_; # more?
+ my($self, $conn, $user, $mail_addr, $bill_addr, $statcats, $settings) = @_; # more?
return OpenILS::Event->new('BAD_PARAMS') unless $user;
return 0 unless $U->ou_ancestor_setting_value($user->home_ou, 'opac.allow_pending_user');
}
}
+ if($settings) {
+ foreach (@$settings) {
+ $_->usrname($uname);
+ $e->create_staging_setting_stage($_) or return $e->die_event;
+ }
+ }
+
$e->commit;
$conn->respond_complete($uname);
billing_addresses => $e->search_staging_billing_address_stage({usrname => $user->usrname}),
mailing_addresses => $e->search_staging_mailing_address_stage({usrname => $user->usrname}),
cards => $e->search_staging_card_stage({usrname => $user->usrname}),
- statcats => $e->search_staging_statcat_stage({usrname => $user->usrname})
+ statcats => $e->search_staging_statcat_stage({usrname => $user->usrname}),
+ settings => $e->search_staging_setting_stage({usrname => $user->usrname}),
};
}
$e->delete_staging_statcat_stage($statcat) or return $e->die_event;
}
+ for my $setting (@{$data->{settings}}) {
+ $e->delete_staging_setting_stage($setting) or return $e->die_event;
+ }
+
$e->commit;
return 1;
}
complete BOOL DEFAULT FALSE
);
+CREATE TABLE staging.setting_stage (
+ row_id BIGSERIAL PRIMARY KEY,
+ row_date TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
+ usrname TEXT NOT NULL,
+ setting TEXT NOT NULL,
+ value TEXT NOT NULL,
+ complete BOOL DEFAULT FALSE
+);
+
-- stored procedure for deleting expired pending patrons
CREATE OR REPLACE FUNCTION staging.purge_pending_users() RETURNS VOID AS $$
DECLARE