LP#1234927: Pluralizing link names to follow convention.
[working/Evergreen.git] / Open-ILS / examples / fm_IDL.xml
index e86ee9c..40fd709 100644 (file)
@@ -1383,7 +1383,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                </permacrud>
        </class>
 
-       <class id="aws" controller="open-ils.cstore" oils_obj:fieldmapper="actor::workstation" oils_persist:tablename="actor.workstation" reporter:label="Workstation">
+       <class id="aws" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="actor::workstation" oils_persist:tablename="actor.workstation" reporter:label="Workstation">
                <fields oils_persist:primary="id" oils_persist:sequence="actor.workstation_id_seq">
                        <field reporter:label="Workstation ID" name="id" reporter:datatype="id"/>
                        <field reporter:label="Workstation Name" name="name" reporter:datatype="text"/>
@@ -1396,6 +1396,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <link field="toolbars" reltype="has_many" key="ws" map="" class="atb"/>
                        <link field="circulations" reltype="has_many" key="workstation" map="" class="circ"/>
                </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <retrieve permission="STAFF_LOGIN" context_field="owning_lib" />
+                       </actions>
+               </permacrud>
        </class>
 
        <class id="ccm" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::circ_modifier" oils_persist:tablename="config.circ_modifier" reporter:label="Circulation Modifier">
@@ -1963,7 +1968,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
             </actions>
         </permacrud>
        </class>
-       <class id="mbts" controller="open-ils.cstore" oils_obj:fieldmapper="money::billable_transaction_summary" oils_persist:tablename="money.materialized_billable_xact_summary" reporter:label="Billable Transaction Summary" oils_persist:readonly="true">
+       <class id="mbts" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="money::billable_transaction_summary" oils_persist:tablename="money.materialized_billable_xact_summary" reporter:label="Billable Transaction Summary" oils_persist:readonly="true">
                <fields oils_persist:primary="id" oils_persist:sequence="">
                        <field reporter:label="Balance Owed" name="balance_owed" reporter:datatype="money"/>
                        <field reporter:label="Transaction ID" name="id" reporter:datatype="id"/>
@@ -1983,6 +1988,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                <links>
                        <link field="usr" reltype="has_a" key="id" map="" class="au"/>
                </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <retrieve permission="VIEW_USER_TRANSACTIONS">
+                                       <context link="usr" field="home_ou" />
+                               </retrieve>
+                       </actions>
+               </permacrud>
        </class>
        <class id="mbtslv" controller="open-ils.cstore" oils_obj:fieldmapper="money::billable_transaction_summary_location_view" oils_persist:tablename="money.billable_xact_summary_location_view" reporter:label="Billable Transaction Summary with Billing Location" oils_persist:readonly="true" reporter:core="true">
                <fields oils_persist:primary="id" oils_persist:sequence="">
@@ -2007,7 +2019,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <link field="billing_location" reltype="has_a" key="id" map="" class="aou"/>
                </links>
        </class>
-       <class id="aun" controller="open-ils.cstore" oils_obj:fieldmapper="actor::usr_note" oils_persist:tablename="actor.usr_note" reporter:label="User Note">
+       <class id="aun" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="actor::usr_note" oils_persist:tablename="actor.usr_note" reporter:label="User Note">
                <fields oils_persist:primary="id" oils_persist:sequence="actor.usr_note_id_seq">
                        <field reporter:label="Creation Date/Time" name="create_date" reporter:datatype="timestamp"/>
                        <field reporter:label="Creating Staff" name="creator" reporter:datatype="link"/>
@@ -2021,6 +2033,23 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <link field="usr" reltype="has_a" key="id" map="" class="au"/>
                        <link field="creator" reltype="has_a" key="id" map="" class="au"/>
                </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <create permission="UPDATE_USER" context_field="owner">
+                    <context link="usr" field="home_ou"/>
+                </create>
+                               <!-- note: public notes are still accessible via API -->
+                <retrieve permission="UPDATE_USER">
+                    <context link="usr" field="home_ou"/>
+                               </retrieve>
+                <update permission="UPDATE_USER">
+                    <context link="usr" field="home_ou"/>
+                               </update>
+                <delete permission="UPDATE_USER">
+                    <context link="usr" field="home_ou"/>
+                               </delete>
+            </actions>
+        </permacrud>
        </class>
        <class id="aupr" controller="open-ils.cstore" oils_obj:fieldmapper="actor::usr_password_reset" oils_persist:tablename="actor.usr_password_reset" reporter:label="User password reset requests">
                <fields oils_persist:primary="id" oils_persist:sequence="actor.usr_password_reset_id_seq">
