[open-ils-commits] r17465 - in branches/rel_2_0/Open-ILS: src/perlmods/OpenILS/Application/Circ src/sql/Pg src/sql/Pg/upgrade web/opac/locale/en-US xul/staff_client/chrome/content/main xul/staff_client/server/patron (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Sep 2 20:10:50 EDT 2010


Author: phasefx
Date: 2010-09-02 20:10:48 -0400 (Thu, 02 Sep 2010)
New Revision: 17465

Added:
   branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0384.data.hold_pull_list_template.sql
Modified:
   branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
   branches/rel_2_0/Open-ILS/src/sql/Pg/002.schema.config.sql
   branches/rel_2_0/Open-ILS/src/sql/Pg/950.data.seed-values.sql
   branches/rel_2_0/Open-ILS/web/opac/locale/en-US/lang.dtd
   branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/main/constants.js
   branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/holds.js
   branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul
Log:
backport 17445, 17464: A/T template based full pull list printing for holds

Modified: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2010-09-02 23:57:51 UTC (rev 17464)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2010-09-03 00:10:48 UTC (rev 17465)
@@ -1284,6 +1284,46 @@
 }
 
 __PACKAGE__->register_method(
+    method    => "print_hold_pull_list",
+    api_name  => "open-ils.circ.hold_pull_list.print",
+    signature => {
+        desc   => 'Returns an HTML-formatted holds pull list',
+        params => [
+            { desc => 'Authtoken', type => 'string'},
+            { desc => 'Org unit ID.  Optional, defaults to workstation org unit', type => 'number'},
+        ],
+        return => {
+            desc => 'HTML string',
+            type => 'string'
+        }
+    }
+);
+
+sub print_hold_pull_list {
+    my($self, $client, $auth, $org_id) = @_;
+
+    my $e = new_editor(authtoken=>$auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
+
+    $org_id = (defined $org_id) ? $org_id : $e->requestor->ws_ou;
+    return $e->die_event unless $e->allowed('VIEW_HOLD', $org_id);
+
+    my $hold_ids = $U->storagereq(
+        'open-ils.storage.direct.action.hold_request.pull_list.id_list.current_copy_circ_lib.status_filtered.atomic',
+        $org_id, 10000);
+
+    return undef unless @$hold_ids;
+    $client->status(new OpenSRF::DomainObject::oilsContinueStatus);
+
+    my $holds = $e->search_action_hold_request({id => $hold_ids}, {substream => 1});
+    $client->status(new OpenSRF::DomainObject::oilsContinueStatus);
+
+    return $U->fire_object_event(undef, 'ahr.format.pull_list', $holds, $org_id);
+}
+
+
+
+__PACKAGE__->register_method(
     method        => 'fetch_hold_notify',
     api_name      => 'open-ils.circ.hold_notification.retrieve_by_hold',
     authoritative => 1,

Modified: branches/rel_2_0/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- branches/rel_2_0/Open-ILS/src/sql/Pg/002.schema.config.sql	2010-09-02 23:57:51 UTC (rev 17464)
+++ branches/rel_2_0/Open-ILS/src/sql/Pg/002.schema.config.sql	2010-09-03 00:10:48 UTC (rev 17465)
@@ -68,7 +68,7 @@
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0381'); -- dbs
+INSERT INTO config.upgrade_log (version) VALUES ('0384'); -- berick
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,

Modified: branches/rel_2_0/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- branches/rel_2_0/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2010-09-02 23:57:51 UTC (rev 17464)
+++ branches/rel_2_0/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2010-09-03 00:10:48 UTC (rev 17465)
@@ -6715,4 +6715,108 @@
     ,(1, 'cat.label.font.weight', '"normal"')
 ;
 
+-- 0384.data.hold_pull_list_template.sql
 
+INSERT INTO action_trigger.hook (key,core_type,description,passive) 
+    VALUES (   
+        'ahr.format.pull_list',
+        'ahr', 
+        oils_i18n_gettext(
+            'ahr.format.pull_list',
+            'Format holds pull list for printing',
+            'ath',
+            'description'
+        ), 
+        FALSE
+    );
+
+INSERT INTO action_trigger.event_definition (
+        id,
+        active,
+        owner,
+        name,
+        hook,
+        validator,
+        reactor,
+        group_field,
+        granularity,
+        template
+    ) VALUES (
+        35,
+        TRUE,
+        1,
+        'Holds Pull List',
+        'ahr.format.pull_list',
+        'NOOP_True',
+        'ProcessTemplate',
+        'pickup_lib',
+        'print-on-demand',
+$$
+[%- USE date -%]
+<style>
+    table { border-collapse: collapse; } 
+    td { padding: 5px; border-bottom: 1px solid #888; } 
+    th { font-weight: bold; }
+</style>
+[% 
+    # Sort the holds into copy-location buckets
+    # In the main print loop, sort each bucket by callnumber before printing
+    SET holds_list = [];
+    SET loc_data = [];
+    SET current_location = target.0.current_copy.location.id;
+    FOR hold IN target;
+        IF current_location != hold.current_copy.location.id;
+            SET current_location = hold.current_copy.location.id;
+            holds_list.push(loc_data);
+            SET loc_data = [];
+        END;
+        SET hold_data = {
+            'hold' => hold,
+            'callnumber' => hold.current_copy.call_number.label
+        };
+        loc_data.push(hold_data);
+    END;
+    holds_list.push(loc_data)
+%]
+<table>
+    <thead>
+        <tr>
+            <th>Title</th>
+            <th>Author</th>
+            <th>Shelving Location</th>
+            <th>Call Number</th>
+            <th>Barcode</th>
+            <th>Patron</th>
+        </tr>
+    </thead>
+    <tbody>
+    [% FOR loc_data IN holds_list  %]
+        [% FOR hold_data IN loc_data.sort('callnumber') %]
+            [% 
+                SET hold = hold_data.hold;
+                SET copy_data = helpers.get_copy_bib_basics(hold.current_copy.id);
+            %]
+            <tr>
+                <td>[% copy_data.title | truncate %]</td>
+                <td>[% copy_data.author | truncate %]</td>
+                <td>[% hold.current_copy.location.name %]</td>
+                <td>[% hold.current_copy.call_number.label %]</td>
+                <td>[% hold.current_copy.barcode %]</td>
+                <td>[% hold.usr.card.barcode %]</td>
+            </tr>
+        [% END %]
+    [% END %]
+    <tbody>
+</table>
+$$
+);
+
+INSERT INTO action_trigger.environment (
+        event_def,
+        path
+    ) VALUES
+        (35, 'current_copy.location'),
+        (35, 'current_copy.call_number'),
+        (35, 'usr.card'),
+        (35, 'pickup_lib')
+;

Copied: branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0384.data.hold_pull_list_template.sql (from rev 17445, trunk/Open-ILS/src/sql/Pg/upgrade/0384.data.hold_pull_list_template.sql)
===================================================================
--- branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0384.data.hold_pull_list_template.sql	                        (rev 0)
+++ branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0384.data.hold_pull_list_template.sql	2010-09-03 00:10:48 UTC (rev 17465)
@@ -0,0 +1,112 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0384');
+
+INSERT INTO action_trigger.hook (key,core_type,description,passive) 
+    VALUES (   
+        'ahr.format.pull_list',
+        'ahr', 
+        oils_i18n_gettext(
+            'ahr.format.pull_list',
+            'Format holds pull list for printing',
+            'ath',
+            'description'
+        ), 
+        FALSE
+    );
+
+INSERT INTO action_trigger.event_definition (
+        id,
+        active,
+        owner,
+        name,
+        hook,
+        validator,
+        reactor,
+        group_field,
+        granularity,
+        template
+    ) VALUES (
+        35,
+        TRUE,
+        1,
+        'Holds Pull List',
+        'ahr.format.pull_list',
+        'NOOP_True',
+        'ProcessTemplate',
+        'pickup_lib',
+        'print-on-demand',
+$$
+[%- USE date -%]
+<style>
+    table { border-collapse: collapse; } 
+    td { padding: 5px; border-bottom: 1px solid #888; } 
+    th { font-weight: bold; }
+</style>
+[% 
+    # Sort the holds into copy-location buckets
+    # In the main print loop, sort each bucket by callnumber before printing
+    SET holds_list = [];
+    SET loc_data = [];
+    SET current_location = target.0.current_copy.location.id;
+    FOR hold IN target;
+        IF current_location != hold.current_copy.location.id;
+            SET current_location = hold.current_copy.location.id;
+            holds_list.push(loc_data);
+            SET loc_data = [];
+        END;
+        SET hold_data = {
+            'hold' => hold,
+            'callnumber' => hold.current_copy.call_number.label
+        };
+        loc_data.push(hold_data);
+    END;
+    holds_list.push(loc_data)
+%]
+<table>
+    <thead>
+        <tr>
+            <th>Title</th>
+            <th>Author</th>
+            <th>Shelving Location</th>
+            <th>Call Number</th>
+            <th>Barcode</th>
+            <th>Patron</th>
+        </tr>
+    </thead>
+    <tbody>
+    [% FOR loc_data IN holds_list  %]
+        [% FOR hold_data IN loc_data.sort('callnumber') %]
+            [% 
+                SET hold = hold_data.hold;
+                SET copy_data = helpers.get_copy_bib_basics(hold.current_copy.id);
+            %]
+            <tr>
+                <td>[% copy_data.title | truncate %]</td>
+                <td>[% copy_data.author | truncate %]</td>
+                <td>[% hold.current_copy.location.name %]</td>
+                <td>[% hold.current_copy.call_number.label %]</td>
+                <td>[% hold.current_copy.barcode %]</td>
+                <td>[% hold.usr.card.barcode %]</td>
+            </tr>
+        [% END %]
+    [% END %]
+    <tbody>
+</table>
+$$
+);
+
+INSERT INTO action_trigger.environment (
+        event_def,
+        path
+    ) VALUES
+        (35, 'current_copy.location'),
+        (35, 'current_copy.call_number'),
+        (35, 'usr.card'),
+        (35, 'pickup_lib')
+;
+
+-- DELETE FROM config.upgrade_log WHERE version = 'tmp'; DELETE FROM action_trigger.event WHERE event_def IN (35); DELETE FROM action_trigger.environment WHERE event_def IN (35); DELETE FROM action_trigger.event_definition WHERE id IN (35); DELETE FROM action_trigger.hook WHERE key IN ( 'ahr.format.pull_list' );
+
+COMMIT;
+

Modified: branches/rel_2_0/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- branches/rel_2_0/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-09-02 23:57:51 UTC (rev 17464)
+++ branches/rel_2_0/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-09-03 00:10:48 UTC (rev 17465)
@@ -2973,6 +2973,8 @@
 <!ENTITY staff.patron.holds_overlay.holds_export.label "Export">
 <!ENTITY staff.patron.holds_overlay.print.label "Print">
 <!ENTITY staff.patron.holds_overlay.print.accesskey "P">
+<!ENTITY staff.patron.holds_overlay.print_full_pull_list.label "Print Full Pull List">
+<!ENTITY staff.patron.holds_overlay.print_full_pull_list.accesskey "u">
 <!ENTITY staff.patron.holds_overlay.place_hold.label "Place Hold">
 <!ENTITY staff.patron.holds_overlay.place_hold.accesskey "H">
 <!ENTITY staff.patron.holds_overlay.show_cancelled_holds.label "Show Cancelled Holds">

Modified: branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2010-09-02 23:57:51 UTC (rev 17464)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2010-09-03 00:10:48 UTC (rev 17465)
@@ -126,6 +126,7 @@
     'FM_AHR_PULL_LIST' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_pull_list.retrieve' },
     'FM_AHR_PULL_LIST_COUNT' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_pull_list.retrieve.count' },
     'FM_AHR_ID_LIST_PULL_LIST' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_pull_list.id_list.retrieve', 'secure' : false },
+    'HTML_HOLD_PULL_LIST' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_pull_list.print' },
     'FM_AHR_ONSHELF_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.captured_holds.on_shelf.retrieve' },
     'FM_AHR_ID_LIST_ONSHELF_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.captured_holds.id_list.on_shelf.retrieve', 'secure' : false },
     'FM_AHR_ID_LIST_EXPIRED_ONSHELF_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.captured_holds.id_list.expired_on_shelf.retrieve', 'secure' : false },

Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/holds.js
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/holds.js	2010-09-02 23:57:51 UTC (rev 17464)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/holds.js	2010-09-03 00:10:48 UTC (rev 17465)
@@ -289,7 +289,31 @@
                             );
                         }
                     ],
