[in progress] New pull list interface taking advantage of flattener for speed,
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Sat, 31 Mar 2012 16:17:40 +0000 (12:17 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Mon, 2 Apr 2012 15:03:01 +0000 (11:03 -0400)
and advanced sorting.

Groundwork only.  This isn't done yet.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.hold-pull-list-view.sql [new file with mode: 0644]
Open-ILS/src/templates/circ/hold_pull_list.tt2 [new file with mode: 0644]
Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js

index fe0af0d..2947880 100644 (file)
@@ -4763,7 +4763,7 @@ SELECT  usr,
             </actions>
         </permacrud>
        </class>
-       <!-- A note: Please update alhr when updating ahr -->
+       <!-- A note: Please update alhr and ahpl when updating ahr -->
        <class id="ahr" controller="open-ils.cstore" oils_obj:fieldmapper="action::hold_request" oils_persist:tablename="action.hold_request" reporter:core="true" reporter:label="Hold Request">
                <fields oils_persist:primary="id" oils_persist:sequence="action.hold_request_id_seq">
                        <field reporter:label="Status" name="status" oils_persist:virtual="true" />
@@ -4826,6 +4826,74 @@ SELECT  usr,
                        <link field="sms_carrier" reltype="might_have" key="code" map="" class="csc"/>
                </links>
        </class>
+       <class id="ahpl" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="action::hold_pull_list" oils_persist:tablename="action.hold_pull_list" reporter:label="Hold Pull List" oils_persist:readonly="true">
+               <fields oils_persist:primary="id">
+                       <field reporter:label="Status" name="status" oils_persist:virtual="true" />
+                       <field reporter:label="Transit" name="transit" oils_persist:virtual="true" />
+                       <field reporter:label="Capture Date/Time" name="capture_time" reporter:datatype="timestamp"/>
+                       <field reporter:label="Currently Targeted Copy" name="current_copy" />
+                       <field reporter:label="Notify by Email?" name="email_notify" reporter:datatype="bool"/>
+                       <field reporter:label="Hold Expire Date/Time" name="expire_time" reporter:datatype="timestamp"/>
+                       <field reporter:label="Fulfilling Library" name="fulfillment_lib" reporter:datatype="org_unit"/>
+                       <field reporter:label="Fulfilling Staff" name="fulfillment_staff" />
+                       <field reporter:label="Fulfillment Date/Time" name="fulfillment_time" reporter:datatype="timestamp"/>
+                       <field reporter:label="Hold Type" name="hold_type" reporter:datatype="text"/>
+                       <field reporter:label="Holdable Formats (for M-type hold)" name="holdable_formats" reporter:datatype="text"/>
+                       <field reporter:label="Hold ID" name="id" reporter:datatype="id" />
+                       <field reporter:label="Notifications Phone Number" name="phone_notify" reporter:datatype="text"/>
+                       <field reporter:label="Notifications SMS Number" name="sms_notify" reporter:datatype="text"/>
+                       <field reporter:label="Notifications SMS Carrier" name="sms_carrier" reporter:datatype="text"/>
+                       <field reporter:label="Pickup Library" name="pickup_lib" reporter:datatype="org_unit"/>
+                       <field reporter:label="Last Targeting Date/Time" name="prev_check_time" reporter:datatype="timestamp"/>
+                       <field reporter:label="Requesting Library" name="request_lib" reporter:datatype="org_unit"/>
+                       <field reporter:label="Request Date/Time" name="request_time" reporter:datatype="timestamp"/>
+                       <field reporter:label="Requesting User" name="requestor" reporter:datatype="link"/>
+                       <field reporter:label="Item Selection Depth" name="selection_depth" />
+                       <field reporter:label="Selection Locus" name="selection_ou" reporter:datatype="org_unit"/>
+                       <field reporter:label="Target Object ID" name="target" reporter:datatype="link"/>
+                       <field reporter:label="Hold User" name="usr" reporter:datatype="link"/>
+                       <field reporter:label="Hold Cancel Date/Time" name="cancel_time" reporter:datatype="timestamp"/>
+                       <field reporter:label="Notify Time" name="notify_time" oils_persist:virtual="true" reporter:datatype="timestamp"/>
+                       <field reporter:label="Notify Count" name="notify_count" oils_persist:virtual="true" reporter:datatype="int" />
+                       <field reporter:label="Notifications" name="notifications" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Bib Record link" name="bib_rec" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Eligible Copies" name="eligible_copies" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Currently Frozen" name="frozen" reporter:datatype="bool"/>
+                       <field reporter:label="Thaw Date (if frozen)" name="thaw_date" reporter:datatype="timestamp"/>
+                       <field reporter:label="Shelf Time" name="shelf_time" reporter:datatype="timestamp"/>
+                       <field reporter:label="Cancelation cause" name="cancel_cause" reporter:datatype="link" />
+                       <field reporter:label="Cancelation note" name="cancel_note" reporter:datatype="text" />
+                       <field reporter:label="Top of Queue" name="cut_in_line" reporter:datatype="bool" />
+                       <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="Notes" name="notes" reporter:datatype="link" oils_persist:virtual="true"/>
+                       <field reporter:label="Current Shelf Lib" name="current_shelf_lib" reporter:datatype="org_unit"/>
+                       <field reporter:label="Copy Location Sort Order" name="copy_location_order_position" reporter:datatype="int" />
+               </fields>
+               <links>
+                       <link field="fulfillment_lib" reltype="has_a" key="id" map="" class="aou"/>
+                       <link field="fulfillment_staff" reltype="has_a" key="id" map="" class="au"/>
+                       <link field="pickup_lib" reltype="has_a" key="id" map="" class="aou"/>
+                       <link field="selection_ou" reltype="has_a" key="id" map="" class="aou"/>
+                       <link field="requestor" reltype="has_a" key="id" map="" class="au"/>
+                       <link field="current_copy" reltype="has_a" key="id" map="" class="acp"/>
+                       <link field="usr" reltype="has_a" key="id" map="" class="au"/>
+                       <link field="request_lib" reltype="has_a" key="id" map="" class="aou"/>
+                       <link field="transit" reltype="might_have" key="hold" map="" class="ahtc"/>
+                       <link field="notifications" reltype="has_many" key="hold" map="" class="ahn"/>
+                       <link field="eligible_copies" reltype="has_many" key="hold" map="target_copy" class="ahcm"/>
+                       <link field="bib_rec" reltype="might_have" key="id" map="" class="rhrr"/>
+                       <link field="cancel_cause" reltype="might_have" key="id" map="" class="ahrcc"/>
+                       <link field="notes" reltype="has_many" key="hold" map="" class="ahrn"/>
+                       <link field="current_shelf_lib" reltype="has_a" key="id" map="" class="aou"/>
+                       <link field="sms_carrier" reltype="might_have" key="code" map="" class="csc"/>
+               </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <retrieve permission="VIEW_HOLD" context_field="pickup_lib" />
+                       </actions>
+               </permacrud>
+       </class>
        <class id="alhr" controller="open-ils.cstore" oils_obj:fieldmapper="action::last_hold_request" reporter:label="Last Captured Hold Request" oils_persist:readonly="true">
                <oils_persist:source_definition>
                        SELECT ahr.* FROM action.hold_request ahr JOIN (SELECT current_copy, MAX(capture_time) AS capture_time FROM action.hold_request WHERE capture_time IS NOT NULL GROUP BY current_copy)x USING (current_copy, capture_time)
@@ -7770,7 +7838,7 @@ SELECT  usr,
                        <link field="folder" reltype="has_a" key="id" map="" class="rof"/>
                </links>
        </class>
-       <class id="rmsr" controller="open-ils.reporter-store open-ils.cstore" oils_obj:fieldmapper="reporter::materialized_simple_record" oils_persist:tablename="reporter.materialized_simple_record" reporter:label="Fast Simple Record Extracts">
+       <class id="rmsr" controller="open-ils.reporter-store open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="reporter::materialized_simple_record" oils_persist:tablename="reporter.materialized_simple_record" reporter:label="Fast Simple Record Extracts">
                <fields oils_persist:primary="id">
                        <field reporter:label="Record ID" name="id" reporter:datatype="id" />
                        <field reporter:label="Fingerprint" name="fingerprint" reporter:datatype="text"/>
@@ -7788,6 +7856,11 @@ SELECT  usr,
                <links>
                        <link field="biblio_record" reltype="might_have" key="id" map="" class="bre"/>
                </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <retrieve />
+                       </actions>
+               </permacrud>
        </class>
        <class id="rssr" controller="open-ils.reporter-store" oils_obj:fieldmapper="reporter::super_simple_record" oils_persist:tablename="reporter.super_simple_record" reporter:label="Simple Record Extracts">
                <fields oils_persist:primary="id">
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.hold-pull-list-view.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.hold-pull-list-view.sql
new file mode 100644 (file)
index 0000000..3f38730
--- /dev/null
@@ -0,0 +1,25 @@
+-- Evergreen DB patch XXXX.schema.hold-pull-list-view.sql
+--
+-- FIXME: insert description of change, if needed
+--
+BEGIN;
+
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+CREATE VIEW action.hold_pull_list AS
+    SELECT
+        ahr.*,
+        COALESCE(999, acplo.position) AS copy_location_order_position
+    FROM action.hold_request ahr
+    JOIN asset.copy acp ON (acp.id = ahr.current_copy)
+    LEFT JOIN asset.copy_location_order acplo
+        ON (acp.location = acplo.location AND acp.circ_lib = acplo.org)
+    WHERE
+        ahr.capture_time IS NULL AND
+        ahr.cancel_time IS NULL AND
+        (ahr.expire_time is NULL OR ahr.expire_time > NOW()) ;
+
+
+COMMIT;
diff --git a/Open-ILS/src/templates/circ/hold_pull_list.tt2 b/Open-ILS/src/templates/circ/hold_pull_list.tt2
new file mode 100644 (file)
index 0000000..31ec209
--- /dev/null
@@ -0,0 +1,45 @@
+[% WRAPPER base.tt2 %]
+[% ctx.page_title = 'Hold Pull List' %]
+<script type="text/javascript">
+    dojo.require("dijit.form.Button");
+    dojo.require("openils.widget.FlattenerGrid");
+</script>
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
+    <div dojoType="dijit.layout.ContentPane"
+         layoutAlign="top" class="oils-header-panel">
+        <div>Hold Pull List</div>
+        <div>
+            <button dojoType="dijit.form.Button"
+                onClick="print_pull_list()">Print Pull List</button>
+        </div>
+    </div>
+    <!-- <div class="oils-acq-basic-roomy">
+        blah, a dropdown or something here (optional; typical interfaces might
+        have a filtering org select here. Then again, why not use
+        showLoadFilter on the Grid instead?)
+    </div> -->
+    <table
+        id="gridNode"
+        jsid="grid"
+        dojoType="openils.widget.FlattenerGrid"
+        columnPersistKey='"circ.hold_pull_list"'
+        autoHeight="10"
+        editOnEnter="true"
+        editStyle="pane"
+        showLoadFilter="true"
+        fmClass="'ahpl'"
+        baseSort="['copy_location_sort_order','call_number']"
+        mapExtras="{copy_circ_lib:{path:'current_copy.circ_lib',filter:true}}"
+        query="{copy_circ_lib: 4}">
+        <thead>
+            <tr>
+                <th field="barcode" fpath="current_copy.barcode">Barcode</th>
+                <th field="title" fpath="current_copy.call_number.record.simple_record.title"></th>
+                <th field="author" fpath="current_copy.call_number.record.simple_record.author"></th>
+                <th field="call_number" fpath="current_copy.call_number.label" ffilter="true"></th><!-- FIXME: prefix & suffix -->
+                <th field="shelving_loc" fpath="current_copy.location.name" ffilter="true">Shelving Location</th>
+            </tr>
+        </thead>
+    </table>
+</div>
+[% END %]
index a18cd4a..230974d 100644 (file)
@@ -158,6 +158,13 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) {
                         var field_def =
                             fieldmapper.IDL.fmclasses[hint].field_map[field];
 
+                        if (!field_def) {
+                            throw new Error(
+                                "Lost our way in IDL at hint " + hint +
+                                ", field " + field
+                            );
+                        }
+
                         if (field_def["class"] && path.length) {
                             last_field = field;
                             last_hint = hint;