@@ -2352,6 +2381,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field name="source" />
                        <field reporter:label="Control Set" name="control_set" reporter:datatype="link"/>
                        <field reporter:label="Owner" name="owner"  reporter:datatype="org_unit"/>
+                       <field name="heading" />
+                       <field name="simple_heading" />
                        <field name="fixed_fields" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field name="notes" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field name="bib_links" oils_persist:virtual="true" reporter:datatype="link"/>
@@ -2425,7 +2456,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
             </actions>
         </permacrud>
        </class>
-       <class id="mccp" controller="open-ils.cstore" oils_obj:fieldmapper="money::credit_card_payment" oils_persist:tablename="money.credit_card_payment" reporter:label="Credit Card Payment">
+       <class id="mccp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="money::credit_card_payment" oils_persist:tablename="money.credit_card_payment" reporter:label="Credit Card Payment">
                <fields oils_persist:primary="id" oils_persist:sequence="money.payment_id_seq">
                        <field name="accepting_usr" />
                        <field name="amount" reporter:datatype="money" />
@@ -2453,6 +2484,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <link field="cash_drawer" reltype="has_a" key="id" map="" class="aws"/>
                        <link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
                </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve permission="VIEW_USER_TRANSACTIONS">
+                    <context link="xact" jump="usr" field="home_ou"/>
+                </retrieve>
+                       </actions>
+               </permacrud>
        </class>
        <class id="cxt" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::xml_transform" oils_persist:tablename="config.xml_transform" reporter:label="XML/XSLT Transform Definition">
                <fields oils_persist:primary="name">
@@ -2848,6 +2886,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                 <create permission="CREATE_MARC IMPORT_MARC" global_required="true"/>
                 <retrieve/>
                 <update permission="UPDATE_MARC" global_required="true"/>
+               <!-- WARNING: Deleting records via PCRUD does NOT check that any prerequisite conditions have been handled first. It is your responsibility to check for those conditions before deleting bib records. -->
+                <delete permission="DELETE_RECORD" global_required="true"/>
             </actions>
         </permacrud>
        </class>
@@ -3002,7 +3042,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                </permacrud>
        </class>
 
-       <class id="mobts" controller="open-ils.cstore" oils_obj:fieldmapper="money::open_billable_transaction_summary" oils_persist:tablename="money.open_billable_xact_summary" reporter:label="Open Billable Transaction Summary">
+       <class id="mobts" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="money::open_billable_transaction_summary" oils_persist:tablename="money.open_billable_xact_summary" reporter:label="Open Billable Transaction Summary">
                <fields oils_persist:primary="id" oils_persist:sequence="">
                        <field name="balance_owed" reporter:datatype="money"/>
                        <field name="id" reporter:datatype="id" />
@@ -3032,6 +3072,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <link field="reservation" reltype="might_have" key="id" map="" class="bresv"/>
                        <link field="billing_location" reltype="has_a" key="id" map="" class="aou"/>
                </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <retrieve permission="VIEW_USER_TRANSACTIONS">
+                                       <context link="usr" field="home_ou" />
+                               </retrieve>
+                       </actions>
+               </permacrud>
        </class>
        <class id="au" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="actor::user" oils_persist:tablename="actor.usr" reporter:core="true" reporter:label="ILS User">
                <fields oils_persist:primary="id" oils_persist:sequence="actor.usr_id_seq">
@@ -3471,7 +3518,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <link field="field" reltype="has_a" key="id" map="" class="cmf"/>
                </links>
        </class>
-       <class id="mcp" controller="open-ils.cstore" oils_obj:fieldmapper="money::cash_payment" oils_persist:tablename="money.cash_payment" reporter:label="Cash Payment">
+       <class id="mcp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="money::cash_payment" oils_persist:tablename="money.cash_payment" reporter:label="Cash Payment">
                <fields oils_persist:primary="id" oils_persist:sequence="money.payment_id_seq">
                        <field name="accepting_usr" reporter:datatype="link"/>
                        <field name="amount" reporter:datatype="money" />
@@ -3490,8 +3537,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <link field="cash_drawer" reltype="has_a" key="id" map="" class="aws"/>
                        <link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
                </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve permission="VIEW_USER_TRANSACTIONS">
