From 6d56037eac6d8b356d9e8d7b95dd7f13787c6848 Mon Sep 17 00:00:00 2001 From: phasefx Date: Tue, 27 Jul 2010 22:33:01 +0000 Subject: [PATCH] flesh out scan item as missing pieces dialog git-svn-id: svn://svn.open-ils.org/ILS/trunk@17045 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/cat/util.js | 1 + .../xul/staff_client/server/circ/missing_pieces.js | 48 ++++++++++++++-------- .../staff_client/server/circ/missing_pieces.xul | 4 +- .../server/locale/en-US/circ.properties | 3 ++ 4 files changed, 37 insertions(+), 19 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/cat/util.js b/Open-ILS/xul/staff_client/server/cat/util.js index 89d5bb38f..9622a7278 100644 --- a/Open-ILS/xul/staff_client/server/cat/util.js +++ b/Open-ILS/xul/staff_client/server/cat/util.js @@ -740,6 +740,7 @@ cat.util.render_loan_duration = function(value) { } cat.util.mark_item_as_missing_pieces = function(copy_ids) { + alert(js2JSON(copy_ids)); } dump('exiting cat/util.js\n'); diff --git a/Open-ILS/xul/staff_client/server/circ/missing_pieces.js b/Open-ILS/xul/staff_client/server/circ/missing_pieces.js index 99eca3987..579726ea9 100644 --- a/Open-ILS/xul/staff_client/server/circ/missing_pieces.js +++ b/Open-ILS/xul/staff_client/server/circ/missing_pieces.js @@ -7,28 +7,42 @@ function my_init() { JSAN.errorLevel = "die"; // none, warn, or die JSAN.addRepository('/xul/server/'); JSAN.use('util.error'); error = new util.error(); - error.sdump('D_TRACE','my_init() for main_test.xul'); - - dojo.require('openils.PermaCrud'); - - var types = new openils.PermaCrud( - { - authtoken :ses() - } - ).retrieveAll('coust'); - - dojo.forEach(types, - function(type) { - alert( js2JSON(type) ); - } + error.sdump('D_TRACE','my_init() for missing_pieces.xul'); + + JSAN.use('util.network'); + var network = new util.network(); + + // Why the indirection of missing_pieces.xul instead of calling window.prompt in chrome/content/main/menu.js directly? + // So we can get free remote upgrades of the logic behind cat.util.mark_item_as_missing_pieces, since I can't call + // JSAN.use('cat.util'); in menu.js + var barcode = window.prompt( + $("circStrings").getString('staff.circ.missing_pieces.scan_item.prompt'), + '', + $("circStrings").getString('staff.circ.missing_pieces.scan_item.title') ); + if (!barcode) { + window.close(); + return; + } - if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') { - try { window.xulG.set_tab_name('Test'); } catch(E) { alert(E); } + var copy; + try { + copy = network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ barcode ]); + if (typeof copy.ilsevent != 'undefined') throw(copy); + if (!copy) throw(copy); + } catch(E) { + alert($("circStrings").getFormattedString('staff.circ.missing_pieces.scan_item.error_alert', [barcode]) + '\n'); + window.close(); + return; } + JSAN.use('cat.util'); + cat.util.mark_item_as_missing_pieces( [ copy.id() ] ); + window.close(); + } catch(E) { - try { error.standard_unexpected_error_alert('main/test.xul',E); } catch(F) { alert(E); } + try { error.standard_unexpected_error_alert('circ/missing_pieces.xul',E); } catch(F) { alert(E); } + window.close(); } } diff --git a/Open-ILS/xul/staff_client/server/circ/missing_pieces.xul b/Open-ILS/xul/staff_client/server/circ/missing_pieces.xul index 6e0602ba4..303e6ce3d 100644 --- a/Open-ILS/xul/staff_client/server/circ/missing_pieces.xul +++ b/Open-ILS/xul/staff_client/server/circ/missing_pieces.xul @@ -28,10 +28,10 @@ + +