LP1928359 Add item circ info to Item Table
authorBill Erickson <berickxx@gmail.com>
Thu, 13 May 2021 16:18:33 +0000 (12:18 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Mon, 20 Sep 2021 15:19:17 +0000 (11:19 -0400)
Adds "Total Circ Count" and "Last Circ Date" to the staff catalog Item
Table grid view.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Shula Link <slink@gchrl.org>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/catalog/record/copies.component.html
Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm

index df669a1..ea6d030 100644 (file)
     </eg-grid-column>
     <eg-grid-column i18n-label label="Due Date" path="due_date" datatype="timestamp">
     </eg-grid-column>
+    <eg-grid-column i18n-label label="Last Circ Date" path="last_circ" datatype="timestamp">
+    </eg-grid-column>
+    <eg-grid-column i18n-label label="Total Circ Count" path="circ_count">
+    </eg-grid-column>
   </eg-grid>
 </div>
 
index 13cdc70..d5da49b 100644 (file)
@@ -2122,6 +2122,7 @@ sub basic_opac_copy_query {
             bmp => [
                 {column => 'label', alias => 'part_label'},
             ],
+            ($staff ? (erfcc => ['circ_count']) : ()),
             ($iss_id ? (sitem => ["issuance"]) : ())
         },
 
@@ -2166,7 +2167,13 @@ sub basic_opac_copy_query {
                             sstr => { }
                         }
                     }
-                } : ())
+                } : ()),
+                ($staff ? {
+                    erfcc => {
+                        fkey => 'id',
+                        field => 'id'
+                    }
+                }: ()),
             ]
         },
 
index 912e626..26ccaac 100644 (file)
@@ -2871,7 +2871,17 @@ sub bib_copies {
 
     my $resp;
     while ($resp = $req->recv) {
-        $client->respond($resp->content); 
+        my $copy = $resp->content;
+
+        if ($is_staff) {
+            # last_circ is an IDL query so it cannot be queried directly
+            # via JSON query.
+            $copy->{last_circ} = 
+                new_editor()->retrieve_reporter_last_circ_date($copy->{id})
+                ->last_circ;
+        }
+
+        $client->respond($copy);
     }
 
     return undef;