+                    <context link="xact" jump="usr" field="home_ou"/>
+                </retrieve>
+                       </actions>
+               </permacrud>
        </class>
-       <class id="mfp" controller="open-ils.cstore" oils_obj:fieldmapper="money::forgive_payment" oils_persist:tablename="money.forgive_payment" reporter:label="Forgive Payment">
+       <class id="mfp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="money::forgive_payment" oils_persist:tablename="money.forgive_payment" reporter:label="Forgive Payment">
                <fields oils_persist:primary="id" oils_persist:sequence="money.payment_id_seq">
                        <field name="accepting_usr" reporter:datatype="link"/>
                        <field name="amount" reporter:datatype="money" />
@@ -3508,6 +3562,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <link field="accepting_usr" reltype="has_a" key="id" map="" class="au"/>
                        <link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
                </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve permission="VIEW_USER_TRANSACTIONS">
+                    <context link="xact" jump="usr" field="home_ou"/>
+                </retrieve>
+                       </actions>
+               </permacrud>
        </class>
        <class id="mrd" controller="open-ils.cstore" oils_obj:fieldmapper="metabib::record_descriptor" oils_persist:tablename="metabib.rec_descriptor" reporter:label="Basic Record Descriptor">
                <fields oils_persist:primary="id" oils_persist:sequence="metabib.rec_descriptor_id_seq">
@@ -3770,8 +3831,8 @@ SELECT  usr,
         ) AS overdue,
 
         SUM( CASE WHEN (xact_finish IS NULL AND stop_fines = 'LOST') THEN 1 ELSE 0 END) AS lost,
-        SUM( CASE WHEN (xact_finish IS NULL AND stop_fines = 'CLAIMSRETURNED') THEN 1 ELSE 0 END) AS claims_returned,
-        SUM( CASE WHEN (xact_finish IS NULL AND stop_fines = 'LONGOVERDUE') THEN 1 ELSE 0 END) AS long_overdue
+        SUM( CASE WHEN stop_fines = 'CLAIMSRETURNED' THEN 1 ELSE 0 END) AS claims_returned,
+        SUM( CASE WHEN stop_fines = 'LONGOVERDUE' THEN 1 ELSE 0 END) AS long_overdue
   FROM  action.circulation
   WHERE checkin_time IS NULL
   GROUP BY 1
@@ -3812,8 +3873,8 @@ SELECT  usr,
         ,',') AS overdue,
 
         STRING_AGG( CASE WHEN (xact_finish IS NULL AND stop_fines = 'LOST') THEN id::TEXT ELSE '0' END,',') AS lost,
-        STRING_AGG( CASE WHEN (xact_finish IS NULL AND stop_fines = 'CLAIMSRETURNED') THEN id::TEXT ELSE '0' END,',') AS claims_returned,
-        STRING_AGG( CASE WHEN (xact_finish IS NULL AND stop_fines = 'LONGOVERDUE') THEN id::TEXT ELSE '0' END,',') AS long_overdue
+        STRING_AGG( CASE WHEN stop_fines = 'CLAIMSRETURNED' THEN id::TEXT ELSE '0' END,',') AS claims_returned,
+        STRING_AGG( CASE WHEN stop_fines = 'LONGOVERDUE' THEN id::TEXT ELSE '0' END,',') AS long_overdue
   FROM  action.circulation
   WHERE checkin_time IS NULL
   GROUP BY 1
@@ -4336,7 +4397,7 @@ SELECT  usr,
                        <link field="target_copy" reltype="has_a" key="id" map="" class="acp"/>
                </links>
        </class>
-       <class id="ahn" controller="open-ils.cstore" oils_obj:fieldmapper="action::hold_notification" oils_persist:tablename="action.hold_notification" reporter:label="Hold Notification">
+       <class id="ahn" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="action::hold_notification" oils_persist:tablename="action.hold_notification" reporter:label="Hold Notification">
                <fields oils_persist:primary="id" oils_persist:sequence="action.hold_notification_id_seq">
                        <field reporter:label="Hold" name="hold" reporter:datatype="link"/>
                        <field reporter:label="Notification ID" name="id" reporter:datatype="id" />
@@ -4349,6 +4410,22 @@ SELECT  usr,
                        <link field="hold" reltype="has_a" key="id" map="" class="ahr"/>
                        <link field="notify_staff" reltype="has_a" key="id" map="" class="au"/>
                </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <create permission="CREATE_HOLD_NOTIFICATION">
