use copy details method
authorpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 15 Nov 2006 19:33:02 +0000 (19:33 +0000)
committerpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 15 Nov 2006 19:33:02 +0000 (19:33 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@6590 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/circ/copy_details.xul
Open-ILS/xul/staff_client/server/circ/copy_status.js
Open-ILS/xul/staff_client/server/circ/util.js

index 8068262..19139b6 100644 (file)
                                var robj = g.network.simple_request('FM_ACP_DETAILS', [ ses(), g.copy_id ] );
                                if (typeof robj.ilsevent != 'undefined') throw(robj);
                                if (robj.copy) g.copy = robj.copy; else throw(robj);
-                               g.hold = robj.hold; g.transit = robj.transit; g.circ = robj.circ;
+                               g.hold = robj.hold; g.transit = robj.transit; g.circ = robj.circ; g.callnumber = robj.volume;
                                if (g.hold) $('hold_caption').setAttribute('tooltiptext','Hold ID = ' + g.hold.id());
                                if (g.transit) $('transit_caption').setAttribute('tooltiptext','Transit ID = ' + g.transit.id());
                                if (g.circ) $('circ_caption').setAttribute('tooltiptext','Circ ID = ' + g.circ.id());
 
-                               g.callnumber = g.network.simple_request('FM_ACN_RETRIEVE',[ g.copy.call_number() ]);
-                               if (typeof g.callnumber.ilsevent != 'undefined') throw(g.callnumber);
+                               //g.callnumber = g.network.simple_request('FM_ACN_RETRIEVE',[ g.copy.call_number() ]);
+                               //if (typeof g.callnumber.ilsevent != 'undefined') throw(g.callnumber);
 
                                $('top').setAttribute('src',urls.XUL_BIB_BRIEF + '?docid=' + g.callnumber.record());
                                g.data.temp_copy = g.copy; g.data.stash('temp_copy'); $('item_summary').setAttribute('src',urls.XUL_COPY_SUMMARY);
index d25ddac..03b594f 100644 (file)
@@ -881,60 +881,72 @@ circ.copy_status.prototype = {
                                if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; }
                        }
                        JSAN.use('circ.util');
