User As Of Circ IDL View user/tsbere/usr_as_of_circ
authorThomas Berezansky <tsbere@mvlc.org>
Fri, 6 Jan 2012 21:32:41 +0000 (16:32 -0500)
committerThomas Berezansky <tsbere@mvlc.org>
Fri, 6 Jan 2012 21:32:41 +0000 (16:32 -0500)
Adds a new view to the IDL, linked to circulations. This shows, based on
auditor table information, the user's base data as of the time of the
circulation. Not all information visible via the user is visible through
the view itself, most noticably linked information like all addresses.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Open-ILS/examples/fm_IDL.xml

index 57ef409..38ea3fe 100644 (file)
@@ -2643,6 +2643,112 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                </links>
        </class>
 
+       <class id="auaoc" controller="open-ils.reporter-store" oils_obj:fieldmapper="actor::user_as_of_circ" reporter:label="ILS User As Of Circ" oils_persist:readonly="true">
+               <oils_persist:source_definition>
+            SELECT DISTINCT ON (circ_id)
+                circ.id AS circ_id,
+                           active,
+                           alert_message,
+                           barred,
+                           billing_address,
+                           card,
+                           claims_returned_count,
+                           claims_never_checked_out_count,
+                           create_date,
+                           credit_forward_balance,
+                           day_phone,
+                           dob,
+                           email,
+                           evening_phone,
+                           expire_date,
+                           family_name,
+                           first_given_name,
+                           home_ou,
+                           aul.id,
+                           ident_type,
+                           ident_type2,
+                           ident_value,
+                           ident_value2,
+                           last_xact_id,
+                           mailing_address,
+                           master_account,
+                           net_access_level,
+                           other_phone,
+                           passwd,
+                           photo_url,
+                           prefix,
+                           profile,
+                           second_given_name,
+                           standing,
+                           suffix,
+                           super_user,
+                           usrgroup,
+                           usrname,
+                           alias,
+                           juvenile,
+                           last_update_time,
+                           deleted
+            FROM action.circulation circ JOIN auditor.actor_usr_lifecycle aul ON aul.id = circ.usr AND aul.audit_time > circ.xact_start
+            ORDER BY circ_id, audit_time
+               </oils_persist:source_definition>
+               <fields oils_persist:primary="circ_id">
+                       <field reporter:label="Circ ID" name="circ_id" reporter:datatype="id"/>
+                       <field reporter:label="Active" name="active" reporter:datatype="bool"/>
+                       <field reporter:label="Alert Message" name="alert_message"  reporter:datatype="text"/>
+                       <field reporter:label="Barred" name="barred" reporter:datatype="bool"/>
+                       <field reporter:label="Physical Address" name="billing_address" reporter:datatype="link"/>
+                       <field reporter:label="Current Library Card" name="card" reporter:datatype="link"/>
+                       <field reporter:label="Claims-returned Count" name="claims_returned_count" reporter:datatype="int" />
+                       <field reporter:label="Claims Never Checked Out Count" name="claims_never_checked_out_count" reporter:datatype="int" />
+                       <field reporter:label="Record Creation Date/Time" name="create_date" reporter:datatype="timestamp"/>
+                       <field reporter:label="User Credit Balance" name="credit_forward_balance" reporter:datatype="money" />
+                       <field reporter:label="Daytime Phone" name="day_phone"  reporter:datatype="text"/>
+                       <field reporter:label="Date of Birth" name="dob" reporter:datatype="timestamp"/>
+                       <field reporter:label="Email Address" name="email"  reporter:datatype="text"/>
+                       <field reporter:label="Evening Phone" name="evening_phone"  reporter:datatype="text"/>
+                       <field reporter:label="Privilege Expiration Date" name="expire_date" reporter:datatype="timestamp"/>
+                       <field reporter:label="Last Name" name="family_name"  reporter:datatype="text"/>
+                       <field reporter:label="First Name" name="first_given_name"  reporter:datatype="text"/>
+                       <field reporter:label="Home Library" name="home_ou" reporter:datatype="org_unit"/>
+                       <field reporter:label="User ID" name="id" reporter:datatype="id" />
+                       <field reporter:label="Primary Identification Type" name="ident_type" reporter:datatype="link"/>
+                       <field reporter:label="Secondary Identification Type" name="ident_type2" reporter:datatype="link"/>
+                       <field reporter:label="Primary Identification" name="ident_value"  reporter:datatype="text"/>
+                       <field reporter:label="Secondary Identification" name="ident_value2"  reporter:datatype="text"/>
+                       <field reporter:label="Last Transaction ID" name="last_xact_id" reporter:datatype="text"/>
+                       <field reporter:label="Mailing Address" name="mailing_address" reporter:datatype="link"/>
+                       <field reporter:label="Is Group Lead Account" name="master_account" reporter:datatype="bool"/>
+                       <field reporter:label="Internet Access Level" name="net_access_level" reporter:datatype="link"/>
+                       <field reporter:label="Other Phone" name="other_phone"  reporter:datatype="text"/>
+                       <field reporter:label="Password" name="passwd"  reporter:datatype="text"/>
+                       <field reporter:label="Photo URL" name="photo_url"  reporter:datatype="text"/>
+                       <field reporter:label="Prefix" name="prefix"  reporter:datatype="text"/>
+                       <field reporter:label="Main (Profile) Permission Group" name="profile" reporter:datatype="link"/>
+                       <field reporter:label="Middle Name" name="second_given_name"  reporter:datatype="text"/>
+                       <field reporter:label="Standing (unused)" name="standing" reporter:datatype="link"/>
+                       <field reporter:label="Suffix/Title" name="suffix"  reporter:datatype="text"/>
+                       <field reporter:label="Is Super User" name="super_user" reporter:datatype="bool"/>
+                       <field reporter:label="Family Linkage or other Group" name="usrgroup" reporter:datatype="int"/>
+                       <field reporter:label="OPAC/Staff Client User Name" name="usrname"  reporter:datatype="text"/>
+                       <field reporter:label="OPAC/Staff Client Holds Alias" name="alias"  reporter:datatype="text"/>
+                       <field reporter:label="Juvenile" name="juvenile"  reporter:datatype="bool"/>
+                       <field reporter:label="Record Last Update Time" name="last_update_time" reporter:datatype="timestamp"/>
+                       <field reporter:label="Is Deleted" name="deleted" reporter:datatype="bool"/>
+               </fields>
+               <links>
+                       <link field="net_access_level" reltype="has_a" key="id" map="" class="cnal"/>
+                       <link field="profile" reltype="has_a" key="id" map="" class="pgt"/>
+                       <link field="ident_type" reltype="has_a" key="id" map="" class="cit"/>
+                       <link field="billing_address" reltype="has_a" key="id" map="" class="aua"/>
+                       <link field="mailing_address" reltype="has_a" key="id" map="" class="aua"/>
+                       <link field="home_ou" reltype="has_a" key="id" map="" class="aou"/>
+                       <link field="standing" reltype="has_a" key="id" map="" class="cst"/>
+                       <link field="card" reltype="has_a" key="id" map="" class="ac"/>
+                       <link field="ident_type2" reltype="has_a" key="id" map="" class="cit"/>
+                       <link field="usrgroup" reltype="has_many" key="usrgroup" map="" class="au"/>
+               </links>
+       </class>
+
        <class id="csg" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::settings_group" oils_persist:tablename="config.settings_group" reporter:label="Settings Group">
                <fields oils_persist:primary="name">
                        <field name="name" reporter:datatype="text"/>