+                                       <context link="hold" jump="usr" field="home_ou" />
+                               </create>
+                <retrieve permission="VIEW_HOLD_NOTIFICATION">
+                                       <context link="hold" jump="usr" field="home_ou" />
+                               </retrieve>
+                <update permission="CREATE_HOLD_NOTIFICATION">
+                                       <context link="hold" jump="usr" field="home_ou" />
+                               </update>
+                <delete permission="CREATE_HOLD_NOTIFICATION">
+                                       <context link="hold" jump="usr" field="home_ou" />
+                               </delete>
+            </actions>
+        </permacrud>
        </class>
        <class id="acpl" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="asset::copy_location" oils_persist:tablename="asset.copy_location" reporter:label="Copy/Shelving Location"  oils_persist:field_safe="true">
                <fields oils_persist:primary="id" oils_persist:sequence="asset.copy_location_id_seq">
@@ -5421,7 +5498,8 @@ SELECT  usr,
                        ahr.capture_time IS NULL AND
                        ahr.cancel_time IS NULL AND
                        csp.id IS NULL AND
-                       (ahr.expire_time is NULL OR ahr.expire_time > NOW())
+                       (ahr.expire_time is NULL OR ahr.expire_time > NOW()) AND
+                       acp.status IN (0,7)
                ]]></oils_persist:source_definition>
                <fields oils_persist:primary="id">
                        <field reporter:label="Status" name="status" oils_persist:virtual="true" />
@@ -5628,6 +5706,7 @@ SELECT  usr,
                        <field reporter:label="Is Mint Condition" name="mint_condition" reporter:datatype="bool" />
                        <field reporter:label="Shelf Expire Time" name="shelf_expire_time" reporter:datatype="timestamp"/>
                        <field reporter:label="Current Shelf Lib" name="current_shelf_lib" reporter:datatype="org_unit"/>
+                       <field reporter:label="Behind Desk" name="behind_desk" reporter:datatype="bool"/>
                </fields>
                <links>
                        <link field="fulfillment_lib" reltype="has_a" key="id" map="" class="aou"/>
@@ -5962,7 +6041,7 @@ SELECT  usr,
                        <link field="bucket" reltype="has_a" key="id" map="" class="cub"/>
                </links>
        </class>
-       <class id="mcrp" controller="open-ils.cstore" oils_obj:fieldmapper="money::credit_payment" oils_persist:tablename="money.credit_payment" reporter:label="House Credit Payment">
+       <class id="mcrp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="money::credit_payment" oils_persist:tablename="money.credit_payment" reporter:label="House Credit Payment">
                <fields oils_persist:primary="id" oils_persist:sequence="money.payment_id_seq">
                        <field reporter:label="Accepting Staff Member" name="accepting_usr" reporter:datatype="link"/>
                        <field reporter:label="Amount" name="amount" reporter:datatype="money" />
@@ -5979,6 +6058,13 @@ SELECT  usr,
                        <link field="accepting_usr" reltype="has_a" key="id" map="" class="au"/>
                        <link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
                </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve permission="VIEW_USER_TRANSACTIONS">
+                    <context link="xact" jump="usr" field="home_ou"/>
+                </retrieve>
+                       </actions>
+               </permacrud>
        </class>
        <class id="afr" controller="open-ils.cstore" oils_obj:fieldmapper="authority::full_rec" oils_persist:tablename="authority.full_rec" reporter:label="Full Authority Record">
                <fields oils_persist:primary="id" oils_persist:sequence="authority.full_rec_id_seq">
@@ -6007,7 +6093,7 @@ SELECT  usr,
                        <link field="field" reltype="has_a" key="id" map="" class="acsaf"/>
                </links>
        </class>
-       <class id="cnct" controller="open-ils.cstore" oils_obj:fieldmapper="config::non_cataloged_type" oils_persist:tablename="config.non_cataloged_type" reporter:label="Non-cataloged Type">
+       <class id="cnct" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::non_cataloged_type" oils_persist:tablename="config.non_cataloged_type" reporter:label="Non-cataloged Type">
                <fields oils_persist:primary="id" oils_persist:sequence="config.non_cataloged_type_id_seq">
                        <field reporter:label="Circulation Duration" name="circ_duration" reporter:datatype="interval"/>
                        <field reporter:label="Non-cat Type ID" name="id" reporter:selector="name" reporter:datatype="id"/>
