optionally showing noncats in items out
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 3 Aug 2006 21:14:39 +0000 (21:14 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 3 Aug 2006 21:14:39 +0000 (21:14 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5264 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/main/constants.js
Open-ILS/xul/staff_client/server/patron/items.js
Open-ILS/xul/staff_client/server/patron/items.xul
Open-ILS/xul/staff_client/server/patron/items_overlay.xul

index cbe0786..1301dc5 100644 (file)
@@ -46,6 +46,8 @@ const api = {
        'FM_AHR_UPDATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.update' },
        'FM_AHR_RESET' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.reset' },
        'FM_AIHU_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.in_house_use.create' },
+       'FM_ANCC_RETRIEVE_VIA_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.non_cataloged_circulation.retrieve' },
+       'FM_ANCC_RETRIEVE_VIA_USER' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.open_non_cataloged_circulation.user' },
        'FM_AOA_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_unit.address.retrieve' },
        'FM_AOU_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_tree.retrieve' },
        'FM_AOU_RETRIEVE_RELATED_VIA_SESSION' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_unit.full_path.retrieve' },
index b62fcb4..a3995a3 100644 (file)
@@ -40,6 +40,7 @@ patron.items.prototype = {
                                        'cmd_show_catalog2' : [ ['command'], function() { obj.show_catalog(2); } ],
                                        'cmd_add_billing' : [ ['command'], function() { obj.add_billing(1); } ],
                                        'cmd_add_billing2' : [ ['command'], function() { obj.add_billing(2); } ],
+                                       'cmd_show_noncats' : [ ['command'], function() { obj.show_noncats(); } ],
                                }
                        }
                );
@@ -60,6 +61,52 @@ patron.items.prototype = {
                obj.controller.view.cmd_show_catalog2.setAttribute('disabled','true');
        },
 
+       'show_noncats' : function() {
+               var obj = this; var checkout = {};
+               try {
+                       var robj = obj.network.simple_request('FM_ANCC_RETRIEVE_VIA_USER',[ ses(), obj.patron_id ]);
+                       if (typeof robj.ilsevent != 'undefined') throw(robj);
+
+                       for (var ii = 0; ii < robj.length; ii++) {
+                               try {
+                                       var nc_circ = obj.network.simple_request('FM_ANCC_RETRIEVE_VIA_ID',[ ses(), robj[ii] ]);
+                                       if (typeof nc_circ.ilsevent != 'undefined') throw(nc_circ);
+                                       var fake_circ = new aoc();
+                                       fake_circ.circ_lib( nc_circ.circ_lib() );
+                                       fake_circ.circ_staff( nc_circ.staff() );
+                                       fake_circ.usr( nc_circ.patron() );
+                                       fake_circ.circ_staff( nc_circ.staff() );
+                                       fake_circ.circ_lib( nc_circ.circ_lib() );
+                                       fake_circ.xact_start( nc_circ.circ_time() );
+                                       fake_circ.renewal_remaining(0);
+                                       fake_circ.stop_fines('Non-Cataloged');
+                                               
+                                       JSAN.use('util.date');
+                                       var c = nc_circ.circ_time();
+                                       var d = c == "now" ? new Date() : util.date.db_date2Date( c );
+                                       var t = obj.data.hash.cnct[ nc_circ.item_type() ];
+                                       var cd = t.circ_duration() || "14 days";
+                                       var i = util.date.interval_to_seconds( cd ) * 1000;
+                                       d.setTime( Date.parse(d) + i );
+                                       fake_circ.due_date( util.date.formatted_date(d,'%F') );
+       
+                                       var fake_record = new mvr();
+                                       fake_record.title( obj.data.hash.cnct[ nc_circ.item_type() ].name());
+       
+                                       var fake_copy = new acp();
+                                       fake_copy.barcode( '' );
+
+                                       obj.list.append( { 'row' : { 'my' : { 'circ' : fake_circ, 'mvr' : fake_record, 'acp' : fake_copy } }, } );
+
+                               } catch(F) {
+                                       obj.error.standard_unexpected_error_alert('Error showing NonCat #' + robj[ii],F);
+                               }
+                       }
+
+               } catch(E) {
+                       obj.error.standard_unexpected_error_alert('Error showing NonCat circulations',E);
+               }
+       },
 
        'items_print' : function(which) {
                var obj = this;
@@ -388,8 +435,12 @@ patron.items.prototype = {
                function retrieve_row(params) {
                        var row = params.row;
 
-                       var funcs = [];
+                       if (!row.my.circ_id) {
+                               if (typeof params.on_retrieve == 'function') { params.on_retrieve(row); }
+                               return row;
+                       }
 
+                       var funcs = [];
 
                        funcs.push(
                                function() {
index f1f99e3..1853d06 100644 (file)
@@ -74,6 +74,8 @@
                <command id="cmd_show_catalog" />
                <command id="cmd_add_billing" />
                
+               <command id="cmd_show_noncats" />
+
                <command id="cmd_items_print2" />
                <command id="cmd_items_renew2" />
                <command id="cmd_items_claimed_returned2" />
index c03fe05..3674c30 100644 (file)
@@ -98,6 +98,7 @@
 
 
 <hbox id="items_bottom_ui" flex="1">
+       <button id="noncat" label="Show Non-Cataloged Circulations in List Above" command="cmd_show_noncats" accesskey="N"/>
        <spacer flex="1"/>
        <button id="items_print" label="&staff.patron_display.items.print_receipt_label;" command="cmd_items_print" accesskey="&staff.patron_display.items.print_receipt_label.accesskey;" />
 </hbox>