@@ -3267,6 +3373,7 @@ SELECT  usr,
                        <field reporter:label="Shelving Location" name="copy_location" reporter:datatype="link"/>
                        <field reporter:label="Archived Patron Stat-Cat Entries" name="aaactsc_entries" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Archived Copy Stat-Cat Entries" name="aaasc_entries" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="User As Of Circ" name="uaoc" oils_persist:virtual="true" reporter:datatype="link"/>
                </fields>
                <links>
                        <link field="billable_transaction" reltype="might_have" key="id" map="" class="mbt"/>
@@ -3291,6 +3398,7 @@ SELECT  usr,
                        <link field="copy_location" reltype="has_a" key="id" map="" class="acpl"/>
                        <link field="aaactsc_entries" reltype="has_many" key="xact" map="" class="aaactsc"/>
                        <link field="aaasc_entries" reltype="has_many" key="xact" map="" class="aaasc"/>
+                       <link field="uaoc" reltype="has_many" key="circ_id" map="" class="auaoc"/>
                </links>
        </class>
        <class id="combcirc" controller="open-ils.cstore" oils_obj:fieldmapper="action::all_circulation" oils_persist:tablename="action.all_circulation" reporter:core="true" reporter:label="Combined Aged and Active Circulations" oils_persist:readonly="true">