@@ -6018,6 +6104,15 @@ SELECT  usr,
                <links>
                        <link field="owning_lib" reltype="has_a" key="id" map="" class="aou"/>
                </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <create permission="CREATE_NON_CAT_TYPE" context_field="owning_lib"/>
+                <retrieve/>
+                <update permission="CREATE_NON_CAT_TYPE" context_field="owning_lib"/>
+                <delete permission="CREATE_NON_CAT_TYPE" context_field="owning_lib"/>
+            </actions>
+        </permacrud>
+
        </class>
        <class id="aout" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="actor::org_unit_type" oils_persist:tablename="actor.org_unit_type" reporter:label="Organizational Unit Type" oils_persist:field_safe="true">
                <fields oils_persist:primary="id" oils_persist:sequence="actor.org_unit_type_id_seq">
@@ -6115,7 +6210,7 @@ SELECT  usr,
             </actions>
         </permacrud>
        </class>
-       <class id="mbt" controller="open-ils.cstore" oils_obj:fieldmapper="money::billable_transaction" oils_persist:tablename="money.billable_xact" reporter:label="Billable Transaction">
+       <class id="mbt" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="money::billable_transaction" oils_persist:tablename="money.billable_xact" reporter:label="Billable Transaction">
                <fields oils_persist:primary="id" oils_persist:sequence="money.billable_xact_id_seq">
                        <field reporter:label="Transaction ID" name="id" reporter:datatype="id" />
                        <field reporter:label="User" name="usr" reporter:datatype="link"/>
@@ -6140,6 +6235,13 @@ SELECT  usr,
                        <link field="payment_total" reltype="might_have" key="xact" map="" class="rxpt"/>
                        <link field="summary" reltype="might_have" key="id" map="" class="mbts"/>
                </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <retrieve permission="VIEW_USER_TRANSACTIONS">
+                                       <context link="usr" field="home_ou" />
+                               </retrieve>
+                       </actions>
+               </permacrud>
        </class>
        <class id="actsce" controller="open-ils.cstore" oils_obj:fieldmapper="actor::stat_cat_entry" oils_persist:tablename="actor.stat_cat_entry" reporter:label="User Stat Cat Entry">
                <fields oils_persist:primary="id" oils_persist:sequence="actor.stat_cat_entry_id_seq">
@@ -6220,7 +6322,7 @@ SELECT  usr,
             </actions>
         </permacrud>
        </class>
-       <class id="mwp" controller="open-ils.cstore" oils_obj:fieldmapper="money::work_payment" oils_persist:tablename="money.work_payment" reporter:label="Work Payment">
+       <class id="mwp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="money::work_payment" oils_persist:tablename="money.work_payment" reporter:label="Work Payment">
                <fields oils_persist:primary="id" oils_persist:sequence="money.payment_id_seq">
                        <field reporter:label="Accepting Staff Member" name="accepting_usr" reporter:datatype="link"/>
                        <field reporter:label="Amount" name="amount" reporter:datatype="money" />
@@ -6237,8 +6339,15 @@ SELECT  usr,
                        <link field="accepting_usr" reltype="has_a" key="id" map="" class="au"/>
                        <link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
                </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve permission="VIEW_USER_TRANSACTIONS">
+                    <context link="xact" jump="usr" field="home_ou"/>
+                </retrieve>
+                       </actions>
+               </permacrud>
        </class>
-       <class id="mgp" controller="open-ils.cstore" oils_obj:fieldmapper="money::goods_payment" oils_persist:tablename="money.goods_payment" reporter:label="Goods Payment">
+       <class id="mgp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="money::goods_payment" oils_persist:tablename="money.goods_payment" reporter:label="Goods Payment">
                <fields oils_persist:primary="id" oils_persist:sequence="money.payment_id_seq">
                        <field reporter:label="Accepting Staff Member" name="accepting_usr" reporter:datatype="link"/>
                        <field reporter:label="Amount" name="amount" reporter:datatype="money" />
@@ -6255,6 +6364,13 @@ SELECT  usr,
                        <link field="accepting_usr" reltype="has_a" key="id" map="" class="au"/>
                        <link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
                </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve permission="VIEW_USER_TRANSACTIONS">