-                       var copy = obj.network.simple_request( 'FM_ACP_RETRIEVE_VIA_BARCODE', [ barcode ]);
-                       if (copy == null) {
-                               throw('Something weird happened.  null result');
-                       } else if (copy.ilsevent) {
-                               switch(copy.ilsevent) {
-                                       case -1: 
-                                               obj.error.standard_network_error_alert(); 
-                                               obj.controller.view.copy_status_barcode_entry_textbox.select();
-                                               obj.controller.view.copy_status_barcode_entry_textbox.focus();
-                                       break;
-                                       case 1502 /* ASSET_COPY_NOT_FOUND */ :
-                                               try { document.getElementById('last_scanned').setAttribute('value',barcode + ' was either mis-scanned or is not cataloged.'); } catch(E) {}
-                                               obj.error.yns_alert(barcode + ' was either mis-scanned or is not cataloged.','Not Cataloged','OK',null,null,'Check here to confirm this message');
-                                               obj.controller.view.copy_status_barcode_entry_textbox.select();
-                                               obj.controller.view.copy_status_barcode_entry_textbox.focus();
-                                       break;
-                                       default: 
-                                               throw(copy); 
-                                       break;
-                               }
-                       } else {
-                               obj.network.simple_request('FM_ACP_DETAILS', [ ses(), copy.id() ], function(req) {
-                                       try {
-                                               var details = req.getResultObject();
-                                               var msg = copy.barcode() + ' -- ';
-                                               if (copy.call_number() == -1) msg += 'Item is a Pre-Cat.  ';
-                                               if (details.hold) msg += 'Item is captured for a Hold.  ';
-                                               if (details.transit) msg += 'Item is in Transit.  ';
-                                               if (details.circ && ! details.circ.checkin_time()) msg += 'Item is circulating.  ';
-                                               try { document.getElementById('last_scanned').setAttribute('value',msg); } catch(E) {}
-                                       } catch(E) {
-                                               alert(E);
+                       obj.network.simple_request('FM_ACP_DETAILS_VIA_BARCODE', [ ses(), barcode ], function(req) {
+                               try {
+                                       var details = req.getResultObject();
+                                       if (details == null) {
+                                               throw('Something weird happened.  null result');
+                                       } else if (details.ilsevent) {
+                                               switch(details.ilsevent) {
+                                                       case -1: 
+                                                               obj.error.standard_network_error_alert(); 
+                                                               obj.controller.view.copy_status_barcode_entry_textbox.select();
+                                                               obj.controller.view.copy_status_barcode_entry_textbox.focus();
+                                                               return;
+                                                       break;
+                                                       case 1502 /* ASSET_COPY_NOT_FOUND */ :
+                                                               try { document.getElementById('last_scanned').setAttribute('value',barcode + ' was either mis-scanned or is not cataloged.'); } catch(E) {}
+                                                               obj.error.yns_alert(barcode + ' was either mis-scanned or is not cataloged.','Not Cataloged','OK',null,null,'Check here to confirm this message');
+                                                               obj.controller.view.copy_status_barcode_entry_textbox.select();
+                                                               obj.controller.view.copy_status_barcode_entry_textbox.focus();
+                                                               return;
+                                                       break;
+                                                       default: 
+                                                               throw(details); 
+                                                       break;
+                                               }
                                        }
-                               } );
-                               var my_mvr = obj.network.simple_request('MODS_SLIM_RECORD_RETRIEVE_VIA_COPY', [ copy.id() ]);
-                               if (document.getElementById('trim_list')) {
-                                       var x = document.getElementById('trim_list');
-                                       if (x.checked) { obj.list.trim_list = 20; } else { obj.list.trim_list = null; }
-                               }
-                               obj.list.append(
-                                       {
-                                               'retrieve_id' : js2JSON( { 'renewable' : copy.circulations() ? 't' : 'f', 'copy_id' : copy.id(), 'acn_id' : (typeof copy.call_number() == 'object' ? copy.call_number().id() : copy.call_number()), 'barcode' : barcode, 'doc_id' : (typeof my_mvr.ilsevent == 'undefined' ? my_mvr.doc_id() : null ) } ),
-                                               'row' : {
-                                                       'my' : {
-                                                               'mvr' : my_mvr,
-                                                               'acp' : copy,
-                                                       }
-                                               },
-                                               'to_top' : true,
+                                       var msg = details.copy.barcode() + ' -- ';
+                                       if (details.copy.call_number() == -1) msg += 'Item is a Pre-Cat.  ';
+                                       if (details.hold) msg += 'Item is captured for a Hold.  ';
+                                       if (details.transit) msg += 'Item is in Transit.  ';
+                                       if (details.circ && ! details.circ.checkin_time()) msg += 'Item is circulating.  ';
+                                       try { document.getElementById('last_scanned').setAttribute('value',msg); } catch(E) {}
+                                       if (document.getElementById('trim_list')) {
+                                               var x = document.getElementById('trim_list');
+                                               if (x.checked) { obj.list.trim_list = 20; } else { obj.list.trim_list = null; }
                                        }
-                               );
-                               obj.controller.view.copy_status_barcode_entry_textbox.value = '';
-                               obj.controller.view.copy_status_barcode_entry_textbox.focus();
-                       }
+                                       obj.list.append(
+                                               {
+                                                       'retrieve_id' : js2JSON( 
+                                                               { 
+                                                                       'renewable' : details.circ ? 't' : 'f', 
+                                                                       'copy_id' : details.copy.id(), 
+                                                                       'acn_id' : details.volume ? details.volume.id() : -1, 
+                                                                       'barcode' : barcode, 
+                                                                       'doc_id' : details.mvr ? details.mvr.doc_id() : null  
+                                                               } 
+                                                       ),
+                                                       'row' : {
+                                                               'my' : {
+                                                                       'mvr' : details.mvr,
+                                                                       'acp' : details.copy,
+                                                                       'acn' : details.volume,
+                                                                       'atc' : details.transit,
+                                                                       'circ' : details.circ,
+                                                                       'ahr' : details.hold,
+                                                               }
+                                                       },
+                                                       'to_top' : true,
+                                               }
+                                       );
+                               } catch(E) {
+                                       obj.error.standard_unexpected_error_alert('',E);
+                               }
+                       } );
+                       obj.controller.view.copy_status_barcode_entry_textbox.value = '';
+                       obj.controller.view.copy_status_barcode_entry_textbox.focus();
+                       
                } catch(E) {
                        obj.error.standard_unexpected_error_alert('',E);
                        obj.controller.view.copy_status_barcode_entry_textbox.select();
index ecd96f4..c8ea359 100644 (file)
@@ -428,7 +428,7 @@ circ.util.columns = function(modify,params) {
                },
                {
                        'id' : 'call_number', 'label' : getString('staff.acp_label_call_number'), 'flex' : 1,
-                       'primary' : false, 'hidden' : true, 'render' : function(my) { if (my.acp && my.acp.call_number() == -1) { return "Not Cataloged"; } else { if (!my.acn) { var x = network.simple_request("FM_ACN_RETRIEVE",[ my.acp.call_number() ]); if (x.ilsevent) { return "Not Cataloged"; } else { my.acn = x; return x.label(); } } else { return my.acn.label(); } } },
+                       'primary' : false, 'hidden' : true, 'render' : function(my) { if (my.acp && my.acp.call_number() == -1) { return "Not Cataloged"; } else { if (!my.acn) { /* var x = network.simple_request("FM_ACN_RETRIEVE",[ my.acp.call_number() ]); if (x.ilsevent) { return "Not Cataloged"; } else { my.acn = x; return x.label(); } */ return '?'; } else { return my.acn.label(); } } },
                        'persist' : 'hidden width ordinal',
                },
                {