Fix IDL and OU setting check for staged users
authorJeff Godin <jgodin@tadl.org>
Tue, 29 May 2012 14:28:50 +0000 (10:28 -0400)
committerBill Erickson <berick@esilibrary.com>
Fri, 2 Aug 2013 14:40:42 +0000 (10:40 -0400)
The IDL had references to sequences that do not exist:

staging.usr_stage_row_id_seq -- a typo, fixed

In the case of staging.billing_address_stage_row_id_seq, the
staging.billing_address_stage table is created with LIKE,
and uses the sequence staging.mailing_address_stage_row_id_seq

The OU setting check for the open-ils.actor.user.stage.create API
call was not passing an org unit, and would always fail.

We now pass the home_ou of the user being staged.

At this point, the opac.allow_pending_user OU setting type must
be manually created before its value can be set.

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Stage.pm

index 882fe12..5053070 100644 (file)
@@ -8922,7 +8922,7 @@ SELECT  usr,
        </class>
 
     <class id="stgu" controller="open-ils.cstore" oils_obj:fieldmapper="staging::user_stage" oils_persist:tablename="staging.user_stage" reporter:label="User Stage">
-        <fields oils_persist:primary="row_id" oils_persist:sequence="staging.usr_stage_row_id_seq">
+        <fields oils_persist:primary="row_id" oils_persist:sequence="staging.user_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"/>
@@ -8967,7 +8967,7 @@ SELECT  usr,
     </class>
 
     <class id="stgba" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="staging::billing_address_stage" oils_persist:tablename="staging.billing_address_stage" reporter:label="Billing Address Stage">
-        <fields oils_persist:primary="row_id" oils_persist:sequence="staging.billing_address_stage_row_id_seq">
+        <fields oils_persist:primary="row_id" oils_persist:sequence="staging.mailing_address_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"/>
index 77bc685..ff60879 100644 (file)
@@ -33,8 +33,8 @@ __PACKAGE__->register_method (
 sub create_user_stage {
     my($self, $conn, $user, $mail_addr, $bill_addr, $statcats) = @_; # more?
 
-    return 0 unless $U->ou_ancestor_setting_value('opac.allow_pending_user');
     return OpenILS::Event->new('BAD_PARAMS') unless $user;
+    return 0 unless $U->ou_ancestor_setting_value($user->home_ou, 'opac.allow_pending_user');
 
     my $e = new_editor(xact => 1);