+                    <context link="xact" jump="usr" field="home_ou"/>
+                </retrieve>
+                       </actions>
+               </permacrud>
        </class>
        <class id="aoc" controller="open-ils.cstore" oils_obj:fieldmapper="action::open_circulation" oils_persist:tablename="action.open_circulation" reporter:label="Open Circulation">
                <fields oils_persist:primary="id" oils_persist:sequence="">
@@ -6324,7 +6440,7 @@ SELECT  usr,
             </actions>
         </permacrud>
        </class>
-       <class id="mckp" controller="open-ils.cstore" oils_obj:fieldmapper="money::check_payment" oils_persist:tablename="money.check_payment" reporter:label="Check Payment">
+       <class id="mckp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="money::check_payment" oils_persist:tablename="money.check_payment" reporter:label="Check Payment">
                <fields oils_persist:primary="id" oils_persist:sequence="money.payment_id_seq">
                        <field reporter:label="Accepting Staff Member" name="accepting_usr" reporter:datatype="link"/>
                        <field reporter:label="Amount" name="amount" reporter:datatype="money" />
@@ -6344,6 +6460,13 @@ SELECT  usr,
                        <link field="cash_drawer" reltype="has_a" key="id" map="" class="aws"/>
                        <link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
                </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve permission="VIEW_USER_TRANSACTIONS">
+                    <context link="xact" jump="usr" field="home_ou"/>
+                </retrieve>
+                       </actions>
+               </permacrud>
        </class>
        <class id="acp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="asset::copy" oils_persist:tablename="asset.copy" reporter:core="true" reporter:label="Item">
                <fields oils_persist:primary="id" oils_persist:sequence="asset.copy_id_seq">
@@ -6383,6 +6506,8 @@ SELECT  usr,
                        <field reporter:label="Copy Notes" name="notes" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Stat-Cat entry maps" name="stat_cat_entry_copy_maps" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Circulations" name="circulations" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Aged (patronless) Circulations" name="aged_circulations" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Combined Aged and Active Circulations" name="all_circulations" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Total Circulations" name="total_circ_count" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Last Circulation Date" name="last_circ" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Holds" name="holds" oils_persist:virtual="true" reporter:datatype="link"/>
@@ -6405,6 +6530,8 @@ SELECT  usr,
                        <link field="notes" reltype="has_many" key="owning_copy" map="" class="acpn"/>
                        <link field="stat_cat_entries" reltype="has_many" key="owning_copy" map="stat_cat_entry" class="ascecm"/>
                        <link field="circulations" reltype="has_many" key="target_copy" map="" class="circ"/>
+                       <link field="aged_circulations" reltype="has_many" key="target_copy" map="" class="acirc"/>
+                       <link field="all_circulations" reltype="has_many" key="target_copy" map="" class="combcirc"/>
                        <link field="total_circ_count" reltype="might_have" key="id" map="" class="erfcc"/>
                        <link field="last_circ" reltype="might_have" key="id" map="" class="rlc"/>
                        <link field="circ_modifier" reltype="has_a" key="code" map="" class="ccm"/>
@@ -6726,7 +6853,7 @@ SELECT  usr,
                        <link field="perm" reltype="has_a" key="id" map="" class="ppl"/>
                </links>
        </class>
-       <class id="mp" controller="open-ils.cstore" oils_obj:fieldmapper="money::payment" oils_persist:tablename="money.payment_view" reporter:core="true" reporter:label="Payments: All">
+       <class id="mp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="money::payment" oils_persist:tablename="money.payment_view" reporter:core="true" reporter:label="Payments: All">
                <fields oils_persist:primary="id" oils_persist:sequence="">
                        <field reporter:label="Amount" name="amount" reporter:datatype="money" />
                        <field reporter:label="Payment ID" name="id" reporter:datatype="id" />
@@ -6753,6 +6880,13 @@ SELECT  usr,
                        <link field="goods_payment" reltype="might_have" key="id" map="" class="mgp"/>
                        <link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
                </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve permission="VIEW_USER_TRANSACTIONS">
+                    <context link="xact" jump="usr" field="home_ou"/>
+                </retrieve>
+                       </actions>
+               </permacrud>
        </class>
        <class id="mbp" controller="open-ils.cstore" oils_obj:fieldmapper="money::bnm_payment" oils_persist:tablename="money.bnm_payment_view" reporter:core="true" reporter:label="Payments: Brick-and-mortar">
                <fields oils_persist:primary="id" oils_persist:sequence="">
