adding IDL view to calculate the date of removal for the last copy on a bib record
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 8 Feb 2010 17:40:51 +0000 (17:40 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 8 Feb 2010 17:40:51 +0000 (17:40 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@15471 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/fm_IDL.xml

index bdafe10..de39fc2 100644 (file)
@@ -6245,6 +6245,34 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                </permacrud>
        </class>
 
+       <class id="rlcd" controller="open-ils.cstore open-ils.pcrud open-ils.reporter-store" oils_obj:fieldmapper="reporter::last_copy_deleted" oils_persist:readonly="true" reporter:core="true" reporter:label="Last Copy Delete Time">
+               <oils_persist:source_definition>
+
+            SELECT  b.id,
+                    MAX(dcp.edit_date) AS last_delete_date
+             FROM   biblio.record_entry b
+                    JOIN asset.call_number cn ON (cn.record = b.id)
+                    JOIN asset.copy dcp ON (cn.id = dcp.call_number)
+             WHERE  NOT b.deleted
+             GROUP BY b.id
+             HAVING SUM( CASE WHEN dcp.deleted THEN -1 ELSE 0 END) &lt; 0 
+
+               </oils_persist:source_definition>
+               <fields oils_persist:primary="id" oils_persist:sequence="biblio.record_entry">
+                       <field reporter:label="Record ID" name="id" reporter:datatype="id"/>
+                       <field reporter:label="Delete Date/Time" name="copy_delete_date" reporter:datatype="timestamp"/>
+               </fields>
+               <links>
+                       <link field="id" reltype="has_a" key="id" map="" class="bre"/>
+               </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <retrieve/>
+                       </actions>
+               </permacrud>
+       </class>
+
+
        <!-- ********************************************************************************************************************* -->
        <!-- What follows is a set of example extensions that are useful for PINES.  Comment out or remove if you don't want them. -->
        <!-- ********************************************************************************************************************* -->