<class id="erccpo" controller="open-ils.reporter-store" oils_obj:fieldmapper="extend_reporter::copy_count_per_org" oils_persist:tablename="extend_reporter.copy_count_per_org" reporter:label="Library Holdings Count with Deleted">
<fields oils_persist:primary="bibid">
<field reporter:label="Bib Record" name="bibid" reporter:datatype="id" />
- <field reporter:label="Circulation Library" name="circ_lib" reporter:datatype="id" />
+ <field reporter:label="Circulation Library" name="circ_lib" reporter:datatype="link" />
+ <field reporter:label="Owning Library" name="owning_lib" reporter:datatype="link" />
<field reporter:label="Last Edit Date" name="last_edit_time" reporter:datatype="timestamp" />
<field reporter:label="Has Only Deleted Copies 0/1" name="has_only_deleted_copies" reporter:datatype="int" />
<field reporter:label="Total deleted copies" name="deleted_count" reporter:datatype="int" />
<links>
<link field="bibid" reltype="has_a" key="id" map="" class="bre"/>
<link field="circ_lib" reltype="has_a" key="id" map="" class="aou"/>
+ <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 OR REPLACE VIEW extend_reporter.copy_count_per_org AS
SELECT acn.record AS bibid,
ac.circ_lib,
+ acn.owning_lib,
max(ac.edit_date) AS last_edit_time,
min(ac.deleted::integer) AS has_only_deleted_copies,
count(
FROM asset.call_number acn,
asset.copy ac
WHERE ac.call_number = acn.id
- GROUP BY acn.record, ac.circ_lib;
+ GROUP BY acn.record, acn.owning_lib, ac.circ_lib;
COMMIT;