LP#1497335 Aged circs display / API / WIP
authorBill Erickson <berickxx@gmail.com>
Tue, 22 Mar 2016 20:20:51 +0000 (16:20 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 28 Jul 2016 20:06:41 +0000 (16:06 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm

index 7bca4f2..66e7d87 100644 (file)
@@ -4161,6 +4161,8 @@ SELECT  usr,
                        <field reporter:label="Bib Record" name="copy_bib_record" 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="Linked Active Circulation" name="active_circ" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Linked Aged Circulation" name="aged_circ" oils_persist:virtual="true" reporter:datatype="link"/>
                </fields>
                <links>
                        <link field="billable_transaction" reltype="might_have" key="id" map="" class="mbt"/>
@@ -4187,6 +4189,8 @@ SELECT  usr,
                        <link field="aaasc_entries" reltype="has_many" key="xact" map="" class="aaasc"/>
                        <link field="usr_home_ou" reltype="has_a" key="id" map="" class="aou"/>
                        <link field="usr_profile" reltype="has_a" key="id" map="" class="pgt"/>
+                       <link field="active_circ" reltype="might_have" key="id" map="" class="circ"/>
+                       <link field="aged_circ" reltype="might_have" key="id" map="" class="acirc"/>
                </links>
        </class>
        <class id="acirc" controller="open-ils.cstore" oils_obj:fieldmapper="action::aged_circulation" oils_persist:tablename="action.aged_circulation" reporter:core="true" reporter:label="Aged (patronless) Circulation">
index 3e438ce..7b22f0e 100644 (file)
@@ -1074,17 +1074,28 @@ sub copy_details {
         { target_copy => $copy_id, dest_recv_time => undef } )->[0];
 
     # find the latest circ, open or closed
-    my $circ = $e->search_action_circulation(
+    my $circ = $e->search_action_all_circulation(
         [
             { target_copy => $copy_id },
             { 
-                flesh => 1,
+                flesh => 2,
                 flesh_fields => {
+                    combcirc => [
+                        'active_circ',
+                        'aged_circ'
+                    ],
                     circ => [
                         'workstation',
-                        'checkin_workstation', 
-                        'duration_rule', 
-                        'max_fine_rule', 
+                        'checkin_workstation',
+                        'duration_rule',
+                        'max_fine_rule',
+                        'recurring_fine_rule'
+                    ],
+                    acirc => [
+                        'workstation',
+                        'checkin_workstation',
+                        'duration_rule',
+                        'max_fine_rule',
                         'recurring_fine_rule'
                     ]
                 },
@@ -1094,6 +1105,9 @@ sub copy_details {
         ]
     )->[0];
 
+    if ($circ) {
+        $circ = $circ->active_circ ? $circ->active_circ : $circ->aged_circ;
+    }
 
     return {
         copy        => $copy,