-
+                    'cmd_holds_print_full' : [
+                        ['command'],
+                        function() {
+                            var x_print_full_pull_list = document.getElementById('print_full_btn');
+                            try {
+                                if (progressmeter) {
+                                    progressmeter.mode = 'undetermined';
+                                    progressmeter.hidden = false;
+                                    x_print_full_pull_list.disabled = true;
+                                }
+                                JSAN.use('util.print');
+                                var print = new util.print('default');
+                                var robj = obj.network.simple_request('HTML_HOLD_PULL_LIST',[ses()]);
+                                if (typeof robj.ilsevent != 'undefined') { throw(robj); }
+                                print.simple( robj.template_output().data() );
+                            } catch(E) {
+                                obj.error.standard_unexpected_error_alert('cmd_holds_print_full',E);
+                            }
+                            if (progressmeter) {
+                                progressmeter.mode = 'determined';
+                                progressmeter.hidden = true;
+                                x_print_full_pull_list.disabled = false;
+                            }
+                        }
+                    ],
                     'cmd_holds_print' : [
                         ['command'],
                         function() {
@@ -1259,6 +1283,7 @@
         var x_show_cancelled_deck = document.getElementById('show_cancelled_deck');
         var x_clear_shelf_widgets = document.getElementById('clear_shelf_widgets');
         var x_expired_checkbox = document.getElementById('expired_checkbox');
+        var x_print_full_pull_list = document.getElementById('print_full_btn');
         switch(obj.hold_interface_type) {
             case 'shelf':
                 obj.render_lib_menus({'pickup_lib':true});
@@ -1269,6 +1294,7 @@
             break;
             case 'pull' :
                 if (x_fetch_more) x_fetch_more.hidden = false;
+                if (x_print_full_pull_list) x_print_full_pull_list.hidden = false;
                 if (x_lib_type_menu) x_lib_type_menu.hidden = true;
                 if (x_lib_menu_placeholder) x_lib_menu_placeholder.hidden = true;
             break;

Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul	2010-09-02 23:57:51 UTC (rev 17464)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul	2010-09-03 00:10:48 UTC (rev 17465)
@@ -18,6 +18,7 @@
         <command id="cmd_csv_to_printer" />
         <command id="cmd_csv_to_file" />
         <command id="cmd_holds_print" />
+        <command id="cmd_holds_print_full" />
         <command id="cmd_show_catalog" />
         <command id="cmd_retrieve_patron" />
         <command id="cmd_holds_edit_desire_mint_condition" />
@@ -186,6 +187,7 @@
         </button>
 
         <button id="holds_print" label="&staff.patron.holds_overlay.print.label;" command="cmd_holds_print" accesskey="&staff.patron.holds_overlay.print.accesskey;" />
+        <button id="print_full_btn" hidden="true" label="&staff.patron.holds_overlay.print_full_pull_list.label;" command="cmd_holds_print_full" accesskey="&staff.patron.holds_overlay.print_full_pull_list.accesskey;" />
         <spacer flex="1"/>
     </hbox>
 



More information about the open-ils-commits mailing list