@@ -6970,7 +7104,7 @@ SELECT  usr,
             </actions>
         </permacrud>
        </class>
-       <class id="mb" controller="open-ils.cstore" oils_obj:fieldmapper="money::billing" oils_persist:tablename="money.billing" reporter:label="Billing Line Item">
+       <class id="mb" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="money::billing" oils_persist:tablename="money.billing" reporter:label="Billing Line Item">
                <fields oils_persist:primary="id" oils_persist:sequence="money.billing_id_seq">
                        <field reporter:label="Amount" name="amount" reporter:datatype="money" />
                        <field reporter:label="Billing Timestamp" name="billing_ts" reporter:datatype="timestamp"/>
@@ -6988,6 +7122,13 @@ SELECT  usr,
                        <link field="voider" reltype="has_a" key="id" map="" class="au"/>
                        <link field="btype" reltype="has_a" key="id" map="" class="cbt"/>
                </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve permission="VIEW_USER_TRANSACTIONS">
+                    <context link="xact" jump="usr" field="home_ou"/>
+                </retrieve>
+                       </actions>
+               </permacrud>
        </class>
        <class id="pugm" controller="open-ils.cstore" oils_obj:fieldmapper="permission::usr_grp_map" oils_persist:tablename="permission.usr_grp_map" reporter:label="User Group Map">
                <fields oils_persist:primary="id" oils_persist:sequence="permission.usr_grp_map_id_seq">
@@ -7673,7 +7814,7 @@ SELECT  usr,
             <link field="combined_balance" reltype="might_have" key="fund" map="" class="acqfcb"/>
             <link field="spent_balance" reltype="might_have" key="fund" map="" class="acqfsb"/>
                </links>
-        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1" ignore_object_perms="true">
             <actions>
                 <create permission="ADMIN_ACQ_FUND" context_field="org"/>
                 <retrieve permission="ADMIN_ACQ_FUND VIEW_FUND MANAGE_FUND" context_field="org"/>
@@ -10143,7 +10284,7 @@ SELECT  usr,
                         SELECT 
                             (SELECT id
                                 FROM biblio.record_entry 
-                                WHERE id = (SELECT record FROM asset.call_number WHERE id = call_number)
+                                WHERE id = (SELECT record FROM asset.call_number WHERE id = call_number and deleted is false)
                             ) AS "bre", 
                             COUNT(*) AS "copy_count"
                         FROM asset.copy
@@ -10509,6 +10650,7 @@ SELECT  usr,
                        <field reporter:label="Item Count" name="item_count" reporter:datatype="int"/>
                        <field reporter:label="Receive Count" name="recv_count" reporter:datatype="int"/>
                        <field reporter:label="Cancel Count" name="cancel_count" reporter:datatype="int"/>
+                       <field reporter:label="Delay Count" name="delay_count" reporter:datatype="int"/>
                        <field reporter:label="Invoice Count" name="invoice_count" reporter:datatype="int"/>
                        <field reporter:label="Claim Count" name="claim_count" reporter:datatype="int"/>
                        <field reporter:label="Estimated Amount" name="estimated_amount" reporter:datatype="money"/>
@@ -10529,6 +10671,7 @@ SELECT  usr,
                        <field reporter:label="Item Count" name="item_count" reporter:datatype="int"/>
                        <field reporter:label="Receive Count" name="recv_count" reporter:datatype="int"/>
                        <field reporter:label="Cancel Count" name="cancel_count" reporter:datatype="int"/>
+                       <field reporter:label="Delay Count" name="delay_count" reporter:datatype="int"/>
                        <field reporter:label="Invoice Count" name="invoice_count" reporter:datatype="int"/>
                        <field reporter:label="Claim Count" name="claim_count" reporter:datatype="int"/>
                        <field reporter:label="Estimated Amount" name="estimated_amount" reporter:datatype="money"/>
@@ -10712,6 +10855,7 @@ SELECT  usr,
         </fields>
         <links>
             <link field="owning_lib" reltype="has_a" key="id" map="" class="aou"/>
+            <link field="id" reltype="has_a" key="id" map="" class="acp"/>
             <link field="circ_lib" reltype="has_a" key="id" map="" class="aou"/>
             <link field="creator" reltype="has_a" key="id" map="" class="au"/>
             <link field="age_protect" reltype="has_a" key="id" map="" class="crahp"/>