" ] ].concat( util.functional.map_list( g.data.list.circ_modifier, function(obj) { return [ obj, obj ]; } ).sort() ) ); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
+ }
+ ],
],
'right_pane3' :
-[ [
- $('catStrings').getString('staff.cat.copy_editor.field.alert_message.label'),
- {
- render: 'fm.alert_message() == null ? $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null") : fm.alert_message()',
- input: 'c = function(v){ g.apply("alert_message",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.setAttribute("multiline",true); g.populate_alert_message_input(x); x.addEventListener("apply",function(f){ return function(ev) { f( ev.target.value ); } }(c), false);',
- }
- ],
-
- [
- $('catStrings').getString('staff.cat.copy_editor.field.deposit.label'),
- {
- render: 'fm.deposit() == null ? $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null") : ( get_bool( fm.deposit() ) ? $("catStrings").getString("staff.cat.copy_editor.field.deposit.yes_or_true") : $("catStrings").getString("staff.cat.copy_editor.field.deposit.no_or_false") )',
- input: 'c = function(v){ g.apply("deposit",v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( [ [ $("catStrings").getString("staff.cat.copy_editor.field.deposit.yes_or_true"), get_db_true() ], [ $("catStrings").getString("staff.cat.copy_editor.field.deposit.no_or_false"), get_db_false() ] ] ); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
- }
- ],
- [
- $('catStrings').getString('staff.cat.copy_editor.field.deposit_amount.label'),
- {
- render: 'if (fm.deposit_amount() == null) { $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null"); } else { util.money.sanitize( fm.deposit_amount() ); }',
- input: 'c = function(v){ g.apply("deposit_amount",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
- }
- ],
- [
- $('catStrings').getString('staff.cat.copy_editor.field.price.label'),
- {
- render: 'if (fm.price() == null) { $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null"); } else { util.money.sanitize( fm.price() ); }',
- input: 'c = function(v){ g.apply("price",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
- }
- ],
-
- [
- $('catStrings').getString('staff.cat.copy_editor.field.opac_visible.label'),
- {
- render: 'fm.opac_visible() == null ? $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null") : ( get_bool( fm.opac_visible() ) ? $("catStrings").getString("staff.cat.copy_editor.field.opac_visible.yes_or_true") : $("catStrings").getString("staff.cat.copy_editor.field.opac_visible.no_or_false") )',
- input: 'c = function(v){ g.apply("opac_visible",v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( [ [ $("catStrings").getString("staff.cat.copy_editor.field.opac_visible.yes_or_true"), get_db_true() ], [ $("catStrings").getString("staff.cat.copy_editor.field.opac_visible.no_or_false"), get_db_false() ] ] ); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
- }
- ],
- [
- $('catStrings').getString('staff.cat.copy_editor.field.reference.label'),
- {
- render: 'fm.ref() == null ? $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null") : ( get_bool( fm.ref() ) ? $("catStrings").getString("staff.cat.copy_editor.field.reference.yes_or_true") : $("catStrings").getString("staff.cat.copy_editor.field.reference.no_or_false") )',
- input: 'c = function(v){ g.apply("ref",v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( [ [ $("catStrings").getString("staff.cat.copy_editor.field.reference.yes_or_true"), get_db_true() ], [ $("catStrings").getString("staff.cat.copy_editor.field.reference.no_or_false"), get_db_false() ] ] ); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
- }
- ],
+[ [
+ $('catStrings').getString('staff.cat.copy_editor.field.alert_message.label'),
+ {
+ render: 'fm.alert_message() == null ? $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null") : fm.alert_message()',
+ input: 'c = function(v){ g.apply("alert_message",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.setAttribute("multiline",true); g.populate_alert_message_input(x); x.addEventListener("apply",function(f){ return function(ev) { f( ev.target.value ); } }(c), false);',
+ }
+ ],
+
+ [
+ $('catStrings').getString('staff.cat.copy_editor.field.deposit.label'),
+ {
+ render: 'fm.deposit() == null ? $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null") : ( get_bool( fm.deposit() ) ? $("catStrings").getString("staff.cat.copy_editor.field.deposit.yes_or_true") : $("catStrings").getString("staff.cat.copy_editor.field.deposit.no_or_false") )',
+ input: 'c = function(v){ g.apply("deposit",v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( [ [ $("catStrings").getString("staff.cat.copy_editor.field.deposit.yes_or_true"), get_db_true() ], [ $("catStrings").getString("staff.cat.copy_editor.field.deposit.no_or_false"), get_db_false() ] ] ); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
+ }
+ ],
+ [
+ $('catStrings').getString('staff.cat.copy_editor.field.deposit_amount.label'),
+ {
+ render: 'if (fm.deposit_amount() == null) { $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null"); } else { util.money.sanitize( fm.deposit_amount() ); }',
+ input: 'c = function(v){ g.apply("deposit_amount",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
+ }
+ ],
+ [
+ $('catStrings').getString('staff.cat.copy_editor.field.price.label'),
+ {
+ render: 'if (fm.price() == null) { $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null"); } else { util.money.sanitize( fm.price() ); }',
+ input: 'c = function(v){ g.apply("price",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
+ }
+ ],
+
+ [
+ $('catStrings').getString('staff.cat.copy_editor.field.opac_visible.label'),
+ {
+ render: 'fm.opac_visible() == null ? $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null") : ( get_bool( fm.opac_visible() ) ? $("catStrings").getString("staff.cat.copy_editor.field.opac_visible.yes_or_true") : $("catStrings").getString("staff.cat.copy_editor.field.opac_visible.no_or_false") )',
+ input: 'c = function(v){ g.apply("opac_visible",v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( [ [ $("catStrings").getString("staff.cat.copy_editor.field.opac_visible.yes_or_true"), get_db_true() ], [ $("catStrings").getString("staff.cat.copy_editor.field.opac_visible.no_or_false"), get_db_false() ] ] ); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
+ }
+ ],
+ [
+ $('catStrings').getString('staff.cat.copy_editor.field.reference.label'),
+ {
+ render: 'fm.ref() == null ? $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null") : ( get_bool( fm.ref() ) ? $("catStrings").getString("staff.cat.copy_editor.field.reference.yes_or_true") : $("catStrings").getString("staff.cat.copy_editor.field.reference.no_or_false") )',
+ input: 'c = function(v){ g.apply("ref",v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( [ [ $("catStrings").getString("staff.cat.copy_editor.field.reference.yes_or_true"), get_db_true() ], [ $("catStrings").getString("staff.cat.copy_editor.field.reference.no_or_false"), get_db_false() ] ] ); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
+ }
+ ],
],
'right_pane4' :
@@ -929,60 +929,60 @@ g.panes_and_field_names = {
/* This loops through all our fieldnames and all the copies, tallying up counts for the different values */
g.summarize = function( copies ) {
- /******************************************************************************************************/
- /* Setup */
-
- JSAN.use('util.date'); JSAN.use('util.money');
- g.summary = {};
- g.field_names = [];
- for (var i in g.panes_and_field_names) {
- g.field_names = g.field_names.concat( g.panes_and_field_names[i] );
- }
- g.field_names = g.field_names.concat( g.editable_stat_cat_names );
- g.field_names = g.field_names.concat( g.readonly_stat_cat_names );
+ /******************************************************************************************************/
+ /* Setup */
+
+ JSAN.use('util.date'); JSAN.use('util.money');
+ g.summary = {};
+ g.field_names = [];
+ for (var i in g.panes_and_field_names) {
+ g.field_names = g.field_names.concat( g.panes_and_field_names[i] );
+ }
+ g.field_names = g.field_names.concat( g.editable_stat_cat_names );
+ g.field_names = g.field_names.concat( g.readonly_stat_cat_names );
- /******************************************************************************************************/
- /* Loop through the field names */
+ /******************************************************************************************************/
+ /* Loop through the field names */
- for (var i = 0; i < g.field_names.length; i++) {
+ for (var i = 0; i < g.field_names.length; i++) {
- var field_name = g.field_names[i][0];
- var render = g.field_names[i][1].render;
+ var field_name = g.field_names[i][0];
+ var render = g.field_names[i][1].render;
var attr = g.field_names[i][1].attr;
- g.summary[ field_name ] = {};
-
- /******************************************************************************************************/
- /* Loop through the copies */
-
- for (var j = 0; j < copies.length; j++) {
-
- var fm = copies[j];
- var cmd = render || ('fm.' + field_name + '();');
- var value = '???';
-
- /**********************************************************************************************/
- /* Try to retrieve the value for this field for this copy */
-
- try {
- value = eval( cmd );
- } catch(E) {
- g.error.sdump('D_ERROR','Attempted ' + cmd + '\n' + E + '\n');
- }
- if (typeof value == 'object' && value != null) {
- alert('FIXME: field_name = <' + field_name + '> value = <' + js2JSON(value) + '>\n');
- }
-
- /**********************************************************************************************/
- /* Tally the count */
-
- if (g.summary[ field_name ][ value ]) {
- g.summary[ field_name ][ value ]++;
- } else {
- g.summary[ field_name ][ value ] = 1;
- }
- }
- }
- g.error.sdump('D_TRACE','summary = ' + js2JSON(g.summary) + '\n');
+ g.summary[ field_name ] = {};
+
+ /******************************************************************************************************/
+ /* Loop through the copies */
+
+ for (var j = 0; j < copies.length; j++) {
+
+ var fm = copies[j];
+ var cmd = render || ('fm.' + field_name + '();');
+ var value = '???';
+
+ /**********************************************************************************************/
+ /* Try to retrieve the value for this field for this copy */
+
+ try {
+ value = eval( cmd );
+ } catch(E) {
+ g.error.sdump('D_ERROR','Attempted ' + cmd + '\n' + E + '\n');
+ }
+ if (typeof value == 'object' && value != null) {
+ alert('FIXME: field_name = <' + field_name + '> value = <' + js2JSON(value) + '>\n');
+ }
+
+ /**********************************************************************************************/
+ /* Tally the count */
+
+ if (g.summary[ field_name ][ value ]) {
+ g.summary[ field_name ][ value ]++;
+ } else {
+ g.summary[ field_name ][ value ] = 1;
+ }
+ }
+ }
+ g.error.sdump('D_TRACE','summary = ' + js2JSON(g.summary) + '\n');
}
/******************************************************************************************************/
@@ -990,18 +990,18 @@ g.summarize = function( copies ) {
g.render = function() {
- /******************************************************************************************************/
- /* Library setup and clear any existing interface */
+ /******************************************************************************************************/
+ /* Library setup and clear any existing interface */
- JSAN.use('util.widgets'); JSAN.use('util.date'); JSAN.use('util.money'); JSAN.use('util.functional');
+ JSAN.use('util.widgets'); JSAN.use('util.date'); JSAN.use('util.money'); JSAN.use('util.functional');
- for (var i in g.panes_and_field_names) {
- var p = document.getElementById(i);
- if (p) util.widgets.remove_children(p);
- }
+ for (var i in g.panes_and_field_names) {
+ var p = document.getElementById(i);
+ if (p) util.widgets.remove_children(p);
+ }
- /******************************************************************************************************/
- /* Populate the library filter menu for stat cats */
+ /******************************************************************************************************/
+ /* Populate the library filter menu for stat cats */
var sc_libs = {};
for (var i = 0; i < g.panes_and_field_names.right_pane4.length; i++) {
@@ -1023,80 +1023,80 @@ g.render = function() {
x.appendChild(menuitem);
}
- /******************************************************************************************************/
- /* Prepare the panes */
+ /******************************************************************************************************/
+ /* Prepare the panes */
- var groupbox; var caption; var vbox; var grid; var rows;
-
- /******************************************************************************************************/
- /* Loop through the field names */
+ var groupbox; var caption; var vbox; var grid; var rows;
+
+ /******************************************************************************************************/
+ /* Loop through the field names */
- for (h in g.panes_and_field_names) {
- if (!document.getElementById(h)) continue;
- for (var i = 0; i < g.panes_and_field_names[h].length; i++) {
- try {
- var f = g.panes_and_field_names[h][i]; var fn = f[0]; var attr = f[1].attr;
- groupbox = document.createElement('groupbox'); document.getElementById(h).appendChild(groupbox);
+ for (h in g.panes_and_field_names) {
+ if (!document.getElementById(h)) continue;
+ for (var i = 0; i < g.panes_and_field_names[h].length; i++) {
+ try {
+ var f = g.panes_and_field_names[h][i]; var fn = f[0]; var attr = f[1].attr;
+ groupbox = document.createElement('groupbox'); document.getElementById(h).appendChild(groupbox);
if (attr) {
for (var a in attr) {
groupbox.setAttribute(a,attr[a]);
}
}
- if (typeof g.changed[fn] != 'undefined') groupbox.setAttribute('class','copy_editor_field_changed');
- caption = document.createElement('caption'); groupbox.appendChild(caption);
- caption.setAttribute('label',fn); caption.setAttribute('id','caption_'+fn);
- vbox = document.createElement('vbox'); groupbox.appendChild(vbox);
- grid = util.widgets.make_grid( [ { 'flex' : 1 }, {}, {} ] ); vbox.appendChild(grid);
- grid.setAttribute('flex','1');
- rows = grid.lastChild;
- var row;
-
- /**************************************************************************************/
- /* Loop through each value for the field */
-
- for (var j in g.summary[fn]) {
- var value = j; var count = g.summary[fn][j];
- row = document.createElement('row'); rows.appendChild(row);
- var label1 = document.createElement('description'); row.appendChild(label1);
- if (g.special_exception[ fn ]) {
- g.special_exception[ fn ]( label1, value );
- } else {
- label1.appendChild( document.createTextNode(value) );
- }
- var label2 = document.createElement('description'); row.appendChild(label2);
- var copy_count;
- if (count == 1) {
- copy_count = $('catStrings').getString('staff.cat.copy_editor.copy_count');
- } else {
- copy_count = $('catStrings').getFormattedString('staff.cat.copy_editor.copy_count.plural', [count]);
- }
- label2.appendChild( document.createTextNode(copy_count) );
- }
- var hbox = document.createElement('hbox');
- hbox.setAttribute('id',fn);
- groupbox.appendChild(hbox);
- var hbox2 = document.createElement('hbox');
- groupbox.appendChild(hbox2);
-
- /**************************************************************************************/
- /* Render the input widget */
-
- if (f[1].input && g.edit) {
- g.render_input(hbox,f[1]);
- }
-
- } catch(E) {
- g.error.sdump('D_ERROR','copy editor: ' + E + '\n');
- }
- }
- }
+ if (typeof g.changed[fn] != 'undefined') groupbox.setAttribute('class','copy_editor_field_changed');
+ caption = document.createElement('caption'); groupbox.appendChild(caption);
+ caption.setAttribute('label',fn); caption.setAttribute('id','caption_'+fn);
+ vbox = document.createElement('vbox'); groupbox.appendChild(vbox);
+ grid = util.widgets.make_grid( [ { 'flex' : 1 }, {}, {} ] ); vbox.appendChild(grid);
+ grid.setAttribute('flex','1');
+ rows = grid.lastChild;
+ var row;
+
+ /**************************************************************************************/
+ /* Loop through each value for the field */
+
+ for (var j in g.summary[fn]) {
+ var value = j; var count = g.summary[fn][j];
+ row = document.createElement('row'); rows.appendChild(row);
+ var label1 = document.createElement('description'); row.appendChild(label1);
+ if (g.special_exception[ fn ]) {
+ g.special_exception[ fn ]( label1, value );
+ } else {
+ label1.appendChild( document.createTextNode(value) );
+ }
+ var label2 = document.createElement('description'); row.appendChild(label2);
+ var copy_count;
+ if (count == 1) {
+ copy_count = $('catStrings').getString('staff.cat.copy_editor.copy_count');
+ } else {
+ copy_count = $('catStrings').getFormattedString('staff.cat.copy_editor.copy_count.plural', [count]);
+ }
+ label2.appendChild( document.createTextNode(copy_count) );
+ }
+ var hbox = document.createElement('hbox');
+ hbox.setAttribute('id',fn);
+ groupbox.appendChild(hbox);
+ var hbox2 = document.createElement('hbox');
+ groupbox.appendChild(hbox2);
+
+ /**************************************************************************************/
+ /* Render the input widget */
+
+ if (f[1].input && g.edit) {
+ g.render_input(hbox,f[1]);
+ }
+
+ } catch(E) {
+ g.error.sdump('D_ERROR','copy editor: ' + E + '\n');
+ }
+ }
+ }
- /******************************************************************************************************/
- /* Synchronize stat cat visibility with library filter menu, and default template selection */
+ /******************************************************************************************************/
+ /* Synchronize stat cat visibility with library filter menu, and default template selection */
JSAN.use('util.file');
- var file = new util.file('copy_editor_prefs.'+g.data.server_unadorned);
- g.copy_editor_prefs = util.widgets.load_attributes(file);
+ var file = new util.file('copy_editor_prefs.'+g.data.server_unadorned);
+ g.copy_editor_prefs = util.widgets.load_attributes(file);
for (var i in g.copy_editor_prefs) {
if (i.match(/filter_/) && g.copy_editor_prefs[i].checked == '') {
try {
@@ -1111,148 +1111,148 @@ g.render = function() {
/******************************************************************************************************/
/* This actually draws the change button and input widget for a given field */
g.render_input = function(node,blob) {
- try {
- // node = hbox ; groupbox -> hbox, hbox
+ try {
+ // node = hbox ; groupbox -> hbox, hbox
- var groupbox = node.parentNode;
- var caption = groupbox.firstChild;
- var vbox = node.previousSibling;
- var hbox = node;
- var hbox2 = node.nextSibling;
+ var groupbox = node.parentNode;
+ var caption = groupbox.firstChild;
+ var vbox = node.previousSibling;
+ var hbox = node;
+ var hbox2 = node.nextSibling;
- var input_cmd = blob.input;
- var render_cmd = blob.render;
+ var input_cmd = blob.input;
+ var render_cmd = blob.render;
var attr = blob.attr;
- var block = false; var first = true;
-
- function on_mouseover(ev) {
- groupbox.setAttribute('style','background: white');
- }
-
- function on_mouseout(ev) {
- groupbox.setAttribute('style','');
- }
-
- vbox.addEventListener('mouseover',on_mouseover,false);
- vbox.addEventListener('mouseout',on_mouseout,false);
- groupbox.addEventListener('mouseover',on_mouseover,false);
- groupbox.addEventListener('mouseout',on_mouseout,false);
- groupbox.firstChild.addEventListener('mouseover',on_mouseover,false);
- groupbox.firstChild.addEventListener('mouseout',on_mouseout,false);
-
- function on_click(ev){
- try {
- if (block) return; block = true;
-
- function post_c(v) {
- try {
- /* FIXME - kludgy */
- var t = input_cmd.match('apply_stat_cat') ? 'stat_cat' : ( input_cmd.match('apply_owning_lib') ? 'owning_lib' : 'attribute' );
- var f;
- switch(t) {
- case 'attribute' :
- f = input_cmd.match(/apply\("(.+?)",/)[1];
- break;
- case 'stat_cat' :
- f = input_cmd.match(/apply_stat_cat\((.+?),/)[1];
- break;
- case 'owning_lib' :
- f = null;
- break;
- }
- g.changed[ hbox.id ] = { 'type' : t, 'field' : f, 'value' : v };
- block = false;
- setTimeout(
- function() {
- g.summarize( g.copies );
- g.render();
- document.getElementById(caption.id).focus();
- }, 0
- );
- } catch(E) {
- g.error.standard_unexpected_error_alert('post_c',E);
- }
- }
- var x; var c; eval( input_cmd );
- if (x) {
- util.widgets.remove_children(vbox);
- util.widgets.remove_children(hbox);
- util.widgets.remove_children(hbox2);
- hbox.appendChild(x);
- var apply = document.createElement('button');
- apply.setAttribute('label', $('catStrings').getString('staff.cat.copy_editor.apply.label'));
- apply.setAttribute('accesskey', $('catStrings').getString('staff.cat.copy_editor.apply.accesskey'));
- hbox2.appendChild(apply);
- apply.addEventListener('command',function() { c(x.value); },false);
- var cancel = document.createElement('button');
- cancel.setAttribute('label', $('catStrings').getString('staff.cat.copy_editor.cancel.label'));
- cancel.addEventListener('command',function() { setTimeout( function() { g.summarize( g.copies ); g.render(); document.getElementById(caption.id).focus(); }, 0); }, false);
- hbox2.appendChild(cancel);
- setTimeout( function() { x.focus(); }, 0 );
- }
- } catch(E) {
- g.error.standard_unexpected_error_alert('render_input',E);
- }
- }
- vbox.addEventListener('click',on_click, false);
- hbox.addEventListener('click',on_click, false);
- caption.addEventListener('click',on_click, false);
- caption.addEventListener('keypress',function(ev) {
- if (ev.keyCode == 13 /* enter */ || ev.keyCode == 77 /* mac enter */) on_click();
- }, false);
- caption.setAttribute('style','-moz-user-focus: normal');
- caption.setAttribute('onfocus','this.setAttribute("class","outline_me")');
- caption.setAttribute('onblur','this.setAttribute("class","")');
-
- } catch(E) {
- g.error.sdump('D_ERROR',E + '\n');
- }
+ var block = false; var first = true;
+
+ function on_mouseover(ev) {
+ groupbox.setAttribute('style','background: white');
+ }
+
+ function on_mouseout(ev) {
+ groupbox.setAttribute('style','');
+ }
+
+ vbox.addEventListener('mouseover',on_mouseover,false);
+ vbox.addEventListener('mouseout',on_mouseout,false);
+ groupbox.addEventListener('mouseover',on_mouseover,false);
+ groupbox.addEventListener('mouseout',on_mouseout,false);
+ groupbox.firstChild.addEventListener('mouseover',on_mouseover,false);
+ groupbox.firstChild.addEventListener('mouseout',on_mouseout,false);
+
+ function on_click(ev){
+ try {
+ if (block) return; block = true;
+
+ function post_c(v) {
+ try {
+ /* FIXME - kludgy */
+ var t = input_cmd.match('apply_stat_cat') ? 'stat_cat' : ( input_cmd.match('apply_owning_lib') ? 'owning_lib' : 'attribute' );
+ var f;
+ switch(t) {
+ case 'attribute' :
+ f = input_cmd.match(/apply\("(.+?)",/)[1];
+ break;
+ case 'stat_cat' :
+ f = input_cmd.match(/apply_stat_cat\((.+?),/)[1];
+ break;
+ case 'owning_lib' :
+ f = null;
+ break;
+ }
+ g.changed[ hbox.id ] = { 'type' : t, 'field' : f, 'value' : v };
+ block = false;
+ setTimeout(
+ function() {
+ g.summarize( g.copies );
+ g.render();
+ document.getElementById(caption.id).focus();
+ }, 0
+ );
+ } catch(E) {
+ g.error.standard_unexpected_error_alert('post_c',E);
+ }
+ }
+ var x; var c; eval( input_cmd );
+ if (x) {
+ util.widgets.remove_children(vbox);
+ util.widgets.remove_children(hbox);
+ util.widgets.remove_children(hbox2);
+ hbox.appendChild(x);
+ var apply = document.createElement('button');
+ apply.setAttribute('label', $('catStrings').getString('staff.cat.copy_editor.apply.label'));
+ apply.setAttribute('accesskey', $('catStrings').getString('staff.cat.copy_editor.apply.accesskey'));
+ hbox2.appendChild(apply);
+ apply.addEventListener('command',function() { c(x.value); },false);
+ var cancel = document.createElement('button');
+ cancel.setAttribute('label', $('catStrings').getString('staff.cat.copy_editor.cancel.label'));
+ cancel.addEventListener('command',function() { setTimeout( function() { g.summarize( g.copies ); g.render(); document.getElementById(caption.id).focus(); }, 0); }, false);
+ hbox2.appendChild(cancel);
+ setTimeout( function() { x.focus(); }, 0 );
+ }
+ } catch(E) {
+ g.error.standard_unexpected_error_alert('render_input',E);
+ }
+ }
+ vbox.addEventListener('click',on_click, false);
+ hbox.addEventListener('click',on_click, false);
+ caption.addEventListener('click',on_click, false);
+ caption.addEventListener('keypress',function(ev) {
+ if (ev.keyCode == 13 /* enter */ || ev.keyCode == 77 /* mac enter */) on_click();
+ }, false);
+ caption.setAttribute('style','-moz-user-focus: normal');
+ caption.setAttribute('onfocus','this.setAttribute("class","outline_me")');
+ caption.setAttribute('onblur','this.setAttribute("class","")');
+
+ } catch(E) {
+ g.error.sdump('D_ERROR',E + '\n');
+ }
}
/******************************************************************************************************/
/* store the copies in the global xpcom stash */
g.stash_and_close = function() {
- try {
- if (g.handle_update) {
- try {
- var r = g.network.request(
- api.FM_ACP_FLESHED_BATCH_UPDATE.app,
- api.FM_ACP_FLESHED_BATCH_UPDATE.method,
- [ ses(), g.copies, true ]
- );
- if (typeof r.ilsevent != 'undefined') {
- g.error.standard_unexpected_error_alert('copy update',r);
- } else {
- alert($('catStrings').getString('staff.cat.copy_editor.handle_update.success'));
- }
- /* FIXME -- revisit the return value here */
- } catch(E) {
- alert($('catStrings').getString('staff.cat.copy_editor.handle_update.error') + ' ' + js2JSON(E));
- }
- }
- //g.data.temp_copies = js2JSON( g.copies );
- //g.data.stash('temp_copies');
- xulG.copies = g.copies;
- update_modal_xulG(xulG);
- window.close();
- } catch(E) {
- g.error.standard_unexpected_error_alert('stash and close',E);
- }
+ try {
+ if (g.handle_update) {
+ try {
+ var r = g.network.request(
+ api.FM_ACP_FLESHED_BATCH_UPDATE.app,
+ api.FM_ACP_FLESHED_BATCH_UPDATE.method,
+ [ ses(), g.copies, true ]
+ );
+ if (typeof r.ilsevent != 'undefined') {
+ g.error.standard_unexpected_error_alert('copy update',r);
+ } else {
+ alert($('catStrings').getString('staff.cat.copy_editor.handle_update.success'));
+ }
+ /* FIXME -- revisit the return value here */
+ } catch(E) {
+ alert($('catStrings').getString('staff.cat.copy_editor.handle_update.error') + ' ' + js2JSON(E));
+ }
+ }
+ //g.data.temp_copies = js2JSON( g.copies );
+ //g.data.stash('temp_copies');
+ xulG.copies = g.copies;
+ update_modal_xulG(xulG);
+ window.close();
+ } catch(E) {
+ g.error.standard_unexpected_error_alert('stash and close',E);
+ }
}
/******************************************************************************************************/
/* spawn copy notes interface */
g.copy_notes = function() {
- JSAN.use('util.window'); var win = new util.window();
- win.open(
- urls.XUL_COPY_NOTES,
- //+ '?copy_id=' + window.escape(g.copies[0].id()),
- $("catStrings").getString("staff.cat.copy_editor.copy_notes"),'chrome,resizable,modal',
- { 'copy_id' : g.copies[0].id() }
- );
+ JSAN.use('util.window'); var win = new util.window();
+ win.open(
+ urls.XUL_COPY_NOTES,
+ //+ '?copy_id=' + window.escape(g.copies[0].id()),
+ $("catStrings").getString("staff.cat.copy_editor.copy_notes"),'chrome,resizable,modal',
+ { 'copy_id' : g.copies[0].id() }
+ );
}
/******************************************************************************************************/
@@ -1275,62 +1275,62 @@ g.toggle_stat_cat_display = function(el) {
/******************************************************************************************************/
/* This adds a stat cat definition to the stat cat pane for rendering */
g.save_attributes = function() {
- JSAN.use('util.widgets'); JSAN.use('util.file'); var file = new util.file('copy_editor_prefs.'+g.data.server_unadorned);
+ JSAN.use('util.widgets'); JSAN.use('util.file'); var file = new util.file('copy_editor_prefs.'+g.data.server_unadorned);
var what_to_save = {};
for (var i in g.copy_editor_prefs) {
what_to_save[i] = [];
for (var j in g.copy_editor_prefs[i]) what_to_save[i].push(j);
}
- util.widgets.save_attributes(file, what_to_save );
+ util.widgets.save_attributes(file, what_to_save );
}
/******************************************************************************************************/
/* This adds a stat cat definition to the stat cat pane for rendering */
g.add_stat_cat = function(sc) {
try {
- if (typeof g.data.hash.asc == 'undefined') { g.data.hash.asc = {}; g.data.stash('hash'); }
+ if (typeof g.data.hash.asc == 'undefined') { g.data.hash.asc = {}; g.data.stash('hash'); }
- var sc_id = sc;
+ var sc_id = sc;
- if (typeof sc == 'object') {
+ if (typeof sc == 'object') {
- sc_id = sc.id();
- }
+ sc_id = sc.id();
+ }
- if (typeof g.stat_cat_seen[sc_id] != 'undefined') { return; }
+ if (typeof g.stat_cat_seen[sc_id] != 'undefined') { return; }
- g.stat_cat_seen[ sc_id ] = 1;
+ g.stat_cat_seen[ sc_id ] = 1;
- if (typeof sc != 'object') {
+ if (typeof sc != 'object') {
- sc = g.network.simple_request(
- 'FM_ASC_BATCH_RETRIEVE',
- [ ses(), [ sc_id ] ]
- )[0];
+ sc = g.network.simple_request(
+ 'FM_ASC_BATCH_RETRIEVE',
+ [ ses(), [ sc_id ] ]
+ )[0];
- }
+ }
- g.data.hash.asc[ sc.id() ] = sc; g.data.stash('hash');
+ g.data.hash.asc[ sc.id() ] = sc; g.data.stash('hash');
- var label_name = g.data.hash.aou[ sc.owner() ].shortname() + " : " + sc.name();
+ var label_name = g.data.hash.aou[ sc.owner() ].shortname() + " : " + sc.name();
- var temp_array = [
- label_name,
- {
- render: 'var l = util.functional.find_list( fm.stat_cat_entries(), function(e){ return e.stat_cat() == '
- + sc.id() + '; } ); l ? l.value() : $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null");',
- input: 'c = function(v){ g.apply_stat_cat(' + sc.id() + ',v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( [ [ $("catStrings").getString("staff.cat.copy_editor.remove_stat_cat_entry"), -1 ] ].concat( util.functional.map_list( g.data.hash.asc[' + sc.id()
- + '].entries(), function(obj){ return [ obj.value(), obj.id() ]; } ) ).sort() ); '
- + 'x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c),false);',
+ var temp_array = [
+ label_name,
+ {
+ render: 'var l = util.functional.find_list( fm.stat_cat_entries(), function(e){ return e.stat_cat() == '
+ + sc.id() + '; } ); l ? l.value() : $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null");',
+ input: 'c = function(v){ g.apply_stat_cat(' + sc.id() + ',v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( [ [ $("catStrings").getString("staff.cat.copy_editor.remove_stat_cat_entry"), -1 ] ].concat( util.functional.map_list( g.data.hash.asc[' + sc.id()
+ + '].entries(), function(obj){ return [ obj.value(), obj.id() ]; } ) ).sort() ); '
+ + 'x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c),false);',
attr: {
sc_lib: sc.owner(),
}
- }
- ];
+ }
+ ];
- g.panes_and_field_names.right_pane4.push( temp_array );
- } catch(E) {
- g.error.standard_unexpected_error_alert($('catStrings').getString('staff.cat.copy_editor.add_stat_cat.error'), E);
+ g.panes_and_field_names.right_pane4.push( temp_array );
+ } catch(E) {
+ g.error.standard_unexpected_error_alert($('catStrings').getString('staff.cat.copy_editor.add_stat_cat.error'), E);
}
}
@@ -1339,37 +1339,37 @@ g.add_stat_cat = function(sc) {
g.populate_stat_cats = function() {
try {
g.data.stash_retrieve();
- g.stat_cat_seen = {};
+ g.stat_cat_seen = {};
- function get(lib_id,only_these) {
+ function get(lib_id,only_these) {
g.data.stash_retrieve();
- var label = 'asc_list_for_lib_'+lib_id;
- if (typeof g.data[label] == 'undefined') {
- var robj = g.network.simple_request('FM_ASC_RETRIEVE_VIA_AOU', [ ses(), lib_id ]);
- if (typeof robj.ilsevent != 'undefined') throw(robj);
- var temp_list = [];
- for (var j = 0; j < robj.length; j++) {
- var my_asc = robj[j];
+ var label = 'asc_list_for_lib_'+lib_id;
+ if (typeof g.data[label] == 'undefined') {
+ var robj = g.network.simple_request('FM_ASC_RETRIEVE_VIA_AOU', [ ses(), lib_id ]);
+ if (typeof robj.ilsevent != 'undefined') throw(robj);
+ var temp_list = [];
+ for (var j = 0; j < robj.length; j++) {
+ var my_asc = robj[j];
if (typeof g.data.hash.asc == 'undefined') { g.data.hash.asc = {}; }
- if (typeof g.data.hash.asc[ my_asc.id() ] == 'undefined') {
- g.data.hash.asc[ my_asc.id() ] = my_asc;
- }
+ if (typeof g.data.hash.asc[ my_asc.id() ] == 'undefined') {
+ g.data.hash.asc[ my_asc.id() ] = my_asc;
+ }
var only_this_lib = my_asc.owner(); if (typeof only_this_lib == 'object') only_this_lib = only_this_lib.id();
- if (only_these.indexOf( String( only_this_lib ) ) != -1) {
- temp_list.push( my_asc );
- }
- }
- g.data[label] = temp_list; g.data.stash(label,'hash','list');
- }
- return g.data[label];
- }
-
- /* The stat cats for the pertinent library -- this is based on workstation ou */
+ if (only_these.indexOf( String( only_this_lib ) ) != -1) {
+ temp_list.push( my_asc );
+ }
+ }
+ g.data[label] = temp_list; g.data.stash(label,'hash','list');
+ }
+ return g.data[label];
+ }
+
+ /* The stat cats for the pertinent library -- this is based on workstation ou */
var label = 'asc_list_for_' + typeof g.data.ws_ou == 'object' ? g.data.ws_ou.id() : g.data.ws_ou;
g.data[ label ] = g.data.list.my_asc; g.data.stash('label');
- for (var i = 0; i < g.data.list.my_asc.length; i++) {
- g.add_stat_cat( g.data.list.my_asc[i] );
- }
+ for (var i = 0; i < g.data.list.my_asc.length; i++) {
+ g.add_stat_cat( g.data.list.my_asc[i] );
+ }
/* For the others, we want to consider the owning libs, circ libs, and any libs that have stat cats already on the copies,
however, if batch editing, we only want to show the ones they have in common. So let's compile the libs */
@@ -1388,21 +1388,21 @@ g.populate_stat_cats = function() {
}
}
- /* stat cats based on stat cat entries present on these copies */
+ /* stat cats based on stat cat entries present on these copies */
var sc_libs = {};
- for (var i = 0; i < g.copies.length; i++) {
- var entries = g.copies[i].stat_cat_entries();
- if (!entries) entries = [];
- for (var j = 0; j < entries.length; j++) {
+ for (var i = 0; i < g.copies.length; i++) {
+ var entries = g.copies[i].stat_cat_entries();
+ if (!entries) entries = [];
+ for (var j = 0; j < entries.length; j++) {
var lib = entries[j].owner(); if (typeof lib == 'object') lib = lib.id();
- sc_libs[ lib ] = true;
- }
+ sc_libs[ lib ] = true;
+ }
}
add_common_ancestors(sc_libs); // CAVEAT - if a copy has no stat_cat_entries, it basically gets no vote here
/* stat cats based on Circ Lib */
sc_libs = {};
- for (var i = 0; i < g.copies.length; i++) {
+ for (var i = 0; i < g.copies.length; i++) {
var circ_lib = g.copies[i].circ_lib(); if (typeof circ_lib == 'object') circ_lib = circ_lib.id();
sc_libs[ circ_lib ] = true;
}
@@ -1410,27 +1410,27 @@ g.populate_stat_cats = function() {
/* stat cats based on Owning Lib */
sc_libs = {};
- for (var i = 0; i < g.copies.length; i++) {
+ for (var i = 0; i < g.copies.length; i++) {
var cn_id = g.copies[i].call_number();
- if (cn_id > 0) {
- if (! g.map_acn[ cn_id ]) {
+ if (cn_id > 0) {
+ if (! g.map_acn[ cn_id ]) {
var req = g.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ cn_id ]);
if (typeof req.ilsevent == 'undefined') {
- g.map_acn[ cn_id ] = req;
+ g.map_acn[ cn_id ] = req;
} else {
continue;
}
- }
+ }
var owning_lib = g.map_acn[ cn_id ].owning_lib(); if (typeof owning_lib == 'object') owning_lib = owning_lib.id();
sc_libs[ owning_lib ] = true;
- }
- }
+ }
+ }
add_common_ancestors(sc_libs); // CAVEAT - if a copy is a pre-cat, it basically gets no vote here
g.panes_and_field_names.right_pane4.sort();
} catch(E) {
- alert(E);
+ alert(E);
g.error.standard_unexpected_error_alert($('catStrings').getString('staff.cat.copy_editor.populate_stat_cat.error'),E);
}
}
diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js
index c12a720934..efe3bd79a9 100644
--- a/Open-ILS/xul/staff_client/server/cat/marcedit.js
+++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js
@@ -22,1270 +22,1270 @@ var p;
function $(id) { return document.getElementById(id); }
function mangle_005() {
- var now = new Date();
- var y = now.getUTCFullYear();
-
- var m = now.getUTCMonth() + 1;
- if (m < 10) m = '0' + m;
-
- var d = now.getUTCDate();
- if (d < 10) d = '0' + d;
-
- var H = now.getUTCHours();
- if (H < 10) H = '0' + H;
-
- var M = now.getUTCMinutes();
- if (M < 10) M = '0' + M;
-
- var S = now.getUTCSeconds();
- if (S < 10) S = '0' + S;
-
-
- var stamp = '' + y + m + d + H + M + S + '.0';
- createControlField('005',stamp);
+ var now = new Date();
+ var y = now.getUTCFullYear();
+
+ var m = now.getUTCMonth() + 1;
+ if (m < 10) m = '0' + m;
+
+ var d = now.getUTCDate();
+ if (d < 10) d = '0' + d;
+
+ var H = now.getUTCHours();
+ if (H < 10) H = '0' + H;
+
+ var M = now.getUTCMinutes();
+ if (M < 10) M = '0' + M;
+
+ var S = now.getUTCSeconds();
+ if (S < 10) S = '0' + S;
+
+
+ var stamp = '' + y + m + d + H + M + S + '.0';
+ createControlField('005',stamp);
}
function createControlField (tag,data) {
- // first, remove the old field, if any;
- for (var i in xml_record.controlfield.(@tag == tag)) delete xml_record.controlfield.(@tag == tag)[i];
-
- var cf = { data } ;
- cf.@tag = tag;
-
- // then, find the right position and insert it
- var done = 0;
- var cfields = xml_record.controlfield;
- var base = Number(tag.substring(2));
- for (var i in cfields) {
- var t = Number(cfields[i].@tag.toString().substring(2));
- if (t > base) {
- xml_record.insertChildBefore( cfields[i], cf );
- done = 1
- break;
- }
- }
-
- if (!done) xml_record.insertChildBefore( xml_record.datafield[0], cf );
-
- return cf;
+ // first, remove the old field, if any;
+ for (var i in xml_record.controlfield.(@tag == tag)) delete xml_record.controlfield.(@tag == tag)[i];
+
+ var cf = { data } ;
+ cf.@tag = tag;
+
+ // then, find the right position and insert it
+ var done = 0;
+ var cfields = xml_record.controlfield;
+ var base = Number(tag.substring(2));
+ for (var i in cfields) {
+ var t = Number(cfields[i].@tag.toString().substring(2));
+ if (t > base) {
+ xml_record.insertChildBefore( cfields[i], cf );
+ done = 1
+ break;
+ }
+ }
+
+ if (!done) xml_record.insertChildBefore( xml_record.datafield[0], cf );
+
+ return cf;
}
function xml_escape_unicode ( str ) {
- return str.replace(
- /([\u0080-\ufffe])/g,
- function (r,s) { return "" + s.charCodeAt(0).toString(16) + ";"; }
- );
+ return str.replace(
+ /([\u0080-\ufffe])/g,
+ function (r,s) { return "" + s.charCodeAt(0).toString(16) + ";"; }
+ );
}
function my_init() {
- try {
-
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- if (typeof JSAN == 'undefined') { throw( $("commonStrings").getString('common.jsan.missing') ); }
- JSAN.errorLevel = "die"; // none, warn, or die
- JSAN.addRepository('/xul/server/');
-
- // Fake xulG for standalone...
- try {
- window.xulG.record;
- } catch (e) {
- window.xulG = {};
- window.xulG.record = {};
- window.xulG.save = {};
-
- window.xulG.save.label = $('catStrings').getString('staff.cat.marcedit.save.label');
- window.xulG.save.func = function (r) { alert(r); }
-
- var cgi = new CGI();
- var _rid = cgi.param('record');
- if (_rid) {
- window.xulG.record.url = '/opac/extras/supercat/retrieve/marcxml/record/' + _rid;
- }
- }
- // End faking part...
-
- document.getElementById('save-button').setAttribute('label', window.xulG.save.label);
- document.getElementById('save-button').setAttribute('oncommand',
- 'mangle_005(); ' +
- 'var xml_string = xml_escape_unicode( xml_record.toXMLString() ); ' +
- 'save_attempt( xml_string ); ' +
- 'loadRecord(xml_record);'
- );
-
- if (window.xulG.record.url) {
- var req = new XMLHttpRequest();
- req.open('POST',window.xulG.record.url,false);
- req.send(null);
- window.xulG.record.marc = req.responseText.replace(xmlDeclaration, '');
- }
-
- xml_record = new XML( window.xulG.record.marc );
- if (xml_record..record[0]) xml_record = xml_record..record[0];
-
- // Get the tooltip xml all async like
- req = new XMLHttpRequest();
-
- // Set a default locale in case preferences fail us
- var locale = "en-US";
-
- // Try to get the locale from our preferences
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- try {
- const Cc = Components.classes;
- const Ci = Components.interfaces;
- locale = Cc["@mozilla.org/preferences-service;1"].
- getService(Ci.nsIPrefBranch).
- getCharPref("general.useragent.locale");
- }
- catch (e) { }
-
- // TODO: We should send a HEAD request to check for the existence of the desired file
- // then fall back to the default locale if preferred locale is not necessary;
- // however, for now we have a simplistic check:
- //
- // we currently have translations for only two locales; in the absence of a
- // valid locale, default to the almighty en-US
- if (locale != 'en-US' && locale != 'fr-CA') {
- locale = 'en-US';
- }
-
- // Get the locale-specific tooltips
- req.open('GET','/xul/server/locale/' + locale + '/marcedit-tooltips.xml',true);
-
- context_menus = createComplexXULElement('popupset');
- document.documentElement.appendChild( context_menus );
-
- tag_menu = createPopup({position : 'after_start', id : 'tags_popup'});
- context_menus.appendChild( tag_menu );
-
- tag_menu.appendChild(
- createMenuitem(
- { label : $('catStrings').getString('staff.cat.marcedit.add_row.label'),
- oncommand :
- 'var e = document.createEvent("KeyEvents");' +
- 'e.initKeyEvent("keypress",1,1,null,1,0,0,0,13,0);' +
- 'current_focus.inputField.dispatchEvent(e);'
- }
- )
- );
-
- tag_menu.appendChild(
- createMenuitem(
- { label : $('catStrings').getString('staff.cat.marcedit.insert_row.label'),
- oncommand :
- 'var e = document.createEvent("KeyEvents");' +
- 'e.initKeyEvent("keypress",1,1,null,1,0,1,0,13,0);' +
- 'current_focus.inputField.dispatchEvent(e);'
- }
- )
- );
-
- tag_menu.appendChild(
- createMenuitem(
- { label : $('catStrings').getString('staff.cat.marcedit.remove_row.label'),
- oncommand :
- 'var e = document.createEvent("KeyEvents");' +
- 'e.initKeyEvent("keypress",1,1,null,1,0,0,0,46,0);' +
- 'current_focus.inputField.dispatchEvent(e);'
- }
- )
- );
-
- tag_menu.appendChild( createComplexXULElement( 'separator' ) );
-
- tag_menu.appendChild(
- createMenuitem(
- { label : $('catStrings').getString('staff.cat.marcedit.replace_006.label'),
- oncommand :
- 'var e = document.createEvent("KeyEvents");' +
- 'e.initKeyEvent("keypress",1,1,null,1,0,0,0,64,0);' +
- 'current_focus.inputField.dispatchEvent(e);'
- }
- )
- );
-
- tag_menu.appendChild(
- createMenuitem(
- { label : $('catStrings').getString('staff.cat.marcedit.replace_007.label'),
- oncommand :
- 'var e = document.createEvent("KeyEvents");' +
- 'e.initKeyEvent("keypress",1,1,null,1,0,0,0,65,0);' +
- 'current_focus.inputField.dispatchEvent(e);'
- }
- )
- );
-
- tag_menu.appendChild(
- createMenuitem(
- { label : $('catStrings').getString('staff.cat.marcedit.replace_008.label'),
- oncommand :
- 'var e = document.createEvent("KeyEvents");' +
- 'e.initKeyEvent("keypress",1,1,null,1,0,0,0,66,0);' +
- 'current_focus.inputField.dispatchEvent(e);'
- }
- )
- );
-
- tag_menu.appendChild( createComplexXULElement( 'separator' ) );
-
- p = createComplexXULElement('popupset');
- document.documentElement.appendChild( p );
-
- req.onreadystatechange = function () {
- if (req.readyState == 4) {
- bib_data = new XML( req.responseText.replace(xmlDeclaration, '') );
- genToolTips();
- }
- }
- req.send(null);
-
- loadRecord(xml_record);
+ try {
+
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ if (typeof JSAN == 'undefined') { throw( $("commonStrings").getString('common.jsan.missing') ); }
+ JSAN.errorLevel = "die"; // none, warn, or die
+ JSAN.addRepository('/xul/server/');
+
+ // Fake xulG for standalone...
+ try {
+ window.xulG.record;
+ } catch (e) {
+ window.xulG = {};
+ window.xulG.record = {};
+ window.xulG.save = {};
+
+ window.xulG.save.label = $('catStrings').getString('staff.cat.marcedit.save.label');
+ window.xulG.save.func = function (r) { alert(r); }
+
+ var cgi = new CGI();
+ var _rid = cgi.param('record');
+ if (_rid) {
+ window.xulG.record.url = '/opac/extras/supercat/retrieve/marcxml/record/' + _rid;
+ }
+ }
+ // End faking part...
+
+ document.getElementById('save-button').setAttribute('label', window.xulG.save.label);
+ document.getElementById('save-button').setAttribute('oncommand',
+ 'mangle_005(); ' +
+ 'var xml_string = xml_escape_unicode( xml_record.toXMLString() ); ' +
+ 'save_attempt( xml_string ); ' +
+ 'loadRecord(xml_record);'
+ );
+
+ if (window.xulG.record.url) {
+ var req = new XMLHttpRequest();
+ req.open('POST',window.xulG.record.url,false);
+ req.send(null);
+ window.xulG.record.marc = req.responseText.replace(xmlDeclaration, '');
+ }
+
+ xml_record = new XML( window.xulG.record.marc );
+ if (xml_record..record[0]) xml_record = xml_record..record[0];
+
+ // Get the tooltip xml all async like
+ req = new XMLHttpRequest();
+
+ // Set a default locale in case preferences fail us
+ var locale = "en-US";
+
+ // Try to get the locale from our preferences
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ try {
+ const Cc = Components.classes;
+ const Ci = Components.interfaces;
+ locale = Cc["@mozilla.org/preferences-service;1"].
+ getService(Ci.nsIPrefBranch).
+ getCharPref("general.useragent.locale");
+ }
+ catch (e) { }
+
+ // TODO: We should send a HEAD request to check for the existence of the desired file
+ // then fall back to the default locale if preferred locale is not necessary;
+ // however, for now we have a simplistic check:
+ //
+ // we currently have translations for only two locales; in the absence of a
+ // valid locale, default to the almighty en-US
+ if (locale != 'en-US' && locale != 'fr-CA') {
+ locale = 'en-US';
+ }
+
+ // Get the locale-specific tooltips
+ req.open('GET','/xul/server/locale/' + locale + '/marcedit-tooltips.xml',true);
+
+ context_menus = createComplexXULElement('popupset');
+ document.documentElement.appendChild( context_menus );
+
+ tag_menu = createPopup({position : 'after_start', id : 'tags_popup'});
+ context_menus.appendChild( tag_menu );
+
+ tag_menu.appendChild(
+ createMenuitem(
+ { label : $('catStrings').getString('staff.cat.marcedit.add_row.label'),
+ oncommand :
+ 'var e = document.createEvent("KeyEvents");' +
+ 'e.initKeyEvent("keypress",1,1,null,1,0,0,0,13,0);' +
+ 'current_focus.inputField.dispatchEvent(e);'
+ }
+ )
+ );
+
+ tag_menu.appendChild(
+ createMenuitem(
+ { label : $('catStrings').getString('staff.cat.marcedit.insert_row.label'),
+ oncommand :
+ 'var e = document.createEvent("KeyEvents");' +
+ 'e.initKeyEvent("keypress",1,1,null,1,0,1,0,13,0);' +
+ 'current_focus.inputField.dispatchEvent(e);'
+ }
+ )
+ );
+
+ tag_menu.appendChild(
+ createMenuitem(
+ { label : $('catStrings').getString('staff.cat.marcedit.remove_row.label'),
+ oncommand :
+ 'var e = document.createEvent("KeyEvents");' +
+ 'e.initKeyEvent("keypress",1,1,null,1,0,0,0,46,0);' +
+ 'current_focus.inputField.dispatchEvent(e);'
+ }
+ )
+ );
+
+ tag_menu.appendChild( createComplexXULElement( 'separator' ) );
+
+ tag_menu.appendChild(
+ createMenuitem(
+ { label : $('catStrings').getString('staff.cat.marcedit.replace_006.label'),
+ oncommand :
+ 'var e = document.createEvent("KeyEvents");' +
+ 'e.initKeyEvent("keypress",1,1,null,1,0,0,0,64,0);' +
+ 'current_focus.inputField.dispatchEvent(e);'
+ }
+ )
+ );
+
+ tag_menu.appendChild(
+ createMenuitem(
+ { label : $('catStrings').getString('staff.cat.marcedit.replace_007.label'),
+ oncommand :
+ 'var e = document.createEvent("KeyEvents");' +
+ 'e.initKeyEvent("keypress",1,1,null,1,0,0,0,65,0);' +
+ 'current_focus.inputField.dispatchEvent(e);'
+ }
+ )
+ );
+
+ tag_menu.appendChild(
+ createMenuitem(
+ { label : $('catStrings').getString('staff.cat.marcedit.replace_008.label'),
+ oncommand :
+ 'var e = document.createEvent("KeyEvents");' +
+ 'e.initKeyEvent("keypress",1,1,null,1,0,0,0,66,0);' +
+ 'current_focus.inputField.dispatchEvent(e);'
+ }
+ )
+ );
+
+ tag_menu.appendChild( createComplexXULElement( 'separator' ) );
+
+ p = createComplexXULElement('popupset');
+ document.documentElement.appendChild( p );
+
+ req.onreadystatechange = function () {
+ if (req.readyState == 4) {
+ bib_data = new XML( req.responseText.replace(xmlDeclaration, '') );
+ genToolTips();
+ }
+ }
+ req.send(null);
+
+ loadRecord(xml_record);
if (! xulG.fast_add_item) {
document.getElementById('fastItemAdd_checkbox').hidden = true;
}
document.getElementById('fastItemAdd_textboxes').hidden = document.getElementById('fastItemAdd_checkbox').hidden || !document.getElementById('fastItemAdd_checkbox').checked;
- } catch(E) {
- alert('FIXME, MARC Editor, my_init: ' + E);
- }
+ } catch(E) {
+ alert('FIXME, MARC Editor, my_init: ' + E);
+ }
}
function createComplexHTMLElement (e, attrs, objects, text) {
- var l = document.createElementNS('http://www.w3.org/1999/xhtml',e);
+ var l = document.createElementNS('http://www.w3.org/1999/xhtml',e);
- if (attrs) {
- for (var i in attrs) l.setAttribute(i,attrs[i]);
- }
+ if (attrs) {
+ for (var i in attrs) l.setAttribute(i,attrs[i]);
+ }
- if (objects) {
- for ( var i in objects ) l.appendChild( objects[i] );
- }
+ if (objects) {
+ for ( var i in objects ) l.appendChild( objects[i] );
+ }
- if (text) {
- l.appendChild( document.createTextNode(text) )
- }
+ if (text) {
+ l.appendChild( document.createTextNode(text) )
+ }
- return l;
+ return l;
}
function createComplexXULElement (e, attrs, objects) {
- var l = document.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul',e);
-
- if (attrs) {
- for (var i in attrs) {
- if (typeof attrs[i] == 'function') {
- l.addEventListener( i, attrs[i], true );
- } else {
- l.setAttribute(i,attrs[i]);
- }
- }
- }
-
- if (objects) {
- for ( var i in objects ) l.appendChild( objects[i] );
- }
-
- return l;
+ var l = document.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul',e);
+
+ if (attrs) {
+ for (var i in attrs) {
+ if (typeof attrs[i] == 'function') {
+ l.addEventListener( i, attrs[i], true );
+ } else {
+ l.setAttribute(i,attrs[i]);
+ }
+ }
+ }
+
+ if (objects) {
+ for ( var i in objects ) l.appendChild( objects[i] );
+ }
+
+ return l;
}
function createDescription (attrs) {
- return createComplexXULElement('description', attrs, Array.prototype.slice.apply(arguments, [1]) );
+ return createComplexXULElement('description', attrs, Array.prototype.slice.apply(arguments, [1]) );
}
function createTooltip (attrs) {
- return createComplexXULElement('tooltip', attrs, Array.prototype.slice.apply(arguments, [1]) );
+ return createComplexXULElement('tooltip', attrs, Array.prototype.slice.apply(arguments, [1]) );
}
function createLabel (attrs) {
- return createComplexXULElement('label', attrs, Array.prototype.slice.apply(arguments, [1]) );
+ return createComplexXULElement('label', attrs, Array.prototype.slice.apply(arguments, [1]) );
}
function createVbox (attrs) {
- return createComplexXULElement('vbox', attrs, Array.prototype.slice.apply(arguments, [1]) );
+ return createComplexXULElement('vbox', attrs, Array.prototype.slice.apply(arguments, [1]) );
}
function createHbox (attrs) {
- return createComplexXULElement('hbox', attrs, Array.prototype.slice.apply(arguments, [1]) );
+ return createComplexXULElement('hbox', attrs, Array.prototype.slice.apply(arguments, [1]) );
}
function createRow (attrs) {
- return createComplexXULElement('row', attrs, Array.prototype.slice.apply(arguments, [1]) );
+ return createComplexXULElement('row', attrs, Array.prototype.slice.apply(arguments, [1]) );
}
function createTextbox (attrs) {
- return createComplexXULElement('textbox', attrs, Array.prototype.slice.apply(arguments, [1]) );
+ return createComplexXULElement('textbox', attrs, Array.prototype.slice.apply(arguments, [1]) );
}
function createMenu (attrs) {
- return createComplexXULElement('menu', attrs, Array.prototype.slice.apply(arguments, [1]) );
+ return createComplexXULElement('menu', attrs, Array.prototype.slice.apply(arguments, [1]) );
}
function createMenuPopup (attrs) {
- return createComplexXULElement('menupopup', attrs, Array.prototype.slice.apply(arguments, [1]) );
+ return createComplexXULElement('menupopup', attrs, Array.prototype.slice.apply(arguments, [1]) );
}
function createPopup (attrs) {
- return createComplexXULElement('popup', attrs, Array.prototype.slice.apply(arguments, [1]) );
+ return createComplexXULElement('popup', attrs, Array.prototype.slice.apply(arguments, [1]) );
}
function createMenuitem (attrs) {
- return createComplexXULElement('menuitem', attrs, Array.prototype.slice.apply(arguments, [1]) );
+ return createComplexXULElement('menuitem', attrs, Array.prototype.slice.apply(arguments, [1]) );
}
function createCheckbox (attrs) {
- return createComplexXULElement('checkbox', attrs, Array.prototype.slice.apply(arguments, [1]) );
+ return createComplexXULElement('checkbox', attrs, Array.prototype.slice.apply(arguments, [1]) );
}
function createMARCTextbox (element,attrs) {
- var box = createComplexXULElement('textbox', attrs, Array.prototype.slice.apply(arguments, [2]) );
- box.onkeypress = function (event) {
- var root_node;
- var node = element;
- while(node = node.parent()) {
- root_node = node;
- }
-
- var row = event.target;
- while (row.tagName != 'row') row = row.parentNode;
-
- if (element.nodeKind() == 'attribute') element[0]=box.value;
- else element.setChildren( box.value );
-
- if (element.localName() != 'controlfield') {
- if ((event.charCode == 100 || event.charCode == 105) && event.ctrlKey) { // ctrl+d or ctrl+i
-
- var index_sf, target, move_data;
- if (element.localName() == 'subfield') {
- index_sf = element;
- target = event.target.parentNode;
-
- var start = event.target.selectionStart;
- var end = event.target.selectionEnd - event.target.selectionStart ?
- event.target.selectionEnd :
- event.target.value.length;
-
- move_data = event.target.value.substring(start,end);
- event.target.value = event.target.value.substring(0,start) + event.target.value.substring(end);
- event.target.setAttribute('size', event.target.value.length + 2);
-
- element.setChildren( event.target.value );
-
- } else if (element.localName() == 'code') {
- index_sf = element.parent();
- target = event.target.parentNode;
- } else if (element.localName() == 'tag' || element.localName() == 'ind1' || element.localName() == 'ind2') {
- index_sf = element.parent().children()[element.parent().children().length() - 1];
- target = event.target.parentNode.lastChild.lastChild;
- }
-
- var sf = { move_data } ;
-
- index_sf.parent().insertChildAfter( index_sf, sf );
-
- var new_sf = marcSubfield(sf);
-
- if (target === target.parentNode.lastChild) {
- target.parentNode.appendChild( new_sf );
- } else {
- target.parentNode.insertBefore( new_sf, target.nextSibling );
- }
-
- new_sf.firstChild.nextSibling.focus();
-
- event.preventDefault();
- return false;
-
- } else if (event.keyCode == 13 || event.keyCode == 77) {
- if (event.ctrlKey) { // ctrl+enter
-
- var index;
- if (element.localName() == 'subfield') index = element.parent();
- if (element.localName() == 'code') index = element.parent().parent();
- if (element.localName() == 'tag') index = element.parent();
- if (element.localName() == 'ind1') index = element.parent();
- if (element.localName() == 'ind2') index = element.parent();
-
- var df = ;
-
- if (event.shiftKey) { // ctrl+shift+enter
- index.parent().insertChildBefore( index, df );
- } else {
- index.parent().insertChildAfter( index, df );
- }
-
- var new_df = marcDatafield(df);
-
- if (row.parentNode.lastChild === row) {
- row.parentNode.appendChild( new_df );
- } else {
- if (event.shiftKey) { // ctrl+shift+enter
- row.parentNode.insertBefore( new_df, row );
- } else {
- row.parentNode.insertBefore( new_df, row.nextSibling );
- }
- }
-
- new_df.firstChild.focus();
-
- event.preventDefault();
- return false;
-
- } else if (event.shiftKey) {
- if (row.previousSibling.className.match('marcDatafieldRow'))
- row.previousSibling.firstChild.focus();
- } else {
- row.nextSibling.firstChild.focus();
- }
-
- } else if (event.keyCode == 38 || event.keyCode == 40) { // up-arrow or down-arrow
- if (event.ctrlKey) { // CTRL key: copy the field
- var index;
- if (element.localName() == 'subfield') index = element.parent();
- if (element.localName() == 'code') index = element.parent().parent();
- if (element.localName() == 'tag') index = element.parent();
- if (element.localName() == 'ind1') index = element.parent();
- if (element.localName() == 'ind2') index = element.parent();
-
- var copyField = index.copy();
-
- if (event.keyCode == 38) { // ctrl+up-arrow
- index.parent().insertChildBefore( index, copyField );
- } else {
- index.parent().insertChildAfter( index, copyField );
- }
-
- var new_df = marcDatafield(copyField);
-
- if (row.parentNode.lastChild === row) {
- row.parentNode.appendChild( new_df );
- } else {
- if (event.keyCode == 38) { // ctrl+up-arrow
- row.parentNode.insertBefore( new_df, row );
- } else { // ctrl+down-arrow
- row.parentNode.insertBefore( new_df, row.nextSibling );
- }
- }
-
- new_df.firstChild.focus();
-
- event.preventDefault();
-
- return false;
- }
-
- } else if (event.keyCode == 46 && event.ctrlKey) { // ctrl+del
-
- var index;
- if (element.localName() == 'subfield') index = element.parent();
- if (element.localName() == 'code') index = element.parent().parent();
- if (element.localName() == 'tag') index = element.parent();
- if (element.localName() == 'ind1') index = element.parent();
- if (element.localName() == 'ind2') index = element.parent();
-
- for (var i in index.parent().children()) {
- if (index === index.parent().children()[i]) {
- delete index.parent().children()[i];
- break;
- }
- }
-
- row.previousSibling.firstChild.focus();
- row.parentNode.removeChild(row);
-
- event.preventDefault();
- return false;
-
- } else if (event.keyCode == 46 && event.shiftKey) { // shift+del
-
- var index;
- if (element.localName() == 'subfield') index = element;
- if (element.localName() == 'code') index = element.parent();
-
- if (index) {
- for (var i in index.parent().children()) {
- if (index === index.parent().children()[i]) {
- delete index.parent().children()[i];
- break;
- }
- }
-
- if (event.target.parentNode === event.target.parentNode.parentNode.lastChild) {
- event.target.parentNode.previousSibling.lastChild.focus();
- } else {
- event.target.parentNode.nextSibling.firstChild.nextSibling.focus();
- }
-
- event.target.parentNode.parentNode.removeChild(event.target.parentNode);
-
- event.preventDefault();
- return false;
- }
- } else if (event.keyCode == 64 && event.ctrlKey) { // ctrl + F6
- createControlField('006',' ');
- loadRecord(xml_record);
- } else if (event.keyCode == 65 && event.ctrlKey) { // ctrl + F7
- createControlField('007',' ');
- loadRecord(xml_record);
- } else if (event.keyCode == 66 && event.ctrlKey) { // ctrl + F8
- createControlField('008',' ');
- loadRecord(xml_record);
- }
- return true;
- }
- };
-
- box.addEventListener(
- 'keypress',
- function () {
- if (element.nodeKind() == 'attribute') element[0]=box.value;
- else element.setChildren( box.value );
- return true;
- },
- false
- );
-
- box.addEventListener(
- 'change',
- function () {
- if (element.nodeKind() == 'attribute') element[0]=box.value;
- else element.setChildren( box.value );
- return true;
- },
- false
- );
-
- box.addEventListener(
- 'keypress',
- function () {
- if (element.nodeKind() == 'attribute') element[0]=box.value;
- else element.setChildren( box.value );
- return true;
- },
- true
- );
-
- box.addEventListener(
- 'keyup',
- function () {
- if (element.localName() == 'controlfield')
- eval('fillFixedFields(xml_record);');
- },
- true
- );
-
- return box;
+ var box = createComplexXULElement('textbox', attrs, Array.prototype.slice.apply(arguments, [2]) );
+ box.onkeypress = function (event) {
+ var root_node;
+ var node = element;
+ while(node = node.parent()) {
+ root_node = node;
+ }
+
+ var row = event.target;
+ while (row.tagName != 'row') row = row.parentNode;
+
+ if (element.nodeKind() == 'attribute') element[0]=box.value;
+ else element.setChildren( box.value );
+
+ if (element.localName() != 'controlfield') {
+ if ((event.charCode == 100 || event.charCode == 105) && event.ctrlKey) { // ctrl+d or ctrl+i
+
+ var index_sf, target, move_data;
+ if (element.localName() == 'subfield') {
+ index_sf = element;
+ target = event.target.parentNode;
+
+ var start = event.target.selectionStart;
+ var end = event.target.selectionEnd - event.target.selectionStart ?
+ event.target.selectionEnd :
+ event.target.value.length;
+
+ move_data = event.target.value.substring(start,end);
+ event.target.value = event.target.value.substring(0,start) + event.target.value.substring(end);
+ event.target.setAttribute('size', event.target.value.length + 2);
+
+ element.setChildren( event.target.value );
+
+ } else if (element.localName() == 'code') {
+ index_sf = element.parent();
+ target = event.target.parentNode;
+ } else if (element.localName() == 'tag' || element.localName() == 'ind1' || element.localName() == 'ind2') {
+ index_sf = element.parent().children()[element.parent().children().length() - 1];
+ target = event.target.parentNode.lastChild.lastChild;
+ }
+
+ var sf = { move_data } ;
+
+ index_sf.parent().insertChildAfter( index_sf, sf );
+
+ var new_sf = marcSubfield(sf);
+
+ if (target === target.parentNode.lastChild) {
+ target.parentNode.appendChild( new_sf );
+ } else {
+ target.parentNode.insertBefore( new_sf, target.nextSibling );
+ }
+
+ new_sf.firstChild.nextSibling.focus();
+
+ event.preventDefault();
+ return false;
+
+ } else if (event.keyCode == 13 || event.keyCode == 77) {
+ if (event.ctrlKey) { // ctrl+enter
+
+ var index;
+ if (element.localName() == 'subfield') index = element.parent();
+ if (element.localName() == 'code') index = element.parent().parent();
+ if (element.localName() == 'tag') index = element.parent();
+ if (element.localName() == 'ind1') index = element.parent();
+ if (element.localName() == 'ind2') index = element.parent();
+
+ var df = ;
+
+ if (event.shiftKey) { // ctrl+shift+enter
+ index.parent().insertChildBefore( index, df );
+ } else {
+ index.parent().insertChildAfter( index, df );
+ }
+
+ var new_df = marcDatafield(df);
+
+ if (row.parentNode.lastChild === row) {
+ row.parentNode.appendChild( new_df );
+ } else {
+ if (event.shiftKey) { // ctrl+shift+enter
+ row.parentNode.insertBefore( new_df, row );
+ } else {
+ row.parentNode.insertBefore( new_df, row.nextSibling );
+ }
+ }
+
+ new_df.firstChild.focus();
+
+ event.preventDefault();
+ return false;
+
+ } else if (event.shiftKey) {
+ if (row.previousSibling.className.match('marcDatafieldRow'))
+ row.previousSibling.firstChild.focus();
+ } else {
+ row.nextSibling.firstChild.focus();
+ }
+
+ } else if (event.keyCode == 38 || event.keyCode == 40) { // up-arrow or down-arrow
+ if (event.ctrlKey) { // CTRL key: copy the field
+ var index;
+ if (element.localName() == 'subfield') index = element.parent();
+ if (element.localName() == 'code') index = element.parent().parent();
+ if (element.localName() == 'tag') index = element.parent();
+ if (element.localName() == 'ind1') index = element.parent();
+ if (element.localName() == 'ind2') index = element.parent();
+
+ var copyField = index.copy();
+
+ if (event.keyCode == 38) { // ctrl+up-arrow
+ index.parent().insertChildBefore( index, copyField );
+ } else {
+ index.parent().insertChildAfter( index, copyField );
+ }
+
+ var new_df = marcDatafield(copyField);
+
+ if (row.parentNode.lastChild === row) {
+ row.parentNode.appendChild( new_df );
+ } else {
+ if (event.keyCode == 38) { // ctrl+up-arrow
+ row.parentNode.insertBefore( new_df, row );
+ } else { // ctrl+down-arrow
+ row.parentNode.insertBefore( new_df, row.nextSibling );
+ }
+ }
+
+ new_df.firstChild.focus();
+
+ event.preventDefault();
+
+ return false;
+ }
+
+ } else if (event.keyCode == 46 && event.ctrlKey) { // ctrl+del
+
+ var index;
+ if (element.localName() == 'subfield') index = element.parent();
+ if (element.localName() == 'code') index = element.parent().parent();
+ if (element.localName() == 'tag') index = element.parent();
+ if (element.localName() == 'ind1') index = element.parent();
+ if (element.localName() == 'ind2') index = element.parent();
+
+ for (var i in index.parent().children()) {
+ if (index === index.parent().children()[i]) {
+ delete index.parent().children()[i];
+ break;
+ }
+ }
+
+ row.previousSibling.firstChild.focus();
+ row.parentNode.removeChild(row);
+
+ event.preventDefault();
+ return false;
+
+ } else if (event.keyCode == 46 && event.shiftKey) { // shift+del
+
+ var index;
+ if (element.localName() == 'subfield') index = element;
+ if (element.localName() == 'code') index = element.parent();
+
+ if (index) {
+ for (var i in index.parent().children()) {
+ if (index === index.parent().children()[i]) {
+ delete index.parent().children()[i];
+ break;
+ }
+ }
+
+ if (event.target.parentNode === event.target.parentNode.parentNode.lastChild) {
+ event.target.parentNode.previousSibling.lastChild.focus();
+ } else {
+ event.target.parentNode.nextSibling.firstChild.nextSibling.focus();
+ }
+
+ event.target.parentNode.parentNode.removeChild(event.target.parentNode);
+
+ event.preventDefault();
+ return false;
+ }
+ } else if (event.keyCode == 64 && event.ctrlKey) { // ctrl + F6
+ createControlField('006',' ');
+ loadRecord(xml_record);
+ } else if (event.keyCode == 65 && event.ctrlKey) { // ctrl + F7
+ createControlField('007',' ');
+ loadRecord(xml_record);
+ } else if (event.keyCode == 66 && event.ctrlKey) { // ctrl + F8
+ createControlField('008',' ');
+ loadRecord(xml_record);
+ }
+ return true;
+ }
+ };
+
+ box.addEventListener(
+ 'keypress',
+ function () {
+ if (element.nodeKind() == 'attribute') element[0]=box.value;
+ else element.setChildren( box.value );
+ return true;
+ },
+ false
+ );
+
+ box.addEventListener(
+ 'change',
+ function () {
+ if (element.nodeKind() == 'attribute') element[0]=box.value;
+ else element.setChildren( box.value );
+ return true;
+ },
+ false
+ );
+
+ box.addEventListener(
+ 'keypress',
+ function () {
+ if (element.nodeKind() == 'attribute') element[0]=box.value;
+ else element.setChildren( box.value );
+ return true;
+ },
+ true
+ );
+
+ box.addEventListener(
+ 'keyup',
+ function () {
+ if (element.localName() == 'controlfield')
+ eval('fillFixedFields(xml_record);');
+ },
+ true
+ );
+
+ return box;
}
var rec_type = {
- BKS : { Type : /[at]{1}/, BLvl : /[acdm]{1}/ },
- SER : { Type : /[a]{1}/, BLvl : /[bs]{1}/ },
- VIS : { Type : /[gkro]{1}/, BLvl : /[abcdms]{1}/ },
- MIX : { Type : /[p]{1}/, BLvl : /[cd]{1}/ },
- MAP : { Type : /[ef]{1}/, BLvl : /[abcdms]{1}/ },
- SCO : { Type : /[cd]{1}/, BLvl : /[abcdms]{1}/ },
- REC : { Type : /[ij]{1}/, BLvl : /[abcdms]{1}/ },
- COM : { Type : /[m]{1}/, BLvl : /[abcdms]{1}/ }
+ BKS : { Type : /[at]{1}/, BLvl : /[acdm]{1}/ },
+ SER : { Type : /[a]{1}/, BLvl : /[bs]{1}/ },
+ VIS : { Type : /[gkro]{1}/, BLvl : /[abcdms]{1}/ },
+ MIX : { Type : /[p]{1}/, BLvl : /[cd]{1}/ },
+ MAP : { Type : /[ef]{1}/, BLvl : /[abcdms]{1}/ },
+ SCO : { Type : /[cd]{1}/, BLvl : /[abcdms]{1}/ },
+ REC : { Type : /[ij]{1}/, BLvl : /[abcdms]{1}/ },
+ COM : { Type : /[m]{1}/, BLvl : /[abcdms]{1}/ }
};
var ff_pos = {
- TrAr : {
- _8 : {
- SCO : {start : 33, len : 1, def : ' ' },
- REC : {start : 33, len : 1, def : 'n' }
- },
- _6 : {
- SCO : {start : 16, len : 1, def : ' ' },
- REC : {start : 16, len : 1, def : 'n' }
- }
- },
- TMat : {
- _8 : {
- VIS : {start : 33, len : 1, def : ' ' }
- },
- _6 : {
- VIS : {start : 16, len : 1, def : ' ' }
- }
- },
- Time : {
- _8 : {
- VIS : {start : 18, len : 3, def : ' ' }
- },
- _6 : {
- VIS : {start : 1, len : 3, def : ' ' }
- }
- },
- Tech : {
- _8 : {
- VIS : {start : 34, len : 1, def : 'n' }
- },
- _6 : {
- VIS : {start : 17, len : 1, def : 'n' }
- }
- },
- SrTp : {
- _8 : {
- SER : {start : 21, len : 1, def : ' ' }
- },
- _6 : {
- SER : {start : 4, len : 1, def : ' ' }
- }
- },
- Srce : {
- _8 : {
- BKS : {start : 39, len : 1, def : 'd' },
- SER : {start : 39, len : 1, def : 'd' },
- VIS : {start : 39, len : 1, def : 'd' },
- MIX : {start : 39, len : 1, def : 'd' },
- MAP : {start : 39, len : 1, def : 'd' },
- SCO : {start : 39, len : 1, def : 'd' },
- REC : {start : 39, len : 1, def : 'd' },
- COM : {start : 39, len : 1, def : 'd' }
- }
- },
- SpFm : {
- _8 : {
- MAP : {start : 33, len : 2, def : ' ' }
- },
- _6 : {
- MAP : {start : 16, len : 2, def : ' ' }
- }
- },
- Relf : {
- _8 : {
- MAP : {start : 18, len : 4, def : ' ' }
- },
- _6 : {
- MAP : {start : 1, len : 4, def : ' ' }
- }
- },
- Regl : {
- _8 : {
- SER : {start : 19, len : 1, def : ' ' }
- },
- _6 : {
- SER : {start : 2, len : 1, def : ' ' }
- }
- },
- Proj : {
- _8 : {
- MAP : {start : 22, len : 2, def : ' ' }
- },
- _6 : {
- MAP : {start : 5, len : 2, def : ' ' }
- }
- },
- Part : {
- _8 : {
- SCO : {start : 21, len : 1, def : ' ' },
- REC : {start : 21, len : 1, def : 'n' }
- },
- _6 : {
- SCO : {start : 4, len : 1, def : ' ' },
- REC : {start : 4, len : 1, def : 'n' }
- }
- },
- Orig : {
- _8 : {
- SER : {start : 22, len : 1, def : ' ' }
- },
- _6 : {
- SER : {start : 5, len : 1, def : ' ' }
- }
- },
- LTxt : {
- _8 : {
- SCO : {start : 30, len : 2, def : ' ' },
- REC : {start : 30, len : 2, def : ' ' }
- },
- _6 : {
- SCO : {start : 13, len : 2, def : ' ' },
- REC : {start : 13, len : 2, def : ' ' }
- }
- },
- Freq : {
- _8 : {
- SER : {start : 18, len : 1, def : ' ' }
- },
- _6 : {
- SER : {start : 1, len : 1, def : ' ' }
- }
- },
- FMus : {
- _8 : {
- SCO : {start : 20, len : 1, def : ' ' },
- REC : {start : 20, len : 1, def : 'n' }
- },
- _6 : {
- SCO : {start : 3, len : 1, def : ' ' },
- REC : {start : 3, len : 1, def : 'n' }
- }
- },
- File : {
- _8 : {
- COM : {start : 26, len : 1, def : 'u' }
- },
- _6 : {
- COM : {start : 9, len : 1, def : 'u' }
- }
- },
- EntW : {
- _8 : {
- SER : {start : 24, len : 1, def : ' ' }
- },
- _6 : {
- SER : {start : 7, len : 1, def : ' ' }
- }
- },
- AccM : {
- _8 : {
- SCO : {start : 24, len : 6, def : ' ' },
- REC : {start : 24, len : 6, def : ' ' }
- },
- _6 : {
- SCO : {start : 7, len : 6, def : ' ' },
- REC : {start : 7, len : 6, def : ' ' }
- }
- },
- Comp : {
- _8 : {
- SCO : {start : 18, len : 2, def : ' ' },
- REC : {start : 18, len : 2, def : ' ' }
- },
- _6 : {
- SCO : {start : 1, len : 2, def : ' ' },
- REC : {start : 1, len : 2, def : ' ' }
- }
- },
- CrTp : {
- _8 : {
- MAP : {start : 25, len : 1, def : ' ' }
- },
- _6 : {
- MAP : {start : 8, len : 1, def : ' ' }
- }
- },
- Ctry : {
- _8 : {
- BKS : {start : 15, len : 3, def : ' ' },
- SER : {start : 15, len : 3, def : ' ' },
- VIS : {start : 15, len : 3, def : ' ' },
- MIX : {start : 15, len : 3, def : ' ' },
- MAP : {start : 15, len : 3, def : ' ' },
- SCO : {start : 15, len : 3, def : ' ' },
- REC : {start : 15, len : 3, def : ' ' },
- COM : {start : 15, len : 3, def : ' ' }
- }
- },
- Lang : {
- _8 : {
- BKS : {start : 35, len : 3, def : ' ' },
- SER : {start : 35, len : 3, def : ' ' },
- VIS : {start : 35, len : 3, def : ' ' },
- MIX : {start : 35, len : 3, def : ' ' },
- MAP : {start : 35, len : 3, def : ' ' },
- SCO : {start : 35, len : 3, def : ' ' },
- REC : {start : 35, len : 3, def : ' ' },
- COM : {start : 35, len : 3, def : ' ' }
- }
- },
- MRec : {
- _8 : {
- BKS : {start : 38, len : 1, def : ' ' },
- SER : {start : 38, len : 1, def : ' ' },
- VIS : {start : 38, len : 1, def : ' ' },
- MIX : {start : 38, len : 1, def : ' ' },
- MAP : {start : 38, len : 1, def : ' ' },
- SCO : {start : 38, len : 1, def : ' ' },
- REC : {start : 38, len : 1, def : ' ' },
- COM : {start : 38, len : 1, def : ' ' }
- }
- },
- DtSt : {
- _8 : {
- BKS : {start : 6, len : 1, def : ' ' },
- SER : {start : 6, len : 1, def : 'c' },
- VIS : {start : 6, len : 1, def : ' ' },
- MIX : {start : 6, len : 1, def : ' ' },
- MAP : {start : 6, len : 1, def : ' ' },
- SCO : {start : 6, len : 1, def : ' ' },
- REC : {start : 6, len : 1, def : ' ' },
- COM : {start : 6, len : 1, def : ' ' }
- }
- },
- Type : {
- ldr : {
- BKS : {start : 6, len : 1, def : 'a' },
- SER : {start : 6, len : 1, def : 'a' },
- VIS : {start : 6, len : 1, def : 'g' },
- MIX : {start : 6, len : 1, def : 'p' },
- MAP : {start : 6, len : 1, def : 'e' },
- SCO : {start : 6, len : 1, def : 'c' },
- REC : {start : 6, len : 1, def : 'i' },
- COM : {start : 6, len : 1, def : 'm' }
- }
- },
- Ctrl : {
- ldr : {
- BKS : {start : 8, len : 1, def : ' ' },
- SER : {start : 8, len : 1, def : ' ' },
- VIS : {start : 8, len : 1, def : ' ' },
- MIX : {start : 8, len : 1, def : ' ' },
- MAP : {start : 8, len : 1, def : ' ' },
- SCO : {start : 8, len : 1, def : ' ' },
- REC : {start : 8, len : 1, def : ' ' },
- COM : {start : 8, len : 1, def : ' ' }
- }
- },
- BLvl : {
- ldr : {
- BKS : {start : 7, len : 1, def : 'm' },
- SER : {start : 7, len : 1, def : 's' },
- VIS : {start : 7, len : 1, def : 'm' },
- MIX : {start : 7, len : 1, def : 'c' },
- MAP : {start : 7, len : 1, def : 'm' },
- SCO : {start : 7, len : 1, def : 'm' },
- REC : {start : 7, len : 1, def : 'm' },
- COM : {start : 7, len : 1, def : 'm' }
- }
- },
- Desc : {
- ldr : {
- BKS : {start : 18, len : 1, def : ' ' },
- SER : {start : 18, len : 1, def : ' ' },
- VIS : {start : 18, len : 1, def : ' ' },
- MIX : {start : 18, len : 1, def : ' ' },
- MAP : {start : 18, len : 1, def : ' ' },
- SCO : {start : 18, len : 1, def : ' ' },
- REC : {start : 18, len : 1, def : ' ' },
- COM : {start : 18, len : 1, def : ' ' }
- }
- },
- ELvl : {
- ldr : {
- BKS : {start : 17, len : 1, def : ' ' },
- SER : {start : 17, len : 1, def : ' ' },
- VIS : {start : 17, len : 1, def : ' ' },
- MIX : {start : 17, len : 1, def : ' ' },
- MAP : {start : 17, len : 1, def : ' ' },
- SCO : {start : 17, len : 1, def : ' ' },
- REC : {start : 17, len : 1, def : ' ' },
- COM : {start : 17, len : 1, def : ' ' }
- }
- },
- Indx : {
- _8 : {
- BKS : {start : 31, len : 1, def : '0' },
- MAP : {start : 31, len : 1, def : '0' }
- },
- _6 : {
- BKS : {start : 14, len : 1, def : '0' },
- MAP : {start : 14, len : 1, def : '0' }
- }
- },
- Date1 : {
- _8 : {
- BKS : {start : 7, len : 4, def : ' ' },
- SER : {start : 7, len : 4, def : ' ' },
- VIS : {start : 7, len : 4, def : ' ' },
- MIX : {start : 7, len : 4, def : ' ' },
- MAP : {start : 7, len : 4, def : ' ' },
- SCO : {start : 7, len : 4, def : ' ' },
- REC : {start : 7, len : 4, def : ' ' },
- COM : {start : 7, len : 4, def : ' ' }
- }
- },
- Date2 : {
- _8 : {
- BKS : {start : 11, len : 4, def : ' ' },
- SER : {start : 11, len : 4, def : '9' },
- VIS : {start : 11, len : 4, def : ' ' },
- MIX : {start : 11, len : 4, def : ' ' },
- MAP : {start : 11, len : 4, def : ' ' },
- SCO : {start : 11, len : 4, def : ' ' },
- REC : {start : 11, len : 4, def : ' ' },
- COM : {start : 11, len : 4, def : ' ' }
- }
- },
- LitF : {
- _8 : {
- BKS : {start : 33, len : 1, def : '0' }
- },
- _6 : {
- BKS : {start : 16, len : 1, def : '0' }
- }
- },
- Biog : {
- _8 : {
- BKS : {start : 34, len : 1, def : ' ' }
- },
- _6 : {
- BKS : {start : 17, len : 1, def : ' ' }
- }
- },
- Ills : {
- _8 : {
- BKS : {start : 18, len : 4, def : ' ' }
- },
- _6 : {
- BKS : {start : 1, len : 4, def : ' ' }
- }
- },
- Fest : {
- _8 : {
- BKS : {start : 30, len : 1, def : '0' }
- },
- _6 : {
- BKS : {start : 13, len : 1, def : '0' }
- }
- },
- Conf : {
- _8 : {
- BKS : {start : 29, len : 1, def : '0' },
- SER : {start : 29, len : 1, def : '0' }
- },
- _6 : {
- BKS : {start : 12, len : 1, def : '0' },
- SER : {start : 12, len : 1, def : '0' }
- }
- },
- Cont : {
- _8 : {
- BKS : {start : 24, len : 4, def : ' ' },
- SER : {start : 25, len : 3, def : ' ' }
- },
- _6 : {
- BKS : {start : 7, len : 4, def : ' ' },
- SER : {start : 8, len : 3, def : ' ' }
- }
- },
- GPub : {
- _8 : {
- BKS : {start : 28, len : 1, def : ' ' },
- SER : {start : 28, len : 1, def : ' ' },
- VIS : {start : 28, len : 1, def : ' ' },
- MAP : {start : 28, len : 1, def : ' ' },
- COM : {start : 28, len : 1, def : ' ' }
- },
- _6 : {
- BKS : {start : 11, len : 1, def : ' ' },
- SER : {start : 11, len : 1, def : ' ' },
- VIS : {start : 11, len : 1, def : ' ' },
- MAP : {start : 11, len : 1, def : ' ' },
- COM : {start : 11, len : 1, def : ' ' }
- }
- },
- Audn : {
- _8 : {
- BKS : {start : 22, len : 1, def : ' ' },
- SER : {start : 22, len : 1, def : ' ' },
- VIS : {start : 22, len : 1, def : ' ' },
- SCO : {start : 22, len : 1, def : ' ' },
- REC : {start : 22, len : 1, def : ' ' },
- COM : {start : 22, len : 1, def : ' ' }
- },
- _6 : {
- BKS : {start : 5, len : 1, def : ' ' },
- SER : {start : 5, len : 1, def : ' ' },
- VIS : {start : 5, len : 1, def : ' ' },
- SCO : {start : 5, len : 1, def : ' ' },
- REC : {start : 5, len : 1, def : ' ' },
- COM : {start : 5, len : 1, def : ' ' }
- }
- },
- Form : {
- _8 : {
- BKS : {start : 23, len : 1, def : ' ' },
- SER : {start : 23, len : 1, def : ' ' },
- VIS : {start : 29, len : 1, def : ' ' },
- MIX : {start : 23, len : 1, def : ' ' },
- MAP : {start : 29, len : 1, def : ' ' },
- SCO : {start : 23, len : 1, def : ' ' },
- REC : {start : 23, len : 1, def : ' ' }
- },
- _6 : {
- BKS : {start : 6, len : 1, def : ' ' },
- SER : {start : 6, len : 1, def : ' ' },
- VIS : {start : 12, len : 1, def : ' ' },
- MIX : {start : 6, len : 1, def : ' ' },
- MAP : {start : 12, len : 1, def : ' ' },
- SCO : {start : 6, len : 1, def : ' ' },
- REC : {start : 6, len : 1, def : ' ' }
- }
- },
- 'S/L' : {
- _8 : {
- SER : {start : 34, len : 1, def : '0' }
- },
- _6 : {
- SER : {start : 17, len : 1, def : '0' }
- }
- },
- 'Alph' : {
- _8 : {
- SER : {start : 33, len : 1, def : ' ' }
- },
- _6 : {
- SER : {start : 16, len : 1, def : ' ' }
- }
- }
+ TrAr : {
+ _8 : {
+ SCO : {start : 33, len : 1, def : ' ' },
+ REC : {start : 33, len : 1, def : 'n' }
+ },
+ _6 : {
+ SCO : {start : 16, len : 1, def : ' ' },
+ REC : {start : 16, len : 1, def : 'n' }
+ }
+ },
+ TMat : {
+ _8 : {
+ VIS : {start : 33, len : 1, def : ' ' }
+ },
+ _6 : {
+ VIS : {start : 16, len : 1, def : ' ' }
+ }
+ },
+ Time : {
+ _8 : {
+ VIS : {start : 18, len : 3, def : ' ' }
+ },
+ _6 : {
+ VIS : {start : 1, len : 3, def : ' ' }
+ }
+ },
+ Tech : {
+ _8 : {
+ VIS : {start : 34, len : 1, def : 'n' }
+ },
+ _6 : {
+ VIS : {start : 17, len : 1, def : 'n' }
+ }
+ },
+ SrTp : {
+ _8 : {
+ SER : {start : 21, len : 1, def : ' ' }
+ },
+ _6 : {
+ SER : {start : 4, len : 1, def : ' ' }
+ }
+ },
+ Srce : {
+ _8 : {
+ BKS : {start : 39, len : 1, def : 'd' },
+ SER : {start : 39, len : 1, def : 'd' },
+ VIS : {start : 39, len : 1, def : 'd' },
+ MIX : {start : 39, len : 1, def : 'd' },
+ MAP : {start : 39, len : 1, def : 'd' },
+ SCO : {start : 39, len : 1, def : 'd' },
+ REC : {start : 39, len : 1, def : 'd' },
+ COM : {start : 39, len : 1, def : 'd' }
+ }
+ },
+ SpFm : {
+ _8 : {
+ MAP : {start : 33, len : 2, def : ' ' }
+ },
+ _6 : {
+ MAP : {start : 16, len : 2, def : ' ' }
+ }
+ },
+ Relf : {
+ _8 : {
+ MAP : {start : 18, len : 4, def : ' ' }
+ },
+ _6 : {
+ MAP : {start : 1, len : 4, def : ' ' }
+ }
+ },
+ Regl : {
+ _8 : {
+ SER : {start : 19, len : 1, def : ' ' }
+ },
+ _6 : {
+ SER : {start : 2, len : 1, def : ' ' }
+ }
+ },
+ Proj : {
+ _8 : {
+ MAP : {start : 22, len : 2, def : ' ' }
+ },
+ _6 : {
+ MAP : {start : 5, len : 2, def : ' ' }
+ }
+ },
+ Part : {
+ _8 : {
+ SCO : {start : 21, len : 1, def : ' ' },
+ REC : {start : 21, len : 1, def : 'n' }
+ },
+ _6 : {
+ SCO : {start : 4, len : 1, def : ' ' },
+ REC : {start : 4, len : 1, def : 'n' }
+ }
+ },
+ Orig : {
+ _8 : {
+ SER : {start : 22, len : 1, def : ' ' }
+ },
+ _6 : {
+ SER : {start : 5, len : 1, def : ' ' }
+ }
+ },
+ LTxt : {
+ _8 : {
+ SCO : {start : 30, len : 2, def : ' ' },
+ REC : {start : 30, len : 2, def : ' ' }
+ },
+ _6 : {
+ SCO : {start : 13, len : 2, def : ' ' },
+ REC : {start : 13, len : 2, def : ' ' }
+ }
+ },
+ Freq : {
+ _8 : {
+ SER : {start : 18, len : 1, def : ' ' }
+ },
+ _6 : {
+ SER : {start : 1, len : 1, def : ' ' }
+ }
+ },
+ FMus : {
+ _8 : {
+ SCO : {start : 20, len : 1, def : ' ' },
+ REC : {start : 20, len : 1, def : 'n' }
+ },
+ _6 : {
+ SCO : {start : 3, len : 1, def : ' ' },
+ REC : {start : 3, len : 1, def : 'n' }
+ }
+ },
+ File : {
+ _8 : {
+ COM : {start : 26, len : 1, def : 'u' }
+ },
+ _6 : {
+ COM : {start : 9, len : 1, def : 'u' }
+ }
+ },
+ EntW : {
+ _8 : {
+ SER : {start : 24, len : 1, def : ' ' }
+ },
+ _6 : {
+ SER : {start : 7, len : 1, def : ' ' }
+ }
+ },
+ AccM : {
+ _8 : {
+ SCO : {start : 24, len : 6, def : ' ' },
+ REC : {start : 24, len : 6, def : ' ' }
+ },
+ _6 : {
+ SCO : {start : 7, len : 6, def : ' ' },
+ REC : {start : 7, len : 6, def : ' ' }
+ }
+ },
+ Comp : {
+ _8 : {
+ SCO : {start : 18, len : 2, def : ' ' },
+ REC : {start : 18, len : 2, def : ' ' }
+ },
+ _6 : {
+ SCO : {start : 1, len : 2, def : ' ' },
+ REC : {start : 1, len : 2, def : ' ' }
+ }
+ },
+ CrTp : {
+ _8 : {
+ MAP : {start : 25, len : 1, def : ' ' }
+ },
+ _6 : {
+ MAP : {start : 8, len : 1, def : ' ' }
+ }
+ },
+ Ctry : {
+ _8 : {
+ BKS : {start : 15, len : 3, def : ' ' },
+ SER : {start : 15, len : 3, def : ' ' },
+ VIS : {start : 15, len : 3, def : ' ' },
+ MIX : {start : 15, len : 3, def : ' ' },
+ MAP : {start : 15, len : 3, def : ' ' },
+ SCO : {start : 15, len : 3, def : ' ' },
+ REC : {start : 15, len : 3, def : ' ' },
+ COM : {start : 15, len : 3, def : ' ' }
+ }
+ },
+ Lang : {
+ _8 : {
+ BKS : {start : 35, len : 3, def : ' ' },
+ SER : {start : 35, len : 3, def : ' ' },
+ VIS : {start : 35, len : 3, def : ' ' },
+ MIX : {start : 35, len : 3, def : ' ' },
+ MAP : {start : 35, len : 3, def : ' ' },
+ SCO : {start : 35, len : 3, def : ' ' },
+ REC : {start : 35, len : 3, def : ' ' },
+ COM : {start : 35, len : 3, def : ' ' }
+ }
+ },
+ MRec : {
+ _8 : {
+ BKS : {start : 38, len : 1, def : ' ' },
+ SER : {start : 38, len : 1, def : ' ' },
+ VIS : {start : 38, len : 1, def : ' ' },
+ MIX : {start : 38, len : 1, def : ' ' },
+ MAP : {start : 38, len : 1, def : ' ' },
+ SCO : {start : 38, len : 1, def : ' ' },
+ REC : {start : 38, len : 1, def : ' ' },
+ COM : {start : 38, len : 1, def : ' ' }
+ }
+ },
+ DtSt : {
+ _8 : {
+ BKS : {start : 6, len : 1, def : ' ' },
+ SER : {start : 6, len : 1, def : 'c' },
+ VIS : {start : 6, len : 1, def : ' ' },
+ MIX : {start : 6, len : 1, def : ' ' },
+ MAP : {start : 6, len : 1, def : ' ' },
+ SCO : {start : 6, len : 1, def : ' ' },
+ REC : {start : 6, len : 1, def : ' ' },
+ COM : {start : 6, len : 1, def : ' ' }
+ }
+ },
+ Type : {
+ ldr : {
+ BKS : {start : 6, len : 1, def : 'a' },
+ SER : {start : 6, len : 1, def : 'a' },
+ VIS : {start : 6, len : 1, def : 'g' },
+ MIX : {start : 6, len : 1, def : 'p' },
+ MAP : {start : 6, len : 1, def : 'e' },
+ SCO : {start : 6, len : 1, def : 'c' },
+ REC : {start : 6, len : 1, def : 'i' },
+ COM : {start : 6, len : 1, def : 'm' }
+ }
+ },
+ Ctrl : {
+ ldr : {
+ BKS : {start : 8, len : 1, def : ' ' },
+ SER : {start : 8, len : 1, def : ' ' },
+ VIS : {start : 8, len : 1, def : ' ' },
+ MIX : {start : 8, len : 1, def : ' ' },
+ MAP : {start : 8, len : 1, def : ' ' },
+ SCO : {start : 8, len : 1, def : ' ' },
+ REC : {start : 8, len : 1, def : ' ' },
+ COM : {start : 8, len : 1, def : ' ' }
+ }
+ },
+ BLvl : {
+ ldr : {
+ BKS : {start : 7, len : 1, def : 'm' },
+ SER : {start : 7, len : 1, def : 's' },
+ VIS : {start : 7, len : 1, def : 'm' },
+ MIX : {start : 7, len : 1, def : 'c' },
+ MAP : {start : 7, len : 1, def : 'm' },
+ SCO : {start : 7, len : 1, def : 'm' },
+ REC : {start : 7, len : 1, def : 'm' },
+ COM : {start : 7, len : 1, def : 'm' }
+ }
+ },
+ Desc : {
+ ldr : {
+ BKS : {start : 18, len : 1, def : ' ' },
+ SER : {start : 18, len : 1, def : ' ' },
+ VIS : {start : 18, len : 1, def : ' ' },
+ MIX : {start : 18, len : 1, def : ' ' },
+ MAP : {start : 18, len : 1, def : ' ' },
+ SCO : {start : 18, len : 1, def : ' ' },
+ REC : {start : 18, len : 1, def : ' ' },
+ COM : {start : 18, len : 1, def : ' ' }
+ }
+ },
+ ELvl : {
+ ldr : {
+ BKS : {start : 17, len : 1, def : ' ' },
+ SER : {start : 17, len : 1, def : ' ' },
+ VIS : {start : 17, len : 1, def : ' ' },
+ MIX : {start : 17, len : 1, def : ' ' },
+ MAP : {start : 17, len : 1, def : ' ' },
+ SCO : {start : 17, len : 1, def : ' ' },
+ REC : {start : 17, len : 1, def : ' ' },
+ COM : {start : 17, len : 1, def : ' ' }
+ }
+ },
+ Indx : {
+ _8 : {
+ BKS : {start : 31, len : 1, def : '0' },
+ MAP : {start : 31, len : 1, def : '0' }
+ },
+ _6 : {
+ BKS : {start : 14, len : 1, def : '0' },
+ MAP : {start : 14, len : 1, def : '0' }
+ }
+ },
+ Date1 : {
+ _8 : {
+ BKS : {start : 7, len : 4, def : ' ' },
+ SER : {start : 7, len : 4, def : ' ' },
+ VIS : {start : 7, len : 4, def : ' ' },
+ MIX : {start : 7, len : 4, def : ' ' },
+ MAP : {start : 7, len : 4, def : ' ' },
+ SCO : {start : 7, len : 4, def : ' ' },
+ REC : {start : 7, len : 4, def : ' ' },
+ COM : {start : 7, len : 4, def : ' ' }
+ }
+ },
+ Date2 : {
+ _8 : {
+ BKS : {start : 11, len : 4, def : ' ' },
+ SER : {start : 11, len : 4, def : '9' },
+ VIS : {start : 11, len : 4, def : ' ' },
+ MIX : {start : 11, len : 4, def : ' ' },
+ MAP : {start : 11, len : 4, def : ' ' },
+ SCO : {start : 11, len : 4, def : ' ' },
+ REC : {start : 11, len : 4, def : ' ' },
+ COM : {start : 11, len : 4, def : ' ' }
+ }
+ },
+ LitF : {
+ _8 : {
+ BKS : {start : 33, len : 1, def : '0' }
+ },
+ _6 : {
+ BKS : {start : 16, len : 1, def : '0' }
+ }
+ },
+ Biog : {
+ _8 : {
+ BKS : {start : 34, len : 1, def : ' ' }
+ },
+ _6 : {
+ BKS : {start : 17, len : 1, def : ' ' }
+ }
+ },
+ Ills : {
+ _8 : {
+ BKS : {start : 18, len : 4, def : ' ' }
+ },
+ _6 : {
+ BKS : {start : 1, len : 4, def : ' ' }
+ }
+ },
+ Fest : {
+ _8 : {
+ BKS : {start : 30, len : 1, def : '0' }
+ },
+ _6 : {
+ BKS : {start : 13, len : 1, def : '0' }
+ }
+ },
+ Conf : {
+ _8 : {
+ BKS : {start : 29, len : 1, def : '0' },
+ SER : {start : 29, len : 1, def : '0' }
+ },
+ _6 : {
+ BKS : {start : 12, len : 1, def : '0' },
+ SER : {start : 12, len : 1, def : '0' }
+ }
+ },
+ Cont : {
+ _8 : {
+ BKS : {start : 24, len : 4, def : ' ' },
+ SER : {start : 25, len : 3, def : ' ' }
+ },
+ _6 : {
+ BKS : {start : 7, len : 4, def : ' ' },
+ SER : {start : 8, len : 3, def : ' ' }
+ }
+ },
+ GPub : {
+ _8 : {
+ BKS : {start : 28, len : 1, def : ' ' },
+ SER : {start : 28, len : 1, def : ' ' },
+ VIS : {start : 28, len : 1, def : ' ' },
+ MAP : {start : 28, len : 1, def : ' ' },
+ COM : {start : 28, len : 1, def : ' ' }
+ },
+ _6 : {
+ BKS : {start : 11, len : 1, def : ' ' },
+ SER : {start : 11, len : 1, def : ' ' },
+ VIS : {start : 11, len : 1, def : ' ' },
+ MAP : {start : 11, len : 1, def : ' ' },
+ COM : {start : 11, len : 1, def : ' ' }
+ }
+ },
+ Audn : {
+ _8 : {
+ BKS : {start : 22, len : 1, def : ' ' },
+ SER : {start : 22, len : 1, def : ' ' },
+ VIS : {start : 22, len : 1, def : ' ' },
+ SCO : {start : 22, len : 1, def : ' ' },
+ REC : {start : 22, len : 1, def : ' ' },
+ COM : {start : 22, len : 1, def : ' ' }
+ },
+ _6 : {
+ BKS : {start : 5, len : 1, def : ' ' },
+ SER : {start : 5, len : 1, def : ' ' },
+ VIS : {start : 5, len : 1, def : ' ' },
+ SCO : {start : 5, len : 1, def : ' ' },
+ REC : {start : 5, len : 1, def : ' ' },
+ COM : {start : 5, len : 1, def : ' ' }
+ }
+ },
+ Form : {
+ _8 : {
+ BKS : {start : 23, len : 1, def : ' ' },
+ SER : {start : 23, len : 1, def : ' ' },
+ VIS : {start : 29, len : 1, def : ' ' },
+ MIX : {start : 23, len : 1, def : ' ' },
+ MAP : {start : 29, len : 1, def : ' ' },
+ SCO : {start : 23, len : 1, def : ' ' },
+ REC : {start : 23, len : 1, def : ' ' }
+ },
+ _6 : {
+ BKS : {start : 6, len : 1, def : ' ' },
+ SER : {start : 6, len : 1, def : ' ' },
+ VIS : {start : 12, len : 1, def : ' ' },
+ MIX : {start : 6, len : 1, def : ' ' },
+ MAP : {start : 12, len : 1, def : ' ' },
+ SCO : {start : 6, len : 1, def : ' ' },
+ REC : {start : 6, len : 1, def : ' ' }
+ }
+ },
+ 'S/L' : {
+ _8 : {
+ SER : {start : 34, len : 1, def : '0' }
+ },
+ _6 : {
+ SER : {start : 17, len : 1, def : '0' }
+ }
+ },
+ 'Alph' : {
+ _8 : {
+ SER : {start : 33, len : 1, def : ' ' }
+ },
+ _6 : {
+ SER : {start : 16, len : 1, def : ' ' }
+ }
+ }
};
function recordType (rec) {
- try {
- var _l = rec.leader.toString();
-
- var _t = _l.substr(ff_pos.Type.ldr.BKS.start, ff_pos.Type.ldr.BKS.len);
- var _b = _l.substr(ff_pos.BLvl.ldr.BKS.start, ff_pos.BLvl.ldr.BKS.len);
-
- for (var t in rec_type) {
- if (_t.match(rec_type[t].Type) && _b.match(rec_type[t].BLvl)) {
- document.getElementById('recordTypeLabel').value = t;
- _record_type = t;
- return t;
- }
- }
-
- // in case we don't have a valid record type ...
- _record_type = 'BKS';
- return _record_type;
-
- } catch(E) {
- alert('FIXME, MARC Editor, recordType: ' + E);
- }
+ try {
+ var _l = rec.leader.toString();
+
+ var _t = _l.substr(ff_pos.Type.ldr.BKS.start, ff_pos.Type.ldr.BKS.len);
+ var _b = _l.substr(ff_pos.BLvl.ldr.BKS.start, ff_pos.BLvl.ldr.BKS.len);
+
+ for (var t in rec_type) {
+ if (_t.match(rec_type[t].Type) && _b.match(rec_type[t].BLvl)) {
+ document.getElementById('recordTypeLabel').value = t;
+ _record_type = t;
+ return t;
+ }
+ }
+
+ // in case we don't have a valid record type ...
+ _record_type = 'BKS';
+ return _record_type;
+
+ } catch(E) {
+ alert('FIXME, MARC Editor, recordType: ' + E);
+ }
}
function toggleFFE () {
- var grid = document.getElementById('leaderGrid');
- if (grid.hidden) {
- grid.hidden = false;
- } else {
- grid.hidden = true;
- }
- return true;
+ var grid = document.getElementById('leaderGrid');
+ if (grid.hidden) {
+ grid.hidden = false;
+ } else {
+ grid.hidden = true;
+ }
+ return true;
}
function changeFFEditor (type) {
- var grid = document.getElementById('leaderGrid');
- grid.setAttribute('type',type);
+ var grid = document.getElementById('leaderGrid');
+ grid.setAttribute('type',type);
}
function fillFixedFields (rec) {
- try {
- var grid = document.getElementById('leaderGrid');
-
- var rtype = _record_type;
-
- var _l = rec.leader.toString();
- var _6 = rec.controlfield.(@tag=='006').toString();
- var _7 = rec.controlfield.(@tag=='007').toString();
- var _8 = rec.controlfield.(@tag=='008').toString();
-
- var list = [];
- var pre_list = grid.getElementsByTagName('label');
- for (var i in pre_list) {
- if ( pre_list[i].getAttribute && pre_list[i].getAttribute('set').indexOf(grid.getAttribute('type')) > -1 ) {
- list.push( pre_list[i] );
- }
- }
-
- for (var i in list) {
- var name = list[i].getAttribute('name');
-
- if (!ff_pos[name])
- continue;
-
- var value = '';
- if ( ff_pos[name].ldr && ff_pos[name].ldr[rtype] )
- value = _l.substr(ff_pos[name].ldr[rtype].start, ff_pos[name].ldr[rtype].len);
-
- if ( ff_pos[name]._8 && ff_pos[name]._8[rtype] )
- value = _8.substr(ff_pos[name]._8[rtype].start, ff_pos[name]._8[rtype].len);
-
- if ( !value && ff_pos[name]._6 && ff_pos[name]._6[rtype] )
- value = _6.substr(ff_pos[name]._6[rtype].start, ff_pos[name]._6[rtype].len);
-
- if ( ff_pos[name]._7 && ff_pos[name]._7[rtype] )
- value = _7.substr(ff_pos[name]._7[rtype].start, ff_pos[name]._7[rtype].len);
-
- if (!value) {
- var d;
- var p;
- if (ff_pos[name].ldr && ff_pos[name].ldr[rtype]) {
- d = ff_pos[name].ldr[rtype].def;
- p = 'ldr';
- }
-
- if (ff_pos[name]._8 && ff_pos[name]._8[rtype]) {
- d = ff_pos[name]._8[rtype].def;
- p = '_8';
- }
-
- if (!value && ff_pos[name]._6 && ff_pos[name]._6[rtype]) {
- d = ff_pos[name]._6[rtype].def;
- p = '_6';
- }
-
- if (ff_pos[name]._7 && ff_pos[name]._7[rtype]) {
- d = ff_pos[name]._7[rtype].def;
- p = '_7';
- }
-
- if (!value) {
- for (var j = 0; j < ff_pos[name][p][rtype].len; j++) {
- value += d;
- }
- }
- }
-
- list[i].nextSibling.value = value;
- }
-
- return true;
- } catch(E) {
- alert('FIXME, MARC Editor, fillFixedFields: ' + E);
- }
+ try {
+ var grid = document.getElementById('leaderGrid');
+
+ var rtype = _record_type;
+
+ var _l = rec.leader.toString();
+ var _6 = rec.controlfield.(@tag=='006').toString();
+ var _7 = rec.controlfield.(@tag=='007').toString();
+ var _8 = rec.controlfield.(@tag=='008').toString();
+
+ var list = [];
+ var pre_list = grid.getElementsByTagName('label');
+ for (var i in pre_list) {
+ if ( pre_list[i].getAttribute && pre_list[i].getAttribute('set').indexOf(grid.getAttribute('type')) > -1 ) {
+ list.push( pre_list[i] );
+ }
+ }
+
+ for (var i in list) {
+ var name = list[i].getAttribute('name');
+
+ if (!ff_pos[name])
+ continue;
+
+ var value = '';
+ if ( ff_pos[name].ldr && ff_pos[name].ldr[rtype] )
+ value = _l.substr(ff_pos[name].ldr[rtype].start, ff_pos[name].ldr[rtype].len);
+
+ if ( ff_pos[name]._8 && ff_pos[name]._8[rtype] )
+ value = _8.substr(ff_pos[name]._8[rtype].start, ff_pos[name]._8[rtype].len);
+
+ if ( !value && ff_pos[name]._6 && ff_pos[name]._6[rtype] )
+ value = _6.substr(ff_pos[name]._6[rtype].start, ff_pos[name]._6[rtype].len);
+
+ if ( ff_pos[name]._7 && ff_pos[name]._7[rtype] )
+ value = _7.substr(ff_pos[name]._7[rtype].start, ff_pos[name]._7[rtype].len);
+
+ if (!value) {
+ var d;
+ var p;
+ if (ff_pos[name].ldr && ff_pos[name].ldr[rtype]) {
+ d = ff_pos[name].ldr[rtype].def;
+ p = 'ldr';
+ }
+
+ if (ff_pos[name]._8 && ff_pos[name]._8[rtype]) {
+ d = ff_pos[name]._8[rtype].def;
+ p = '_8';
+ }
+
+ if (!value && ff_pos[name]._6 && ff_pos[name]._6[rtype]) {
+ d = ff_pos[name]._6[rtype].def;
+ p = '_6';
+ }
+
+ if (ff_pos[name]._7 && ff_pos[name]._7[rtype]) {
+ d = ff_pos[name]._7[rtype].def;
+ p = '_7';
+ }
+
+ if (!value) {
+ for (var j = 0; j < ff_pos[name][p][rtype].len; j++) {
+ value += d;
+ }
+ }
+ }
+
+ list[i].nextSibling.value = value;
+ }
+
+ return true;
+ } catch(E) {
+ alert('FIXME, MARC Editor, fillFixedFields: ' + E);
+ }
}
function updateFixedFields (element) {
- var grid = document.getElementById('leaderGrid');
- var recGrid = document.getElementById('recGrid');
-
- var rtype = _record_type;
- var new_value = element.value;
-
- var parts = {
- ldr : _record.leader,
- _6 : _record.controlfield.(@tag=='006'),
- _7 : _record.controlfield.(@tag=='007'),
- _8 : _record.controlfield.(@tag=='008')
- };
-
- var name = element.getAttribute('name');
- for (var i in ff_pos[name]) {
-
- if (!ff_pos[name][i][rtype]) continue;
- if (!parts[i]) {
- // we're missing the required field. Add it now.
-
- var newfield;
- if (i == '_6') newfield = '006';
- else if (i == '_7') newfield = '007';
- else if (i == '_8') newfield = '008';
- else continue;
-
- createControlField(newfield,' ');
- parts[i] = _record.controlfield.(@tag==newfield);
- }
+ var grid = document.getElementById('leaderGrid');
+ var recGrid = document.getElementById('recGrid');
+
+ var rtype = _record_type;
+ var new_value = element.value;
+
+ var parts = {
+ ldr : _record.leader,
+ _6 : _record.controlfield.(@tag=='006'),
+ _7 : _record.controlfield.(@tag=='007'),
+ _8 : _record.controlfield.(@tag=='008')
+ };
+
+ var name = element.getAttribute('name');
+ for (var i in ff_pos[name]) {
+
+ if (!ff_pos[name][i][rtype]) continue;
+ if (!parts[i]) {
+ // we're missing the required field. Add it now.
+
+ var newfield;
+ if (i == '_6') newfield = '006';
+ else if (i == '_7') newfield = '007';
+ else if (i == '_8') newfield = '008';
+ else continue;
+
+ createControlField(newfield,' ');
+ parts[i] = _record.controlfield.(@tag==newfield);
+ }
- var before = parts[i].substr(0, ff_pos[name][i][rtype].start);
- var after = parts[i].substr(ff_pos[name][i][rtype].start + ff_pos[name][i][rtype].len);
+ var before = parts[i].substr(0, ff_pos[name][i][rtype].start);
+ var after = parts[i].substr(ff_pos[name][i][rtype].start + ff_pos[name][i][rtype].len);
- for (var j = 0; new_value.length < ff_pos[name][i][rtype].len; j++) {
- new_value += ff_pos[name][i][rtype].def;
- }
+ for (var j = 0; new_value.length < ff_pos[name][i][rtype].len; j++) {
+ new_value += ff_pos[name][i][rtype].def;
+ }
- parts[i].setChildren( before + new_value + after );
- recGrid.getElementsByAttribute('tag',i)[0].lastChild.value = parts[i].toString();
- }
+ parts[i].setChildren( before + new_value + after );
+ recGrid.getElementsByAttribute('tag',i)[0].lastChild.value = parts[i].toString();
+ }
- return true;
+ return true;
}
function marcLeader (leader) {
- var row = createRow(
- { class : 'marcLeaderRow',
- tag : 'ldr' },
- createLabel(
- { value : 'LDR',
- class : 'marcTag',
- tooltiptext : $('catStrings').getString('staff.cat.marcedit.marcTag.LDR.label') } ),
- createLabel(
- { value : '',
- class : 'marcInd1' } ),
- createLabel(
- { value : '',
- class : 'marcInd2' } ),
- createLabel(
- { value : leader.text(),
- class : 'marcLeader' } )
- );
-
- return row;
+ var row = createRow(
+ { class : 'marcLeaderRow',
+ tag : 'ldr' },
+ createLabel(
+ { value : 'LDR',
+ class : 'marcTag',
+ tooltiptext : $('catStrings').getString('staff.cat.marcedit.marcTag.LDR.label') } ),
+ createLabel(
+ { value : '',
+ class : 'marcInd1' } ),
+ createLabel(
+ { value : '',
+ class : 'marcInd2' } ),
+ createLabel(
+ { value : leader.text(),
+ class : 'marcLeader' } )
+ );
+
+ return row;
}
function marcControlfield (field) {
- tagname = field.@tag.toString().substr(2);
- var row;
- if (tagname == '1' || tagname == '3' || tagname == '6' || tagname == '7' || tagname == '8') {
- row = createRow(
- { class : 'marcControlfieldRow',
- tag : '_' + tagname },
- createLabel(
- { value : field.@tag,
- class : 'marcTag',
- context : 'tags_popup',
- onmouseover : 'getTooltip(this, "tag");',
- tooltipid : 'tag' + field.@tag } ),
- createLabel(
- { value : field.@ind1,
- class : 'marcInd1',
- onmouseover : 'getTooltip(this, "ind1");',
- tooltipid : 'tag' + field.@tag + 'ind1val' + field.@ind1 } ),
- createLabel(
- { value : field.@ind2,
- class : 'marcInd2',
- onmouseover : 'getTooltip(this, "ind2");',
- tooltipid : 'tag' + field.@tag + 'ind2val' + field.@ind2 } ),
- createMARCTextbox(
- field,
- { value : field.text(),
- class : 'plain marcEditableControlfield',
- name : 'CONTROL' + tagname,
- context : 'clipboard',
- size : 50,
- maxlength : 50 } )
- );
- } else {
- row = createRow(
- { class : 'marcControlfieldRow',
- tag : '_' + tagname },
- createLabel(
- { value : field.@tag,
- class : 'marcTag',
- onmouseover : 'getTooltip(this, "tag");',
- tooltipid : 'tag' + field.@tag } ),
- createLabel(
- { value : field.@ind1,
- class : 'marcInd1',
- onmouseover : 'getTooltip(this, "ind1");',
- tooltipid : 'tag' + field.@tag + 'ind1val' + field.@ind1 } ),
- createLabel(
- { value : field.@ind2,
- class : 'marcInd2',
- onmouseover : 'getTooltip(this, "ind2");',
- tooltipid : 'tag' + field.@tag + 'ind2val' + field.@ind2 } ),
- createLabel(
- { value : field.text(),
- class : 'marcControlfield' } )
- );
- }
-
- return row;
+ tagname = field.@tag.toString().substr(2);
+ var row;
+ if (tagname == '1' || tagname == '3' || tagname == '6' || tagname == '7' || tagname == '8') {
+ row = createRow(
+ { class : 'marcControlfieldRow',
+ tag : '_' + tagname },
+ createLabel(
+ { value : field.@tag,
+ class : 'marcTag',
+ context : 'tags_popup',
+ onmouseover : 'getTooltip(this, "tag");',
+ tooltipid : 'tag' + field.@tag } ),
+ createLabel(
+ { value : field.@ind1,
+ class : 'marcInd1',
+ onmouseover : 'getTooltip(this, "ind1");',
+ tooltipid : 'tag' + field.@tag + 'ind1val' + field.@ind1 } ),
+ createLabel(
+ { value : field.@ind2,
+ class : 'marcInd2',
+ onmouseover : 'getTooltip(this, "ind2");',
+ tooltipid : 'tag' + field.@tag + 'ind2val' + field.@ind2 } ),
+ createMARCTextbox(
+ field,
+ { value : field.text(),
+ class : 'plain marcEditableControlfield',
+ name : 'CONTROL' + tagname,
+ context : 'clipboard',
+ size : 50,
+ maxlength : 50 } )
+ );
+ } else {
+ row = createRow(
+ { class : 'marcControlfieldRow',
+ tag : '_' + tagname },
+ createLabel(
+ { value : field.@tag,
+ class : 'marcTag',
+ onmouseover : 'getTooltip(this, "tag");',
+ tooltipid : 'tag' + field.@tag } ),
+ createLabel(
+ { value : field.@ind1,
+ class : 'marcInd1',
+ onmouseover : 'getTooltip(this, "ind1");',
+ tooltipid : 'tag' + field.@tag + 'ind1val' + field.@ind1 } ),
+ createLabel(
+ { value : field.@ind2,
+ class : 'marcInd2',
+ onmouseover : 'getTooltip(this, "ind2");',
+ tooltipid : 'tag' + field.@tag + 'ind2val' + field.@ind2 } ),
+ createLabel(
+ { value : field.text(),
+ class : 'marcControlfield' } )
+ );
+ }
+
+ return row;
}
function stackSubfields(checkbox) {
- var list = document.getElementsByAttribute('name','sf_box');
-
- var o = 'vertical';
- if (!checkbox.checked) o = 'horizontal';
-
- for (var i = 0; i < list.length; i++) {
- if (list[i]) list[i].setAttribute('orient',o);
- }
+ var list = document.getElementsByAttribute('name','sf_box');
+
+ var o = 'vertical';
+ if (!checkbox.checked) o = 'horizontal';
+
+ for (var i = 0; i < list.length; i++) {
+ if (list[i]) list[i].setAttribute('orient',o);
+ }
}
function fastItemAdd_toggle(checkbox) {
@@ -1324,769 +1324,769 @@ function save_attempt(xml_string) {
}
function marcDatafield (field) {
- var row = createRow(
- { class : 'marcDatafieldRow' },
- createMARCTextbox(
- field.@tag,
- { value : field.@tag,
- class : 'plain marcTag',
- name : 'marcTag',
- context : 'tags_popup',
- oninput : 'if (this.value.length == 3) { this.nextSibling.focus(); }',
- size : 3,
- maxlength : 3,
- onmouseover : 'current_focus = this; getTooltip(this, "tag");' } ),
- createMARCTextbox(
- field.@ind1,
- { value : field.@ind1,
- class : 'plain marcInd1',
- name : 'marcInd1',
- oninput : 'if (this.value.length == 1) { this.nextSibling.focus(); }',
- size : 1,
- maxlength : 1,
- onmouseover : 'current_focus = this; getContextMenu(this, "ind1"); getTooltip(this, "ind1");',
- oncontextmenu : 'getContextMenu(this, "ind1");' } ),
- createMARCTextbox(
- field.@ind2,
- { value : field.@ind2,
- class : 'plain marcInd2',
- name : 'marcInd2',
- oninput : 'if (this.value.length == 1) { this.nextSibling.firstChild.firstChild.focus(); }',
- size : 1,
- maxlength : 1,
- onmouseover : 'current_focus = this; getContextMenu(this, "ind2"); getTooltip(this, "ind2");',
- oncontextmenu : 'getContextMenu(this, "ind2");' } ),
- createHbox({ name : 'sf_box' })
- );
-
- if (!current_focus && field.@tag == '') current_focus = row.childNodes[0];
- if (!current_focus && field.@ind1 == '') current_focus = row.childNodes[1];
- if (!current_focus && field.@ind2 == '') current_focus = row.childNodes[2];
-
- var sf_box = row.lastChild;
- if (document.getElementById('stackSubfields').checked)
- sf_box.setAttribute('orient','vertical');
-
- sf_box.addEventListener(
- 'click',
- function (e) {
- if (sf_box === e.target) {
- sf_box.lastChild.lastChild.focus();
- } else if (e.target.parentNode === sf_box) {
- e.target.lastChild.focus();
- }
- },
- false
- );
-
-
- for (var i in field.subfield) {
- var sf = field.subfield[i];
- sf_box.appendChild(
- marcSubfield(sf)
- );
-
- if (sf.@code == '' && (!current_focus || current_focus.className.match(/Ind/)))
- current_focus = sf_box.lastChild.childNodes[1];
- }
-
- return row;
+ var row = createRow(
+ { class : 'marcDatafieldRow' },
+ createMARCTextbox(
+ field.@tag,
+ { value : field.@tag,
+ class : 'plain marcTag',
+ name : 'marcTag',
+ context : 'tags_popup',
+ oninput : 'if (this.value.length == 3) { this.nextSibling.focus(); }',
+ size : 3,
+ maxlength : 3,
+ onmouseover : 'current_focus = this; getTooltip(this, "tag");' } ),
+ createMARCTextbox(
+ field.@ind1,
+ { value : field.@ind1,
+ class : 'plain marcInd1',
+ name : 'marcInd1',
+ oninput : 'if (this.value.length == 1) { this.nextSibling.focus(); }',
+ size : 1,
+ maxlength : 1,
+ onmouseover : 'current_focus = this; getContextMenu(this, "ind1"); getTooltip(this, "ind1");',
+ oncontextmenu : 'getContextMenu(this, "ind1");' } ),
+ createMARCTextbox(
+ field.@ind2,
+ { value : field.@ind2,
+ class : 'plain marcInd2',
+ name : 'marcInd2',
+ oninput : 'if (this.value.length == 1) { this.nextSibling.firstChild.firstChild.focus(); }',
+ size : 1,
+ maxlength : 1,
+ onmouseover : 'current_focus = this; getContextMenu(this, "ind2"); getTooltip(this, "ind2");',
+ oncontextmenu : 'getContextMenu(this, "ind2");' } ),
+ createHbox({ name : 'sf_box' })
+ );
+
+ if (!current_focus && field.@tag == '') current_focus = row.childNodes[0];
+ if (!current_focus && field.@ind1 == '') current_focus = row.childNodes[1];
+ if (!current_focus && field.@ind2 == '') current_focus = row.childNodes[2];
+
+ var sf_box = row.lastChild;
+ if (document.getElementById('stackSubfields').checked)
+ sf_box.setAttribute('orient','vertical');
+
+ sf_box.addEventListener(
+ 'click',
+ function (e) {
+ if (sf_box === e.target) {
+ sf_box.lastChild.lastChild.focus();
+ } else if (e.target.parentNode === sf_box) {
+ e.target.lastChild.focus();
+ }
+ },
+ false
+ );
+
+
+ for (var i in field.subfield) {
+ var sf = field.subfield[i];
+ sf_box.appendChild(
+ marcSubfield(sf)
+ );
+
+ if (sf.@code == '' && (!current_focus || current_focus.className.match(/Ind/)))
+ current_focus = sf_box.lastChild.childNodes[1];
+ }
+
+ return row;
}
-function marcSubfield (sf) {
- return createHbox(
- { class : 'marcSubfieldBox' },
- createLabel(
- { value : "\u2021",
- class : 'plain marcSubfieldDelimiter',
- onmouseover : 'getTooltip(this.nextSibling, "subfield");',
- oncontextmenu : 'getContextMenu(this.nextSibling, "subfield");',
- //onclick : 'this.nextSibling.focus();',
- onfocus : 'this.nextSibling.focus();',
- size : 2 } ),
- createMARCTextbox(
- sf.@code,
- { value : sf.@code,
- class : 'plain marcSubfieldCode',
- name : 'marcSubfieldCode',
- onmouseover : 'current_focus = this; getContextMenu(this, "subfield"); getTooltip(this, "subfield");',
- oncontextmenu : 'getContextMenu(this, "subfield");',
- oninput : 'if (this.value.length == 1) { this.nextSibling.focus(); }',
- size : 2,
- maxlength : 1 } ),
- createMARCTextbox(
- sf,
- { value : sf.text(),
- name : sf.parent().@tag + ':' + sf.@code,
- class : 'plain marcSubfield',
- onmouseover : 'getTooltip(this, "subfield");',
- contextmenu : function (event) { getAuthorityContextMenu(event.target, sf) },
- size : new String(sf.text()).length + 2,
- oninput : "this.setAttribute('size', this.value.length + 2);"
- } )
- );
+function marcSubfield (sf) {
+ return createHbox(
+ { class : 'marcSubfieldBox' },
+ createLabel(
+ { value : "\u2021",
+ class : 'plain marcSubfieldDelimiter',
+ onmouseover : 'getTooltip(this.nextSibling, "subfield");',
+ oncontextmenu : 'getContextMenu(this.nextSibling, "subfield");',
+ //onclick : 'this.nextSibling.focus();',
+ onfocus : 'this.nextSibling.focus();',
+ size : 2 } ),
+ createMARCTextbox(
+ sf.@code,
+ { value : sf.@code,
+ class : 'plain marcSubfieldCode',
+ name : 'marcSubfieldCode',
+ onmouseover : 'current_focus = this; getContextMenu(this, "subfield"); getTooltip(this, "subfield");',
+ oncontextmenu : 'getContextMenu(this, "subfield");',
+ oninput : 'if (this.value.length == 1) { this.nextSibling.focus(); }',
+ size : 2,
+ maxlength : 1 } ),
+ createMARCTextbox(
+ sf,
+ { value : sf.text(),
+ name : sf.parent().@tag + ':' + sf.@code,
+ class : 'plain marcSubfield',
+ onmouseover : 'getTooltip(this, "subfield");',
+ contextmenu : function (event) { getAuthorityContextMenu(event.target, sf) },
+ size : new String(sf.text()).length + 2,
+ oninput : "this.setAttribute('size', this.value.length + 2);"
+ } )
+ );
}
function loadRecord(rec) {
- try {
- _record = rec;
- var grid_rows = document.getElementById('recGrid').lastChild;
+ try {
+ _record = rec;
+ var grid_rows = document.getElementById('recGrid').lastChild;
- while (grid_rows.firstChild) grid_rows.removeChild(grid_rows.firstChild);
+ while (grid_rows.firstChild) grid_rows.removeChild(grid_rows.firstChild);
- grid_rows.appendChild( marcLeader( rec.leader ) );
+ grid_rows.appendChild( marcLeader( rec.leader ) );
- for (var i in rec.controlfield) {
- grid_rows.appendChild( marcControlfield( rec.controlfield[i] ) );
- }
+ for (var i in rec.controlfield) {
+ grid_rows.appendChild( marcControlfield( rec.controlfield[i] ) );
+ }
- for (var i in rec.datafield) {
- grid_rows.appendChild( marcDatafield( rec.datafield[i] ) );
- }
+ for (var i in rec.datafield) {
+ grid_rows.appendChild( marcDatafield( rec.datafield[i] ) );
+ }
- grid_rows.getElementsByAttribute('class','marcDatafieldRow')[0].firstChild.focus();
- changeFFEditor(recordType(rec));
- fillFixedFields(rec);
- } catch(E) {
- alert('FIXME, MARC Editor, loadRecord: ' + E);
- }
+ grid_rows.getElementsByAttribute('class','marcDatafieldRow')[0].firstChild.focus();
+ changeFFEditor(recordType(rec));
+ fillFixedFields(rec);
+ } catch(E) {
+ alert('FIXME, MARC Editor, loadRecord: ' + E);
+ }
}
function genToolTips () {
- for (var i in bib_data.field) {
- var f = bib_data.field[i];
-
- tag_menu.appendChild(
- createMenuitem(
- { label : f.@tag,
- oncommand :
- 'current_focus.value = "' + f.@tag + '";' +
- 'var e = document.createEvent("MutationEvents");' +
- 'e.initMutationEvent("change",1,1,null,0,0,0,0);' +
- 'current_focus.inputField.dispatchEvent(e);',
- disabled : f.@tag < '010' ? "true" : "false",
- tooltiptext : f.description }
- )
- );
-
- var i1_popup = createPopup({position : 'after_start', id : 't' + f.@tag + 'i1' });
- context_menus.appendChild( i1_popup );
-
- var i2_popup = createPopup({position : 'after_start', id : 't' + f.@tag + 'i2' });
- context_menus.appendChild( i2_popup );
-
- var sf_popup = createPopup({position : 'after_start', id : 't' + f.@tag + 'sf' });
- context_menus.appendChild( sf_popup );
-
- tooltip_hash['tag' + f.@tag] = f.description;
- for (var j in f.indicator) {
- var ind = f.indicator[j];
- tooltip_hash['tag' + f.@tag + 'ind' + ind.@position + 'val' + ind.@value] = ind.description;
-
- if (ind.@position == 1) {
- i1_popup.appendChild(
- createMenuitem(
- { label : ind.@value,
- oncommand :
- 'current_focus.value = "' + ind.@value + '";' +
- 'var e = document.createEvent("MutationEvents");' +
- 'e.initMutationEvent("change",1,1,null,0,0,0,0);' +
- 'current_focus.inputField.dispatchEvent(e);',
- tooltiptext : ind.description }
- )
- );
- }
-
- if (ind.@position == 2) {
- i2_popup.appendChild(
- createMenuitem(
- { label : ind.@value,
- oncommand :
- 'current_focus.value = "' + ind.@value + '";' +
- 'var e = document.createEvent("MutationEvents");' +
- 'e.initMutationEvent("change",1,1,null,0,0,0,0);' +
- 'current_focus.inputField.dispatchEvent(e);',
- tooltiptext : ind.description }
- )
- );
- }
- }
-
- for (var j in f.subfield) {
- var sf = f.subfield[j];
- tooltip_hash['tag' + f.@tag + 'sf' + sf.@code] = sf.description;
-
- sf_popup.appendChild(
- createMenuitem(
- { label : sf.@code,
- oncommand :
- 'current_focus.value = "' + sf.@code + '";' +
- 'var e = document.createEvent("MutationEvents");' +
- 'e.initMutationEvent("change",1,1,null,0,0,0,0);' +
- 'current_focus.inputField.dispatchEvent(e);',
- tooltiptext : sf.description
- }
- )
- );
- }
- }
+ for (var i in bib_data.field) {
+ var f = bib_data.field[i];
+
+ tag_menu.appendChild(
+ createMenuitem(
+ { label : f.@tag,
+ oncommand :
+ 'current_focus.value = "' + f.@tag + '";' +
+ 'var e = document.createEvent("MutationEvents");' +
+ 'e.initMutationEvent("change",1,1,null,0,0,0,0);' +
+ 'current_focus.inputField.dispatchEvent(e);',
+ disabled : f.@tag < '010' ? "true" : "false",
+ tooltiptext : f.description }
+ )
+ );
+
+ var i1_popup = createPopup({position : 'after_start', id : 't' + f.@tag + 'i1' });
+ context_menus.appendChild( i1_popup );
+
+ var i2_popup = createPopup({position : 'after_start', id : 't' + f.@tag + 'i2' });
+ context_menus.appendChild( i2_popup );
+
+ var sf_popup = createPopup({position : 'after_start', id : 't' + f.@tag + 'sf' });
+ context_menus.appendChild( sf_popup );
+
+ tooltip_hash['tag' + f.@tag] = f.description;
+ for (var j in f.indicator) {
+ var ind = f.indicator[j];
+ tooltip_hash['tag' + f.@tag + 'ind' + ind.@position + 'val' + ind.@value] = ind.description;
+
+ if (ind.@position == 1) {
+ i1_popup.appendChild(
+ createMenuitem(
+ { label : ind.@value,
+ oncommand :
+ 'current_focus.value = "' + ind.@value + '";' +
+ 'var e = document.createEvent("MutationEvents");' +
+ 'e.initMutationEvent("change",1,1,null,0,0,0,0);' +
+ 'current_focus.inputField.dispatchEvent(e);',
+ tooltiptext : ind.description }
+ )
+ );
+ }
+
+ if (ind.@position == 2) {
+ i2_popup.appendChild(
+ createMenuitem(
+ { label : ind.@value,
+ oncommand :
+ 'current_focus.value = "' + ind.@value + '";' +
+ 'var e = document.createEvent("MutationEvents");' +
+ 'e.initMutationEvent("change",1,1,null,0,0,0,0);' +
+ 'current_focus.inputField.dispatchEvent(e);',
+ tooltiptext : ind.description }
+ )
+ );
+ }
+ }
+
+ for (var j in f.subfield) {
+ var sf = f.subfield[j];
+ tooltip_hash['tag' + f.@tag + 'sf' + sf.@code] = sf.description;
+
+ sf_popup.appendChild(
+ createMenuitem(
+ { label : sf.@code,
+ oncommand :
+ 'current_focus.value = "' + sf.@code + '";' +
+ 'var e = document.createEvent("MutationEvents");' +
+ 'e.initMutationEvent("change",1,1,null,0,0,0,0);' +
+ 'current_focus.inputField.dispatchEvent(e);',
+ tooltiptext : sf.description
+ }
+ )
+ );
+ }
+ }
}
function getTooltip (target, type) {
- var tt = '';
- if (type == 'subfield')
- tt = 'tag' + target.parentNode.parentNode.parentNode.firstChild.value + 'sf' + target.parentNode.childNodes[1].value;
-
- if (type == 'ind1')
- tt = 'tag' + target.parentNode.firstChild.value + 'ind1val' + target.value;
-
- if (type == 'ind2')
- tt = 'tag' + target.parentNode.firstChild.value + 'ind2val' + target.value;
-
- if (type == 'tag')
- tt = 'tag' + target.parentNode.firstChild.value;
-
- if (!document.getElementById( tt )) {
- p.appendChild(
- createTooltip(
- { id : tt,
- flex : "1",
- orient : 'vertical',
- onpopupshown : 'this.width = this.firstChild.boxObject.width + 10; this.height = this.firstChild.boxObject.height + 10;',
- class : 'tooltip' },
- createDescription({}, document.createTextNode( tooltip_hash[tt] ) )
- )
- );
- }
-
- target.tooltip = tt;
- return true;
+ var tt = '';
+ if (type == 'subfield')
+ tt = 'tag' + target.parentNode.parentNode.parentNode.firstChild.value + 'sf' + target.parentNode.childNodes[1].value;
+
+ if (type == 'ind1')
+ tt = 'tag' + target.parentNode.firstChild.value + 'ind1val' + target.value;
+
+ if (type == 'ind2')
+ tt = 'tag' + target.parentNode.firstChild.value + 'ind2val' + target.value;
+
+ if (type == 'tag')
+ tt = 'tag' + target.parentNode.firstChild.value;
+
+ if (!document.getElementById( tt )) {
+ p.appendChild(
+ createTooltip(
+ { id : tt,
+ flex : "1",
+ orient : 'vertical',
+ onpopupshown : 'this.width = this.firstChild.boxObject.width + 10; this.height = this.firstChild.boxObject.height + 10;',
+ class : 'tooltip' },
+ createDescription({}, document.createTextNode( tooltip_hash[tt] ) )
+ )
+ );
+ }
+
+ target.tooltip = tt;
+ return true;
}
function getContextMenu (target, type) {
- var tt = '';
- if (type == 'subfield')
- tt = 't' + target.parentNode.parentNode.parentNode.firstChild.value + 'sf';
+ var tt = '';
+ if (type == 'subfield')
+ tt = 't' + target.parentNode.parentNode.parentNode.firstChild.value + 'sf';
- if (type == 'ind1')
- tt = 't' + target.parentNode.firstChild.value + 'i1';
+ if (type == 'ind1')
+ tt = 't' + target.parentNode.firstChild.value + 'i1';
- if (type == 'ind2')
- tt = 't' + target.parentNode.firstChild.value + 'i2';
+ if (type == 'ind2')
+ tt = 't' + target.parentNode.firstChild.value + 'i2';
- target.setAttribute('context', tt);
- return true;
+ target.setAttribute('context', tt);
+ return true;
}
var authority_tag_map = {
- 100 : ['[100,400,500,700]',100],
- 400 : ['[100,400,500,700]',100],
- 700 : ['[100,400,500,700]',100],
- 800 : ['[100,400,500,700]',100],
- 110 : ['[110,410,510,710]',110],
- 410 : ['[110,410,510,710]',110],
- 710 : ['[110,410,510,710]',110],
- 810 : ['[110,410,510,710]',110],
- 111 : ['[111,411,511,711]',111],
- 411 : ['[111,411,511,711]',111],
- 711 : ['[111,411,511,711]',111],
- 811 : ['[111,411,511,711]',111],
- 240 : ['[130,430,530,730]',130],
- 440 : ['[130,430,530,730]',130],
- 130 : ['[130,430,530,730]',130],
- 730 : ['[130,430,530,730]',130],
- 830 : ['[130,430,530,730]',130],
- 600 : ['[100,400,480,481,482,485,500,580,581,582,585,700,780,781,782,785]',100],
- 650 : ['[150,450,480,481,482,485,550,580,581,582,585,750,780,781,782,785]',150],
- 651 : ['[151,451,480,481,482,485,551,580,581,582,585,751,780,781,782,785]',151],
- 655 : ['[155,455,480,481,482,485,555,580,581,582,585,755,780,781,782,785]',155]
+ 100 : ['[100,400,500,700]',100],
+ 400 : ['[100,400,500,700]',100],
+ 700 : ['[100,400,500,700]',100],
+ 800 : ['[100,400,500,700]',100],
+ 110 : ['[110,410,510,710]',110],
+ 410 : ['[110,410,510,710]',110],
+ 710 : ['[110,410,510,710]',110],
+ 810 : ['[110,410,510,710]',110],
+ 111 : ['[111,411,511,711]',111],
+ 411 : ['[111,411,511,711]',111],
+ 711 : ['[111,411,511,711]',111],
+ 811 : ['[111,411,511,711]',111],
+ 240 : ['[130,430,530,730]',130],
+ 440 : ['[130,430,530,730]',130],
+ 130 : ['[130,430,530,730]',130],
+ 730 : ['[130,430,530,730]',130],
+ 830 : ['[130,430,530,730]',130],
+ 600 : ['[100,400,480,481,482,485,500,580,581,582,585,700,780,781,782,785]',100],
+ 650 : ['[150,450,480,481,482,485,550,580,581,582,585,750,780,781,782,785]',150],
+ 651 : ['[151,451,480,481,482,485,551,580,581,582,585,751,780,781,782,785]',151],
+ 655 : ['[155,455,480,481,482,485,555,580,581,582,585,755,780,781,782,785]',155]
};
function getAuthorityContextMenu (target, sf) {
- var menu_id = sf.parent().@tag + ':' + sf.@code + '-authority-context-' + sf;
+ var menu_id = sf.parent().@tag + ':' + sf.@code + '-authority-context-' + sf;
- var old = document.getElementById( menu_id );
- if (old) old.parentNode.removeChild(old);
+ var old = document.getElementById( menu_id );
+ if (old) old.parentNode.removeChild(old);
- var sf_popup = createPopup({ id : menu_id, flex : 1 });
- context_menus.appendChild( sf_popup );
+ var sf_popup = createPopup({ id : menu_id, flex : 1 });
+ context_menus.appendChild( sf_popup );
- if (!authority_tag_map[sf.parent().@tag]) {
- sf_popup.appendChild(createLabel( { value : $('catStrings').getString('staff.cat.marcedit.not_authority_field.label') } ) );
- target.setAttribute('context', 'clipboard');
- return false;
- }
-
- var auth_data = searchAuthority( sf, authority_tag_map[sf.parent().@tag][0], sf.@code, 50);
-
- var res = new XML( auth_data.responseText );
+ if (!authority_tag_map[sf.parent().@tag]) {
+ sf_popup.appendChild(createLabel( { value : $('catStrings').getString('staff.cat.marcedit.not_authority_field.label') } ) );
+ target.setAttribute('context', 'clipboard');
+ return false;
+ }
- var rec_list = [];
+ var auth_data = searchAuthority( sf, authority_tag_map[sf.parent().@tag][0], sf.@code, 50);
- var recs = res.gw::payload.gw::array.gw::string;
- for (var i in recs) {
- var x = recs[i];
- var xml = new XML(x.toString());
- var main = xml.datafield.(@tag.toString().match(/^1/)).subfield;
+ var res = new XML( auth_data.responseText );
- if (! (main[0].parent().@tag == authority_tag_map[sf.parent().@tag][1]) ) continue;
+ var rec_list = [];
- var main_text = '';
- for (var i in main) {
- if (main_text) main_text += ' / ';
- main_text += main[i];
- }
+ var recs = res.gw::payload.gw::array.gw::string;
+ for (var i in recs) {
+ var x = recs[i];
+ var xml = new XML(x.toString());
+ var main = xml.datafield.(@tag.toString().match(/^1/)).subfield;
- rec_list.push( [ main_text, xml ] );
- }
-
- for (var i in rec_list.sort( function (a, b) { if(a[0] > b[0]) return 1; return -1; } )) {
+ if (! (main[0].parent().@tag == authority_tag_map[sf.parent().@tag][1]) ) continue;
- var main_text = rec_list[i][0];
- var xml = rec_list[i][1];
- var main = xml.datafield.(@tag.toString().match(/^1/)).subfield;
+ var main_text = '';
+ for (var i in main) {
+ if (main_text) main_text += ' / ';
+ main_text += main[i];
+ }
- if (! (main[0].parent().@tag == authority_tag_map[sf.parent().@tag][1]) ) continue;
+ rec_list.push( [ main_text, xml ] );
+ }
+
+ for (var i in rec_list.sort( function (a, b) { if(a[0] > b[0]) return 1; return -1; } )) {
- var grid = document.getElementsByAttribute('name','authority-marc-template')[0].cloneNode(true);
- grid.setAttribute('name','-none-');
- grid.setAttribute('style','overflow:scroll');
+ var main_text = rec_list[i][0];
+ var xml = rec_list[i][1];
+ var main = xml.datafield.(@tag.toString().match(/^1/)).subfield;
+ if (! (main[0].parent().@tag == authority_tag_map[sf.parent().@tag][1]) ) continue;
- var submenu = createMenu( { label : main_text } );
+ var grid = document.getElementsByAttribute('name','authority-marc-template')[0].cloneNode(true);
+ grid.setAttribute('name','-none-');
+ grid.setAttribute('style','overflow:scroll');
- var popup = createMenuPopup({ flex : "1" });
- submenu.appendChild(popup);
- var fields = xml.datafield;
- for (var j in fields) {
+ var submenu = createMenu( { label : main_text } );
- var row = createRow(
- {},
- createLabel( { value : fields[j].@tag } ),
- createLabel( { value : fields[j].@ind1 } ),
- createLabel( { value : fields[j].@ind2 } )
- );
+ var popup = createMenuPopup({ flex : "1" });
+ submenu.appendChild(popup);
- var sf_box = createHbox();
+ var fields = xml.datafield;
+ for (var j in fields) {
- var subfields = fields[j].subfield;
- for (var k in subfields) {
- sf_box.appendChild(
- createCheckbox(
- { label : '\u2021' + subfields[k].@code + ' ' + subfields[k],
- subfield : subfields[k].@code,
- tag : subfields[k].parent().@tag,
- value : subfields[k]
- }
- )
- );
- row.appendChild(sf_box);
- }
+ var row = createRow(
+ {},
+ createLabel( { value : fields[j].@tag } ),
+ createLabel( { value : fields[j].@ind1 } ),
+ createLabel( { value : fields[j].@ind2 } )
+ );
- grid.lastChild.appendChild(row);
- }
+ var sf_box = createHbox();
- grid.hidden = false;
- popup.appendChild( grid );
+ var subfields = fields[j].subfield;
+ for (var k in subfields) {
+ sf_box.appendChild(
+ createCheckbox(
+ { label : '\u2021' + subfields[k].@code + ' ' + subfields[k],
+ subfield : subfields[k].@code,
+ tag : subfields[k].parent().@tag,
+ value : subfields[k]
+ }
+ )
+ );
+ row.appendChild(sf_box);
+ }
- popup.appendChild(
- createMenuitem(
- { label : $('catStrings').getString('staff.cat.marcedit.apply_selected.label'),
- command : function (event) {
- applyAuthority(event.target.previousSibling, target, sf);
- return true;
- }
- }
- )
- );
+ grid.lastChild.appendChild(row);
+ }
- sf_popup.appendChild( submenu );
- }
+ grid.hidden = false;
+ popup.appendChild( grid );
+
+ popup.appendChild(
+ createMenuitem(
+ { label : $('catStrings').getString('staff.cat.marcedit.apply_selected.label'),
+ command : function (event) {
+ applyAuthority(event.target.previousSibling, target, sf);
+ return true;
+ }
+ }
+ )
+ );
+
+ sf_popup.appendChild( submenu );
+ }
- if (sf_popup.childNodes.length == 0)
- sf_popup.appendChild(createLabel( { value : $('catStrings').getString('staff.cat.marcedit.no_authority_match.label') } ) );
+ if (sf_popup.childNodes.length == 0)
+ sf_popup.appendChild(createLabel( { value : $('catStrings').getString('staff.cat.marcedit.no_authority_match.label') } ) );
- target.setAttribute('context', menu_id);
- return true;
+ target.setAttribute('context', menu_id);
+ return true;
}
function applyAuthority ( target, ui_sf, e4x_sf ) {
- var new_vals = target.getElementsByAttribute('checked','true');
- var field = e4x_sf.parent();
+ var new_vals = target.getElementsByAttribute('checked','true');
+ var field = e4x_sf.parent();
- for (var i = 0; i < new_vals.length; i++) {
+ for (var i = 0; i < new_vals.length; i++) {
- var sf_list = field.subfield;
- for (var j in sf_list) {
+ var sf_list = field.subfield;
+ for (var j in sf_list) {
- if (sf_list[j].@code == new_vals[i].getAttribute('subfield')) {
- sf_list[j] = new_vals[i].getAttribute('value');
- new_vals[i].setAttribute('subfield','');
- break;
- }
- }
- }
+ if (sf_list[j].@code == new_vals[i].getAttribute('subfield')) {
+ sf_list[j] = new_vals[i].getAttribute('value');
+ new_vals[i].setAttribute('subfield','');
+ break;
+ }
+ }
+ }
- for (var i = 0; i < new_vals.length; i++) {
- if (!new_vals[i].getAttribute('subfield')) continue;
+ for (var i = 0; i < new_vals.length; i++) {
+ if (!new_vals[i].getAttribute('subfield')) continue;
- var val = new_vals[i].getAttribute('value');
+ var val = new_vals[i].getAttribute('value');
- var sf = {val} ;
- sf.@code = new_vals[i].getAttribute('subfield');
+ var sf = {val} ;
+ sf.@code = new_vals[i].getAttribute('subfield');
- field.insertChildAfter(field.subfield[field.subfield.length() - 1], sf);
- }
+ field.insertChildAfter(field.subfield[field.subfield.length() - 1], sf);
+ }
- var row = marcDatafield( field );
+ var row = marcDatafield( field );
- var node = ui_sf;
- while (node.nodeName != 'row') {
- node = node.parentNode;
- }
+ var node = ui_sf;
+ while (node.nodeName != 'row') {
+ node = node.parentNode;
+ }
- node.parentNode.replaceChild( row, node );
- return true;
+ node.parentNode.replaceChild( row, node );
+ return true;
}
var control_map = {
- 100 : {
- 'a' : { 100 : 'a' },
- 'd' : { 100 : 'd' },
- 'q' : { 100 : 'q' }
- },
- 110 : {
- 'a' : { 110 : 'a' },
- 'd' : { 110 : 'd' }
- },
- 111 : {
- 'a' : { 111 : 'a' },
- 'd' : { 111 : 'd' }
- },
- 130 : {
- 'a' : { 130 : 'a' },
- 'd' : { 130 : 'd' }
- },
- 240 : {
- 'a' : { 130 : 'a' },
- 'd' : { 130 : 'd' }
- },
- 400 : {
- 'a' : { 100 : 'a' },
- 'd' : { 100 : 'd' }
- },
- 410 : {
- 'a' : { 110 : 'a' },
- 'd' : { 110 : 'd' }
- },
- 411 : {
- 'a' : { 111 : 'a' },
- 'd' : { 111 : 'd' }
- },
- 440 : {
- 'a' : { 130 : 'a' },
- 'n' : { 130 : 'n' },
- 'p' : { 130 : 'p' }
- },
- 700 : {
- 'a' : { 100 : 'a' },
- 'd' : { 100 : 'd' },
- 'q' : { 100 : 'q' },
- 't' : { 100 : 't' }
- },
- 710 : {
- 'a' : { 110 : 'a' },
- 'd' : { 110 : 'd' }
- },
- 711 : {
- 'a' : { 111 : 'a' },
- 'd' : { 111 : 'd' }
- },
- 730 : {
- 'a' : { 130 : 'a' },
- 'd' : { 130 : 'd' }
- },
- 800 : {
- 'a' : { 100 : 'a' },
- 'd' : { 100 : 'd' }
- },
- 810 : {
- 'a' : { 110 : 'a' },
- 'd' : { 110 : 'd' }
- },
- 811 : {
- 'a' : { 111 : 'a' },
- 'd' : { 111 : 'd' }
- },
- 830 : {
- 'a' : { 130 : 'a' },
- 'd' : { 130 : 'd' }
- },
- 600 : {
- 'a' : { 100 : 'a' },
- 'd' : { 100 : 'd' },
- 'q' : { 100 : 'q' },
- 't' : { 100 : 't' },
- 'v' : { 180 : 'v',
- 100 : 'v',
- 181 : 'v',
- 182 : 'v',
- 185 : 'v'
- },
- 'x' : { 180 : 'x',
- 100 : 'x',
- 181 : 'x',
- 182 : 'x',
- 185 : 'x'
- },
- 'y' : { 180 : 'y',
- 100 : 'y',
- 181 : 'y',
- 182 : 'y',
- 185 : 'y'
- },
- 'z' : { 180 : 'z',
- 100 : 'z',
- 181 : 'z',
- 182 : 'z',
- 185 : 'z'
- }
- },
- 610 : {
- 'a' : { 110 : 'a' },
- 'd' : { 110 : 'd' },
- 't' : { 110 : 't' },
- 'v' : { 180 : 'v',
- 110 : 'v',
- 181 : 'v',
- 182 : 'v',
- 185 : 'v'
- },
- 'x' : { 180 : 'x',
- 110 : 'x',
- 181 : 'x',
- 182 : 'x',
- 185 : 'x'
- },
- 'y' : { 180 : 'y',
- 110 : 'y',
- 181 : 'y',
- 182 : 'y',
- 185 : 'y'
- },
- 'z' : { 180 : 'z',
- 110 : 'z',
- 181 : 'z',
- 182 : 'z',
- 185 : 'z'
- }
- },
- 611 : {
- 'a' : { 111 : 'a' },
- 'd' : { 111 : 'd' },
- 't' : { 111 : 't' },
- 'v' : { 180 : 'v',
- 111 : 'v',
- 181 : 'v',
- 182 : 'v',
- 185 : 'v'
- },
- 'x' : { 180 : 'x',
- 111 : 'x',
- 181 : 'x',
- 182 : 'x',
- 185 : 'x'
- },
- 'y' : { 180 : 'y',
- 111 : 'y',
- 181 : 'y',
- 182 : 'y',
- 185 : 'y'
- },
- 'z' : { 180 : 'z',
- 111 : 'z',
- 181 : 'z',
- 182 : 'z',
- 185 : 'z'
- }
- },
- 630 : {
- 'a' : { 130 : 'a' },
- 'd' : { 130 : 'd' }
- },
- 650 : {
- 'a' : { 150 : 'a' },
- 'b' : { 150 : 'b' },
- 'v' : { 180 : 'v',
- 150 : 'v',
- 181 : 'v',
- 182 : 'v',
- 185 : 'v'
- },
- 'x' : { 180 : 'x',
- 150 : 'x',
- 181 : 'x',
- 182 : 'x',
- 185 : 'x'
- },
- 'y' : { 180 : 'y',
- 150 : 'y',
- 181 : 'y',
- 182 : 'y',
- 185 : 'y'
- },
- 'z' : { 180 : 'z',
- 150 : 'z',
- 181 : 'z',
- 182 : 'z',
- 185 : 'z'
- }
- },
- 651 : {
- 'a' : { 151 : 'a' },
- 'v' : { 180 : 'v',
- 151 : 'v',
- 181 : 'v',
- 182 : 'v',
- 185 : 'v'
- },
- 'x' : { 180 : 'x',
- 151 : 'x',
- 181 : 'x',
- 182 : 'x',
- 185 : 'x'
- },
- 'y' : { 180 : 'y',
- 151 : 'y',
- 181 : 'y',
- 182 : 'y',
- 185 : 'y'
- },
- 'z' : { 180 : 'z',
- 151 : 'z',
- 181 : 'z',
- 182 : 'z',
- 185 : 'z'
- }
- },
- 655 : {
- 'a' : { 155 : 'a' },
- 'v' : { 180 : 'v',
- 155 : 'v',
- 181 : 'v',
- 182 : 'v',
- 185 : 'v'
- },
- 'x' : { 180 : 'x',
- 155 : 'x',
- 181 : 'x',
- 182 : 'x',
- 185 : 'x'
- },
- 'y' : { 180 : 'y',
- 155 : 'y',
- 181 : 'y',
- 182 : 'y',
- 185 : 'y'
- },
- 'z' : { 180 : 'z',
- 155 : 'z',
- 181 : 'z',
- 182 : 'z',
- 185 : 'z'
- }
- }
+ 100 : {
+ 'a' : { 100 : 'a' },
+ 'd' : { 100 : 'd' },
+ 'q' : { 100 : 'q' }
+ },
+ 110 : {
+ 'a' : { 110 : 'a' },
+ 'd' : { 110 : 'd' }
+ },
+ 111 : {
+ 'a' : { 111 : 'a' },
+ 'd' : { 111 : 'd' }
+ },
+ 130 : {
+ 'a' : { 130 : 'a' },
+ 'd' : { 130 : 'd' }
+ },
+ 240 : {
+ 'a' : { 130 : 'a' },
+ 'd' : { 130 : 'd' }
+ },
+ 400 : {
+ 'a' : { 100 : 'a' },
+ 'd' : { 100 : 'd' }
+ },
+ 410 : {
+ 'a' : { 110 : 'a' },
+ 'd' : { 110 : 'd' }
+ },
+ 411 : {
+ 'a' : { 111 : 'a' },
+ 'd' : { 111 : 'd' }
+ },
+ 440 : {
+ 'a' : { 130 : 'a' },
+ 'n' : { 130 : 'n' },
+ 'p' : { 130 : 'p' }
+ },
+ 700 : {
+ 'a' : { 100 : 'a' },
+ 'd' : { 100 : 'd' },
+ 'q' : { 100 : 'q' },
+ 't' : { 100 : 't' }
+ },
+ 710 : {
+ 'a' : { 110 : 'a' },
+ 'd' : { 110 : 'd' }
+ },
+ 711 : {
+ 'a' : { 111 : 'a' },
+ 'd' : { 111 : 'd' }
+ },
+ 730 : {
+ 'a' : { 130 : 'a' },
+ 'd' : { 130 : 'd' }
+ },
+ 800 : {
+ 'a' : { 100 : 'a' },
+ 'd' : { 100 : 'd' }
+ },
+ 810 : {
+ 'a' : { 110 : 'a' },
+ 'd' : { 110 : 'd' }
+ },
+ 811 : {
+ 'a' : { 111 : 'a' },
+ 'd' : { 111 : 'd' }
+ },
+ 830 : {
+ 'a' : { 130 : 'a' },
+ 'd' : { 130 : 'd' }
+ },
+ 600 : {
+ 'a' : { 100 : 'a' },
+ 'd' : { 100 : 'd' },
+ 'q' : { 100 : 'q' },
+ 't' : { 100 : 't' },
+ 'v' : { 180 : 'v',
+ 100 : 'v',
+ 181 : 'v',
+ 182 : 'v',
+ 185 : 'v'
+ },
+ 'x' : { 180 : 'x',
+ 100 : 'x',
+ 181 : 'x',
+ 182 : 'x',
+ 185 : 'x'
+ },
+ 'y' : { 180 : 'y',
+ 100 : 'y',
+ 181 : 'y',
+ 182 : 'y',
+ 185 : 'y'
+ },
+ 'z' : { 180 : 'z',
+ 100 : 'z',
+ 181 : 'z',
+ 182 : 'z',
+ 185 : 'z'
+ }
+ },
+ 610 : {
+ 'a' : { 110 : 'a' },
+ 'd' : { 110 : 'd' },
+ 't' : { 110 : 't' },
+ 'v' : { 180 : 'v',
+ 110 : 'v',
+ 181 : 'v',
+ 182 : 'v',
+ 185 : 'v'
+ },
+ 'x' : { 180 : 'x',
+ 110 : 'x',
+ 181 : 'x',
+ 182 : 'x',
+ 185 : 'x'
+ },
+ 'y' : { 180 : 'y',
+ 110 : 'y',
+ 181 : 'y',
+ 182 : 'y',
+ 185 : 'y'
+ },
+ 'z' : { 180 : 'z',
+ 110 : 'z',
+ 181 : 'z',
+ 182 : 'z',
+ 185 : 'z'
+ }
+ },
+ 611 : {
+ 'a' : { 111 : 'a' },
+ 'd' : { 111 : 'd' },
+ 't' : { 111 : 't' },
+ 'v' : { 180 : 'v',
+ 111 : 'v',
+ 181 : 'v',
+ 182 : 'v',
+ 185 : 'v'
+ },
+ 'x' : { 180 : 'x',
+ 111 : 'x',
+ 181 : 'x',
+ 182 : 'x',
+ 185 : 'x'
+ },
+ 'y' : { 180 : 'y',
+ 111 : 'y',
+ 181 : 'y',
+ 182 : 'y',
+ 185 : 'y'
+ },
+ 'z' : { 180 : 'z',
+ 111 : 'z',
+ 181 : 'z',
+ 182 : 'z',
+ 185 : 'z'
+ }
+ },
+ 630 : {
+ 'a' : { 130 : 'a' },
+ 'd' : { 130 : 'd' }
+ },
+ 650 : {
+ 'a' : { 150 : 'a' },
+ 'b' : { 150 : 'b' },
+ 'v' : { 180 : 'v',
+ 150 : 'v',
+ 181 : 'v',
+ 182 : 'v',
+ 185 : 'v'
+ },
+ 'x' : { 180 : 'x',
+ 150 : 'x',
+ 181 : 'x',
+ 182 : 'x',
+ 185 : 'x'
+ },
+ 'y' : { 180 : 'y',
+ 150 : 'y',
+ 181 : 'y',
+ 182 : 'y',
+ 185 : 'y'
+ },
+ 'z' : { 180 : 'z',
+ 150 : 'z',
+ 181 : 'z',
+ 182 : 'z',
+ 185 : 'z'
+ }
+ },
+ 651 : {
+ 'a' : { 151 : 'a' },
+ 'v' : { 180 : 'v',
+ 151 : 'v',
+ 181 : 'v',
+ 182 : 'v',
+ 185 : 'v'
+ },
+ 'x' : { 180 : 'x',
+ 151 : 'x',
+ 181 : 'x',
+ 182 : 'x',
+ 185 : 'x'
+ },
+ 'y' : { 180 : 'y',
+ 151 : 'y',
+ 181 : 'y',
+ 182 : 'y',
+ 185 : 'y'
+ },
+ 'z' : { 180 : 'z',
+ 151 : 'z',
+ 181 : 'z',
+ 182 : 'z',
+ 185 : 'z'
+ }
+ },
+ 655 : {
+ 'a' : { 155 : 'a' },
+ 'v' : { 180 : 'v',
+ 155 : 'v',
+ 181 : 'v',
+ 182 : 'v',
+ 185 : 'v'
+ },
+ 'x' : { 180 : 'x',
+ 155 : 'x',
+ 181 : 'x',
+ 182 : 'x',
+ 185 : 'x'
+ },
+ 'y' : { 180 : 'y',
+ 155 : 'y',
+ 181 : 'y',
+ 182 : 'y',
+ 185 : 'y'
+ },
+ 'z' : { 180 : 'z',
+ 155 : 'z',
+ 181 : 'z',
+ 182 : 'z',
+ 185 : 'z'
+ }
+ }
};
function validateAuthority (button) {
- var grid = document.getElementById('recGrid');
- var label = button.getAttribute('label');
+ var grid = document.getElementById('recGrid');
+ var label = button.getAttribute('label');
- //loop over rows
- var rows = grid.lastChild.childNodes;
- for (var i = 0; i < rows.length; i++) {
- var row = rows[i];
- var tag = row.firstChild;
+ //loop over rows
+ var rows = grid.lastChild.childNodes;
+ for (var i = 0; i < rows.length; i++) {
+ var row = rows[i];
+ var tag = row.firstChild;
- if (!control_map[tag.value]) continue
- button.setAttribute('label', label + ' - ' + tag.value);
+ if (!control_map[tag.value]) continue
+ button.setAttribute('label', label + ' - ' + tag.value);
- var ind1 = tag.nextSibling;
- var ind2 = ind1.nextSibling;
- var subfields = ind2.nextSibling.childNodes;
+ var ind1 = tag.nextSibling;
+ var ind2 = ind1.nextSibling;
+ var subfields = ind2.nextSibling.childNodes;
var tags = {};
- for (var j = 0; j < subfields.length; j++) {
- var sf = subfields[j];
+ for (var j = 0; j < subfields.length; j++) {
+ var sf = subfields[j];
var sf_code = sf.childNodes[1].value;
var sf_value = sf.childNodes[2].value;
- if (!control_map[tag.value][sf_code]) continue;
+ if (!control_map[tag.value][sf_code]) continue;
- var found = 0;
- for (var a_tag in control_map[tag.value][sf_code]) {
+ var found = 0;
+ for (var a_tag in control_map[tag.value][sf_code]) {
if (!tags[a_tag]) tags[a_tag] = [];
tags[a_tag].push({ term : sf_value, subfield : sf_code });
- }
+ }
- }
+ }
for (var val_tag in tags) {
- var auth_data = validateBibField( [val_tag], tags[val_tag]);
- var res = new XML( auth_data.responseText );
- found = parseInt(res.gw::payload.gw::string.toString());
+ var auth_data = validateBibField( [val_tag], tags[val_tag]);
+ var res = new XML( auth_data.responseText );
+ found = parseInt(res.gw::payload.gw::string.toString());
if (found) break;
}
- // XXX If adt, etc should be validated separately from vxz, etc then move this up into the above for loop
- for (var j = 0; j < subfields.length; j++) {
- var sf = subfields[j];
- if (!found) {
- sf.childNodes[2].inputField.style.color = 'red';
- } else {
- sf.childNodes[2].inputField.style.color = 'black';
- }
+ // XXX If adt, etc should be validated separately from vxz, etc then move this up into the above for loop
+ for (var j = 0; j < subfields.length; j++) {
+ var sf = subfields[j];
+ if (!found) {
+ sf.childNodes[2].inputField.style.color = 'red';
+ } else {
+ sf.childNodes[2].inputField.style.color = 'black';
+ }
}
- }
+ }
- button.setAttribute('label', label);
+ button.setAttribute('label', label);
- return true;
+ return true;
}
function validateBibField (tags, searches) {
- var url = "/gateway?input_format=json&format=xml&service=open-ils.search&method=open-ils.search.authority.validate.tag";
- url += '¶m="tags"¶m=' + js2JSON(tags);
- url += '¶m="searches"¶m=' + js2JSON(searches);
+ var url = "/gateway?input_format=json&format=xml&service=open-ils.search&method=open-ils.search.authority.validate.tag";
+ url += '¶m="tags"¶m=' + js2JSON(tags);
+ url += '¶m="searches"¶m=' + js2JSON(searches);
- var req = new XMLHttpRequest();
- req.open('GET',url,false);
- req.send(null);
+ var req = new XMLHttpRequest();
+ req.open('GET',url,false);
+ req.send(null);
- return req;
+ return req;
}
function searchAuthority (term, tag, sf, limit) {
- var url = "/gateway?input_format=json&format=xml&service=open-ils.search&method=open-ils.search.authority.fts";
- url += '¶m="term"¶m="' + term + '"';
- url += '¶m="limit"¶m=' + limit;
- url += '¶m="tag"¶m=' + tag;
- url += '¶m="subfield"¶m="' + sf + '"';
+ var url = "/gateway?input_format=json&format=xml&service=open-ils.search&method=open-ils.search.authority.fts";
+ url += '¶m="term"¶m="' + term + '"';
+ url += '¶m="limit"¶m=' + limit;
+ url += '¶m="tag"¶m=' + tag;
+ url += '¶m="subfield"¶m="' + sf + '"';
- var req = new XMLHttpRequest();
- req.open('GET',url,false);
- req.send(null);
+ var req = new XMLHttpRequest();
+ req.open('GET',url,false);
+ req.send(null);
- return req;
+ return req;
}
diff --git a/Open-ILS/xul/staff_client/server/cat/record_buckets.js b/Open-ILS/xul/staff_client/server/cat/record_buckets.js
index f105c3ca1f..21abc2aaef 100644
--- a/Open-ILS/xul/staff_client/server/cat/record_buckets.js
+++ b/Open-ILS/xul/staff_client/server/cat/record_buckets.js
@@ -5,10 +5,10 @@ function $(id) { return document.getElementById(id); }
if (typeof cat == 'undefined') cat = {};
cat.record_buckets = function (params) {
- JSAN.use('util.error'); this.error = new util.error();
- JSAN.use('util.network'); this.network = new util.network();
- JSAN.use('util.date');
- JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
+ JSAN.use('util.error'); this.error = new util.error();
+ JSAN.use('util.network'); this.network = new util.network();
+ JSAN.use('util.date');
+ JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
var x = document.getElementById("record_buckets_tabbox");
if (x) {
x.addEventListener(
@@ -32,102 +32,102 @@ cat.record_buckets = function (params) {
};
cat.record_buckets.pick_file = function (defaultFileName) {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- var nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance( nsIFilePicker );
+ var nsIFilePicker = Components.interfaces.nsIFilePicker;
+ var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance( nsIFilePicker );
- fp.init( window, $("catStrings").getString('staff.cat.record_buckets.save_file_as'), nsIFilePicker.modeSave );
- if (defaultFileName)
- fp.defaultString = defaultFileName;
+ fp.init( window, $("catStrings").getString('staff.cat.record_buckets.save_file_as'), nsIFilePicker.modeSave );
+ if (defaultFileName)
+ fp.defaultString = defaultFileName;
- fp.appendFilters( nsIFilePicker.filterAll );
+ fp.appendFilters( nsIFilePicker.filterAll );
- var result = fp.show();
- if ( (result == nsIFilePicker.returnOK || result == nsIFilePicker.returnReplace) && fp.file ) {
- return fp.file;
- } else {
- return null;
- }
+ var result = fp.show();
+ if ( (result == nsIFilePicker.returnOK || result == nsIFilePicker.returnReplace) && fp.file ) {
+ return fp.file;
+ } else {
+ return null;
+ }
};
cat.record_buckets.export_records = function(obj, output_type) {
- try {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.list2.select_all();
- obj.data.stash_retrieve();
- JSAN.use('util.functional');
-
- var record_ids = util.functional.map_list(
- obj.list2.dump_retrieve_ids(),
- function (o) { return JSON2js(o).docid }
- );
-
- var persist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
- .createInstance(Components.interfaces.nsIWebBrowserPersist);
-
- var proto_uri = 'https://' + window.location.hostname + '/exporter?format=' + output_type + '&ses=' + ses();
-
- dump('Record Export URI is ' + proto_uri + '&id=' + record_ids.join('&id=') + '\n');
-
- var uri = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService)
- .newURI( proto_uri + '&id=' + record_ids.join('&id='), null, null );
-
- var file = cat.record_buckets.pick_file('bucket.' + output_type);
-
- if (file) {
- persist.saveURI(uri,null,null,null,null,file);
- } else {
- alert( $("catStrings").getString('staff.cat.record_buckets.export_records.alert') );
- }
-
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.record_buckets.export_records.std_unexpected_error'), E);
- }
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ obj.list2.select_all();
+ obj.data.stash_retrieve();
+ JSAN.use('util.functional');
+
+ var record_ids = util.functional.map_list(
+ obj.list2.dump_retrieve_ids(),
+ function (o) { return JSON2js(o).docid }
+ );
+
+ var persist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
+ .createInstance(Components.interfaces.nsIWebBrowserPersist);
+
+ var proto_uri = 'https://' + window.location.hostname + '/exporter?format=' + output_type + '&ses=' + ses();
+
+ dump('Record Export URI is ' + proto_uri + '&id=' + record_ids.join('&id=') + '\n');
+
+ var uri = Components.classes["@mozilla.org/network/io-service;1"]
+ .getService(Components.interfaces.nsIIOService)
+ .newURI( proto_uri + '&id=' + record_ids.join('&id='), null, null );
+
+ var file = cat.record_buckets.pick_file('bucket.' + output_type);
+
+ if (file) {
+ persist.saveURI(uri,null,null,null,null,file);
+ } else {
+ alert( $("catStrings").getString('staff.cat.record_buckets.export_records.alert') );
+ }
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.record_buckets.export_records.std_unexpected_error'), E);
+ }
};
cat.record_buckets.prototype = {
- 'selection_list0' : [],
- 'selection_list1' : [],
- 'selection_list2' : [],
- 'bucket_id_name_map' : {},
-
- 'render_pending_records' : function() {
- var obj = this;
- obj.list1.clear();
- for (var i = 0; i < obj.record_ids.length; i++) {
- var item = obj.prep_record_for_list( obj.record_ids[i] );
- if (item) obj.list1.append( item );
- }
- },
-
- 'init' : function( params ) {
-
- var obj = this;
-
- obj.record_ids = params['record_ids'] || [];
-
- JSAN.use('circ.util');
- var columns = circ.util.columns(
- {
- 'title' : { 'hidden' : false },
- 'author' : { 'hidden' : false },
- 'edition' : { 'hidden' : false },
- 'publisher' : { 'hidden' : false },
- 'pubdate' : { 'hidden' : false },
- 'isbn' : { 'hidden' : false },
- 'tcn' : { 'hidden' : false }
- }
- );
-
- JSAN.use('util.list');
+ 'selection_list0' : [],
+ 'selection_list1' : [],
+ 'selection_list2' : [],
+ 'bucket_id_name_map' : {},
+
+ 'render_pending_records' : function() {
+ var obj = this;
+ obj.list1.clear();
+ for (var i = 0; i < obj.record_ids.length; i++) {
+ var item = obj.prep_record_for_list( obj.record_ids[i] );
+ if (item) obj.list1.append( item );
+ }
+ },
+
+ 'init' : function( params ) {
+
+ var obj = this;
+
+ obj.record_ids = params['record_ids'] || [];
+
+ JSAN.use('circ.util');
+ var columns = circ.util.columns(
+ {
+ 'title' : { 'hidden' : false },
+ 'author' : { 'hidden' : false },
+ 'edition' : { 'hidden' : false },
+ 'publisher' : { 'hidden' : false },
+ 'pubdate' : { 'hidden' : false },
+ 'isbn' : { 'hidden' : false },
+ 'tcn' : { 'hidden' : false }
+ }
+ );
+
+ JSAN.use('util.list');
function retrieve_row(params) {
var row = params.row;
try {
- obj.network.simple_request( 'MODS_SLIM_RECORD_RETRIEVE.authoritative', [ row.my.docid ],
+ obj.network.simple_request( 'MODS_SLIM_RECORD_RETRIEVE.authoritative', [ row.my.docid ],
function(req) {
try {
var record = req.getResultObject();
@@ -147,124 +147,124 @@ cat.record_buckets.prototype = {
return row;
}
- obj.list0 = new util.list('record_query_list');
- obj.list0.init(
- {
- 'columns' : columns,
- 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
+ obj.list0 = new util.list('record_query_list');
+ obj.list0.init(
+ {
+ 'columns' : columns,
+ 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
'retrieve_row' : retrieve_row,
- 'on_select' : function(ev) {
- try {
- JSAN.use('util.functional');
- var sel = obj.list0.retrieve_selection();
- obj.controller.view.sel_clip1.setAttribute('disabled', sel.length < 1 ? "true" : "false");
- obj.selection_list0 = util.functional.map_list(
- sel,
- function(o) { return JSON2js(o.getAttribute('retrieve_id')); }
- );
- obj.error.sdump('D_TRACE','circ/record_buckets: selection list 0 = ' + js2JSON(obj.selection_list1) );
- if (obj.selection_list0.length == 0) {
- obj.controller.view.cmd_add_sel_query_to_pending.setAttribute('disabled','true');
- } else {
- obj.controller.view.cmd_add_sel_query_to_pending.setAttribute('disabled','false');
- }
- } catch(E) {
- alert('FIXME: ' + E);
- }
- }
-
- }
- );
-
- obj.list1 = new util.list('pending_records_list');
- obj.list1.init(
- {
- 'columns' : columns,
- 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
+ 'on_select' : function(ev) {
+ try {
+ JSAN.use('util.functional');
+ var sel = obj.list0.retrieve_selection();
+ obj.controller.view.sel_clip1.setAttribute('disabled', sel.length < 1 ? "true" : "false");
+ obj.selection_list0 = util.functional.map_list(
+ sel,
+ function(o) { return JSON2js(o.getAttribute('retrieve_id')); }
+ );
+ obj.error.sdump('D_TRACE','circ/record_buckets: selection list 0 = ' + js2JSON(obj.selection_list1) );
+ if (obj.selection_list0.length == 0) {
+ obj.controller.view.cmd_add_sel_query_to_pending.setAttribute('disabled','true');
+ } else {
+ obj.controller.view.cmd_add_sel_query_to_pending.setAttribute('disabled','false');
+ }
+ } catch(E) {
+ alert('FIXME: ' + E);
+ }
+ }
+
+ }
+ );
+
+ obj.list1 = new util.list('pending_records_list');
+ obj.list1.init(
+ {
+ 'columns' : columns,
+ 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
'retrieve_row' : retrieve_row,
- 'on_select' : function(ev) {
- try {
- JSAN.use('util.functional');
- var sel = obj.list1.retrieve_selection();
- obj.controller.view.sel_clip1.setAttribute('disabled', sel.length < 1 ? "true" : "false");
- obj.selection_list1 = util.functional.map_list(
- sel,
- function(o) { return JSON2js(o.getAttribute('retrieve_id')); }
- );
- obj.error.sdump('D_TRACE','circ/record_buckets: selection list 1 = ' + js2JSON(obj.selection_list1) );
- if (obj.selection_list1.length == 0) {
- obj.controller.view.cmd_add_sel_pending_to_record_bucket.setAttribute('disabled','true');
- } else {
- obj.controller.view.cmd_add_sel_pending_to_record_bucket.setAttribute('disabled','false');
- }
- } catch(E) {
- alert('FIXME: ' + E);
- }
- }
-
- }
- );
-
- obj.render_pending_records();
-
- obj.list2 = new util.list('records_in_bucket_list');
- obj.list2.init(
- {
- 'columns' : columns,
- 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
+ 'on_select' : function(ev) {
+ try {
+ JSAN.use('util.functional');
+ var sel = obj.list1.retrieve_selection();
+ obj.controller.view.sel_clip1.setAttribute('disabled', sel.length < 1 ? "true" : "false");
+ obj.selection_list1 = util.functional.map_list(
+ sel,
+ function(o) { return JSON2js(o.getAttribute('retrieve_id')); }
+ );
+ obj.error.sdump('D_TRACE','circ/record_buckets: selection list 1 = ' + js2JSON(obj.selection_list1) );
+ if (obj.selection_list1.length == 0) {
+ obj.controller.view.cmd_add_sel_pending_to_record_bucket.setAttribute('disabled','true');
+ } else {
+ obj.controller.view.cmd_add_sel_pending_to_record_bucket.setAttribute('disabled','false');
+ }
+ } catch(E) {
+ alert('FIXME: ' + E);
+ }
+ }
+
+ }
+ );
+
+ obj.render_pending_records();
+
+ obj.list2 = new util.list('records_in_bucket_list');
+ obj.list2.init(
+ {
+ 'columns' : columns,
+ 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
'retrieve_row' : retrieve_row,
- 'on_select' : function(ev) {
- try {
- JSAN.use('util.functional');
- var sel = obj.list2.retrieve_selection();
- obj.controller.view.sel_clip2.setAttribute('disabled', sel.length < 1 ? "true" : "false");
- obj.selection_list2 = util.functional.map_list(
- sel,
- function(o) { return JSON2js(o.getAttribute('retrieve_id')); }
- );
- obj.error.sdump('D_TRACE','circ/record_buckets: selection list 2 = ' + js2JSON(obj.selection_list2) );
- if (obj.selection_list2.length == 0) {
- obj.controller.view.cmd_record_buckets_delete_item.setAttribute('disabled','true');
- obj.controller.view.cmd_record_buckets_to_pending_buckets.setAttribute('disabled','true');
- } else {
- obj.controller.view.cmd_record_buckets_delete_item.setAttribute('disabled','false');
- obj.controller.view.cmd_record_buckets_to_pending_buckets.setAttribute('disabled','false');
- }
- } catch(E) {
- alert('FIXME: ' + E);
- }
- }
- }
- );
-
- JSAN.use('util.controller'); obj.controller = new util.controller();
- obj.controller.init(
- {
- 'control_map' : {
- 'save_columns2' : [
- ['command'],
- function() { obj.list2.save_columns(); }
- ],
- 'save_columns1' : [
- ['command'],
- function() { obj.list1.save_columns(); }
- ],
- 'save_columns0' : [
- ['command'],
- function() { obj.list0.save_columns(); }
- ],
- 'sel_clip2' : [
- ['command'],
- function() { obj.list2.clipboard(); }
- ],
- 'sel_clip1' : [
- ['command'],
- function() { obj.list1.clipboard(); }
- ],
- 'sel_clip0' : [
- ['command'],
- function() { obj.list0.clipboard(); }
- ],
+ 'on_select' : function(ev) {
+ try {
+ JSAN.use('util.functional');
+ var sel = obj.list2.retrieve_selection();
+ obj.controller.view.sel_clip2.setAttribute('disabled', sel.length < 1 ? "true" : "false");
+ obj.selection_list2 = util.functional.map_list(
+ sel,
+ function(o) { return JSON2js(o.getAttribute('retrieve_id')); }
+ );
+ obj.error.sdump('D_TRACE','circ/record_buckets: selection list 2 = ' + js2JSON(obj.selection_list2) );
+ if (obj.selection_list2.length == 0) {
+ obj.controller.view.cmd_record_buckets_delete_item.setAttribute('disabled','true');
+ obj.controller.view.cmd_record_buckets_to_pending_buckets.setAttribute('disabled','true');
+ } else {
+ obj.controller.view.cmd_record_buckets_delete_item.setAttribute('disabled','false');
+ obj.controller.view.cmd_record_buckets_to_pending_buckets.setAttribute('disabled','false');
+ }
+ } catch(E) {
+ alert('FIXME: ' + E);
+ }
+ }
+ }
+ );
+
+ JSAN.use('util.controller'); obj.controller = new util.controller();
+ obj.controller.init(
+ {
+ 'control_map' : {
+ 'save_columns2' : [
+ ['command'],
+ function() { obj.list2.save_columns(); }
+ ],
+ 'save_columns1' : [
+ ['command'],
+ function() { obj.list1.save_columns(); }
+ ],
+ 'save_columns0' : [
+ ['command'],
+ function() { obj.list0.save_columns(); }
+ ],
+ 'sel_clip2' : [
+ ['command'],
+ function() { obj.list2.clipboard(); }
+ ],
+ 'sel_clip1' : [
+ ['command'],
+ function() { obj.list1.clipboard(); }
+ ],
+ 'sel_clip0' : [
+ ['command'],
+ function() { obj.list0.clipboard(); }
+ ],
'record_query_input' : [
['render'],
function(ev) {
@@ -278,61 +278,61 @@ cat.record_buckets.prototype = {
['command'],
function() { obj.submit(); }
],
- 'record_buckets_menulist_placeholder' : [
- ['render'],
- function(e) {
- return function() {
- JSAN.use('util.widgets'); JSAN.use('util.functional');
- var buckets = obj.network.simple_request(
- 'BUCKET_RETRIEVE_VIA_USER',
- [ ses(), obj.data.list.au[0].id() ]
- );
- if (typeof buckets.ilsevent != 'undefined') {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.record_buckets.buckets.std_unexpected_error'), buckets);
- return;
- }
- var items = [
- [$("catStrings").getString('staff.cat.record_buckets.menulist_placeholder.item1'),''],
- [$("catStrings").getString('staff.cat.record_buckets.menulist_placeholder.item2'),-1]
- ].concat(
- util.functional.map_list(
- util.functional.filter_list(
- buckets.biblio,
- function(o) {
- return o.btype() == 'staff_client';
- }
- ),
- function(o) {
- obj.bucket_id_name_map[ o.id() ] = o.name();
- return [ o.name(), o.id() ];
- }
- ).sort(
- function( a, b ) {
- if (a[0] < b[0]) return -1;
- if (a[0] > b[0]) return 1;
- return 0;
- }
- )
- );
- obj.error.sdump('D_TRACE','items = ' + js2JSON(items));
- util.widgets.remove_children( e );
- var ml = util.widgets.make_menulist(
- items
- );
- e.appendChild( ml );
- ml.setAttribute('id','bucket_menulist');
- ml.setAttribute('accesskey','');
-
- function change_bucket(ev) {
- var bucket_id = ev.target.value;
- if (bucket_id < 0 ) {
- bucket_id = window.prompt($("catStrings").getString('staff.cat.record_buckets.change_bucket.bucket_id'));
- ev.target.value = bucket_id;
- ev.target.setAttribute('value',bucket_id);
- }
- if (!bucket_id) return;
- var x = document.getElementById('info_box');
- if (x) x.setAttribute('hidden','true');
+ 'record_buckets_menulist_placeholder' : [
+ ['render'],
+ function(e) {
+ return function() {
+ JSAN.use('util.widgets'); JSAN.use('util.functional');
+ var buckets = obj.network.simple_request(
+ 'BUCKET_RETRIEVE_VIA_USER',
+ [ ses(), obj.data.list.au[0].id() ]
+ );
+ if (typeof buckets.ilsevent != 'undefined') {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.record_buckets.buckets.std_unexpected_error'), buckets);
+ return;
+ }
+ var items = [
+ [$("catStrings").getString('staff.cat.record_buckets.menulist_placeholder.item1'),''],
+ [$("catStrings").getString('staff.cat.record_buckets.menulist_placeholder.item2'),-1]
+ ].concat(
+ util.functional.map_list(
+ util.functional.filter_list(
+ buckets.biblio,
+ function(o) {
+ return o.btype() == 'staff_client';
+ }
+ ),
+ function(o) {
+ obj.bucket_id_name_map[ o.id() ] = o.name();
+ return [ o.name(), o.id() ];
+ }
+ ).sort(
+ function( a, b ) {
+ if (a[0] < b[0]) return -1;
+ if (a[0] > b[0]) return 1;
+ return 0;
+ }
+ )
+ );
+ obj.error.sdump('D_TRACE','items = ' + js2JSON(items));
+ util.widgets.remove_children( e );
+ var ml = util.widgets.make_menulist(
+ items
+ );
+ e.appendChild( ml );
+ ml.setAttribute('id','bucket_menulist');
+ ml.setAttribute('accesskey','');
+
+ function change_bucket(ev) {
+ var bucket_id = ev.target.value;
+ if (bucket_id < 0 ) {
+ bucket_id = window.prompt($("catStrings").getString('staff.cat.record_buckets.change_bucket.bucket_id'));
+ ev.target.value = bucket_id;
+ ev.target.setAttribute('value',bucket_id);
+ }
+ if (!bucket_id) return;
+ var x = document.getElementById('info_box');
+ if (x) x.setAttribute('hidden','true');
x = document.getElementById('bucket_item_count');
if (x) x.setAttribute('label','');
obj.controller.view.cmd_record_buckets_delete_bucket.setAttribute('disabled','true');
@@ -342,19 +342,19 @@ cat.record_buckets.prototype = {
obj.controller.view.cmd_delete_records.setAttribute('disabled','true');
obj.controller.view.cmd_sel_opac.setAttribute('disabled','true');
obj.controller.view.record_buckets_list_actions.disabled = true;
- var bucket = obj.network.simple_request(
- 'BUCKET_FLESH',
- [ ses(), 'biblio', bucket_id ]
- );
- if (typeof bucket.ilsevent != 'undefined') {
- if (bucket.ilsevent == 1506 /* CONTAINER_NOT_FOUND */) {
- alert(catStrings.getFormattedString('staff.cat.record_buckets.menulist.change_bucket.undefined',[bucket_id]));
- } else {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.record_buckets.change_bucket.error'),bucket);
- }
- return;
- }
- try {
+ var bucket = obj.network.simple_request(
+ 'BUCKET_FLESH',
+ [ ses(), 'biblio', bucket_id ]
+ );
+ if (typeof bucket.ilsevent != 'undefined') {
+ if (bucket.ilsevent == 1506 /* CONTAINER_NOT_FOUND */) {
+ alert(catStrings.getFormattedString('staff.cat.record_buckets.menulist.change_bucket.undefined',[bucket_id]));
+ } else {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.record_buckets.change_bucket.error'),bucket);
+ }
+ return;
+ }
+ try {
obj.controller.view.cmd_record_buckets_delete_bucket.setAttribute('disabled','false');
obj.controller.view.cmd_record_buckets_refresh.setAttribute('disabled','false');
obj.controller.view.record_buckets_export_records.disabled = false;
@@ -363,41 +363,41 @@ cat.record_buckets.prototype = {
obj.controller.view.cmd_sel_opac.setAttribute('disabled','false');
obj.controller.view.record_buckets_list_actions.disabled = false;
- var x = document.getElementById('info_box');
- x.setAttribute('hidden','false');
- x = document.getElementById('bucket_number');
- x.setAttribute('value',bucket.id());
- x = document.getElementById('bucket_name');
- x.setAttribute('value',bucket.name());
- x = document.getElementById('bucket_owner');
- var s = bucket.owner(); JSAN.use('patron.util');
- if (s && typeof s != "object") s = patron.util.retrieve_fleshed_au_via_id(ses(),s);
- x.setAttribute('value',s.family_name() + ' (' + s.card().barcode() + ") @ " + obj.data.hash.aou[ s.home_ou() ].shortname());
- } catch(E) {
- alert(E);
- }
- var items = bucket.items() || [];
- obj.list2.clear();
+ var x = document.getElementById('info_box');
+ x.setAttribute('hidden','false');
+ x = document.getElementById('bucket_number');
+ x.setAttribute('value',bucket.id());
+ x = document.getElementById('bucket_name');
+ x.setAttribute('value',bucket.name());
+ x = document.getElementById('bucket_owner');
+ var s = bucket.owner(); JSAN.use('patron.util');
+ if (s && typeof s != "object") s = patron.util.retrieve_fleshed_au_via_id(ses(),s);
+ x.setAttribute('value',s.family_name() + ' (' + s.card().barcode() + ") @ " + obj.data.hash.aou[ s.home_ou() ].shortname());
+ } catch(E) {
+ alert(E);
+ }
+ var items = bucket.items() || [];
+ obj.list2.clear();
var x = document.getElementById('bucket_item_count');
if (x && catStrings) x.setAttribute('value',catStrings.getFormattedString('cat.total_bucket_items_in_bucket',[items.length]));
- for (var i = 0; i < items.length; i++) {
- var item = obj.prep_record_for_list(
- items[i].target_biblio_record_entry(),
- items[i].id()
- );
- if (item) obj.list2.append( item );
- }
- }
-
- ml.addEventListener( 'change_bucket', change_bucket , false);
- ml.addEventListener( 'command', function() {
- JSAN.use('util.widgets'); util.widgets.dispatch('change_bucket',ml);
- }, false);
- obj.controller.view.bucket_menulist = ml;
- JSAN.use('util.widgets'); util.widgets.dispatch('change_bucket',ml);
- };
- },
- ],
+ for (var i = 0; i < items.length; i++) {
+ var item = obj.prep_record_for_list(
+ items[i].target_biblio_record_entry(),
+ items[i].id()
+ );
+ if (item) obj.list2.append( item );
+ }
+ }
+
+ ml.addEventListener( 'change_bucket', change_bucket , false);
+ ml.addEventListener( 'command', function() {
+ JSAN.use('util.widgets'); util.widgets.dispatch('change_bucket',ml);
+ }, false);
+ obj.controller.view.bucket_menulist = ml;
+ JSAN.use('util.widgets'); util.widgets.dispatch('change_bucket',ml);
+ };
+ },
+ ],
'cmd_record_buckets_refresh' : [
['command'],
@@ -406,143 +406,143 @@ cat.record_buckets.prototype = {
}
],
- 'cmd_add_all_query_to_pending' : [
- ['command'],
- function() {
- obj.list0.select_all();
- for (var i = 0; i < obj.selection_list0.length; i++) {
- var docid = obj.selection_list0[i].docid;
- try {
- var item = obj.prep_record_for_list( docid );
- if (!item) continue;
- obj.list1.append( item );
+ 'cmd_add_all_query_to_pending' : [
+ ['command'],
+ function() {
+ obj.list0.select_all();
+ for (var i = 0; i < obj.selection_list0.length; i++) {
+ var docid = obj.selection_list0[i].docid;
+ try {
+ var item = obj.prep_record_for_list( docid );
+ if (!item) continue;
+ obj.list1.append( item );
+ obj.record_ids.push( docid );
+ } catch(E) {
+ alert( js2JSON(E) );
+ }
+ }
+ }
+ ],
+
+ 'cmd_add_sel_query_to_pending' : [
+ ['command'],
+ function() {
+ for (var i = 0; i < obj.selection_list0.length; i++) {
+ var docid = obj.selection_list0[i].docid;
+ try {
+ var item = obj.prep_record_for_list( docid );
+ if (!item) continue;
+ obj.list1.append( item );
obj.record_ids.push( docid );
- } catch(E) {
- alert( js2JSON(E) );
- }
- }
- }
- ],
-
- 'cmd_add_sel_query_to_pending' : [
- ['command'],
- function() {
- for (var i = 0; i < obj.selection_list0.length; i++) {
- var docid = obj.selection_list0[i].docid;
- try {
- var item = obj.prep_record_for_list( docid );
- if (!item) continue;
- obj.list1.append( item );
+ } catch(E) {
+ alert( js2JSON(E) );
+ }
+ }
+ }
+ ],
+
+
+ 'cmd_add_all_pending_to_record_bucket' : [
+ ['command'],
+ function() {
+ var bucket_id = obj.controller.view.bucket_menulist.value;
+ if (!bucket_id) return;
+ for (var i = 0; i < obj.record_ids.length; i++) {
+ var bucket_item = new cbrebi();
+ bucket_item.isnew('1');
+ bucket_item.bucket(bucket_id);
+ bucket_item.target_biblio_record_entry( obj.record_ids[i] );
+ try {
+ var robj = obj.network.simple_request('BUCKET_ITEM_CREATE',
+ [ ses(), 'biblio', bucket_item ]);
+
+ if (typeof robj == 'object') throw robj;
+
+ var item = obj.prep_record_for_list( obj.record_ids[i], robj );
+ if (!item) continue;
+
+ obj.list2.append( item );
+ } catch(E) {
+ alert( js2JSON(E) );
+ }
+ }
+ }
+ ],
+ 'cmd_add_sel_pending_to_record_bucket' : [
+ ['command'],
+ function() {
+ var bucket_id = obj.controller.view.bucket_menulist.value;
+ if (!bucket_id) return;
+ for (var i = 0; i < obj.selection_list1.length; i++) {
+ var docid = obj.selection_list1[i].docid;
+ var bucket_item = new cbrebi();
+ bucket_item.isnew('1');
+ bucket_item.bucket(bucket_id);
+ bucket_item.target_biblio_record_entry( docid );
+ try {
+ var robj = obj.network.simple_request('BUCKET_ITEM_CREATE',
+ [ ses(), 'biblio', bucket_item ]);
+
+ if (typeof robj == 'object') throw robj;
+
+ var item = obj.prep_record_for_list( docid, robj );
+ if (!item) continue;
+
+ obj.list2.append( item );
+ } catch(E) {
+ alert( js2JSON(E) );
+ }
+ }
+
+ }
+ ],
+ 'cmd_record_buckets_to_pending_buckets' : [
+ ['command'],
+ function() {
+ for (var i = 0; i < obj.selection_list2.length; i++) {
+ var docid = obj.selection_list2[i].docid;
+ var item = obj.prep_record_for_list( docid );
+ if (item) {
+ obj.list1.append( item );
obj.record_ids.push( docid );
- } catch(E) {
- alert( js2JSON(E) );
- }
- }
- }
- ],
-
-
- 'cmd_add_all_pending_to_record_bucket' : [
- ['command'],
- function() {
- var bucket_id = obj.controller.view.bucket_menulist.value;
- if (!bucket_id) return;
- for (var i = 0; i < obj.record_ids.length; i++) {
- var bucket_item = new cbrebi();
- bucket_item.isnew('1');
- bucket_item.bucket(bucket_id);
- bucket_item.target_biblio_record_entry( obj.record_ids[i] );
- try {
- var robj = obj.network.simple_request('BUCKET_ITEM_CREATE',
- [ ses(), 'biblio', bucket_item ]);
-
- if (typeof robj == 'object') throw robj;
-
- var item = obj.prep_record_for_list( obj.record_ids[i], robj );
- if (!item) continue;
-
- obj.list2.append( item );
- } catch(E) {
- alert( js2JSON(E) );
- }
- }
- }
- ],
- 'cmd_add_sel_pending_to_record_bucket' : [
- ['command'],
- function() {
- var bucket_id = obj.controller.view.bucket_menulist.value;
- if (!bucket_id) return;
- for (var i = 0; i < obj.selection_list1.length; i++) {
- var docid = obj.selection_list1[i].docid;
- var bucket_item = new cbrebi();
- bucket_item.isnew('1');
- bucket_item.bucket(bucket_id);
- bucket_item.target_biblio_record_entry( docid );
- try {
- var robj = obj.network.simple_request('BUCKET_ITEM_CREATE',
- [ ses(), 'biblio', bucket_item ]);
-
- if (typeof robj == 'object') throw robj;
-
- var item = obj.prep_record_for_list( docid, robj );
- if (!item) continue;
-
- obj.list2.append( item );
- } catch(E) {
- alert( js2JSON(E) );
- }
- }
-
- }
- ],
- 'cmd_record_buckets_to_pending_buckets' : [
- ['command'],
- function() {
- for (var i = 0; i < obj.selection_list2.length; i++) {
- var docid = obj.selection_list2[i].docid;
- var item = obj.prep_record_for_list( docid );
- if (item) {
- obj.list1.append( item );
- obj.record_ids.push( docid );
- }
- }
- }
- ],
-
- 'cmd_record_buckets_delete_item' : [
- ['command'],
- function() {
- for (var i = 0; i < obj.selection_list2.length; i++) {
- try {
- var bucket_item_id = obj.selection_list2[i].bucket_item_id;
- var robj = obj.network.simple_request('BUCKET_ITEM_DELETE',
- [ ses(), 'biblio', bucket_item_id ]);
- if (typeof robj == 'object') throw robj;
- } catch(E) {
- alert(js2JSON(E));
- }
+ }
+ }
+ }
+ ],
+
+ 'cmd_record_buckets_delete_item' : [
+ ['command'],
+ function() {
+ for (var i = 0; i < obj.selection_list2.length; i++) {
+ try {
+ var bucket_item_id = obj.selection_list2[i].bucket_item_id;
+ var robj = obj.network.simple_request('BUCKET_ITEM_DELETE',
+ [ ses(), 'biblio', bucket_item_id ]);
+ if (typeof robj == 'object') throw robj;
+ } catch(E) {
+ alert(js2JSON(E));
+ }
}
- setTimeout(
- function() {
- JSAN.use('util.widgets');
- util.widgets.dispatch('change_bucket',obj.controller.view.bucket_menulist);
- }, 0
- );
- }
- ],
- 'cmd_record_buckets_delete_bucket' : [
- ['command'],
- function() {
- try {
- var bucket = obj.controller.view.bucket_menulist.value;
- var name = obj.bucket_id_name_map[ bucket ];
- var conf = window.confirm($("catStrings").getFormattedString('staff.cat.record_buckets.delete_bucket_named', [name]));
- if (!conf) return;
- obj.list2.clear();
- var robj = obj.network.simple_request('BUCKET_DELETE',[ses(),'biblio',bucket]);
- if (typeof robj == 'object') throw robj;
- var x = document.getElementById('info_box');
+ setTimeout(
+ function() {
+ JSAN.use('util.widgets');
+ util.widgets.dispatch('change_bucket',obj.controller.view.bucket_menulist);
+ }, 0
+ );
+ }
+ ],
+ 'cmd_record_buckets_delete_bucket' : [
+ ['command'],
+ function() {
+ try {
+ var bucket = obj.controller.view.bucket_menulist.value;
+ var name = obj.bucket_id_name_map[ bucket ];
+ var conf = window.confirm($("catStrings").getFormattedString('staff.cat.record_buckets.delete_bucket_named', [name]));
+ if (!conf) return;
+ obj.list2.clear();
+ var robj = obj.network.simple_request('BUCKET_DELETE',[ses(),'biblio',bucket]);
+ if (typeof robj == 'object') throw robj;
+ var x = document.getElementById('info_box');
x.setAttribute('hidden','true');
obj.controller.view.cmd_record_buckets_delete_bucket.setAttribute('disabled','true');
obj.controller.view.cmd_record_buckets_refresh.setAttribute('disabled','true');
@@ -551,63 +551,63 @@ cat.record_buckets.prototype = {
obj.controller.view.cmd_delete_records.setAttribute('disabled','true');
obj.controller.view.cmd_sel_opac.setAttribute('disabled','true');
obj.controller.view.record_buckets_list_actions.disabled = true;
- obj.controller.render('record_buckets_menulist_placeholder');
- setTimeout(
- function() {
- JSAN.use('util.widgets');
- util.widgets.dispatch('change_bucket',obj.controller.view.bucket_menulist);
- }, 0
- );
-
- } catch(E) {
- alert('FIXME: ' + E);
- }
- }
- ],
- 'cmd_record_buckets_new_bucket' : [
- ['command'],
- function() {
- try {
- var name = prompt(
- $("catStrings").getString('staff.cat.record_buckets.new_bucket.bucket_prompt'),
- '',
- $("catStrings").getString('staff.cat.record_buckets.new_bucket.bucket_prompt_title')
- );
-
- if (name) {
- var bucket = new cbreb();
- bucket.btype('staff_client');
- bucket.owner( obj.data.list.au[0].id() );
- bucket.name( name );
-
- var robj = obj.network.simple_request('BUCKET_CREATE',[ses(),'biblio',bucket]);
-
- if (typeof robj == 'object') {
- if (robj.ilsevent == 1710 /* CONTAINER_EXISTS */) {
- alert($("catStrings").getString('staff.cat.record_buckets.new_bucket.same_name_alert'));
- return;
- }
- throw robj;
- }
-
- obj.controller.render('record_buckets_menulist_placeholder');
- obj.controller.view.bucket_menulist.value = robj;
- setTimeout(
- function() {
- JSAN.use('util.widgets');
- util.widgets.dispatch('change_bucket',obj.controller.view.bucket_menulist);
- }, 0
- );
- }
- } catch(E) {
- alert( js2JSON(E) );
- }
- }
- ],
-
- 'cmd_record_query_csv_to_clipboard' : [ ['command'], function() { obj.list0.dump_csv_to_clipboard(); } ],
- 'cmd_pending_buckets_csv_to_clipboard' : [ ['command'], function() { obj.list1.dump_csv_to_clipboard(); } ],
- 'cmd_record_buckets_csv_to_clipboard' : [ ['command'], function() { obj.list2.dump_csv_to_clipboard(); } ],
+ obj.controller.render('record_buckets_menulist_placeholder');
+ setTimeout(
+ function() {
+ JSAN.use('util.widgets');
+ util.widgets.dispatch('change_bucket',obj.controller.view.bucket_menulist);
+ }, 0
+ );
+
+ } catch(E) {
+ alert('FIXME: ' + E);
+ }
+ }
+ ],
+ 'cmd_record_buckets_new_bucket' : [
+ ['command'],
+ function() {
+ try {
+ var name = prompt(
+ $("catStrings").getString('staff.cat.record_buckets.new_bucket.bucket_prompt'),
+ '',
+ $("catStrings").getString('staff.cat.record_buckets.new_bucket.bucket_prompt_title')
+ );
+
+ if (name) {
+ var bucket = new cbreb();
+ bucket.btype('staff_client');
+ bucket.owner( obj.data.list.au[0].id() );
+ bucket.name( name );
+
+ var robj = obj.network.simple_request('BUCKET_CREATE',[ses(),'biblio',bucket]);
+
+ if (typeof robj == 'object') {
+ if (robj.ilsevent == 1710 /* CONTAINER_EXISTS */) {
+ alert($("catStrings").getString('staff.cat.record_buckets.new_bucket.same_name_alert'));
+ return;
+ }
+ throw robj;
+ }
+
+ obj.controller.render('record_buckets_menulist_placeholder');
+ obj.controller.view.bucket_menulist.value = robj;
+ setTimeout(
+ function() {
+ JSAN.use('util.widgets');
+ util.widgets.dispatch('change_bucket',obj.controller.view.bucket_menulist);
+ }, 0
+ );
+ }
+ } catch(E) {
+ alert( js2JSON(E) );
+ }
+ }
+ ],
+
+ 'cmd_record_query_csv_to_clipboard' : [ ['command'], function() { obj.list0.dump_csv_to_clipboard(); } ],
+ 'cmd_pending_buckets_csv_to_clipboard' : [ ['command'], function() { obj.list1.dump_csv_to_clipboard(); } ],
+ 'cmd_record_buckets_csv_to_clipboard' : [ ['command'], function() { obj.list2.dump_csv_to_clipboard(); } ],
'cmd_record_query_csv_to_printer' : [ ['command'], function() { obj.list0.dump_csv_to_printer(); } ],
'cmd_pending_buckets_csv_to_printer' : [ ['command'], function() { obj.list1.dump_csv_to_printer(); } ],
'cmd_record_buckets_csv_to_printer' : [ ['command'], function() { obj.list2.dump_csv_to_printer(); } ],
@@ -615,249 +615,249 @@ cat.record_buckets.prototype = {
'cmd_pending_buckets_csv_to_file' : [ ['command'], function() { obj.list1.dump_csv_to_file( { 'defaultFileName' : 'pending_records.txt' } ); } ],
'cmd_record_buckets_csv_to_file' : [ ['command'], function() { obj.list2.dump_csv_to_file( { 'defaultFileName' : 'bucket_records.txt' } ); } ],
- 'cmd_export_records_usmarc' : [
- ['command'],
- function () { return cat.record_buckets.export_records(obj, 'usmarc') }
- ],
-
- 'cmd_export_records_unimarc' : [
- ['command'],
- function () { return cat.record_buckets.export_records(obj, 'unimarc') }
- ],
-
- 'cmd_export_records_xml' : [
- ['command'],
- function () { return cat.record_buckets.export_records(obj, 'xml') }
- ],
-
- 'cmd_export_records_bre' : [
- ['command'],
- function () { return cat.record_buckets.export_records(obj, 'bre') }
- ],
-
- 'cmd_merge_records' : [
- ['command'],
- function() {
- try {
- obj.list2.select_all();
- obj.data.stash_retrieve();
- JSAN.use('util.functional');
-
- var record_ids = util.functional.map_list(
- obj.list2.dump_retrieve_ids(),
- function (o) {
- return JSON2js(o).docid; // docid
- }
- );
-
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- var top_xml = '';
- top_xml += '' + $("catStrings").getString('staff.cat.record_buckets.merge_records.merge_lead') + ' ';
- top_xml += '';
- top_xml += ' ';
- top_xml += ' ';
-
- var xml = '';
- //obj.data.temp_merge_top = top_xml; obj.data.stash('temp_merge_top');
- //obj.data.temp_merge_mid = xml; obj.data.stash('temp_merge_mid');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_merge_mid'
- //+ '&top_xml_in_stash=temp_merge_top'
- //+ '&title=' + window.escape('Record Merging'),
- 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
- {
- 'top_xml' : top_xml, 'xml' : xml, 'title' : $("catStrings").getString('staff.cat.record_buckets.merge_records.fancy_prompt_title')
- }
- );
- //obj.data.stash_retrieve();
-
- if (typeof fancy_prompt_data.fancy_status == 'undefined' || fancy_prompt_data.fancy_status == 'incomplete') {
- alert($("catStrings").getString('staff.cat.record_buckets.merge_records.fancy_prompt.alert'));
- return;
- }
- var robj = obj.network.simple_request('MERGE_RECORDS',
- [
- ses(),
- fancy_prompt_data.lead,
- util.functional.filter_list( record_ids,
- function(o) {
- return o != fancy_prompt_data.lead;
- }
- )
- ]
- );
- if (typeof robj.ilsevent != 'undefined') {
- throw(robj);
- }
-
- obj.render_pending_records(); // FIXME -- need a generic refresh for lists
- setTimeout(
- function() {
- JSAN.use('util.widgets');
- util.widgets.dispatch('change_bucket',obj.controller.view.bucket_menulist);
- }, 0
- );
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.record_buckets.merge_records.catch.std_unex_error'),E);
- }
-
- }
- ],
-
- 'cmd_delete_records' : [
- ['command'],
- function() {
- try {
- obj.list2.select_all();
- obj.data.stash_retrieve();
- JSAN.use('util.functional');
-
- var record_ids = util.functional.map_list(
- obj.list2.dump_retrieve_ids(),
- function (o) {
- return JSON2js(o).docid; // docid
- }
- );
-
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- var top_xml = '';
- top_xml += '' + $("catStrings").getString('staff.cat.record_buckets.delete_records.xml1') + ' ';
- top_xml += '';
- top_xml += ' ';
- top_xml += ' ';
-
- var xml = '';
- //obj.data.temp_merge_top = top_xml; obj.data.stash('temp_merge_top');
- //obj.data.temp_merge_mid = xml; obj.data.stash('temp_merge_mid');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_merge_mid'
- //+ '&top_xml_in_stash=temp_merge_top'
- //+ '&title=' + window.escape('Record Purging'),
- 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
- {
- 'top_xml' : top_xml, 'xml' : xml, 'title' : $("catStrings").getString('staff.cat.record_buckets.delete_records.fancy_prompt_title')
- }
- );
- //obj.data.stash_retrieve();
- if (typeof fancy_prompt_data.fancy_status == 'undefined' || fancy_prompt_data.fancy_status != 'complete') {
- alert($("catStrings").getString('staff.cat.record_buckets.delete_records.fancy_prompt.alert'));
- return;
- }
- var s = '';
- for (var i = 0; i < record_ids.length; i++) {
- var robj = obj.network.simple_request('FM_BRE_DELETE',[ses(),record_ids[i]]);
- if (typeof robj.ilsevent != 'undefined') {
- if (!s) s = $("catStrings").getString('staff.cat.record_buckets.delete_records.s1');
- s += $("catStrings").getFormattedString('staff.cat.record_buckets.delete_records.s2', [record_ids[i], robj.textcode, robj.desc]);
- }
- }
- if (s) { alert(s); }
-
- obj.render_pending_records(); // FIXME -- need a generic refresh for lists
- setTimeout(
- function() {
- JSAN.use('util.widgets');
- util.widgets.dispatch('change_bucket',obj.controller.view.bucket_menulist);
- }, 0
- );
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.record_buckets.delete_records.catch.std_unex_err',E));
- }
-
- }
- ],
-
- 'cmd_broken' : [
- ['command'],
- function() { alert($("catStrings").getString('staff.cat.record_buckets.cmd_broken.alert')); }
- ],
- 'cmd_sel_opac' : [
- ['command'],
- function() {
- try {
- obj.list2.select_all();
- JSAN.use('util.functional');
- var docids = util.functional.map_list(
- obj.list2.dump_retrieve_ids(),
- function (o) {
- return JSON2js(o).docid; // docid
- }
- );
+ 'cmd_export_records_usmarc' : [
+ ['command'],
+ function () { return cat.record_buckets.export_records(obj, 'usmarc') }
+ ],
+
+ 'cmd_export_records_unimarc' : [
+ ['command'],
+ function () { return cat.record_buckets.export_records(obj, 'unimarc') }
+ ],
+
+ 'cmd_export_records_xml' : [
+ ['command'],
+ function () { return cat.record_buckets.export_records(obj, 'xml') }
+ ],
+
+ 'cmd_export_records_bre' : [
+ ['command'],
+ function () { return cat.record_buckets.export_records(obj, 'bre') }
+ ],
+
+ 'cmd_merge_records' : [
+ ['command'],
+ function() {
+ try {
+ obj.list2.select_all();
+ obj.data.stash_retrieve();
+ JSAN.use('util.functional');
+
+ var record_ids = util.functional.map_list(
+ obj.list2.dump_retrieve_ids(),
+ function (o) {
+ return JSON2js(o).docid; // docid
+ }
+ );
+
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
+ var top_xml = '';
+ top_xml += '' + $("catStrings").getString('staff.cat.record_buckets.merge_records.merge_lead') + ' ';
+ top_xml += '';
+ top_xml += ' ';
+ top_xml += ' ';
+
+ var xml = '';
+ //obj.data.temp_merge_top = top_xml; obj.data.stash('temp_merge_top');
+ //obj.data.temp_merge_mid = xml; obj.data.stash('temp_merge_mid');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_merge_mid'
+ //+ '&top_xml_in_stash=temp_merge_top'
+ //+ '&title=' + window.escape('Record Merging'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
+ {
+ 'top_xml' : top_xml, 'xml' : xml, 'title' : $("catStrings").getString('staff.cat.record_buckets.merge_records.fancy_prompt_title')
+ }
+ );
+ //obj.data.stash_retrieve();
+
+ if (typeof fancy_prompt_data.fancy_status == 'undefined' || fancy_prompt_data.fancy_status == 'incomplete') {
+ alert($("catStrings").getString('staff.cat.record_buckets.merge_records.fancy_prompt.alert'));
+ return;
+ }
+ var robj = obj.network.simple_request('MERGE_RECORDS',
+ [
+ ses(),
+ fancy_prompt_data.lead,
+ util.functional.filter_list( record_ids,
+ function(o) {
+ return o != fancy_prompt_data.lead;
+ }
+ )
+ ]
+ );
+ if (typeof robj.ilsevent != 'undefined') {
+ throw(robj);
+ }
+
+ obj.render_pending_records(); // FIXME -- need a generic refresh for lists
+ setTimeout(
+ function() {
+ JSAN.use('util.widgets');
+ util.widgets.dispatch('change_bucket',obj.controller.view.bucket_menulist);
+ }, 0
+ );
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.record_buckets.merge_records.catch.std_unex_error'),E);
+ }
+
+ }
+ ],
+
+ 'cmd_delete_records' : [
+ ['command'],
+ function() {
+ try {
+ obj.list2.select_all();
+ obj.data.stash_retrieve();
+ JSAN.use('util.functional');
+
+ var record_ids = util.functional.map_list(
+ obj.list2.dump_retrieve_ids(),
+ function (o) {
+ return JSON2js(o).docid; // docid
+ }
+ );
+
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
+ var top_xml = '';
+ top_xml += '' + $("catStrings").getString('staff.cat.record_buckets.delete_records.xml1') + ' ';
+ top_xml += '';
+ top_xml += ' ';
+ top_xml += ' ';
+
+ var xml = '';
+ //obj.data.temp_merge_top = top_xml; obj.data.stash('temp_merge_top');
+ //obj.data.temp_merge_mid = xml; obj.data.stash('temp_merge_mid');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_merge_mid'
+ //+ '&top_xml_in_stash=temp_merge_top'
+ //+ '&title=' + window.escape('Record Purging'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
+ {
+ 'top_xml' : top_xml, 'xml' : xml, 'title' : $("catStrings").getString('staff.cat.record_buckets.delete_records.fancy_prompt_title')
+ }
+ );
+ //obj.data.stash_retrieve();
+ if (typeof fancy_prompt_data.fancy_status == 'undefined' || fancy_prompt_data.fancy_status != 'complete') {
+ alert($("catStrings").getString('staff.cat.record_buckets.delete_records.fancy_prompt.alert'));
+ return;
+ }
+ var s = '';
+ for (var i = 0; i < record_ids.length; i++) {
+ var robj = obj.network.simple_request('FM_BRE_DELETE',[ses(),record_ids[i]]);
+ if (typeof robj.ilsevent != 'undefined') {
+ if (!s) s = $("catStrings").getString('staff.cat.record_buckets.delete_records.s1');
+ s += $("catStrings").getFormattedString('staff.cat.record_buckets.delete_records.s2', [record_ids[i], robj.textcode, robj.desc]);
+ }
+ }
+ if (s) { alert(s); }
+
+ obj.render_pending_records(); // FIXME -- need a generic refresh for lists
+ setTimeout(
+ function() {
+ JSAN.use('util.widgets');
+ util.widgets.dispatch('change_bucket',obj.controller.view.bucket_menulist);
+ }, 0
+ );
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.record_buckets.delete_records.catch.std_unex_err',E));
+ }
+
+ }
+ ],
+
+ 'cmd_broken' : [
+ ['command'],
+ function() { alert($("catStrings").getString('staff.cat.record_buckets.cmd_broken.alert')); }
+ ],
+ 'cmd_sel_opac' : [
+ ['command'],
+ function() {
+ try {
+ obj.list2.select_all();
+ JSAN.use('util.functional');
+ var docids = util.functional.map_list(
+ obj.list2.dump_retrieve_ids(),
+ function (o) {
+ return JSON2js(o).docid; // docid
+ }
+ );
var seen = {};
- for (var i = 0; i < docids.length; i++) {
- var doc_id = docids[i];
+ for (var i = 0; i < docids.length; i++) {
+ var doc_id = docids[i];
if (seen[doc_id]) continue; seen[doc_id] = true;
- var opac_url = xulG.url_prefix( urls.opac_rdetail ) + '?r=' + doc_id;
- var content_params = {
- 'session' : ses(),
- 'authtime' : ses('authtime'),
- 'opac_url' : opac_url
- };
- xulG.new_tab(
- xulG.url_prefix(urls.XUL_OPAC_WRAPPER),
- {'tab_name':$("catStrings").getString('staff.cat.record_buckets.cmd_sel_opac.tab_name')},
- content_params
- );
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.record_buckets.cmd_sel_opac.catch.std_unex_err'),E);
- }
- }
- ],
+ var opac_url = xulG.url_prefix( urls.opac_rdetail ) + '?r=' + doc_id;
+ var content_params = {
+ 'session' : ses(),
+ 'authtime' : ses('authtime'),
+ 'opac_url' : opac_url
+ };
+ xulG.new_tab(
+ xulG.url_prefix(urls.XUL_OPAC_WRAPPER),
+ {'tab_name':$("catStrings").getString('staff.cat.record_buckets.cmd_sel_opac.tab_name')},
+ content_params
+ );
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.record_buckets.cmd_sel_opac.catch.std_unex_err'),E);
+ }
+ }
+ ],
'record_buckets_export_records' : [ ['render'], function(){} ],
'record_buckets_list_actions' : [ ['render'], function(){} ]
- }
- }
- );
- this.controller.render();
+ }
+ }
+ );
+ this.controller.render();
- if (typeof xulG == 'undefined') {
- obj.controller.view.cmd_sel_opac.disabled = true;
- obj.controller.view.cmd_sel_opac.setAttribute('disabled',true);
- }
- },
+ if (typeof xulG == 'undefined') {
+ obj.controller.view.cmd_sel_opac.disabled = true;
+ obj.controller.view.cmd_sel_opac.setAttribute('disabled',true);
+ }
+ },
'submit' : function() {
try {
@@ -911,9 +911,9 @@ cat.record_buckets.prototype = {
}
},
- 'prep_record_for_list' : function(docid,bucket_item_id) {
- var obj = this;
- try {
+ 'prep_record_for_list' : function(docid,bucket_item_id) {
+ var obj = this;
+ try {
var item = {
'retrieve_id' : js2JSON( { 'docid' : docid, 'bucket_item_id' : bucket_item_id } ),
'row' : {
@@ -924,12 +924,12 @@ cat.record_buckets.prototype = {
}
};
return item;
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("catStrings").getFormattedString('staff.cat.record_buckets.prep_record_for_list.std_unex_err', [docid]),E);
- return null;
- }
- }
-
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("catStrings").getFormattedString('staff.cat.record_buckets.prep_record_for_list.std_unex_err', [docid]),E);
+ return null;
+ }
+ }
+
};
dump('exiting cat.record_buckets.js\n');
diff --git a/Open-ILS/xul/staff_client/server/cat/spine_labels.js b/Open-ILS/xul/staff_client/server/cat/spine_labels.js
index 11f692bf70..f393fb921b 100644
--- a/Open-ILS/xul/staff_client/server/cat/spine_labels.js
+++ b/Open-ILS/xul/staff_client/server/cat/spine_labels.js
@@ -1,298 +1,298 @@
- function my_init() {
- try {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- if (typeof JSAN == 'undefined') { throw( $("commonStrings").getString('common.jsan.missing') ); }
- JSAN.errorLevel = "die"; // none, warn, or die
- JSAN.addRepository('/xul/server/');
- JSAN.use('util.error'); g.error = new util.error();
- g.error.sdump('D_TRACE','my_init() for spine_labels.xul');
+ function my_init() {
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ if (typeof JSAN == 'undefined') { throw( $("commonStrings").getString('common.jsan.missing') ); }
+ JSAN.errorLevel = "die"; // none, warn, or die
+ JSAN.addRepository('/xul/server/');
+ JSAN.use('util.error'); g.error = new util.error();
+ g.error.sdump('D_TRACE','my_init() for spine_labels.xul');
- JSAN.use('util.network'); g.network = new util.network();
+ JSAN.use('util.network'); g.network = new util.network();
- g.cgi = new CGI();
+ g.cgi = new CGI();
- g.barcodes = [];
- if (g.cgi.param('barcodes')) {
- g.barcodes = g.barcodes.concat( JSON2js(g.cgi.param('barcodes')) );
- }
- JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.stash_retrieve();
- if (g.data.temp_barcodes_for_labels) {
- g.barcodes = g.barcodes.concat( g.data.temp_barcodes_for_labels );
- g.data.temp_barcodes_for_labels = null; g.data.stash('temp_barcodes_for_labels');
- }
+ g.barcodes = [];
+ if (g.cgi.param('barcodes')) {
+ g.barcodes = g.barcodes.concat( JSON2js(g.cgi.param('barcodes')) );
+ }
+ JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.stash_retrieve();
+ if (g.data.temp_barcodes_for_labels) {
+ g.barcodes = g.barcodes.concat( g.data.temp_barcodes_for_labels );
+ g.data.temp_barcodes_for_labels = null; g.data.stash('temp_barcodes_for_labels');
+ }
- JSAN.use('circ.util');
- g.cols = circ.util.columns( {} );
- g.col_map = {};
- for (var i = 0; i < g.cols.length; i++) {
- g.col_map[ g.cols[i].id ] = { 'regex' : new RegExp('%' + g.cols[i].id + '%',"g"), 'render' : g.cols[i].render };
- }
+ JSAN.use('circ.util');
+ g.cols = circ.util.columns( {} );
+ g.col_map = {};
+ for (var i = 0; i < g.cols.length; i++) {
+ g.col_map[ g.cols[i].id ] = { 'regex' : new RegExp('%' + g.cols[i].id + '%',"g"), 'render' : g.cols[i].render };
+ }
- g.volumes = {};
+ g.volumes = {};
- for (var i = 0; i < g.barcodes.length; i++) {
- var copy = g.network.simple_request( 'FM_ACP_RETRIEVE_VIA_BARCODE.authoritative', [ g.barcodes[i] ] );
- if (typeof copy.ilsevent != 'undefined') throw(copy);
- if (!g.volumes[ copy.call_number() ]) {
- var volume = g.network.simple_request( 'FM_ACN_RETRIEVE.authoritative', [ copy.call_number() ] );
- if (typeof volume.ilsevent != 'undefined') throw(volume);
- var record = g.network.simple_request('MODS_SLIM_RECORD_RETRIEVE.authoritative', [ volume.record() ]);
- volume.record( record );
- g.volumes[ volume.id() ] = volume;
- }
- if (g.volumes[ copy.call_number() ].copies()) {
- var copies = g.volumes[ copy.call_number() ].copies();
- copies.push( copy );
- g.volumes[ copy.call_number() ].copies( copies );
- } else {
- g.volumes[ copy.call_number() ].copies( [ copy ] );
- }
- }
+ for (var i = 0; i < g.barcodes.length; i++) {
+ var copy = g.network.simple_request( 'FM_ACP_RETRIEVE_VIA_BARCODE.authoritative', [ g.barcodes[i] ] );
+ if (typeof copy.ilsevent != 'undefined') throw(copy);
+ if (!g.volumes[ copy.call_number() ]) {
+ var volume = g.network.simple_request( 'FM_ACN_RETRIEVE.authoritative', [ copy.call_number() ] );
+ if (typeof volume.ilsevent != 'undefined') throw(volume);
+ var record = g.network.simple_request('MODS_SLIM_RECORD_RETRIEVE.authoritative', [ volume.record() ]);
+ volume.record( record );
+ g.volumes[ volume.id() ] = volume;
+ }
+ if (g.volumes[ copy.call_number() ].copies()) {
+ var copies = g.volumes[ copy.call_number() ].copies();
+ copies.push( copy );
+ g.volumes[ copy.call_number() ].copies( copies );
+ } else {
+ g.volumes[ copy.call_number() ].copies( [ copy ] );
+ }
+ }
- generate();
+ generate();
- if (typeof xulG != 'undefined') $('close').hidden = true;
+ if (typeof xulG != 'undefined') $('close').hidden = true;
- } catch(E) {
- try {
- g.error.standard_unexpected_error_alert('/xul/server/cat/spine_labels.xul',E);
- } catch(F) {
- alert('FIXME: ' + js2JSON(E));
- }
- }
- }
+ } catch(E) {
+ try {
+ g.error.standard_unexpected_error_alert('/xul/server/cat/spine_labels.xul',E);
+ } catch(F) {
+ alert('FIXME: ' + js2JSON(E));
+ }
+ }
+ }
- function show_macros() {
- JSAN.use('util.functional');
- alert( util.functional.map_list( g.cols, function(o) { return '%' + o.id + '%'; } ).join(" ") );
- }
+ function show_macros() {
+ JSAN.use('util.functional');
+ alert( util.functional.map_list( g.cols, function(o) { return '%' + o.id + '%'; } ).join(" ") );
+ }
- function $(id) { return document.getElementById(id); }
+ function $(id) { return document.getElementById(id); }
- function generate() {
- try {
- var idx = 0;
- JSAN.use('util.text'); JSAN.use('util.money');
- JSAN.use('util.widgets'); util.widgets.remove_children('panel'); var pn = $('panel'); $('preview').disabled = false;
- var lw = Number($('lw').value) || 8; /* spine label width */
- var ll = Number($('ll').value) || 9; /* spine label length */
- var plw = Number($('plw').value) || 28; /* pocket label width */
- var pll = Number($('pll').value) || 9; /* pocket label length */
- for (var i in g.volumes) {
- var vb = document.createElement('vbox'); pn.appendChild(vb); vb.setAttribute('name','template'); vb.setAttribute('acn_id',g.volumes[i].id());
- var ds = document.createElement('description'); vb.appendChild(ds);
- ds.appendChild( document.createTextNode( g.volumes[i].label() ) );
- var ds2 = document.createElement('description'); vb.appendChild(ds2);
- ds2.appendChild( document.createTextNode( g.volumes[i].copies().length + (
- g.volumes[i].copies().length == 1 ? $("catStrings").getString('staff.cat.spine_labels.copy') : $("catStrings").getString('staff.cat.spine_labels.copies')) ) );
- ds2.setAttribute('style','color: green');
- var hb = document.createElement('hbox'); vb.appendChild(hb);
+ function generate() {
+ try {
+ var idx = 0;
+ JSAN.use('util.text'); JSAN.use('util.money');
+ JSAN.use('util.widgets'); util.widgets.remove_children('panel'); var pn = $('panel'); $('preview').disabled = false;
+ var lw = Number($('lw').value) || 8; /* spine label width */
+ var ll = Number($('ll').value) || 9; /* spine label length */
+ var plw = Number($('plw').value) || 28; /* pocket label width */
+ var pll = Number($('pll').value) || 9; /* pocket label length */
+ for (var i in g.volumes) {
+ var vb = document.createElement('vbox'); pn.appendChild(vb); vb.setAttribute('name','template'); vb.setAttribute('acn_id',g.volumes[i].id());
+ var ds = document.createElement('description'); vb.appendChild(ds);
+ ds.appendChild( document.createTextNode( g.volumes[i].label() ) );
+ var ds2 = document.createElement('description'); vb.appendChild(ds2);
+ ds2.appendChild( document.createTextNode( g.volumes[i].copies().length + (
+ g.volumes[i].copies().length == 1 ? $("catStrings").getString('staff.cat.spine_labels.copy') : $("catStrings").getString('staff.cat.spine_labels.copies')) ) );
+ ds2.setAttribute('style','color: green');
+ var hb = document.createElement('hbox'); vb.appendChild(hb);
- var gb = document.createElement('groupbox'); hb.appendChild(gb);
- /* take the call number and split it on whitespace */
- var names = String(g.volumes[i].label()).split(/\s+/);
- var j = 0;
- while (j < ll || j < pll) {
- var hb2 = document.createElement('hbox'); gb.appendChild(hb2);
-
- /* spine */
- if (j < ll) {
- var tb = document.createElement('textbox'); hb2.appendChild(tb);
- tb.value = '';
- tb.setAttribute('class','plain'); tb.setAttribute('style','font-family: monospace');
- tb.setAttribute('size',lw+1); tb.setAttribute('maxlength',lw);
- tb.setAttribute('name','spine');
- var name = names.shift(); if (name) {
- name = String( name );
- /* if the name is greater than the label width... */
- if (name.length > lw) {
- /* then try to split it on periods */
- var sname = name.split(/\./);
- if (sname.length > 1) {
- /* if we can, then put the periods back in on each splitted element */
- if (name.match(/^\./)) sname[0] = '.' + sname[0];
- for (var k = 1; k < sname.length; k++) sname[k] = '.' + sname[k];
- /* and put all but the first one back into the names array */
- names = sname.slice(1).concat( names );
- /* if the name fragment is still greater than the label width... */
- if (sname[0].length > lw) {
- /* then just truncate and throw the rest back into the names array */
- tb.value = sname[0].substr(0,lw);
- names = [ sname[0].substr(lw) ].concat( names );
- } else {
- /* otherwise we're set */
- tb.value = sname[0];
- }
- } else {
- /* if we can't split on periods, then just truncate and throw the rest back into the names array */
- tb.value = name.substr(0,lw);
- names = [ name.substr(lw) ].concat( names );
- }
- } else {
- /* otherwise we're set */
- tb.value = name;
- }
- }
- }
+ var gb = document.createElement('groupbox'); hb.appendChild(gb);
+ /* take the call number and split it on whitespace */
+ var names = String(g.volumes[i].label()).split(/\s+/);
+ var j = 0;
+ while (j < ll || j < pll) {
+ var hb2 = document.createElement('hbox'); gb.appendChild(hb2);
+
+ /* spine */
+ if (j < ll) {
+ var tb = document.createElement('textbox'); hb2.appendChild(tb);
+ tb.value = '';
+ tb.setAttribute('class','plain'); tb.setAttribute('style','font-family: monospace');
+ tb.setAttribute('size',lw+1); tb.setAttribute('maxlength',lw);
+ tb.setAttribute('name','spine');
+ var name = names.shift(); if (name) {
+ name = String( name );
+ /* if the name is greater than the label width... */
+ if (name.length > lw) {
+ /* then try to split it on periods */
+ var sname = name.split(/\./);
+ if (sname.length > 1) {
+ /* if we can, then put the periods back in on each splitted element */
+ if (name.match(/^\./)) sname[0] = '.' + sname[0];
+ for (var k = 1; k < sname.length; k++) sname[k] = '.' + sname[k];
+ /* and put all but the first one back into the names array */
+ names = sname.slice(1).concat( names );
+ /* if the name fragment is still greater than the label width... */
+ if (sname[0].length > lw) {
+ /* then just truncate and throw the rest back into the names array */
+ tb.value = sname[0].substr(0,lw);
+ names = [ sname[0].substr(lw) ].concat( names );
+ } else {
+ /* otherwise we're set */
+ tb.value = sname[0];
+ }
+ } else {
+ /* if we can't split on periods, then just truncate and throw the rest back into the names array */
+ tb.value = name.substr(0,lw);
+ names = [ name.substr(lw) ].concat( names );
+ }
+ } else {
+ /* otherwise we're set */
+ tb.value = name;
+ }
+ }
+ }
- /* pocket */
- if ($('pl').checked && j < pll) {
- var tb2 = document.createElement('textbox'); hb2.appendChild(tb2);
- tb2.value = '';
- tb2.setAttribute('class','plain'); tb2.setAttribute('style','font-family: monospace');
- tb2.setAttribute('size',plw+1); tb2.setAttribute('maxlength',plw);
- tb2.setAttribute('name','pocket');
- if ($('title').checked && $('title_line').value == j + 1 && instanceOf(g.volumes[i].record(),mvr)) {
- if (g.volumes[i].record().title()) {
- tb2.value = util.text.wrap_on_space( g.volumes[i].record().title(), plw )[0];
- } else {
- tb2.value = '';
- }
- }
- if ($('title_r').checked && $('title_r_line').value == j + 1 && instanceOf(g.volumes[i].record(),mvr)) {
- if (g.volumes[i].record().title()) {
- tb2.value = ( ($('title_r_indent').checked ? ' ' : '') + util.text.wrap_on_space( g.volumes[i].record().title(), plw )[1]).substr(0,plw);
- } else {
- tb2.value = '';
- }
- }
- if ($('author').checked && $('author_line').value == j + 1 && instanceOf(g.volumes[i].record(),mvr)) {
- if (g.volumes[i].record().author()) {
- tb2.value = g.volumes[i].record().author().substr(0,plw);
- } else {
- tb2.value = '';
- }
- }
- if ($('call_number').checked && $('call_number_line').value == j + 1) {
- tb2.value = g.volumes[i].label().substr(0,plw);
- }
- if ($('owning_lib_shortname').checked && $('owning_lib_shortname_line').value == j + 1) {
- var lib = g.volumes[i].owning_lib();
- if (!instanceOf(lib,aou)) lib = g.data.hash.aou[ lib ];
- tb2.value = lib.shortname().substr(0,plw);
- }
- if ($('owning_lib').checked && $('owning_lib_line').value == j + 1) {
- var lib = g.volumes[i].owning_lib();
- if (!instanceOf(lib,aou)) lib = g.data.hash.aou[ lib ];
- tb2.value = lib.name().substr(0,plw);
- }
- if ($('shelving_location').checked && $('shelving_location_line').value == j + 1) {
- tb2.value = '%location%';
- }
- if ($('barcode').checked && $('barcode_line').value == j + 1) {
- tb2.value = '%barcode%';
- }
- if ($('custom1').checked && $('custom1_line').value == j + 1) {
- tb2.value = $('custom1_tb').value;
- }
- if ($('custom2').checked && $('custom2_line').value == j + 1) {
- tb2.value = $('custom2_tb').value;
- }
- if ($('custom3').checked && $('custom3_line').value == j + 1) {
- tb2.value = $('custom3_tb').value;
- }
- if ($('custom4').checked && $('custom4_line').value == j + 1) {
- tb2.value = $('custom4_tb').value;
- }
- }
+ /* pocket */
+ if ($('pl').checked && j < pll) {
+ var tb2 = document.createElement('textbox'); hb2.appendChild(tb2);
+ tb2.value = '';
+ tb2.setAttribute('class','plain'); tb2.setAttribute('style','font-family: monospace');
+ tb2.setAttribute('size',plw+1); tb2.setAttribute('maxlength',plw);
+ tb2.setAttribute('name','pocket');
+ if ($('title').checked && $('title_line').value == j + 1 && instanceOf(g.volumes[i].record(),mvr)) {
+ if (g.volumes[i].record().title()) {
+ tb2.value = util.text.wrap_on_space( g.volumes[i].record().title(), plw )[0];
+ } else {
+ tb2.value = '';
+ }
+ }
+ if ($('title_r').checked && $('title_r_line').value == j + 1 && instanceOf(g.volumes[i].record(),mvr)) {
+ if (g.volumes[i].record().title()) {
+ tb2.value = ( ($('title_r_indent').checked ? ' ' : '') + util.text.wrap_on_space( g.volumes[i].record().title(), plw )[1]).substr(0,plw);
+ } else {
+ tb2.value = '';
+ }
+ }
+ if ($('author').checked && $('author_line').value == j + 1 && instanceOf(g.volumes[i].record(),mvr)) {
+ if (g.volumes[i].record().author()) {
+ tb2.value = g.volumes[i].record().author().substr(0,plw);
+ } else {
+ tb2.value = '';
+ }
+ }
+ if ($('call_number').checked && $('call_number_line').value == j + 1) {
+ tb2.value = g.volumes[i].label().substr(0,plw);
+ }
+ if ($('owning_lib_shortname').checked && $('owning_lib_shortname_line').value == j + 1) {
+ var lib = g.volumes[i].owning_lib();
+ if (!instanceOf(lib,aou)) lib = g.data.hash.aou[ lib ];
+ tb2.value = lib.shortname().substr(0,plw);
+ }
+ if ($('owning_lib').checked && $('owning_lib_line').value == j + 1) {
+ var lib = g.volumes[i].owning_lib();
+ if (!instanceOf(lib,aou)) lib = g.data.hash.aou[ lib ];
+ tb2.value = lib.name().substr(0,plw);
+ }
+ if ($('shelving_location').checked && $('shelving_location_line').value == j + 1) {
+ tb2.value = '%location%';
+ }
+ if ($('barcode').checked && $('barcode_line').value == j + 1) {
+ tb2.value = '%barcode%';
+ }
+ if ($('custom1').checked && $('custom1_line').value == j + 1) {
+ tb2.value = $('custom1_tb').value;
+ }
+ if ($('custom2').checked && $('custom2_line').value == j + 1) {
+ tb2.value = $('custom2_tb').value;
+ }
+ if ($('custom3').checked && $('custom3_line').value == j + 1) {
+ tb2.value = $('custom3_tb').value;
+ }
+ if ($('custom4').checked && $('custom4_line').value == j + 1) {
+ tb2.value = $('custom4_tb').value;
+ }
+ }
- j++;
- }
+ j++;
+ }
- idx++;
- }
- } catch(E) {
- g.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.spine_labels.generate.std_unexpeceted_err'),E);
- }
- }
+ idx++;
+ }
+ } catch(E) {
+ g.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.spine_labels.generate.std_unexpeceted_err'),E);
+ }
+ }
- function expand_macros(text,copy,volume,record) {
- var my = { 'acp' : copy, 'acn' : volume, 'mvr' : record };
- var obj = { 'data' : g.data };
- for (var i in g.col_map) {
- var re = g.col_map[i].regex;
- if (text.match(re)) {
- try {
- text = text.replace(re, (typeof g.col_map[i].render == 'function' ? g.col_map[i].render(my) : eval( g.col_map[i].render ) ) );
- } catch(E) {
- g.error.sdump('D_ERROR','spine_labels.js, expand_macros() = ' + E);
- }
- }
- }
- return text;
- }
+ function expand_macros(text,copy,volume,record) {
+ var my = { 'acp' : copy, 'acn' : volume, 'mvr' : record };
+ var obj = { 'data' : g.data };
+ for (var i in g.col_map) {
+ var re = g.col_map[i].regex;
+ if (text.match(re)) {
+ try {
+ text = text.replace(re, (typeof g.col_map[i].render == 'function' ? g.col_map[i].render(my) : eval( g.col_map[i].render ) ) );
+ } catch(E) {
+ g.error.sdump('D_ERROR','spine_labels.js, expand_macros() = ' + E);
+ }
+ }
+ }
+ return text;
+ }
- function preview(idx) {
- try {
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- var pt = Number( $('pt').value ) || 10; /* font size */
- var lm = Number($('lm').value); if (lm == NaN) lm = 11; /* left margin */
- var mm = Number($('mm').value); if (mm == NaN) mm = 2; /* middle margin */
- var lw = Number($('lw').value) || 8; var ll = Number($('ll').value) || 9; /* spine label width and length */
- var plw = Number($('plw').value) || 28; var pll = Number($('pll').value) || 9; /* pocket label width and length */
- var html = "";
+ function preview(idx) {
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+ var pt = Number( $('pt').value ) || 10; /* font size */
+ var lm = Number($('lm').value); if (lm == NaN) lm = 11; /* left margin */
+ var mm = Number($('mm').value); if (mm == NaN) mm = 2; /* middle margin */
+ var lw = Number($('lw').value) || 8; var ll = Number($('ll').value) || 9; /* spine label width and length */
+ var plw = Number($('plw').value) || 28; var pll = Number($('pll').value) || 9; /* pocket label width and length */
+ var html = "";
html += " "
html += " ";
html += "Spine Labels \n";
- var nl = document.getElementsByAttribute('name','template');
- for (var i = 0; i < nl.length; i++) {
- if (typeof idx == 'undefined' || idx == null) { } else {
- if (idx != i) continue;
- }
- var volume = g.volumes[ nl[i].getAttribute('acn_id') ];
+ var nl = document.getElementsByAttribute('name','template');
+ for (var i = 0; i < nl.length; i++) {
+ if (typeof idx == 'undefined' || idx == null) { } else {
+ if (idx != i) continue;
+ }
+ var volume = g.volumes[ nl[i].getAttribute('acn_id') ];
- for (var j = 0; j < volume.copies().length; j++) {
- var copy = volume.copies()[j];
+ for (var j = 0; j < volume.copies().length; j++) {
+ var copy = volume.copies()[j];
if (i == 0) {
- html += '\n';
+ html += '\n';
} else {
- html += '\n';
+ html += '\n';
+ }
+ var gb = nl[i].getElementsByTagName('groupbox')[0];
+ var nl2 = gb.getElementsByAttribute('name','spine');
+ for (var k = 0; k < nl2.length; k++) {
+ for (var m = 0; m < lm; m++) html += ' ';
+ html += util.text.preserve_string_in_html(expand_macros( nl2[k].value, copy, volume, volume.record() ).substr(0,lw));
+ if ($('pl').checked) {
+ var sib = nl2[k].nextSibling;
+ if (sib) {
+ for (var m = 0; m < lw - nl2[k].value.length; m++) html += ' ';
+ for (var m = 0; m < mm; m++) html += ' ';
+ html += util.text.preserve_string_in_html(expand_macros( sib.value, copy, volume, volume.record() ).substr(0,plw));
+ }
+ }
+ html += '\n';
+ }
+ html += ' \n';
+ }
+ }
+ html += '';
+ JSAN.use('util.window'); var win = new util.window();
+ var loc = ( urls.XUL_REMOTE_BROWSER );
+ //+ '?url=' + window.escape('about:blank') + '&show_print_button=1&alternate_print=1&no_xulG=1&title=' + window.escape('Spine Labels');
+ var w = win.open( loc, 'spine_preview', 'chrome,resizable,width=750,height=550');
+ w.xulG = {
+ 'url' : 'about:blank',
+ 'show_print_button' : 1,
+ 'alternate_print' : 1,
+ 'no_xulG' : 1,
+ 'title' : $("catStrings").getString('staff.cat.spine_labels.preview.title'),
+ 'on_url_load' : function(b) {
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+ if (typeof w.xulG.written == 'undefined') {
+ w.xulG.written = true;
+ w.g.browser.get_content().document.write(html);
+ w.g.browser.get_content().document.close();
+ }
+ } catch(E) {
+ alert(E);
}
- var gb = nl[i].getElementsByTagName('groupbox')[0];
- var nl2 = gb.getElementsByAttribute('name','spine');
- for (var k = 0; k < nl2.length; k++) {
- for (var m = 0; m < lm; m++) html += ' ';
- html += util.text.preserve_string_in_html(expand_macros( nl2[k].value, copy, volume, volume.record() ).substr(0,lw));
- if ($('pl').checked) {
- var sib = nl2[k].nextSibling;
- if (sib) {
- for (var m = 0; m < lw - nl2[k].value.length; m++) html += ' ';
- for (var m = 0; m < mm; m++) html += ' ';
- html += util.text.preserve_string_in_html(expand_macros( sib.value, copy, volume, volume.record() ).substr(0,plw));
- }
- }
- html += '\n';
- }
- html += ' \n';
- }
- }
- html += '';
- JSAN.use('util.window'); var win = new util.window();
- var loc = ( urls.XUL_REMOTE_BROWSER );
- //+ '?url=' + window.escape('about:blank') + '&show_print_button=1&alternate_print=1&no_xulG=1&title=' + window.escape('Spine Labels');
- var w = win.open( loc, 'spine_preview', 'chrome,resizable,width=750,height=550');
- w.xulG = {
- 'url' : 'about:blank',
- 'show_print_button' : 1,
- 'alternate_print' : 1,
- 'no_xulG' : 1,
- 'title' : $("catStrings").getString('staff.cat.spine_labels.preview.title'),
- 'on_url_load' : function(b) {
- try {
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- if (typeof w.xulG.written == 'undefined') {
- w.xulG.written = true;
- w.g.browser.get_content().document.write(html);
- w.g.browser.get_content().document.close();
- }
- } catch(E) {
- alert(E);
- }
- }
- };
- } catch(E) {
- g.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.spine_labels.preview.std_unexpected_err'),E);
- }
- }
+ }
+ };
+ } catch(E) {
+ g.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.spine_labels.preview.std_unexpected_err'),E);
+ }
+ }
diff --git a/Open-ILS/xul/staff_client/server/cat/util.js b/Open-ILS/xul/staff_client/server/cat/util.js
index 2797678b0a..011587662b 100644
--- a/Open-ILS/xul/staff_client/server/cat/util.js
+++ b/Open-ILS/xul/staff_client/server/cat/util.js
@@ -5,309 +5,309 @@ function $(id) { return document.getElementById(id); }
if (typeof cat == 'undefined') var cat = {};
cat.util = {};
-cat.util.EXPORT_OK = [
- 'spawn_copy_editor', 'add_copies_to_bucket', 'show_in_opac', 'spawn_spine_editor', 'transfer_copies',
- 'mark_item_missing', 'mark_item_damaged', 'replace_barcode', 'fast_item_add'
+cat.util.EXPORT_OK = [
+ 'spawn_copy_editor', 'add_copies_to_bucket', 'show_in_opac', 'spawn_spine_editor', 'transfer_copies',
+ 'mark_item_missing', 'mark_item_damaged', 'replace_barcode', 'fast_item_add'
];
-cat.util.EXPORT_TAGS = { ':all' : cat.util.EXPORT_OK };
+cat.util.EXPORT_TAGS = { ':all' : cat.util.EXPORT_OK };
cat.util.replace_barcode = function(old_bc) {
- try {
- JSAN.use('util.network');
- var network = new util.network();
+ try {
+ JSAN.use('util.network');
+ var network = new util.network();
- if (!old_bc) old_bc = window.prompt($("catStrings").getString('staff.cat.util.replace_barcode.old_bc_window_prompt.prompt'),
- '',
- $("catStrings").getString('staff.cat.util.replace_barcode.old_bc_window_prompt.title'));
- if (!old_bc) return;
+ if (!old_bc) old_bc = window.prompt($("catStrings").getString('staff.cat.util.replace_barcode.old_bc_window_prompt.prompt'),
+ '',
+ $("catStrings").getString('staff.cat.util.replace_barcode.old_bc_window_prompt.title'));
+ if (!old_bc) return;
- var copy;
+ var copy;
try {
- copy = network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ old_bc ]);
- if (typeof copy.ilsevent != 'undefined') throw(copy);
- if (!copy) throw(copy);
- } catch(E) {
- alert($("catStrings").getFormattedString('staff.cat.util.replace_barcode.error_alert', [old_bc]) + '\n');
- return old_bc;
- }
-
- // Why did I want to do this twice? Because this copy is more fleshed?
- try {
- copy = network.simple_request('FM_ACP_RETRIEVE',[ copy.id() ]);
- if (typeof copy.ilsevent != 'undefined') throw(copy);
- if (!copy) throw(copy);
- } catch(E) {
- try {
- alert($("catStrings").getFormattedString('staff.cat.util.replace_barcode.error_alert', [old_bc]) +
- '\n' + (typeof E.ilsevent == 'undefined' ? '' : E.textcode + ' : ' + E.desc));
- } catch(F) {
- alert(E + '\n' + F);
- }
- return old_bc;
- }
-
- var new_bc = window.prompt($("catStrings").getString('staff.cat.util.replace_barcode.new_bc_window_prompt.prompt'),
- '',
- $("catStrings").getString('staff.cat.util.replace_barcode.new_bc_window_prompt.title'));
- new_bc = String( new_bc ).replace(/\s/g,'');
- /* Casting a possibly null input value to a String turns it into "null" */
- if (!new_bc || new_bc == 'null') {
- alert($("catStrings").getString('staff.cat.util.replace_barcode.new_bc.failed'));
- return old_bc;
- }
-
- var test = network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ new_bc ]);
- if (typeof test.ilsevent == 'undefined') {
- alert('Rename aborted. Another copy has barcode "' + new_bc + '".');
- return old_bc;
- } else {
- if (test.ilsevent != 1502 /* ASSET_COPY_NOT_FOUND */) {
- obj.error.standard_unexpected_error_alert($("catStrings").getFormattedString('staff.cat.util.replace_barcode.testing_error', [new_bc]), test);
- return old_bc;
- }
- }
-
- copy.barcode(new_bc); copy.ischanged('1');
- var r = network.simple_request('FM_ACP_FLESHED_BATCH_UPDATE', [ ses(), [ copy ] ]);
- if (typeof r.ilsevent != 'undefined') {
- if (r.ilsevent != 0) {
- if (r.ilsevent == 5000 /* PERM_FAILURE */) {
- alert($("catStrings").getString('staff.cat.util.replace_barcode.insufficient_permission_for_rename'));
- return old_bc;
- } else {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.util.replace_barcode.item_rename_error'),r);
- return old_bc;
- }
- }
- }
-
- return new_bc;
- } catch(E) {
- JSAN.use('util.error'); var error = new util.error();
- error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.util.replace_barcode.rename_error'),E);
- return old_bc;
- }
+ copy = network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ old_bc ]);
+ if (typeof copy.ilsevent != 'undefined') throw(copy);
+ if (!copy) throw(copy);
+ } catch(E) {
+ alert($("catStrings").getFormattedString('staff.cat.util.replace_barcode.error_alert', [old_bc]) + '\n');
+ return old_bc;
+ }
+
+ // Why did I want to do this twice? Because this copy is more fleshed?
+ try {
+ copy = network.simple_request('FM_ACP_RETRIEVE',[ copy.id() ]);
+ if (typeof copy.ilsevent != 'undefined') throw(copy);
+ if (!copy) throw(copy);
+ } catch(E) {
+ try {
+ alert($("catStrings").getFormattedString('staff.cat.util.replace_barcode.error_alert', [old_bc]) +
+ '\n' + (typeof E.ilsevent == 'undefined' ? '' : E.textcode + ' : ' + E.desc));
+ } catch(F) {
+ alert(E + '\n' + F);
+ }
+ return old_bc;
+ }
+
+ var new_bc = window.prompt($("catStrings").getString('staff.cat.util.replace_barcode.new_bc_window_prompt.prompt'),
+ '',
+ $("catStrings").getString('staff.cat.util.replace_barcode.new_bc_window_prompt.title'));
+ new_bc = String( new_bc ).replace(/\s/g,'');
+ /* Casting a possibly null input value to a String turns it into "null" */
+ if (!new_bc || new_bc == 'null') {
+ alert($("catStrings").getString('staff.cat.util.replace_barcode.new_bc.failed'));
+ return old_bc;
+ }
+
+ var test = network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ new_bc ]);
+ if (typeof test.ilsevent == 'undefined') {
+ alert('Rename aborted. Another copy has barcode "' + new_bc + '".');
+ return old_bc;
+ } else {
+ if (test.ilsevent != 1502 /* ASSET_COPY_NOT_FOUND */) {
+ obj.error.standard_unexpected_error_alert($("catStrings").getFormattedString('staff.cat.util.replace_barcode.testing_error', [new_bc]), test);
+ return old_bc;
+ }
+ }
+
+ copy.barcode(new_bc); copy.ischanged('1');
+ var r = network.simple_request('FM_ACP_FLESHED_BATCH_UPDATE', [ ses(), [ copy ] ]);
+ if (typeof r.ilsevent != 'undefined') {
+ if (r.ilsevent != 0) {
+ if (r.ilsevent == 5000 /* PERM_FAILURE */) {
+ alert($("catStrings").getString('staff.cat.util.replace_barcode.insufficient_permission_for_rename'));
+ return old_bc;
+ } else {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.util.replace_barcode.item_rename_error'),r);
+ return old_bc;
+ }
+ }
+ }
+
+ return new_bc;
+ } catch(E) {
+ JSAN.use('util.error'); var error = new util.error();
+ error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.util.replace_barcode.rename_error'),E);
+ return old_bc;
+ }
}
cat.util.transfer_copies = function(params) {
- JSAN.use('util.error'); var error = new util.error();
- JSAN.use('OpenILS.data'); var data = new OpenILS.data();
- JSAN.use('util.network'); var network = new util.network();
- try {
- data.stash_retrieve();
- if (!data.marked_volume) {
- alert($("catStrings").getString('staff.cat.util.transfer_copies.unmarked_volume_alert'));
- return;
- }
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- var xml = '';
- if (!params.message) {
- params.message = $("catStrings").getFormattedString('staff.cat.util.transfer_copies.params_message', [data.hash.aou[ params.owning_lib ].shortname(), params.volume_label]);
- //params.message = 'Transfer items from their original volumes to ';
- //params.message += data.hash.aou[ params.owning_lib ].shortname() + "'s volume labelled ";
- //params.message += '"' + params.volume_label + '" on the following record (and change their circ libs to match)?';
- }
-
- xml += '' + params.message.replace(/&/g,'&').replace(//g,'>') + ' ';
- xml += ' ';
- xml += ' ';
- xml += '';
- xml += ' ';
- //data.temp_transfer = xml; data.stash('temp_transfer');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_transfer'
- //+ '&title=' + window.escape('Item Transfer'),
- 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300',
- { 'xml' : xml, 'title' : $("catStrings").getString('staff.cat.util.transfer_copies.window_title') }
- );
- if (fancy_prompt_data.fancy_status == 'incomplete') { alert($("catStrings").getString('staff.cat.util.transfer_copies.aborted_transfer')); return; }
-
- JSAN.use('util.functional');
-
- var copies = network.simple_request('FM_ACP_FLESHED_BATCH_RETRIEVE.authoritative', [ params.copy_ids ]);
-
- for (var i = 0; i < copies.length; i++) {
- copies[i].call_number( data.marked_volume );
- copies[i].circ_lib( params.owning_lib );
- copies[i].ischanged( 1 );
- }
-
- var robj = network.simple_request(
- 'FM_ACP_FLESHED_BATCH_UPDATE',
- [ ses(), copies, true ],
- null,
- {
- 'title' : $("catStrings").getString('staff.cat.util.transfer_copies.override_transfer_failure'),
- 'overridable_events' : [
- 1208 /* TITLE_LAST_COPY */,
- 1227 /* COPY_DELETE_WARNING */,
- ]
- }
- );
-
- if (typeof robj.ilsevent != 'undefined') {
- throw(robj);
- } else {
- alert($("catStrings").getString('staff.cat.util.transfer_copies.successful_transfer'));
- }
-
- } catch(E) {
- error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.util.transfer_copies.transfer_error'),E);
- }
+ JSAN.use('util.error'); var error = new util.error();
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data();
+ JSAN.use('util.network'); var network = new util.network();
+ try {
+ data.stash_retrieve();
+ if (!data.marked_volume) {
+ alert($("catStrings").getString('staff.cat.util.transfer_copies.unmarked_volume_alert'));
+ return;
+ }
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
+ var xml = '';
+ if (!params.message) {
+ params.message = $("catStrings").getFormattedString('staff.cat.util.transfer_copies.params_message', [data.hash.aou[ params.owning_lib ].shortname(), params.volume_label]);
+ //params.message = 'Transfer items from their original volumes to ';
+ //params.message += data.hash.aou[ params.owning_lib ].shortname() + "'s volume labelled ";
+ //params.message += '"' + params.volume_label + '" on the following record (and change their circ libs to match)?';
+ }
+
+ xml += '' + params.message.replace(/&/g,'&').replace(//g,'>') + ' ';
+ xml += ' ';
+ xml += ' ';
+ xml += '';
+ xml += ' ';
+ //data.temp_transfer = xml; data.stash('temp_transfer');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_transfer'
+ //+ '&title=' + window.escape('Item Transfer'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300',
+ { 'xml' : xml, 'title' : $("catStrings").getString('staff.cat.util.transfer_copies.window_title') }
+ );
+ if (fancy_prompt_data.fancy_status == 'incomplete') { alert($("catStrings").getString('staff.cat.util.transfer_copies.aborted_transfer')); return; }
+
+ JSAN.use('util.functional');
+
+ var copies = network.simple_request('FM_ACP_FLESHED_BATCH_RETRIEVE.authoritative', [ params.copy_ids ]);
+
+ for (var i = 0; i < copies.length; i++) {
+ copies[i].call_number( data.marked_volume );
+ copies[i].circ_lib( params.owning_lib );
+ copies[i].ischanged( 1 );
+ }
+
+ var robj = network.simple_request(
+ 'FM_ACP_FLESHED_BATCH_UPDATE',
+ [ ses(), copies, true ],
+ null,
+ {
+ 'title' : $("catStrings").getString('staff.cat.util.transfer_copies.override_transfer_failure'),
+ 'overridable_events' : [
+ 1208 /* TITLE_LAST_COPY */,
+ 1227 /* COPY_DELETE_WARNING */,
+ ]
+ }
+ );
+
+ if (typeof robj.ilsevent != 'undefined') {
+ throw(robj);
+ } else {
+ alert($("catStrings").getString('staff.cat.util.transfer_copies.successful_transfer'));
+ }
+
+ } catch(E) {
+ error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.util.transfer_copies.transfer_error'),E);
+ }
}
cat.util.spawn_spine_editor = function(selection_list) {
- JSAN.use('util.error'); var error = new util.error();
- try {
- JSAN.use('util.functional');
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
- data.temp_barcodes_for_labels = util.functional.map_list( selection_list, function(o){return o.barcode;}) ;
- data.stash('temp_barcodes_for_labels');
- xulG.new_tab(
- xulG.url_prefix( urls.XUL_SPINE_LABEL ),
- { 'tab_name' : $("catStrings").getString('staff.cat.util.spine_editor.tab_name') },
- {}
- );
- } catch(E) {
- error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.util.spine_editor.spine_editor_error'),E);
- }
+ JSAN.use('util.error'); var error = new util.error();
+ try {
+ JSAN.use('util.functional');
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
+ data.temp_barcodes_for_labels = util.functional.map_list( selection_list, function(o){return o.barcode;}) ;
+ data.stash('temp_barcodes_for_labels');
+ xulG.new_tab(
+ xulG.url_prefix( urls.XUL_SPINE_LABEL ),
+ { 'tab_name' : $("catStrings").getString('staff.cat.util.spine_editor.tab_name') },
+ {}
+ );
+ } catch(E) {
+ error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.util.spine_editor.spine_editor_error'),E);
+ }
}
cat.util.show_in_opac = function(selection_list) {
- JSAN.use('util.error'); var error = new util.error();
- var doc_id; var seen = {};
- try {
- for (var i = 0; i < selection_list.length; i++) {
- doc_id = selection_list[i].doc_id;
- if (!doc_id) {
- alert($("catStrings").getFormattedString('staff.cat.util.show_in_opac.unknown_barcode', [selection_list[i].barcode]));
- continue;
- }
+ JSAN.use('util.error'); var error = new util.error();
+ var doc_id; var seen = {};
+ try {
+ for (var i = 0; i < selection_list.length; i++) {
+ doc_id = selection_list[i].doc_id;
+ if (!doc_id) {
+ alert($("catStrings").getFormattedString('staff.cat.util.show_in_opac.unknown_barcode', [selection_list[i].barcode]));
+ continue;
+ }
if (doc_id == -1 ) {
continue; /* pre-cat */
}
- if (typeof seen[doc_id] != 'undefined') {
- continue;
- }
- seen[doc_id] = true;
- var opac_url = xulG.url_prefix( urls.opac_rdetail ) + '?r=' + doc_id;
- var content_params = {
- 'session' : ses(),
- 'authtime' : ses('authtime'),
- 'opac_url' : opac_url,
- };
- xulG.new_tab(
- xulG.url_prefix(urls.XUL_OPAC_WRAPPER),
- {'tab_name':'Retrieving title...'},
- content_params
- );
- }
- } catch(E) {
- error.standard_unexpected_error_alert($("catStrings").getFormattedString('staff.cat.util.show_in_opac.catalog_error_for_doc_id', [doc_id]),E);
- }
+ if (typeof seen[doc_id] != 'undefined') {
+ continue;
+ }
+ seen[doc_id] = true;
+ var opac_url = xulG.url_prefix( urls.opac_rdetail ) + '?r=' + doc_id;
+ var content_params = {
+ 'session' : ses(),
+ 'authtime' : ses('authtime'),
+ 'opac_url' : opac_url,
+ };
+ xulG.new_tab(
+ xulG.url_prefix(urls.XUL_OPAC_WRAPPER),
+ {'tab_name':'Retrieving title...'},
+ content_params
+ );
+ }
+ } catch(E) {
+ error.standard_unexpected_error_alert($("catStrings").getFormattedString('staff.cat.util.show_in_opac.catalog_error_for_doc_id', [doc_id]),E);
+ }
}
cat.util.add_copies_to_bucket = function(selection_list) {
- JSAN.use('util.functional');
- JSAN.use('util.window'); var win = new util.window();
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
- data.cb_temp_copy_ids = js2JSON(
- util.functional.map_list(
- selection_list,
- function (o) {
- if (typeof o.copy_id != 'undefined' && o.copy_id != null) {
- return o.copy_id;
- } else {
- return o;
- }
- }
- )
- );
- data.stash('cb_temp_copy_ids');
- win.open(
- xulG.url_prefix(urls.XUL_COPY_BUCKETS_QUICK),
- 'sel_bucket_win' + win.window_name_increment(),
- 'chrome,resizable,center'
- );
+ JSAN.use('util.functional');
+ JSAN.use('util.window'); var win = new util.window();
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+ data.cb_temp_copy_ids = js2JSON(
+ util.functional.map_list(
+ selection_list,
+ function (o) {
+ if (typeof o.copy_id != 'undefined' && o.copy_id != null) {
+ return o.copy_id;
+ } else {
+ return o;
+ }
+ }
+ )
+ );
+ data.stash('cb_temp_copy_ids');
+ win.open(
+ xulG.url_prefix(urls.XUL_COPY_BUCKETS_QUICK),
+ 'sel_bucket_win' + win.window_name_increment(),
+ 'chrome,resizable,center'
+ );
}
cat.util.spawn_copy_editor = function(params) {
- try {
+ try {
if (!params.copy_ids && !params.copies) return;
- if (params.copy_ids && params.copy_ids.length == 0) return;
- if (params.copies && params.copies.length == 0) return;
+ if (params.copy_ids && params.copy_ids.length == 0) return;
+ if (params.copies && params.copies.length == 0) return;
if (params.copy_ids) params.copy_ids = js2JSON(params.copy_ids); // legacy
if (!params.caller_handles_update) params.handle_update = 1; // legacy
- var obj = {};
- JSAN.use('util.network'); obj.network = new util.network();
- JSAN.use('util.error'); obj.error = new util.error();
-
- var title = '';
- if (params.copy_ids && params.copy_ids.length > 1 && params.edit == 1)
- title = $("catStrings").getString('staff.cat.util.copy_editor.batch_edit');
- else if(params.copies && params.copies.length > 1 && params.edit == 1)
- title = $("catStrings").getString('staff.cat.util.copy_editor.batch_view');
- else if(params.copy_ids && params.copy_ids.length == 1)
- title = $("catStrings").getString('staff.cat.util.copy_editor.edit');
- else
- title = $("catStrings").getString('staff.cat.util.copy_editor.view');
-
- JSAN.use('util.window'); var win = new util.window();
- var my_xulG = win.open(
- (urls.XUL_COPY_EDITOR),
- title,
- 'chrome,modal,resizable',
+ var obj = {};
+ JSAN.use('util.network'); obj.network = new util.network();
+ JSAN.use('util.error'); obj.error = new util.error();
+
+ var title = '';
+ if (params.copy_ids && params.copy_ids.length > 1 && params.edit == 1)
+ title = $("catStrings").getString('staff.cat.util.copy_editor.batch_edit');
+ else if(params.copies && params.copies.length > 1 && params.edit == 1)
+ title = $("catStrings").getString('staff.cat.util.copy_editor.batch_view');
+ else if(params.copy_ids && params.copy_ids.length == 1)
+ title = $("catStrings").getString('staff.cat.util.copy_editor.edit');
+ else
+ title = $("catStrings").getString('staff.cat.util.copy_editor.view');
+
+ JSAN.use('util.window'); var win = new util.window();
+ var my_xulG = win.open(
+ (urls.XUL_COPY_EDITOR),
+ title,
+ 'chrome,modal,resizable',
params
- );
- if (!my_xulG.copies && params.edit) {
+ );
+ if (!my_xulG.copies && params.edit) {
alert(typeof params.no_copies_modified_msg != 'undefined' ? params.no_copies_modified_msg : $("catStrings").getString('staff.cat.util.copy_editor.not_modified'));
} else {
return my_xulG.copies;
}
return [];
- } catch(E) {
- JSAN.use('util.error'); var error = new util.error();
- error.standard_unexpected_error_alert('error in cat.util.spawn_copy_editor',E);
- }
+ } catch(E) {
+ JSAN.use('util.error'); var error = new util.error();
+ error.standard_unexpected_error_alert('error in cat.util.spawn_copy_editor',E);
+ }
}
cat.util.mark_item_damaged = function(copy_ids) {
- var error;
- try {
- JSAN.use('util.error'); error = new util.error();
- JSAN.use('util.functional');
- JSAN.use('util.network'); var network = new util.network();
- var copies = network.simple_request('FM_ACP_FLESHED_BATCH_RETRIEVE.authoritative', [ copy_ids ]);
- if (typeof copies.ilsevent != 'undefined') throw(copies);
- var magic_status = false;
- for (var i = 0; i < copies.length; i++) {
- var status = copies[i].status(); if (typeof status == 'object') status = status.id();
- if (typeof my_constants.magical_statuses[ status ] != 'undefined')
- if (my_constants.magical_statuses[ status ].block_mark_item_damaged) magic_status = true;
- }
- if (magic_status) {
-
- error.yns_alert($("catStrings").getString('staff.cat.util.mark_item_damaged.af_message'),
- $("catStrings").getString('staff.cat.util.mark_item_damaged.af_title'),
- $("catStrings").getString('staff.cat.util.mark_item_damaged.af_ok_label'), null, null,
- $("catStrings").getString('staff.cat.util.mark_item_damaged.af_confirm_action'));
-
- } else {
-
- var r = error.yns_alert($("catStrings").getFormattedString('staff.cat.util.mark_item_damaged.md_message', [util.functional.map_list( copies, function(o) { return o.barcode(); } ).join(", ")]),
- $("catStrings").getString('staff.cat.util.mark_item_damaged.md_title'),
- $("catStrings").getString('staff.cat.util.mark_item_damaged.md_ok_label'),
- $("catStrings").getString('staff.cat.util.mark_item_damaged.md_cancel_label'), null,
- $("catStrings").getString('staff.cat.util.mark_item_damaged.md_confirm_action'));
-
- if (r == 0) {
- var count = 0;
- for (var i = 0; i < copies.length; i++) {
- try {
+ var error;
+ try {
+ JSAN.use('util.error'); error = new util.error();
+ JSAN.use('util.functional');
+ JSAN.use('util.network'); var network = new util.network();
+ var copies = network.simple_request('FM_ACP_FLESHED_BATCH_RETRIEVE.authoritative', [ copy_ids ]);
+ if (typeof copies.ilsevent != 'undefined') throw(copies);
+ var magic_status = false;
+ for (var i = 0; i < copies.length; i++) {
+ var status = copies[i].status(); if (typeof status == 'object') status = status.id();
+ if (typeof my_constants.magical_statuses[ status ] != 'undefined')
+ if (my_constants.magical_statuses[ status ].block_mark_item_damaged) magic_status = true;
+ }
+ if (magic_status) {
+
+ error.yns_alert($("catStrings").getString('staff.cat.util.mark_item_damaged.af_message'),
+ $("catStrings").getString('staff.cat.util.mark_item_damaged.af_title'),
+ $("catStrings").getString('staff.cat.util.mark_item_damaged.af_ok_label'), null, null,
+ $("catStrings").getString('staff.cat.util.mark_item_damaged.af_confirm_action'));
+
+ } else {
+
+ var r = error.yns_alert($("catStrings").getFormattedString('staff.cat.util.mark_item_damaged.md_message', [util.functional.map_list( copies, function(o) { return o.barcode(); } ).join(", ")]),
+ $("catStrings").getString('staff.cat.util.mark_item_damaged.md_title'),
+ $("catStrings").getString('staff.cat.util.mark_item_damaged.md_ok_label'),
+ $("catStrings").getString('staff.cat.util.mark_item_damaged.md_cancel_label'), null,
+ $("catStrings").getString('staff.cat.util.mark_item_damaged.md_confirm_action'));
+
+ if (r == 0) {
+ var count = 0;
+ for (var i = 0; i < copies.length; i++) {
+ try {
var my_circ = network.simple_request('FM_CIRC_RETRIEVE_VIA_COPY',[ses(),copies[i].id(),1]);
if (typeof my_circ.ilsevent == 'undefined') {
@@ -348,8 +348,8 @@ cat.util.mark_item_damaged = function(copy_ids) {
}
}
- var robj = network.simple_request('MARK_ITEM_DAMAGED',[ses(),copies[i].id()]);
- if (typeof robj.ilsevent != 'undefined') {
+ var robj = network.simple_request('MARK_ITEM_DAMAGED',[ses(),copies[i].id()]);
+ if (typeof robj.ilsevent != 'undefined') {
switch(robj.textcode) {
case 'DAMAGE_CHARGE' :
JSAN.use('util.money');
@@ -370,82 +370,82 @@ cat.util.mark_item_damaged = function(copy_ids) {
$("catStrings").getString('staff.cat.util.mark_item_damaged.charge_patron_prompt.confirm_action'));
robj = network.simple_request('MARK_ITEM_DAMAGED',[ ses(), copies[i].id(), {'apply_fines' : r1 == 0 ? 'apply' : 'noapply'} ]);
- if (typeof robj.ilsevent != 'undefined') { throw(robj); }
+ if (typeof robj.ilsevent != 'undefined') { throw(robj); }
break;
default: throw(robj);
}
}
- count++;
- } catch(E) {
- error.standard_unexpected_error_alert($("catStrings").getFormattedString('staff.cat.util.mark_item_damaged.marking_error', [copies[i].barcode()]),E);
- }
- }
- alert(count == 1 ? $("catStrings").getString('staff.cat.util.mark_item_damaged.one_item_damaged') :
- $("catStrings").getFormattedString('staff.cat.util.mark_item_damaged.multiple_item_damaged', [count]));
- }
- }
-
- } catch(E) {
- if (error) error.standard_unexpected_error_alert('cat.util.mark_item_damaged',E); else alert('FIXME: ' + E);
- }
+ count++;
+ } catch(E) {
+ error.standard_unexpected_error_alert($("catStrings").getFormattedString('staff.cat.util.mark_item_damaged.marking_error', [copies[i].barcode()]),E);
+ }
+ }
+ alert(count == 1 ? $("catStrings").getString('staff.cat.util.mark_item_damaged.one_item_damaged') :
+ $("catStrings").getFormattedString('staff.cat.util.mark_item_damaged.multiple_item_damaged', [count]));
+ }
+ }
+
+ } catch(E) {
+ if (error) error.standard_unexpected_error_alert('cat.util.mark_item_damaged',E); else alert('FIXME: ' + E);
+ }
}
cat.util.mark_item_missing = function(copy_ids) {
- var error;
- try {
- JSAN.use('util.error'); error = new util.error();
- JSAN.use('util.functional');
- JSAN.use('util.network'); var network = new util.network();
- var copies = network.simple_request('FM_ACP_FLESHED_BATCH_RETRIEVE.authoritative', [ copy_ids ]);
- if (typeof copies.ilsevent != 'undefined') throw(copies);
- var magic_status = false;
- for (var i = 0; i < copies.length; i++) {
- var status = copies[i].status(); if (typeof status == 'object') status = status.id();
- if (typeof my_constants.magical_statuses[ status ] != 'undefined')
- if (my_constants.magical_statuses[ status ].block_mark_item_action) magic_status = true;
- }
- if (magic_status) {
-
- error.yns_alert($("catStrings").getString('staff.cat.util.mark_item_missing.af_message'),
- $("catStrings").getString('staff.cat.util.mark_item_missing.af_title'),
- $("catStrings").getString('staff.cat.util.mark_item_missing.af_ok_label'), null, null,
- $("catStrings").getString('staff.cat.util.mark_item_missing.af_confirm_action'));
-
- } else {
-
- var r = error.yns_alert($("catStrings").getFormattedString('staff.cat.util.mark_item_missing.ms_message', [util.functional.map_list( copies, function(o) { return o.barcode(); } ).join(", ")]),
- $("catStrings").getString('staff.cat.util.mark_item_missing.ms_title'),
- $("catStrings").getString('staff.cat.util.mark_item_missing.ms_ok_label'),
- $("catStrings").getString('staff.cat.util.mark_item_missing.ms_cancel_label'), null,
- $("catStrings").getString('staff.cat.util.mark_item_missing.ms_confirm_action'));
-
- if (r == 0) {
- var count = 0;
- for (var i = 0; i < copies.length; i++) {
- try {
- var robj = network.simple_request('MARK_ITEM_MISSING',[ses(),copies[i].id()]);
- if (typeof robj.ilsevent != 'undefined') throw(robj);
- count++;
- } catch(E) {
- error.standard_unexpected_error_alert($("catStrings").getFormattedString('staff.cat.util.mark_item_missing.marking_error', [copies[i].barcode()]),E);
- }
- }
- alert(count == 1 ? $("catStrings").getString('staff.cat.util.mark_item_missing.one_item_missing') :
- $("catStrings").getFormattedString('staff.cat.util.mark_item_missing.multiple_item_missing', [count]));
- }
- }
-
- } catch(E) {
- if (error) error.standard_unexpected_error_alert('cat.util.mark_item_missing',E); else alert('FIXME: ' + E);
- }
+ var error;
+ try {
+ JSAN.use('util.error'); error = new util.error();
+ JSAN.use('util.functional');
+ JSAN.use('util.network'); var network = new util.network();
+ var copies = network.simple_request('FM_ACP_FLESHED_BATCH_RETRIEVE.authoritative', [ copy_ids ]);
+ if (typeof copies.ilsevent != 'undefined') throw(copies);
+ var magic_status = false;
+ for (var i = 0; i < copies.length; i++) {
+ var status = copies[i].status(); if (typeof status == 'object') status = status.id();
+ if (typeof my_constants.magical_statuses[ status ] != 'undefined')
+ if (my_constants.magical_statuses[ status ].block_mark_item_action) magic_status = true;
+ }
+ if (magic_status) {
+
+ error.yns_alert($("catStrings").getString('staff.cat.util.mark_item_missing.af_message'),
+ $("catStrings").getString('staff.cat.util.mark_item_missing.af_title'),
+ $("catStrings").getString('staff.cat.util.mark_item_missing.af_ok_label'), null, null,
+ $("catStrings").getString('staff.cat.util.mark_item_missing.af_confirm_action'));
+
+ } else {
+
+ var r = error.yns_alert($("catStrings").getFormattedString('staff.cat.util.mark_item_missing.ms_message', [util.functional.map_list( copies, function(o) { return o.barcode(); } ).join(", ")]),
+ $("catStrings").getString('staff.cat.util.mark_item_missing.ms_title'),
+ $("catStrings").getString('staff.cat.util.mark_item_missing.ms_ok_label'),
+ $("catStrings").getString('staff.cat.util.mark_item_missing.ms_cancel_label'), null,
+ $("catStrings").getString('staff.cat.util.mark_item_missing.ms_confirm_action'));
+
+ if (r == 0) {
+ var count = 0;
+ for (var i = 0; i < copies.length; i++) {
+ try {
+ var robj = network.simple_request('MARK_ITEM_MISSING',[ses(),copies[i].id()]);
+ if (typeof robj.ilsevent != 'undefined') throw(robj);
+ count++;
+ } catch(E) {
+ error.standard_unexpected_error_alert($("catStrings").getFormattedString('staff.cat.util.mark_item_missing.marking_error', [copies[i].barcode()]),E);
+ }
+ }
+ alert(count == 1 ? $("catStrings").getString('staff.cat.util.mark_item_missing.one_item_missing') :
+ $("catStrings").getFormattedString('staff.cat.util.mark_item_missing.multiple_item_missing', [count]));
+ }
+ }
+
+ } catch(E) {
+ if (error) error.standard_unexpected_error_alert('cat.util.mark_item_missing',E); else alert('FIXME: ' + E);
+ }
}
cat.util.fast_item_add = function(doc_id,cn_label,cp_barcode) {
- var error;
- try {
+ var error;
+ try {
- JSAN.use('util.error'); error = new util.error();
- JSAN.use('util.network'); var network = new util.network();
+ JSAN.use('util.error'); error = new util.error();
+ JSAN.use('util.network'); var network = new util.network();
var acn_id = network.simple_request(
'FM_ACN_FIND_OR_CREATE',
@@ -476,12 +476,12 @@ cat.util.fast_item_add = function(doc_id,cn_label,cp_barcode) {
copy_obj.opac_visible(get_db_true());
copy_obj.ref(get_db_false());
- JSAN.use('util.window'); var win = new util.window();
+ JSAN.use('util.window'); var win = new util.window();
JSAN.use('cat.util');
return cat.util.spawn_copy_editor( { 'handle_update' : 1, 'edit' : 1, 'docid' : doc_id, 'copies' : [ copy_obj ] });
- } catch(E) {
- if (error) error.standard_unexpected_error_alert('cat.util.fast_item_add',E); else alert('FIXME: ' + E);
- }
+ } catch(E) {
+ if (error) error.standard_unexpected_error_alert('cat.util.fast_item_add',E); else alert('FIXME: ' + E);
+ }
}
dump('exiting cat/util.js\n');
diff --git a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js
index c7b2496efa..a5f577eab7 100644
--- a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js
+++ b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js
@@ -2,393 +2,393 @@ const g_max_copies_that_can_be_added_at_a_time_per_volume = 100;
var g = {};
function my_init() {
- try {
+ try {
- /***********************************************************************************************************/
- /* Initial setup */
+ /***********************************************************************************************************/
+ /* Initial setup */
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- if (typeof JSAN == 'undefined') { throw( $("commonStrings").getString('common.jsan.missing') ); }
- JSAN.errorLevel = "die"; // none, warn, or die
- JSAN.addRepository('/xul/server/');
- JSAN.use('util.error'); g.error = new util.error();
- g.error.sdump('D_TRACE','my_init() for cat/volume_copy_creator.xul');
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ if (typeof JSAN == 'undefined') { throw( $("commonStrings").getString('common.jsan.missing') ); }
+ JSAN.errorLevel = "die"; // none, warn, or die
+ JSAN.addRepository('/xul/server/');
+ JSAN.use('util.error'); g.error = new util.error();
+ g.error.sdump('D_TRACE','my_init() for cat/volume_copy_creator.xul');
- JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
- JSAN.use('util.widgets'); JSAN.use('util.functional');
+ JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
+ JSAN.use('util.widgets'); JSAN.use('util.functional');
- JSAN.use('util.network'); g.network = new util.network();
+ JSAN.use('util.network'); g.network = new util.network();
- /***********************************************************************************************************/
- /* What record am I dealing with? Am I adding just copies or copies and volumes? */
+ /***********************************************************************************************************/
+ /* What record am I dealing with? Am I adding just copies or copies and volumes? */
- g.doc_id = xul_param('doc_id');
+ g.doc_id = xul_param('doc_id');
var sb = document.getElementById('summary_box'); while(sb.firstChild) sb.removeChild(sb.lastChild);
var summary = document.createElement('iframe'); sb.appendChild(summary);
- summary.setAttribute('src',urls.XUL_BIB_BRIEF);
- summary.setAttribute('flex','1');
- get_contentWindow(summary).xulG = { 'docid' : g.doc_id };
-
- g.copy_shortcut = xul_param('copy_shortcut',{'JSON2js_if_cgi':true});
- g.error.sdump('D_ERROR','location.href = ' + location.href + '\n\ncopy_short cut = ' + g.copy_shortcut + '\n\nou_ids = ' + xul_param('ou_ids'));
-
- var ou_ids = xul_param('ou_ids',{'JSON2js_if_cgi' : true, 'concat' : true});;
-
- /***********************************************************************************************************/
- /* For the call number drop down */
-
- var cn_blob;
- try {
- cn_blob = g.network.simple_request('BLOB_MARC_CALLNUMBERS_RETRIEVE',[g.doc_id]);
- } catch(E) {
- cn_blob = [];
- }
- if ((!g.copy_shortcut)) {
- var hbox = document.getElementById('marc_cn');
- var ml = util.widgets.make_menulist(
- util.functional.map_list(
- cn_blob,
- function(o) {
- for (var i in o) {
- return [ o[i], i ];
- }
- }
- ).sort(
- function(a,b) {
- a = a[1]; b = b[1];
- if (a == '082') return -1;
- if (b == '082') return 1;
- if (a == '092') return -1;
- if (b == '092') return 1;
- if (a < b) return -1;
- if (a > b) return 1;
- return 0;
- }
- )
- ); hbox.appendChild(ml);
- ml.setAttribute('editable','true');
- ml.setAttribute('width', '200');
- var btn = document.createElement('button');
- btn.setAttribute('label',$('catStrings').getString('staff.cat.volume_copy_creator.my_init.btn.label'));
- btn.setAttribute('accesskey','A');
- btn.setAttribute('image','/xul/server/skin/media/images/down_arrow.gif');
- hbox.appendChild(btn);
- btn.addEventListener(
- 'command',
- function() {
- var nl = document.getElementsByTagName('textbox');
- for (var i = 0; i < nl.length; i++) {
- if (nl[i].getAttribute('rel_vert_pos')==2
- && !nl[i].disabled) nl[i].value = ml.value;
- }
- if (g.last_focus) setTimeout( function() { g.last_focus.focus(); }, 0 );
- },
- false
- );
- }
-
- /***********************************************************************************************************/
- /* render the orgs and volumes/input */
-
- var rows = document.getElementById('rows');
-
- var node_id = 0;
- for (var i = 0; i < ou_ids.length; i++) {
- try {
- var org = g.data.hash.aou[ ou_ids[i] ];
- if ( get_bool( g.data.hash.aout[ org.ou_type() ].can_have_vols() ) ) {
- var row = document.createElement('row'); rows.appendChild(row); row.setAttribute('ou_id',ou_ids[i]);
- g.render_library_label(row,ou_ids[i]);
- g.render_volume_count_entry(row,ou_ids[i]);
- }
- } catch(E) {
- g.error.sdump('D_ERROR',E);
- }
- }
-
- g.load_prefs();
-
- } catch(E) {
- var err_msg = $("commonStrings").getFormattedString('common.exception', ['cat/volume_copy_creator.js', E]);
- try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); dump(js2JSON(E)); }
- alert(err_msg);
- }
+ summary.setAttribute('src',urls.XUL_BIB_BRIEF);
+ summary.setAttribute('flex','1');
+ get_contentWindow(summary).xulG = { 'docid' : g.doc_id };
+
+ g.copy_shortcut = xul_param('copy_shortcut',{'JSON2js_if_cgi':true});
+ g.error.sdump('D_ERROR','location.href = ' + location.href + '\n\ncopy_short cut = ' + g.copy_shortcut + '\n\nou_ids = ' + xul_param('ou_ids'));
+
+ var ou_ids = xul_param('ou_ids',{'JSON2js_if_cgi' : true, 'concat' : true});;
+
+ /***********************************************************************************************************/
+ /* For the call number drop down */
+
+ var cn_blob;
+ try {
+ cn_blob = g.network.simple_request('BLOB_MARC_CALLNUMBERS_RETRIEVE',[g.doc_id]);
+ } catch(E) {
+ cn_blob = [];
+ }
+ if ((!g.copy_shortcut)) {
+ var hbox = document.getElementById('marc_cn');
+ var ml = util.widgets.make_menulist(
+ util.functional.map_list(
+ cn_blob,
+ function(o) {
+ for (var i in o) {
+ return [ o[i], i ];
+ }
+ }
+ ).sort(
+ function(a,b) {
+ a = a[1]; b = b[1];
+ if (a == '082') return -1;
+ if (b == '082') return 1;
+ if (a == '092') return -1;
+ if (b == '092') return 1;
+ if (a < b) return -1;
+ if (a > b) return 1;
+ return 0;
+ }
+ )
+ ); hbox.appendChild(ml);
+ ml.setAttribute('editable','true');
+ ml.setAttribute('width', '200');
+ var btn = document.createElement('button');
+ btn.setAttribute('label',$('catStrings').getString('staff.cat.volume_copy_creator.my_init.btn.label'));
+ btn.setAttribute('accesskey','A');
+ btn.setAttribute('image','/xul/server/skin/media/images/down_arrow.gif');
+ hbox.appendChild(btn);
+ btn.addEventListener(
+ 'command',
+ function() {
+ var nl = document.getElementsByTagName('textbox');
+ for (var i = 0; i < nl.length; i++) {
+ if (nl[i].getAttribute('rel_vert_pos')==2
+ && !nl[i].disabled) nl[i].value = ml.value;
+ }
+ if (g.last_focus) setTimeout( function() { g.last_focus.focus(); }, 0 );
+ },
+ false
+ );
+ }
+
+ /***********************************************************************************************************/
+ /* render the orgs and volumes/input */
+
+ var rows = document.getElementById('rows');
+
+ var node_id = 0;
+ for (var i = 0; i < ou_ids.length; i++) {
+ try {
+ var org = g.data.hash.aou[ ou_ids[i] ];
+ if ( get_bool( g.data.hash.aout[ org.ou_type() ].can_have_vols() ) ) {
+ var row = document.createElement('row'); rows.appendChild(row); row.setAttribute('ou_id',ou_ids[i]);
+ g.render_library_label(row,ou_ids[i]);
+ g.render_volume_count_entry(row,ou_ids[i]);
+ }
+ } catch(E) {
+ g.error.sdump('D_ERROR',E);
+ }
+ }
+
+ g.load_prefs();
+
+ } catch(E) {
+ var err_msg = $("commonStrings").getFormattedString('common.exception', ['cat/volume_copy_creator.js', E]);
+ try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); dump(js2JSON(E)); }
+ alert(err_msg);
+ }
}
g.render_library_label = function(row,ou_id) {
- var label = document.createElement('label'); row.appendChild(label);
- label.setAttribute('ou_id',ou_id);
- label.setAttribute('value',g.data.hash.aou[ ou_id ].shortname());
+ var label = document.createElement('label'); row.appendChild(label);
+ label.setAttribute('ou_id',ou_id);
+ label.setAttribute('value',g.data.hash.aou[ ou_id ].shortname());
}
g.render_volume_count_entry = function(row,ou_id) {
- var hb = document.createElement('vbox'); row.appendChild(hb);
- var tb = document.createElement('textbox'); hb.appendChild(tb);
- tb.setAttribute('ou_id',ou_id); tb.setAttribute('size','3'); tb.setAttribute('cols','3');
- tb.setAttribute('rel_vert_pos','1');
- if ( (!g.copy_shortcut) && (!g.last_focus) ) { tb.focus(); g.last_focus = tb; }
- var node;
- function render_copy_count_entry(ev) {
- if (ev.target.disabled) return;
- if (! isNaN( Number( ev.target.value) ) ) {
- if ( Number( ev.target.value ) > g_max_copies_that_can_be_added_at_a_time_per_volume ) {
- g.error.yns_alert($("catStrings").getFormattedString('staff.cat.volume_copy_creator.render_volume_count_entry.message', [g_max_copies_that_can_be_added_at_a_time_per_volume]),
- $("catStrings").getString('staff.cat.volume_copy_creator.render_volume_count_entry.title'),
- $("catStrings").getString('staff.cat.volume_copy_creator.render_volume_count_entry.ok_label'),null,null,'');
- return;
- }
- if (node) { row.removeChild(node); node = null; }
- //ev.target.disabled = true;
- node = g.render_callnumber_copy_count_entry(row,ou_id,ev.target.value);
- }
- }
- util.widgets.apply_vertical_tab_on_enter_handler(
- tb,
- function() { render_copy_count_entry({'target':tb}); setTimeout(function(){util.widgets.vertical_tab(tb);},0); }
- );
- tb.addEventListener( 'change', render_copy_count_entry, false);
- tb.addEventListener( 'focus', function(ev) { g.last_focus = ev.target; }, false );
- setTimeout(
- function() {
- try {
- if (g.copy_shortcut) {
- JSAN.use('util.functional');
- tb.value = util.functional.map_object_to_list(
- g.copy_shortcut[ou_id],
- function(o,i) {
- return g.copy_shortcut[ou_id][i];
- }
- ).length
- render_copy_count_entry({'target':tb});
- tb.disabled = true;
- }
- } catch(E) {
- alert(E);
- }
- }, 0
- );
+ var hb = document.createElement('vbox'); row.appendChild(hb);
+ var tb = document.createElement('textbox'); hb.appendChild(tb);
+ tb.setAttribute('ou_id',ou_id); tb.setAttribute('size','3'); tb.setAttribute('cols','3');
+ tb.setAttribute('rel_vert_pos','1');
+ if ( (!g.copy_shortcut) && (!g.last_focus) ) { tb.focus(); g.last_focus = tb; }
+ var node;
+ function render_copy_count_entry(ev) {
+ if (ev.target.disabled) return;
+ if (! isNaN( Number( ev.target.value) ) ) {
+ if ( Number( ev.target.value ) > g_max_copies_that_can_be_added_at_a_time_per_volume ) {
+ g.error.yns_alert($("catStrings").getFormattedString('staff.cat.volume_copy_creator.render_volume_count_entry.message', [g_max_copies_that_can_be_added_at_a_time_per_volume]),
+ $("catStrings").getString('staff.cat.volume_copy_creator.render_volume_count_entry.title'),
+ $("catStrings").getString('staff.cat.volume_copy_creator.render_volume_count_entry.ok_label'),null,null,'');
+ return;
+ }
+ if (node) { row.removeChild(node); node = null; }
+ //ev.target.disabled = true;
+ node = g.render_callnumber_copy_count_entry(row,ou_id,ev.target.value);
+ }
+ }
+ util.widgets.apply_vertical_tab_on_enter_handler(
+ tb,
+ function() { render_copy_count_entry({'target':tb}); setTimeout(function(){util.widgets.vertical_tab(tb);},0); }
+ );
+ tb.addEventListener( 'change', render_copy_count_entry, false);
+ tb.addEventListener( 'focus', function(ev) { g.last_focus = ev.target; }, false );
+ setTimeout(
+ function() {
+ try {
+ if (g.copy_shortcut) {
+ JSAN.use('util.functional');
+ tb.value = util.functional.map_object_to_list(
+ g.copy_shortcut[ou_id],
+ function(o,i) {
+ return g.copy_shortcut[ou_id][i];
+ }
+ ).length
+ render_copy_count_entry({'target':tb});
+ tb.disabled = true;
+ }
+ } catch(E) {
+ alert(E);
+ }
+ }, 0
+ );
}
g.render_callnumber_copy_count_entry = function(row,ou_id,count) {
- var grid = util.widgets.make_grid( [ {}, {} ] ); row.appendChild(grid);
- grid.setAttribute('flex','1');
- grid.setAttribute('ou_id',ou_id);
- var rows = grid.lastChild;
- var r = document.createElement('row'); rows.appendChild( r );
- var x = document.createElement('label'); r.appendChild(x);
- x.setAttribute('value', $("catStrings").getString('staff.cat.volume_copy_creator.render_callnumber_copy_count_entry.call_nums')); x.setAttribute('style','font-weight: bold');
- x = document.createElement('label'); r.appendChild(x);
- x.setAttribute('value',$("catStrings").getString('staff.cat.volume_copy_creator.render_callnumber_copy_count_entry.num_of_copies')); x.setAttribute('style','font-weight: bold');
- x.setAttribute('size','3'); x.setAttribute('cols','3');
-
-
- function handle_change(tb1,tb2,hb3) {
- if (tb1.value == '') return;
- if (isNaN( Number( tb2.value ) )) return;
- if ( Number( tb2.value ) > g_max_copies_that_can_be_added_at_a_time_per_volume ) {
- g.error.yns_alert($("catStrings").getFormattedString('staff.cat.volume_copy_creator.render_volume_count_entry.message', [g_max_copies_that_can_be_added_at_a_time_per_volume]),
- $("catStrings").getString('staff.cat.volume_copy_creator.render_volume_count_entry.title'),
- $("catStrings").getString('staff.cat.volume_copy_creator.render_volume_count_entry.ok_label'),null,null,'');
+ var grid = util.widgets.make_grid( [ {}, {} ] ); row.appendChild(grid);
+ grid.setAttribute('flex','1');
+ grid.setAttribute('ou_id',ou_id);
+ var rows = grid.lastChild;
+ var r = document.createElement('row'); rows.appendChild( r );
+ var x = document.createElement('label'); r.appendChild(x);
+ x.setAttribute('value', $("catStrings").getString('staff.cat.volume_copy_creator.render_callnumber_copy_count_entry.call_nums')); x.setAttribute('style','font-weight: bold');
+ x = document.createElement('label'); r.appendChild(x);
+ x.setAttribute('value',$("catStrings").getString('staff.cat.volume_copy_creator.render_callnumber_copy_count_entry.num_of_copies')); x.setAttribute('style','font-weight: bold');
+ x.setAttribute('size','3'); x.setAttribute('cols','3');
+
+
+ function handle_change(tb1,tb2,hb3) {
+ if (tb1.value == '') return;
+ if (isNaN( Number( tb2.value ) )) return;
+ if ( Number( tb2.value ) > g_max_copies_that_can_be_added_at_a_time_per_volume ) {
+ g.error.yns_alert($("catStrings").getFormattedString('staff.cat.volume_copy_creator.render_volume_count_entry.message', [g_max_copies_that_can_be_added_at_a_time_per_volume]),
+ $("catStrings").getString('staff.cat.volume_copy_creator.render_volume_count_entry.title'),
+ $("catStrings").getString('staff.cat.volume_copy_creator.render_volume_count_entry.ok_label'),null,null,'');
return;
- }
-
- //if (tb1.disabled || tb2.disabled) return;
-
- //tb1.disabled = true;
- //tb2.disabled = true;
-
- util.widgets.remove_children(hb3);
-
- g.render_barcode_entry(hb3,tb1.value,Number(tb2.value),ou_id);
- document.getElementById("Create").disabled = false;
- }
-
- function handle_change_tb1(ev) {
- var _tb1 = ev.target;
- var _hb1 = _tb1.parentNode;
- var _hb2 = _hb1.nextSibling;
- var _tb2 = _hb2.firstChild;
- var _hb3 = _hb2.nextSibling;
- handle_change(_tb1,_tb2,_hb3);
- }
-
- function handle_change_tb2(ev) {
- var _tb2 = ev.target;
- var _hb2 = _tb2.parentNode;
- var _hb1 = _hb2.previousSibling;
- var _tb1 = _hb1.firstChild;
- var _hb3 = _hb2.nextSibling;
- handle_change(_tb1,_tb2,_hb3);
- }
-
- for (var i = 0; i < count; i++) {
- var r = document.createElement('row'); rows.appendChild(r);
- var hb1 = document.createElement('vbox'); r.appendChild(hb1);
- var hb2 = document.createElement('vbox'); r.appendChild(hb2);
- var hb3 = document.createElement('vbox'); r.appendChild(hb3);
- var tb1 = document.createElement('textbox'); hb1.appendChild(tb1);
- tb1.setAttribute('rel_vert_pos','2');
- tb1.setAttribute('ou_id',ou_id);
- util.widgets.apply_vertical_tab_on_enter_handler(
- tb1,
- function() { handle_change_tb1({'target':tb1}); setTimeout(function(){util.widgets.vertical_tab(tb1);},0); }
- );
- var tb2 = document.createElement('textbox'); hb2.appendChild(tb2);
- tb2.setAttribute('size','3'); tb2.setAttribute('cols','3');
- tb2.setAttribute('rel_vert_pos','3');
- tb2.setAttribute('ou_id',ou_id);
- util.widgets.apply_vertical_tab_on_enter_handler(
- tb2,
- function() { handle_change_tb2({'target':tb2}); setTimeout(function(){util.widgets.vertical_tab(tb2);},0); }
- );
-
- tb1.addEventListener( 'change', handle_change_tb1, false);
- tb1.addEventListener( 'focus', function(ev) { g.last_focus = ev.target; }, false );
- tb2.addEventListener( 'change', handle_change_tb2, false);
- tb2.addEventListener( 'focus', function(ev) { g.last_focus = ev.target; }, false );
- if ( !g.last_focus ) { tb2.focus(); g.last_focus = tb2; }
-
- setTimeout(
- function(idx,tb){
- return function() {
- try {
- JSAN.use('util.functional');
- if (g.copy_shortcut) {
- var label = util.functional.map_object_to_list(
- g.copy_shortcut[ou_id],
- function(o,i) {
- return i;
- }
- )[idx];
- tb.value = label; handle_change_tb1({'target':tb});
- tb.disabled = true;
- }
- } catch(E) {
- alert(E);
- }
- }
- }(i,tb1),0
- );
- }
-
- return grid;
+ }
+
+ //if (tb1.disabled || tb2.disabled) return;
+
+ //tb1.disabled = true;
+ //tb2.disabled = true;
+
+ util.widgets.remove_children(hb3);
+
+ g.render_barcode_entry(hb3,tb1.value,Number(tb2.value),ou_id);
+ document.getElementById("Create").disabled = false;
+ }
+
+ function handle_change_tb1(ev) {
+ var _tb1 = ev.target;
+ var _hb1 = _tb1.parentNode;
+ var _hb2 = _hb1.nextSibling;
+ var _tb2 = _hb2.firstChild;
+ var _hb3 = _hb2.nextSibling;
+ handle_change(_tb1,_tb2,_hb3);
+ }
+
+ function handle_change_tb2(ev) {
+ var _tb2 = ev.target;
+ var _hb2 = _tb2.parentNode;
+ var _hb1 = _hb2.previousSibling;
+ var _tb1 = _hb1.firstChild;
+ var _hb3 = _hb2.nextSibling;
+ handle_change(_tb1,_tb2,_hb3);
+ }
+
+ for (var i = 0; i < count; i++) {
+ var r = document.createElement('row'); rows.appendChild(r);
+ var hb1 = document.createElement('vbox'); r.appendChild(hb1);
+ var hb2 = document.createElement('vbox'); r.appendChild(hb2);
+ var hb3 = document.createElement('vbox'); r.appendChild(hb3);
+ var tb1 = document.createElement('textbox'); hb1.appendChild(tb1);
+ tb1.setAttribute('rel_vert_pos','2');
+ tb1.setAttribute('ou_id',ou_id);
+ util.widgets.apply_vertical_tab_on_enter_handler(
+ tb1,
+ function() { handle_change_tb1({'target':tb1}); setTimeout(function(){util.widgets.vertical_tab(tb1);},0); }
+ );
+ var tb2 = document.createElement('textbox'); hb2.appendChild(tb2);
+ tb2.setAttribute('size','3'); tb2.setAttribute('cols','3');
+ tb2.setAttribute('rel_vert_pos','3');
+ tb2.setAttribute('ou_id',ou_id);
+ util.widgets.apply_vertical_tab_on_enter_handler(
+ tb2,
+ function() { handle_change_tb2({'target':tb2}); setTimeout(function(){util.widgets.vertical_tab(tb2);},0); }
+ );
+
+ tb1.addEventListener( 'change', handle_change_tb1, false);
+ tb1.addEventListener( 'focus', function(ev) { g.last_focus = ev.target; }, false );
+ tb2.addEventListener( 'change', handle_change_tb2, false);
+ tb2.addEventListener( 'focus', function(ev) { g.last_focus = ev.target; }, false );
+ if ( !g.last_focus ) { tb2.focus(); g.last_focus = tb2; }
+
+ setTimeout(
+ function(idx,tb){
+ return function() {
+ try {
+ JSAN.use('util.functional');
+ if (g.copy_shortcut) {
+ var label = util.functional.map_object_to_list(
+ g.copy_shortcut[ou_id],
+ function(o,i) {
+ return i;
+ }
+ )[idx];
+ tb.value = label; handle_change_tb1({'target':tb});
+ tb.disabled = true;
+ }
+ } catch(E) {
+ alert(E);
+ }
+ }
+ }(i,tb1),0
+ );
+ }
+
+ return grid;
}
g.render_barcode_entry = function(node,callnumber,count,ou_id) {
- try {
- function ready_to_create(ev) {
- document.getElementById("Create").disabled = false;
- }
-
- JSAN.use('util.barcode');
-
- for (var i = 0; i < count; i++) {
- var tb = document.createElement('textbox'); node.appendChild(tb);
- tb.setAttribute('ou_id',ou_id);
- tb.setAttribute('callnumber',callnumber);
- tb.setAttribute('rel_vert_pos','4');
- util.widgets.apply_vertical_tab_on_enter_handler(
- tb,
- function() { ready_to_create({'target':tb}); setTimeout(function(){util.widgets.vertical_tab(tb);},0); }
- );
- //tb.addEventListener('change',ready_to_create,false);
- tb.addEventListener('change', function(ev) {
- var barcode = String( ev.target.value ).replace(/\s/g,'');
- if (barcode != ev.target.value) ev.target.value = barcode;
- if ($('check_barcodes').checked && ! util.barcode.check(barcode) ) {
- g.error.yns_alert($("catStrings").getFormattedString('staff.cat.volume_copy_creator.render_barcode_entry.alert_message', [barcode]),
- $("catStrings").getString('staff.cat.volume_copy_creator.render_barcode_entry.alert_title'),
- $("catStrings").getString('staff.cat.volume_copy_creator.render_barcode_entry.alert_ok_button'),null,null,
- $("catStrings").getString('staff.cat.volume_copy_creator.render_barcode_entry.alert_confirm'));
- setTimeout( function() { ev.target.select(); ev.target.focus(); }, 0);
- }
- }, false);
- tb.addEventListener( 'focus', function(ev) { g.last_focus = ev.target; }, false );
- }
- } catch(E) {
- g.error.sdump('D_ERROR','g.render_barcode_entry: ' + E);
- }
+ try {
+ function ready_to_create(ev) {
+ document.getElementById("Create").disabled = false;
+ }
+
+ JSAN.use('util.barcode');
+
+ for (var i = 0; i < count; i++) {
+ var tb = document.createElement('textbox'); node.appendChild(tb);
+ tb.setAttribute('ou_id',ou_id);
+ tb.setAttribute('callnumber',callnumber);
+ tb.setAttribute('rel_vert_pos','4');
+ util.widgets.apply_vertical_tab_on_enter_handler(
+ tb,
+ function() { ready_to_create({'target':tb}); setTimeout(function(){util.widgets.vertical_tab(tb);},0); }
+ );
+ //tb.addEventListener('change',ready_to_create,false);
+ tb.addEventListener('change', function(ev) {
+ var barcode = String( ev.target.value ).replace(/\s/g,'');
+ if (barcode != ev.target.value) ev.target.value = barcode;
+ if ($('check_barcodes').checked && ! util.barcode.check(barcode) ) {
+ g.error.yns_alert($("catStrings").getFormattedString('staff.cat.volume_copy_creator.render_barcode_entry.alert_message', [barcode]),
+ $("catStrings").getString('staff.cat.volume_copy_creator.render_barcode_entry.alert_title'),
+ $("catStrings").getString('staff.cat.volume_copy_creator.render_barcode_entry.alert_ok_button'),null,null,
+ $("catStrings").getString('staff.cat.volume_copy_creator.render_barcode_entry.alert_confirm'));
+ setTimeout( function() { ev.target.select(); ev.target.focus(); }, 0);
+ }
+ }, false);
+ tb.addEventListener( 'focus', function(ev) { g.last_focus = ev.target; }, false );
+ }
+ } catch(E) {
+ g.error.sdump('D_ERROR','g.render_barcode_entry: ' + E);
+ }
}
g.new_node_id = -1;
g.stash_and_close = function() {
- try {
-
- var nl = document.getElementsByTagName('textbox');
-
- var volumes_hash = {};
-
- var barcodes = [];
-
- for (var i = 0; i < nl.length; i++) {
- if ( nl[i].getAttribute('rel_vert_pos') == 4 ) barcodes.push( nl[i] );
- if ( nl[i].getAttribute('rel_vert_pos') == 2 ) {
- var ou_id = nl[i].getAttribute('ou_id');
- var callnumber = nl[i].value;
- if (typeof volumes_hash[ou_id] == 'undefined') { volumes_hash[ou_id] = {} }
- if (typeof volumes_hash[ou_id][callnumber] == 'undefined') { volumes_hash[ou_id][callnumber] = [] }
- }
- };
-
- for (var i = 0; i < barcodes.length; i++) {
- var ou_id = barcodes[i].getAttribute('ou_id');
- var callnumber = barcodes[i].getAttribute('callnumber');
- var barcode = barcodes[i].value;
-
- if (typeof volumes_hash[ou_id] == 'undefined') { volumes_hash[ou_id] = {} }
- if (typeof volumes_hash[ou_id][callnumber] == 'undefined') { volumes_hash[ou_id][callnumber] = [] }
-
- if (barcode != '') volumes_hash[ou_id][callnumber].push( barcode );
- }
-
- var volumes = [];
- var copies = [];
- var volume_labels = {};
-
- for (var ou_id in volumes_hash) {
- for (var cn in volumes_hash[ou_id]) {
-
- var acn_id = g.network.simple_request(
- 'FM_ACN_FIND_OR_CREATE',
- [ ses(), cn, g.doc_id, ou_id ]
- );
-
- if (typeof acn_id.ilsevent != 'undefined') {
- g.error.standard_unexpected_error_alert($("catStrings").getFormattedString('staff.cat.volume_copy_creator.stash_and_close.problem_with_volume', [cn]), acn_id);
- continue;
- }
-
- volume_labels[ acn_id ] = { 'label' : cn, 'owning_lib' : ou_id };
-
- for (var i = 0; i < volumes_hash[ou_id][cn].length; i++) {
- var copy = new acp();
- copy.id( g.new_node_id-- );
- copy.isnew('1');
- copy.barcode( volumes_hash[ou_id][cn][i] );
- copy.call_number( acn_id );
- copy.circ_lib(ou_id);
- /* FIXME -- use constants */
- copy.deposit(0);
- copy.price(0);
- copy.deposit_amount(0);
- copy.fine_level(2);
- copy.loan_duration(2);
- copy.location(1);
- copy.status(0);
- copy.circulate(get_db_true());
- copy.holdable(get_db_true());
- copy.opac_visible(get_db_true());
- copy.ref(get_db_false());
- copies.push( copy );
- }
- }
- }
-
- JSAN.use('util.window'); var win = new util.window();
- if (copies.length > 0) {
- JSAN.use('cat.util');
+ try {
+
+ var nl = document.getElementsByTagName('textbox');
+
+ var volumes_hash = {};
+
+ var barcodes = [];
+
+ for (var i = 0; i < nl.length; i++) {
+ if ( nl[i].getAttribute('rel_vert_pos') == 4 ) barcodes.push( nl[i] );
+ if ( nl[i].getAttribute('rel_vert_pos') == 2 ) {
+ var ou_id = nl[i].getAttribute('ou_id');
+ var callnumber = nl[i].value;
+ if (typeof volumes_hash[ou_id] == 'undefined') { volumes_hash[ou_id] = {} }
+ if (typeof volumes_hash[ou_id][callnumber] == 'undefined') { volumes_hash[ou_id][callnumber] = [] }
+ }
+ };
+
+ for (var i = 0; i < barcodes.length; i++) {
+ var ou_id = barcodes[i].getAttribute('ou_id');
+ var callnumber = barcodes[i].getAttribute('callnumber');
+ var barcode = barcodes[i].value;
+
+ if (typeof volumes_hash[ou_id] == 'undefined') { volumes_hash[ou_id] = {} }
+ if (typeof volumes_hash[ou_id][callnumber] == 'undefined') { volumes_hash[ou_id][callnumber] = [] }
+
+ if (barcode != '') volumes_hash[ou_id][callnumber].push( barcode );
+ }
+
+ var volumes = [];
+ var copies = [];
+ var volume_labels = {};
+
+ for (var ou_id in volumes_hash) {
+ for (var cn in volumes_hash[ou_id]) {
+
+ var acn_id = g.network.simple_request(
+ 'FM_ACN_FIND_OR_CREATE',
+ [ ses(), cn, g.doc_id, ou_id ]
+ );
+
+ if (typeof acn_id.ilsevent != 'undefined') {
+ g.error.standard_unexpected_error_alert($("catStrings").getFormattedString('staff.cat.volume_copy_creator.stash_and_close.problem_with_volume', [cn]), acn_id);
+ continue;
+ }
+
+ volume_labels[ acn_id ] = { 'label' : cn, 'owning_lib' : ou_id };
+
+ for (var i = 0; i < volumes_hash[ou_id][cn].length; i++) {
+ var copy = new acp();
+ copy.id( g.new_node_id-- );
+ copy.isnew('1');
+ copy.barcode( volumes_hash[ou_id][cn][i] );
+ copy.call_number( acn_id );
+ copy.circ_lib(ou_id);
+ /* FIXME -- use constants */
+ copy.deposit(0);
+ copy.price(0);
+ copy.deposit_amount(0);
+ copy.fine_level(2);
+ copy.loan_duration(2);
+ copy.location(1);
+ copy.status(0);
+ copy.circulate(get_db_true());
+ copy.holdable(get_db_true());
+ copy.opac_visible(get_db_true());
+ copy.ref(get_db_false());
+ copies.push( copy );
+ }
+ }
+ }
+
+ JSAN.use('util.window'); var win = new util.window();
+ if (copies.length > 0) {
+ JSAN.use('cat.util');
copies = cat.util.spawn_copy_editor( { 'edit' : 1, 'docid' : g.doc_id, 'copies' : copies });
try {
//case 1706 /* ITEM_BARCODE_EXISTS */ :
@@ -406,63 +406,63 @@ g.stash_and_close = function() {
} catch(E) {
g.error.standard_unexpected_error_alert($(catStrings).getString('staff.cat.volume_copy_creator.stash_and_close.tree_err2'),E);
}
- }
+ }
- if (typeof window.refresh == 'function') window.refresh();
+ if (typeof window.refresh == 'function') window.refresh();
- window.close();
+ window.close();
- } catch(E) {
- g.error.standard_unexpected_error_alert($(catStrings).getString('staff.cat.volume_copy_creator.stash_and_close.tree_err3'),E);
- }
+ } catch(E) {
+ g.error.standard_unexpected_error_alert($(catStrings).getString('staff.cat.volume_copy_creator.stash_and_close.tree_err3'),E);
+ }
}
g.load_prefs = function() {
- try {
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- JSAN.use('util.file'); var file = new util.file('volume_copy_creator.prefs');
- if (file._file.exists()) {
- var prefs = file.get_object(); file.close();
- if (prefs.check_barcodes) {
- if ( prefs.check_barcodes == 'false' ) {
- $('check_barcodes').checked = false;
- } else {
- $('check_barcodes').checked = prefs.check_barcodes;
- }
- } else {
- $('check_barcodes').checked = false;
- }
- if (prefs.print_labels) {
- if ( prefs.print_labels == 'false' ) {
- $('print_labels').checked = false;
- } else {
- $('print_labels').checked = prefs.print_labels;
- }
- } else {
- $('print_labels').checked = false;
- }
-
- }
- } catch(E) {
- g.error.standard_unexpected_error_alert($(catStrings).getString('staff.cat.volume_copy_creator.load_prefs.err_retrieving_prefs'),E);
-
- }
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+ JSAN.use('util.file'); var file = new util.file('volume_copy_creator.prefs');
+ if (file._file.exists()) {
+ var prefs = file.get_object(); file.close();
+ if (prefs.check_barcodes) {
+ if ( prefs.check_barcodes == 'false' ) {
+ $('check_barcodes').checked = false;
+ } else {
+ $('check_barcodes').checked = prefs.check_barcodes;
+ }
+ } else {
+ $('check_barcodes').checked = false;
+ }
+ if (prefs.print_labels) {
+ if ( prefs.print_labels == 'false' ) {
+ $('print_labels').checked = false;
+ } else {
+ $('print_labels').checked = prefs.print_labels;
+ }
+ } else {
+ $('print_labels').checked = false;
+ }
+
+ }
+ } catch(E) {
+ g.error.standard_unexpected_error_alert($(catStrings).getString('staff.cat.volume_copy_creator.load_prefs.err_retrieving_prefs'),E);
+
+ }
}
g.save_prefs = function () {
- try {
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- JSAN.use('util.file'); var file = new util.file('volume_copy_creator.prefs');
- file.set_object(
- {
- 'check_barcodes' : $('check_barcodes').checked,
- 'print_labels' : $('print_labels').checked,
- }
- );
- file.close();
- } catch(E) {
- g.error.standard_unexpected_error_alert($(catStrings).getString('staff.cat.volume_copy_creator.save_prefs.err_storing_prefs'),E);
- }
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+ JSAN.use('util.file'); var file = new util.file('volume_copy_creator.prefs');
+ file.set_object(
+ {
+ 'check_barcodes' : $('check_barcodes').checked,
+ 'print_labels' : $('print_labels').checked,
+ }
+ );
+ file.close();
+ } catch(E) {
+ g.error.standard_unexpected_error_alert($(catStrings).getString('staff.cat.volume_copy_creator.save_prefs.err_storing_prefs'),E);
+ }
}
diff --git a/Open-ILS/xul/staff_client/server/cat/z3950.js b/Open-ILS/xul/staff_client/server/cat/z3950.js
index 8ece2df239..b1ac1b025b 100644
--- a/Open-ILS/xul/staff_client/server/cat/z3950.js
+++ b/Open-ILS/xul/staff_client/server/cat/z3950.js
@@ -4,18 +4,18 @@ function $(id) { return document.getElementById(id); }
if (typeof cat == 'undefined') cat = {};
cat.z3950 = function (params) {
- try {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- JSAN.use('util.error'); this.error = new util.error();
- JSAN.use('util.network'); this.network = new util.network();
- } catch(E) {
- dump('cat.z3950: ' + E + '\n');
- }
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ JSAN.use('util.error'); this.error = new util.error();
+ JSAN.use('util.network'); this.network = new util.network();
+ } catch(E) {
+ dump('cat.z3950: ' + E + '\n');
+ }
}
cat.z3950.prototype = {
- 'creds_version' : 2,
+ 'creds_version' : 2,
'number_of_result_sets' : 0,
@@ -23,92 +23,92 @@ cat.z3950.prototype = {
'limit' : 10,
- 'init' : function( params ) {
+ 'init' : function( params ) {
- try {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- JSAN.use('util.widgets');
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ JSAN.use('util.widgets');
- var obj = this;
+ var obj = this;
JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
- obj.load_creds();
+ obj.load_creds();
- JSAN.use('circ.util');
- var columns = circ.util.columns(
- {
- 'tcn' : { 'hidden' : false },
- 'isbn' : { 'hidden' : false },
- 'title' : { 'hidden' : false, 'flex' : '1' },
- 'author' : { 'hidden' : false },
- 'edition' : { 'hidden' : false },
- 'pubdate' : { 'hidden' : false },
- 'publisher' : { 'hidden' : false },
- 'service' : { 'hidden' : false }
- }
+ JSAN.use('circ.util');
+ var columns = circ.util.columns(
+ {
+ 'tcn' : { 'hidden' : false },
+ 'isbn' : { 'hidden' : false },
+ 'title' : { 'hidden' : false, 'flex' : '1' },
+ 'author' : { 'hidden' : false },
+ 'edition' : { 'hidden' : false },
+ 'pubdate' : { 'hidden' : false },
+ 'publisher' : { 'hidden' : false },
+ 'service' : { 'hidden' : false }
+ }
);
- JSAN.use('util.list'); obj.list = new util.list('results');
- obj.list.init(
- {
- 'columns' : columns,
- 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
- 'on_select' : function(ev) {
- try {
- JSAN.use('util.functional');
- var sel = obj.list.retrieve_selection();
- document.getElementById('sel_clip').setAttribute('disabled', sel.length < 1);
- var list = util.functional.map_list(
- sel,
- function(o) { return o.getAttribute('retrieve_id'); }
- );
- obj.error.sdump('D_TRACE','cat/z3950: selection list = ' + js2JSON(list) );
- obj.controller.view.marc_import.disabled = false;
- obj.controller.view.marc_import.setAttribute('retrieve_id',list[0]);
- obj.data.init({'via':'stash'});
- if (obj.data.marked_record) {
- obj.controller.view.marc_import_overlay.disabled = false;
+ JSAN.use('util.list'); obj.list = new util.list('results');
+ obj.list.init(
+ {
+ 'columns' : columns,
+ 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
+ 'on_select' : function(ev) {
+ try {
+ JSAN.use('util.functional');
+ var sel = obj.list.retrieve_selection();
+ document.getElementById('sel_clip').setAttribute('disabled', sel.length < 1);
+ var list = util.functional.map_list(
+ sel,
+ function(o) { return o.getAttribute('retrieve_id'); }
+ );
+ obj.error.sdump('D_TRACE','cat/z3950: selection list = ' + js2JSON(list) );
+ obj.controller.view.marc_import.disabled = false;
+ obj.controller.view.marc_import.setAttribute('retrieve_id',list[0]);
+ obj.data.init({'via':'stash'});
+ if (obj.data.marked_record) {
+ obj.controller.view.marc_import_overlay.disabled = false;
} else {
- obj.controller.view.marc_import_overlay.disabled = true;
+ obj.controller.view.marc_import_overlay.disabled = true;
}
- obj.controller.view.marc_import_overlay.setAttribute('retrieve_id',list[0]);
- obj.controller.view.marc_view_btn.disabled = false;
- obj.controller.view.marc_view_btn.setAttribute('retrieve_id',list[0]);
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.obj_list_init.list_construction_error'),E);
- }
- },
- }
- );
+ obj.controller.view.marc_import_overlay.setAttribute('retrieve_id',list[0]);
+ obj.controller.view.marc_view_btn.disabled = false;
+ obj.controller.view.marc_view_btn.setAttribute('retrieve_id',list[0]);
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.obj_list_init.list_construction_error'),E);
+ }
+ },
+ }
+ );
- JSAN.use('util.controller'); obj.controller = new util.controller();
- obj.controller.init(
- {
- control_map : {
- 'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
- 'sel_clip' : [ ['command'], function() { obj.list.clipboard(); } ],
- 'cmd_z3950_csv_to_clipboard' : [ ['command'], function() { obj.list.dump_csv_to_clipboard(); } ],
+ JSAN.use('util.controller'); obj.controller = new util.controller();
+ obj.controller.init(
+ {
+ control_map : {
+ 'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
+ 'sel_clip' : [ ['command'], function() { obj.list.clipboard(); } ],
+ 'cmd_z3950_csv_to_clipboard' : [ ['command'], function() { obj.list.dump_csv_to_clipboard(); } ],
'cmd_z3950_csv_to_printer' : [ ['command'], function() { obj.list.dump_csv_to_printer(); } ],
'cmd_z3950_csv_to_file' : [ ['command'], function() { obj.list.dump_csv_to_file( { 'defaultFileName' : 'z3950_results.txt' } ); } ],
- 'cmd_broken' : [
- ['command'],
- function() { alert('Not Yet Implemented'); }
- ],
- 'result_message' : [['render'],function(e){return function(){};}],
- 'clear' : [
- ['command'],
- function() {
- obj.clear();
- }
- ],
- 'save_creds' : [
- ['command'],
- function() {
- obj.save_creds();
+ 'cmd_broken' : [
+ ['command'],
+ function() { alert('Not Yet Implemented'); }
+ ],
+ 'result_message' : [['render'],function(e){return function(){};}],
+ 'clear' : [
+ ['command'],
+ function() {
+ obj.clear();
+ }
+ ],
+ 'save_creds' : [
+ ['command'],
+ function() {
+ obj.save_creds();
setTimeout( function() { obj.focus(); }, 0 );
- }
- ],
+ }
+ ],
'marc_view_btn' : [
['render'],
function(e) {
@@ -116,39 +116,39 @@ cat.z3950.prototype = {
e.setAttribute('accesskey', $("catStrings").getString('staff.cat.z3950.marc_view.accesskey'));
}
],
- 'marc_view' : [
- ['command'],
- function(ev) {
- try {
- var n = obj.controller.view.marc_view_btn;
- if (n.getAttribute('toggle') == '1') {
- document.getElementById('deck').selectedIndex = 0;
- n.setAttribute('toggle','0');
- n.setAttribute('label', $("catStrings").getString('staff.cat.z3950.marc_view.label'));
- n.setAttribute('accesskey', $("catStrings").getString('staff.cat.z3950.marc_view.accesskey'));
- document.getElementById('results').focus();
- } else {
- document.getElementById('deck').selectedIndex = 1;
- n.setAttribute('toggle','1');
- n.setAttribute('label', $("catStrings").getString('staff.cat.z3950.results_view.label'));
- n.setAttribute('accesskey', $("catStrings").getString('staff.cat.z3950.results_view.accesskey'));
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- var f = get_contentWindow(document.getElementById('marc_frame'));
+ 'marc_view' : [
+ ['command'],
+ function(ev) {
+ try {
+ var n = obj.controller.view.marc_view_btn;
+ if (n.getAttribute('toggle') == '1') {
+ document.getElementById('deck').selectedIndex = 0;
+ n.setAttribute('toggle','0');
+ n.setAttribute('label', $("catStrings").getString('staff.cat.z3950.marc_view.label'));
+ n.setAttribute('accesskey', $("catStrings").getString('staff.cat.z3950.marc_view.accesskey'));
+ document.getElementById('results').focus();
+ } else {
+ document.getElementById('deck').selectedIndex = 1;
+ n.setAttribute('toggle','1');
+ n.setAttribute('label', $("catStrings").getString('staff.cat.z3950.results_view.label'));
+ n.setAttribute('accesskey', $("catStrings").getString('staff.cat.z3950.results_view.accesskey'));
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+ var f = get_contentWindow(document.getElementById('marc_frame'));
var retrieve_id = n.getAttribute('retrieve_id');
var result_idx = retrieve_id.split('-')[0];
var record_idx = retrieve_id.split('-')[1];
- f.xulG = { 'marcxml' : obj.result_set[result_idx].records[ record_idx ].marcxml };
- f.my_init();
- f.document.body.firstChild.focus();
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.obj_controller_init.marc_view_error'),E);
- }
- },
- ],
- 'marc_import' : [
- ['command'],
- function() {
+ f.xulG = { 'marcxml' : obj.result_set[result_idx].records[ record_idx ].marcxml };
+ f.my_init();
+ f.document.body.firstChild.focus();
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.obj_controller_init.marc_view_error'),E);
+ }
+ },
+ ],
+ 'marc_import' : [
+ ['command'],
+ function() {
try {
var retrieve_id = obj.controller.view.marc_import.getAttribute('retrieve_id');
var result_idx = retrieve_id.split('-')[0];
@@ -158,14 +158,14 @@ cat.z3950.prototype = {
obj.result_set[ result_idx ].records[ record_idx ].service /* FIXME: we want biblio_source here */
);
} catch(E) {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.obj_controller_init.marc_import_error'),E);
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.obj_controller_init.marc_import_error'),E);
}
- },
- ],
- 'marc_import_overlay' : [
- ['command'],
- function() {
- try {
+ },
+ ],
+ 'marc_import_overlay' : [
+ ['command'],
+ function() {
+ try {
var retrieve_id = obj.controller.view.marc_import_overlay.getAttribute('retrieve_id');
var result_idx = retrieve_id.split('-')[0];
var record_idx = retrieve_id.split('-')[1];
@@ -173,17 +173,17 @@ cat.z3950.prototype = {
obj.result_set[ result_idx ].records[ record_idx ].marcxml,
obj.result_set[ result_idx ].records[ record_idx ].service /* FIXME: we want biblio_source here */
);
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.obj_controller_init.marc_import_overlay_error'),E);
- }
- },
- ],
- 'search' : [
- ['command'],
- function() {
- obj.initial_search();
- },
- ],
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.obj_controller_init.marc_import_overlay_error'),E);
+ }
+ },
+ ],
+ 'search' : [
+ ['command'],
+ function() {
+ obj.initial_search();
+ },
+ ],
'raw_search' : [
['command'],
function() {
@@ -195,12 +195,12 @@ cat.z3950.prototype = {
if (raw) obj.initial_raw_search(raw);
}
],
- 'page_next' : [
- ['command'],
- function() {
- obj.page_next();
- },
- ],
+ 'page_next' : [
+ ['command'],
+ function() {
+ obj.page_next();
+ },
+ ],
'toggle_form_btn' : [
['render'],
function(e) {
@@ -214,7 +214,7 @@ cat.z3950.prototype = {
function() {
var x = document.getElementById('top_pane');
document.getElementById('splitter_grippy2').doCommand();
- var n = obj.controller.view.toggle_form_btn;
+ var n = obj.controller.view.toggle_form_btn;
if (x.collapsed) {
n.setAttribute('image',"/xul/server/skin/media/images/down_arrow.gif");
n.setAttribute('label',$("catStrings").getString('staff.cat.z3950.unhide_top_pane.label'));
@@ -242,13 +242,13 @@ cat.z3950.prototype = {
}
}
],
- 'service_rows' : [
- ['render'],
- function(e) {
- return function() {
- try {
+ 'service_rows' : [
+ ['render'],
+ function(e) {
+ return function() {
+ try {
- function handle_switch(node) {
+ function handle_switch(node) {
try {
$('search').setAttribute('disabled','true'); $('raw_search').setAttribute('disabled','true');
obj.active_services = [];
@@ -332,18 +332,18 @@ cat.z3950.prototype = {
}
}
} catch(E) {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.obj_controller_init.search_fields_error'),E);
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.obj_controller_init.search_fields_error'),E);
}
- }
+ }
document.getElementById('native-evergreen-catalog_service').addEventListener('command',handle_switch,false);
- var robj = obj.network.simple_request(
- 'RETRIEVE_Z3950_SERVICES',
- [ ses() ]
- );
- if (typeof robj.ilsevent != 'undefined') throw(robj);
- obj.services = robj;
+ var robj = obj.network.simple_request(
+ 'RETRIEVE_Z3950_SERVICES',
+ [ ses() ]
+ );
+ if (typeof robj.ilsevent != 'undefined') throw(robj);
+ obj.services = robj;
var x = document.getElementById('service_rows');
var services = new Array();
for (var i in obj.services) {
@@ -384,7 +384,7 @@ cat.z3950.prototype = {
}
//obj.services[ 'native-evergreen-catalog' ] = { 'attrs' : { 'author' : {}, 'title' : {} } };
setTimeout(
- function() {
+ function() {
if (obj.creds.hosts[ obj.data.server_unadorned ]) {
for (var i = 0; i < obj.creds.hosts[ obj.data.server_unadorned ].default_services.length; i++) {
var x = document.getElementById(obj.creds.hosts[ obj.data.server_unadorned ].default_services[i]+'_service');
@@ -395,19 +395,19 @@ cat.z3950.prototype = {
if (x) x.checked = true;
}
handle_switch();
- },0
- );
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.obj_controller_init.z39_service_error'),E);
- }
- }
- }
- ],
- }
- }
- );
+ },0
+ );
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.obj_controller_init.z39_service_error'),E);
+ }
+ }
+ }
+ ],
+ }
+ }
+ );
- obj.controller.render();
+ obj.controller.render();
setTimeout( function() { obj.focus(); }, 0 );
@@ -415,7 +415,7 @@ cat.z3950.prototype = {
function() {
obj.data.init({'via':'stash'});
if (obj.data.marked_record) {
- var sel = obj.list.retrieve_selection();
+ var sel = obj.list.retrieve_selection();
if (sel.length > 0) { obj.controller.view.marc_import_overlay.disabled = false; }
if ($("overlay_tcn_indicator")) {
if (obj.data.marked_record_mvr) {
@@ -433,81 +433,81 @@ cat.z3950.prototype = {
}, 2000
);
- } catch(E) {
- this.error.sdump('D_ERROR','cat.z3950.init: ' + E + '\n');
- }
- },
+ } catch(E) {
+ this.error.sdump('D_ERROR','cat.z3950.init: ' + E + '\n');
+ }
+ },
- 'focus' : function() {
- var obj = this;
+ 'focus' : function() {
+ var obj = this;
var focus_me; var or_focus_me;
for (var i = 0; i < obj.active_services.length; i++) {
if (obj.creds.hosts[ obj.data.server_unadorned ] && obj.creds.hosts[ obj.data.server_unadorned ].services[ obj.active_services[i] ]) {
- var x = obj.creds.hosts[ obj.data.server_unadorned ].services[ obj.active_services[i] ].default_attr;
+ var x = obj.creds.hosts[ obj.data.server_unadorned ].services[ obj.active_services[i] ].default_attr;
if (x) { focus_me = x; break; }
}
if (obj.services[ obj.active_services[i] ]) for (var i in obj.services[ obj.active_services[i] ].attr) { or_focus_me = i; }
}
if (! focus_me) focus_me = or_focus_me;
- var xx = document.getElementById(focus_me+'_input'); if (xx) xx.focus();
- },
+ var xx = document.getElementById(focus_me+'_input'); if (xx) xx.focus();
+ },
- 'clear' : function() {
- var obj = this;
- var nl = document.getElementsByAttribute('mytype','search_class');
- for (var i = 0; i < nl.length; i++) { nl[i].value = ''; nl[i].setAttribute('value',''); }
- obj.focus();
- },
+ 'clear' : function() {
+ var obj = this;
+ var nl = document.getElementsByAttribute('mytype','search_class');
+ for (var i = 0; i < nl.length; i++) { nl[i].value = ''; nl[i].setAttribute('value',''); }
+ obj.focus();
+ },
- 'search_params' : {},
+ 'search_params' : {},
- 'initial_search' : function() {
- try {
- var obj = this;
+ 'initial_search' : function() {
+ try {
+ var obj = this;
obj.result_set = []; obj.number_of_result_sets = 0;
- JSAN.use('util.widgets');
- util.widgets.remove_children( obj.controller.view.result_message );
- var x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
+ JSAN.use('util.widgets');
+ util.widgets.remove_children( obj.controller.view.result_message );
+ var x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
if (obj.active_services.length < 1) {
- x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.initial_search.no_search_selection')));
+ x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.initial_search.no_search_selection')));
return;
}
- x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.initial_search.searching')));
- obj.search_params = {}; obj.list.clear();
- obj.controller.view.page_next.disabled = true;
- obj.controller.view.cmd_z3950_csv_to_file.setAttribute('disabled','true');
- obj.controller.view.cmd_z3950_csv_to_clipboard.setAttribute('disabled','true');
- obj.controller.view.cmd_z3950_csv_to_printer.setAttribute('disabled','true');
+ x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.initial_search.searching')));
+ obj.search_params = {}; obj.list.clear();
+ obj.controller.view.page_next.disabled = true;
+ obj.controller.view.cmd_z3950_csv_to_file.setAttribute('disabled','true');
+ obj.controller.view.cmd_z3950_csv_to_clipboard.setAttribute('disabled','true');
+ obj.controller.view.cmd_z3950_csv_to_printer.setAttribute('disabled','true');
- obj.search_params.service_array = [];
- obj.search_params.username_array = [];
- obj.search_params.password_array = [];
+ obj.search_params.service_array = [];
+ obj.search_params.username_array = [];
+ obj.search_params.password_array = [];
for (var i = 0; i < obj.active_services.length; i++) {
obj.search_params.service_array.push( obj.active_services[i] );
obj.search_params.username_array.push( document.getElementById( obj.active_services[i]+'_username' ).value );
obj.search_params.password_array.push( document.getElementById( obj.active_services[i]+'_password' ).value );
}
- obj.search_params.limit = Math.ceil( obj.limit / obj.active_services.length );
- obj.search_params.offset = 0;
+ obj.search_params.limit = Math.ceil( obj.limit / obj.active_services.length );
+ obj.search_params.offset = 0;
- obj.search_params.search = {};
- var nl = document.getElementsByAttribute('mytype','search_class');
- var count = 0;
- for (var i = 0; i < nl.length; i++) {
- if (nl[i].disabled) continue;
- if (nl[i].value == '') continue;
- count++;
- obj.search_params.search[ nl[i].getAttribute('search_class') ] = nl[i].value;
- }
- if (count>0) {
- obj.search();
- } else {
- util.widgets.remove_children( obj.controller.view.result_message );
- }
- } catch(E) {
- this.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.initial_search.failed_search'),E);
- }
- },
+ obj.search_params.search = {};
+ var nl = document.getElementsByAttribute('mytype','search_class');
+ var count = 0;
+ for (var i = 0; i < nl.length; i++) {
+ if (nl[i].disabled) continue;
+ if (nl[i].value == '') continue;
+ count++;
+ obj.search_params.search[ nl[i].getAttribute('search_class') ] = nl[i].value;
+ }
+ if (count>0) {
+ obj.search();
+ } else {
+ util.widgets.remove_children( obj.controller.view.result_message );
+ }
+ } catch(E) {
+ this.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.initial_search.failed_search'),E);
+ }
+ },
'initial_raw_search' : function(raw) {
try {
@@ -517,100 +517,100 @@ cat.z3950.prototype = {
util.widgets.remove_children( obj.controller.view.result_message );
var x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
if (obj.active_services.length < 1) {
- x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.initial_search.no_search_selection')));
+ x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.initial_search.no_search_selection')));
return;
}
if (obj.active_services.length > 1) {
- x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.initial_search.too_many_selections')));
+ x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.initial_search.too_many_selections')));
return;
}
if (obj.active_services[0] == 'native-evergreen-catalog') {
- x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.initial_search.raw_search_unsupported_for_native_catalog')));
+ x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.initial_search.raw_search_unsupported_for_native_catalog')));
return;
}
- x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.initial_search.searching')));
- obj.search_params = {}; obj.list.clear();
- obj.controller.view.page_next.disabled = true;
- obj.controller.view.cmd_z3950_csv_to_file.setAttribute('disabled','true');
- obj.controller.view.cmd_z3950_csv_to_clipboard.setAttribute('disabled','true');
- obj.controller.view.cmd_z3950_csv_to_printer.setAttribute('disabled','true');
+ x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.initial_search.searching')));
+ obj.search_params = {}; obj.list.clear();
+ obj.controller.view.page_next.disabled = true;
+ obj.controller.view.cmd_z3950_csv_to_file.setAttribute('disabled','true');
+ obj.controller.view.cmd_z3950_csv_to_clipboard.setAttribute('disabled','true');
+ obj.controller.view.cmd_z3950_csv_to_printer.setAttribute('disabled','true');
- obj.search_params.service_array = [];
- obj.search_params.username_array = [];
- obj.search_params.password_array = [];
+ obj.search_params.service_array = [];
+ obj.search_params.username_array = [];
+ obj.search_params.password_array = [];
for (var i = 0; i < obj.active_services.length; i++) {
obj.search_params.service_array.push( obj.active_services[i] );
obj.search_params.username_array.push( document.getElementById( obj.active_services[i]+'_username' ).value );
obj.search_params.password_array.push( document.getElementById( obj.active_services[i]+'_password' ).value );
}
- obj.search_params.limit = Math.ceil( obj.limit / obj.active_services.length );
- obj.search_params.offset = 0;
+ obj.search_params.limit = Math.ceil( obj.limit / obj.active_services.length );
+ obj.search_params.offset = 0;
obj.search_params.query = raw;
obj.search();
} catch(E) {
- this.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.initial_search.failed_search'),E);
+ this.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.initial_search.failed_search'),E);
}
},
- 'page_next' : function() {
- try {
- var obj = this;
- JSAN.use('util.widgets');
- util.widgets.remove_children( obj.controller.view.result_message );
- var x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
- x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.page_next.more_results')));
- obj.search_params.offset += obj.search_params.limit;
- obj.search();
- } catch(E) {
- this.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.page_next.subsequent_search_error'),E);
- }
- },
+ 'page_next' : function() {
+ try {
+ var obj = this;
+ JSAN.use('util.widgets');
+ util.widgets.remove_children( obj.controller.view.result_message );
+ var x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
+ x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.page_next.more_results')));
+ obj.search_params.offset += obj.search_params.limit;
+ obj.search();
+ } catch(E) {
+ this.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.page_next.subsequent_search_error'),E);
+ }
+ },
- 'search' : function() {
- try {
- var obj = this;
- var method;
- if (typeof obj.search_params.query == 'undefined') {
- method = 'FM_BLOB_RETRIEVE_VIA_Z3950_SEARCH';
+ 'search' : function() {
+ try {
+ var obj = this;
+ var method;
+ if (typeof obj.search_params.query == 'undefined') {
+ method = 'FM_BLOB_RETRIEVE_VIA_Z3950_SEARCH';
obj.search_params.service = obj.search_params.service_array;
obj.search_params.username = obj.search_params.username_array;
obj.search_params.password = obj.search_params.password_array;
- } else {
- method = 'FM_BLOB_RETRIEVE_VIA_Z3950_RAW_SEARCH';
+ } else {
+ method = 'FM_BLOB_RETRIEVE_VIA_Z3950_RAW_SEARCH';
obj.search_params.service = obj.search_params.service_array[0];
obj.search_params.username = obj.search_params.username_array[0];
obj.search_params.password = obj.search_params.password_array[0];
- }
- obj.network.simple_request(
- method,
- [ ses(), obj.search_params ],
- function(req) {
- obj.handle_results(req.getResultObject())
- }
- );
- document.getElementById('deck').selectedIndex = 0;
- } catch(E) {
- this.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.search.search_error'),E);
- }
- },
+ }
+ obj.network.simple_request(
+ method,
+ [ ses(), obj.search_params ],
+ function(req) {
+ obj.handle_results(req.getResultObject())
+ }
+ );
+ document.getElementById('deck').selectedIndex = 0;
+ } catch(E) {
+ this.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.search.search_error'),E);
+ }
+ },
- 'handle_results' : function(results) {
- var obj = this;
- try {
- JSAN.use('util.widgets');
- util.widgets.remove_children( obj.controller.view.result_message ); var x;
- if (results == null) {
- x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
- x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.handle_results.null_server_error')));
- return;
- }
- if (typeof results.ilsevent != 'undefined') {
- x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
- x.appendChild( document.createTextNode($("catStrings").getFormattedString('staff.cat.z3950.handle_results.server_error', [results.textcode, results.desc])));
- return;
- }
+ 'handle_results' : function(results) {
+ var obj = this;
+ try {
+ JSAN.use('util.widgets');
+ util.widgets.remove_children( obj.controller.view.result_message ); var x;
+ if (results == null) {
+ x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
+ x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.handle_results.null_server_error')));
+ return;
+ }
+ if (typeof results.ilsevent != 'undefined') {
+ x = document.createElement('description'); obj.controller.view.result_message.appendChild(x);
+ x.appendChild( document.createTextNode($("catStrings").getFormattedString('staff.cat.z3950.handle_results.server_error', [results.textcode, results.desc])));
+ return;
+ }
obj.controller.view.cmd_z3950_csv_to_file.setAttribute('disabled','false');
obj.controller.view.cmd_z3950_csv_to_clipboard.setAttribute('disabled','false');
obj.controller.view.cmd_z3950_csv_to_printer.setAttribute('disabled','false');
@@ -684,32 +684,32 @@ cat.z3950.prototype = {
);
}
- } catch(E) {
- this.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.handle_results.search_result_error'),E);
- }
- },
+ } catch(E) {
+ this.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.handle_results.search_result_error'),E);
+ }
+ },
- 'replace_tab_with_opac' : function(doc_id) {
- var opac_url = xulG.url_prefix( urls.opac_rdetail ) + '?r=' + doc_id;
- var content_params = {
- 'session' : ses(),
- 'authtime' : ses('authtime'),
- 'opac_url' : opac_url,
- };
- xulG.set_tab(
- xulG.url_prefix(urls.XUL_OPAC_WRAPPER),
- {'tab_name': $("catStrings").getString('staff.cat.z3950.replace_tab_with_opac.tab_name')},
- content_params
- );
- },
+ 'replace_tab_with_opac' : function(doc_id) {
+ var opac_url = xulG.url_prefix( urls.opac_rdetail ) + '?r=' + doc_id;
+ var content_params = {
+ 'session' : ses(),
+ 'authtime' : ses('authtime'),
+ 'opac_url' : opac_url,
+ };
+ xulG.set_tab(
+ xulG.url_prefix(urls.XUL_OPAC_WRAPPER),
+ {'tab_name': $("catStrings").getString('staff.cat.z3950.replace_tab_with_opac.tab_name')},
+ content_params
+ );
+ },
- 'spawn_marc_editor' : function(my_marcxml,biblio_source) {
- var obj = this;
- xulG.new_tab(
- xulG.url_prefix(urls.XUL_MARC_EDIT),
- { 'tab_name' : 'MARC Editor' },
- {
- 'record' : { 'marc' : my_marcxml },
+ 'spawn_marc_editor' : function(my_marcxml,biblio_source) {
+ var obj = this;
+ xulG.new_tab(
+ xulG.url_prefix(urls.XUL_MARC_EDIT),
+ { 'tab_name' : 'MARC Editor' },
+ {
+ 'record' : { 'marc' : my_marcxml },
'fast_add_item' : function(doc_id,cn_label,cp_barcode) {
try {
JSAN.use('cat.util'); return cat.util.fast_item_add(doc_id,cn_label,cp_barcode);
@@ -717,43 +717,43 @@ cat.z3950.prototype = {
alert(E);
}
},
- 'save' : {
- 'label' : 'Import Record',
- 'func' : function (new_marcxml) {
- try {
- var r = obj.network.simple_request('MARC_XML_RECORD_IMPORT', [ ses(), new_marcxml, biblio_source ]);
- if (typeof r.ilsevent != 'undefined') {
- switch(Number(r.ilsevent)) {
- case 1704 /* TCN_EXISTS */ :
- var msg = $("catStrings").getFormattedString('staff.cat.z3950.spawn_marc_editor.same_tcn', [r.payload.tcn]);
- var title = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor.title');
- var btn1 = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor.btn1_overlay');
- var btn2 = typeof r.payload.new_tcn == 'undefined' ? null : $("catStrings").getFormattedString('staff.cat.z3950.spawn_marc_editor.btn2_import', [r.payload.new_tcn]);
- if (btn2) {
- obj.data.init({'via':'stash'});
- var robj = obj.network.simple_request(
- 'PERM_CHECK',[
- ses(),
- obj.data.list.au[0].id(),
- obj.data.list.au[0].ws_ou(),
- [ 'ALLOW_ALT_TCN' ]
- ]
- );
- if (typeof robj.ilsevent != 'undefined') {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.permission_error'),E);
- }
- if (robj.length != 0) btn2 = null;
- }
- var btn3 = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor.btn3_cancel_import');
- var p = obj.error.yns_alert(msg,title,btn1,btn2,btn3,$("catStrings").getString('staff.cat.z3950.spawn_marc_editor.confirm_action'));
- obj.error.sdump('D_ERROR','option ' + p + 'chosen');
- switch(p) {
- case 0:
- var r3 = obj.network.simple_request('MARC_XML_RECORD_UPDATE', [ ses(), r.payload.dup_record, new_marcxml, biblio_source ]);
- if (typeof r3.ilsevent != 'undefined') {
- throw(r3);
- } else {
- alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.successful_overlay'));
+ 'save' : {
+ 'label' : 'Import Record',
+ 'func' : function (new_marcxml) {
+ try {
+ var r = obj.network.simple_request('MARC_XML_RECORD_IMPORT', [ ses(), new_marcxml, biblio_source ]);
+ if (typeof r.ilsevent != 'undefined') {
+ switch(Number(r.ilsevent)) {
+ case 1704 /* TCN_EXISTS */ :
+ var msg = $("catStrings").getFormattedString('staff.cat.z3950.spawn_marc_editor.same_tcn', [r.payload.tcn]);
+ var title = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor.title');
+ var btn1 = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor.btn1_overlay');
+ var btn2 = typeof r.payload.new_tcn == 'undefined' ? null : $("catStrings").getFormattedString('staff.cat.z3950.spawn_marc_editor.btn2_import', [r.payload.new_tcn]);
+ if (btn2) {
+ obj.data.init({'via':'stash'});
+ var robj = obj.network.simple_request(
+ 'PERM_CHECK',[
+ ses(),
+ obj.data.list.au[0].id(),
+ obj.data.list.au[0].ws_ou(),
+ [ 'ALLOW_ALT_TCN' ]
+ ]
+ );
+ if (typeof robj.ilsevent != 'undefined') {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.permission_error'),E);
+ }
+ if (robj.length != 0) btn2 = null;
+ }
+ var btn3 = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor.btn3_cancel_import');
+ var p = obj.error.yns_alert(msg,title,btn1,btn2,btn3,$("catStrings").getString('staff.cat.z3950.spawn_marc_editor.confirm_action'));
+ obj.error.sdump('D_ERROR','option ' + p + 'chosen');
+ switch(p) {
+ case 0:
+ var r3 = obj.network.simple_request('MARC_XML_RECORD_UPDATE', [ ses(), r.payload.dup_record, new_marcxml, biblio_source ]);
+ if (typeof r3.ilsevent != 'undefined') {
+ throw(r3);
+ } else {
+ alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.successful_overlay'));
return {
'id' : r3.id(),
'on_complete' : function() {
@@ -764,18 +764,18 @@ cat.z3950.prototype = {
}
}
};
- }
- break;
- case 1:
- var r2 = obj.network.request(
- api.MARC_XML_RECORD_IMPORT.app,
- api.MARC_XML_RECORD_IMPORT.method + '.override',
- [ ses(), new_marcxml, biblio_source ]
- );
- if (typeof r2.ilsevent != 'undefined') {
- throw(r2);
- } else {
- alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.successful_import_with_new_tcn'));
+ }
+ break;
+ case 1:
+ var r2 = obj.network.request(
+ api.MARC_XML_RECORD_IMPORT.app,
+ api.MARC_XML_RECORD_IMPORT.method + '.override',
+ [ ses(), new_marcxml, biblio_source ]
+ );
+ if (typeof r2.ilsevent != 'undefined') {
+ throw(r2);
+ } else {
+ alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.successful_import_with_new_tcn'));
return {
'id' : r2.id(),
'on_complete' : function() {
@@ -786,21 +786,21 @@ cat.z3950.prototype = {
}
}
};
- }
- break;
- case 2:
- default:
- alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.import_cancelled'));
- break;
- }
- break;
- default:
- throw(r);
- break;
- }
- } else {
- alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.successful_import'));
- return {
+ }
+ break;
+ case 2:
+ default:
+ alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.import_cancelled'));
+ break;
+ }
+ break;
+ default:
+ throw(r);
+ break;
+ }
+ } else {
+ alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.successful_import'));
+ return {
'id' : r.id(),
'on_complete' : function() {
try {
@@ -810,66 +810,66 @@ cat.z3950.prototype = {
}
}
};
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.import_error'),E);
- }
- }
- }
- }
- );
- },
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.import_error'),E);
+ }
+ }
+ }
+ }
+ );
+ },
- 'confirm_overlay' : function(record_ids) {
- var obj = this; // JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- var top_xml = '';
- top_xml += ''+$("catStrings").getString('staff.cat.z3950.confirm_overlay.description')+' ';
- top_xml += ' ';
- top_xml += ' ';
+ 'confirm_overlay' : function(record_ids) {
+ var obj = this; // JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
+ var top_xml = '';
+ top_xml += ''+$("catStrings").getString('staff.cat.z3950.confirm_overlay.description')+' ';
+ top_xml += ' ';
+ top_xml += ' ';
- var xml = ' ';
+ // data.temp_merge_top = top_xml; data.stash('temp_merge_top');
+ // data.temp_merge_mid = xml; data.stash('temp_merge_mid');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ // + '?xml_in_stash=temp_merge_mid'
+ // + '&top_xml_in_stash=temp_merge_top'
+ // + '&title=' + window.escape('Record Overlay'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
+ { 'top_xml' : top_xml, 'xml' : xml, 'title' : $("catStrings").getString('staff.cat.z3950.confirm_overlay.title') }
+ );
+ //data.stash_retrieve();
+ if (fancy_prompt_data.fancy_status == 'incomplete') { alert($("catStrings").getString('staff.cat.z3950.confirm_overlay.aborted')); return false; }
+ return true;
+ },
- 'spawn_marc_editor_for_overlay' : function(my_marcxml,biblio_source) {
- var obj = this;
- obj.data.init({'via':'stash'});
- if (!obj.data.marked_record) {
- alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.try_again'));
- return;
- }
+ 'spawn_marc_editor_for_overlay' : function(my_marcxml,biblio_source) {
+ var obj = this;
+ obj.data.init({'via':'stash'});
+ if (!obj.data.marked_record) {
+ alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.try_again'));
+ return;
+ }
- xulG.new_tab(
- xulG.url_prefix(urls.XUL_MARC_EDIT),
- { 'tab_name' : $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.tab_name') },
- {
- 'record' : { 'marc' : my_marcxml },
+ xulG.new_tab(
+ xulG.url_prefix(urls.XUL_MARC_EDIT),
+ { 'tab_name' : $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.tab_name') },
+ {
+ 'record' : { 'marc' : my_marcxml },
'fast_add_item' : function(doc_id,cn_label,cp_barcode) {
try {
JSAN.use('cat.util'); cat.util.fast_item_add(doc_id,cn_label,cp_barcode);
@@ -877,47 +877,47 @@ cat.z3950.prototype = {
alert(E);
}
},
- 'save' : {
- 'label' : $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.overlay_record_label'),
- 'func' : function (new_marcxml) {
- try {
- if (! obj.confirm_overlay( [ obj.data.marked_record ] ) ) { return; }
- var r = obj.network.simple_request('MARC_XML_RECORD_REPLACE', [ ses(), obj.data.marked_record, new_marcxml, biblio_source ]);
- if (typeof r.ilsevent != 'undefined') {
- switch(Number(r.ilsevent)) {
- case 1704 /* TCN_EXISTS */ :
- var msg = $("catStrings").getFormattedString('staff.cat.z3950.spawn_marc_editor_for_overlay.same_tcn', [r.payload.tcn]);
- var title = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.import_collision');
- var btn1 = typeof r.payload.new_tcn == 'undefined' ? null : $("catStrings").getFormattedString('staff.cat.z3950.spawn_marc_editor_for_overlay.btn1_overlay', [r.payload.new_tcn]);
- if (btn1) {
- var robj = obj.network.simple_request(
- 'PERM_CHECK',[
- ses(),
- obj.data.list.au[0].id(),
- obj.data.list.au[0].ws_ou(),
- [ 'ALLOW_ALT_TCN' ]
- ]
- );
- if (typeof robj.ilsevent != 'undefined') {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.permission_error'),E);
- }
- if (robj.length != 0) btn1 = null;
- }
- var btn2 = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.btn2_cancel');
- var p = obj.error.yns_alert(msg,title,btn1,btn2,null, $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.confirm_action'));
- obj.error.sdump('D_ERROR','option ' + p + 'chosen');
- switch(p) {
- case 0:
- var r2 = obj.network.request(
- api.MARC_XML_RECORD_REPLACE.app,
- api.MARC_XML_RECORD_REPLACE.method + '.override',
- [ ses(), obj.data.marked_record, new_marcxml, biblio_source ]
- );
- if (typeof r2.ilsevent != 'undefined') {
- throw(r2);
- } else {
- alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.successful_overlay_with_new_TCN'));
- return {
+ 'save' : {
+ 'label' : $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.overlay_record_label'),
+ 'func' : function (new_marcxml) {
+ try {
+ if (! obj.confirm_overlay( [ obj.data.marked_record ] ) ) { return; }
+ var r = obj.network.simple_request('MARC_XML_RECORD_REPLACE', [ ses(), obj.data.marked_record, new_marcxml, biblio_source ]);
+ if (typeof r.ilsevent != 'undefined') {
+ switch(Number(r.ilsevent)) {
+ case 1704 /* TCN_EXISTS */ :
+ var msg = $("catStrings").getFormattedString('staff.cat.z3950.spawn_marc_editor_for_overlay.same_tcn', [r.payload.tcn]);
+ var title = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.import_collision');
+ var btn1 = typeof r.payload.new_tcn == 'undefined' ? null : $("catStrings").getFormattedString('staff.cat.z3950.spawn_marc_editor_for_overlay.btn1_overlay', [r.payload.new_tcn]);
+ if (btn1) {
+ var robj = obj.network.simple_request(
+ 'PERM_CHECK',[
+ ses(),
+ obj.data.list.au[0].id(),
+ obj.data.list.au[0].ws_ou(),
+ [ 'ALLOW_ALT_TCN' ]
+ ]
+ );
+ if (typeof robj.ilsevent != 'undefined') {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.permission_error'),E);
+ }
+ if (robj.length != 0) btn1 = null;
+ }
+ var btn2 = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.btn2_cancel');
+ var p = obj.error.yns_alert(msg,title,btn1,btn2,null, $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.confirm_action'));
+ obj.error.sdump('D_ERROR','option ' + p + 'chosen');
+ switch(p) {
+ case 0:
+ var r2 = obj.network.request(
+ api.MARC_XML_RECORD_REPLACE.app,
+ api.MARC_XML_RECORD_REPLACE.method + '.override',
+ [ ses(), obj.data.marked_record, new_marcxml, biblio_source ]
+ );
+ if (typeof r2.ilsevent != 'undefined') {
+ throw(r2);
+ } else {
+ alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.successful_overlay_with_new_TCN'));
+ return {
'id' : r2.id(),
'on_complete' : function() {
try {
@@ -927,20 +927,20 @@ cat.z3950.prototype = {
}
}
};
- }
- break;
- case 1:
- default:
- alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.cancelled_overlay'));
- break;
- }
- break;
- default:
- throw(r);
- break;
- }
- } else {
- alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.success_overlay'));
+ }
+ break;
+ case 1:
+ default:
+ alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.cancelled_overlay'));
+ break;
+ }
+ break;
+ default:
+ throw(r);
+ break;
+ }
+ } else {
+ alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.success_overlay'));
return {
'id' : r.id(),
'on_complete' : function() {
@@ -951,39 +951,39 @@ cat.z3950.prototype = {
}
}
};
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.overlay_error'),E);
- }
- }
- }
- }
- );
- },
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.overlay_error'),E);
+ }
+ }
+ }
+ }
+ );
+ },
- 'load_creds' : function() {
- var obj = this;
- try {
- obj.creds = { 'version' : g.save_version, 'services' : {}, 'hosts' : {} };
- /*
- {
- 'version' : xx,
- 'default_service' : xx,
- 'services' : {
+ 'load_creds' : function() {
+ var obj = this;
+ try {
+ obj.creds = { 'version' : g.save_version, 'services' : {}, 'hosts' : {} };
+ /*
+ {
+ 'version' : xx,
+ 'default_service' : xx,
+ 'services' : {
- 'xx' : {
- 'username' : xx,
- 'password' : xx,
- 'default_attr' : xx,
- },
+ 'xx' : {
+ 'username' : xx,
+ 'password' : xx,
+ 'default_attr' : xx,
+ },
- 'xx' : {
- 'username' : xx,
- 'password' : xx,
- 'default_attr' : xx,
- },
- },
+ 'xx' : {
+ 'username' : xx,
+ 'password' : xx,
+ 'default_attr' : xx,
+ },
+ },
// new in version 2
'hosts' : {
'xxxx' : {
@@ -1004,56 +1004,56 @@ cat.z3950.prototype = {
},
}
}
- }
- */
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- JSAN.use('util.file'); var file = new util.file('z3950_store');
- if (file._file.exists()) {
- var creds = file.get_object(); file.close();
- if (typeof creds.version != 'undefined') {
- if (creds.version >= obj.creds_version) { /* so apparently, this guy is assuming that future versions will be backwards compatible */
+ }
+ */
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+ JSAN.use('util.file'); var file = new util.file('z3950_store');
+ if (file._file.exists()) {
+ var creds = file.get_object(); file.close();
+ if (typeof creds.version != 'undefined') {
+ if (creds.version >= obj.creds_version) { /* so apparently, this guy is assuming that future versions will be backwards compatible */
if (typeof creds.hosts == 'undefined') creds.hosts = {};
- obj.creds = creds;
- }
- }
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.load_creds.z3950_cred_error'),E);
- }
- },
+ obj.creds = creds;
+ }
+ }
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.load_creds.z3950_cred_error'),E);
+ }
+ },
- 'save_creds' : function () {
- try {
- var obj = this;
+ 'save_creds' : function () {
+ try {
+ var obj = this;
if (typeof obj.creds.hosts == 'undefined') obj.creds.hosts = {};
if (typeof obj.creds.hosts[ obj.data.server_unadorned ] == 'undefined') obj.creds.hosts[ obj.data.server_unadorned ] = { 'services' : {} };
obj.creds.hosts[ obj.data.server_unadorned ].default_services = obj.active_services;
for (var i = 0; i < obj.creds.hosts[ obj.data.server_unadorned ].default_services.length; i++) {
- var service = obj.creds.hosts[ obj.data.server_unadorned ].default_services[i];
- if (typeof obj.creds.hosts[ obj.data.server_unadorned ].services[ service ] == 'undefined') {
+ var service = obj.creds.hosts[ obj.data.server_unadorned ].default_services[i];
+ if (typeof obj.creds.hosts[ obj.data.server_unadorned ].services[ service ] == 'undefined') {
obj.creds.hosts[ obj.data.server_unadorned ].services[ service ] = {}
- }
- obj.creds.hosts[ obj.data.server_unadorned ].services[service].username = document.getElementById(service + '_username').value;
- obj.creds.hosts[ obj.data.server_unadorned ].services[service].password = document.getElementById(service + '_password').value;
- if (obj.default_attr) {
- obj.creds.hosts[ obj.data.server_unadorned ].services[service].default_attr = obj.default_attr;
- }
+ }
+ obj.creds.hosts[ obj.data.server_unadorned ].services[service].username = document.getElementById(service + '_username').value;
+ obj.creds.hosts[ obj.data.server_unadorned ].services[service].password = document.getElementById(service + '_password').value;
+ if (obj.default_attr) {
+ obj.creds.hosts[ obj.data.server_unadorned ].services[service].default_attr = obj.default_attr;
+ }
}
- obj.creds.version = obj.creds_version;
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- JSAN.use('util.file'); var file = new util.file('z3950_store');
- file.set_object(obj.creds);
- file.close();
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.save_creds.z3950_cred_error'),E);
- }
- },
+ obj.creds.version = obj.creds_version;
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+ JSAN.use('util.file'); var file = new util.file('z3950_store');
+ file.set_object(obj.creds);
+ file.close();
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.save_creds.z3950_cred_error'),E);
+ }
+ },
- 'handle_enter' : function(ev) {
- var obj = this;
- if (ev.target.tagName != 'textbox') return;
- if (ev.keyCode == 13 /* enter */ || ev.keyCode == 77 /* enter on a mac */) setTimeout( function() { obj.initial_search(); }, 0);
- },
+ 'handle_enter' : function(ev) {
+ var obj = this;
+ if (ev.target.tagName != 'textbox') return;
+ if (ev.keyCode == 13 /* enter */ || ev.keyCode == 77 /* enter on a mac */) setTimeout( function() { obj.initial_search(); }, 0);
+ },
}
dump('exiting cat.z3950.js\n');
diff --git a/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js b/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js
index 4a9ccd8745..46d306b789 100644
--- a/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js
+++ b/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js
@@ -19,7 +19,7 @@ function backdate_post_checkin_init() {
JSAN.errorLevel = "die"; // none, warn, or die
JSAN.addRepository('..');
- JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
+ JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
JSAN.use('util.error'); error = new util.error();
diff --git a/Open-ILS/xul/staff_client/server/circ/checkin.js b/Open-ILS/xul/staff_client/server/circ/checkin.js
index 6acee6d437..0aa91693e4 100644
--- a/Open-ILS/xul/staff_client/server/circ/checkin.js
+++ b/Open-ILS/xul/staff_client/server/circ/checkin.js
@@ -3,38 +3,38 @@ dump('entering circ.checkin.js\n');
if (typeof circ == 'undefined') circ = {};
circ.checkin = function (params) {
- JSAN.use('util.error'); this.error = new util.error();
- JSAN.use('util.network'); this.network = new util.network();
- JSAN.use('util.barcode');
- JSAN.use('util.date');
- this.OpenILS = {}; JSAN.use('OpenILS.data'); this.OpenILS.data = new OpenILS.data(); this.OpenILS.data.init({'via':'stash'});
- this.data = this.OpenILS.data;
+ JSAN.use('util.error'); this.error = new util.error();
+ JSAN.use('util.network'); this.network = new util.network();
+ JSAN.use('util.barcode');
+ JSAN.use('util.date');
+ this.OpenILS = {}; JSAN.use('OpenILS.data'); this.OpenILS.data = new OpenILS.data(); this.OpenILS.data.init({'via':'stash'});
+ this.data = this.OpenILS.data;
}
circ.checkin.prototype = {
- 'selection_list' : [],
-
- 'init' : function( params ) {
-
- var obj = this;
-
- JSAN.use('circ.util'); JSAN.use('patron.util');
- var columns = circ.util.columns(
- {
- 'barcode' : { 'hidden' : false },
- 'title' : { 'hidden' : false },
- 'location' : { 'hidden' : false },
- 'call_number' : { 'hidden' : false },
- 'status' : { 'hidden' : false },
- 'route_to' : { 'hidden' : false },
- 'alert_message' : { 'hidden' : false },
- 'checkin_time' : { 'hidden' : false }
- },
- {
- 'except_these' : [ 'uses', 'checkin_time_full' ]
- }
- ).concat(
+ 'selection_list' : [],
+
+ 'init' : function( params ) {
+
+ var obj = this;
+
+ JSAN.use('circ.util'); JSAN.use('patron.util');
+ var columns = circ.util.columns(
+ {
+ 'barcode' : { 'hidden' : false },
+ 'title' : { 'hidden' : false },
+ 'location' : { 'hidden' : false },
+ 'call_number' : { 'hidden' : false },
+ 'status' : { 'hidden' : false },
+ 'route_to' : { 'hidden' : false },
+ 'alert_message' : { 'hidden' : false },
+ 'checkin_time' : { 'hidden' : false }
+ },
+ {
+ 'except_these' : [ 'uses', 'checkin_time_full' ]
+ }
+ ).concat(
patron.util.columns( { 'family_name' : { 'hidden' : 'false' } } )
).concat(
@@ -42,135 +42,135 @@ circ.checkin.prototype = {
).sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
- JSAN.use('util.list'); obj.list = new util.list('checkin_list');
- obj.list.init(
- {
- 'columns' : columns,
- 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
+ JSAN.use('util.list'); obj.list = new util.list('checkin_list');
+ obj.list.init(
+ {
+ 'columns' : columns,
+ 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
'retrieve_row' : obj.gen_list_retrieve_row_func(),
- 'on_select' : function(ev) {
- try {
- JSAN.use('util.functional');
- var sel = obj.list.retrieve_selection();
- obj.selection_list = util.functional.map_list(
- sel,
- function(o) { return JSON2js(o.getAttribute('retrieve_id')); }
- );
- obj.error.sdump('D_TRACE', 'circ/copy_status: selection list = ' + js2JSON(obj.selection_list) );
- if (obj.selection_list.length == 0) {
- obj.controller.view.sel_edit.setAttribute('disabled','true');
- obj.controller.view.sel_backdate.setAttribute('disabled','true');
- obj.controller.view.sel_opac.setAttribute('disabled','true');
- obj.controller.view.sel_patron.setAttribute('disabled','true');
- obj.controller.view.sel_last_patron.setAttribute('disabled','true');
- obj.controller.view.sel_copy_details.setAttribute('disabled','true');
- obj.controller.view.sel_bucket.setAttribute('disabled','true');
- obj.controller.view.sel_spine.setAttribute('disabled','true');
- obj.controller.view.sel_transit_abort.setAttribute('disabled','true');
- obj.controller.view.sel_clip.setAttribute('disabled','true');
- obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','true');
- } else {
- obj.controller.view.sel_edit.setAttribute('disabled','false');
- obj.controller.view.sel_backdate.setAttribute('disabled','false');
- obj.controller.view.sel_opac.setAttribute('disabled','false');
- obj.controller.view.sel_patron.setAttribute('disabled','false');
- obj.controller.view.sel_last_patron.setAttribute('disabled','false');
- obj.controller.view.sel_copy_details.setAttribute('disabled','false');
- obj.controller.view.sel_bucket.setAttribute('disabled','false');
- obj.controller.view.sel_spine.setAttribute('disabled','false');
- obj.controller.view.sel_transit_abort.setAttribute('disabled','false');
- obj.controller.view.sel_clip.setAttribute('disabled','false');
- obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','false');
- }
- } catch(E) {
- alert('FIXME: ' + E);
- }
- }
- }
- );
-
- JSAN.use('util.controller'); obj.controller = new util.controller();
- obj.controller.init(
- {
- 'control_map' : {
- 'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
- 'sel_clip' : [
- ['command'],
- function() {
+ 'on_select' : function(ev) {
+ try {
+ JSAN.use('util.functional');
+ var sel = obj.list.retrieve_selection();
+ obj.selection_list = util.functional.map_list(
+ sel,
+ function(o) { return JSON2js(o.getAttribute('retrieve_id')); }
+ );
+ obj.error.sdump('D_TRACE', 'circ/copy_status: selection list = ' + js2JSON(obj.selection_list) );
+ if (obj.selection_list.length == 0) {
+ obj.controller.view.sel_edit.setAttribute('disabled','true');
+ obj.controller.view.sel_backdate.setAttribute('disabled','true');
+ obj.controller.view.sel_opac.setAttribute('disabled','true');
+ obj.controller.view.sel_patron.setAttribute('disabled','true');
+ obj.controller.view.sel_last_patron.setAttribute('disabled','true');
+ obj.controller.view.sel_copy_details.setAttribute('disabled','true');
+ obj.controller.view.sel_bucket.setAttribute('disabled','true');
+ obj.controller.view.sel_spine.setAttribute('disabled','true');
+ obj.controller.view.sel_transit_abort.setAttribute('disabled','true');
+ obj.controller.view.sel_clip.setAttribute('disabled','true');
+ obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','true');
+ } else {
+ obj.controller.view.sel_edit.setAttribute('disabled','false');
+ obj.controller.view.sel_backdate.setAttribute('disabled','false');
+ obj.controller.view.sel_opac.setAttribute('disabled','false');
+ obj.controller.view.sel_patron.setAttribute('disabled','false');
+ obj.controller.view.sel_last_patron.setAttribute('disabled','false');
+ obj.controller.view.sel_copy_details.setAttribute('disabled','false');
+ obj.controller.view.sel_bucket.setAttribute('disabled','false');
+ obj.controller.view.sel_spine.setAttribute('disabled','false');
+ obj.controller.view.sel_transit_abort.setAttribute('disabled','false');
+ obj.controller.view.sel_clip.setAttribute('disabled','false');
+ obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','false');
+ }
+ } catch(E) {
+ alert('FIXME: ' + E);
+ }
+ }
+ }
+ );
+
+ JSAN.use('util.controller'); obj.controller = new util.controller();
+ obj.controller.init(
+ {
+ 'control_map' : {
+ 'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
+ 'sel_clip' : [
+ ['command'],
+ function() {
obj.list.clipboard();
obj.controller.view.checkin_barcode_entry_textbox.focus();
}
- ],
- 'sel_edit' : [
- ['command'],
- function() {
- try {
- obj.spawn_copy_editor();
- } catch(E) {
- alert(E);
- }
- }
- ],
- 'sel_spine' : [
- ['command'],
- function() {
- JSAN.use('cat.util');
- cat.util.spawn_spine_editor(obj.selection_list);
- }
- ],
- 'sel_opac' : [
- ['command'],
- function() {
- JSAN.use('cat.util');
- cat.util.show_in_opac(obj.selection_list);
- }
- ],
- 'sel_transit_abort' : [
- ['command'],
- function() {
- JSAN.use('circ.util');
- circ.util.abort_transits(obj.selection_list);
- }
- ],
- 'sel_patron' : [
- ['command'],
- function() {
- JSAN.use('circ.util');
- circ.util.show_last_few_circs(obj.selection_list);
- }
- ],
- 'sel_last_patron' : [
- ['command'],
- function() {
- var patrons = {};
- for (var i = 0; i < obj.selection_list.length; i++) {
- var circs = obj.network.simple_request('FM_CIRC_RETRIEVE_VIA_COPY',[ses(),obj.selection_list[i].copy_id,1]);
- if (circs.length > 0) {
- patrons[circs[0].usr()] = 1;
- } else {
- alert(document.getElementById('circStrings').getFormattedString('staff.circ.item_no_circs', [obj.selection_list[i].barcode]));
- }
- }
- for (var i in patrons) {
- xulG.new_patron_tab({},{'id' : i});
- }
- }
- ],
- 'sel_copy_details' : [
- ['command'],
- function() {
- JSAN.use('circ.util');
- for (var i = 0; i < obj.selection_list.length; i++) {
- circ.util.show_copy_details( obj.selection_list[i].copy_id );
- }
- }
- ],
- 'sel_backdate' : [
- ['command'],
- function() {
- JSAN.use('circ.util');
+ ],
+ 'sel_edit' : [
+ ['command'],
+ function() {
+ try {
+ obj.spawn_copy_editor();
+ } catch(E) {
+ alert(E);
+ }
+ }
+ ],
+ 'sel_spine' : [
+ ['command'],
+ function() {
+ JSAN.use('cat.util');
+ cat.util.spawn_spine_editor(obj.selection_list);
+ }
+ ],
+ 'sel_opac' : [
+ ['command'],
+ function() {
+ JSAN.use('cat.util');
+ cat.util.show_in_opac(obj.selection_list);
+ }
+ ],
+ 'sel_transit_abort' : [
+ ['command'],
+ function() {
+ JSAN.use('circ.util');
+ circ.util.abort_transits(obj.selection_list);
+ }
+ ],
+ 'sel_patron' : [
+ ['command'],
+ function() {
+ JSAN.use('circ.util');
+ circ.util.show_last_few_circs(obj.selection_list);
+ }
+ ],
+ 'sel_last_patron' : [
+ ['command'],
+ function() {
+ var patrons = {};
+ for (var i = 0; i < obj.selection_list.length; i++) {
+ var circs = obj.network.simple_request('FM_CIRC_RETRIEVE_VIA_COPY',[ses(),obj.selection_list[i].copy_id,1]);
+ if (circs.length > 0) {
+ patrons[circs[0].usr()] = 1;
+ } else {
+ alert(document.getElementById('circStrings').getFormattedString('staff.circ.item_no_circs', [obj.selection_list[i].barcode]));
+ }
+ }
+ for (var i in patrons) {
+ xulG.new_patron_tab({},{'id' : i});
+ }
+ }
+ ],
+ 'sel_copy_details' : [
+ ['command'],
+ function() {
+ JSAN.use('circ.util');
+ for (var i = 0; i < obj.selection_list.length; i++) {
+ circ.util.show_copy_details( obj.selection_list[i].copy_id );
+ }
+ }
+ ],
+ 'sel_backdate' : [
+ ['command'],
+ function() {
+ JSAN.use('circ.util');
var circ_ids = [];
- for (var i = 0; i < obj.selection_list.length; i++) {
+ for (var i = 0; i < obj.selection_list.length; i++) {
var circ_id = obj.selection_list[i].circ_id;
var copy_id = obj.selection_list[i].copy_id;
if (!circ_id) {
@@ -179,67 +179,67 @@ circ.checkin.prototype = {
}
if (!circ_id) continue;
circ_ids.push( circ_id );
- }
+ }
circ.util.backdate_post_checkin( circ_ids );
- }
- ],
- 'sel_mark_items_damaged' : [
- ['command'],
- function() {
- var funcs = [];
- JSAN.use('cat.util'); JSAN.use('util.functional');
- cat.util.mark_item_damaged( util.functional.map_list( obj.selection_list, function(o) { return o.copy_id; } ) );
- }
- ],
- 'sel_bucket' : [
- ['command'],
- function() {
- JSAN.use('cat.util');
- cat.util.add_copies_to_bucket(obj.selection_list);
- }
- ],
- 'checkin_barcode_entry_textbox' : [
- ['keypress'],
- function(ev) {
- if (ev.keyCode && ev.keyCode == 13) {
- obj.checkin();
- }
- }
- ],
- 'checkin_effective_date_label' : [
- ['render'],
- function(e) {
- return function() {
- obj.controller.view.checkin_effective_datepicker.value =
- util.date.formatted_date(new Date(),'%F');
- };
- }
- ],
- 'checkin_effective_datepicker' : [
- ['change'],
- function(ev) {
- if (ev.target.nodeName == 'datepicker') {
- try {
- if ( ev.target.dateValue > new Date() ) throw(document.getElementById('circStrings').getString('staff.circ.future_date'));
- var x = document.getElementById('background');
- if (x) {
- if ( ev.target.value == util.date.formatted_date(new Date(),'%F') ) {
+ }
+ ],
+ 'sel_mark_items_damaged' : [
+ ['command'],
+ function() {
+ var funcs = [];
+ JSAN.use('cat.util'); JSAN.use('util.functional');
+ cat.util.mark_item_damaged( util.functional.map_list( obj.selection_list, function(o) { return o.copy_id; } ) );
+ }
+ ],
+ 'sel_bucket' : [
+ ['command'],
+ function() {
+ JSAN.use('cat.util');
+ cat.util.add_copies_to_bucket(obj.selection_list);
+ }
+ ],
+ 'checkin_barcode_entry_textbox' : [
+ ['keypress'],
+ function(ev) {
+ if (ev.keyCode && ev.keyCode == 13) {
+ obj.checkin();
+ }
+ }
+ ],
+ 'checkin_effective_date_label' : [
+ ['render'],
+ function(e) {
+ return function() {
+ obj.controller.view.checkin_effective_datepicker.value =
+ util.date.formatted_date(new Date(),'%F');
+ };
+ }
+ ],
+ 'checkin_effective_datepicker' : [
+ ['change'],
+ function(ev) {
+ if (ev.target.nodeName == 'datepicker') {
+ try {
+ if ( ev.target.dateValue > new Date() ) throw(document.getElementById('circStrings').getString('staff.circ.future_date'));
+ var x = document.getElementById('background');
+ if (x) {
+ if ( ev.target.value == util.date.formatted_date(new Date(),'%F') ) {
//addCSSClass(x,'checkin_screen_normal');
removeCSSClass(x,'checkin_screen_backdating');
removeCSSClass(document.getElementById('background'),'checkin_screen_do_not_alert_on_precat');
removeCSSClass(document.getElementById('background'),'checkin_screen_suppress_holds_and_transits');
removeCSSClass(document.getElementById('background'),'checkin_screen_amnesty_mode');
removeCSSClass(document.getElementById('background'),'checkin_screen_checkin_auto_print_slips');
- document.getElementById('background-text').setAttribute('value',document.getElementById('circStrings').getString('staff.circ.process_item'));
- } else {
+ document.getElementById('background-text').setAttribute('value',document.getElementById('circStrings').getString('staff.circ.process_item'));
+ } else {
addCSSClass(x,'checkin_screen_backdating');
//removeCSSClass(x,'checkin_screen_normal');
- document.getElementById('background-text').setAttribute('value',document.getElementById('circStrings').getFormattedString('staff.circ.backdated_checkin', [ev.target.value]));
- }
- }
- } catch(E) {
- var x = document.getElementById('background');
- if (x) {
+ document.getElementById('background-text').setAttribute('value',document.getElementById('circStrings').getFormattedString('staff.circ.backdated_checkin', [ev.target.value]));
+ }
+ }
+ } catch(E) {
+ var x = document.getElementById('background');
+ if (x) {
//addCSSClass(x,'checkin_screen_normal');
removeCSSClass(x,'checkin_screen_backdating');
removeCSSClass(document.getElementById('background'),'checkin_screen_do_not_alert_on_precat');
@@ -248,45 +248,45 @@ circ.checkin.prototype = {
removeCSSClass(document.getElementById('background'),'checkin_screen_checkin_auto_print_slips');
document.getElementById('background-text').setAttribute('value',document.getElementById('circStrings').getString('staff.circ.process_item'));
}
- dump('checkin:effective_date: ' + E + '\n');
+ dump('checkin:effective_date: ' + E + '\n');
ev.target.disabled = true;
- //alert(document.getElementById('circStrings').getFormattedString('staff.circ.backdate.exception', [E]));
+ //alert(document.getElementById('circStrings').getFormattedString('staff.circ.backdate.exception', [E]));
ev.target.value = util.date.formatted_date(new Date(),'%F');
ev.target.disabled = false;
- JSAN.use('util.sound'); var sound = new util.sound(); sound.bad();
+ JSAN.use('util.sound'); var sound = new util.sound(); sound.bad();
- }
- }
- }
- ],
- 'cmd_broken' : [
- ['command'],
- function() { alert(document.getElementById('circStrings').getString('staff.circ.unimplemented')); }
- ],
- 'cmd_checkin_submit_barcode' : [
- ['command'],
- function() {
- obj.checkin();
- }
- ],
- 'cmd_checkin_print' : [
- ['command'],
- function() {
- var p = {
- 'template' : 'checkin'
- };
- obj.list.print(p);
- }
- ],
- 'cmd_csv_to_clipboard' : [ ['command'], function() {
+ }
+ }
+ }
+ ],
+ 'cmd_broken' : [
+ ['command'],
+ function() { alert(document.getElementById('circStrings').getString('staff.circ.unimplemented')); }
+ ],
+ 'cmd_checkin_submit_barcode' : [
+ ['command'],
+ function() {
+ obj.checkin();
+ }
+ ],
+ 'cmd_checkin_print' : [
+ ['command'],
+ function() {
+ var p = {
+ 'template' : 'checkin'
+ };
+ obj.list.print(p);
+ }
+ ],
+ 'cmd_csv_to_clipboard' : [ ['command'], function() {
obj.list.dump_csv_to_clipboard();
obj.controller.view.checkin_barcode_entry_textbox.focus();
} ],
- 'cmd_csv_to_printer' : [ ['command'], function() {
+ 'cmd_csv_to_printer' : [ ['command'], function() {
obj.list.dump_csv_to_printer();
obj.controller.view.checkin_barcode_entry_textbox.focus();
} ],
- 'cmd_csv_to_file' : [ ['command'], function() {
+ 'cmd_csv_to_file' : [ ['command'], function() {
obj.list.dump_csv_to_file( { 'defaultFileName' : 'checked_in.txt' } );
obj.controller.view.checkin_barcode_entry_textbox.focus();
} ],
@@ -334,13 +334,13 @@ circ.checkin.prototype = {
document.getElementById('checkin_barcode_entry_textbox').focus();
return true;
} ]
- }
- }
- );
- this.controller.render();
- this.controller.view.checkin_barcode_entry_textbox.focus();
+ }
+ }
+ );
+ this.controller.render();
+ this.controller.view.checkin_barcode_entry_textbox.focus();
- },
+ },
'gen_list_retrieve_row_func' : function() {
var obj = this;
@@ -378,42 +378,42 @@ circ.checkin.prototype = {
};
},
- 'test_barcode' : function(bc) {
- var obj = this;
- var x = document.getElementById('strict_barcode');
- if (x && x.checked != true) return true;
- var good = util.barcode.check(bc);
- if (good) {
- return true;
- } else {
- if ( 1 == obj.error.yns_alert(
- document.getElementById('circStrings').getFormattedString('staff.circ.check_digit.bad', [bc]),
- document.getElementById('circStrings').getString('staff.circ.barcode.bad'),
- document.getElementById('circStrings').getString('staff.circ.cancel'),
- document.getElementById('circStrings').getString('staff.circ.barcode.accept'),
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm'),
- '/xul/server/skin/media/images/bad_barcode.png'
- ) ) {
- return true;
- } else {
- return false;
- }
- }
- },
-
- 'checkin' : function() {
- var obj = this;
- try {
- var barcode = obj.controller.view.checkin_barcode_entry_textbox.value;
- if (!barcode) return;
- if (barcode) {
- if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; }
- }
- var backdate = obj.controller.view.checkin_effective_datepicker.value;
- var auto_print = document.getElementById('checkin_auto_print_slips');
- if (auto_print) auto_print = auto_print.getAttribute('checked') == 'true';
- JSAN.use('circ.util');
+ 'test_barcode' : function(bc) {
+ var obj = this;
+ var x = document.getElementById('strict_barcode');
+ if (x && x.checked != true) return true;
+ var good = util.barcode.check(bc);
+ if (good) {
+ return true;
+ } else {
+ if ( 1 == obj.error.yns_alert(
+ document.getElementById('circStrings').getFormattedString('staff.circ.check_digit.bad', [bc]),
+ document.getElementById('circStrings').getString('staff.circ.barcode.bad'),
+ document.getElementById('circStrings').getString('staff.circ.cancel'),
+ document.getElementById('circStrings').getString('staff.circ.barcode.accept'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm'),
+ '/xul/server/skin/media/images/bad_barcode.png'
+ ) ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ },
+
+ 'checkin' : function() {
+ var obj = this;
+ try {
+ var barcode = obj.controller.view.checkin_barcode_entry_textbox.value;
+ if (!barcode) return;
+ if (barcode) {
+ if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; }
+ }
+ var backdate = obj.controller.view.checkin_effective_datepicker.value;
+ var auto_print = document.getElementById('checkin_auto_print_slips');
+ if (auto_print) auto_print = auto_print.getAttribute('checked') == 'true';
+ JSAN.use('circ.util');
var params = {
'barcode' : barcode,
'disable_textbox' : function() {
@@ -430,131 +430,131 @@ circ.checkin.prototype = {
obj.checkin2(checkin,backdate);
}
};
- var suppress_holds_and_transits = document.getElementById('suppress_holds_and_transits');
- if (suppress_holds_and_transits) suppress_holds_and_transits = suppress_holds_and_transits.getAttribute('checked') == 'true';
+ var suppress_holds_and_transits = document.getElementById('suppress_holds_and_transits');
+ if (suppress_holds_and_transits) suppress_holds_and_transits = suppress_holds_and_transits.getAttribute('checked') == 'true';
if (suppress_holds_and_transits) params.noop = 1;
- var amnesty_mode = document.getElementById('amnesty_mode');
- if (amnesty_mode) amnesty_mode = amnesty_mode.getAttribute('checked') == 'true';
+ var amnesty_mode = document.getElementById('amnesty_mode');
+ if (amnesty_mode) amnesty_mode = amnesty_mode.getAttribute('checked') == 'true';
if (amnesty_mode) params.void_overdues = 1;
- circ.util.checkin_via_barcode(
- ses(),
+ circ.util.checkin_via_barcode(
+ ses(),
params,
backdate,
auto_print
- );
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.exception', [E]), E);
- if (typeof obj.on_failure == 'function') {
- obj.on_failure(E);
- }
- if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
- obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.util.checkin.exception.external') + '\n');
- window.xulG.on_failure(E);
- } else {
- obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.util.checkin.exception.no_external') + '\n');
- }
- }
-
- },
-
- 'checkin2' : function(checkin,backdate) {
- var obj = this;
- try {
- if (!checkin) return obj.on_failure(); /* circ.util.checkin handles errors and returns null currently */
- if (checkin.ilsevent == 7010 /* COPY_ALERT_MESSAGE */
- || checkin.ilsevent == 1203 /* COPY_BAD_STATUS */
- || checkin.ilsevent == -1 /* offline */
- || checkin.ilsevent == 1502 /* ASSET_COPY_NOT_FOUND */
- || checkin.ilsevent == 1203 /* COPY_BAD_STATUS */
- || checkin.ilsevent == 7009 /* CIRC_CLAIMS_RETURNED */
- || checkin.ilsevent == 7011 /* COPY_STATUS_LOST */
- || checkin.ilsevent == 7012 /* COPY_STATUS_MISSING */) return obj.on_failure();
- var retrieve_id = js2JSON( { 'circ_id' : checkin.circ ? checkin.circ.id() : null , 'copy_id' : checkin.copy.id(), 'barcode' : checkin.copy.barcode(), 'doc_id' : (typeof checkin.record != 'undefined' ? ( typeof checkin.record.ilsevent == 'undefined' ? checkin.record.doc_id() : null ) : null ) } );
- if (checkin.circ && checkin.circ.checkin_time() == 'now') checkin.circ.checkin_time(backdate);
- 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' : retrieve_id,
- 'row' : {
- 'my' : {
- 'circ' : checkin.circ,
- 'mbts' : checkin.circ ? checkin.circ.billable_transaction().summary() : null,
- 'mvr' : checkin.record,
- 'acp' : checkin.copy,
- 'au' : checkin.patron,
- 'status' : checkin.status,
- 'route_to' : checkin.route_to,
- 'message' : checkin.message
- }
- },
- 'to_top' : true
- }
- );
- obj.list.node.view.selection.select(0);
-
- JSAN.use('util.sound'); var sound = new util.sound(); sound.circ_good();
-
- if (typeof obj.on_checkin == 'function') {
- obj.on_checkin(checkin);
- }
- if (typeof window.xulG == 'object' && typeof window.xulG.on_checkin == 'function') {
- obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.checkin.exception.external') + '\n');
- window.xulG.on_checkin(checkin);
- } else {
- obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.checkin.exception.no_external') + '\n');
- }
-
- return true;
-
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin2.exception', [E]));
- if (typeof obj.on_failure == 'function') {
- obj.on_failure(E);
- }
- if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
- obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.checkin2.exception.external') + '\n');
- window.xulG.on_failure(E);
- } else {
- obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.checkin2.exception.no_external') + '\n');
- }
- }
-
- },
-
- 'on_checkin' : function() {
- this.controller.view.checkin_barcode_entry_textbox.disabled = false;
- this.controller.view.checkin_barcode_entry_textbox.select();
- this.controller.view.checkin_barcode_entry_textbox.value = '';
- this.controller.view.checkin_barcode_entry_textbox.focus();
- },
-
- 'on_failure' : function() {
- this.controller.view.checkin_barcode_entry_textbox.disabled = false;
- this.controller.view.checkin_barcode_entry_textbox.select();
- this.controller.view.checkin_barcode_entry_textbox.focus();
- },
-
- 'spawn_copy_editor' : function() {
-
- var obj = this;
-
- JSAN.use('util.functional');
-
- var list = obj.selection_list;
-
- list = util.functional.map_list(
- list,
- function (o) {
- return o.copy_id;
- }
- );
-
- JSAN.use('cat.util'); cat.util.spawn_copy_editor( { 'copy_ids' : list, 'edit' : 1 } );
-
- }
+ );
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.exception', [E]), E);
+ if (typeof obj.on_failure == 'function') {
+ obj.on_failure(E);
+ }
+ if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
+ obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.util.checkin.exception.external') + '\n');
+ window.xulG.on_failure(E);
+ } else {
+ obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.util.checkin.exception.no_external') + '\n');
+ }
+ }
+
+ },
+
+ 'checkin2' : function(checkin,backdate) {
+ var obj = this;
+ try {
+ if (!checkin) return obj.on_failure(); /* circ.util.checkin handles errors and returns null currently */
+ if (checkin.ilsevent == 7010 /* COPY_ALERT_MESSAGE */
+ || checkin.ilsevent == 1203 /* COPY_BAD_STATUS */
+ || checkin.ilsevent == -1 /* offline */
+ || checkin.ilsevent == 1502 /* ASSET_COPY_NOT_FOUND */
+ || checkin.ilsevent == 1203 /* COPY_BAD_STATUS */
+ || checkin.ilsevent == 7009 /* CIRC_CLAIMS_RETURNED */
+ || checkin.ilsevent == 7011 /* COPY_STATUS_LOST */
+ || checkin.ilsevent == 7012 /* COPY_STATUS_MISSING */) return obj.on_failure();
+ var retrieve_id = js2JSON( { 'circ_id' : checkin.circ ? checkin.circ.id() : null , 'copy_id' : checkin.copy.id(), 'barcode' : checkin.copy.barcode(), 'doc_id' : (typeof checkin.record != 'undefined' ? ( typeof checkin.record.ilsevent == 'undefined' ? checkin.record.doc_id() : null ) : null ) } );
+ if (checkin.circ && checkin.circ.checkin_time() == 'now') checkin.circ.checkin_time(backdate);
+ 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' : retrieve_id,
+ 'row' : {
+ 'my' : {
+ 'circ' : checkin.circ,
+ 'mbts' : checkin.circ ? checkin.circ.billable_transaction().summary() : null,
+ 'mvr' : checkin.record,
+ 'acp' : checkin.copy,
+ 'au' : checkin.patron,
+ 'status' : checkin.status,
+ 'route_to' : checkin.route_to,
+ 'message' : checkin.message
+ }
+ },
+ 'to_top' : true
+ }
+ );
+ obj.list.node.view.selection.select(0);
+
+ JSAN.use('util.sound'); var sound = new util.sound(); sound.circ_good();
+
+ if (typeof obj.on_checkin == 'function') {
+ obj.on_checkin(checkin);
+ }
+ if (typeof window.xulG == 'object' && typeof window.xulG.on_checkin == 'function') {
+ obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.checkin.exception.external') + '\n');
+ window.xulG.on_checkin(checkin);
+ } else {
+ obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.checkin.exception.no_external') + '\n');
+ }
+
+ return true;
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin2.exception', [E]));
+ if (typeof obj.on_failure == 'function') {
+ obj.on_failure(E);
+ }
+ if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
+ obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.checkin2.exception.external') + '\n');
+ window.xulG.on_failure(E);
+ } else {
+ obj.error.sdump('D_CIRC', document.getElementById('circStrings').getString('staff.circ.checkin2.exception.no_external') + '\n');
+ }
+ }
+
+ },
+
+ 'on_checkin' : function() {
+ this.controller.view.checkin_barcode_entry_textbox.disabled = false;
+ this.controller.view.checkin_barcode_entry_textbox.select();
+ this.controller.view.checkin_barcode_entry_textbox.value = '';
+ this.controller.view.checkin_barcode_entry_textbox.focus();
+ },
+
+ 'on_failure' : function() {
+ this.controller.view.checkin_barcode_entry_textbox.disabled = false;
+ this.controller.view.checkin_barcode_entry_textbox.select();
+ this.controller.view.checkin_barcode_entry_textbox.focus();
+ },
+
+ 'spawn_copy_editor' : function() {
+
+ var obj = this;
+
+ JSAN.use('util.functional');
+
+ var list = obj.selection_list;
+
+ list = util.functional.map_list(
+ list,
+ function (o) {
+ return o.copy_id;
+ }
+ );
+
+ JSAN.use('cat.util'); cat.util.spawn_copy_editor( { 'copy_ids' : list, 'edit' : 1 } );
+
+ }
}
diff --git a/Open-ILS/xul/staff_client/server/circ/checkout.js b/Open-ILS/xul/staff_client/server/circ/checkout.js
index e695a4de62..a3a7f34d21 100644
--- a/Open-ILS/xul/staff_client/server/circ/checkout.js
+++ b/Open-ILS/xul/staff_client/server/circ/checkout.js
@@ -3,296 +3,296 @@ dump('entering circ.checkout.js\n');
if (typeof circ == 'undefined') { circ = {}; }
circ.checkout = function (params) {
- JSAN.use('util.error'); this.error = new util.error();
- JSAN.use('util.network'); this.network = new util.network();
- JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
- JSAN.use('util.barcode');
+ JSAN.use('util.error'); this.error = new util.error();
+ JSAN.use('util.network'); this.network = new util.network();
+ JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
+ JSAN.use('util.barcode');
};
circ.checkout.prototype = {
- 'init' : function( params ) {
-
- var obj = this;
-
- obj.patron_id = params.patron_id;
-
- JSAN.use('circ.util');
- var columns = circ.util.columns(
- {
- 'barcode' : { 'hidden' : false },
- 'title' : { 'hidden' : false },
- 'due_date' : { 'hidden' : false }
- }
- );
-
- JSAN.use('util.list'); obj.list = new util.list('checkout_list');
- obj.list.init(
- {
- 'columns' : columns,
- 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
- 'on_select' : function() {
- var sel = obj.list.retrieve_selection();
- document.getElementById('clip_button').disabled = sel.length < 1;
- }
- }
- );
-
- JSAN.use('util.controller'); obj.controller = new util.controller();
- obj.controller.init(
- {
- 'control_map' : {
- 'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
- 'sel_clip' : [
- ['command'],
- function() { obj.list.clipboard(); }
- ],
- 'checkout_menu_placeholder' : [
- ['render'],
- function(e) {
- return function() {
- JSAN.use('util.widgets'); JSAN.use('util.functional'); JSAN.use('util.fm_utils');
- var items = [ [ document.getElementById('circStrings').getString('staff.circ.checkout.barcode') , 'barcode' ] ].concat(
- util.functional.map_list(
- util.functional.filter_list(
- obj.data.list.my_cnct,
- function(o) {
- return util.fm_utils.compare_aou_a_is_b_or_ancestor(o.owning_lib(), obj.data.list.au[0].ws_ou());
- }
- ).sort(
-
- function(a,b) {
- try {
- return util.fm_utils.sort_func_aou_by_depth_and_then_string(
- [ a.owning_lib(), a.name() ],
- [ b.owning_lib(), b.name() ]
- );
- } catch(E) {
- alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkout.sorting.exception', [E]));
- return 0;
- }
- }
-
- ),
- function(o) {
- return [ obj.data.hash.aou[ o.owning_lib() ].shortname() + ' : ' + o.name(), o.id() ];
- }
- )
- );
- g.error.sdump('D_TRACE','items = ' + js2JSON(items));
- util.widgets.remove_children( e );
- var ml = util.widgets.make_menulist(items);
- e.appendChild( ml );
- ml.setAttribute('id','checkout_menulist');
- ml.setAttribute('accesskey','');
- ml.addEventListener(
- 'command',
- function(ev) {
- var tb = obj.controller.view.checkout_barcode_entry_textbox;
- var db = document.getElementById('duedate_hbox');
- if (ev.target.value == 'barcode') {
- db.hidden = false;
- tb.disabled = false;
- tb.value = '';
- tb.focus();
- } else {
- db.hidden = true;
- tb.disabled = true;
- tb.value = document.getElementById('circStrings').getString('staff.circ.non_cataloged');
- }
- }, false
- );
- obj.controller.view.checkout_menu = ml;
- };
- }
- ],
- 'checkout_barcode_entry_textbox' : [
- ['keypress'],
- function(ev) {
- if (ev.keyCode && ev.keyCode == 13) {
- obj.checkout( { barcode: ev.target.value } );
- }
- }
- ],
- 'checkout_duedate_datepicker' : [
- ['change'],
- function(ev) {
- try {
- if (obj.check_date(ev.target)) {
- ev.target.parentNode.setAttribute('style','');
+ 'init' : function( params ) {
+
+ var obj = this;
+
+ obj.patron_id = params.patron_id;
+
+ JSAN.use('circ.util');
+ var columns = circ.util.columns(
+ {
+ 'barcode' : { 'hidden' : false },
+ 'title' : { 'hidden' : false },
+ 'due_date' : { 'hidden' : false }
+ }
+ );
+
+ JSAN.use('util.list'); obj.list = new util.list('checkout_list');
+ obj.list.init(
+ {
+ 'columns' : columns,
+ 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
+ 'on_select' : function() {
+ var sel = obj.list.retrieve_selection();
+ document.getElementById('clip_button').disabled = sel.length < 1;
+ }
+ }
+ );
+
+ JSAN.use('util.controller'); obj.controller = new util.controller();
+ obj.controller.init(
+ {
+ 'control_map' : {
+ 'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
+ 'sel_clip' : [
+ ['command'],
+ function() { obj.list.clipboard(); }
+ ],
+ 'checkout_menu_placeholder' : [
+ ['render'],
+ function(e) {
+ return function() {
+ JSAN.use('util.widgets'); JSAN.use('util.functional'); JSAN.use('util.fm_utils');
+ var items = [ [ document.getElementById('circStrings').getString('staff.circ.checkout.barcode') , 'barcode' ] ].concat(
+ util.functional.map_list(
+ util.functional.filter_list(
+ obj.data.list.my_cnct,
+ function(o) {
+ return util.fm_utils.compare_aou_a_is_b_or_ancestor(o.owning_lib(), obj.data.list.au[0].ws_ou());
+ }
+ ).sort(
+
+ function(a,b) {
+ try {
+ return util.fm_utils.sort_func_aou_by_depth_and_then_string(
+ [ a.owning_lib(), a.name() ],
+ [ b.owning_lib(), b.name() ]
+ );
+ } catch(E) {
+ alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkout.sorting.exception', [E]));
+ return 0;
+ }
+ }
+
+ ),
+ function(o) {
+ return [ obj.data.hash.aou[ o.owning_lib() ].shortname() + ' : ' + o.name(), o.id() ];
+ }
+ )
+ );
+ g.error.sdump('D_TRACE','items = ' + js2JSON(items));
+ util.widgets.remove_children( e );
+ var ml = util.widgets.make_menulist(items);
+ e.appendChild( ml );
+ ml.setAttribute('id','checkout_menulist');
+ ml.setAttribute('accesskey','');
+ ml.addEventListener(
+ 'command',
+ function(ev) {
+ var tb = obj.controller.view.checkout_barcode_entry_textbox;
+ var db = document.getElementById('duedate_hbox');
+ if (ev.target.value == 'barcode') {
+ db.hidden = false;
+ tb.disabled = false;
+ tb.value = '';
+ tb.focus();
+ } else {
+ db.hidden = true;
+ tb.disabled = true;
+ tb.value = document.getElementById('circStrings').getString('staff.circ.non_cataloged');
+ }
+ }, false
+ );
+ obj.controller.view.checkout_menu = ml;
+ };
+ }
+ ],
+ 'checkout_barcode_entry_textbox' : [
+ ['keypress'],
+ function(ev) {
+ if (ev.keyCode && ev.keyCode == 13) {
+ obj.checkout( { barcode: ev.target.value } );
+ }
+ }
+ ],
+ 'checkout_duedate_datepicker' : [
+ ['change'],
+ function(ev) {
+ try {
+ if (obj.check_date(ev.target)) {
+ ev.target.parentNode.setAttribute('style','');
} else {
ev.target.parentNode.setAttribute('style','background-color: red');
}
- } catch(E) {
+ } catch(E) {
alert('Error in checkout.js, checkout_duedate_datepicker @change: ' + E);
- }
- }
- ],
- 'cmd_broken' : [
- ['command'],
- function() { alert(document.getElementById('circStrings').getString('staff.circ.checkout.unimplemented')); }
- ],
- 'cmd_checkout_submit' : [
- ['command'],
- function() {
- var params = {}; var count = 1;
-
- if (obj.controller.view.checkout_menu.value == 'barcode' ||
- obj.controller.view.checkout_menu.value === '') {
- params.barcode = obj.controller.view.checkout_barcode_entry_textbox.value;
- } else {
- params.noncat = 1;
- params.noncat_type = obj.controller.view.checkout_menu.value;
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- var r = window.prompt(
- document.getElementById('circStrings').getFormattedString('staff.circ.checkout.cmd_checkout_submit.msg', [obj.data.hash.cnct[params.noncat_type].name()]),
- '1',
- document.getElementById('circStrings').getString('staff.circ.checkout.cmd_checkout_submit.title')
- );
- if (r) {
- count = Number(r);
- if (count > 0) {
- if (count > 99) {
- obj.error.yns_alert(
- document.getElementById('circStrings').getFormattedString('staff.circ.checkout.cmd_checkout_submit.too_many.msg', [count, obj.data.hash.cnct[params.noncat_type].name()]),
- document.getElementById('circStrings').getString('staff.circ.checkout.cmd_checkout_submit.too_many.title'),
- document.getElementById('circStrings').getString('staff.circ.checkout.ok.btn'),
- null,
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm')
- );
- return;
- } else if (count > 20) {
- r = obj.error.yns_alert(
- document.getElementById('circStrings').getFormattedString('staff.circ.checkout.cmd_checkout_submit.confirm.msg', [count, obj.data.hash.cnct[params.noncat_type].name()]),
- document.getElementById('circStrings').getString('staff.circ.checkout.cmd_checkout_submit.confirm.title'),
- document.getElementById('circStrings').getString('staff.circ.checkout.yes.btn'),
- document.getElementById('circStrings').getString('staff.circ.checkout.no.btn'),
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm')
- );
- if (r !== 0) { return; }
- }
- } else {
- r = obj.error.yns_alert(
- document.getElementById('circStrings').getFormattedString('staff.circ.checkout.cmd_checkout_submit.non_numeric.msg', [r]),
- document.getElementById('circStrings').getString('staff.circ.checkout.cmd_checkout_submit.non_numeric.title'),
- document.getElementById('circStrings').getString('staff.circ.checkout.ok.btn'),
- null,
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm')
- );
- return;
- }
- } else {
- return;
- }
- }
- for (var i = 0; i < count; i++) {
- obj.checkout( params );
- }
- }
- ],
- 'cmd_checkout_print' : [
- ['command'],
- function() {
- try {
- obj.print();
- } catch(E) {
- obj.error.standard_unexpected_error_alert('cmd_checkout_print',E);
- }
-
- }
- ],
- 'cmd_checkout_export' : [
- ['command'],
- function() {
- try {
- obj.export_list();
- } catch(E) {
- obj.error.standard_unexpected_error_alert('cmd_checkout_export',E);
- }
- }
- ],
-
-
- 'cmd_checkout_reprint' : [
- ['command'],
- function() {
- JSAN.use('util.print'); var print = new util.print();
- print.reprint_last();
- }
- ],
- 'cmd_checkout_done' : [
- ['command'],
- function() {
- try {
+ }
+ }
+ ],
+ 'cmd_broken' : [
+ ['command'],
+ function() { alert(document.getElementById('circStrings').getString('staff.circ.checkout.unimplemented')); }
+ ],
+ 'cmd_checkout_submit' : [
+ ['command'],
+ function() {
+ var params = {}; var count = 1;
+
+ if (obj.controller.view.checkout_menu.value == 'barcode' ||
+ obj.controller.view.checkout_menu.value === '') {
+ params.barcode = obj.controller.view.checkout_barcode_entry_textbox.value;
+ } else {
+ params.noncat = 1;
+ params.noncat_type = obj.controller.view.checkout_menu.value;
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
+ var r = window.prompt(
+ document.getElementById('circStrings').getFormattedString('staff.circ.checkout.cmd_checkout_submit.msg', [obj.data.hash.cnct[params.noncat_type].name()]),
+ '1',
+ document.getElementById('circStrings').getString('staff.circ.checkout.cmd_checkout_submit.title')
+ );
+ if (r) {
+ count = Number(r);
+ if (count > 0) {
+ if (count > 99) {
+ obj.error.yns_alert(
+ document.getElementById('circStrings').getFormattedString('staff.circ.checkout.cmd_checkout_submit.too_many.msg', [count, obj.data.hash.cnct[params.noncat_type].name()]),
+ document.getElementById('circStrings').getString('staff.circ.checkout.cmd_checkout_submit.too_many.title'),
+ document.getElementById('circStrings').getString('staff.circ.checkout.ok.btn'),
+ null,
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm')
+ );
+ return;
+ } else if (count > 20) {
+ r = obj.error.yns_alert(
+ document.getElementById('circStrings').getFormattedString('staff.circ.checkout.cmd_checkout_submit.confirm.msg', [count, obj.data.hash.cnct[params.noncat_type].name()]),
+ document.getElementById('circStrings').getString('staff.circ.checkout.cmd_checkout_submit.confirm.title'),
+ document.getElementById('circStrings').getString('staff.circ.checkout.yes.btn'),
+ document.getElementById('circStrings').getString('staff.circ.checkout.no.btn'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm')
+ );
+ if (r !== 0) { return; }
+ }
+ } else {
+ r = obj.error.yns_alert(
+ document.getElementById('circStrings').getFormattedString('staff.circ.checkout.cmd_checkout_submit.non_numeric.msg', [r]),
+ document.getElementById('circStrings').getString('staff.circ.checkout.cmd_checkout_submit.non_numeric.title'),
+ document.getElementById('circStrings').getString('staff.circ.checkout.ok.btn'),
+ null,
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm')
+ );
+ return;
+ }
+ } else {
+ return;
+ }
+ }
+ for (var i = 0; i < count; i++) {
+ obj.checkout( params );
+ }
+ }
+ ],
+ 'cmd_checkout_print' : [
+ ['command'],
+ function() {
+ try {
+ obj.print();
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('cmd_checkout_print',E);
+ }
+
+ }
+ ],
+ 'cmd_checkout_export' : [
+ ['command'],
+ function() {
+ try {
+ obj.export_list();
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('cmd_checkout_export',E);
+ }
+ }
+ ],
+
+
+ 'cmd_checkout_reprint' : [
+ ['command'],
+ function() {
+ JSAN.use('util.print'); var print = new util.print();
+ print.reprint_last();
+ }
+ ],
+ 'cmd_checkout_done' : [
+ ['command'],
+ function() {
+ try {
var no_print_prompting = obj.data.hash.aous['circ.staff_client.do_not_auto_attempt_print'];
if (no_print_prompting) {
if (no_print_prompting.indexOf( "Checkout" ) > -1) {
- obj.list.clear();
- xulG.set_tab(urls.XUL_PATRON_BARCODE_ENTRY,{},{});
+ obj.list.clear();
+ xulG.set_tab(urls.XUL_PATRON_BARCODE_ENTRY,{},{});
return;
}
}
- if (document.getElementById('checkout_auto').checked) {
- obj.print(true,function() {
- obj.list.clear();
- xulG.set_tab(urls.XUL_PATRON_BARCODE_ENTRY,{},{});
- });
- } else {
- obj.print(false,function() {
- obj.list.clear();
- xulG.set_tab(urls.XUL_PATRON_BARCODE_ENTRY,{},{});
- });
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert('cmd_checkout_done',E);
- }
- }
- ]
- }
- }
- );
- this.controller.render();
- //this.controller.view.checkout_barcode_entry_textbox.focus();
-
- this.check_disable();
-
- var robj = obj.network.simple_request(
- 'FM_CIRC_COUNT_RETRIEVE_VIA_USER.authoritative',
- [ ses(), obj.patron_id ]
- );
- obj.items_out_count = (robj.out + robj.overdue + robj.claims_returned + robj.long_overdue );
-
- },
-
- 'check_disable' : function() {
- var obj = this;
- try {
- if (typeof xulG.check_stop_checkouts == 'function') {
- var disable = xulG.check_stop_checkouts();
- if (disable) {
- document.getElementById('checkout_submit_barcode_button').disabled = true;
- document.getElementById('checkout_done').disabled = true;
- obj.controller.view.checkout_menu.disabled = true;
- obj.controller.view.checkout_barcode_entry_textbox.disabled = true;
- } else {
- document.getElementById('checkout_submit_barcode_button').disabled = false;
- document.getElementById('checkout_done').disabled = false;
- obj.controller.view.checkout_menu.disabled = false;
- obj.controller.view.checkout_barcode_entry_textbox.disabled = false;
- }
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.checkout.disable.error'),E);
- }
- },
-
- 'print' : function(silent,f) {
- var obj = this;
- try {
- obj.patron = obj.network.simple_request('FM_AU_FLESHED_RETRIEVE_VIA_ID',[ses(),obj.patron_id]);
+ if (document.getElementById('checkout_auto').checked) {
+ obj.print(true,function() {
+ obj.list.clear();
+ xulG.set_tab(urls.XUL_PATRON_BARCODE_ENTRY,{},{});
+ });
+ } else {
+ obj.print(false,function() {
+ obj.list.clear();
+ xulG.set_tab(urls.XUL_PATRON_BARCODE_ENTRY,{},{});
+ });
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('cmd_checkout_done',E);
+ }
+ }
+ ]
+ }
+ }
+ );
+ this.controller.render();
+ //this.controller.view.checkout_barcode_entry_textbox.focus();
+
+ this.check_disable();
+
+ var robj = obj.network.simple_request(
+ 'FM_CIRC_COUNT_RETRIEVE_VIA_USER.authoritative',
+ [ ses(), obj.patron_id ]
+ );
+ obj.items_out_count = (robj.out + robj.overdue + robj.claims_returned + robj.long_overdue );
+
+ },
+
+ 'check_disable' : function() {
+ var obj = this;
+ try {
+ if (typeof xulG.check_stop_checkouts == 'function') {
+ var disable = xulG.check_stop_checkouts();
+ if (disable) {
+ document.getElementById('checkout_submit_barcode_button').disabled = true;
+ document.getElementById('checkout_done').disabled = true;
+ obj.controller.view.checkout_menu.disabled = true;
+ obj.controller.view.checkout_barcode_entry_textbox.disabled = true;
+ } else {
+ document.getElementById('checkout_submit_barcode_button').disabled = false;
+ document.getElementById('checkout_done').disabled = false;
+ obj.controller.view.checkout_menu.disabled = false;
+ obj.controller.view.checkout_barcode_entry_textbox.disabled = false;
+ }
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.checkout.disable.error'),E);
+ }
+ },
+
+ 'print' : function(silent,f) {
+ var obj = this;
+ try {
+ obj.patron = obj.network.simple_request('FM_AU_FLESHED_RETRIEVE_VIA_ID',[ses(),obj.patron_id]);
var params = {
'patron' : obj.patron,
'lib' : obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ],
@@ -312,121 +312,121 @@ circ.checkout.prototype = {
);
}
};
- if (silent) { params.no_prompt = true; }
- obj.list.print(params);
- } catch(E) {
- obj.error.standard_unexpected_error_alert('print',E);
- }
- },
-
- 'export_list' : function(silent,f) {
- var obj = this;
- try {
- obj.list.dump_csv_to_clipboard();
- } catch(E) {
- obj.error.standard_unexpected_error_alert('export',E);
- }
- },
-
- 'check_date' : function(node) {
+ if (silent) { params.no_prompt = true; }
+ obj.list.print(params);
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('print',E);
+ }
+ },
+
+ 'export_list' : function(silent,f) {
+ var obj = this;
+ try {
+ obj.list.dump_csv_to_clipboard();
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('export',E);
+ }
+ },
+
+ 'check_date' : function(node) {
var obj = this;
- JSAN.use('util.date');
- try {
+ JSAN.use('util.date');
+ try {
obj.controller.view.checkout_barcode_entry_textbox.setAttribute('disabled','false');
obj.controller.view.checkout_barcode_entry_textbox.disabled = false;
obj.controller.view.cmd_checkout_submit.setAttribute('disabled','false');
obj.controller.view.cmd_checkout_submit.disabled = false;
- if (util.date.check_past('YYYY-MM-DD',node.value) ) {
- obj.controller.view.checkout_barcode_entry_textbox.setAttribute('disabled','true');
- obj.controller.view.cmd_checkout_submit.setAttribute('disabled','true');
+ if (util.date.check_past('YYYY-MM-DD',node.value) ) {
+ obj.controller.view.checkout_barcode_entry_textbox.setAttribute('disabled','true');
+ obj.controller.view.cmd_checkout_submit.setAttribute('disabled','true');
return false;
- }
- return true;
- } catch(E) {
- throw(E);
- }
- },
-
- '_checkout_pending_hash' : {},
-
- '_checkout' : function(params,permit) {
- var obj = this;
- try {
-
- /**********************************************************************************************************************/
- /* This handles the return value of the checkout/renewal */
- function _checkout_callback(req,x) {
- try {
-
- if (params.barcode) {
- delete obj._checkout_pending_hash[ params.barcode ];
- }
-
- var checkout = req.getResultObject();
-
- if (checkout.ilsevent === '0') {
-
- if (!checkout.payload) { checkout.payload = {}; }
-
- if (!checkout.payload.circ) {
- checkout.payload.circ = new aoc();
- /*********************************************************************************************/
- /* Non Cat */
- if (checkout.payload.noncat_circ) {
- checkout.payload.circ.circ_lib( checkout.payload.noncat_circ.circ_lib() );
- checkout.payload.circ.circ_staff( checkout.payload.noncat_circ.staff() );
- checkout.payload.circ.usr( checkout.payload.noncat_circ.patron() );
-
- JSAN.use('util.date');
- var c = checkout.payload.noncat_circ.circ_time();
- var d = c == "now" ? new Date() : util.date.db_date2Date( c );
- var t =obj.data.hash.cnct[ checkout.payload.noncat_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 );
- checkout.payload.circ.due_date( util.date.formatted_date(d,'%F') );
-
- }
- }
-
- if (!checkout.payload.record) {
- checkout.payload.record = new mvr();
- /*********************************************************************************************/
- /* Non Cat */
- if (checkout.payload.noncat_circ) {
- checkout.payload.record.title(
- obj.data.hash.cnct[ checkout.payload.noncat_circ.item_type() ].name()
- );
- }
- }
-
- if (!checkout.payload.copy) {
- checkout.payload.copy = new acp();
- checkout.payload.copy.barcode( '' );
- }
-
- /*********************************************************************************************/
- /* Override mvr title/author with dummy title/author for Pre cat */
- if (checkout.payload.copy.dummy_title()) {
- checkout.payload.record.title( checkout.payload.copy.dummy_title() );
- }
- if (checkout.payload.copy.dummy_author()) {
- checkout.payload.record.author( checkout.payload.copy.dummy_author() );
- }
-
- obj.list.append(
- {
- 'row' : {
- 'my' : {
- 'circ' : checkout.payload.circ,
- 'mvr' : checkout.payload.record,
- 'acp' : checkout.payload.copy
- }
- },
- 'to_top' : true
- //I could override map_row_to_column here
- }
- );
+ }
+ return true;
+ } catch(E) {
+ throw(E);
+ }
+ },
+
+ '_checkout_pending_hash' : {},
+
+ '_checkout' : function(params,permit) {
+ var obj = this;
+ try {
+
+ /**********************************************************************************************************************/
+ /* This handles the return value of the checkout/renewal */
+ function _checkout_callback(req,x) {
+ try {
+
+ if (params.barcode) {
+ delete obj._checkout_pending_hash[ params.barcode ];
+ }
+
+ var checkout = req.getResultObject();
+
+ if (checkout.ilsevent === '0') {
+
+ if (!checkout.payload) { checkout.payload = {}; }
+
+ if (!checkout.payload.circ) {
+ checkout.payload.circ = new aoc();
+ /*********************************************************************************************/
+ /* Non Cat */
+ if (checkout.payload.noncat_circ) {
+ checkout.payload.circ.circ_lib( checkout.payload.noncat_circ.circ_lib() );
+ checkout.payload.circ.circ_staff( checkout.payload.noncat_circ.staff() );
+ checkout.payload.circ.usr( checkout.payload.noncat_circ.patron() );
+
+ JSAN.use('util.date');
+ var c = checkout.payload.noncat_circ.circ_time();
+ var d = c == "now" ? new Date() : util.date.db_date2Date( c );
+ var t =obj.data.hash.cnct[ checkout.payload.noncat_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 );
+ checkout.payload.circ.due_date( util.date.formatted_date(d,'%F') );
+
+ }
+ }
+
+ if (!checkout.payload.record) {
+ checkout.payload.record = new mvr();
+ /*********************************************************************************************/
+ /* Non Cat */
+ if (checkout.payload.noncat_circ) {
+ checkout.payload.record.title(
+ obj.data.hash.cnct[ checkout.payload.noncat_circ.item_type() ].name()
+ );
+ }
+ }
+
+ if (!checkout.payload.copy) {
+ checkout.payload.copy = new acp();
+ checkout.payload.copy.barcode( '' );
+ }
+
+ /*********************************************************************************************/
+ /* Override mvr title/author with dummy title/author for Pre cat */
+ if (checkout.payload.copy.dummy_title()) {
+ checkout.payload.record.title( checkout.payload.copy.dummy_title() );
+ }
+ if (checkout.payload.copy.dummy_author()) {
+ checkout.payload.record.author( checkout.payload.copy.dummy_author() );
+ }
+
+ obj.list.append(
+ {
+ 'row' : {
+ 'my' : {
+ 'circ' : checkout.payload.circ,
+ 'mvr' : checkout.payload.record,
+ 'acp' : checkout.payload.copy
+ }
+ },
+ 'to_top' : true
+ //I could override map_row_to_column here
+ }
+ );
obj.error.work_log(
document.getElementById('circStrings').getFormattedString(
'staff.circ.work_log_checkout.message',
@@ -443,19 +443,19 @@ circ.checkout.prototype = {
'acp_barcode' : checkout.payload.copy.barcode()
}
);
- document.getElementById('msg_area').removeChild(x);
- /*
- if (typeof obj.on_checkout == 'function') {
- obj.on_checkout(checkout.payload);
- }
- */
- if (typeof window.xulG == 'object' && typeof window.xulG.on_list_change == 'function') {
- window.xulG.on_list_change(checkout.payload);
- } else {
- obj.error.sdump('D_CIRC','circ.checkout: No external .on_checkout()\n');
- }
-
- } else {
+ document.getElementById('msg_area').removeChild(x);
+ /*
+ if (typeof obj.on_checkout == 'function') {
+ obj.on_checkout(checkout.payload);
+ }
+ */
+ if (typeof window.xulG == 'object' && typeof window.xulG.on_list_change == 'function') {
+ window.xulG.on_list_change(checkout.payload);
+ } else {
+ obj.error.sdump('D_CIRC','circ.checkout: No external .on_checkout()\n');
+ }
+
+ } else {
// Should get here with failed renewals
switch(Number(checkout.ilsevent)) {
case null /* custom event */ :
@@ -477,86 +477,86 @@ circ.checkout.prototype = {
case 7009 /* CIRC_CLAIMS_RETURNED */ :
case 7010 /* COPY_ALERT_MESSAGE */ :
case 7013 /* PATRON_EXCEEDS_FINES */ :
- x.setAttribute('style','color: red');
- x.setAttribute('value', document.getElementById('circStrings').getFormattedString('staff.circ.checkout.barcode.failed', [params.barcode]));
- if (typeof params.noncat == 'undefined') { obj.items_out_count--; }
+ x.setAttribute('style','color: red');
+ x.setAttribute('value', document.getElementById('circStrings').getFormattedString('staff.circ.checkout.barcode.failed', [params.barcode]));
+ if (typeof params.noncat == 'undefined') { obj.items_out_count--; }
break;
default: throw(checkout);
}
- }
-
- } catch(E) {
- x.setAttribute('style','color: red');
- x.setAttribute('value', document.getElementById('circStrings').getFormattedString('staff.circ.checkout.barcode.failed', [params.barcode]));
- if (typeof params.noncat == 'undefined') { obj.items_out_count--; }
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkout.barcode.failed.alert', ['#3']),E);
- }
- }
-
- /**********************************************************************************************************************/
- /* This used to do the actual checkout/renewal */
-
- var x = document.createElement('label');
- x.setAttribute('style','color: green');
- if (params.barcode) {
- x.setAttribute('value',document.getElementById('circStrings').getFormattedString('staff.circ.checkout.barcode.pending', [params.barcode]));
- } else {
- x.setAttribute('value',document.getElementById('circStrings').getString('staff.circ.checkout.non_cataloged.pending'));
- }
- document.getElementById('msg_area').appendChild(x);
+ }
+
+ } catch(E) {
+ x.setAttribute('style','color: red');
+ x.setAttribute('value', document.getElementById('circStrings').getFormattedString('staff.circ.checkout.barcode.failed', [params.barcode]));
+ if (typeof params.noncat == 'undefined') { obj.items_out_count--; }
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkout.barcode.failed.alert', ['#3']),E);
+ }
+ }
+
+ /**********************************************************************************************************************/
+ /* This used to do the actual checkout/renewal */
+
+ var x = document.createElement('label');
+ x.setAttribute('style','color: green');
+ if (params.barcode) {
+ x.setAttribute('value',document.getElementById('circStrings').getFormattedString('staff.circ.checkout.barcode.pending', [params.barcode]));
+ } else {
+ x.setAttribute('value',document.getElementById('circStrings').getString('staff.circ.checkout.non_cataloged.pending'));
+ }
+ document.getElementById('msg_area').appendChild(x);
/*
- obj.network.request(
- api.CHECKOUT.app,
- api.CHECKOUT.method,
- [ ses(), params, obj.items_out_count ],
- function(req) {
- _checkout_callback(req,x);
- }
- );
+ obj.network.request(
+ api.CHECKOUT.app,
+ api.CHECKOUT.method,
+ [ ses(), params, obj.items_out_count ],
+ function(req) {
+ _checkout_callback(req,x);
+ }
+ );
*/
-
- if (typeof params.noncat == 'undefined') { obj.items_out_count++; }
+
+ if (typeof params.noncat == 'undefined') { obj.items_out_count++; }
/* new */
_checkout_callback({ 'getResultObject' : function() { return permit; } },x);
- } catch(E) {
- x.setAttribute('style','color: red');
- x.setAttribute('value', document.getElementById('circStrings').getFormattedString('staff.circ.checkout.barcode.failed', [params.barcode]));
- if (typeof params.noncat == 'undefined') { obj.items_out_count--; }
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkout.barcode.failed.alert', ['#2']),E);
- }
- },
-
-
- 'test_barcode' : function(bc) {
- var obj = this;
- var x = document.getElementById('strict_barcode');
- if (x && x.checked !== true) { return true; }
- var good = util.barcode.check(bc);
- if (good) {
- return true;
- } else {
- if ( 1 == obj.error.yns_alert(
- document.getElementById('circStrings').getFormattedString('staff.circ.check_digit.bad', [bc]),
- document.getElementById('circStrings').getString('staff.circ.barcode.bad'),
- document.getElementById('circStrings').getString('staff.circ.cancel'),
- document.getElementById('circStrings').getString('staff.circ.barcode.accept'),
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm'),
- '/xul/server/skin/media/images/bad_barcode.png'
- )
- ) {
- return true;
- } else {
- return false;
- }
- }
- },
-
- 'checkout' : function(params) {
- var obj = this;
+ } catch(E) {
+ x.setAttribute('style','color: red');
+ x.setAttribute('value', document.getElementById('circStrings').getFormattedString('staff.circ.checkout.barcode.failed', [params.barcode]));
+ if (typeof params.noncat == 'undefined') { obj.items_out_count--; }
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkout.barcode.failed.alert', ['#2']),E);
+ }
+ },
+
+
+ 'test_barcode' : function(bc) {
+ var obj = this;
+ var x = document.getElementById('strict_barcode');
+ if (x && x.checked !== true) { return true; }
+ var good = util.barcode.check(bc);
+ if (good) {
+ return true;
+ } else {
+ if ( 1 == obj.error.yns_alert(
+ document.getElementById('circStrings').getFormattedString('staff.circ.check_digit.bad', [bc]),
+ document.getElementById('circStrings').getString('staff.circ.barcode.bad'),
+ document.getElementById('circStrings').getString('staff.circ.cancel'),
+ document.getElementById('circStrings').getString('staff.circ.barcode.accept'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm'),
+ '/xul/server/skin/media/images/bad_barcode.png'
+ )
+ ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ },
+
+ 'checkout' : function(params) {
+ var obj = this;
if (document.getElementById('checkout_duedate_checkbox').checked) {
if (! obj.check_date(obj.controller.view.checkout_duedate_datepicker)) return;
@@ -572,256 +572,256 @@ circ.checkout.prototype = {
params.due_date = util.date.formatted_date(tp_date,'%{iso8601}');
}
- if (typeof obj.on_checkout == 'function') { obj.on_checkout(params); }
+ if (typeof obj.on_checkout == 'function') { obj.on_checkout(params); }
- if (! (params.barcode||params.noncat)) { return; }
+ if (! (params.barcode||params.noncat)) { return; }
- if (params.barcode) {
+ if (params.barcode) {
- if ( obj.test_barcode(params.barcode) ) { /* good */ } else { /* bad */ return; }
+ if ( obj.test_barcode(params.barcode) ) { /* good */ } else { /* bad */ return; }
- if (typeof obj._checkout_pending_hash[ params.barcode ] != 'undefined') {
+ if (typeof obj._checkout_pending_hash[ params.barcode ] != 'undefined') {
- obj.error.sdump('D_CIRC','Redundant barcode scan == ' + params.barcode);
- return; // redundant barcode scan
+ obj.error.sdump('D_CIRC','Redundant barcode scan == ' + params.barcode);
+ return; // redundant barcode scan
- } else {
+ } else {
- obj._checkout_pending_hash[ params.barcode ] = true;
+ obj._checkout_pending_hash[ params.barcode ] = true;
- }
- }
+ }
+ }
- /**********************************************************************************************************************/
- /* This used to be the Permissibility test before checkout */
- try {
+ /**********************************************************************************************************************/
+ /* This used to be the Permissibility test before checkout */
+ try {
- params.patron = obj.patron_id;
+ params.patron = obj.patron_id;
- var permit = obj.network.simple_request(
- //api.CHECKOUT_PERMIT.app,
- 'CHECKOUT_FULL',
- [ ses(), params, obj.items_out_count ],
- null,
- {
- 'title' : document.getElementById('circStrings').getString('staff.circ.checkout.override.confirm'),
- 'overridable_events' : [
+ var permit = obj.network.simple_request(
+ //api.CHECKOUT_PERMIT.app,
+ 'CHECKOUT_FULL',
+ [ ses(), params, obj.items_out_count ],
+ null,
+ {
+ 'title' : document.getElementById('circStrings').getString('staff.circ.checkout.override.confirm'),
+ 'overridable_events' : [
null /* custom event */,
- 1212 /* PATRON_EXCEEDS_OVERDUE_COUNT */,
- 1213 /* PATRON_BARRED */,
- 1215 /* CIRC_EXCEEDS_COPY_RANGE */,
+ 1212 /* PATRON_EXCEEDS_OVERDUE_COUNT */,
+ 1213 /* PATRON_BARRED */,
+ 1215 /* CIRC_EXCEEDS_COPY_RANGE */,
1232 /* ITEM_DEPOSIT_REQUIRED */,
1233 /* ITEM_RENTAL_FEE_REQUIRED */,
- 7002 /* PATRON_EXCEEDS_CHECKOUT_COUNT */,
- 7003 /* COPY_CIRC_NOT_ALLOWED */,
- 7004 /* COPY_NOT_AVAILABLE */,
- 7006 /* COPY_IS_REFERENCE */,
- 7010 /* COPY_ALERT_MESSAGE */,
- 7016 /* ITEM_ON_HOLDS_SHELF */,
- 7013 /* PATRON_EXCEEDS_FINES */
- ],
- 'text' : {
+ 7002 /* PATRON_EXCEEDS_CHECKOUT_COUNT */,
+ 7003 /* COPY_CIRC_NOT_ALLOWED */,
+ 7004 /* COPY_NOT_AVAILABLE */,
+ 7006 /* COPY_IS_REFERENCE */,
+ 7010 /* COPY_ALERT_MESSAGE */,
+ 7016 /* ITEM_ON_HOLDS_SHELF */,
+ 7013 /* PATRON_EXCEEDS_FINES */
+ ],
+ 'text' : {
'1232' : function(r) {
return document.getElementById('circStrings').getString('staff.circ.checkout.override.item_deposit_required.warning');
},
'1233' : function(r) {
return document.getElementById('circStrings').getString('staff.circ.checkout.override.item_rental_fee_required.warning');
},
- '7004' : function(r) {
- return r.payload.status().name();
- },
- '7010' : function(r) {
- return r.payload;
- }
- }
- }
- );
-
- if (!permit) { throw(permit); }
-
- function test_event(list,ev) {
- if (typeof list.ilsevent != 'undefined' ) {
- if (list.ilsevent == ev) {
- return list;
- } else {
- return false;
- }
- } else {
- for (var i = 0; i < list.length; i++) {
- if (typeof list[i].ilsevent != 'undefined') {
- if (list[i].ilsevent == ev) { return list[i]; }
- }
- }
- return false;
- }
- }
-
- /**********************************************************************************************************************/
- /* Normal case, proceed with checkout */
- if (permit.ilsevent === '0') {
-
- JSAN.use('util.sound'); var sound = new util.sound(); sound.circ_good();
- params.permit_key = permit.payload;
- obj._checkout( params, permit );
-
- /**********************************************************************************************************************/
- /* Item not cataloged or barcode mis-scan. Prompt for pre-cat option */
- } else {
-
- if (params.barcode) { delete obj._checkout_pending_hash[ params.barcode ]; }
-
- var found_handled = false; var found_not_handled = false; var msg = '';
-
- if (test_event(permit,1202 /* ITEM_NOT_CATALOGED */)) {
-
- if ( 1 == obj.error.yns_alert(
- document.getElementById('circStrings').getString('staff.circ.checkout.not_cataloged.confirm'),
- document.getElementById('circStrings').getString('staff.circ.alert'),
- document.getElementById('circStrings').getString('staff.circ.cancel'),
- document.getElementById('circStrings').getString('staff.circ.pre_cataloged'),
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm'),
- '/xul/server/skin/media/images/book_question.png'
- ) ) {
-
- obj.data.dummy_title = ''; obj.data.dummy_author = ''; obj.data.stash('dummy_title','dummy_author');
- JSAN.use('util.window'); var win = new util.window();
- win.open(urls.XUL_PRE_CAT, 'dummy_fields', 'chrome,resizable,modal');
- obj.data.stash_retrieve();
-
- params.permit_key = permit.payload;
- params.dummy_title = obj.data.precat_dummy_title;
- params.dummy_author = obj.data.precat_dummy_author;
- params.dummy_isbn = obj.data.precat_dummy_isbn;
- params.circ_modifier = obj.data.precat_circ_modifier;
- params.precat = 1;
-
- if (obj.data.precat_submit == 'go') {
- //obj._checkout( params ); No real request method here anymore
- obj.checkout( params );
- } else {
- alert(document.getElementById('circStrings').getString('staff.circ.checkout.cancelled'));
- }
- }
+ '7004' : function(r) {
+ return r.payload.status().name();
+ },
+ '7010' : function(r) {
+ return r.payload;
+ }
+ }
+ }
+ );
+
+ if (!permit) { throw(permit); }
+
+ function test_event(list,ev) {
+ if (typeof list.ilsevent != 'undefined' ) {
+ if (list.ilsevent == ev) {
+ return list;
+ } else {
+ return false;
+ }
+ } else {
+ for (var i = 0; i < list.length; i++) {
+ if (typeof list[i].ilsevent != 'undefined') {
+ if (list[i].ilsevent == ev) { return list[i]; }
+ }
+ }
+ return false;
+ }
+ }
+
+ /**********************************************************************************************************************/
+ /* Normal case, proceed with checkout */
+ if (permit.ilsevent === '0') {
+
+ JSAN.use('util.sound'); var sound = new util.sound(); sound.circ_good();
+ params.permit_key = permit.payload;
+ obj._checkout( params, permit );
+
+ /**********************************************************************************************************************/
+ /* Item not cataloged or barcode mis-scan. Prompt for pre-cat option */
+ } else {
+
+ if (params.barcode) { delete obj._checkout_pending_hash[ params.barcode ]; }
+
+ var found_handled = false; var found_not_handled = false; var msg = '';
+
+ if (test_event(permit,1202 /* ITEM_NOT_CATALOGED */)) {
+
+ if ( 1 == obj.error.yns_alert(
+ document.getElementById('circStrings').getString('staff.circ.checkout.not_cataloged.confirm'),
+ document.getElementById('circStrings').getString('staff.circ.alert'),
+ document.getElementById('circStrings').getString('staff.circ.cancel'),
+ document.getElementById('circStrings').getString('staff.circ.pre_cataloged'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm'),
+ '/xul/server/skin/media/images/book_question.png'
+ ) ) {
+
+ obj.data.dummy_title = ''; obj.data.dummy_author = ''; obj.data.stash('dummy_title','dummy_author');
+ JSAN.use('util.window'); var win = new util.window();
+ win.open(urls.XUL_PRE_CAT, 'dummy_fields', 'chrome,resizable,modal');
+ obj.data.stash_retrieve();
+
+ params.permit_key = permit.payload;
+ params.dummy_title = obj.data.precat_dummy_title;
+ params.dummy_author = obj.data.precat_dummy_author;
+ params.dummy_isbn = obj.data.precat_dummy_isbn;
+ params.circ_modifier = obj.data.precat_circ_modifier;
+ params.precat = 1;
+
+ if (obj.data.precat_submit == 'go') {
+ //obj._checkout( params ); No real request method here anymore
+ obj.checkout( params );
+ } else {
+ alert(document.getElementById('circStrings').getString('staff.circ.checkout.cancelled'));
+ }
+ }
return;
- }
-
- var test_permit;
- if (typeof permit.ilsevent != 'undefined') { test_permit = [ permit ]; } else { test_permit = permit; }
-
- var stop_checkout = false;
- for (var i = 0; i < test_permit.length; i++) {
- switch(Number(test_permit[i].ilsevent)) {
- case 1216 /* PATRON_CARD_INACTIVE */ :
- case 1217 /* PATRON_INACTIVE */ :
- case 1224 /* PATRON_ACCOUNT_EXPIRED */ :
- stop_checkout = true;
- break;
- }
- }
-
- for (var i = 0; i < test_permit.length; i++) {
- dump('found [' + test_permit[i].ilsevent + ']\n');
- switch(test_permit[i].ilsevent == null ? null : Number(test_permit[i].ilsevent)) {
- case null /* custom event */ :
- found_handled = true;
- break;
- case 1212 /* PATRON_EXCEEDS_OVERDUE_COUNT */ :
- found_handled = true;
- break;
- case 1213 /* PATRON_BARRED */ :
- found_handled = true;
- break;
- case 1215 /* CIRC_EXCEEDS_COPY_RANGE */ :
- found_handled = true;
- break;
- case 1216 /* PATRON_CARD_INACTIVE */ :
- found_handled = true;
- msg += document.getElementById('circStrings').getString('staff.circ.checkout.card.inactive') + '\n';
- obj.error.yns_alert(
- msg,
- document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
- document.getElementById('circStrings').getString('staff.circ.checkout.ok.btn'),
- null,
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg')
- );
- break;
- case 1217 /* PATRON_INACTIVE */ :
- found_handled = true;
- msg += document.getElementById('circStrings').getString('staff.circ.checkout.account.inactive') + '\n';
- obj.error.yns_alert(
- msg,
- document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
- document.getElementById('circStrings').getString('staff.circ.checkout.ok.btn'),
- null,
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg')
- );
- break;
- case 1224 /* PATRON_ACCOUNT_EXPIRED */ :
- found_handled = true;
- msg += document.getElementById('circStrings').getString('staff.circ.checkout.account.expired') + '\n';
- obj.error.yns_alert(
- msg,
- document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
- document.getElementById('circStrings').getString('staff.circ.checkout.ok.btn'),
- null,
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg')
- );
- break;
- case 1232 /* ITEM_DEPOSIT_REQUIRED */ :
- case 1233 /* ITEM_RENTAL_FEE_REQUIRED */ :
- case 7013 /* PATRON_EXCEEDS_FINES */ :
- found_handled = true;
- break;
- case 7002 /* PATRON_EXCEEDS_CHECKOUT_COUNT */ :
- found_handled = true;
- break;
- case 7003 /* COPY_CIRC_NOT_ALLOWED */ :
- found_handled = true;
- break;
- case 7004 /* COPY_NOT_AVAILABLE */ :
- msg += test_permit[i].desc + '\n' + document.getElementById('circStrings').getFormattedString('staff.circ.checkout.copy_status', [test_permit[i].payload.status().name()]) + '\n';
- found_handled = true;
- break;
- case 7006 /* COPY_IS_REFERENCE */ :
- msg += test_permit[i].desc + '\n';
- found_handled = true;
- break;
- case 7009 /* CIRC_CLAIMS_RETURNED */ :
- msg += test_permit[i].desc + '\n';
- obj.error.yns_alert(
- msg,
- document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
- document.getElementById('circStrings').getString('staff.circ.checkout.ok.btn'),
- null,
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg')
- );
- found_handled = true;
- break;
- case 7010 /* COPY_ALERT_MESSAGE */ :
- msg += test_permit[i].desc + '\n' + document.getElementById('circStrings').getFormattedString('staff.circ.checkout.alert_message', [test_permit[i].payload]) + '\n';
- found_handled = true;
- break;
- case 7016 /* ITEM_ON_HOLDS_SHELF */ :
- msg += test_permit[i].desc + '\n';
- found_handled = true;
- break;
- case 1202 /* ITEM_NOT_CATALOGED */ :
- found_handled = true;
- break;
- case 5000 /* PERM_FAILURE */ :
- msg += test_permit[i].desc + '\n' + document.getElementById('circStrings').getFormattedString('staff.circ.checkout.permission_denied', [test_permit[i].ilsperm]) + '\n';
- found_handled = true;
- break;
- case 1702 /* OPEN_CIRCULATION_EXISTS */ :
- msg += test_permit[i].desc + '\n';
- found_handled = true;
+ }
+
+ var test_permit;
+ if (typeof permit.ilsevent != 'undefined') { test_permit = [ permit ]; } else { test_permit = permit; }
+
+ var stop_checkout = false;
+ for (var i = 0; i < test_permit.length; i++) {
+ switch(Number(test_permit[i].ilsevent)) {
+ case 1216 /* PATRON_CARD_INACTIVE */ :
+ case 1217 /* PATRON_INACTIVE */ :
+ case 1224 /* PATRON_ACCOUNT_EXPIRED */ :
+ stop_checkout = true;
+ break;
+ }
+ }
+
+ for (var i = 0; i < test_permit.length; i++) {
+ dump('found [' + test_permit[i].ilsevent + ']\n');
+ switch(test_permit[i].ilsevent == null ? null : Number(test_permit[i].ilsevent)) {
+ case null /* custom event */ :
+ found_handled = true;
+ break;
+ case 1212 /* PATRON_EXCEEDS_OVERDUE_COUNT */ :
+ found_handled = true;
+ break;
+ case 1213 /* PATRON_BARRED */ :
+ found_handled = true;
+ break;
+ case 1215 /* CIRC_EXCEEDS_COPY_RANGE */ :
+ found_handled = true;
+ break;
+ case 1216 /* PATRON_CARD_INACTIVE */ :
+ found_handled = true;
+ msg += document.getElementById('circStrings').getString('staff.circ.checkout.card.inactive') + '\n';
+ obj.error.yns_alert(
+ msg,
+ document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
+ document.getElementById('circStrings').getString('staff.circ.checkout.ok.btn'),
+ null,
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg')
+ );
+ break;
+ case 1217 /* PATRON_INACTIVE */ :
+ found_handled = true;
+ msg += document.getElementById('circStrings').getString('staff.circ.checkout.account.inactive') + '\n';
+ obj.error.yns_alert(
+ msg,
+ document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
+ document.getElementById('circStrings').getString('staff.circ.checkout.ok.btn'),
+ null,
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg')
+ );
+ break;
+ case 1224 /* PATRON_ACCOUNT_EXPIRED */ :
+ found_handled = true;
+ msg += document.getElementById('circStrings').getString('staff.circ.checkout.account.expired') + '\n';
+ obj.error.yns_alert(
+ msg,
+ document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
+ document.getElementById('circStrings').getString('staff.circ.checkout.ok.btn'),
+ null,
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg')
+ );
+ break;
+ case 1232 /* ITEM_DEPOSIT_REQUIRED */ :
+ case 1233 /* ITEM_RENTAL_FEE_REQUIRED */ :
+ case 7013 /* PATRON_EXCEEDS_FINES */ :
+ found_handled = true;
+ break;
+ case 7002 /* PATRON_EXCEEDS_CHECKOUT_COUNT */ :
+ found_handled = true;
+ break;
+ case 7003 /* COPY_CIRC_NOT_ALLOWED */ :
+ found_handled = true;
+ break;
+ case 7004 /* COPY_NOT_AVAILABLE */ :
+ msg += test_permit[i].desc + '\n' + document.getElementById('circStrings').getFormattedString('staff.circ.checkout.copy_status', [test_permit[i].payload.status().name()]) + '\n';
+ found_handled = true;
+ break;
+ case 7006 /* COPY_IS_REFERENCE */ :
+ msg += test_permit[i].desc + '\n';
+ found_handled = true;
+ break;
+ case 7009 /* CIRC_CLAIMS_RETURNED */ :
+ msg += test_permit[i].desc + '\n';
+ obj.error.yns_alert(
+ msg,
+ document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
+ document.getElementById('circStrings').getString('staff.circ.checkout.ok.btn'),
+ null,
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg')
+ );
+ found_handled = true;
+ break;
+ case 7010 /* COPY_ALERT_MESSAGE */ :
+ msg += test_permit[i].desc + '\n' + document.getElementById('circStrings').getFormattedString('staff.circ.checkout.alert_message', [test_permit[i].payload]) + '\n';
+ found_handled = true;
+ break;
+ case 7016 /* ITEM_ON_HOLDS_SHELF */ :
+ msg += test_permit[i].desc + '\n';
+ found_handled = true;
+ break;
+ case 1202 /* ITEM_NOT_CATALOGED */ :
+ found_handled = true;
+ break;
+ case 5000 /* PERM_FAILURE */ :
+ msg += test_permit[i].desc + '\n' + document.getElementById('circStrings').getFormattedString('staff.circ.checkout.permission_denied', [test_permit[i].ilsperm]) + '\n';
+ found_handled = true;
+ break;
+ case 1702 /* OPEN_CIRCULATION_EXISTS */ :
+ msg += test_permit[i].desc + '\n';
+ found_handled = true;
var foreign_circ = true;
var my_circ;
@@ -841,7 +841,7 @@ circ.checkout.prototype = {
my_circ = my_circ[0];
}
- if (! stop_checkout ) {
+ if (! stop_checkout ) {
var due_date = my_circ.due_date() ? my_circ.due_date().substr(0,10) : null;
JSAN.use('util.date'); var today = util.date.formatted_date(new Date(),'%F');
@@ -909,116 +909,116 @@ circ.checkout.prototype = {
}
}
}
- } else {
- obj.error.yns_alert(
- msg,
- document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
- document.getElementById('circStrings').getString('staff.circ.checkout.ok.btn'),
- null,
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg')
- );
- }
- break;
- case 7014 /* COPY_IN_TRANSIT */ :
- msg += test_permit[i].desc + '\n';
- found_handled = true;
- if (! stop_checkout ) {
- var r = obj.error.yns_alert(
- msg,
- document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
- document.getElementById('circStrings').getString('staff.circ.cancel'),
- document.getElementById('circStrings').getString('staff.circ.checkout.abort_transit_then_checkout'),
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg')
- );
- if (r == 1) {
- var robj = obj.network.simple_request('FM_ATC_VOID',[ ses(), { 'barcode' : params.barcode } ]);
- if (typeof robj.ilsevent == 'undefined') {
- obj.checkout(params);
- } else {
- switch(robj.ilsevent) {
- case 1225 /* TRANSIT_ABORT_NOT_ALLOWED */ :
- alert(robj.desc);
- break;
- case 5000 /* PERM_FAILURE */ :
- break;
- default:
- throw(robj);
- break;
- }
- }
- }
- } else {
- obj.error.yns_alert(
- msg,
- document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
- document.getElementById('circStrings').getString('staff.circ.checkout.ok.btn'),
- null,
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg')
- );
- }
- break;
- case -1 /* NETWORK_FAILURE */ :
- msg += document.getElementById('circStrings').getString('staff.circ.checkout.network_failure') + '\n';
- found_handled = true;
- obj.error.yns_alert(
- msg,
- document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
- document.getElementById('circStrings').getString('staff.circ.checkout.ok.btn'),
- null,
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg')
- );
- break;
- default:
- msg += 'FIXME: ' + js2JSON(test_permit[i]) + '\n';
- found_not_handled = true;
- break;
- }
- }
-
- if (found_not_handled) {
- obj.error.standard_unexpected_error_alert(msg,permit);
- }
-
- obj.controller.view.checkout_barcode_entry_textbox.select();
- obj.controller.view.checkout_barcode_entry_textbox.focus();
- }
-
- } catch(E) {
- if (params.barcode) { delete obj._checkout_pending_hash[ params.barcode ]; }
- if (typeof E.ilsevent != 'undefined' && E.ilsevent == -1) {
- obj.error.standard_network_error_alert(document.getElementById('circStrings').getString('staff.circ.checkout.suggest_offline'));
- } else {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),E);
- }
- if (typeof obj.on_failure == 'function') {
- obj.on_failure(E);
- }
- if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
- obj.error.sdump('D_CIRC','circ.checkout: Calling external .on_failure()\n');
- window.xulG.on_failure(E);
- } else {
- obj.error.sdump('D_CIRC','circ.checkout: No external .on_failure()\n');
- }
- }
-
- },
-
- 'on_checkout' : function() {
- this.controller.view.checkout_menu.selectedIndex = 0;
- this.controller.view.checkout_barcode_entry_textbox.disabled = false;
- this.controller.view.checkout_barcode_entry_textbox.value = '';
- this.controller.view.checkout_barcode_entry_textbox.focus();
- document.getElementById('duedate_hbox').hidden = false;
- },
-
- 'on_failure' : function() {
- this.controller.view.checkout_barcode_entry_textbox.select();
- this.controller.view.checkout_barcode_entry_textbox.focus();
- }
+ } else {
+ obj.error.yns_alert(
+ msg,
+ document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
+ document.getElementById('circStrings').getString('staff.circ.checkout.ok.btn'),
+ null,
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg')
+ );
+ }
+ break;
+ case 7014 /* COPY_IN_TRANSIT */ :
+ msg += test_permit[i].desc + '\n';
+ found_handled = true;
+ if (! stop_checkout ) {
+ var r = obj.error.yns_alert(
+ msg,
+ document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
+ document.getElementById('circStrings').getString('staff.circ.cancel'),
+ document.getElementById('circStrings').getString('staff.circ.checkout.abort_transit_then_checkout'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg')
+ );
+ if (r == 1) {
+ var robj = obj.network.simple_request('FM_ATC_VOID',[ ses(), { 'barcode' : params.barcode } ]);
+ if (typeof robj.ilsevent == 'undefined') {
+ obj.checkout(params);
+ } else {
+ switch(robj.ilsevent) {
+ case 1225 /* TRANSIT_ABORT_NOT_ALLOWED */ :
+ alert(robj.desc);
+ break;
+ case 5000 /* PERM_FAILURE */ :
+ break;
+ default:
+ throw(robj);
+ break;
+ }
+ }
+ }
+ } else {
+ obj.error.yns_alert(
+ msg,
+ document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
+ document.getElementById('circStrings').getString('staff.circ.checkout.ok.btn'),
+ null,
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg')
+ );
+ }
+ break;
+ case -1 /* NETWORK_FAILURE */ :
+ msg += document.getElementById('circStrings').getString('staff.circ.checkout.network_failure') + '\n';
+ found_handled = true;
+ obj.error.yns_alert(
+ msg,
+ document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
+ document.getElementById('circStrings').getString('staff.circ.checkout.ok.btn'),
+ null,
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg')
+ );
+ break;
+ default:
+ msg += 'FIXME: ' + js2JSON(test_permit[i]) + '\n';
+ found_not_handled = true;
+ break;
+ }
+ }
+
+ if (found_not_handled) {
+ obj.error.standard_unexpected_error_alert(msg,permit);
+ }
+
+ obj.controller.view.checkout_barcode_entry_textbox.select();
+ obj.controller.view.checkout_barcode_entry_textbox.focus();
+ }
+
+ } catch(E) {
+ if (params.barcode) { delete obj._checkout_pending_hash[ params.barcode ]; }
+ if (typeof E.ilsevent != 'undefined' && E.ilsevent == -1) {
+ obj.error.standard_network_error_alert(document.getElementById('circStrings').getString('staff.circ.checkout.suggest_offline'));
+ } else {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),E);
+ }
+ if (typeof obj.on_failure == 'function') {
+ obj.on_failure(E);
+ }
+ if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
+ obj.error.sdump('D_CIRC','circ.checkout: Calling external .on_failure()\n');
+ window.xulG.on_failure(E);
+ } else {
+ obj.error.sdump('D_CIRC','circ.checkout: No external .on_failure()\n');
+ }
+ }
+
+ },
+
+ 'on_checkout' : function() {
+ this.controller.view.checkout_menu.selectedIndex = 0;
+ this.controller.view.checkout_barcode_entry_textbox.disabled = false;
+ this.controller.view.checkout_barcode_entry_textbox.value = '';
+ this.controller.view.checkout_barcode_entry_textbox.focus();
+ document.getElementById('duedate_hbox').hidden = false;
+ },
+
+ 'on_failure' : function() {
+ this.controller.view.checkout_barcode_entry_textbox.select();
+ this.controller.view.checkout_barcode_entry_textbox.focus();
+ }
};
dump('exiting circ.checkout.js\n');
diff --git a/Open-ILS/xul/staff_client/server/circ/copy_status.js b/Open-ILS/xul/staff_client/server/circ/copy_status.js
index aa18927b42..bfc4bcd516 100644
--- a/Open-ILS/xul/staff_client/server/circ/copy_status.js
+++ b/Open-ILS/xul/staff_client/server/circ/copy_status.js
@@ -4,113 +4,113 @@ dump('entering circ.copy_status.js\n');
if (typeof circ == 'undefined') { circ = {}; }
circ.copy_status = function (params) {
- JSAN.use('util.error'); this.error = new util.error();
- JSAN.use('util.network'); this.network = new util.network();
- JSAN.use('util.barcode');
- JSAN.use('util.date');
- JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
- JSAN.use('util.sound'); this.sound = new util.sound();
+ JSAN.use('util.error'); this.error = new util.error();
+ JSAN.use('util.network'); this.network = new util.network();
+ JSAN.use('util.barcode');
+ JSAN.use('util.date');
+ JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
+ JSAN.use('util.sound'); this.sound = new util.sound();
};
circ.copy_status.prototype = {
- 'selection_list' : [],
- 'list_copyid_map' : {},
+ 'selection_list' : [],
+ 'list_copyid_map' : {},
'detail_map' : {},
- 'init' : function( params ) {
-
- var obj = this;
-
- JSAN.use('circ.util');
- var columns = circ.util.columns(
- {
- 'barcode' : { 'hidden' : false },
- 'title' : { 'hidden' : false },
- 'location' : { 'hidden' : false },
- 'call_number' : { 'hidden' : false },
- 'status' : { 'hidden' : false },
- 'alert_message' : { 'hidden' : false },
- 'due_date' : { 'hidden' : false }
- },
- {
- 'except_these' : [
- 'route_to', 'message', 'uses'
- ]
- }
- );
-
- JSAN.use('util.list'); obj.list = new util.list('copy_status_list');
- obj.list.init(
- {
- 'columns' : columns,
- 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
- 'on_select' : function(ev) {
- try {
- JSAN.use('util.functional');
- var sel = obj.list.retrieve_selection();
- obj.selection_list = util.functional.map_list(
- sel,
- function(o) { return JSON2js(o.getAttribute('retrieve_id')); }
- );
- obj.error.sdump('D_TRACE','circ/copy_status: selection list = ' + js2JSON(obj.selection_list) );
- if (obj.selection_list.length == 0) {
- obj.controller.view.sel_checkin.setAttribute('disabled','true');
- obj.controller.view.cmd_replace_barcode.setAttribute('disabled','true');
- obj.controller.view.sel_edit.setAttribute('disabled','true');
- obj.controller.view.sel_opac.setAttribute('disabled','true');
- obj.controller.view.sel_bucket.setAttribute('disabled','true');
- obj.controller.view.sel_copy_details.setAttribute('disabled','true');
- obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','true');
- obj.controller.view.sel_mark_items_missing.setAttribute('disabled','true');
- obj.controller.view.sel_patron.setAttribute('disabled','true');
- obj.controller.view.sel_spine.setAttribute('disabled','true');
- obj.controller.view.sel_transit_abort.setAttribute('disabled','true');
- obj.controller.view.sel_clip.setAttribute('disabled','true');
- obj.controller.view.sel_renew.setAttribute('disabled','true');
- obj.controller.view.cmd_add_items.setAttribute('disabled','true');
- obj.controller.view.cmd_delete_items.setAttribute('disabled','true');
- obj.controller.view.cmd_transfer_items.setAttribute('disabled','true');
- obj.controller.view.cmd_add_volumes.setAttribute('disabled','true');
- obj.controller.view.cmd_edit_volumes.setAttribute('disabled','true');
- obj.controller.view.cmd_delete_volumes.setAttribute('disabled','true');
- obj.controller.view.cmd_mark_volume.setAttribute('disabled','true');
- obj.controller.view.cmd_mark_library.setAttribute('disabled','true');
- obj.controller.view.cmd_transfer_volume.setAttribute('disabled','true');
- } else {
- obj.controller.view.sel_checkin.setAttribute('disabled','false');
- obj.controller.view.cmd_replace_barcode.setAttribute('disabled','false');
- obj.controller.view.sel_edit.setAttribute('disabled','false');
- obj.controller.view.sel_opac.setAttribute('disabled','false');
- obj.controller.view.sel_patron.setAttribute('disabled','false');
- obj.controller.view.sel_bucket.setAttribute('disabled','false');
- obj.controller.view.sel_copy_details.setAttribute('disabled','false');
- obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','false');
- obj.controller.view.sel_mark_items_missing.setAttribute('disabled','false');
- obj.controller.view.sel_spine.setAttribute('disabled','false');
- obj.controller.view.sel_transit_abort.setAttribute('disabled','false');
- obj.controller.view.sel_clip.setAttribute('disabled','false');
- obj.controller.view.sel_renew.setAttribute('disabled','false');
- obj.controller.view.cmd_add_items.setAttribute('disabled','false');
- obj.controller.view.cmd_delete_items.setAttribute('disabled','false');
- obj.controller.view.cmd_transfer_items.setAttribute('disabled','false');
- obj.controller.view.cmd_add_volumes.setAttribute('disabled','false');
- obj.controller.view.cmd_edit_volumes.setAttribute('disabled','false');
- obj.controller.view.cmd_delete_volumes.setAttribute('disabled','false');
- obj.controller.view.cmd_mark_volume.setAttribute('disabled','false');
- obj.controller.view.cmd_mark_library.setAttribute('disabled','false');
- obj.controller.view.cmd_transfer_volume.setAttribute('disabled','false');
- }
- } catch(E) {
- alert('FIXME: ' + E);
- }
- }
- }
- );
-
- JSAN.use('util.controller'); obj.controller = new util.controller();
- obj.controller.init(
- {
- 'control_map' : {
+ 'init' : function( params ) {
+
+ var obj = this;
+
+ JSAN.use('circ.util');
+ var columns = circ.util.columns(
+ {
+ 'barcode' : { 'hidden' : false },
+ 'title' : { 'hidden' : false },
+ 'location' : { 'hidden' : false },
+ 'call_number' : { 'hidden' : false },
+ 'status' : { 'hidden' : false },
+ 'alert_message' : { 'hidden' : false },
+ 'due_date' : { 'hidden' : false }
+ },
+ {
+ 'except_these' : [
+ 'route_to', 'message', 'uses'
+ ]
+ }
+ );
+
+ JSAN.use('util.list'); obj.list = new util.list('copy_status_list');
+ obj.list.init(
+ {
+ 'columns' : columns,
+ 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
+ 'on_select' : function(ev) {
+ try {
+ JSAN.use('util.functional');
+ var sel = obj.list.retrieve_selection();
+ obj.selection_list = util.functional.map_list(
+ sel,
+ function(o) { return JSON2js(o.getAttribute('retrieve_id')); }
+ );
+ obj.error.sdump('D_TRACE','circ/copy_status: selection list = ' + js2JSON(obj.selection_list) );
+ if (obj.selection_list.length == 0) {
+ obj.controller.view.sel_checkin.setAttribute('disabled','true');
+ obj.controller.view.cmd_replace_barcode.setAttribute('disabled','true');
+ obj.controller.view.sel_edit.setAttribute('disabled','true');
+ obj.controller.view.sel_opac.setAttribute('disabled','true');
+ obj.controller.view.sel_bucket.setAttribute('disabled','true');
+ obj.controller.view.sel_copy_details.setAttribute('disabled','true');
+ obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','true');
+ obj.controller.view.sel_mark_items_missing.setAttribute('disabled','true');
+ obj.controller.view.sel_patron.setAttribute('disabled','true');
+ obj.controller.view.sel_spine.setAttribute('disabled','true');
+ obj.controller.view.sel_transit_abort.setAttribute('disabled','true');
+ obj.controller.view.sel_clip.setAttribute('disabled','true');
+ obj.controller.view.sel_renew.setAttribute('disabled','true');
+ obj.controller.view.cmd_add_items.setAttribute('disabled','true');
+ obj.controller.view.cmd_delete_items.setAttribute('disabled','true');
+ obj.controller.view.cmd_transfer_items.setAttribute('disabled','true');
+ obj.controller.view.cmd_add_volumes.setAttribute('disabled','true');
+ obj.controller.view.cmd_edit_volumes.setAttribute('disabled','true');
+ obj.controller.view.cmd_delete_volumes.setAttribute('disabled','true');
+ obj.controller.view.cmd_mark_volume.setAttribute('disabled','true');
+ obj.controller.view.cmd_mark_library.setAttribute('disabled','true');
+ obj.controller.view.cmd_transfer_volume.setAttribute('disabled','true');
+ } else {
+ obj.controller.view.sel_checkin.setAttribute('disabled','false');
+ obj.controller.view.cmd_replace_barcode.setAttribute('disabled','false');
+ obj.controller.view.sel_edit.setAttribute('disabled','false');
+ obj.controller.view.sel_opac.setAttribute('disabled','false');
+ obj.controller.view.sel_patron.setAttribute('disabled','false');
+ obj.controller.view.sel_bucket.setAttribute('disabled','false');
+ obj.controller.view.sel_copy_details.setAttribute('disabled','false');
+ obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','false');
+ obj.controller.view.sel_mark_items_missing.setAttribute('disabled','false');
+ obj.controller.view.sel_spine.setAttribute('disabled','false');
+ obj.controller.view.sel_transit_abort.setAttribute('disabled','false');
+ obj.controller.view.sel_clip.setAttribute('disabled','false');
+ obj.controller.view.sel_renew.setAttribute('disabled','false');
+ obj.controller.view.cmd_add_items.setAttribute('disabled','false');
+ obj.controller.view.cmd_delete_items.setAttribute('disabled','false');
+ obj.controller.view.cmd_transfer_items.setAttribute('disabled','false');
+ obj.controller.view.cmd_add_volumes.setAttribute('disabled','false');
+ obj.controller.view.cmd_edit_volumes.setAttribute('disabled','false');
+ obj.controller.view.cmd_delete_volumes.setAttribute('disabled','false');
+ obj.controller.view.cmd_mark_volume.setAttribute('disabled','false');
+ obj.controller.view.cmd_mark_library.setAttribute('disabled','false');
+ obj.controller.view.cmd_transfer_volume.setAttribute('disabled','false');
+ }
+ } catch(E) {
+ alert('FIXME: ' + E);
+ }
+ }
+ }
+ );
+
+ JSAN.use('util.controller'); obj.controller = new util.controller();
+ obj.controller.init(
+ {
+ 'control_map' : {
'list_actions' : [
['render'],
function(e) {
@@ -162,300 +162,300 @@ circ.copy_status.prototype = {
}
},
],
- 'sel_checkin' : [
- ['command'],
- function() {
- try {
- var funcs = [];
- JSAN.use('circ.util');
- for (var i = 0; i < obj.selection_list.length; i++) {
- var barcode = obj.selection_list[i].barcode;
- var checkin = circ.util.checkin_via_barcode( ses(), { 'barcode' : barcode } );
- funcs.push( function(a) { return function() { obj.copy_status( a, true ); }; }(barcode) );
- }
- for (var i = 0; i < funcs.length; i++) { funcs[i](); }
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.copy_status.sel_checkin.error'),E);
- }
- }
- ],
- 'cmd_replace_barcode' : [
- ['command'],
- function() {
- try {
- var funcs = [];
- JSAN.use('cat.util');
- for (var i = 0; i < obj.selection_list.length; i++) {
- try {
- var barcode = obj.selection_list[i].barcode;
- var new_bc = cat.util.replace_barcode( barcode );
- funcs.push( function(a) { return function() { obj.copy_status( a, true ); }; }(new_bc) );
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.cmd_replace_barcode.error', [barcode]), E);
- }
- }
- for (var i = 0; i < funcs.length; i++) { funcs[i](); }
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.copy_status.cmd_replace_barcodes.error'), E);
- }
- }
- ],
- 'sel_edit' : [
- ['command'],
- function() {
- try {
- var funcs = [];
- obj.spawn_copy_editor();
- for (var i = 0; i < obj.selection_list.length; i++) {
- var barcode = obj.selection_list[i].barcode;
- funcs.push( function(a) { return function() { obj.copy_status( a, true ); }; }(barcode) );
- }
- for (var i = 0; i < funcs.length; i++) { funcs[i](); }
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.copy_status.sel_edit.error'), E);
- }
- }
- ],
- 'sel_spine' : [
- ['command'],
- function() {
- JSAN.use('cat.util');
- cat.util.spawn_spine_editor(obj.selection_list);
- }
- ],
- 'sel_opac' : [
- ['command'],
- function() {
- JSAN.use('cat.util');
- cat.util.show_in_opac(obj.selection_list);
- }
- ],
- 'sel_transit_abort' : [
- ['command'],
- function() {
- var funcs = [];
- JSAN.use('circ.util');
- circ.util.abort_transits(obj.selection_list);
- for (var i = 0; i < obj.selection_list.length; i++) {
- var barcode = obj.selection_list[i].barcode;
- funcs.push( function(a) { return function() { obj.copy_status( a, true ); }; }(barcode) );
- }
- for (var i = 0; i < funcs.length; i++) { funcs[i](); }
- }
- ],
- 'sel_patron' : [
- ['command'],
- function() {
- JSAN.use('circ.util');
- circ.util.show_last_few_circs(obj.selection_list);
- }
- ],
- 'sel_copy_details' : [
- ['command'],
- function() {
- JSAN.use('circ.util');
- for (var i = 0; i < obj.selection_list.length; i++) {
- circ.util.show_copy_details( obj.selection_list[i].copy_id );
- }
- }
- ],
- 'sel_renew' : [
- ['command'],
- function() {
- var funcs = [];
- JSAN.use('circ.util');
- for (var i = 0; i < obj.selection_list.length; i++) {
- var test = obj.selection_list[i].renewable;
- var barcode = obj.selection_list[i].barcode;
- if (test == 't') {
- circ.util.renew_via_barcode( { 'barcode' : barcode } );
- funcs.push( function(a) { return function() { obj.copy_status( a, true ); }; }(barcode) );
- } else {
- alert(document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.sel_renew.not_circulating', [barcode]));
- }
- }
- for (var i = 0; i < funcs.length; i++) { funcs[i](); }
- }
- ],
-
- 'sel_mark_items_damaged' : [
- ['command'],
- function() {
- var funcs = [];
- JSAN.use('cat.util'); JSAN.use('util.functional');
- cat.util.mark_item_damaged( util.functional.map_list( obj.selection_list, function(o) { return o.copy_id; } ) );
- for (var i = 0; i < obj.selection_list.length; i++) {
- var barcode = obj.selection_list[i].barcode;
- funcs.push( function(a) { return function() { obj.copy_status( a, true ); }; }(barcode) );
- }
- for (var i = 0; i < funcs.length; i++) { funcs[i](); }
- }
- ],
- 'sel_mark_items_missing' : [
- ['command'],
- function() {
- var funcs = [];
- JSAN.use('cat.util'); JSAN.use('util.functional');
- cat.util.mark_item_missing( util.functional.map_list( obj.selection_list, function(o) { return o.copy_id; } ) );
- for (var i = 0; i < obj.selection_list.length; i++) {
- var barcode = obj.selection_list[i].barcode;
- funcs.push( function(a) { return function() { obj.copy_status( a, true ); }; }(barcode) );
- }
- for (var i = 0; i < funcs.length; i++) { funcs[i](); }
- }
- ],
- 'sel_bucket' : [
- ['command'],
- function() {
- JSAN.use('cat.util');
- cat.util.add_copies_to_bucket(obj.selection_list);
- }
- ],
- 'copy_status_barcode_entry_textbox' : [
- ['keypress'],
- function(ev) {
- if (ev.keyCode && ev.keyCode == 13) {
- obj.copy_status();
- }
- }
- ],
- 'cmd_broken' : [
- ['command'],
- function() { alert(document.getElementById('circStrings').getString('staff.circ.unimplemented')); }
- ],
- 'cmd_copy_status_submit_barcode' : [
- ['command'],
- function() {
- obj.copy_status();
- }
- ],
- 'cmd_copy_status_upload_file' : [
- ['command'],
- function() {
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- JSAN.use('util.file');
- var f = new util.file('');
+ 'sel_checkin' : [
+ ['command'],
+ function() {
+ try {
+ var funcs = [];
+ JSAN.use('circ.util');
+ for (var i = 0; i < obj.selection_list.length; i++) {
+ var barcode = obj.selection_list[i].barcode;
+ var checkin = circ.util.checkin_via_barcode( ses(), { 'barcode' : barcode } );
+ funcs.push( function(a) { return function() { obj.copy_status( a, true ); }; }(barcode) );
+ }
+ for (var i = 0; i < funcs.length; i++) { funcs[i](); }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.copy_status.sel_checkin.error'),E);
+ }
+ }
+ ],
+ 'cmd_replace_barcode' : [
+ ['command'],
+ function() {
+ try {
+ var funcs = [];
+ JSAN.use('cat.util');
+ for (var i = 0; i < obj.selection_list.length; i++) {
+ try {
+ var barcode = obj.selection_list[i].barcode;
+ var new_bc = cat.util.replace_barcode( barcode );
+ funcs.push( function(a) { return function() { obj.copy_status( a, true ); }; }(new_bc) );
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.cmd_replace_barcode.error', [barcode]), E);
+ }
+ }
+ for (var i = 0; i < funcs.length; i++) { funcs[i](); }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.copy_status.cmd_replace_barcodes.error'), E);
+ }
+ }
+ ],
+ 'sel_edit' : [
+ ['command'],
+ function() {
+ try {
+ var funcs = [];
+ obj.spawn_copy_editor();
+ for (var i = 0; i < obj.selection_list.length; i++) {
+ var barcode = obj.selection_list[i].barcode;
+ funcs.push( function(a) { return function() { obj.copy_status( a, true ); }; }(barcode) );
+ }
+ for (var i = 0; i < funcs.length; i++) { funcs[i](); }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.copy_status.sel_edit.error'), E);
+ }
+ }
+ ],
+ 'sel_spine' : [
+ ['command'],
+ function() {
+ JSAN.use('cat.util');
+ cat.util.spawn_spine_editor(obj.selection_list);
+ }
+ ],
+ 'sel_opac' : [
+ ['command'],
+ function() {
+ JSAN.use('cat.util');
+ cat.util.show_in_opac(obj.selection_list);
+ }
+ ],
+ 'sel_transit_abort' : [
+ ['command'],
+ function() {
+ var funcs = [];
+ JSAN.use('circ.util');
+ circ.util.abort_transits(obj.selection_list);
+ for (var i = 0; i < obj.selection_list.length; i++) {
+ var barcode = obj.selection_list[i].barcode;
+ funcs.push( function(a) { return function() { obj.copy_status( a, true ); }; }(barcode) );
+ }
+ for (var i = 0; i < funcs.length; i++) { funcs[i](); }
+ }
+ ],
+ 'sel_patron' : [
+ ['command'],
+ function() {
+ JSAN.use('circ.util');
+ circ.util.show_last_few_circs(obj.selection_list);
+ }
+ ],
+ 'sel_copy_details' : [
+ ['command'],
+ function() {
+ JSAN.use('circ.util');
+ for (var i = 0; i < obj.selection_list.length; i++) {
+ circ.util.show_copy_details( obj.selection_list[i].copy_id );
+ }
+ }
+ ],
+ 'sel_renew' : [
+ ['command'],
+ function() {
+ var funcs = [];
+ JSAN.use('circ.util');
+ for (var i = 0; i < obj.selection_list.length; i++) {
+ var test = obj.selection_list[i].renewable;
+ var barcode = obj.selection_list[i].barcode;
+ if (test == 't') {
+ circ.util.renew_via_barcode( { 'barcode' : barcode } );
+ funcs.push( function(a) { return function() { obj.copy_status( a, true ); }; }(barcode) );
+ } else {
+ alert(document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.sel_renew.not_circulating', [barcode]));
+ }
+ }
+ for (var i = 0; i < funcs.length; i++) { funcs[i](); }
+ }
+ ],
+
+ 'sel_mark_items_damaged' : [
+ ['command'],
+ function() {
+ var funcs = [];
+ JSAN.use('cat.util'); JSAN.use('util.functional');
+ cat.util.mark_item_damaged( util.functional.map_list( obj.selection_list, function(o) { return o.copy_id; } ) );
+ for (var i = 0; i < obj.selection_list.length; i++) {
+ var barcode = obj.selection_list[i].barcode;
+ funcs.push( function(a) { return function() { obj.copy_status( a, true ); }; }(barcode) );
+ }
+ for (var i = 0; i < funcs.length; i++) { funcs[i](); }
+ }
+ ],
+ 'sel_mark_items_missing' : [
+ ['command'],
+ function() {
+ var funcs = [];
+ JSAN.use('cat.util'); JSAN.use('util.functional');
+ cat.util.mark_item_missing( util.functional.map_list( obj.selection_list, function(o) { return o.copy_id; } ) );
+ for (var i = 0; i < obj.selection_list.length; i++) {
+ var barcode = obj.selection_list[i].barcode;
+ funcs.push( function(a) { return function() { obj.copy_status( a, true ); }; }(barcode) );
+ }
+ for (var i = 0; i < funcs.length; i++) { funcs[i](); }
+ }
+ ],
+ 'sel_bucket' : [
+ ['command'],
+ function() {
+ JSAN.use('cat.util');
+ cat.util.add_copies_to_bucket(obj.selection_list);
+ }
+ ],
+ 'copy_status_barcode_entry_textbox' : [
+ ['keypress'],
+ function(ev) {
+ if (ev.keyCode && ev.keyCode == 13) {
+ obj.copy_status();
+ }
+ }
+ ],
+ 'cmd_broken' : [
+ ['command'],
+ function() { alert(document.getElementById('circStrings').getString('staff.circ.unimplemented')); }
+ ],
+ 'cmd_copy_status_submit_barcode' : [
+ ['command'],
+ function() {
+ obj.copy_status();
+ }
+ ],
+ 'cmd_copy_status_upload_file' : [
+ ['command'],
+ function() {
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
+ JSAN.use('util.file');
+ var f = new util.file('');
var content = f.import_file( { 'title' : document.getElementById('circStrings').getString('staff.circ.copy_status.upload_file.title'), 'not_json' : true } );
if (!content) { return; }
- var barcodes = content.split(/[,\s]+/);
- if (barcodes.length > 0) {
- JSAN.use('util.exec'); var exec = new util.exec();
- var funcs = [];
- for (var i = 0; i < barcodes.length; i++) {
- funcs.push(
- function(b){
- return function() {
- obj.copy_status(b);
- };
- }(barcodes[i])
- );
- }
- funcs.push( function() { alert(document.getElementById('circStrings').getString('staff.circ.copy_status.upload_file.complete')); } );
- exec.chain( funcs );
- } else {
- alert(document.getElementById('circStrings').getString('staff.circ.copy_status.upload_file.no_barcodes'));
- }
-
- }
- ],
- 'cmd_copy_status_print' : [
- ['command'],
- function() {
- try {
+ var barcodes = content.split(/[,\s]+/);
+ if (barcodes.length > 0) {
+ JSAN.use('util.exec'); var exec = new util.exec();
+ var funcs = [];
+ for (var i = 0; i < barcodes.length; i++) {
+ funcs.push(
+ function(b){
+ return function() {
+ obj.copy_status(b);
+ };
+ }(barcodes[i])
+ );
+ }
+ funcs.push( function() { alert(document.getElementById('circStrings').getString('staff.circ.copy_status.upload_file.complete')); } );
+ exec.chain( funcs );
+ } else {
+ alert(document.getElementById('circStrings').getString('staff.circ.copy_status.upload_file.no_barcodes'));
+ }
+
+ }
+ ],
+ 'cmd_copy_status_print' : [
+ ['command'],
+ function() {
+ try {
var p = {
'template' : 'item_status'
};
- obj.list.print(p);
- } catch(E) {
- obj.error.standard_unexpected_error_alert('print',E);
- }
- }
- ],
- 'cmd_add_items' : [
- ['command'],
- function() {
- try {
-
- JSAN.use('util.functional');
- var list = util.functional.map_list( obj.selection_list, function(o) { return o.acn_id; } );
- if (list.length == 0) { return; }
-
- var copy_shortcut = {}; var map_acn = {};
-
- for (var i = 0; i < list.length; i++) {
- var volume_id = list[i];
- if (volume_id == -1) {
- continue; /* ignore magic pre-cat volume */
- }
- if (! map_acn[volume_id]) {
- map_acn[ volume_id ] = obj.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ volume_id ]);
- }
- var record_id = map_acn[ volume_id ].record();
- var ou_id = map_acn[ volume_id ].owning_lib();
- var label = map_acn[ volume_id ].label();
- if (!copy_shortcut[record_id]) {
- copy_shortcut[record_id] = {};
- }
- if (!copy_shortcut[record_id][ou_id]) {
- copy_shortcut[record_id][ou_id] = {};
- }
- copy_shortcut[record_id][ou_id][ label ] = volume_id;
-
- }
-
- for (var r in copy_shortcut) {
-
- /* quick fix */ /* what was this fixing? */
- list = []; for (var i in copy_shortcut[r]) { list.push( i ); }
-
- var edit = 0;
- try {
- edit = obj.network.request(
- api.PERM_MULTI_ORG_CHECK.app,
- api.PERM_MULTI_ORG_CHECK.method,
- [
- ses(),
- obj.data.list.au[0].id(),
- list,
- [ 'CREATE_COPY' ]
- ]
- ).length == 0 ? 1 : 0;
- } catch(E) {
- obj.error.sdump('D_ERROR','batch permission check: ' + E);
- }
-
- if (edit==0) {
- return; // no read-only view for this interface
- }
-
- var title = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.add_items.title', [r]);
-
- JSAN.use('util.window'); var win = new util.window();
- var w = win.open(
- window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR),
- //+'?doc_id=' + window.escape(r)
- //+'&ou_ids=' + window.escape( js2JSON(list) )
- //+'©_shortcut=' + window.escape( js2JSON(copy_shortcut[r]) ),
- title,
- 'chrome,resizable',
- { 'doc_id' : r, 'ou_ids' : list, 'copy_shortcut' : copy_shortcut[r] }
- );
- }
-
- } catch(E) {
- obj.error.standard_unexpected_error_alert('copy status -> add copies',E);
- }
- }
-
- ],
- 'cmd_delete_items' : [
- ['command'],
- function() {
- try {
+ obj.list.print(p);
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('print',E);
+ }
+ }
+ ],
+ 'cmd_add_items' : [
+ ['command'],
+ function() {
+ try {
+
+ JSAN.use('util.functional');
+ var list = util.functional.map_list( obj.selection_list, function(o) { return o.acn_id; } );
+ if (list.length == 0) { return; }
+
+ var copy_shortcut = {}; var map_acn = {};
+
+ for (var i = 0; i < list.length; i++) {
+ var volume_id = list[i];
+ if (volume_id == -1) {
+ continue; /* ignore magic pre-cat volume */
+ }
+ if (! map_acn[volume_id]) {
+ map_acn[ volume_id ] = obj.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ volume_id ]);
+ }
+ var record_id = map_acn[ volume_id ].record();
+ var ou_id = map_acn[ volume_id ].owning_lib();
+ var label = map_acn[ volume_id ].label();
+ if (!copy_shortcut[record_id]) {
+ copy_shortcut[record_id] = {};
+ }
+ if (!copy_shortcut[record_id][ou_id]) {
+ copy_shortcut[record_id][ou_id] = {};
+ }
+ copy_shortcut[record_id][ou_id][ label ] = volume_id;
+
+ }
+
+ for (var r in copy_shortcut) {
+
+ /* quick fix */ /* what was this fixing? */
+ list = []; for (var i in copy_shortcut[r]) { list.push( i ); }
+
+ var edit = 0;
+ try {
+ edit = obj.network.request(
+ api.PERM_MULTI_ORG_CHECK.app,
+ api.PERM_MULTI_ORG_CHECK.method,
+ [
+ ses(),
+ obj.data.list.au[0].id(),
+ list,
+ [ 'CREATE_COPY' ]
+ ]
+ ).length == 0 ? 1 : 0;
+ } catch(E) {
+ obj.error.sdump('D_ERROR','batch permission check: ' + E);
+ }
+
+ if (edit==0) {
+ return; // no read-only view for this interface
+ }
+
+ var title = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.add_items.title', [r]);
+
+ JSAN.use('util.window'); var win = new util.window();
+ var w = win.open(
+ window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR),
+ //+'?doc_id=' + window.escape(r)
+ //+'&ou_ids=' + window.escape( js2JSON(list) )
+ //+'©_shortcut=' + window.escape( js2JSON(copy_shortcut[r]) ),
+ title,
+ 'chrome,resizable',
+ { 'doc_id' : r, 'ou_ids' : list, 'copy_shortcut' : copy_shortcut[r] }
+ );
+ }
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('copy status -> add copies',E);
+ }
+ }
+
+ ],
+ 'cmd_delete_items' : [
+ ['command'],
+ function() {
+ try {
JSAN.use('util.functional');
- var list = util.functional.map_list( obj.selection_list, function(o) { return o.copy_id; } );
+ var list = util.functional.map_list( obj.selection_list, function(o) { return o.copy_id; } );
var copies = util.functional.map_list(
list,
@@ -469,246 +469,246 @@ circ.copy_status.prototype = {
copies[i].isdeleted(1);
}
- if (! window.confirm(document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.del_items.confirm', [util.functional.map_list( copies, function(o) { return o.barcode(); }).join(", ")]))) {
- return;
- }
+ if (! window.confirm(document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.del_items.confirm', [util.functional.map_list( copies, function(o) { return o.barcode(); }).join(", ")]))) {
+ return;
+ }
var robj = obj.network.simple_request('FM_ACP_FLESHED_BATCH_UPDATE',[ ses(), copies, true]);
- var robj = obj.network.simple_request(
- 'FM_ACP_FLESHED_BATCH_UPDATE',
- [ ses(), copies, true ],
- null,
- {
- 'title' : document.getElementById('circStrings').getString('staff.circ.copy_status.del_items.title'),
- 'overridable_events' : [
- 1208 /* TITLE_LAST_COPY */,
- 1227 /* COPY_DELETE_WARNING */
- ]
- }
- );
-
+ var robj = obj.network.simple_request(
+ 'FM_ACP_FLESHED_BATCH_UPDATE',
+ [ ses(), copies, true ],
+ null,
+ {
+ 'title' : document.getElementById('circStrings').getString('staff.circ.copy_status.del_items.title'),
+ 'overridable_events' : [
+ 1208 /* TITLE_LAST_COPY */,
+ 1227 /* COPY_DELETE_WARNING */
+ ]
+ }
+ );
+
if (typeof robj.ilsevent != 'undefined') {
- switch(Number(robj.ilsevent)) {
- case 1208 /* TITLE_LAST_COPY */:
- case 1227 /* COPY_DELETE_WARNING */:
- break;
- default:
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.copy_status.del_items.success.error'), robj);
- break;
- }
- } else { alert(document.getElementById('circStrings').getString('staff.circ.copy_status.del_items.success')); }
-
- } catch(E) {
- obj.error.standard_unexpected_error_alert('copy status -> delete items',E);
- }
- }
- ],
- 'cmd_transfer_items' : [
- ['command'],
- function() {
- try {
- obj.data.stash_retrieve();
- if (!obj.data.marked_volume) {
- alert(document.getElementById('circStrings').getString('staff.circ.copy_status.transfer_items.mark_destination'));
- return;
- }
-
- JSAN.use('util.functional');
-
- var list = util.functional.map_list( obj.selection_list, function(o) { return o.copy_id; } );
-
- var volume = obj.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ obj.data.marked_volume ]);
-
- JSAN.use('cat.util'); cat.util.transfer_copies( {
- 'copy_ids' : list,
- 'docid' : volume.record(),
- 'volume_label' : volume.label(),
- 'owning_lib' : volume.owning_lib()
- } );
-
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.copy_status.transfer_items.problem'), E);
- }
- }
-
- ],
- 'cmd_add_volumes' : [
- ['command'],
- function() {
- try {
- JSAN.use('util.functional');
- var list = util.functional.map_list( obj.selection_list, function(o) { return o.acn_id; } );
- if (list.length == 0) { return; }
-
- var aou_hash = {}; var map_acn = {};
-
- for (var i = 0; i < list.length; i++) {
- var volume_id = list[i];
- if (volume_id == -1) {
- continue; /* ignore magic pre-cat volume */
- }
- if (! map_acn[volume_id]) {
- map_acn[ volume_id ] = obj.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ volume_id ]);
- }
- var record_id = map_acn[ volume_id ].record();
- var ou_id = map_acn[ volume_id ].owning_lib();
- var label = map_acn[ volume_id ].label();
- if (!aou_hash[record_id]) aou_hash[record_id] = {};
- aou_hash[record_id][ou_id] = 1;
-
- }
-
- for (var r in aou_hash) {
-
- list = []; for (var org in aou_hash[r]) list.push(org);
-
- var edit = 0;
- try {
- edit = obj.network.request(
- api.PERM_MULTI_ORG_CHECK.app,
- api.PERM_MULTI_ORG_CHECK.method,
- [
- ses(),
- obj.data.list.au[0].id(),
- list,
- [ 'CREATE_VOLUME', 'CREATE_COPY' ]
- ]
- ).length == 0 ? 1 : 0;
- } catch(E) {
- obj.error.sdump('D_ERROR','batch permission check: ' + E);
- }
-
- if (edit==0) {
- alert(document.getElementById('circStrings').getString('staff.circ.copy_status.add_volumes.perm_failure'));
- return; // no read-only view for this interface
- }
-
- var title = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.add_volumes.title', [r]);
-
- JSAN.use('util.window'); var win = new util.window();
- var w = win.open(
- window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR),
- //+'?doc_id=' + window.escape(r)
- //+'&ou_ids=' + window.escape( js2JSON(list) ),
- title,
- 'chrome,resizable',
- { 'doc_id' : r, 'ou_ids' : list }
- );
-
- }
-
- } catch(E) {
- obj.error.standard_unexpected_error_alert('copy status -> add volumes',E);
- }
- }
-
- ],
- 'cmd_edit_volumes' : [
- ['command'],
- function() {
- try {
- JSAN.use('util.functional');
- var list = util.functional.map_list( obj.selection_list, function(o) { return o.acn_id; } );
- if (list.length == 0) { return; }
-
- var volume_hash = {}; var map_acn = {};
-
- for (var i = 0; i < list.length; i++) {
- var volume_id = list[i];
- if (volume_id == -1) {
- continue; /* ignore magic pre-cat volume */
- }
- if (! map_acn[volume_id]) {
- map_acn[ volume_id ] = obj.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ volume_id ]);
- map_acn[ volume_id ].copies( [] );
- }
- var record_id = map_acn[ volume_id ].record();
- if (!volume_hash[record_id]) {
- volume_hash[record_id] = {};
- }
- volume_hash[record_id][volume_id] = 1;
- }
-
- for (var rec in volume_hash) {
-
- list = [];
- for (var v in volume_hash[rec]) {
- list.push( map_acn[v] );
- }
-
- var edit = 0;
- try {
- edit = obj.network.request(
- api.PERM_MULTI_ORG_CHECK.app,
- api.PERM_MULTI_ORG_CHECK.method,
- [
- ses(),
- obj.data.list.au[0].id(),
- util.functional.map_list(
- list,
- function (o) {
- return o.owning_lib();
- }
- ),
- [ 'UPDATE_VOLUME' ]
- ]
- ).length == 0 ? 1 : 0;
- } catch(E) {
- obj.error.sdump('D_ERROR','batch permission check: ' + E);
- }
-
- if (edit==0) {
- alert(document.getElementById('circStrings').getString('staff.circ.copy_status.edit_volumes.perm_failure'));
- return; // no read-only view for this interface
- }
-
- var title;
- if (list.length == 1) {
- title = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.edit_volume.title', [rec]);
- } else {
- title = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.edit_volumes.title', [rec]);
- }
-
- JSAN.use('util.window'); var win = new util.window();
- //obj.data.volumes_temp = js2JSON( list );
- //obj.data.stash('volumes_temp');
- var my_xulG = win.open(
- window.xulG.url_prefix(urls.XUL_VOLUME_EDITOR),
- title,
- 'chrome,modal,resizable',
- { 'volumes' : JSON2js(js2JSON(list)) }
- );
-
- /* FIXME -- need to unique the temp space, and not rely on modalness of window */
- //obj.data.stash_retrieve();
- //var volumes = JSON2js( obj.data.volumes_temp );
+ switch(Number(robj.ilsevent)) {
+ case 1208 /* TITLE_LAST_COPY */:
+ case 1227 /* COPY_DELETE_WARNING */:
+ break;
+ default:
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.copy_status.del_items.success.error'), robj);
+ break;
+ }
+ } else { alert(document.getElementById('circStrings').getString('staff.circ.copy_status.del_items.success')); }
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('copy status -> delete items',E);
+ }
+ }
+ ],
+ 'cmd_transfer_items' : [
+ ['command'],
+ function() {
+ try {
+ obj.data.stash_retrieve();
+ if (!obj.data.marked_volume) {
+ alert(document.getElementById('circStrings').getString('staff.circ.copy_status.transfer_items.mark_destination'));
+ return;
+ }
+
+ JSAN.use('util.functional');
+
+ var list = util.functional.map_list( obj.selection_list, function(o) { return o.copy_id; } );
+
+ var volume = obj.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ obj.data.marked_volume ]);
+
+ JSAN.use('cat.util'); cat.util.transfer_copies( {
+ 'copy_ids' : list,
+ 'docid' : volume.record(),
+ 'volume_label' : volume.label(),
+ 'owning_lib' : volume.owning_lib()
+ } );
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.copy_status.transfer_items.problem'), E);
+ }
+ }
+
+ ],
+ 'cmd_add_volumes' : [
+ ['command'],
+ function() {
+ try {
+ JSAN.use('util.functional');
+ var list = util.functional.map_list( obj.selection_list, function(o) { return o.acn_id; } );
+ if (list.length == 0) { return; }
+
+ var aou_hash = {}; var map_acn = {};
+
+ for (var i = 0; i < list.length; i++) {
+ var volume_id = list[i];
+ if (volume_id == -1) {
+ continue; /* ignore magic pre-cat volume */
+ }
+ if (! map_acn[volume_id]) {
+ map_acn[ volume_id ] = obj.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ volume_id ]);
+ }
+ var record_id = map_acn[ volume_id ].record();
+ var ou_id = map_acn[ volume_id ].owning_lib();
+ var label = map_acn[ volume_id ].label();
+ if (!aou_hash[record_id]) aou_hash[record_id] = {};
+ aou_hash[record_id][ou_id] = 1;
+
+ }
+
+ for (var r in aou_hash) {
+
+ list = []; for (var org in aou_hash[r]) list.push(org);
+
+ var edit = 0;
+ try {
+ edit = obj.network.request(
+ api.PERM_MULTI_ORG_CHECK.app,
+ api.PERM_MULTI_ORG_CHECK.method,
+ [
+ ses(),
+ obj.data.list.au[0].id(),
+ list,
+ [ 'CREATE_VOLUME', 'CREATE_COPY' ]
+ ]
+ ).length == 0 ? 1 : 0;
+ } catch(E) {
+ obj.error.sdump('D_ERROR','batch permission check: ' + E);
+ }
+
+ if (edit==0) {
+ alert(document.getElementById('circStrings').getString('staff.circ.copy_status.add_volumes.perm_failure'));
+ return; // no read-only view for this interface
+ }
+
+ var title = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.add_volumes.title', [r]);
+
+ JSAN.use('util.window'); var win = new util.window();
+ var w = win.open(
+ window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR),
+ //+'?doc_id=' + window.escape(r)
+ //+'&ou_ids=' + window.escape( js2JSON(list) ),
+ title,
+ 'chrome,resizable',
+ { 'doc_id' : r, 'ou_ids' : list }
+ );
+
+ }
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('copy status -> add volumes',E);
+ }
+ }
+
+ ],
+ 'cmd_edit_volumes' : [
+ ['command'],
+ function() {
+ try {
+ JSAN.use('util.functional');
+ var list = util.functional.map_list( obj.selection_list, function(o) { return o.acn_id; } );
+ if (list.length == 0) { return; }
+
+ var volume_hash = {}; var map_acn = {};
+
+ for (var i = 0; i < list.length; i++) {
+ var volume_id = list[i];
+ if (volume_id == -1) {
+ continue; /* ignore magic pre-cat volume */
+ }
+ if (! map_acn[volume_id]) {
+ map_acn[ volume_id ] = obj.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ volume_id ]);
+ map_acn[ volume_id ].copies( [] );
+ }
+ var record_id = map_acn[ volume_id ].record();
+ if (!volume_hash[record_id]) {
+ volume_hash[record_id] = {};
+ }
+ volume_hash[record_id][volume_id] = 1;
+ }
+
+ for (var rec in volume_hash) {
+
+ list = [];
+ for (var v in volume_hash[rec]) {
+ list.push( map_acn[v] );
+ }
+
+ var edit = 0;
+ try {
+ edit = obj.network.request(
+ api.PERM_MULTI_ORG_CHECK.app,
+ api.PERM_MULTI_ORG_CHECK.method,
+ [
+ ses(),
+ obj.data.list.au[0].id(),
+ util.functional.map_list(
+ list,
+ function (o) {
+ return o.owning_lib();
+ }
+ ),
+ [ 'UPDATE_VOLUME' ]
+ ]
+ ).length == 0 ? 1 : 0;
+ } catch(E) {
+ obj.error.sdump('D_ERROR','batch permission check: ' + E);
+ }
+
+ if (edit==0) {
+ alert(document.getElementById('circStrings').getString('staff.circ.copy_status.edit_volumes.perm_failure'));
+ return; // no read-only view for this interface
+ }
+
+ var title;
+ if (list.length == 1) {
+ title = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.edit_volume.title', [rec]);
+ } else {
+ title = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.edit_volumes.title', [rec]);
+ }
+
+ JSAN.use('util.window'); var win = new util.window();
+ //obj.data.volumes_temp = js2JSON( list );
+ //obj.data.stash('volumes_temp');
+ var my_xulG = win.open(
+ window.xulG.url_prefix(urls.XUL_VOLUME_EDITOR),
+ title,
+ 'chrome,modal,resizable',
+ { 'volumes' : JSON2js(js2JSON(list)) }
+ );
+
+ /* FIXME -- need to unique the temp space, and not rely on modalness of window */
+ //obj.data.stash_retrieve();
+ //var volumes = JSON2js( obj.data.volumes_temp );
if (typeof my_xulG.update_these_volumes == 'undefined') { return; }
- var volumes = my_xulG.volumes;
- if (!volumes) { return; }
-
- volumes = util.functional.filter_list(
- volumes,
- function (o) {
- return o.ischanged() == '1';
- }
- );
-
- volumes = util.functional.map_list(
- volumes,
- function (o) {
- o.record( rec ); // staff client 2 did not do this. Does it matter?
- return o;
- }
- );
-
- if (volumes.length == 0) { return; }
-
- try {
- var r = obj.network.request(
- api.FM_ACN_TREE_UPDATE.app,
- api.FM_ACN_TREE_UPDATE.method,
- [ ses(), volumes, false ]
- );
+ var volumes = my_xulG.volumes;
+ if (!volumes) { return; }
+
+ volumes = util.functional.filter_list(
+ volumes,
+ function (o) {
+ return o.ischanged() == '1';
+ }
+ );
+
+ volumes = util.functional.map_list(
+ volumes,
+ function (o) {
+ o.record( rec ); // staff client 2 did not do this. Does it matter?
+ return o;
+ }
+ );
+
+ if (volumes.length == 0) { return; }
+
+ try {
+ var r = obj.network.request(
+ api.FM_ACN_TREE_UPDATE.app,
+ api.FM_ACN_TREE_UPDATE.method,
+ [ ses(), volumes, false ]
+ );
if (typeof r.ilsevent != 'undefined') {
switch(Number(r.ilsevent)) {
case 1705 /* VOLUME_LABEL_EXISTS */ :
@@ -717,257 +717,257 @@ circ.copy_status.prototype = {
default: throw(r);
}
} else {
- alert(document.getElementById('circStrings').getString('staff.circ.copy_status.edit_volumes.success'));
+ alert(document.getElementById('circStrings').getString('staff.circ.copy_status.edit_volumes.success'));
}
- } catch(E) {
- obj.error.standard_unexpected_error_alert('volume update error: ',E);
- }
-
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert('Copy Status -> Volume Edit',E);
- }
- }
-
- ],
- 'cmd_delete_volumes' : [
- ['command'],
- function() {
- try {
- JSAN.use('util.functional');
- var list = util.functional.map_list( obj.selection_list, function(o) { return o.acn_id; } );
- if (list.length == 0) { return; }
-
- var map_acn = {};
-
- for (var i = 0; i < list.length; i++) {
- var volume_id = list[i];
- if (volume_id == -1) {
- continue; /* ignore magic pre-cat volume */
- }
- if (! map_acn[volume_id]) {
- map_acn[ volume_id ] = obj.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ volume_id ]);
- }
- }
-
- list = [];
- for (var v in map_acn) {
- list.push( map_acn[v] );
- }
-
- var confirm_prompt;
- if (list.length == 1) {
- confirm_prompt = document.getElementById('circStrings').getString('staff.circ.copy_status.delete_volumes.singular');
- } else {
- confirm_prompt = document.getElementById('circStrings').getString('staff.circ.copy_status.delete_volumes.plural');
- }
-
- var r = obj.error.yns_alert(
- confirm_prompt,
- document.getElementById('circStrings').getString('staff.circ.copy_status.delete_volumes.title'),
- document.getElementById('circStrings').getString('staff.circ.copy_status.delete_volumes.delete'),
- document.getElementById('circStrings').getString('staff.circ.copy_status.delete_volumes.cancel'),
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm')
- );
-
- if (r == 0) {
- for (var i = 0; i < list.length; i++) {
- list[i].isdeleted('1');
- }
- var robj = obj.network.simple_request(
- 'FM_ACN_TREE_UPDATE',
- [ ses(), list, true ],
- null,
- {
- 'title' : document.getElementById('circStrings').getString('staff.circ.copy_status.delete_volumes.override'),
- 'overridable_events' : [
- ]
- }
- );
- if (robj == null) throw(robj);
- if (typeof robj.ilsevent != 'undefined') {
- if (robj.ilsevent == 1206 /* VOLUME_NOT_EMPTY */) {
- alert(document.getElementById('circStrings').getString('staff.circ.copy_status.delete_volumes.delete_copies'));
- return;
- }
- if (robj.ilsevent != 0) { throw(robj); }
- }
- alert(document.getElementById('circStrings').getString('staff.circ.copy_status.delete_volumes.success'));
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert('copy status -> delete volumes',E);
- }
-
- }
-
- ],
- 'cmd_mark_volume' : [
- ['command'],
- function() {
- try {
- JSAN.use('util.functional');
- var list = util.functional.map_list( obj.selection_list, function(o) { return o.acn_id; } );
-
- if (list.length == 1) {
- obj.data.marked_volume = list[0];
- obj.data.stash('marked_volume');
- alert(document.getElementById('circStrings').getString('staff.circ.copy_status.mark_volume.status'));
- } else {
- obj.error.yns_alert(
- document.getElementById('circStrings').getString('staff.circ.copy_status.mark_volume.prompt'),
- document.getElementById('circStrings').getString('staff.circ.copy_status.mark_volume.title'),
- document.getElementById('circStrings').getString('staff.circ.copy_status.ok'),
- null,
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm')
- );
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert('copy status -> mark volume',E);
- }
- }
- ],
- 'cmd_mark_library' : [
- ['command'],
- function() {
- try {
- JSAN.use('util.functional');
- var list = util.functional.map_list( obj.selection_list, function(o) { return o.acn_id; } );
-
- if (list.length == 1) {
- var v = obj.network.simple_request('FM_ACN_RETRIEVE.authoritative',[list[0]]);
- var owning_lib = v.owning_lib();
- if (typeof owning_lib == 'object') {
- owning_lib = owning_lib.id();
- }
-
- obj.data.marked_library = { 'lib' : owning_lib, 'docid' : v.record() };
- obj.data.stash('marked_library');
- alert(document.getElementById('circStrings').getString('staff.circ.copy_status.mark_library'));
- } else {
- obj.error.yns_alert(
- document.getElementById('circStrings').getString('staff.circ.copy_status.mark_library.limit_one'),
- document.getElementById('circStrings').getString('staff.circ.copy_status.mark_library.limit_one.title'),
- document.getElementById('circStrings').getString('staff.circ.copy_status.ok'),
- null,
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm')
- );
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert('copy status -> mark library',E);
- }
- }
- ],
- 'cmd_transfer_volume' : [
- ['command'],
- function() {
- try {
- obj.data.stash_retrieve();
- if (!obj.data.marked_library) {
- alert(document.getElementById('circStrings').getString('staff.circ.copy_status.transfer_volume.none'));
- return;
- }
-
- JSAN.use('util.functional');
-
- var list = util.functional.map_list( obj.selection_list, function(o) { return o.acn_id; } );
- if (list.length == 0) { return; }
-
- var map_acn = {};
-
- for (var i = 0; i < list.length; i++) {
- var volume_id = list[i];
- if (volume_id == -1) {
- continue; /* ignore magic pre-cat volume */
- }
- if (! map_acn[volume_id]) {
- map_acn[ volume_id ] = obj.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ volume_id ]);
- }
- }
-
- list = [];
- for (v in map_acn) {
- list.push(map_acn[v]);
- }
-
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- var xml = '';
- xml += '';
-
- var vols = util.functional.map_list(list,
- function (o) {
- return o.label();
- }
- ).join(", ");
-
- var volume_list = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.transfer_volume.confirm',
- [vols, obj.data.hash.aou[ obj.data.marked_library.lib ].shortname()]);
-
- xml += volume_list;
- xml += ' ';
- xml += ' ';
- xml += ' ';
- xml += '';
- xml += ' ';
- JSAN.use('OpenILS.data');
- //var data = new OpenILS.data(); data.init({'via':'stash'});
- //data.temp_transfer = xml; data.stash('temp_transfer');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_transfer'
- //+ '&title=' + window.escape('Volume Transfer'),
- 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300',
- { 'xml' : xml, 'title' : document.getElementById('circStrings').getString('staff.circ.copy_status.transfer_volume.title') }
- );
-
- if (fancy_prompt_data.fancy_status == 'incomplete') {
- alert(document.getElementById('circStrings').getString('staff.circ.copy_status.transfer_volume.aborted'));
- return;
- }
-
- var robj = obj.network.simple_request(
- 'FM_ACN_TRANSFER',
- [ ses(), { 'docid' : obj.data.marked_library.docid, 'lib' : obj.data.marked_library.lib, 'volumes' : util.functional.map_list( list, function(o) { return o.id(); }) } ],
- null,
- {
- 'title' : document.getElementById('circStrings').getString('staff.circ.copy_status.transfer_volume.override_failure'),
- 'overridable_events' : [
- 1208 /* TITLE_LAST_COPY */,
- 1219 /* COPY_REMOTE_CIRC_LIB */
- ]
- }
- );
-
- if (typeof robj.ilsevent != 'undefined') {
- if (robj.ilsevent == 1221 /* ORG_CANNOT_HAVE_VOLS */) {
- alert(document.getElementById('circStrings').getString('staff.circ.copy_status.transfer_volume.cannot_have_vols'));
- } else {
- throw(robj);
- }
- } else {
- alert(document.getElementById('circStrings').getString('staff.circ.copy_status.transfer_volume.success'));
- }
-
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.copy_status.transfer_volume.error'),E);
- }
- }
-
- ]
- }
- }
- );
- this.controller.render();
- this.controller.view.copy_status_barcode_entry_textbox.focus();
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('volume update error: ',E);
+ }
+
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('Copy Status -> Volume Edit',E);
+ }
+ }
+
+ ],
+ 'cmd_delete_volumes' : [
+ ['command'],
+ function() {
+ try {
+ JSAN.use('util.functional');
+ var list = util.functional.map_list( obj.selection_list, function(o) { return o.acn_id; } );
+ if (list.length == 0) { return; }
+
+ var map_acn = {};
+
+ for (var i = 0; i < list.length; i++) {
+ var volume_id = list[i];
+ if (volume_id == -1) {
+ continue; /* ignore magic pre-cat volume */
+ }
+ if (! map_acn[volume_id]) {
+ map_acn[ volume_id ] = obj.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ volume_id ]);
+ }
+ }
+
+ list = [];
+ for (var v in map_acn) {
+ list.push( map_acn[v] );
+ }
+
+ var confirm_prompt;
+ if (list.length == 1) {
+ confirm_prompt = document.getElementById('circStrings').getString('staff.circ.copy_status.delete_volumes.singular');
+ } else {
+ confirm_prompt = document.getElementById('circStrings').getString('staff.circ.copy_status.delete_volumes.plural');
+ }
+
+ var r = obj.error.yns_alert(
+ confirm_prompt,
+ document.getElementById('circStrings').getString('staff.circ.copy_status.delete_volumes.title'),
+ document.getElementById('circStrings').getString('staff.circ.copy_status.delete_volumes.delete'),
+ document.getElementById('circStrings').getString('staff.circ.copy_status.delete_volumes.cancel'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm')
+ );
+
+ if (r == 0) {
+ for (var i = 0; i < list.length; i++) {
+ list[i].isdeleted('1');
+ }
+ var robj = obj.network.simple_request(
+ 'FM_ACN_TREE_UPDATE',
+ [ ses(), list, true ],
+ null,
+ {
+ 'title' : document.getElementById('circStrings').getString('staff.circ.copy_status.delete_volumes.override'),
+ 'overridable_events' : [
+ ]
+ }
+ );
+ if (robj == null) throw(robj);
+ if (typeof robj.ilsevent != 'undefined') {
+ if (robj.ilsevent == 1206 /* VOLUME_NOT_EMPTY */) {
+ alert(document.getElementById('circStrings').getString('staff.circ.copy_status.delete_volumes.delete_copies'));
+ return;
+ }
+ if (robj.ilsevent != 0) { throw(robj); }
+ }
+ alert(document.getElementById('circStrings').getString('staff.circ.copy_status.delete_volumes.success'));
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('copy status -> delete volumes',E);
+ }
+
+ }
+
+ ],
+ 'cmd_mark_volume' : [
+ ['command'],
+ function() {
+ try {
+ JSAN.use('util.functional');
+ var list = util.functional.map_list( obj.selection_list, function(o) { return o.acn_id; } );
+
+ if (list.length == 1) {
+ obj.data.marked_volume = list[0];
+ obj.data.stash('marked_volume');
+ alert(document.getElementById('circStrings').getString('staff.circ.copy_status.mark_volume.status'));
+ } else {
+ obj.error.yns_alert(
+ document.getElementById('circStrings').getString('staff.circ.copy_status.mark_volume.prompt'),
+ document.getElementById('circStrings').getString('staff.circ.copy_status.mark_volume.title'),
+ document.getElementById('circStrings').getString('staff.circ.copy_status.ok'),
+ null,
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm')
+ );
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('copy status -> mark volume',E);
+ }
+ }
+ ],
+ 'cmd_mark_library' : [
+ ['command'],
+ function() {
+ try {
+ JSAN.use('util.functional');
+ var list = util.functional.map_list( obj.selection_list, function(o) { return o.acn_id; } );
+
+ if (list.length == 1) {
+ var v = obj.network.simple_request('FM_ACN_RETRIEVE.authoritative',[list[0]]);
+ var owning_lib = v.owning_lib();
+ if (typeof owning_lib == 'object') {
+ owning_lib = owning_lib.id();
+ }
+
+ obj.data.marked_library = { 'lib' : owning_lib, 'docid' : v.record() };
+ obj.data.stash('marked_library');
+ alert(document.getElementById('circStrings').getString('staff.circ.copy_status.mark_library'));
+ } else {
+ obj.error.yns_alert(
+ document.getElementById('circStrings').getString('staff.circ.copy_status.mark_library.limit_one'),
+ document.getElementById('circStrings').getString('staff.circ.copy_status.mark_library.limit_one.title'),
+ document.getElementById('circStrings').getString('staff.circ.copy_status.ok'),
+ null,
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm')
+ );
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('copy status -> mark library',E);
+ }
+ }
+ ],
+ 'cmd_transfer_volume' : [
+ ['command'],
+ function() {
+ try {
+ obj.data.stash_retrieve();
+ if (!obj.data.marked_library) {
+ alert(document.getElementById('circStrings').getString('staff.circ.copy_status.transfer_volume.none'));
+ return;
+ }
+
+ JSAN.use('util.functional');
+
+ var list = util.functional.map_list( obj.selection_list, function(o) { return o.acn_id; } );
+ if (list.length == 0) { return; }
+
+ var map_acn = {};
+
+ for (var i = 0; i < list.length; i++) {
+ var volume_id = list[i];
+ if (volume_id == -1) {
+ continue; /* ignore magic pre-cat volume */
+ }
+ if (! map_acn[volume_id]) {
+ map_acn[ volume_id ] = obj.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ volume_id ]);
+ }
+ }
+
+ list = [];
+ for (v in map_acn) {
+ list.push(map_acn[v]);
+ }
+
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
+ var xml = '';
+ xml += '';
+
+ var vols = util.functional.map_list(list,
+ function (o) {
+ return o.label();
+ }
+ ).join(", ");
+
+ var volume_list = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.transfer_volume.confirm',
+ [vols, obj.data.hash.aou[ obj.data.marked_library.lib ].shortname()]);
+
+ xml += volume_list;
+ xml += ' ';
+ xml += ' ';
+ xml += ' ';
+ xml += '';
+ xml += ' ';
+ JSAN.use('OpenILS.data');
+ //var data = new OpenILS.data(); data.init({'via':'stash'});
+ //data.temp_transfer = xml; data.stash('temp_transfer');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_transfer'
+ //+ '&title=' + window.escape('Volume Transfer'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300',
+ { 'xml' : xml, 'title' : document.getElementById('circStrings').getString('staff.circ.copy_status.transfer_volume.title') }
+ );
+
+ if (fancy_prompt_data.fancy_status == 'incomplete') {
+ alert(document.getElementById('circStrings').getString('staff.circ.copy_status.transfer_volume.aborted'));
+ return;
+ }
+
+ var robj = obj.network.simple_request(
+ 'FM_ACN_TRANSFER',
+ [ ses(), { 'docid' : obj.data.marked_library.docid, 'lib' : obj.data.marked_library.lib, 'volumes' : util.functional.map_list( list, function(o) { return o.id(); }) } ],
+ null,
+ {
+ 'title' : document.getElementById('circStrings').getString('staff.circ.copy_status.transfer_volume.override_failure'),
+ 'overridable_events' : [
+ 1208 /* TITLE_LAST_COPY */,
+ 1219 /* COPY_REMOTE_CIRC_LIB */
+ ]
+ }
+ );
+
+ if (typeof robj.ilsevent != 'undefined') {
+ if (robj.ilsevent == 1221 /* ORG_CANNOT_HAVE_VOLS */) {
+ alert(document.getElementById('circStrings').getString('staff.circ.copy_status.transfer_volume.cannot_have_vols'));
+ } else {
+ throw(robj);
+ }
+ } else {
+ alert(document.getElementById('circStrings').getString('staff.circ.copy_status.transfer_volume.success'));
+ }
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.copy_status.transfer_volume.error'),E);
+ }
+ }
+
+ ]
+ }
+ }
+ );
+ this.controller.render();
+ this.controller.view.copy_status_barcode_entry_textbox.focus();
JSAN.use('util.browser');
obj.browser = new util.browser();
@@ -981,124 +981,124 @@ circ.copy_status.prototype = {
}
);
- },
-
- 'test_barcode' : function(bc) {
- var obj = this;
- var good = util.barcode.check(bc);
- var x = document.getElementById('strict_barcode');
- if (x && x.checked != true) { return true; }
- if (good) {
- return true;
- } else {
- if ( 1 == obj.error.yns_alert(
- document.getElementById('circStrings').getFormattedString('staff.circ.check_digit.bad', [bc]),
- document.getElementById('circStrings').getString('staff.circ.barcode.bad'),
- document.getElementById('circStrings').getString('staff.circ.cancel'),
- document.getElementById('circStrings').getString('staff.circ.barcode.accept'),
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm'),
- '/xul/server/skin/media/images/bad_barcode.png'
- ) ) {
- return true;
- } else {
- return false;
- }
- }
- },
-
- 'copy_status' : function(barcode,refresh) {
- var obj = this;
- try {
- try { document.getElementById('last_scanned').setAttribute('value',''); } catch(E) {}
- if (!barcode) {
- barcode = obj.controller.view.copy_status_barcode_entry_textbox.value;
- }
- if (!barcode) { return; }
- if (barcode) {
- if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; }
- }
- JSAN.use('circ.util');
- function handle_req(req) {
- try {
- var details = req.getResultObject();
- if (details == null) {
- throw(document.getElementById('circStrings').getString('staff.circ.copy_status.status.null_result'));
- } else if (details.ilsevent) {
- switch(Number(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', document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.status.copy_not_found', [barcode])); } catch(E) {}
- obj.error.yns_alert(
- document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.status.copy_not_found', [barcode]),
- document.getElementById('circStrings').getString('staff.circ.copy_status.status.not_cataloged'),
- document.getElementById('circStrings').getString('staff.circ.copy_status.ok'),
- null,
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg')
- );
- 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 msg = details.copy.barcode() + ' -- ';
- if (details.copy.call_number() == -1) {
- msg += document.getElementById('circStrings').getString('staff.circ.copy_status.status.pre_cat') + ' ';
- }
- if (details.hold) {
- msg += document.getElementById('circStrings').getString('staff.circ.copy_status.status.hold') + ' ';
- }
- if (details.transit) {
- msg += document.getElementById('circStrings').getString('staff.circ.copy_status.status.transit') + ' ';
- }
- if (details.circ && ! details.circ.checkin_time()) {
- msg += document.getElementById('circStrings').getString('staff.circ.copy_status.status.circ') + ' ';
- }
- 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; }
- }
- var params = {
- '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
- };
- if (!refresh) {
- var nparams = obj.list.append(params);
- if (!document.getElementById('trim_list').checked) {
- if (typeof obj.list_copyid_map[details.copy.id()] == 'undefined') obj.list_copyid_map[details.copy.id()] =[];
- obj.list_copyid_map[details.copy.id()].push(nparams);
- }
- } else {
- if (!document.getElementById('trim_list').checked) {
+ },
+
+ 'test_barcode' : function(bc) {
+ var obj = this;
+ var good = util.barcode.check(bc);
+ var x = document.getElementById('strict_barcode');
+ if (x && x.checked != true) { return true; }
+ if (good) {
+ return true;
+ } else {
+ if ( 1 == obj.error.yns_alert(
+ document.getElementById('circStrings').getFormattedString('staff.circ.check_digit.bad', [bc]),
+ document.getElementById('circStrings').getString('staff.circ.barcode.bad'),
+ document.getElementById('circStrings').getString('staff.circ.cancel'),
+ document.getElementById('circStrings').getString('staff.circ.barcode.accept'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm'),
+ '/xul/server/skin/media/images/bad_barcode.png'
+ ) ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ },
+
+ 'copy_status' : function(barcode,refresh) {
+ var obj = this;
+ try {
+ try { document.getElementById('last_scanned').setAttribute('value',''); } catch(E) {}
+ if (!barcode) {
+ barcode = obj.controller.view.copy_status_barcode_entry_textbox.value;
+ }
+ if (!barcode) { return; }
+ if (barcode) {
+ if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; }
+ }
+ JSAN.use('circ.util');
+ function handle_req(req) {
+ try {
+ var details = req.getResultObject();
+ if (details == null) {
+ throw(document.getElementById('circStrings').getString('staff.circ.copy_status.status.null_result'));
+ } else if (details.ilsevent) {
+ switch(Number(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', document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.status.copy_not_found', [barcode])); } catch(E) {}
+ obj.error.yns_alert(
+ document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.status.copy_not_found', [barcode]),
+ document.getElementById('circStrings').getString('staff.circ.copy_status.status.not_cataloged'),
+ document.getElementById('circStrings').getString('staff.circ.copy_status.ok'),
+ null,
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg')
+ );
+ 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 msg = details.copy.barcode() + ' -- ';
+ if (details.copy.call_number() == -1) {
+ msg += document.getElementById('circStrings').getString('staff.circ.copy_status.status.pre_cat') + ' ';
+ }
+ if (details.hold) {
+ msg += document.getElementById('circStrings').getString('staff.circ.copy_status.status.hold') + ' ';
+ }
+ if (details.transit) {
+ msg += document.getElementById('circStrings').getString('staff.circ.copy_status.status.transit') + ' ';
+ }
+ if (details.circ && ! details.circ.checkin_time()) {
+ msg += document.getElementById('circStrings').getString('staff.circ.copy_status.status.circ') + ' ';
+ }
+ 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; }
+ }
+ var params = {
+ '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
+ };
+ if (!refresh) {
+ var nparams = obj.list.append(params);
+ if (!document.getElementById('trim_list').checked) {
+ if (typeof obj.list_copyid_map[details.copy.id()] == 'undefined') obj.list_copyid_map[details.copy.id()] =[];
+ obj.list_copyid_map[details.copy.id()].push(nparams);
+ }
+ } else {
+ if (!document.getElementById('trim_list').checked) {
if (typeof obj.list_copyid_map[details.copy.id()] != 'undefined') {
for (var i = 0; i < obj.list_copyid_map[details.copy.id()].length; i++) {
if (typeof obj.list_copyid_map[details.copy.id()][i] == 'undefined') {
@@ -1109,18 +1109,18 @@ circ.copy_status.prototype = {
}
}
} else {
- obj.list.append(params);
+ obj.list.append(params);
}
- } else {
- obj.list.append(params);
- }
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert('barcode = ' + barcode,E);
- }
- }
- var result = obj.network.simple_request('FM_ACP_DETAILS_VIA_BARCODE.authoritative', [ ses(), barcode ]);
- handle_req({'getResultObject':function(){return result;}}); // used to be async
+ } else {
+ obj.list.append(params);
+ }
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('barcode = ' + barcode,E);
+ }
+ }
+ var result = obj.network.simple_request('FM_ACP_DETAILS_VIA_BARCODE.authoritative', [ ses(), barcode ]);
+ handle_req({'getResultObject':function(){return result;}}); // used to be async
if (result.copy && document.getElementById('deck').selectedIndex == 1) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var f = obj.browser.get_content();
@@ -1132,35 +1132,35 @@ circ.copy_status.prototype = {
alert('hrmm');
}
}
- 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('barcode = ' + barcode,E);
- obj.controller.view.copy_status_barcode_entry_textbox.select();
- obj.controller.view.copy_status_barcode_entry_textbox.focus();
- }
+ 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('barcode = ' + barcode,E);
+ obj.controller.view.copy_status_barcode_entry_textbox.select();
+ obj.controller.view.copy_status_barcode_entry_textbox.focus();
+ }
- },
-
- 'spawn_copy_editor' : function() {
+ },
+
+ 'spawn_copy_editor' : function() {
- var obj = this;
+ var obj = this;
- JSAN.use('util.functional');
+ JSAN.use('util.functional');
- var list = obj.selection_list;
+ var list = obj.selection_list;
- list = util.functional.map_list(
- list,
- function (o) {
- return o.copy_id;
- }
- );
+ list = util.functional.map_list(
+ list,
+ function (o) {
+ return o.copy_id;
+ }
+ );
- JSAN.use('cat.util'); cat.util.spawn_copy_editor( { 'copy_ids' : list, 'edit' : 1 } );
+ JSAN.use('cat.util'); cat.util.spawn_copy_editor( { 'copy_ids' : list, 'edit' : 1 } );
- },
+ },
}
diff --git a/Open-ILS/xul/staff_client/server/circ/in_house_use.js b/Open-ILS/xul/staff_client/server/circ/in_house_use.js
index 919c105607..5f81732ab7 100644
--- a/Open-ILS/xul/staff_client/server/circ/in_house_use.js
+++ b/Open-ILS/xul/staff_client/server/circ/in_house_use.js
@@ -4,347 +4,347 @@ dump('entering circ.in_house_use.js\n');
if (typeof circ == 'undefined') circ = {};
circ.in_house_use = function (params) {
- JSAN.use('util.error'); this.error = new util.error();
- JSAN.use('util.network'); this.network = new util.network();
- JSAN.use('util.barcode');
- JSAN.use('util.date');
- JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
+ JSAN.use('util.error'); this.error = new util.error();
+ JSAN.use('util.network'); this.network = new util.network();
+ JSAN.use('util.barcode');
+ JSAN.use('util.date');
+ JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
}
circ.in_house_use.prototype = {
- 'init' : function( params ) {
+ 'init' : function( params ) {
- var obj = this;
+ var obj = this;
- JSAN.use('circ.util');
- var columns = circ.util.columns(
- {
- 'barcode' : { 'hidden' : false },
- 'title' : { 'hidden' : false },
- 'status' : { 'hidden' : false },
- 'location' : { 'hidden' : false },
- 'call_number' : { 'hidden' : false },
- 'uses' : { 'hidden' : false }
- }
- );
+ JSAN.use('circ.util');
+ var columns = circ.util.columns(
+ {
+ 'barcode' : { 'hidden' : false },
+ 'title' : { 'hidden' : false },
+ 'status' : { 'hidden' : false },
+ 'location' : { 'hidden' : false },
+ 'call_number' : { 'hidden' : false },
+ 'uses' : { 'hidden' : false }
+ }
+ );
- JSAN.use('util.list'); obj.list = new util.list('in_house_use_list');
- obj.list.init(
- {
- 'columns' : columns,
- 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
- 'on_select' : function() {
- var sel = obj.list.retrieve_selection();
- obj.controller.view.sel_clip.setAttribute('disabled', sel.length < 1);
- }
- }
- );
-
- JSAN.use('util.controller'); obj.controller = new util.controller();
- obj.controller.init(
- {
- 'control_map' : {
- 'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
- 'sel_clip' : [
- ['command'],
- function() {
- obj.list.clipboard();
- obj.controller.view.in_house_use_barcode_entry_textbox.focus();
- }
- ],
- 'in_house_use_menu_placeholder' : [
- ['render'],
- function(e) {
- return function() {
- JSAN.use('util.widgets'); JSAN.use('util.functional'); JSAN.use('util.fm_utils');
- var items = [ [ document.getElementById('circStrings').getString('staff.circ.in_house_use.barcode') , 'barcode' ] ].concat(
- util.functional.map_list(
- util.functional.filter_list(
- obj.data.list.my_cnct,
- function(o) {
- return util.fm_utils.compare_aou_a_is_b_or_ancestor(o.owning_lib(), obj.data.list.au[0].ws_ou());
- }
- ).sort(
+ JSAN.use('util.list'); obj.list = new util.list('in_house_use_list');
+ obj.list.init(
+ {
+ 'columns' : columns,
+ 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
+ 'on_select' : function() {
+ var sel = obj.list.retrieve_selection();
+ obj.controller.view.sel_clip.setAttribute('disabled', sel.length < 1);
+ }
+ }
+ );
+
+ JSAN.use('util.controller'); obj.controller = new util.controller();
+ obj.controller.init(
+ {
+ 'control_map' : {
+ 'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
+ 'sel_clip' : [
+ ['command'],
+ function() {
+ obj.list.clipboard();
+ obj.controller.view.in_house_use_barcode_entry_textbox.focus();
+ }
+ ],
+ 'in_house_use_menu_placeholder' : [
+ ['render'],
+ function(e) {
+ return function() {
+ JSAN.use('util.widgets'); JSAN.use('util.functional'); JSAN.use('util.fm_utils');
+ var items = [ [ document.getElementById('circStrings').getString('staff.circ.in_house_use.barcode') , 'barcode' ] ].concat(
+ util.functional.map_list(
+ util.functional.filter_list(
+ obj.data.list.my_cnct,
+ function(o) {
+ return util.fm_utils.compare_aou_a_is_b_or_ancestor(o.owning_lib(), obj.data.list.au[0].ws_ou());
+ }
+ ).sort(
- function(a,b) {
- try {
- return util.fm_utils.sort_func_aou_by_depth_and_then_string(
- [ a.owning_lib(), a.name() ],
- [ b.owning_lib(), b.name() ]
- );
- } catch(E) {
- alert(document.getElementById('circStrings').getString('staff.circ.in_house_use.noncat_sort_error') + ' ' + E);
- return 0;
- }
- }
+ function(a,b) {
+ try {
+ return util.fm_utils.sort_func_aou_by_depth_and_then_string(
+ [ a.owning_lib(), a.name() ],
+ [ b.owning_lib(), b.name() ]
+ );
+ } catch(E) {
+ alert(document.getElementById('circStrings').getString('staff.circ.in_house_use.noncat_sort_error') + ' ' + E);
+ return 0;
+ }
+ }
- ),
- function(o) {
- return [ obj.data.hash.aou[ o.owning_lib() ].shortname() + ' : ' + o.name(), o.id() ];
- }
- )
- );
- g.error.sdump('D_TRACE', document.getElementById('circStrings').getString('staff.circ.in_house_use.items_dump') + js2JSON(items));
- util.widgets.remove_children( e );
- var ml = util.widgets.make_menulist(
- items
- );
- e.appendChild( ml );
- ml.setAttribute('id','in_house_use_menulist');
- ml.setAttribute('accesskey','');
- ml.addEventListener(
- 'command',
- function(ev) {
- var tb = obj.controller.view.in_house_use_barcode_entry_textbox;
- if (ev.target.value == 'barcode') {
- tb.disabled = false;
- tb.value = '';
- tb.focus();
- } else {
- tb.disabled = true;
- tb.value = document.getElementById('circStrings').getString('staff.circ.in_house_use.noncataloged');
- }
- }, false
- );
- obj.controller.view.in_house_use_menu = ml;
- };
- },
- ],
- 'in_house_use_barcode_entry_textbox' : [
- ['keypress'],
- function(ev) {
- if (ev.keyCode && ev.keyCode == 13) {
- obj.in_house_use();
- }
- }
- ],
- 'in_house_use_multiplier_label' : [
- ['render'],
- function(e) {
- return function() {
- obj.controller.view.in_house_use_multiplier_textbox.select();
- obj.controller.view.in_house_use_multiplier_textbox.value = 1;
- };
- }
- ],
- 'in_house_use_multiplier_textbox' : [
- ['change'],
- function(ev) {
- if (ev.target.nodeName == 'textbox') {
- try {
- var value = Number(ev.target.value);
- if (value > 0) {
- if (value > 99) ev.target.value = 99;
- } else {
- ev.target.value = 1;
- }
- } catch(E) {
- dump('in_house_use:multiplier: ' + E + '\n');
- ev.target.value = 1;
- }
- }
- }
- ],
- 'cmd_broken' : [
- ['command'],
- function() { alert(document.getElementById('circStrings').getString('staff.circ.unimplemented')); }
- ],
- 'cmd_in_house_use_submit_barcode' : [
- ['command'],
- function() {
- obj.in_house_use();
- }
- ],
- 'cmd_in_house_use_print' : [
- ['command'],
- function() {
- var p = {
- 'template' : 'in_house_use'
- };
- obj.list.print(p);
- }
- ],
- 'cmd_csv_to_clipboard' : [ ['command'], function() {
+ ),
+ function(o) {
+ return [ obj.data.hash.aou[ o.owning_lib() ].shortname() + ' : ' + o.name(), o.id() ];
+ }
+ )
+ );
+ g.error.sdump('D_TRACE', document.getElementById('circStrings').getString('staff.circ.in_house_use.items_dump') + js2JSON(items));
+ util.widgets.remove_children( e );
+ var ml = util.widgets.make_menulist(
+ items
+ );
+ e.appendChild( ml );
+ ml.setAttribute('id','in_house_use_menulist');
+ ml.setAttribute('accesskey','');
+ ml.addEventListener(
+ 'command',
+ function(ev) {
+ var tb = obj.controller.view.in_house_use_barcode_entry_textbox;
+ if (ev.target.value == 'barcode') {
+ tb.disabled = false;
+ tb.value = '';
+ tb.focus();
+ } else {
+ tb.disabled = true;
+ tb.value = document.getElementById('circStrings').getString('staff.circ.in_house_use.noncataloged');
+ }
+ }, false
+ );
+ obj.controller.view.in_house_use_menu = ml;
+ };
+ },
+ ],
+ 'in_house_use_barcode_entry_textbox' : [
+ ['keypress'],
+ function(ev) {
+ if (ev.keyCode && ev.keyCode == 13) {
+ obj.in_house_use();
+ }
+ }
+ ],
+ 'in_house_use_multiplier_label' : [
+ ['render'],
+ function(e) {
+ return function() {
+ obj.controller.view.in_house_use_multiplier_textbox.select();
+ obj.controller.view.in_house_use_multiplier_textbox.value = 1;
+ };
+ }
+ ],
+ 'in_house_use_multiplier_textbox' : [
+ ['change'],
+ function(ev) {
+ if (ev.target.nodeName == 'textbox') {
+ try {
+ var value = Number(ev.target.value);
+ if (value > 0) {
+ if (value > 99) ev.target.value = 99;
+ } else {
+ ev.target.value = 1;
+ }
+ } catch(E) {
+ dump('in_house_use:multiplier: ' + E + '\n');
+ ev.target.value = 1;
+ }
+ }
+ }
+ ],
+ 'cmd_broken' : [
+ ['command'],
+ function() { alert(document.getElementById('circStrings').getString('staff.circ.unimplemented')); }
+ ],
+ 'cmd_in_house_use_submit_barcode' : [
+ ['command'],
+ function() {
+ obj.in_house_use();
+ }
+ ],
+ 'cmd_in_house_use_print' : [
+ ['command'],
+ function() {
+ var p = {
+ 'template' : 'in_house_use'
+ };
+ obj.list.print(p);
+ }
+ ],
+ 'cmd_csv_to_clipboard' : [ ['command'], function() {
obj.list.dump_csv_to_clipboard();
obj.controller.view.in_house_use_barcode_entry_textbox.focus();
} ],
- 'cmd_csv_to_printer' : [ ['command'], function() {
+ 'cmd_csv_to_printer' : [ ['command'], function() {
obj.list.dump_csv_to_printer();
obj.controller.view.in_house_use_barcode_entry_textbox.focus();
} ],
- 'cmd_csv_to_file' : [ ['command'], function() {
+ 'cmd_csv_to_file' : [ ['command'], function() {
obj.list.dump_csv_to_file( { 'defaultFileName' : 'checked_in.txt' } );
obj.controller.view.in_house_use_barcode_entry_textbox.focus();
} ]
- }
- }
- );
- this.controller.render();
- this.controller.view.in_house_use_barcode_entry_textbox.focus();
+ }
+ }
+ );
+ this.controller.render();
+ this.controller.view.in_house_use_barcode_entry_textbox.focus();
- },
+ },
- 'test_barcode' : function(bc) {
- var obj = this;
- var good = util.barcode.check(bc);
- var x = document.getElementById('strict_barcode');
- if (x && x.checked != true) return true;
- if (good) {
- return true;
- } else {
- if ( 1 == obj.error.yns_alert(
- document.getElementById('circStrings').getFormattedString('staff.circ.check_digit.bad', [bc]),
- document.getElementById('circStrings').getString('staff.circ.barcode.bad'),
- document.getElementById('circStrings').getString('staff.circ.cancel'),
- document.getElementById('circStrings').getString('staff.circ.barcode.accept'),
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm'),
- '/xul/server/skin/media/images/bad_barcode.png'
- ) ) {
- return true;
- } else {
- return false;
- }
- }
- },
+ 'test_barcode' : function(bc) {
+ var obj = this;
+ var good = util.barcode.check(bc);
+ var x = document.getElementById('strict_barcode');
+ if (x && x.checked != true) return true;
+ if (good) {
+ return true;
+ } else {
+ if ( 1 == obj.error.yns_alert(
+ document.getElementById('circStrings').getFormattedString('staff.circ.check_digit.bad', [bc]),
+ document.getElementById('circStrings').getString('staff.circ.barcode.bad'),
+ document.getElementById('circStrings').getString('staff.circ.cancel'),
+ document.getElementById('circStrings').getString('staff.circ.barcode.accept'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm'),
+ '/xul/server/skin/media/images/bad_barcode.png'
+ ) ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ },
- 'in_house_use' : function() {
- var obj = this;
- try {
- var barcode;
- if (obj.controller.view.in_house_use_menu.value == '' || obj.controller.view.in_house_use_menu.value == 'barcode') {
- barcode = obj.controller.view.in_house_use_barcode_entry_textbox.value;
- if (barcode) {
- if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; }
- }
- } else {
- barcode = ( obj.controller.view.in_house_use_menu.value );
- //barcode = obj.data.hash.cnct[ obj.controller.view.in_house_use_menu.value ].name()
- }
- var multiplier = Number( obj.controller.view.in_house_use_multiplier_textbox.value );
+ 'in_house_use' : function() {
+ var obj = this;
+ try {
+ var barcode;
+ if (obj.controller.view.in_house_use_menu.value == '' || obj.controller.view.in_house_use_menu.value == 'barcode') {
+ barcode = obj.controller.view.in_house_use_barcode_entry_textbox.value;
+ if (barcode) {
+ if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; }
+ }
+ } else {
+ barcode = ( obj.controller.view.in_house_use_menu.value );
+ //barcode = obj.data.hash.cnct[ obj.controller.view.in_house_use_menu.value ].name()
+ }
+ var multiplier = Number( obj.controller.view.in_house_use_multiplier_textbox.value );
- if (barcode == '') {
- obj.controller.view.in_house_use_barcode_entry_textbox.focus();
- return;
- }
+ if (barcode == '') {
+ obj.controller.view.in_house_use_barcode_entry_textbox.focus();
+ return;
+ }
- if (multiplier == 0 || multiplier > 99) {
- obj.controller.view.in_house_use_multiplier_textbox.focus();
- obj.controller.view.in_house_use_multiplier_textbox.select();
- return;
- }
+ if (multiplier == 0 || multiplier > 99) {
+ obj.controller.view.in_house_use_multiplier_textbox.focus();
+ obj.controller.view.in_house_use_multiplier_textbox.select();
+ return;
+ }
- if (multiplier > 20) {
- var r = obj.error.yns_alert(
- document.getElementById('circStrings').getFormattedString('staff.circ.in_house_use.confirm_multiple', [barcode, multiplier]),
- document.getElementById('circStrings').getString('staff.circ.in_house_use.confirm_multiple.title'),
- document.getElementById('circStrings').getString('staff.circ.in_house_use.yes'),
- document.getElementById('circStrings').getString('staff.circ.in_house_use.no'),
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg')
- );
- if (r != 0) {
- obj.controller.view.in_house_use_multiplier_textbox.focus();
- obj.controller.view.in_house_use_multiplier_textbox.select();
- return;
- }
- }
+ if (multiplier > 20) {
+ var r = obj.error.yns_alert(
+ document.getElementById('circStrings').getFormattedString('staff.circ.in_house_use.confirm_multiple', [barcode, multiplier]),
+ document.getElementById('circStrings').getString('staff.circ.in_house_use.confirm_multiple.title'),
+ document.getElementById('circStrings').getString('staff.circ.in_house_use.yes'),
+ document.getElementById('circStrings').getString('staff.circ.in_house_use.no'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg')
+ );
+ if (r != 0) {
+ obj.controller.view.in_house_use_multiplier_textbox.focus();
+ obj.controller.view.in_house_use_multiplier_textbox.select();
+ return;
+ }
+ }
- JSAN.use('circ.util');
+ JSAN.use('circ.util');
- if (obj.controller.view.in_house_use_menu.value == 'barcode') {
+ if (obj.controller.view.in_house_use_menu.value == 'barcode') {
- var copy = obj.network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ barcode ]);
- if (copy.ilsevent) {
- switch(Number(copy.ilsevent)) {
- case -1 :
- obj.error.standard_network_error_alert(document.getElementById('circStrings').getString('staff.circ.in_house_use.failed.verbose'));
- break;
- case 1502 /* ASSET_COPY_NOT_FOUND */ :
- obj.error.yns_alert(
- copy.textcode,
- document.getElementById('circStrings').getString('staff.circ.in_house_use.failed'),
- document.getElementById('circStrings').getString('staff.circ.in_house_use.ok'),
- null,
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg')
- );
- break;
- default:
- throw(copy);
- }
- return;
- }
-
- var mods = obj.network.simple_request('MODS_SLIM_RECORD_RETRIEVE_VIA_COPY.authoritative',[ copy.id() ]);
- var result = obj.network.simple_request('FM_AIHU_CREATE',
- [ ses(), { 'copyid' : copy.id(), 'location' : obj.data.list.au[0].ws_ou(), 'count' : multiplier } ]
- );
+ var copy = obj.network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ barcode ]);
+ if (copy.ilsevent) {
+ switch(Number(copy.ilsevent)) {
+ case -1 :
+ obj.error.standard_network_error_alert(document.getElementById('circStrings').getString('staff.circ.in_house_use.failed.verbose'));
+ break;
+ case 1502 /* ASSET_COPY_NOT_FOUND */ :
+ obj.error.yns_alert(
+ copy.textcode,
+ document.getElementById('circStrings').getString('staff.circ.in_house_use.failed'),
+ document.getElementById('circStrings').getString('staff.circ.in_house_use.ok'),
+ null,
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg')
+ );
+ break;
+ default:
+ throw(copy);
+ }
+ return;
+ }
+
+ var mods = obj.network.simple_request('MODS_SLIM_RECORD_RETRIEVE_VIA_COPY.authoritative',[ copy.id() ]);
+ var result = obj.network.simple_request('FM_AIHU_CREATE',
+ [ ses(), { 'copyid' : copy.id(), 'location' : obj.data.list.au[0].ws_ou(), 'count' : multiplier } ]
+ );
- } else {
- var result = obj.network.simple_request('FM_ANCIHU_CREATE',
- [ ses(), { 'non_cat_type' : obj.controller.view.in_house_use_menu.value, 'location' : obj.data.list.au[0].ws_ou(), 'count' : multiplier } ]
- );
- mods = new mvr(); mods.title( obj.data.hash.cnct[ obj.controller.view.in_house_use_menu.value ].name());
- copy = new acp(); copy.barcode( '' );
- }
+ } else {
+ var result = obj.network.simple_request('FM_ANCIHU_CREATE',
+ [ ses(), { 'non_cat_type' : obj.controller.view.in_house_use_menu.value, 'location' : obj.data.list.au[0].ws_ou(), 'count' : multiplier } ]
+ );
+ mods = new mvr(); mods.title( obj.data.hash.cnct[ obj.controller.view.in_house_use_menu.value ].name());
+ copy = new acp(); copy.barcode( '' );
+ }
- 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(
- {
- 'row' : {
- 'my' : {
- 'mvr' : mods,
- 'acp' : copy,
- 'uses' : result.length
- }
- },
- 'to_top' : true
- //I could override map_row_to_column here
- }
- );
+ 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(
+ {
+ 'row' : {
+ 'my' : {
+ 'mvr' : mods,
+ 'acp' : copy,
+ 'uses' : result.length
+ }
+ },
+ 'to_top' : true
+ //I could override map_row_to_column here
+ }
+ );
- if (typeof obj.on_in_house_use == 'function') {
- obj.on_in_house_use(result);
- }
- if (typeof window.xulG == 'object' && typeof window.xulG.on_in_house_use == 'function') {
- obj.error.sdump('D_CIRC', + document.getElementById('circStrings').getString('staff.circ.in_house_use.external') + '\n');
- window.xulG.on_in_house_use(result);
- } else {
- obj.error.sdump('D_CIRC', + document.getElementById('circStrings').getString('staff.circ.in_house_use.no_external') + '\n');
- }
+ if (typeof obj.on_in_house_use == 'function') {
+ obj.on_in_house_use(result);
+ }
+ if (typeof window.xulG == 'object' && typeof window.xulG.on_in_house_use == 'function') {
+ obj.error.sdump('D_CIRC', + document.getElementById('circStrings').getString('staff.circ.in_house_use.external') + '\n');
+ window.xulG.on_in_house_use(result);
+ } else {
+ obj.error.sdump('D_CIRC', + document.getElementById('circStrings').getString('staff.circ.in_house_use.no_external') + '\n');
+ }
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.in_house_use.failed'), E);
- if (typeof obj.on_failure == 'function') {
- obj.on_failure(E);
- }
- if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
- obj.error.sdump('D_CIRC', + document.getElementById('circStrings').getString('staff.circ.in_house_use.on_failure.external') + '\n');
- window.xulG.on_failure(E);
- } else {
- obj.error.sdump('D_CIRC', + document.getElementById('circStrings').getString('staff.circ.in_house_use.on_failure.external') + '\n');
- }
- }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.in_house_use.failed'), E);
+ if (typeof obj.on_failure == 'function') {
+ obj.on_failure(E);
+ }
+ if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
+ obj.error.sdump('D_CIRC', + document.getElementById('circStrings').getString('staff.circ.in_house_use.on_failure.external') + '\n');
+ window.xulG.on_failure(E);
+ } else {
+ obj.error.sdump('D_CIRC', + document.getElementById('circStrings').getString('staff.circ.in_house_use.on_failure.external') + '\n');
+ }
+ }
- },
+ },
- 'on_in_house_use' : function() {
- this.controller.view.in_house_use_multiplier_textbox.select();
- this.controller.view.in_house_use_multiplier_textbox.value = '1';
- this.controller.view.in_house_use_barcode_entry_textbox.value = '';
- this.controller.view.in_house_use_barcode_entry_textbox.focus();
- },
+ 'on_in_house_use' : function() {
+ this.controller.view.in_house_use_multiplier_textbox.select();
+ this.controller.view.in_house_use_multiplier_textbox.value = '1';
+ this.controller.view.in_house_use_barcode_entry_textbox.value = '';
+ this.controller.view.in_house_use_barcode_entry_textbox.focus();
+ },
- 'on_failure' : function() {
- this.controller.view.in_house_use_barcode_entry_textbox.select();
- this.controller.view.in_house_use_barcode_entry_textbox.focus();
- }
+ 'on_failure' : function() {
+ this.controller.view.in_house_use_barcode_entry_textbox.select();
+ this.controller.view.in_house_use_barcode_entry_textbox.focus();
+ }
}
dump('exiting circ.in_house_use.js\n');
diff --git a/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.js b/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.js
index 340f870626..78651e7755 100644
--- a/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.js
+++ b/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.js
@@ -3,399 +3,399 @@ dump('entering print_list_template_editor.js\n');
if (typeof circ == 'undefined') circ = {};
circ.print_list_template_editor = function (params) {
- try {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- JSAN.use('util.error'); this.error = new util.error();
- } catch(E) {
- dump('print_list: ' + E + '\n');
- }
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ JSAN.use('util.error'); this.error = new util.error();
+ } catch(E) {
+ dump('print_list: ' + E + '\n');
+ }
}
circ.print_list_template_editor.prototype = {
- 'init' : function( params ) {
+ 'init' : function( params ) {
- try {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- var obj = this;
+ var obj = this;
- JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
- this.test_patron = new au();
- this.test_patron.family_name('Doe');
- this.test_patron.first_given_name('John');
- this.test_card = new ac();
- this.test_card.barcode('123456789');
- this.test_patron.card( this.test_card );
+ JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
+ this.test_patron = new au();
+ this.test_patron.family_name('Doe');
+ this.test_patron.first_given_name('John');
+ this.test_card = new ac();
+ this.test_card.barcode('123456789');
+ this.test_patron.card( this.test_card );
- this.test_data = {
- 'payment' : {
- 'original_balance' : '16.36',
- 'payment_type' : 'Cash',
- 'payment_received' : '0.00',
- 'payment_applied' : '0.00',
- 'voided_balance' : '0.50',
- 'change_given' : '0.00',
- 'credit_given' : '0.00',
- 'note' : "We refunded this because...",
- 'new_balance' : '16.36'
- }
- }
+ this.test_data = {
+ 'payment' : {
+ 'original_balance' : '16.36',
+ 'payment_type' : 'Cash',
+ 'payment_received' : '0.00',
+ 'payment_applied' : '0.00',
+ 'voided_balance' : '0.50',
+ 'change_given' : '0.00',
+ 'credit_given' : '0.00',
+ 'note' : "We refunded this because...",
+ 'new_balance' : '16.36'
+ }
+ }
- this.test_list = {
-
- 'items' : [
- {"uses":"undefined","alert_message":"","author":"Annixter, Jane.","barcode":"3635300990263","call_number":"F","checkin_time":" ","checkin_time_full":"","xact_start":"2006-08-23","xact_start_full":"2006-08-23T14:37:15-0400","circ_as_type":"","circ_id":"19907","circ_lib":"URRLS-SC","circ_modifier":"","circulate":"Yes","acp_id":"34","copy_number":"1","create_date":"2006-04-28","edit_date":"2006-08-23","deleted":"No","deposit_amount":"0.00","deposit":"No","mvr_doc_id":"13","due_date":"2006-08-23","edition":"","fine_level":"Low","stop_fines":"","stop_fines_time":"","holdable":"Yes","isbn":"","loan_duration":"Short","location":"Adult","message":" ","opac_visible":"Yes","owning_lib":"URRLS-SC","price":"10.00","pubdate":"1961","publisher":"Longmans","ref":"No","renewal_remaining":"0","route_to":" ","status":"Checked out","tcn":"PIN01000015 ","title":"Peace comes to Castle Oak ","xact_finish":""},
- {"uses":"undefined","alert_message":"","author":"Josephson, Matthew","barcode":"33207002163014","call_number":"NONFIC 330.922 JOSEPHSO","checkin_time":" ","checkin_time_full":"","xact_start":"2006-08-23","xact_start_full":"2006-08-23T14:37:23-0400","circ_as_type":"","circ_id":"19908","circ_lib":"ARL-ATH","circ_modifier":"","circulate":"Yes","acp_id":"1658","copy_number":"1","create_date":"2006-04-28","edit_date":"2006-08-23","deleted":"No","deposit_amount":"0.00","deposit":"No","mvr_doc_id":"250","due_date":"2006-09-06","edition":"","fine_level":"Low","stop_fines":"","stop_fines_time":"","holdable":"Yes","isbn":"","loan_duration":"Short","location":"Adult","message":" ","opac_visible":"Yes","owning_lib":"ARL-ATH","price":"10.95","pubdate":"[c1934]","publisher":"Harcourt, Brace and company","ref":"No","renewal_remaining":"0","route_to":" ","status":"Checked out","tcn":"PIN01000311 ","title":"The robber barons : the great American capitalists, 1861-1901","xact_finish":""},
- {"uses":"undefined","alert_message":"","author":"Payne, Emmy","barcode":"33034001434539","call_number":"EJ PAYNE","checkin_time":" ","checkin_time_full":"","xact_start":"2006-08-23","xact_start_full":"2006-08-23T14:36:54-0400","circ_as_type":"","circ_id":"19904","circ_lib":"SHRL-RM","circ_modifier":"","circulate":"Yes","acp_id":"6165596","copy_number":"1","create_date":"2006-04-28","edit_date":"2006-08-23","deleted":"No","deposit_amount":"0.00","deposit":"No","mvr_doc_id":"1220497","due_date":"2006-09-06","edition":"Reinforced ed.","fine_level":"Low","stop_fines":"","stop_fines_time":"","holdable":"Yes","isbn":"075872926X (BWI bdg.)","loan_duration":"Short","location":"Adult","message":" ","opac_visible":"Yes","owning_lib":"SHRL-RM","price":"0.00","pubdate":"1944","publisher":"Houghton Mifflin","ref":"No","renewal_remaining":"0","route_to":" ","status":"Checked out","tcn":"PIN01000377 ","title":"Katy no-pocket ","xact_finish":""},
- {"uses":"undefined","alert_message":"","author":"Ames, Leslie","barcode":"31039000791757","call_number":"AF AME","checkin_time":" ","checkin_time_full":"","xact_start":"2006-08-23","xact_start_full":"2006-08-23T14:37:07-0400","circ_as_type":"","circ_id":"19906","circ_lib":"ORLS-TEL","circ_modifier":"","circulate":"Yes","acp_id":"28","copy_number":"1","create_date":"2006-04-28","edit_date":"2006-08-23","deleted":"No","deposit_amount":"0.00","deposit":"No","mvr_doc_id":"8","due_date":"2006-09-06","edition":"","fine_level":"Low","stop_fines":"","stop_fines_time":"","holdable":"Yes","isbn":"","loan_duration":"Short","location":"Adult","message":" ","opac_visible":"Yes","owning_lib":"ORLS-TEL","price":"5.95","pubdate":"","publisher":"Lenox Hill","ref":"No","renewal_remaining":"0","route_to":" ","status":"Checked out","tcn":"PIN01000009 ","title":"King's Castle ","xact_finish":""},
- {"uses":"undefined","alert_message":"","author":"Payne, Emmy","barcode":"33034001434539","call_number":"EJ PAYNE","checkin_time":" ","checkin_time_full":"","xact_start":"2006-08-23","xact_start_full":"2006-08-23T14:36:54-0400","circ_as_type":"","circ_id":"19903","circ_lib":"SHRL-RM","circ_modifier":"","circulate":"Yes","acp_id":"6165596","copy_number":"1","create_date":"2006-04-28","edit_date":"2006-08-23","deleted":"No","deposit_amount":"0.00","deposit":"No","mvr_doc_id":"1220497","due_date":"2006-09-06","edition":"Reinforced ed.","fine_level":"Low","stop_fines":"","stop_fines_time":"","holdable":"Yes","isbn":"075872926X (BWI bdg.)","loan_duration":"Short","location":"Adult","message":" ","opac_visible":"Yes","owning_lib":"SHRL-RM","price":"0.00","pubdate":"1944","publisher":"Houghton Mifflin","ref":"No","renewal_remaining":"0","route_to":" ","status":"Checked out","tcn":"PIN01000377 ","title":"Katy no-pocket ","xact_finish":""}],
- 'holds' : [{"author":"Wells, H. G. ","available_time":"2006-08-03","available_timestamp":"2006-08-03T15:14:53-0400","capture_time":"2006-08-03","capture_timestamp":"2006-08-03T15:14:53-0400","current_copy":"33207003884402","edition":"","email_notify":"No","expire_time":"","fulfillment_time":"","id":"57","holdable_formats":"","isbn":"0192828266 :","notify_time":"","notify_count":"0","patron_name":"23500000023053 Stompro, Josh","phone_notify":"218-233-3757","pickup_lib_shortname":"ARL-ATH","pickup_lib":"Athens-Clarke County Library","prev_check_time":"2006-08-02T16:15:11-0400","pubdate":"1995","publisher":"Oxford University Press","request_time":"2006-05-20","request_timestamp":"2006-05-20","requestor":"1000000","selection_depth":"0","status":"Ready for pickup","tcn":"PIN03002240 ","target":"131469","title":"The war of the worlds","transit_dest_recv_time":"","transit_dest_lib":"","transit_source":"","transit_source_send_time":"","hold_type":"T","usr":"1000567"},
- {"author":"Kramer, Kathryn.","available_time":"2006-08-03","available_timestamp":"2006-08-03T15:32:58-0400","capture_time":"2006-08-03","capture_timestamp":"2006-08-03T15:32:58-0400","current_copy":"33207004030757","edition":"1st ed.","email_notify":"No","expire_time":"","fulfillment_time":"","id":"470","holdable_formats":"","isbn":"0375400834","notify_time":"2006-08-24T15:12:30-0400","notify_count":"1","patron_name":"21034000217210 Jenkins, George","phone_notify":"229-985-3464","pickup_lib_shortname":"ARL-ATH","pickup_lib":"Athens-Clarke County Library","prev_check_time":"2006-08-03T12:15:03-0400","pubdate":"1998","publisher":"Knopf","request_time":"2006-07-28","request_timestamp":"2006-07-28","requestor":"3","selection_depth":"0","status":"Ready for pickup","tcn":"PIN03053147 ","target":"313678","title":"Sweet water ","transit_dest_recv_time":"","transit_dest_lib":"","transit_source":"","transit_source_send_time":"","hold_type":"T","usr":"1001151"},
- {"author":"Silva, Daniel","available_time":"2006-08-03","available_timestamp":"2006-08-03T15:39:35-0400","capture_time":"2006-08-03","capture_timestamp":"2006-08-03T15:39:35-0400","current_copy":"33207004323517","edition":"1st ed.","email_notify":"No","expire_time":"","fulfillment_time":"","id":"448","holdable_formats":"","isbn":"0375500898 (alk. paper)","notify_time":"","notify_count":"0","patron_name":"21099000002755 Broome, Sandra","phone_notify":"706-236-4632","pickup_lib_shortname":"ARL-ATH","pickup_lib":"Athens-Clarke County Library","prev_check_time":"2006-08-02T17:16:39-0400","pubdate":"c1999","publisher":"Random House","request_time":"2006-07-27","request_timestamp":"2006-07-27","requestor":"1000001","selection_depth":"0","status":"Ready for pickup","tcn":"ocm40444117 ","target":"77772","title":"The marching season : a novel","transit_dest_recv_time":"","transit_dest_lib":"","transit_source":"","transit_source_send_time":"","hold_type":"T","usr":"1000846"},
- {"author":"Seuss","available_time":"2006-08-13","available_timestamp":"2006-08-13T20:55:02-0400","capture_time":"2006-08-13","capture_timestamp":"2006-08-13T20:55:02-0400","current_copy":"20070805","edition":"","email_notify":"No","expire_time":"","fulfillment_time":"","id":"1697","holdable_formats":"","isbn":"039480001X :","notify_time":"","notify_count":"0","patron_name":"4545 Tripper, Jack","phone_notify":"444-333-2222","pickup_lib_shortname":"ARL-ATH","pickup_lib":"Athens-Clarke County Library","prev_check_time":"2006-08-13T20:45:09-0400","pubdate":"1992, c1957","publisher":"Seedlings Braille Books for Children","request_time":"2006-08-13","request_timestamp":"2006-08-13","requestor":"1000000","selection_depth":"0","status":"Ready for pickup","tcn":"ocm47673093 ","target":"1534993","title":"The cat in the hat","transit_dest_recv_time":"","transit_dest_lib":"","transit_source":"","transit_source_send_time":"","hold_type":"T","usr":"1002261"},
- {"author":"Potter, Sally.","available_time":"2006-08-09","available_timestamp":"2006-08-09T18:06:10-0400","capture_time":"2006-08-09","capture_timestamp":"2006-08-09T18:06:10-0400","current_copy":"31001000843129","edition":"","email_notify":"No","expire_time":"","fulfillment_time":"","id":"1004","holdable_formats":"","isbn":"0783262663","notify_time":"2006-08-10T15:24:46-0400","notify_count":"12","patron_name":"2222233333 Erickson, Bill","phone_notify":"999-999-9999","pickup_lib_shortname":"ARL-ATH","pickup_lib":"Athens-Clarke County Library","prev_check_time":"2006-08-09T12:15:27-0400","pubdate":"c2001","publisher":"Universal Studios","request_time":"2006-08-08","request_timestamp":"2006-08-08","requestor":"3","selection_depth":"0","status":"Ready for pickup","tcn":"ocm48683123 ","target":"1572303","title":"The man who cried","transit_dest_recv_time":"","transit_dest_lib":"","transit_source":"","transit_source_send_time":"","hold_type":"T","usr":"3"}],
- 'bills' : [{"balance_owed":"-5.00","xact_finish":"2006-05-08","xact_start":"2006-05-08","id":"9","last_billing_ts":"2006-05-08 18:53","last_billing_note":"test","last_billing_type":"Miscellaneous charges","last_payment_ts":"2006-05-08 18:53","last_payment_note":"","last_payment_type":"cash_payment","total_owed":"0.00","total_paid":"5.00","xact_type":"grocery","usr":"Id = 1000502"},
- {"balance_owed":"-5.00","xact_finish":"2006-05-08","xact_start":"2006-05-08","id":"11","last_billing_ts":"2006-05-08 19:11","last_billing_note":"test","last_billing_type":"Miscellaneous","last_payment_ts":"2006-05-08 19:12","last_payment_note":"","last_payment_type":"cash_payment","total_owed":"0.00","total_paid":"5.00","xact_type":"grocery","usr":"Id = 1000502"},
- {"balance_owed":"-50.00","xact_finish":"2006-05-08","xact_start":"2006-05-08","id":"18","last_billing_ts":"2006-05-08 20:20","last_billing_note":"","last_billing_type":"Miscellaneous","last_payment_ts":"2006-05-08 21:27","last_payment_note":"","last_payment_type":"cash_payment","total_owed":"0.00","total_paid":"50.00","xact_type":"grocery","usr":"Id = 1000502"},
- {"balance_owed":"1.00","xact_finish":"2006-06-14","xact_start":"2006-06-14","id":"451","last_billing_ts":"2006-06-14 16:49","last_billing_note":"SYSTEM GENERATED","last_billing_type":"Lost Materials","last_payment_ts":"2006-06-14 16:49","last_payment_note":"","last_payment_type":"cash_payment","total_owed":"6.00","total_paid":"5.00","xact_type":"circulation","usr":"Id = 1000502"},
- {"balance_owed":"-1.00","xact_finish":"2006-06-17","xact_start":"2006-06-17","id":"3689","last_billing_ts":"2006-06-17 04:01","last_billing_note":"","last_billing_type":"Miscellaneous","last_payment_ts":"2006-06-17 18:51","last_payment_note":"","last_payment_type":"cash_payment","total_owed":"10.00","total_paid":"11.00","xact_type":"grocery","usr":"Id = 1000502"},
- {"balance_owed":".66","xact_finish":"","xact_start":"2006-06-27","id":"5589","last_billing_ts":"2006-08-22 00:00","last_billing_note":"Overdue Fine","last_billing_type":"Overdue materials","last_payment_ts":"2006-09-04 17:31","last_payment_note":"","last_payment_type":"cash_payment","total_owed":"5.60","total_paid":"4.94","xact_type":"circulation","usr":"Id = 1000502"},
- {"balance_owed":".70","xact_finish":"","xact_start":"2006-06-27","id":"5593","last_billing_ts":"2006-08-22 00:00","last_billing_note":"Overdue Fine","last_billing_type":"Overdue materials","last_payment_ts":"2006-08-16 11:01","last_payment_note":"","last_payment_type":"cash_payment","total_owed":"5.50","total_paid":"4.80","xact_type":"circulation","usr":"Id = 1000502"},
- {"balance_owed":"5.00","xact_finish":"","xact_start":"2006-08-16","id":"14834","last_billing_ts":"2006-08-16 12:25","last_billing_note":"","last_billing_type":"Damaged material","last_payment_ts":"","last_payment_note":"","last_payment_type":"","total_owed":"5.00","total_paid":"0.00","xact_type":"grocery","usr":"Id = 1000502"},
- {"balance_owed":"10.00","xact_finish":"","xact_start":"2006-08-16","id":"14858","last_billing_ts":"2006-08-16 12:34","last_billing_note":"","last_billing_type":"Damaged material","last_payment_ts":"","last_payment_note":"","last_payment_type":"","total_owed":"10.00","total_paid":"0.00","xact_type":"grocery","usr":"Id = 1000502"}],
- 'payment' : [{"bill_id":5559,"payment":"-0.04","last_billing_type":"Overdue materials","last_billing_note":"Overdue Fine","title":"Hali Bote Azikaban de tao fan","barcode":"a16"},{"bill_id":5589,"payment":"0.04","last_billing_type":"Overdue materials","last_billing_note":"Overdue Fine","title":"Hali Bote Azikaban de tao fan","barcode":"a47"}],
- 'patrons' : [],
- 'transits' : [{"transit_item_author":"Arvetis, Chris.","transit_item_barcode":"3947801748348","transit_item_callnumber":"JE ARV","transit_item_title":"Why do birds sing?","transit_target_copy":"2385751","transit_dest_lib":"PIED-WIN","transit_id":"25","transit_source":"ARL-ATH","transit_source_send_time":"2006-05-24T16:37:09-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
- {"transit_item_author":"Pine, Tillie S.","transit_item_barcode":"3635300990762","transit_item_callnumber":"F","transit_item_title":"Water all around ","transit_target_copy":"1","transit_dest_lib":"URRLS-SC","transit_id":"26","transit_source":"ARL-ATH","transit_source_send_time":"2006-05-27T22:49:40-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
- {"transit_item_author":"","transit_item_barcode":"31057000861941","transit_item_callnumber":"CD J 781.5246 CASPE","transit_item_title":"Casper's spookiest songs and sounds 10 spooky songs plus creepy sound effects","transit_target_copy":"7923932","transit_dest_lib":"WGRL-LS","transit_id":"98","transit_source":"ARL-ATH","transit_source_send_time":"2006-06-29T16:34:38-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
- {"transit_item_author":"Davidson, MaryJanice.","transit_item_barcode":"31027005649112","transit_item_callnumber":"AC DAV","transit_item_title":"Undead and unreturnable ","transit_target_copy":"7924995","transit_dest_lib":"HCLS-LG","transit_id":"100","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-07T16:02:32-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
- {"transit_item_author":"Evanovich, Janet.","transit_item_barcode":"31001001097295","transit_item_callnumber":"813/.54","transit_item_title":"Two for the dough","transit_target_copy":"8000335","transit_dest_lib":"ARL-BOG","transit_id":"102","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-11T12:12:11-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
- {"transit_item_author":"Edwards, Anne","transit_item_barcode":"39021423853564","transit_item_callnumber":"780.92 STREISAND","transit_item_title":"Streisand a biography","transit_target_copy":"949781","transit_dest_lib":"ECGR-BKM","transit_id":"110","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-14T10:00:01-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
- {"transit_item_author":"Riese, Randall.","transit_item_barcode":"31025900460205","transit_item_callnumber":"921 STREISAND 1993","transit_item_title":"Her name is Barbra an intimate portrait of the real Barbra Streisand","transit_target_copy":"2210566","transit_dest_lib":"HALL-BPL","transit_id":"112","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-14T10:01:39-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
- {"transit_item_author":"Rowling, J. K.","transit_item_barcode":"a45","transit_item_callnumber":"JROWLING2","transit_item_title":"Hali Bote Azikaban de tao fan","transit_target_copy":"8000297","transit_dest_lib":"WGRL-LS","transit_id":"118","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-19T13:52:38-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
- {"transit_item_author":"Some Author","transit_item_barcode":"321","transit_item_callnumber":"UNCATALOGED","transit_item_title":"Big Book","transit_target_copy":"8000387","transit_dest_lib":"ROCK-NG","transit_id":"119","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-19T13:58:21-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
- {"transit_item_author":"Thomas, Joyce Carol.","transit_item_barcode":"31036000522216","transit_item_callnumber":"E THOMAS","transit_item_title":"The gospel Cinderella","transit_target_copy":"7422951","transit_dest_lib":"NCLS-COVTN","transit_id":"200","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-25T15:20:00-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
- {"transit_item_author":"Robinson, Barbara","transit_item_barcode":"31036000545159","transit_item_callnumber":"J ROBINSON","transit_item_title":"The best Halloween ever","transit_target_copy":"7487432","transit_dest_lib":"NCLS-COVTN","transit_id":"206","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-25T15:25:44-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
- {"transit_item_author":"Robinson, Barbara","transit_item_barcode":"31036000545142","transit_item_callnumber":"J ROBINSON","transit_item_title":"The best Halloween ever","transit_target_copy":"7487431","transit_dest_lib":"NCLS-COVTN","transit_id":"207","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-25T15:25:49-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
- {"transit_item_author":"Grafton, Sue.","transit_item_barcode":"31036000527900","transit_item_callnumber":"F GRAFTON","transit_item_title":"\"H\" is for homicide","transit_target_copy":"7273824","transit_dest_lib":"NCLS-COVTN","transit_id":"208","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-25T15:25:58-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
- {"transit_item_author":"Beaumont, Karen.","transit_item_barcode":"31036000521853","transit_item_callnumber":"E BEAUMONT","transit_item_title":"I like myself!","transit_target_copy":"7387328","transit_dest_lib":"NCLS-COVTN","transit_id":"211","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-25T15:26:08-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
- {"transit_item_author":"Sandler, Martin W.","transit_item_barcode":"31036000522612","transit_item_callnumber":"J 388.42 SANDLER","transit_item_title":"Straphanging in the USA trolleys and subways in American life","transit_target_copy":"7360328","transit_dest_lib":"NCLS-COVTN","transit_id":"212","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-25T15:35:17-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
- {"transit_item_author":"Bohjalian, Christopher A.","transit_item_barcode":"31036000538303","transit_item_callnumber":"F BOHJALIAN","transit_item_title":"Before you know kindness : a novel","transit_target_copy":"7544549","transit_dest_lib":"NCLS-COVTN","transit_id":"218","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-26T10:23:20-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},],
- 'offline_checkout' : [],
- 'offline_checkin' : [],
- 'offline_renew' : [],
- 'offline_inhouse_use' : []
- }
+ this.test_list = {
+
+ 'items' : [
+ {"uses":"undefined","alert_message":"","author":"Annixter, Jane.","barcode":"3635300990263","call_number":"F","checkin_time":" ","checkin_time_full":"","xact_start":"2006-08-23","xact_start_full":"2006-08-23T14:37:15-0400","circ_as_type":"","circ_id":"19907","circ_lib":"URRLS-SC","circ_modifier":"","circulate":"Yes","acp_id":"34","copy_number":"1","create_date":"2006-04-28","edit_date":"2006-08-23","deleted":"No","deposit_amount":"0.00","deposit":"No","mvr_doc_id":"13","due_date":"2006-08-23","edition":"","fine_level":"Low","stop_fines":"","stop_fines_time":"","holdable":"Yes","isbn":"","loan_duration":"Short","location":"Adult","message":" ","opac_visible":"Yes","owning_lib":"URRLS-SC","price":"10.00","pubdate":"1961","publisher":"Longmans","ref":"No","renewal_remaining":"0","route_to":" ","status":"Checked out","tcn":"PIN01000015 ","title":"Peace comes to Castle Oak ","xact_finish":""},
+ {"uses":"undefined","alert_message":"","author":"Josephson, Matthew","barcode":"33207002163014","call_number":"NONFIC 330.922 JOSEPHSO","checkin_time":" ","checkin_time_full":"","xact_start":"2006-08-23","xact_start_full":"2006-08-23T14:37:23-0400","circ_as_type":"","circ_id":"19908","circ_lib":"ARL-ATH","circ_modifier":"","circulate":"Yes","acp_id":"1658","copy_number":"1","create_date":"2006-04-28","edit_date":"2006-08-23","deleted":"No","deposit_amount":"0.00","deposit":"No","mvr_doc_id":"250","due_date":"2006-09-06","edition":"","fine_level":"Low","stop_fines":"","stop_fines_time":"","holdable":"Yes","isbn":"","loan_duration":"Short","location":"Adult","message":" ","opac_visible":"Yes","owning_lib":"ARL-ATH","price":"10.95","pubdate":"[c1934]","publisher":"Harcourt, Brace and company","ref":"No","renewal_remaining":"0","route_to":" ","status":"Checked out","tcn":"PIN01000311 ","title":"The robber barons : the great American capitalists, 1861-1901","xact_finish":""},
+ {"uses":"undefined","alert_message":"","author":"Payne, Emmy","barcode":"33034001434539","call_number":"EJ PAYNE","checkin_time":" ","checkin_time_full":"","xact_start":"2006-08-23","xact_start_full":"2006-08-23T14:36:54-0400","circ_as_type":"","circ_id":"19904","circ_lib":"SHRL-RM","circ_modifier":"","circulate":"Yes","acp_id":"6165596","copy_number":"1","create_date":"2006-04-28","edit_date":"2006-08-23","deleted":"No","deposit_amount":"0.00","deposit":"No","mvr_doc_id":"1220497","due_date":"2006-09-06","edition":"Reinforced ed.","fine_level":"Low","stop_fines":"","stop_fines_time":"","holdable":"Yes","isbn":"075872926X (BWI bdg.)","loan_duration":"Short","location":"Adult","message":" ","opac_visible":"Yes","owning_lib":"SHRL-RM","price":"0.00","pubdate":"1944","publisher":"Houghton Mifflin","ref":"No","renewal_remaining":"0","route_to":" ","status":"Checked out","tcn":"PIN01000377 ","title":"Katy no-pocket ","xact_finish":""},
+ {"uses":"undefined","alert_message":"","author":"Ames, Leslie","barcode":"31039000791757","call_number":"AF AME","checkin_time":" ","checkin_time_full":"","xact_start":"2006-08-23","xact_start_full":"2006-08-23T14:37:07-0400","circ_as_type":"","circ_id":"19906","circ_lib":"ORLS-TEL","circ_modifier":"","circulate":"Yes","acp_id":"28","copy_number":"1","create_date":"2006-04-28","edit_date":"2006-08-23","deleted":"No","deposit_amount":"0.00","deposit":"No","mvr_doc_id":"8","due_date":"2006-09-06","edition":"","fine_level":"Low","stop_fines":"","stop_fines_time":"","holdable":"Yes","isbn":"","loan_duration":"Short","location":"Adult","message":" ","opac_visible":"Yes","owning_lib":"ORLS-TEL","price":"5.95","pubdate":"","publisher":"Lenox Hill","ref":"No","renewal_remaining":"0","route_to":" ","status":"Checked out","tcn":"PIN01000009 ","title":"King's Castle ","xact_finish":""},
+ {"uses":"undefined","alert_message":"","author":"Payne, Emmy","barcode":"33034001434539","call_number":"EJ PAYNE","checkin_time":" ","checkin_time_full":"","xact_start":"2006-08-23","xact_start_full":"2006-08-23T14:36:54-0400","circ_as_type":"","circ_id":"19903","circ_lib":"SHRL-RM","circ_modifier":"","circulate":"Yes","acp_id":"6165596","copy_number":"1","create_date":"2006-04-28","edit_date":"2006-08-23","deleted":"No","deposit_amount":"0.00","deposit":"No","mvr_doc_id":"1220497","due_date":"2006-09-06","edition":"Reinforced ed.","fine_level":"Low","stop_fines":"","stop_fines_time":"","holdable":"Yes","isbn":"075872926X (BWI bdg.)","loan_duration":"Short","location":"Adult","message":" ","opac_visible":"Yes","owning_lib":"SHRL-RM","price":"0.00","pubdate":"1944","publisher":"Houghton Mifflin","ref":"No","renewal_remaining":"0","route_to":" ","status":"Checked out","tcn":"PIN01000377 ","title":"Katy no-pocket ","xact_finish":""}],
+ 'holds' : [{"author":"Wells, H. G. ","available_time":"2006-08-03","available_timestamp":"2006-08-03T15:14:53-0400","capture_time":"2006-08-03","capture_timestamp":"2006-08-03T15:14:53-0400","current_copy":"33207003884402","edition":"","email_notify":"No","expire_time":"","fulfillment_time":"","id":"57","holdable_formats":"","isbn":"0192828266 :","notify_time":"","notify_count":"0","patron_name":"23500000023053 Stompro, Josh","phone_notify":"218-233-3757","pickup_lib_shortname":"ARL-ATH","pickup_lib":"Athens-Clarke County Library","prev_check_time":"2006-08-02T16:15:11-0400","pubdate":"1995","publisher":"Oxford University Press","request_time":"2006-05-20","request_timestamp":"2006-05-20","requestor":"1000000","selection_depth":"0","status":"Ready for pickup","tcn":"PIN03002240 ","target":"131469","title":"The war of the worlds","transit_dest_recv_time":"","transit_dest_lib":"","transit_source":"","transit_source_send_time":"","hold_type":"T","usr":"1000567"},
+ {"author":"Kramer, Kathryn.","available_time":"2006-08-03","available_timestamp":"2006-08-03T15:32:58-0400","capture_time":"2006-08-03","capture_timestamp":"2006-08-03T15:32:58-0400","current_copy":"33207004030757","edition":"1st ed.","email_notify":"No","expire_time":"","fulfillment_time":"","id":"470","holdable_formats":"","isbn":"0375400834","notify_time":"2006-08-24T15:12:30-0400","notify_count":"1","patron_name":"21034000217210 Jenkins, George","phone_notify":"229-985-3464","pickup_lib_shortname":"ARL-ATH","pickup_lib":"Athens-Clarke County Library","prev_check_time":"2006-08-03T12:15:03-0400","pubdate":"1998","publisher":"Knopf","request_time":"2006-07-28","request_timestamp":"2006-07-28","requestor":"3","selection_depth":"0","status":"Ready for pickup","tcn":"PIN03053147 ","target":"313678","title":"Sweet water ","transit_dest_recv_time":"","transit_dest_lib":"","transit_source":"","transit_source_send_time":"","hold_type":"T","usr":"1001151"},
+ {"author":"Silva, Daniel","available_time":"2006-08-03","available_timestamp":"2006-08-03T15:39:35-0400","capture_time":"2006-08-03","capture_timestamp":"2006-08-03T15:39:35-0400","current_copy":"33207004323517","edition":"1st ed.","email_notify":"No","expire_time":"","fulfillment_time":"","id":"448","holdable_formats":"","isbn":"0375500898 (alk. paper)","notify_time":"","notify_count":"0","patron_name":"21099000002755 Broome, Sandra","phone_notify":"706-236-4632","pickup_lib_shortname":"ARL-ATH","pickup_lib":"Athens-Clarke County Library","prev_check_time":"2006-08-02T17:16:39-0400","pubdate":"c1999","publisher":"Random House","request_time":"2006-07-27","request_timestamp":"2006-07-27","requestor":"1000001","selection_depth":"0","status":"Ready for pickup","tcn":"ocm40444117 ","target":"77772","title":"The marching season : a novel","transit_dest_recv_time":"","transit_dest_lib":"","transit_source":"","transit_source_send_time":"","hold_type":"T","usr":"1000846"},
+ {"author":"Seuss","available_time":"2006-08-13","available_timestamp":"2006-08-13T20:55:02-0400","capture_time":"2006-08-13","capture_timestamp":"2006-08-13T20:55:02-0400","current_copy":"20070805","edition":"","email_notify":"No","expire_time":"","fulfillment_time":"","id":"1697","holdable_formats":"","isbn":"039480001X :","notify_time":"","notify_count":"0","patron_name":"4545 Tripper, Jack","phone_notify":"444-333-2222","pickup_lib_shortname":"ARL-ATH","pickup_lib":"Athens-Clarke County Library","prev_check_time":"2006-08-13T20:45:09-0400","pubdate":"1992, c1957","publisher":"Seedlings Braille Books for Children","request_time":"2006-08-13","request_timestamp":"2006-08-13","requestor":"1000000","selection_depth":"0","status":"Ready for pickup","tcn":"ocm47673093 ","target":"1534993","title":"The cat in the hat","transit_dest_recv_time":"","transit_dest_lib":"","transit_source":"","transit_source_send_time":"","hold_type":"T","usr":"1002261"},
+ {"author":"Potter, Sally.","available_time":"2006-08-09","available_timestamp":"2006-08-09T18:06:10-0400","capture_time":"2006-08-09","capture_timestamp":"2006-08-09T18:06:10-0400","current_copy":"31001000843129","edition":"","email_notify":"No","expire_time":"","fulfillment_time":"","id":"1004","holdable_formats":"","isbn":"0783262663","notify_time":"2006-08-10T15:24:46-0400","notify_count":"12","patron_name":"2222233333 Erickson, Bill","phone_notify":"999-999-9999","pickup_lib_shortname":"ARL-ATH","pickup_lib":"Athens-Clarke County Library","prev_check_time":"2006-08-09T12:15:27-0400","pubdate":"c2001","publisher":"Universal Studios","request_time":"2006-08-08","request_timestamp":"2006-08-08","requestor":"3","selection_depth":"0","status":"Ready for pickup","tcn":"ocm48683123 ","target":"1572303","title":"The man who cried","transit_dest_recv_time":"","transit_dest_lib":"","transit_source":"","transit_source_send_time":"","hold_type":"T","usr":"3"}],
+ 'bills' : [{"balance_owed":"-5.00","xact_finish":"2006-05-08","xact_start":"2006-05-08","id":"9","last_billing_ts":"2006-05-08 18:53","last_billing_note":"test","last_billing_type":"Miscellaneous charges","last_payment_ts":"2006-05-08 18:53","last_payment_note":"","last_payment_type":"cash_payment","total_owed":"0.00","total_paid":"5.00","xact_type":"grocery","usr":"Id = 1000502"},
+ {"balance_owed":"-5.00","xact_finish":"2006-05-08","xact_start":"2006-05-08","id":"11","last_billing_ts":"2006-05-08 19:11","last_billing_note":"test","last_billing_type":"Miscellaneous","last_payment_ts":"2006-05-08 19:12","last_payment_note":"","last_payment_type":"cash_payment","total_owed":"0.00","total_paid":"5.00","xact_type":"grocery","usr":"Id = 1000502"},
+ {"balance_owed":"-50.00","xact_finish":"2006-05-08","xact_start":"2006-05-08","id":"18","last_billing_ts":"2006-05-08 20:20","last_billing_note":"","last_billing_type":"Miscellaneous","last_payment_ts":"2006-05-08 21:27","last_payment_note":"","last_payment_type":"cash_payment","total_owed":"0.00","total_paid":"50.00","xact_type":"grocery","usr":"Id = 1000502"},
+ {"balance_owed":"1.00","xact_finish":"2006-06-14","xact_start":"2006-06-14","id":"451","last_billing_ts":"2006-06-14 16:49","last_billing_note":"SYSTEM GENERATED","last_billing_type":"Lost Materials","last_payment_ts":"2006-06-14 16:49","last_payment_note":"","last_payment_type":"cash_payment","total_owed":"6.00","total_paid":"5.00","xact_type":"circulation","usr":"Id = 1000502"},
+ {"balance_owed":"-1.00","xact_finish":"2006-06-17","xact_start":"2006-06-17","id":"3689","last_billing_ts":"2006-06-17 04:01","last_billing_note":"","last_billing_type":"Miscellaneous","last_payment_ts":"2006-06-17 18:51","last_payment_note":"","last_payment_type":"cash_payment","total_owed":"10.00","total_paid":"11.00","xact_type":"grocery","usr":"Id = 1000502"},
+ {"balance_owed":".66","xact_finish":"","xact_start":"2006-06-27","id":"5589","last_billing_ts":"2006-08-22 00:00","last_billing_note":"Overdue Fine","last_billing_type":"Overdue materials","last_payment_ts":"2006-09-04 17:31","last_payment_note":"","last_payment_type":"cash_payment","total_owed":"5.60","total_paid":"4.94","xact_type":"circulation","usr":"Id = 1000502"},
+ {"balance_owed":".70","xact_finish":"","xact_start":"2006-06-27","id":"5593","last_billing_ts":"2006-08-22 00:00","last_billing_note":"Overdue Fine","last_billing_type":"Overdue materials","last_payment_ts":"2006-08-16 11:01","last_payment_note":"","last_payment_type":"cash_payment","total_owed":"5.50","total_paid":"4.80","xact_type":"circulation","usr":"Id = 1000502"},
+ {"balance_owed":"5.00","xact_finish":"","xact_start":"2006-08-16","id":"14834","last_billing_ts":"2006-08-16 12:25","last_billing_note":"","last_billing_type":"Damaged material","last_payment_ts":"","last_payment_note":"","last_payment_type":"","total_owed":"5.00","total_paid":"0.00","xact_type":"grocery","usr":"Id = 1000502"},
+ {"balance_owed":"10.00","xact_finish":"","xact_start":"2006-08-16","id":"14858","last_billing_ts":"2006-08-16 12:34","last_billing_note":"","last_billing_type":"Damaged material","last_payment_ts":"","last_payment_note":"","last_payment_type":"","total_owed":"10.00","total_paid":"0.00","xact_type":"grocery","usr":"Id = 1000502"}],
+ 'payment' : [{"bill_id":5559,"payment":"-0.04","last_billing_type":"Overdue materials","last_billing_note":"Overdue Fine","title":"Hali Bote Azikaban de tao fan","barcode":"a16"},{"bill_id":5589,"payment":"0.04","last_billing_type":"Overdue materials","last_billing_note":"Overdue Fine","title":"Hali Bote Azikaban de tao fan","barcode":"a47"}],
+ 'patrons' : [],
+ 'transits' : [{"transit_item_author":"Arvetis, Chris.","transit_item_barcode":"3947801748348","transit_item_callnumber":"JE ARV","transit_item_title":"Why do birds sing?","transit_target_copy":"2385751","transit_dest_lib":"PIED-WIN","transit_id":"25","transit_source":"ARL-ATH","transit_source_send_time":"2006-05-24T16:37:09-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
+ {"transit_item_author":"Pine, Tillie S.","transit_item_barcode":"3635300990762","transit_item_callnumber":"F","transit_item_title":"Water all around ","transit_target_copy":"1","transit_dest_lib":"URRLS-SC","transit_id":"26","transit_source":"ARL-ATH","transit_source_send_time":"2006-05-27T22:49:40-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
+ {"transit_item_author":"","transit_item_barcode":"31057000861941","transit_item_callnumber":"CD J 781.5246 CASPE","transit_item_title":"Casper's spookiest songs and sounds 10 spooky songs plus creepy sound effects","transit_target_copy":"7923932","transit_dest_lib":"WGRL-LS","transit_id":"98","transit_source":"ARL-ATH","transit_source_send_time":"2006-06-29T16:34:38-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
+ {"transit_item_author":"Davidson, MaryJanice.","transit_item_barcode":"31027005649112","transit_item_callnumber":"AC DAV","transit_item_title":"Undead and unreturnable ","transit_target_copy":"7924995","transit_dest_lib":"HCLS-LG","transit_id":"100","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-07T16:02:32-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
+ {"transit_item_author":"Evanovich, Janet.","transit_item_barcode":"31001001097295","transit_item_callnumber":"813/.54","transit_item_title":"Two for the dough","transit_target_copy":"8000335","transit_dest_lib":"ARL-BOG","transit_id":"102","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-11T12:12:11-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
+ {"transit_item_author":"Edwards, Anne","transit_item_barcode":"39021423853564","transit_item_callnumber":"780.92 STREISAND","transit_item_title":"Streisand a biography","transit_target_copy":"949781","transit_dest_lib":"ECGR-BKM","transit_id":"110","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-14T10:00:01-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
+ {"transit_item_author":"Riese, Randall.","transit_item_barcode":"31025900460205","transit_item_callnumber":"921 STREISAND 1993","transit_item_title":"Her name is Barbra an intimate portrait of the real Barbra Streisand","transit_target_copy":"2210566","transit_dest_lib":"HALL-BPL","transit_id":"112","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-14T10:01:39-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
+ {"transit_item_author":"Rowling, J. K.","transit_item_barcode":"a45","transit_item_callnumber":"JROWLING2","transit_item_title":"Hali Bote Azikaban de tao fan","transit_target_copy":"8000297","transit_dest_lib":"WGRL-LS","transit_id":"118","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-19T13:52:38-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
+ {"transit_item_author":"Some Author","transit_item_barcode":"321","transit_item_callnumber":"UNCATALOGED","transit_item_title":"Big Book","transit_target_copy":"8000387","transit_dest_lib":"ROCK-NG","transit_id":"119","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-19T13:58:21-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
+ {"transit_item_author":"Thomas, Joyce Carol.","transit_item_barcode":"31036000522216","transit_item_callnumber":"E THOMAS","transit_item_title":"The gospel Cinderella","transit_target_copy":"7422951","transit_dest_lib":"NCLS-COVTN","transit_id":"200","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-25T15:20:00-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
+ {"transit_item_author":"Robinson, Barbara","transit_item_barcode":"31036000545159","transit_item_callnumber":"J ROBINSON","transit_item_title":"The best Halloween ever","transit_target_copy":"7487432","transit_dest_lib":"NCLS-COVTN","transit_id":"206","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-25T15:25:44-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
+ {"transit_item_author":"Robinson, Barbara","transit_item_barcode":"31036000545142","transit_item_callnumber":"J ROBINSON","transit_item_title":"The best Halloween ever","transit_target_copy":"7487431","transit_dest_lib":"NCLS-COVTN","transit_id":"207","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-25T15:25:49-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
+ {"transit_item_author":"Grafton, Sue.","transit_item_barcode":"31036000527900","transit_item_callnumber":"F GRAFTON","transit_item_title":"\"H\" is for homicide","transit_target_copy":"7273824","transit_dest_lib":"NCLS-COVTN","transit_id":"208","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-25T15:25:58-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
+ {"transit_item_author":"Beaumont, Karen.","transit_item_barcode":"31036000521853","transit_item_callnumber":"E BEAUMONT","transit_item_title":"I like myself!","transit_target_copy":"7387328","transit_dest_lib":"NCLS-COVTN","transit_id":"211","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-25T15:26:08-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
+ {"transit_item_author":"Sandler, Martin W.","transit_item_barcode":"31036000522612","transit_item_callnumber":"J 388.42 SANDLER","transit_item_title":"Straphanging in the USA trolleys and subways in American life","transit_target_copy":"7360328","transit_dest_lib":"NCLS-COVTN","transit_id":"212","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-25T15:35:17-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},
+ {"transit_item_author":"Bohjalian, Christopher A.","transit_item_barcode":"31036000538303","transit_item_callnumber":"F BOHJALIAN","transit_item_title":"Before you know kindness : a novel","transit_target_copy":"7544549","transit_dest_lib":"NCLS-COVTN","transit_id":"218","transit_source":"ARL-ATH","transit_source_send_time":"2006-07-26T10:23:20-0400","capture_time":" ","capture_timestamp":" ","expire_time":" ","patron_name":"undefined undefined, undefined","request_time":" ","request_timestamp":" ","hold_type":" "},],
+ 'offline_checkout' : [],
+ 'offline_checkin' : [],
+ 'offline_renew' : [],
+ 'offline_inhouse_use' : []
+ }
- obj.controller_init();
- obj.controller.render(); obj.controller.view.template_name_menu.focus();
+ obj.controller_init();
+ obj.controller.render(); obj.controller.view.template_name_menu.focus();
- obj.post_init();
+ obj.post_init();
- } catch(E) {
- alert('init: ' + E);
- this.error.sdump('D_ERROR','print_list.init: ' + E + '\n');
- }
- },
+ } catch(E) {
+ alert('init: ' + E);
+ this.error.sdump('D_ERROR','print_list.init: ' + E + '\n');
+ }
+ },
- 'post_init' : function() {
- var obj = this;
- setTimeout(
- function() {
- var tmp = obj.data.print_list_templates[ obj.controller.view.template_name_menu.value ];
- obj.controller.view.template_type_menu.value = tmp.type;
- obj.controller.view.header.value = tmp.header;
- obj.controller.view.line_item.value = tmp.line_item;
- obj.controller.view.footer.value = tmp.footer;
- obj.preview();
- }, 0
- );
- },
+ 'post_init' : function() {
+ var obj = this;
+ setTimeout(
+ function() {
+ var tmp = obj.data.print_list_templates[ obj.controller.view.template_name_menu.value ];
+ obj.controller.view.template_type_menu.value = tmp.type;
+ obj.controller.view.header.value = tmp.header;
+ obj.controller.view.line_item.value = tmp.line_item;
+ obj.controller.view.footer.value = tmp.footer;
+ obj.preview();
+ }, 0
+ );
+ },
- 'controller_init' : function() {
- try {
- var obj = this;
- JSAN.use('util.controller'); obj.controller = new util.controller();
- obj.controller.init(
- {
- control_map : {
- 'sample' : [ ['command'], function() { } ],
- 'header' : [ ['change'], function() { obj.preview(); } ],
- 'line_item' : [ ['change'], function() { obj.preview(); } ],
- 'footer' : [ ['change'], function() { obj.preview(); } ],
- 'preview' : [
- ['command'],
- function() {
- obj.preview();
- }
- ],
- 'save' : [
- ['command'],
- function() {
- obj.save_template( obj.controller.view.template_name_menu.value );
- }
- ],
- 'export' : [
- ['command'],
- function() {
- obj.export_templates();
- }
- ],
- 'import' : [
- ['command'],
- function() {
- obj.import_templates();
- }
- ],
- 'default' : [
- ['command'],
- function() {
- obj.data.print_list_defaults();
- obj.post_init();
- }
- ],
- 'macros' : [
- ['command'],
- function() {
- try {
- JSAN.use('util.functional');
- var template_type = obj.controller.view.template_type_menu.value;
- var macros = [];
- switch(template_type) {
- case 'items':
- JSAN.use('circ.util');
- macros = util.functional.map_list(
- circ.util.columns( {} ),
- function(o) {
- return '%' + o.id + '%';
- }
- );
- break;
- case 'holds':
- JSAN.use('circ.util');
- macros = util.functional.map_list(
- circ.util.hold_columns( {} ),
- function(o) {
- return '%' + o.id + '%';
- }
- );
- break;
- case 'transits':
- JSAN.use('circ.util');
- macros = util.functional.map_list(
- circ.util.transit_columns( {} ),
- function(o) {
- return '%' + o.id + '%';
- }
- );
- break;
- case 'offline_checkout':
- JSAN.use('circ.util');
- macros = util.functional.map_list(
- circ.util.offline_checkout_columns( {} ),
- function(o) {
- return '%' + o.id + '%';
- }
- );
- break;
- case 'offline_checkin':
- JSAN.use('circ.util');
- macros = util.functional.map_list(
- circ.util.offline_checkin_columns( {} ),
- function(o) {
- return '%' + o.id + '%';
- }
- );
- break;
- case 'offline_renew':
- JSAN.use('circ.util');
- macros = util.functional.map_list(
- circ.util.offline_renew_columns( {} ),
- function(o) {
- return '%' + o.id + '%';
- }
- );
- break;
+ 'controller_init' : function() {
+ try {
+ var obj = this;
+ JSAN.use('util.controller'); obj.controller = new util.controller();
+ obj.controller.init(
+ {
+ control_map : {
+ 'sample' : [ ['command'], function() { } ],
+ 'header' : [ ['change'], function() { obj.preview(); } ],
+ 'line_item' : [ ['change'], function() { obj.preview(); } ],
+ 'footer' : [ ['change'], function() { obj.preview(); } ],
+ 'preview' : [
+ ['command'],
+ function() {
+ obj.preview();
+ }
+ ],
+ 'save' : [
+ ['command'],
+ function() {
+ obj.save_template( obj.controller.view.template_name_menu.value );
+ }
+ ],
+ 'export' : [
+ ['command'],
+ function() {
+ obj.export_templates();
+ }
+ ],
+ 'import' : [
+ ['command'],
+ function() {
+ obj.import_templates();
+ }
+ ],
+ 'default' : [
+ ['command'],
+ function() {
+ obj.data.print_list_defaults();
+ obj.post_init();
+ }
+ ],
+ 'macros' : [
+ ['command'],
+ function() {
+ try {
+ JSAN.use('util.functional');
+ var template_type = obj.controller.view.template_type_menu.value;
+ var macros = [];
+ switch(template_type) {
+ case 'items':
+ JSAN.use('circ.util');
+ macros = util.functional.map_list(
+ circ.util.columns( {} ),
+ function(o) {
+ return '%' + o.id + '%';
+ }
+ );
+ break;
+ case 'holds':
+ JSAN.use('circ.util');
+ macros = util.functional.map_list(
+ circ.util.hold_columns( {} ),
+ function(o) {
+ return '%' + o.id + '%';
+ }
+ );
+ break;
+ case 'transits':
+ JSAN.use('circ.util');
+ macros = util.functional.map_list(
+ circ.util.transit_columns( {} ),
+ function(o) {
+ return '%' + o.id + '%';
+ }
+ );
+ break;
+ case 'offline_checkout':
+ JSAN.use('circ.util');
+ macros = util.functional.map_list(
+ circ.util.offline_checkout_columns( {} ),
+ function(o) {
+ return '%' + o.id + '%';
+ }
+ );
+ break;
+ case 'offline_checkin':
+ JSAN.use('circ.util');
+ macros = util.functional.map_list(
+ circ.util.offline_checkin_columns( {} ),
+ function(o) {
+ return '%' + o.id + '%';
+ }
+ );
+ break;
+ case 'offline_renew':
+ JSAN.use('circ.util');
+ macros = util.functional.map_list(
+ circ.util.offline_renew_columns( {} ),
+ function(o) {
+ return '%' + o.id + '%';
+ }
+ );
+ break;
case 'offline_inhouse_use':
- JSAN.use('circ.util');
- macros = util.functional.map_list(
- circ.util.offline_inhouse_use_columns( {} ),
- function(o) {
- return '%' + o.id + '%';
- }
- );
- break;
- case 'bills':
- JSAN.use('patron.util');
- macros = util.functional.map_list(
- patron.util.mbts_columns( {} ),
- function(o) {
- return '%' + o.id + '%';
- }
- );
- break;
- case 'patrons':
- JSAN.use('patron.util');
- macros = util.functional.map_list(
- patron.util.columns( {} ),
- function(o) {
- return '%' + o.id + '%';
- }
- );
- break;
- case 'payment' :
- macros = [ '%original_balance%', '%payment_received%', '%payment_applied%', '%payment_type%', '%voided_balance%', '%change_given%', '%new_balance%', '%note%', '%bill_id%', '%payment%', '%title%' ];
- break;
- }
- var macro_string = macros.join(', ');
- JSAN.use('util.window');
- var win = new util.window();
- win.open('data:text/html,'
- + window.escape(
- ''
- + ''
- + document.getElementById('circStrings').getString('staff.circ.print_list_template.window.title')
- + ' '
- + ''
- + ''
- + document.getElementById('circStrings').getString('staff.circ.print_list_template.window.heading')
- + ' '
- + '%SHORTNAME%, %TODAY%, %STAFF_FIRSTNAME%, %STAFF_LASTNAME%, '
- + '%PATRON_FIRSTNAME%, %LIBRARY%
'
- + ''
- + document.getElementById('circStrings').getFormattedString('staff.circ.print_list_template.window.template_type', [template_type])
- + ' '
- + ''
- + macro_string
- + '
'
- + ''
- + document.getElementById('circStrings').getString('staff.circ.print_list_template.window.close')
- + ' '
- + ''
- ), 'title', 'chrome,resizable');
- } catch(E) {
- alert(E);
- }
- }
- ],
- 'template_name_menu_placeholder' : [
- ['render'],
- function(e) {
- return function() {
- JSAN.use('util.widgets'); JSAN.use('util.functional');
- util.widgets.remove_children(e);
- var ml = util.widgets.make_menulist(
- util.functional.map_object_to_list(
- obj.data.print_list_templates,
- function(o,i) { return [i,i]; }
- )
- );
- ml.setAttribute('id','template_name_menu');
- //ml.setAttribute('editable','true');
- ml.setAttribute('flex','1');
- e.appendChild(ml);
- obj.controller.view.template_name_menu = ml;
- ml.addEventListener(
- 'command',
- function(ev) {
- var tmp = obj.data.print_list_templates[ ev.target.value ];
- obj.controller.view.template_type_menu.value = tmp.type;
- obj.controller.view.header.value = tmp.header;
- obj.controller.view.line_item.value = tmp.line_item;
- obj.controller.view.footer.value = tmp.footer;
- obj.preview();
- },
- false
- );
- }
- }
- ],
- 'template_type_menu_placeholder' : [
- ['render'],
- function(e) {
- return function() {
- JSAN.use('util.widgets'); JSAN.use('util.functional');
- util.widgets.remove_children(e);
- var ml = util.widgets.make_menulist(
- util.functional.map_list(
- obj.data.print_list_types,
- function(o) { return [o,o]; }
- )
- );
- ml.setAttribute('id','template_types_menu');
- ml.setAttribute('disabled','true');
- e.appendChild(ml);
- obj.controller.view.template_type_menu = ml;
- }
- }
- ]
+ JSAN.use('circ.util');
+ macros = util.functional.map_list(
+ circ.util.offline_inhouse_use_columns( {} ),
+ function(o) {
+ return '%' + o.id + '%';
+ }
+ );
+ break;
+ case 'bills':
+ JSAN.use('patron.util');
+ macros = util.functional.map_list(
+ patron.util.mbts_columns( {} ),
+ function(o) {
+ return '%' + o.id + '%';
+ }
+ );
+ break;
+ case 'patrons':
+ JSAN.use('patron.util');
+ macros = util.functional.map_list(
+ patron.util.columns( {} ),
+ function(o) {
+ return '%' + o.id + '%';
+ }
+ );
+ break;
+ case 'payment' :
+ macros = [ '%original_balance%', '%payment_received%', '%payment_applied%', '%payment_type%', '%voided_balance%', '%change_given%', '%new_balance%', '%note%', '%bill_id%', '%payment%', '%title%' ];
+ break;
+ }
+ var macro_string = macros.join(', ');
+ JSAN.use('util.window');
+ var win = new util.window();
+ win.open('data:text/html,'
+ + window.escape(
+ ''
+ + ''
+ + document.getElementById('circStrings').getString('staff.circ.print_list_template.window.title')
+ + ' '
+ + ''
+ + ''
+ + document.getElementById('circStrings').getString('staff.circ.print_list_template.window.heading')
+ + ' '
+ + '%SHORTNAME%, %TODAY%, %STAFF_FIRSTNAME%, %STAFF_LASTNAME%, '
+ + '%PATRON_FIRSTNAME%, %LIBRARY%
'
+ + ''
+ + document.getElementById('circStrings').getFormattedString('staff.circ.print_list_template.window.template_type', [template_type])
+ + ' '
+ + ''
+ + macro_string
+ + '
'
+ + ''
+ + document.getElementById('circStrings').getString('staff.circ.print_list_template.window.close')
+ + ' '
+ + ''
+ ), 'title', 'chrome,resizable');
+ } catch(E) {
+ alert(E);
+ }
+ }
+ ],
+ 'template_name_menu_placeholder' : [
+ ['render'],
+ function(e) {
+ return function() {
+ JSAN.use('util.widgets'); JSAN.use('util.functional');
+ util.widgets.remove_children(e);
+ var ml = util.widgets.make_menulist(
+ util.functional.map_object_to_list(
+ obj.data.print_list_templates,
+ function(o,i) { return [i,i]; }
+ )
+ );
+ ml.setAttribute('id','template_name_menu');
+ //ml.setAttribute('editable','true');
+ ml.setAttribute('flex','1');
+ e.appendChild(ml);
+ obj.controller.view.template_name_menu = ml;
+ ml.addEventListener(
+ 'command',
+ function(ev) {
+ var tmp = obj.data.print_list_templates[ ev.target.value ];
+ obj.controller.view.template_type_menu.value = tmp.type;
+ obj.controller.view.header.value = tmp.header;
+ obj.controller.view.line_item.value = tmp.line_item;
+ obj.controller.view.footer.value = tmp.footer;
+ obj.preview();
+ },
+ false
+ );
+ }
+ }
+ ],
+ 'template_type_menu_placeholder' : [
+ ['render'],
+ function(e) {
+ return function() {
+ JSAN.use('util.widgets'); JSAN.use('util.functional');
+ util.widgets.remove_children(e);
+ var ml = util.widgets.make_menulist(
+ util.functional.map_list(
+ obj.data.print_list_types,
+ function(o) { return [o,o]; }
+ )
+ );
+ ml.setAttribute('id','template_types_menu');
+ ml.setAttribute('disabled','true');
+ e.appendChild(ml);
+ obj.controller.view.template_type_menu = ml;
+ }
+ }
+ ]
- }
- }
- );
- } catch(E) {
- alert('controller_init: ' + E );
- }
- },
+ }
+ }
+ );
+ } catch(E) {
+ alert('controller_init: ' + E );
+ }
+ },
- 'preview' : function () {
- try {
- var list = this.test_list[ this.controller.view.template_type_menu.value ];
- if (typeof list == 'undefined') list = [];
- var data = this.test_data[ this.controller.view.template_type_menu.value ];
- if (typeof data == 'undefined') data = {};
+ 'preview' : function () {
+ try {
+ var list = this.test_list[ this.controller.view.template_type_menu.value ];
+ if (typeof list == 'undefined') list = [];
+ var data = this.test_data[ this.controller.view.template_type_menu.value ];
+ if (typeof data == 'undefined') data = {};
- var params = {
- 'patron' : this.test_patron,
- 'lib' : this.data.hash.aou[ this.data.list.au[0].ws_ou() ],
- 'staff' : this.data.list.au[0],
- 'header' : this.controller.view.header.value,
- 'line_item' : this.controller.view.line_item.value,
- 'footer' : this.controller.view.footer.value,
- 'type' : this.controller.view.template_type_menu.value,
- 'list' : list,
- 'data' : data,
- 'sample_frame' : this.controller.view.sample
- };
- JSAN.use('util.print'); var print = new util.print();
- print.tree_list( params );
- } catch(E) {
- this.error.sdump('D_ERROR', document.getElementById('circStrings').getString('staff.circ.print_list_template.preview') + ' ' + E);
- alert(document.getElementById('circStrings').getString('staff.circ.print_list_template.preview') + ' ' + E);
- }
- },
+ var params = {
+ 'patron' : this.test_patron,
+ 'lib' : this.data.hash.aou[ this.data.list.au[0].ws_ou() ],
+ 'staff' : this.data.list.au[0],
+ 'header' : this.controller.view.header.value,
+ 'line_item' : this.controller.view.line_item.value,
+ 'footer' : this.controller.view.footer.value,
+ 'type' : this.controller.view.template_type_menu.value,
+ 'list' : list,
+ 'data' : data,
+ 'sample_frame' : this.controller.view.sample
+ };
+ JSAN.use('util.print'); var print = new util.print();
+ print.tree_list( params );
+ } catch(E) {
+ this.error.sdump('D_ERROR', document.getElementById('circStrings').getString('staff.circ.print_list_template.preview') + ' ' + E);
+ alert(document.getElementById('circStrings').getString('staff.circ.print_list_template.preview') + ' ' + E);
+ }
+ },
- 'save_template' : function(name) {
- var obj = this;
- obj.data.print_list_templates[name].header = obj.controller.view.header.value;
- obj.data.print_list_templates[name].line_item = obj.controller.view.line_item.value;
- obj.data.print_list_templates[name].footer = obj.controller.view.footer.value;
- obj.data.print_list_templates[name].type = obj.controller.view.template_type_menu.value;
- obj.data.stash( 'print_list_templates' );
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- JSAN.use('util.file'); var file = new util.file('print_list_templates');
- file.set_object(obj.data.print_list_templates); file.close();
- alert(document.getElementById('circStrings').getString('staff.circ.print_list_template.save') + '\n' + js2JSON(obj.data.print_list_templates[name]));
- },
+ 'save_template' : function(name) {
+ var obj = this;
+ obj.data.print_list_templates[name].header = obj.controller.view.header.value;
+ obj.data.print_list_templates[name].line_item = obj.controller.view.line_item.value;
+ obj.data.print_list_templates[name].footer = obj.controller.view.footer.value;
+ obj.data.print_list_templates[name].type = obj.controller.view.template_type_menu.value;
+ obj.data.stash( 'print_list_templates' );
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ JSAN.use('util.file'); var file = new util.file('print_list_templates');
+ file.set_object(obj.data.print_list_templates); file.close();
+ alert(document.getElementById('circStrings').getString('staff.circ.print_list_template.save') + '\n' + js2JSON(obj.data.print_list_templates[name]));
+ },
- 'export_templates' : function() {
- try {
- var obj = this;
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- JSAN.use('util.file'); var f = new util.file('');
+ 'export_templates' : function() {
+ try {
+ var obj = this;
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ JSAN.use('util.file'); var f = new util.file('');
f.export_file( { 'title' : document.getElementById('circStrings').getString('staff.circ.print_list_template.save_as'), 'data' : obj.data.print_list_templates } );
- } catch(E) {
- this.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.print_list_template.export.error'),E);
- }
- },
+ } catch(E) {
+ this.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.print_list_template.export.error'),E);
+ }
+ },
- 'import_templates' : function() {
- try {
- var obj = this;
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- JSAN.use('util.file'); var f = new util.file('');
+ 'import_templates' : function() {
+ try {
+ var obj = this;
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ JSAN.use('util.file'); var f = new util.file('');
var temp = f.import_file( { 'title' : document.getElementById('circStrings').getString('staff.circ.print_list_template.import') } );
if (!temp) { return; }
var s = '';
@@ -411,11 +411,11 @@ circ.print_list_template_editor.prototype = {
} else {
alert(document.getElementById('circStrings').getString('staff.circ.print_list_template.reload'));
}
-
- } catch(E) {
- this.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.print_list_template.import.error'),E);
- }
- }
+
+ } catch(E) {
+ this.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.print_list_template.import.error'),E);
+ }
+ }
}
diff --git a/Open-ILS/xul/staff_client/server/circ/renew.js b/Open-ILS/xul/staff_client/server/circ/renew.js
index 3211203455..d844e95d9f 100644
--- a/Open-ILS/xul/staff_client/server/circ/renew.js
+++ b/Open-ILS/xul/staff_client/server/circ/renew.js
@@ -3,39 +3,39 @@ dump('entering circ.renew.js\n');
if (typeof circ == 'undefined') circ = {};
circ.renew = function (params) {
- JSAN.use('util.error'); this.error = new util.error();
- JSAN.use('util.network'); this.network = new util.network();
- JSAN.use('util.barcode');
- JSAN.use('util.date');
- this.OpenILS = {}; JSAN.use('OpenILS.data'); this.OpenILS.data = new OpenILS.data(); this.OpenILS.data.init({'via':'stash'});
- this.data = this.OpenILS.data;
+ JSAN.use('util.error'); this.error = new util.error();
+ JSAN.use('util.network'); this.network = new util.network();
+ JSAN.use('util.barcode');
+ JSAN.use('util.date');
+ this.OpenILS = {}; JSAN.use('OpenILS.data'); this.OpenILS.data = new OpenILS.data(); this.OpenILS.data.init({'via':'stash'});
+ this.data = this.OpenILS.data;
}
circ.renew.prototype = {
- 'selection_list' : [],
-
- 'init' : function( params ) {
-
- var obj = this;
-
- JSAN.use('circ.util'); JSAN.use('patron.util');
- var columns = circ.util.columns(
- {
- 'barcode' : { 'hidden' : false },
- 'title' : { 'hidden' : false },
- 'location' : { 'hidden' : false },
- 'call_number' : { 'hidden' : false },
- 'status' : { 'hidden' : false },
- 'alert_message' : { 'hidden' : false },
- 'due_date' : { 'hidden' : false },
- 'due_time' : { 'hidden' : false },
- 'renewal_remaining' : { 'hidden' : false }
- },
- {
- 'except_these' : [ 'uses', 'checkin_time_full' ]
- }
- ).concat(
+ 'selection_list' : [],
+
+ 'init' : function( params ) {
+
+ var obj = this;
+
+ JSAN.use('circ.util'); JSAN.use('patron.util');
+ var columns = circ.util.columns(
+ {
+ 'barcode' : { 'hidden' : false },
+ 'title' : { 'hidden' : false },
+ 'location' : { 'hidden' : false },
+ 'call_number' : { 'hidden' : false },
+ 'status' : { 'hidden' : false },
+ 'alert_message' : { 'hidden' : false },
+ 'due_date' : { 'hidden' : false },
+ 'due_time' : { 'hidden' : false },
+ 'renewal_remaining' : { 'hidden' : false }
+ },
+ {
+ 'except_these' : [ 'uses', 'checkin_time_full' ]
+ }
+ ).concat(
patron.util.columns( { 'family_name' : { 'hidden' : 'false' } } )
).concat(
@@ -43,244 +43,244 @@ circ.renew.prototype = {
).sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
- JSAN.use('util.list'); obj.list = new util.list('renew_list');
- obj.list.init(
- {
- 'columns' : columns,
- 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
- 'on_select' : function(ev) {
- try {
- JSAN.use('util.functional');
- var sel = obj.list.retrieve_selection();
- obj.selection_list = util.functional.map_list(
- sel,
- function(o) { return JSON2js(o.getAttribute('retrieve_id')); }
- );
- obj.error.sdump('D_TRACE', 'circ/copy_status: selection list = ' + js2JSON(obj.selection_list) );
- if (obj.selection_list.length == 0) {
- obj.controller.view.sel_edit.setAttribute('disabled','true');
- obj.controller.view.sel_opac.setAttribute('disabled','true');
- obj.controller.view.sel_patron.setAttribute('disabled','true');
- obj.controller.view.sel_last_patron.setAttribute('disabled','true');
- obj.controller.view.sel_copy_details.setAttribute('disabled','true');
- obj.controller.view.sel_bucket.setAttribute('disabled','true');
- obj.controller.view.sel_spine.setAttribute('disabled','true');
- obj.controller.view.sel_transit_abort.setAttribute('disabled','true');
- obj.controller.view.sel_clip.setAttribute('disabled','true');
- obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','true');
- } else {
- obj.controller.view.sel_edit.setAttribute('disabled','false');
- obj.controller.view.sel_opac.setAttribute('disabled','false');
- obj.controller.view.sel_patron.setAttribute('disabled','false');
- obj.controller.view.sel_last_patron.setAttribute('disabled','false');
- obj.controller.view.sel_copy_details.setAttribute('disabled','false');
- obj.controller.view.sel_bucket.setAttribute('disabled','false');
- obj.controller.view.sel_spine.setAttribute('disabled','false');
- obj.controller.view.sel_transit_abort.setAttribute('disabled','false');
- obj.controller.view.sel_clip.setAttribute('disabled','false');
- obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','false');
- }
- } catch(E) {
- alert('FIXME: ' + E);
- }
- }
- }
- );
-
- JSAN.use('util.controller'); obj.controller = new util.controller();
- obj.controller.init(
- {
- 'control_map' : {
- 'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
- 'sel_clip' : [
- ['command'],
- function() {
+ JSAN.use('util.list'); obj.list = new util.list('renew_list');
+ obj.list.init(
+ {
+ 'columns' : columns,
+ 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
+ 'on_select' : function(ev) {
+ try {
+ JSAN.use('util.functional');
+ var sel = obj.list.retrieve_selection();
+ obj.selection_list = util.functional.map_list(
+ sel,
+ function(o) { return JSON2js(o.getAttribute('retrieve_id')); }
+ );
+ obj.error.sdump('D_TRACE', 'circ/copy_status: selection list = ' + js2JSON(obj.selection_list) );
+ if (obj.selection_list.length == 0) {
+ obj.controller.view.sel_edit.setAttribute('disabled','true');
+ obj.controller.view.sel_opac.setAttribute('disabled','true');
+ obj.controller.view.sel_patron.setAttribute('disabled','true');
+ obj.controller.view.sel_last_patron.setAttribute('disabled','true');
+ obj.controller.view.sel_copy_details.setAttribute('disabled','true');
+ obj.controller.view.sel_bucket.setAttribute('disabled','true');
+ obj.controller.view.sel_spine.setAttribute('disabled','true');
+ obj.controller.view.sel_transit_abort.setAttribute('disabled','true');
+ obj.controller.view.sel_clip.setAttribute('disabled','true');
+ obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','true');
+ } else {
+ obj.controller.view.sel_edit.setAttribute('disabled','false');
+ obj.controller.view.sel_opac.setAttribute('disabled','false');
+ obj.controller.view.sel_patron.setAttribute('disabled','false');
+ obj.controller.view.sel_last_patron.setAttribute('disabled','false');
+ obj.controller.view.sel_copy_details.setAttribute('disabled','false');
+ obj.controller.view.sel_bucket.setAttribute('disabled','false');
+ obj.controller.view.sel_spine.setAttribute('disabled','false');
+ obj.controller.view.sel_transit_abort.setAttribute('disabled','false');
+ obj.controller.view.sel_clip.setAttribute('disabled','false');
+ obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','false');
+ }
+ } catch(E) {
+ alert('FIXME: ' + E);
+ }
+ }
+ }
+ );
+
+ JSAN.use('util.controller'); obj.controller = new util.controller();
+ obj.controller.init(
+ {
+ 'control_map' : {
+ 'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
+ 'sel_clip' : [
+ ['command'],
+ function() {
obj.list.clipboard();
obj.controller.view.renew_barcode_entry_textbox.focus();
}
- ],
- 'sel_edit' : [
- ['command'],
- function() {
- try {
- obj.spawn_copy_editor();
- } catch(E) {
- alert(E);
- }
- }
- ],
- 'sel_spine' : [
- ['command'],
- function() {
- JSAN.use('cat.util');
- cat.util.spawn_spine_editor(obj.selection_list);
- }
- ],
- 'sel_opac' : [
- ['command'],
- function() {
- JSAN.use('cat.util');
- cat.util.show_in_opac(obj.selection_list);
- }
- ],
- 'sel_transit_abort' : [
- ['command'],
- function() {
- JSAN.use('circ.util');
- circ.util.abort_transits(obj.selection_list);
- }
- ],
- 'sel_patron' : [
- ['command'],
- function() {
- JSAN.use('circ.util');
- circ.util.show_last_few_circs(obj.selection_list);
- }
- ],
- 'sel_last_patron' : [
- ['command'],
- function() {
- var patrons = {};
- for (var i = 0; i < obj.selection_list.length; i++) {
- var circs = obj.network.simple_request('FM_CIRC_RETRIEVE_VIA_COPY',[ses(),obj.selection_list[i].copy_id,1]);
- if (circs.length > 0) {
- patrons[circs[0].usr()] = 1;
- } else {
- alert(document.getElementById('circStrings').getFormattedString('staff.circ.item_no_circs', [obj.selection_list[i].barcode]));
- }
- }
- for (var i in patrons) {
- xulG.new_patron_tab({},{'id' : i});
- }
- }
- ],
- 'sel_copy_details' : [
- ['command'],
- function() {
- JSAN.use('circ.util');
- for (var i = 0; i < obj.selection_list.length; i++) {
- circ.util.show_copy_details( obj.selection_list[i].copy_id );
- }
- }
- ],
- 'sel_mark_items_damaged' : [
- ['command'],
- function() {
- var funcs = [];
- JSAN.use('cat.util'); JSAN.use('util.functional');
- cat.util.mark_item_damaged( util.functional.map_list( obj.selection_list, function(o) { return o.copy_id; } ) );
- }
- ],
- 'sel_bucket' : [
- ['command'],
- function() {
- JSAN.use('cat.util');
- cat.util.add_copies_to_bucket(obj.selection_list);
- }
- ],
- 'renew_barcode_entry_textbox' : [
- ['keypress'],
- function(ev) {
- if (ev.keyCode && ev.keyCode == 13) {
- obj.renew();
- }
- }
- ],
- 'cmd_broken' : [
- ['command'],
- function() { alert(document.getElementById('circStrings').getString('staff.circ.unimplemented')); }
- ],
- 'cmd_renew_submit_barcode' : [
- ['command'],
- function() {
- obj.renew();
- }
- ],
- 'cmd_renew_print' : [
- ['command'],
- function() {
- var p = {
- 'template' : 'renew'
- };
- obj.list.print(p);
- }
- ],
- 'cmd_csv_to_clipboard' : [ ['command'], function() {
+ ],
+ 'sel_edit' : [
+ ['command'],
+ function() {
+ try {
+ obj.spawn_copy_editor();
+ } catch(E) {
+ alert(E);
+ }
+ }
+ ],
+ 'sel_spine' : [
+ ['command'],
+ function() {
+ JSAN.use('cat.util');
+ cat.util.spawn_spine_editor(obj.selection_list);
+ }
+ ],
+ 'sel_opac' : [
+ ['command'],
+ function() {
+ JSAN.use('cat.util');
+ cat.util.show_in_opac(obj.selection_list);
+ }
+ ],
+ 'sel_transit_abort' : [
+ ['command'],
+ function() {
+ JSAN.use('circ.util');
+ circ.util.abort_transits(obj.selection_list);
+ }
+ ],
+ 'sel_patron' : [
+ ['command'],
+ function() {
+ JSAN.use('circ.util');
+ circ.util.show_last_few_circs(obj.selection_list);
+ }
+ ],
+ 'sel_last_patron' : [
+ ['command'],
+ function() {
+ var patrons = {};
+ for (var i = 0; i < obj.selection_list.length; i++) {
+ var circs = obj.network.simple_request('FM_CIRC_RETRIEVE_VIA_COPY',[ses(),obj.selection_list[i].copy_id,1]);
+ if (circs.length > 0) {
+ patrons[circs[0].usr()] = 1;
+ } else {
+ alert(document.getElementById('circStrings').getFormattedString('staff.circ.item_no_circs', [obj.selection_list[i].barcode]));
+ }
+ }
+ for (var i in patrons) {
+ xulG.new_patron_tab({},{'id' : i});
+ }
+ }
+ ],
+ 'sel_copy_details' : [
+ ['command'],
+ function() {
+ JSAN.use('circ.util');
+ for (var i = 0; i < obj.selection_list.length; i++) {
+ circ.util.show_copy_details( obj.selection_list[i].copy_id );
+ }
+ }
+ ],
+ 'sel_mark_items_damaged' : [
+ ['command'],
+ function() {
+ var funcs = [];
+ JSAN.use('cat.util'); JSAN.use('util.functional');
+ cat.util.mark_item_damaged( util.functional.map_list( obj.selection_list, function(o) { return o.copy_id; } ) );
+ }
+ ],
+ 'sel_bucket' : [
+ ['command'],
+ function() {
+ JSAN.use('cat.util');
+ cat.util.add_copies_to_bucket(obj.selection_list);
+ }
+ ],
+ 'renew_barcode_entry_textbox' : [
+ ['keypress'],
+ function(ev) {
+ if (ev.keyCode && ev.keyCode == 13) {
+ obj.renew();
+ }
+ }
+ ],
+ 'cmd_broken' : [
+ ['command'],
+ function() { alert(document.getElementById('circStrings').getString('staff.circ.unimplemented')); }
+ ],
+ 'cmd_renew_submit_barcode' : [
+ ['command'],
+ function() {
+ obj.renew();
+ }
+ ],
+ 'cmd_renew_print' : [
+ ['command'],
+ function() {
+ var p = {
+ 'template' : 'renew'
+ };
+ obj.list.print(p);
+ }
+ ],
+ 'cmd_csv_to_clipboard' : [ ['command'], function() {
obj.list.dump_csv_to_clipboard();
obj.controller.view.renew_barcode_entry_textbox.focus();
} ],
- 'cmd_csv_to_printer' : [ ['command'], function() {
+ 'cmd_csv_to_printer' : [ ['command'], function() {
obj.list.dump_csv_to_printer();
obj.controller.view.renew_barcode_entry_textbox.focus();
} ],
- 'cmd_csv_to_file' : [ ['command'], function() {
+ 'cmd_csv_to_file' : [ ['command'], function() {
obj.list.dump_csv_to_file( { 'defaultFileName' : 'checked_in.txt' } );
obj.controller.view.renew_barcode_entry_textbox.focus();
} ]
- }
- }
- );
- this.controller.render();
- this.controller.view.renew_barcode_entry_textbox.focus();
-
- },
-
- 'test_barcode' : function(bc) {
- var obj = this;
- var x = document.getElementById('strict_barcode');
- if (x && x.checked != true) return true;
- var good = util.barcode.check(bc);
- if (good) {
- return true;
- } else {
- if ( 1 == obj.error.yns_alert(
- document.getElementById('circStrings').getFormattedString('staff.circ.check_digit.bad', [bc]),
- document.getElementById('circStrings').getString('staff.circ.barcode.bad'),
- document.getElementById('circStrings').getString('staff.circ.cancel'),
- document.getElementById('circStrings').getString('staff.circ.barcode.accept'),
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm'),
- '/xul/server/skin/media/images/bad_barcode.png'
- ) ) {
- return true;
- } else {
- return false;
- }
- }
- },
-
- 'renew' : function() {
- var obj = this;
- try {
- var barcode = obj.controller.view.renew_barcode_entry_textbox.value;
- if (!barcode) return;
- if (barcode) {
- if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; }
- }
- var auto_print = document.getElementById('renew_auto');
- if (auto_print) auto_print = auto_print.checked;
- JSAN.use('circ.util');
- var renew = circ.util.renew_via_barcode(
+ }
+ }
+ );
+ this.controller.render();
+ this.controller.view.renew_barcode_entry_textbox.focus();
+
+ },
+
+ 'test_barcode' : function(bc) {
+ var obj = this;
+ var x = document.getElementById('strict_barcode');
+ if (x && x.checked != true) return true;
+ var good = util.barcode.check(bc);
+ if (good) {
+ return true;
+ } else {
+ if ( 1 == obj.error.yns_alert(
+ document.getElementById('circStrings').getFormattedString('staff.circ.check_digit.bad', [bc]),
+ document.getElementById('circStrings').getString('staff.circ.barcode.bad'),
+ document.getElementById('circStrings').getString('staff.circ.cancel'),
+ document.getElementById('circStrings').getString('staff.circ.barcode.accept'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm'),
+ '/xul/server/skin/media/images/bad_barcode.png'
+ ) ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ },
+
+ 'renew' : function() {
+ var obj = this;
+ try {
+ var barcode = obj.controller.view.renew_barcode_entry_textbox.value;
+ if (!barcode) return;
+ if (barcode) {
+ if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; }
+ }
+ var auto_print = document.getElementById('renew_auto');
+ if (auto_print) auto_print = auto_print.checked;
+ JSAN.use('circ.util');
+ var renew = circ.util.renew_via_barcode(
{ 'barcode' : barcode, 'return_patron' : true },
function( r ) {
obj.renew_followup( r, barcode );
}
- );
- } catch(E) {
- obj.error.standard_unexpected_error_alert('Error in circ/renew.js, renew():', E);
- if (typeof obj.on_failure == 'function') {
- obj.on_failure(E);
- }
- if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
- window.xulG.on_failure(E);
- }
- }
- },
-
- 'renew_followup' : function(r,bc) {
- var obj = this;
- try {
- if (!r) return obj.on_failure(); /* circ.util.renew handles errors and returns null currently */
+ );
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('Error in circ/renew.js, renew():', E);
+ if (typeof obj.on_failure == 'function') {
+ obj.on_failure(E);
+ }
+ if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
+ window.xulG.on_failure(E);
+ }
+ }
+ },
+
+ 'renew_followup' : function(r,bc) {
+ var obj = this;
+ try {
+ if (!r) return obj.on_failure(); /* circ.util.renew handles errors and returns null currently */
if ( (typeof r[0].ilsevent != 'undefined' && r[0].ilsevent == 0) ) {
// SUCCESS
var x = document.getElementById('no_change_label');
@@ -296,16 +296,16 @@ circ.renew.prototype = {
x.hidden = false;
x.setAttribute('value',msg);
}
- obj.controller.view.renew_barcode_entry_textbox.focus();
- obj.controller.view.renew_barcode_entry_textbox.select();
+ obj.controller.view.renew_barcode_entry_textbox.focus();
+ obj.controller.view.renew_barcode_entry_textbox.select();
return;
}
var renew = r[0].payload;
- var retrieve_id = js2JSON( { 'copy_id' : renew.copy.id(), 'barcode' : renew.copy.barcode(), 'doc_id' : (renew.record == null ? null : renew.record.doc_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; }
- }
+ var retrieve_id = js2JSON( { 'copy_id' : renew.copy.id(), 'barcode' : renew.copy.barcode(), 'doc_id' : (renew.record == null ? null : renew.record.doc_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; }
+ }
var params = {
'retrieve_id' : retrieve_id,
@@ -323,7 +323,7 @@ circ.renew.prototype = {
},
'to_top' : true
};
- obj.list.append( params );
+ obj.list.append( params );
if (params.row.my.mbts && ( document.getElementById('no_change_label') || document.getElementById('fine_tally') ) ) {
JSAN.use('util.money');
@@ -349,32 +349,32 @@ circ.renew.prototype = {
}
}
- obj.list.node.view.selection.select(0);
+ obj.list.node.view.selection.select(0);
- JSAN.use('util.sound'); var sound = new util.sound(); sound.circ_good();
+ JSAN.use('util.sound'); var sound = new util.sound(); sound.circ_good();
- if (typeof obj.on_renew == 'function') {
- obj.on_renew(renew);
- }
- if (typeof window.xulG == 'object' && typeof window.xulG.on_renew == 'function') {
- window.xulG.on_renew(renew);
- }
+ if (typeof obj.on_renew == 'function') {
+ obj.on_renew(renew);
+ }
+ if (typeof window.xulG == 'object' && typeof window.xulG.on_renew == 'function') {
+ window.xulG.on_renew(renew);
+ }
- return true;
+ return true;
- } catch(E) {
- obj.error.standard_unexpected_error_alert('Error in circ/renew.js, renew_followup():', E);
- if (typeof obj.on_failure == 'function') {
- obj.on_failure(E);
- }
- if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
- window.xulG.on_failure(E);
- }
- }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('Error in circ/renew.js, renew_followup():', E);
+ if (typeof obj.on_failure == 'function') {
+ obj.on_failure(E);
+ }
+ if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
+ window.xulG.on_failure(E);
+ }
+ }
- },
+ },
- 'on_renew' : function() {
+ 'on_renew' : function() {
try {
this.controller.view.renew_barcode_entry_textbox.disabled = false;
this.controller.view.renew_barcode_entry_textbox.select();
@@ -383,9 +383,9 @@ circ.renew.prototype = {
} catch(E) {
alert('Error in renew.js, on_renew(): ' + E);
}
- },
+ },
- 'on_failure' : function() {
+ 'on_failure' : function() {
try {
this.controller.view.renew_barcode_entry_textbox.disabled = false;
this.controller.view.renew_barcode_entry_textbox.select();
@@ -393,26 +393,26 @@ circ.renew.prototype = {
} catch(E) {
alert('Error in renew.js, on_failure(): ' + E);
}
- },
-
- 'spawn_copy_editor' : function() {
+ },
+
+ 'spawn_copy_editor' : function() {
- var obj = this;
+ var obj = this;
- JSAN.use('util.functional');
+ JSAN.use('util.functional');
- var list = obj.selection_list;
+ var list = obj.selection_list;
- list = util.functional.map_list(
- list,
- function (o) {
- return o.copy_id;
- }
- );
+ list = util.functional.map_list(
+ list,
+ function (o) {
+ return o.copy_id;
+ }
+ );
- JSAN.use('cat.util'); cat.util.spawn_copy_editor( { 'copy_ids' : list, 'edit' : 1 } );
+ JSAN.use('cat.util'); cat.util.spawn_copy_editor( { 'copy_ids' : list, 'edit' : 1 } );
- }
+ }
}
diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js
index 8ac1b8cf8b..c05b528de7 100644
--- a/Open-ILS/xul/staff_client/server/circ/util.js
+++ b/Open-ILS/xul/staff_client/server/circ/util.js
@@ -4,92 +4,92 @@ dump('entering circ/util.js\n');
if (typeof circ == 'undefined') { var circ = {}; }
circ.util = {};
-circ.util.EXPORT_OK = [
- 'offline_checkout_columns', 'offline_checkin_columns', 'offline_renew_columns', 'offline_inhouse_use_columns',
- 'columns', 'hold_columns', 'checkin_via_barcode', 'std_map_row_to_columns',
- 'show_last_few_circs', 'abort_transits', 'transit_columns', 'work_log_columns', 'renew_via_barcode', 'backdate_post_checkin'
+circ.util.EXPORT_OK = [
+ 'offline_checkout_columns', 'offline_checkin_columns', 'offline_renew_columns', 'offline_inhouse_use_columns',
+ 'columns', 'hold_columns', 'checkin_via_barcode', 'std_map_row_to_columns',
+ 'show_last_few_circs', 'abort_transits', 'transit_columns', 'work_log_columns', 'renew_via_barcode', 'backdate_post_checkin'
];
-circ.util.EXPORT_TAGS = { ':all' : circ.util.EXPORT_OK };
+circ.util.EXPORT_TAGS = { ':all' : circ.util.EXPORT_OK };
circ.util.abort_transits = function(selection_list) {
- var obj = {};
- JSAN.use('util.error'); obj.error = new util.error();
- JSAN.use('util.network'); obj.network = new util.network();
- JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
- JSAN.use('util.functional');
- var copies = util.functional.map_list( selection_list, function(o){return o.copy_id;}).join(', ');
- var msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.abort_transits.confirm', [copies]);
- var r = obj.error.yns_alert(
- msg,
- document.getElementById('circStrings').getString('staff.circ.utils.abort_transits.title'),
- document.getElementById('circStrings').getString('staff.circ.utils.yes'),
- document.getElementById('circStrings').getString('staff.circ.utils.no'),
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm')
- );
- if (r == 0) {
- try {
- for (var i = 0; i < selection_list.length; i++) {
- var copy_id = selection_list[i].copy_id;
- var robj = obj.network.simple_request('FM_ATC_VOID',[ ses(), { 'copyid' : copy_id } ]);
- if (typeof robj.ilsevent != 'undefined') {
- switch(Number(robj.ilsevent)) {
- case 1225 /* TRANSIT_ABORT_NOT_ALLOWED */ :
- alert(document.getElementById('circString').getFormattedString('staff.circ.utils.abort_transits.not_allowed', [copy_id]) + '\n' + robj.desc);
- break;
- case 1504 /* ACTION_TRANSIT_COPY_NOT_FOUND */ :
- alert(document.getElementById('circString').getString('staff.circ.utils.abort_transits.not_found'));
- break;
- case 5000 /* PERM_FAILURE */ :
- break;
- default:
- throw(robj);
- break;
- }
- }
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circString').getString('staff.circ.utils.abort_transits.unexpected_error'),E);
- }
- }
+ var obj = {};
+ JSAN.use('util.error'); obj.error = new util.error();
+ JSAN.use('util.network'); obj.network = new util.network();
+ JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
+ JSAN.use('util.functional');
+ var copies = util.functional.map_list( selection_list, function(o){return o.copy_id;}).join(', ');
+ var msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.abort_transits.confirm', [copies]);
+ var r = obj.error.yns_alert(
+ msg,
+ document.getElementById('circStrings').getString('staff.circ.utils.abort_transits.title'),
+ document.getElementById('circStrings').getString('staff.circ.utils.yes'),
+ document.getElementById('circStrings').getString('staff.circ.utils.no'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm')
+ );
+ if (r == 0) {
+ try {
+ for (var i = 0; i < selection_list.length; i++) {
+ var copy_id = selection_list[i].copy_id;
+ var robj = obj.network.simple_request('FM_ATC_VOID',[ ses(), { 'copyid' : copy_id } ]);
+ if (typeof robj.ilsevent != 'undefined') {
+ switch(Number(robj.ilsevent)) {
+ case 1225 /* TRANSIT_ABORT_NOT_ALLOWED */ :
+ alert(document.getElementById('circString').getFormattedString('staff.circ.utils.abort_transits.not_allowed', [copy_id]) + '\n' + robj.desc);
+ break;
+ case 1504 /* ACTION_TRANSIT_COPY_NOT_FOUND */ :
+ alert(document.getElementById('circString').getString('staff.circ.utils.abort_transits.not_found'));
+ break;
+ case 5000 /* PERM_FAILURE */ :
+ break;
+ default:
+ throw(robj);
+ break;
+ }
+ }
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circString').getString('staff.circ.utils.abort_transits.unexpected_error'),E);
+ }
+ }
};
circ.util.show_copy_details = function(copy_id) {
- var obj = {};
- JSAN.use('util.error'); obj.error = new util.error();
- JSAN.use('util.window'); obj.win = new util.window();
- JSAN.use('util.network'); obj.network = new util.network();
- JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
-
- if (typeof copy_id == 'object' && copy_id != null) copy_id = copy_id.id();
-
- try {
- var url = xulG.url_prefix( urls.XUL_COPY_DETAILS ); // + '?copy_id=' + copy_id;
- var my_xulG = obj.win.open( url, 'show_copy_details', 'chrome,resizable,modal', { 'copy_id' : copy_id } );
-
- if (typeof my_xulG.retrieve_these_patrons == 'undefined') return;
- var patrons = my_xulG.retrieve_these_patrons;
- for (var j = 0; j < patrons.length; j++) {
- if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') {
- try {
- window.xulG.new_patron_tab( {}, { 'id' : patrons[j] } );
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.utils.retrieve_patron.failure'), E);
- }
- }
- }
-
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.utils.retrieve_copy.failure'),E);
- }
+ var obj = {};
+ JSAN.use('util.error'); obj.error = new util.error();
+ JSAN.use('util.window'); obj.win = new util.window();
+ JSAN.use('util.network'); obj.network = new util.network();
+ JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
+
+ if (typeof copy_id == 'object' && copy_id != null) copy_id = copy_id.id();
+
+ try {
+ var url = xulG.url_prefix( urls.XUL_COPY_DETAILS ); // + '?copy_id=' + copy_id;
+ var my_xulG = obj.win.open( url, 'show_copy_details', 'chrome,resizable,modal', { 'copy_id' : copy_id } );
+
+ if (typeof my_xulG.retrieve_these_patrons == 'undefined') return;
+ var patrons = my_xulG.retrieve_these_patrons;
+ for (var j = 0; j < patrons.length; j++) {
+ if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') {
+ try {
+ window.xulG.new_patron_tab( {}, { 'id' : patrons[j] } );
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.utils.retrieve_patron.failure'), E);
+ }
+ }
+ }
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.utils.retrieve_copy.failure'),E);
+ }
};
circ.util.backdate_post_checkin = function(circ_ids) {
- var obj = {};
- JSAN.use('util.error'); obj.error = new util.error();
- JSAN.use('util.window'); obj.win = new util.window();
- JSAN.use('util.network'); obj.network = new util.network();
- JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
+ var obj = {};
+ JSAN.use('util.error'); obj.error = new util.error();
+ JSAN.use('util.window'); obj.win = new util.window();
+ JSAN.use('util.network'); obj.network = new util.network();
+ JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
JSAN.use('util.sound'); obj.sound = new util.sound();
var circStrings = document.getElementById('circStrings');
@@ -101,2003 +101,2003 @@ circ.util.backdate_post_checkin = function(circ_ids) {
}
);
- try {
- var url = xulG.url_prefix( urls.XUL_BACKDATE );
- var my_xulG = obj.win.open( url, 'backdate_post_checkin', 'chrome,resizable,modal', { 'circ_ids' : circ_ids } );
+ try {
+ var url = xulG.url_prefix( urls.XUL_BACKDATE );
+ var my_xulG = obj.win.open( url, 'backdate_post_checkin', 'chrome,resizable,modal', { 'circ_ids' : circ_ids } );
return my_xulG;
- } catch(E) {
- obj.error.standard_unexpected_error_alert(circStrings.getString('staff.circ.utils.retrieve_copy.failure'),E);
- }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(circStrings.getString('staff.circ.utils.retrieve_copy.failure'),E);
+ }
};
circ.util.show_last_few_circs = function(selection_list) {
- var obj = {};
- JSAN.use('util.error'); obj.error = new util.error();
- JSAN.use('util.window'); obj.win = new util.window();
- JSAN.use('util.network'); obj.network = new util.network();
- JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
-
- for (var i = 0; i < selection_list.length; i++) {
- try {
- if (typeof selection_list[i].copy_id == 'undefined' || selection_list[i].copy_id == null) continue;
- var url = xulG.url_prefix( urls.XUL_CIRC_SUMMARY ); // + '?copy_id=' + selection_list[i].copy_id + '&count=' + count;
- var my_xulG = obj.win.open( url, 'show_last_few_circs', 'chrome,resizable,modal', { 'copy_id' : selection_list[i].copy_id } );
-
- if (typeof my_xulG.retrieve_these_patrons == 'undefined') continue;
- var patrons = my_xulG.retrieve_these_patrons;
- for (var j = 0; j < patrons.length; j++) {
- if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') {
- try {
- window.xulG.new_patron_tab( {}, { 'id' : patrons[j] } );
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.utils.retrieve_patron.failure') ,E);
- }
- }
- }
-
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.utils.retrieve_circs.failure') ,E);
- }
- }
+ var obj = {};
+ JSAN.use('util.error'); obj.error = new util.error();
+ JSAN.use('util.window'); obj.win = new util.window();
+ JSAN.use('util.network'); obj.network = new util.network();
+ JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
+
+ for (var i = 0; i < selection_list.length; i++) {
+ try {
+ if (typeof selection_list[i].copy_id == 'undefined' || selection_list[i].copy_id == null) continue;
+ var url = xulG.url_prefix( urls.XUL_CIRC_SUMMARY ); // + '?copy_id=' + selection_list[i].copy_id + '&count=' + count;
+ var my_xulG = obj.win.open( url, 'show_last_few_circs', 'chrome,resizable,modal', { 'copy_id' : selection_list[i].copy_id } );
+
+ if (typeof my_xulG.retrieve_these_patrons == 'undefined') continue;
+ var patrons = my_xulG.retrieve_these_patrons;
+ for (var j = 0; j < patrons.length; j++) {
+ if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') {
+ try {
+ window.xulG.new_patron_tab( {}, { 'id' : patrons[j] } );
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.utils.retrieve_patron.failure') ,E);
+ }
+ }
+ }
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.utils.retrieve_circs.failure') ,E);
+ }
+ }
};
circ.util.offline_checkout_columns = function(modify,params) {
- var c = [
- {
- 'id' : 'timestamp',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.timestamp'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.timestamp; }
- },
- {
- 'id' : 'checkout_time',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.checkout_time'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.checkout_time; }
- },
- {
- 'id' : 'type',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.type'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.type; }
- },
- {
- 'id' : 'noncat',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.noncat'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.noncat; }
- },
- {
- 'id' : 'noncat_type',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.noncat_type'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.noncat_type; }
- },
- {
- 'id' : 'noncat_count',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.count'),
- 'sort_type' : 'number',
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : false,
- 'editable' : false, 'render' : function(my) { return my.noncat_count; }
- },
- {
- 'id' : 'patron_barcode',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.patron_barcode'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.patron_barcode; }
- },
- {
- 'id' : 'barcode',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.item_barcode'),
- 'flex' : 2,
- 'primary' : true,
- 'hidden' : false,
- 'editable' : false, 'render' : function(my) { return my.barcode; }
- },
- {
- 'id' : 'due_date',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.due_date'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : false,
- 'editable' : false, 'render' : function(my) { return my.due_date; }
- },
- {
- 'id' : 'due_time',
- 'label' : document.getElementById('commonStrings').getString('staff.circ_label_due_time'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : false,
- 'editable' : false, 'render' : function(my) { return my.due_time; }
- }
-
- ];
- if (modify) for (var i = 0; i < c.length; i++) {
- if (modify[ c[i].id ]) {
- for (var j in modify[ c[i].id ]) {
- c[i][j] = modify[ c[i].id ][j];
- }
- }
- }
- if (params) {
- if (params.just_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < params.just_these.length; i++) {
- var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
- new_c.push( function(y){ return y; }( x ) );
- }
- c = new_c;
- }
- if (params.except_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < c.length; i++) {
- var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
- if (!x) new_c.push(c[i]);
- }
- c = new_c;
- }
-
- }
- return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
+ var c = [
+ {
+ 'id' : 'timestamp',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.timestamp'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.timestamp; }
+ },
+ {
+ 'id' : 'checkout_time',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.checkout_time'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.checkout_time; }
+ },
+ {
+ 'id' : 'type',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.type'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.type; }
+ },
+ {
+ 'id' : 'noncat',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.noncat'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.noncat; }
+ },
+ {
+ 'id' : 'noncat_type',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.noncat_type'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.noncat_type; }
+ },
+ {
+ 'id' : 'noncat_count',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.count'),
+ 'sort_type' : 'number',
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : false,
+ 'editable' : false, 'render' : function(my) { return my.noncat_count; }
+ },
+ {
+ 'id' : 'patron_barcode',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.patron_barcode'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.patron_barcode; }
+ },
+ {
+ 'id' : 'barcode',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.item_barcode'),
+ 'flex' : 2,
+ 'primary' : true,
+ 'hidden' : false,
+ 'editable' : false, 'render' : function(my) { return my.barcode; }
+ },
+ {
+ 'id' : 'due_date',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.due_date'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : false,
+ 'editable' : false, 'render' : function(my) { return my.due_date; }
+ },
+ {
+ 'id' : 'due_time',
+ 'label' : document.getElementById('commonStrings').getString('staff.circ_label_due_time'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : false,
+ 'editable' : false, 'render' : function(my) { return my.due_time; }
+ }
+
+ ];
+ if (modify) for (var i = 0; i < c.length; i++) {
+ if (modify[ c[i].id ]) {
+ for (var j in modify[ c[i].id ]) {
+ c[i][j] = modify[ c[i].id ][j];
+ }
+ }
+ }
+ if (params) {
+ if (params.just_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < params.just_these.length; i++) {
+ var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
+ new_c.push( function(y){ return y; }( x ) );
+ }
+ c = new_c;
+ }
+ if (params.except_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < c.length; i++) {
+ var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
+ if (!x) new_c.push(c[i]);
+ }
+ c = new_c;
+ }
+
+ }
+ return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
};
circ.util.offline_checkin_columns = function(modify,params) {
- var c = [
- {
- 'id' : 'timestamp',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.timestamp'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.timestamp; }
- },
- {
- 'id' : 'backdate',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.backdate'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.backdate; }
- },
- {
- 'id' : 'type',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.type'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.type; }
- },
- {
- 'id' : 'barcode',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.item_barcode'),
- 'flex' : 2,
- 'primary' : true,
- 'hidden' : false,
- 'editable' : false, 'render' : function(my) { return my.barcode; }
- }
- ];
- if (modify) for (var i = 0; i < c.length; i++) {
- if (modify[ c[i].id ]) {
- for (var j in modify[ c[i].id ]) {
- c[i][j] = modify[ c[i].id ][j];
- }
- }
- }
- if (params) {
- if (params.just_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < params.just_these.length; i++) {
- var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
- new_c.push( function(y){ return y; }( x ) );
- }
- c = new_c;
- }
- if (params.except_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < c.length; i++) {
- var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
- if (!x) new_c.push(c[i]);
- }
- c = new_c;
- }
-
- }
- return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
+ var c = [
+ {
+ 'id' : 'timestamp',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.timestamp'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.timestamp; }
+ },
+ {
+ 'id' : 'backdate',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.backdate'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.backdate; }
+ },
+ {
+ 'id' : 'type',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.type'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.type; }
+ },
+ {
+ 'id' : 'barcode',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.item_barcode'),
+ 'flex' : 2,
+ 'primary' : true,
+ 'hidden' : false,
+ 'editable' : false, 'render' : function(my) { return my.barcode; }
+ }
+ ];
+ if (modify) for (var i = 0; i < c.length; i++) {
+ if (modify[ c[i].id ]) {
+ for (var j in modify[ c[i].id ]) {
+ c[i][j] = modify[ c[i].id ][j];
+ }
+ }
+ }
+ if (params) {
+ if (params.just_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < params.just_these.length; i++) {
+ var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
+ new_c.push( function(y){ return y; }( x ) );
+ }
+ c = new_c;
+ }
+ if (params.except_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < c.length; i++) {
+ var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
+ if (!x) new_c.push(c[i]);
+ }
+ c = new_c;
+ }
+
+ }
+ return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
};
circ.util.offline_renew_columns = function(modify,params) {
- var c = [
- {
- 'id' : 'timestamp',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.timestamp'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.timestamp; }
- },
- {
- 'id' : 'checkout_time',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.checkout_time'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.checkout_time; }
- },
- {
- 'id' : 'type',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.type'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.type; }
- },
- {
- 'id' : 'patron_barcode',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.patron_barcode'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.patron_barcode; }
- },
- {
- 'id' : 'barcode',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.item_barcode'),
- 'flex' : 2,
- 'primary' : true,
- 'hidden' : false,
- 'editable' : false, 'render' : function(my) { return my.barcode; }
- },
- {
- 'id' : 'due_date',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.due_date'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : false,
- 'editable' : false, 'render' : function(my) { return my.due_date; }
- },
- {
- 'id' : 'due_time',
- 'label' : document.getElementById('commonStrings').getString('staff.circ_label_due_time'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : false,
- 'editable' : false, 'render' : function(my) { return my.due_time; }
- }
- ];
- if (modify) for (var i = 0; i < c.length; i++) {
- if (modify[ c[i].id ]) {
- for (var j in modify[ c[i].id ]) {
- c[i][j] = modify[ c[i].id ][j];
- }
- }
- }
- if (params) {
- if (params.just_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < params.just_these.length; i++) {
- var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
- new_c.push( function(y){ return y; }( x ) );
- }
- c = new_c;
- }
- if (params.except_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < c.length; i++) {
- var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
- if (!x) new_c.push(c[i]);
- }
- c = new_c;
- }
-
- }
- return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
+ var c = [
+ {
+ 'id' : 'timestamp',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.timestamp'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.timestamp; }
+ },
+ {
+ 'id' : 'checkout_time',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.checkout_time'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.checkout_time; }
+ },
+ {
+ 'id' : 'type',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.type'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.type; }
+ },
+ {
+ 'id' : 'patron_barcode',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.patron_barcode'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.patron_barcode; }
+ },
+ {
+ 'id' : 'barcode',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.item_barcode'),
+ 'flex' : 2,
+ 'primary' : true,
+ 'hidden' : false,
+ 'editable' : false, 'render' : function(my) { return my.barcode; }
+ },
+ {
+ 'id' : 'due_date',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.due_date'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : false,
+ 'editable' : false, 'render' : function(my) { return my.due_date; }
+ },
+ {
+ 'id' : 'due_time',
+ 'label' : document.getElementById('commonStrings').getString('staff.circ_label_due_time'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : false,
+ 'editable' : false, 'render' : function(my) { return my.due_time; }
+ }
+ ];
+ if (modify) for (var i = 0; i < c.length; i++) {
+ if (modify[ c[i].id ]) {
+ for (var j in modify[ c[i].id ]) {
+ c[i][j] = modify[ c[i].id ][j];
+ }
+ }
+ }
+ if (params) {
+ if (params.just_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < params.just_these.length; i++) {
+ var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
+ new_c.push( function(y){ return y; }( x ) );
+ }
+ c = new_c;
+ }
+ if (params.except_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < c.length; i++) {
+ var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
+ if (!x) new_c.push(c[i]);
+ }
+ c = new_c;
+ }
+
+ }
+ return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
};
circ.util.offline_inhouse_use_columns = function(modify,params) {
- var c = [
- {
- 'id' : 'timestamp',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.timestamp'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.timestamp; }
- },
- {
- 'id' : 'use_time',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.use_time'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.use_time; }
- },
- {
- 'id' : 'type',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.type'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.type; }
- },
- {
- 'id' : 'count',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.count'),
- 'sort_type' : 'number',
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : false,
- 'editable' : false, 'render' : function(my) { return my.count; }
- },
- {
- 'id' : 'barcode',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.item_barcode'),
- 'flex' : 2,
- 'primary' : true,
- 'hidden' : false,
- 'editable' : false, 'render' : function(my) { return my.barcode; }
- }
- ];
- if (modify) for (var i = 0; i < c.length; i++) {
- if (modify[ c[i].id ]) {
- for (var j in modify[ c[i].id ]) {
- c[i][j] = modify[ c[i].id ][j];
- }
- }
- }
- if (params) {
- if (params.just_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < params.just_these.length; i++) {
- var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
- new_c.push( function(y){ return y; }( x ) );
- }
- c = new_c;
- }
- if (params.except_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < c.length; i++) {
- var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
- if (!x) new_c.push(c[i]);
- }
- c = new_c;
- }
-
- }
- return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
+ var c = [
+ {
+ 'id' : 'timestamp',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.timestamp'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.timestamp; }
+ },
+ {
+ 'id' : 'use_time',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.use_time'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.use_time; }
+ },
+ {
+ 'id' : 'type',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.type'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.type; }
+ },
+ {
+ 'id' : 'count',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.count'),
+ 'sort_type' : 'number',
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : false,
+ 'editable' : false, 'render' : function(my) { return my.count; }
+ },
+ {
+ 'id' : 'barcode',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.item_barcode'),
+ 'flex' : 2,
+ 'primary' : true,
+ 'hidden' : false,
+ 'editable' : false, 'render' : function(my) { return my.barcode; }
+ }
+ ];
+ if (modify) for (var i = 0; i < c.length; i++) {
+ if (modify[ c[i].id ]) {
+ for (var j in modify[ c[i].id ]) {
+ c[i][j] = modify[ c[i].id ][j];
+ }
+ }
+ }
+ if (params) {
+ if (params.just_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < params.just_these.length; i++) {
+ var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
+ new_c.push( function(y){ return y; }( x ) );
+ }
+ c = new_c;
+ }
+ if (params.except_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < c.length; i++) {
+ var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
+ if (!x) new_c.push(c[i]);
+ }
+ c = new_c;
+ }
+
+ }
+ return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
};
circ.util.columns = function(modify,params) {
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
- JSAN.use('util.network'); var network = new util.network();
- JSAN.use('util.money');
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+ JSAN.use('util.network'); var network = new util.network();
+ JSAN.use('util.money');
- var c = [
- {
- 'id' : 'acp_id',
+ var c = [
+ {
+ 'id' : 'acp_id',
'fm_class' : 'acp',
- 'label' : document.getElementById('commonStrings').getString('staff.acp_label_id'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.acp.id(); },
- 'persist' : 'hidden width ordinal'
- },
- {
- 'id' : 'circ_id',
+ 'label' : document.getElementById('commonStrings').getString('staff.acp_label_id'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.acp.id(); },
+ 'persist' : 'hidden width ordinal'
+ },
+ {
+ 'id' : 'circ_id',
'fm_class' : 'circ',
- 'label' : document.getElementById('commonStrings').getString('staff.circ_label_id'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.circ ? my.circ.id() : ( my.acp.circulations() ? my.acp.circulations()[0].id() : ""); },
- 'persist' : 'hidden width ordinal'
- },
- {
- 'id' : 'mvr_doc_id',
+ 'label' : document.getElementById('commonStrings').getString('staff.circ_label_id'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.circ ? my.circ.id() : ( my.acp.circulations() ? my.acp.circulations()[0].id() : ""); },
+ 'persist' : 'hidden width ordinal'
+ },
+ {
+ 'id' : 'mvr_doc_id',
'fm_class' : 'mvr',
- 'label' : document.getElementById('commonStrings').getString('staff.mvr_label_doc_id'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.mvr.doc_id(); },
- 'persist' : 'hidden width ordinal'
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'service',
- 'label' : 'Service',
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.service; }
- },
- {
- 'id' : 'barcode',
+ 'label' : document.getElementById('commonStrings').getString('staff.mvr_label_doc_id'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.mvr.doc_id(); },
+ 'persist' : 'hidden width ordinal'
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'service',
+ 'label' : 'Service',
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.service; }
+ },
+ {
+ 'id' : 'barcode',
'fm_class' : 'acp',
- 'label' : document.getElementById('commonStrings').getString('staff.acp_label_barcode'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.acp.barcode(); },
- 'persist' : 'hidden width ordinal'
- },
- {
- 'id' : 'call_number',
+ 'label' : document.getElementById('commonStrings').getString('staff.acp_label_barcode'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.acp.barcode(); },
+ 'persist' : 'hidden width ordinal'
+ },
+ {
+ 'id' : 'call_number',
'fm_class' : 'acp',
- 'label' : document.getElementById('commonStrings').getString('staff.acp_label_call_number'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.acp && my.acp.call_number() == -1) {
- return document.getElementById('circStrings').getString('staff.circ.utils.not_cataloged');
- } else if (my.acp && my.acp.call_number() == -2) {
- return document.getElementById('circStrings').getString('staff.circ.utils.retrieving');
- } else {
- if (!my.acn) {
- var x = network.simple_request("FM_ACN_RETRIEVE.authoritative",[ my.acp.call_number() ]);
- if (x.ilsevent) {
- return document.getElementById('circStrings').getString('staff.circ.utils.not_cataloged');
- } else {
- my.acn = x; return x.label();
- }
- } else {
- return my.acn.label();
- }
- }
- },
- 'persist' : 'hidden width ordinal'
- },
- {
- 'id' : 'owning_lib',
+ 'label' : document.getElementById('commonStrings').getString('staff.acp_label_call_number'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (my.acp && my.acp.call_number() == -1) {
+ return document.getElementById('circStrings').getString('staff.circ.utils.not_cataloged');
+ } else if (my.acp && my.acp.call_number() == -2) {
+ return document.getElementById('circStrings').getString('staff.circ.utils.retrieving');
+ } else {
+ if (!my.acn) {
+ var x = network.simple_request("FM_ACN_RETRIEVE.authoritative",[ my.acp.call_number() ]);
+ if (x.ilsevent) {
+ return document.getElementById('circStrings').getString('staff.circ.utils.not_cataloged');
+ } else {
+ my.acn = x; return x.label();
+ }
+ } else {
+ return my.acn.label();
+ }
+ }
+ },
+ 'persist' : 'hidden width ordinal'
+ },
+ {
+ 'id' : 'owning_lib',
'fm_class' : 'acn',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.owning_lib'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (Number(my.acn.owning_lib())>=0) {
- return data.hash.aou[ my.acn.owning_lib() ].shortname();
- } else {
- return my.acn.owning_lib().shortname();
- }
- },
- 'persist' : 'hidden width ordinal'
- },
- {
- 'id' : 'copy_number',
- 'fm_class' : 'acp',
- 'label' : document.getElementById('commonStrings').getString('staff.acp_label_copy_number'),
- 'flex' : 1,
- 'sort_type' : 'number',
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.acp.copy_number(); },
- 'persist' : 'hidden width ordinal'
- },
- {
- 'id' : 'location',
- 'fm_class' : 'acp',
- 'label' : document.getElementById('commonStrings').getString('staff.acp_label_location'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (Number(my.acp.location())>=0) {
- return data.lookup("acpl", my.acp.location() ).name();
- } else {
- return my.acp.location().name();
- }
- },
- 'persist' : 'hidden width ordinal'
- },
- {
- 'id' : 'loan_duration',
- 'fm_class' : 'acp',
- 'label' : document.getElementById('commonStrings').getString('staff.acp_label_loan_duration'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- switch(Number(my.acp.loan_duration())) {
- case 1:
- return document.getElementById('circStrings').getString('staff.circ.utils.loan_duration.short');
- break;
- case 2:
- return document.getElementById('circStrings').getString('staff.circ.utils.loan_duration.normal');
- break;
- case 3:
- return document.getElementById('circStrings').getString('staff.circ.utils.loan_duration.long');
- break;
- };
- },
- 'persist' : 'hidden width ordinal'
- },
- {
- 'id' : 'circ_lib',
- 'fm_class' : 'acp',
- 'label' : document.getElementById('commonStrings').getString('staff.acp_label_circ_lib'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (Number(my.acp.circ_lib())>=0) {
- return data.hash.aou[ my.acp.circ_lib() ].shortname();
- } else {
- return my.acp.circ_lib().shortname();
- }
- },
- 'persist' : 'hidden width ordinal'
- },
- {
- 'id' : 'fine_level',
- 'fm_class' : 'acp',
- 'label' : document.getElementById('commonStrings').getString('staff.acp_label_fine_level'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- switch(Number(my.acp.fine_level())) {
- case 1:
- return document.getElementById('circStrings').getString('staff.circ.utils.fine_level.low');
- break;
- case 2:
- return document.getElementById('circStrings').getString('staff.circ.utils.fine_level.normal');
- break;
- case 3:
- return document.getElementById('circStrings').getString('staff.circ.utils.fine_level.high');
- break;
- };
- },
- 'persist' : 'hidden width ordinal'
- },
- {
- 'id' : 'circulate',
- 'fm_class' : 'acp',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.circulate'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (get_bool( my.acp.circulate() )) {
- return document.getElementById('circStrings').getString('staff.circ.utils.yes');
- } else {
- return document.getElementById('circStrings').getString('staff.circ.utils.no');
- }
- },
- 'persist' : 'hidden width ordinal'
- },
- {
- 'id' : 'deleted',
- 'fm_class' : 'acp',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.deleted'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (get_bool( my.acp.deleted() )) {
- return document.getElementById('circStrings').getString('staff.circ.utils.yes');
- } else {
- return document.getElementById('circStrings').getString('staff.circ.utils.no');
- }
- },
- 'persist' : 'hidden width ordinal'
- },
- {
- 'id' : 'holdable',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.owning_lib'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (Number(my.acn.owning_lib())>=0) {
+ return data.hash.aou[ my.acn.owning_lib() ].shortname();
+ } else {
+ return my.acn.owning_lib().shortname();
+ }
+ },
+ 'persist' : 'hidden width ordinal'
+ },
+ {
+ 'id' : 'copy_number',
'fm_class' : 'acp',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.holdable'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (get_bool( my.acp.holdable() )) {
- return document.getElementById('circStrings').getString('staff.circ.utils.yes');
- } else {
- return document.getElementById('circStrings').getString('staff.circ.utils.no');
- }
- },
- 'persist' : 'hidden width ordinal'
- },
- {
- 'id' : 'opac_visible',
+ 'label' : document.getElementById('commonStrings').getString('staff.acp_label_copy_number'),
+ 'flex' : 1,
+ 'sort_type' : 'number',
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.acp.copy_number(); },
+ 'persist' : 'hidden width ordinal'
+ },
+ {
+ 'id' : 'location',
'fm_class' : 'acp',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.opac_visible'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (get_bool( my.acp.opac_visible() )) {
- return document.getElementById('circStrings').getString('staff.circ.utils.yes');
- } else {
- return document.getElementById('circStrings').getString('staff.circ.utils.no');
- }
- },
- 'persist' : 'hidden width ordinal'
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'label' : document.getElementById('commonStrings').getString('staff.acp_label_location'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (Number(my.acp.location())>=0) {
+ return data.lookup("acpl", my.acp.location() ).name();
+ } else {
+ return my.acp.location().name();
+ }
+ },
+ 'persist' : 'hidden width ordinal'
+ },
+ {
+ 'id' : 'loan_duration',
'fm_class' : 'acp',
- 'id' : 'ref',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.reference'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (get_bool( my.acp.ref() )) {
- return document.getElementById('circStrings').getString('staff.circ.utils.yes');
- } else {
- return document.getElementById('circStrings').getString('staff.circ.utils.no');
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'label' : document.getElementById('commonStrings').getString('staff.acp_label_loan_duration'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ switch(Number(my.acp.loan_duration())) {
+ case 1:
+ return document.getElementById('circStrings').getString('staff.circ.utils.loan_duration.short');
+ break;
+ case 2:
+ return document.getElementById('circStrings').getString('staff.circ.utils.loan_duration.normal');
+ break;
+ case 3:
+ return document.getElementById('circStrings').getString('staff.circ.utils.loan_duration.long');
+ break;
+ };
+ },
+ 'persist' : 'hidden width ordinal'
+ },
+ {
+ 'id' : 'circ_lib',
'fm_class' : 'acp',
- 'id' : 'deposit',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.deposit'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (get_bool( my.acp.deposit() )) {
- return document.getElementById('circStrings').getString('staff.circ.utils.yes');
- } else {
- return document.getElementById('circStrings').getString('staff.circ.utils.no');
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'label' : document.getElementById('commonStrings').getString('staff.acp_label_circ_lib'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (Number(my.acp.circ_lib())>=0) {
+ return data.hash.aou[ my.acp.circ_lib() ].shortname();
+ } else {
+ return my.acp.circ_lib().shortname();
+ }
+ },
+ 'persist' : 'hidden width ordinal'
+ },
+ {
+ 'id' : 'fine_level',
'fm_class' : 'acp',
- 'id' : 'deposit_amount',
- 'label' : document.getElementById('commonStrings').getString('staff.acp_label_deposit_amount'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.acp.price() == null) {
- return document.getElementById('circStrings').getString('staff.circ.utils.unset');
- } else {
- return util.money.sanitize(my.acp.deposit_amount());
- }
- },
- 'sort_type' : 'money'
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'label' : document.getElementById('commonStrings').getString('staff.acp_label_fine_level'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ switch(Number(my.acp.fine_level())) {
+ case 1:
+ return document.getElementById('circStrings').getString('staff.circ.utils.fine_level.low');
+ break;
+ case 2:
+ return document.getElementById('circStrings').getString('staff.circ.utils.fine_level.normal');
+ break;
+ case 3:
+ return document.getElementById('circStrings').getString('staff.circ.utils.fine_level.high');
+ break;
+ };
+ },
+ 'persist' : 'hidden width ordinal'
+ },
+ {
+ 'id' : 'circulate',
'fm_class' : 'acp',
- 'id' : 'price',
- 'label' : document.getElementById('commonStrings').getString('staff.acp_label_price'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.acp.price() == null) {
- return document.getElementById('circStrings').getString('staff.circ.utils.unset');
- } else {
- return util.money.sanitize(my.acp.price());
- }
- },
- 'sort_type' : 'money'
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.circulate'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (get_bool( my.acp.circulate() )) {
+ return document.getElementById('circStrings').getString('staff.circ.utils.yes');
+ } else {
+ return document.getElementById('circStrings').getString('staff.circ.utils.no');
+ }
+ },
+ 'persist' : 'hidden width ordinal'
+ },
+ {
+ 'id' : 'deleted',
+ 'fm_class' : 'acp',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.deleted'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (get_bool( my.acp.deleted() )) {
+ return document.getElementById('circStrings').getString('staff.circ.utils.yes');
+ } else {
+ return document.getElementById('circStrings').getString('staff.circ.utils.no');
+ }
+ },
+ 'persist' : 'hidden width ordinal'
+ },
+ {
+ 'id' : 'holdable',
+ 'fm_class' : 'acp',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.holdable'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (get_bool( my.acp.holdable() )) {
+ return document.getElementById('circStrings').getString('staff.circ.utils.yes');
+ } else {
+ return document.getElementById('circStrings').getString('staff.circ.utils.no');
+ }
+ },
+ 'persist' : 'hidden width ordinal'
+ },
+ {
+ 'id' : 'opac_visible',
+ 'fm_class' : 'acp',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.opac_visible'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (get_bool( my.acp.opac_visible() )) {
+ return document.getElementById('circStrings').getString('staff.circ.utils.yes');
+ } else {
+ return document.getElementById('circStrings').getString('staff.circ.utils.no');
+ }
+ },
+ 'persist' : 'hidden width ordinal'
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'fm_class' : 'acp',
+ 'id' : 'ref',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.reference'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (get_bool( my.acp.ref() )) {
+ return document.getElementById('circStrings').getString('staff.circ.utils.yes');
+ } else {
+ return document.getElementById('circStrings').getString('staff.circ.utils.no');
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'fm_class' : 'acp',
+ 'id' : 'deposit',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.deposit'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (get_bool( my.acp.deposit() )) {
+ return document.getElementById('circStrings').getString('staff.circ.utils.yes');
+ } else {
+ return document.getElementById('circStrings').getString('staff.circ.utils.no');
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'fm_class' : 'acp',
+ 'id' : 'deposit_amount',
+ 'label' : document.getElementById('commonStrings').getString('staff.acp_label_deposit_amount'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (my.acp.price() == null) {
+ return document.getElementById('circStrings').getString('staff.circ.utils.unset');
+ } else {
+ return util.money.sanitize(my.acp.deposit_amount());
+ }
+ },
+ 'sort_type' : 'money'
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'acp',
- 'id' : 'circ_as_type',
- 'label' : document.getElementById('commonStrings').getString('staff.acp_label_circ_as_type'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.acp.circ_as_type(); }
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'id' : 'price',
+ 'label' : document.getElementById('commonStrings').getString('staff.acp_label_price'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (my.acp.price() == null) {
+ return document.getElementById('circStrings').getString('staff.circ.utils.unset');
+ } else {
+ return util.money.sanitize(my.acp.price());
+ }
+ },
+ 'sort_type' : 'money'
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'fm_class' : 'acp',
+ 'id' : 'circ_as_type',
+ 'label' : document.getElementById('commonStrings').getString('staff.acp_label_circ_as_type'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.acp.circ_as_type(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'acp',
- 'id' : 'circ_modifier',
- 'label' : document.getElementById('commonStrings').getString('staff.acp_label_circ_modifier'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.acp.circ_modifier(); }
- },
- {
- 'id' : 'status_changed_time',
+ 'id' : 'circ_modifier',
+ 'label' : document.getElementById('commonStrings').getString('staff.acp_label_circ_modifier'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.acp.circ_modifier(); }
+ },
+ {
+ 'id' : 'status_changed_time',
'fm_class' : 'acp',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.status_changed_time'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.acp.status_changed_time(); },
- 'persist' : 'hidden width ordinal'
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.status_changed_time'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.acp.status_changed_time(); },
+ 'persist' : 'hidden width ordinal'
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'circ',
- 'id' : 'checkout_lib',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.checkout_lib'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.circ) {
- return data.hash.aou[ my.circ.circ_lib() ].shortname();
- } else {
- if (my.acp.circulations()) {
- return data.hash.aou[ my.acp.circulations()[0].circ_lib() ].shortname();
- } else {
- return "";
- }
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'id' : 'checkout_lib',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.checkout_lib'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (my.circ) {
+ return data.hash.aou[ my.circ.circ_lib() ].shortname();
+ } else {
+ if (my.acp.circulations()) {
+ return data.hash.aou[ my.acp.circulations()[0].circ_lib() ].shortname();
+ } else {
+ return "";
+ }
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'circ',
- 'id' : 'xact_start_full',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.checkout_timestamp'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.circ) {
- return my.circ.xact_start();
- } else {
- if (my.acp.circulations()) {
- return my.acp.circulations()[0].xact_start();
- }
- else {
- return "";
- }
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'id' : 'xact_start_full',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.checkout_timestamp'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (my.circ) {
+ return my.circ.xact_start();
+ } else {
+ if (my.acp.circulations()) {
+ return my.acp.circulations()[0].xact_start();
+ }
+ else {
+ return "";
+ }
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'circ',
- 'id' : 'checkin_time_full',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.checkin_timestamp'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.circ) {
- return my.circ.checkin_time();
- } else {
- if (my.acp.circulations()) {
- return my.acp.circulations()[0].checkin_time();
- } else {
- return "";
- }
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'id' : 'checkin_time_full',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.checkin_timestamp'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (my.circ) {
+ return my.circ.checkin_time();
+ } else {
+ if (my.acp.circulations()) {
+ return my.acp.circulations()[0].checkin_time();
+ } else {
+ return "";
+ }
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'circ',
- 'id' : 'xact_start',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.xact_start'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.circ) {
- return my.circ.xact_start().substr(0,10);
- } else {
- if (my.acp.circulations()) {
- return my.acp.circulations()[0].xact_start().substr(0,10);
- } else {
- return "";
- }
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'id' : 'xact_start',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.xact_start'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (my.circ) {
+ return my.circ.xact_start().substr(0,10);
+ } else {
+ if (my.acp.circulations()) {
+ return my.acp.circulations()[0].xact_start().substr(0,10);
+ } else {
+ return "";
+ }
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'circ',
- 'id' : 'checkin_time',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.checkin_time'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.circ) {
- return my.circ.checkin_time().substr(0,10);
- } else {
- if (my.acp.circulations()) {
- return my.acp.circulations()[0].checkin_time().substr(0,10);
- } else {
- return "";
- }
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'id' : 'checkin_time',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.checkin_time'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (my.circ) {
+ return my.circ.checkin_time().substr(0,10);
+ } else {
+ if (my.acp.circulations()) {
+ return my.acp.circulations()[0].checkin_time().substr(0,10);
+ } else {
+ return "";
+ }
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'circ',
- 'id' : 'xact_finish',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.xact_finish'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.circ ? my.circ.xact_finish() : ( my.acp.circulations() ? my.acp.circulations()[0].xact_finish() : ""); },
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'id' : 'xact_finish',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.xact_finish'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.circ ? my.circ.xact_finish() : ( my.acp.circulations() ? my.acp.circulations()[0].xact_finish() : ""); },
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'circ',
- 'id' : 'due_date',
- 'label' : document.getElementById('commonStrings').getString('staff.circ_label_due_date'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.circ) {
- return my.circ.due_date().substr(0,10);
- } else {
- if (my.acp.circulations()) {
- return my.acp.circulations()[0].due_date().substr(0,10);
- } else {
- return "";
- }
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'id' : 'due_date',
+ 'label' : document.getElementById('commonStrings').getString('staff.circ_label_due_date'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (my.circ) {
+ return my.circ.due_date().substr(0,10);
+ } else {
+ if (my.acp.circulations()) {
+ return my.acp.circulations()[0].due_date().substr(0,10);
+ } else {
+ return "";
+ }
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'circ',
- 'id' : 'due_time',
- 'label' : document.getElementById('commonStrings').getString('staff.circ_label_due_time'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.circ) {
- return my.circ.due_date().substr(11,8);
- } else {
- if (my.acp.circulations()) {
- return my.acp.circulations()[0].due_date().substr(11,8);
- } else {
- return "";
- }
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'id' : 'due_time',
+ 'label' : document.getElementById('commonStrings').getString('staff.circ_label_due_time'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (my.circ) {
+ return my.circ.due_date().substr(11,8);
+ } else {
+ if (my.acp.circulations()) {
+ return my.acp.circulations()[0].due_date().substr(11,8);
+ } else {
+ return "";
+ }
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'acp',
- 'id' : 'create_date',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.create_date'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.acp.create_date().substr(0,10); }
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'id' : 'create_date',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.create_date'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.acp.create_date().substr(0,10); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'acp',
- 'id' : 'edit_date',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.edit_date'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.acp.edit_date().substr(0,10); }
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'id' : 'edit_date',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.edit_date'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.acp.edit_date().substr(0,10); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'mvr',
- 'id' : 'title',
- 'label' : document.getElementById('commonStrings').getString('staff.mvr_label_title'),
- 'flex' : 2,
- 'sort_type' : 'title',
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- try { return my.mvr.title(); }
- catch(E) { return my.acp.dummy_title(); }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'id' : 'title',
+ 'label' : document.getElementById('commonStrings').getString('staff.mvr_label_title'),
+ 'flex' : 2,
+ 'sort_type' : 'title',
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ try { return my.mvr.title(); }
+ catch(E) { return my.acp.dummy_title(); }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'mvr',
- 'id' : 'author',
- 'label' : document.getElementById('commonStrings').getString('staff.mvr_label_author'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- try { return my.mvr.author(); }
- catch(E) { return my.acp.dummy_author(); }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'id' : 'author',
+ 'label' : document.getElementById('commonStrings').getString('staff.mvr_label_author'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ try { return my.mvr.author(); }
+ catch(E) { return my.acp.dummy_author(); }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'mvr',
- 'id' : 'edition',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.edition'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.mvr.edition(); }
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'id' : 'edition',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.edition'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.mvr.edition(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'mvr',
- 'id' : 'isbn',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.isbn'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
+ 'id' : 'isbn',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.isbn'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
try { return my.mvr.isbn(); }
catch(E) { return my.acp.dummy_isbn(); }
}
- },
- {
- 'persist' : 'hidden width ordinal',
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'mvr',
- 'id' : 'pubdate',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.pubdate'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.mvr.pubdate(); }
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'id' : 'pubdate',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.pubdate'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.mvr.pubdate(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'mvr',
- 'id' : 'publisher',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.publisher'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.mvr.publisher(); }
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'id' : 'publisher',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.publisher'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.mvr.publisher(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'mvr',
- 'id' : 'tcn',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.tcn'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.mvr.tcn(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'fm_class' : 'circ',
- 'id' : 'renewal_remaining',
- 'label' : document.getElementById('commonStrings').getString('staff.circ_label_renewal_remaining'),
- 'flex' : 0,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.circ) {
- return my.circ.renewal_remaining();
- } else {
- if (my.acp.circulations()) {
- return my.acp.circulations()[0].renewal_remaining();
- } else {
- return "";
- }
- }
- },
- 'sort_type' : 'number'
- },
- {
- 'persist' : 'hidden width ordinal',
- 'fm_class' : 'circ',
- 'id' : 'stop_fines',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.stop_fines'),
- 'flex' : 0,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.circ) {
- return my.circ.stop_fines();
- } else {
- if (my.acp.circulations()) {
- return my.acp.circulations()[0].stop_fines();
- } else {
- return "";
- }
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'fm_class' : 'circ',
- 'id' : 'stop_fines_time',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.stop_fines_time'),
- 'flex' : 0,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.circ) {
- return my.circ.stop_fines_time();
- } else {
- if (my.acp.circulations()) {
- return my.acp.circulations()[0].stop_fines_time();
- } else {
- return "";
- }
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'fm_class' : 'acp',
- 'id' : 'status',
- 'label' : document.getElementById('commonStrings').getString('staff.acp_label_status'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (Number(my.acp.status())>=0) {
- return data.hash.ccs[ my.acp.status() ].name();
- } else {
- return my.acp.status().name();
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'route_to',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.route_to'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.route_to.toString(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'message',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.message'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.message.toString(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'uses',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.uses'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.uses; },
- 'sort_type' : 'number'
- },
- {
- 'persist' : 'hidden width ordinal',
+ 'id' : 'tcn',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.tcn'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.mvr.tcn(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'fm_class' : 'circ',
+ 'id' : 'renewal_remaining',
+ 'label' : document.getElementById('commonStrings').getString('staff.circ_label_renewal_remaining'),
+ 'flex' : 0,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (my.circ) {
+ return my.circ.renewal_remaining();
+ } else {
+ if (my.acp.circulations()) {
+ return my.acp.circulations()[0].renewal_remaining();
+ } else {
+ return "";
+ }
+ }
+ },
+ 'sort_type' : 'number'
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'fm_class' : 'circ',
+ 'id' : 'stop_fines',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.stop_fines'),
+ 'flex' : 0,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (my.circ) {
+ return my.circ.stop_fines();
+ } else {
+ if (my.acp.circulations()) {
+ return my.acp.circulations()[0].stop_fines();
+ } else {
+ return "";
+ }
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'fm_class' : 'circ',
+ 'id' : 'stop_fines_time',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.stop_fines_time'),
+ 'flex' : 0,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (my.circ) {
+ return my.circ.stop_fines_time();
+ } else {
+ if (my.acp.circulations()) {
+ return my.acp.circulations()[0].stop_fines_time();
+ } else {
+ return "";
+ }
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
'fm_class' : 'acp',
- 'id' : 'alert_message',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.alert_message'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.acp.alert_message(); }
- },
+ 'id' : 'status',
+ 'label' : document.getElementById('commonStrings').getString('staff.acp_label_status'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (Number(my.acp.status())>=0) {
+ return data.hash.ccs[ my.acp.status() ].name();
+ } else {
+ return my.acp.status().name();
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'route_to',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.route_to'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.route_to.toString(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'message',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.message'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.message.toString(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'uses',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.uses'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.uses; },
+ 'sort_type' : 'number'
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'fm_class' : 'acp',
+ 'id' : 'alert_message',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.alert_message'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.acp.alert_message(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'fm_class' : 'circ',
+ 'id' : 'checkin_workstation',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.checkin_workstation'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.circ ? ( typeof my.circ.checkin_workstation() == 'object' ? my.circ.checkin_workstation().name() : my.circ.checkin_workstation() ) : ( my.acp.circulations() ? ( typeof my.acp.circulations()[0].checkin_workstation() == 'object' ? my.acp.circulations().checkin_workstation().name() : my.acp.circulations().checkin_workstation() ) : ""); },
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'fm_class' : 'circ',
+ 'id' : 'checkin_scan_time',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.checkin_scan_time'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.circ ? my.circ.checkin_scan_time().substr(0,10) : ( my.acp.circulations() ? my.acp.circulations()[0].checkin_scan_time().substr(0,10) : ""); },
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'fm_class' : 'circ',
+ 'id' : 'checkin_scan_timestamp',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.checkin_scan_timestamp'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.circ ? my.circ.checkin_scan_time() : ( my.acp.circulations() ? my.acp.circulations()[0].checkin_scan_time() : ""); },
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'fm_class' : 'bre',
+ 'id' : 'creator',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.creator'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.bre ? (typeof my.bre.creator() == 'object' ? my.bre.creator().usrname() : '#' + my.bre.creator() ) : ''; }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'fm_class' : 'bre',
+ 'id' : 'editor',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.editor'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.bre ? (typeof my.bre.editor() == 'object' ? my.bre.editor().usrname() : '#' + my.bre.editor() ) : ''; }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'fm_class' : 'bre',
+ 'id' : 'create_date',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.create_date'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.bre ? my.bre.create_date() : ''; }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'fm_class' : 'bre',
+ 'id' : 'edit_date',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.edit_date'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.bre ? my.bre.edit_date() : ''; }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'fm_class' : 'bre',
+ 'id' : 'tcn_value',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.tcn'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.bre ? my.bre.tcn_value() : ''; }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'fm_class' : 'bre',
+ 'id' : 'tcn_source',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.tcn_source'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.bre ? my.bre.tcn_source() : ''; }
+ }
+
+ ];
+ for (var i = 0; i < c.length; i++) {
+ if (modify[ c[i].id ]) {
+ for (var j in modify[ c[i].id ]) {
+ c[i][j] = modify[ c[i].id ][j];
+ }
+ }
+ }
+ if (params) {
+ if (params.just_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < params.just_these.length; i++) {
+ var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
+ new_c.push( function(y){ return y; }( x ) );
+ }
+ c = new_c;
+ }
+ if (params.except_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < c.length; i++) {
+ var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
+ if (!x) new_c.push(c[i]);
+ }
+ c = new_c;
+ }
+ }
+ return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
+};
+
+circ.util.work_log_columns = function(modify,params) {
+
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+
+ var c = [
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'message',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.work_log_column.message'),
+ 'flex' : 3,
+ 'primary' : true,
+ 'hidden' : false,
+ 'editable' : false, 'render' : function(my) { return my.message; }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'when',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.work_log_column.when'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : false,
+ 'editable' : false, 'render' : function(my) { return String( my.when ); }
+ }
+
+ ];
+ for (var i = 0; i < c.length; i++) {
+ if (modify[ c[i].id ]) {
+ for (var j in modify[ c[i].id ]) {
+ c[i][j] = modify[ c[i].id ][j];
+ }
+ }
+ }
+ if (params) {
+ if (params.just_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < params.just_these.length; i++) {
+ var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
+ new_c.push( function(y){ return y; }( x ) );
+ }
+ c = new_c;
+ }
+ if (params.except_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < c.length; i++) {
+ var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
+ if (!x) new_c.push(c[i]);
+ }
+ c = new_c;
+ }
+
+ }
+ return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
+};
+
+circ.util.transit_columns = function(modify,params) {
+
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+
+ var c = [
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'transit_item_barcode',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.barcode'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.acp.barcode(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'transit_item_title',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.title'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ try { return my.mvr.title(); }
+ catch(E) { return my.acp.dummy_title(); }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'transit_item_author',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.author'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ try { return my.mvr.author(); }
+ catch(E) { return my.acp.dummy_author(); }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'transit_item_callnumber',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.callnumber'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.acn.label(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'transit_id',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_id'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.atc.id(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'transit_source',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_source'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : false,
+ 'editable' : false, 'render' : function(my) {
+ if (typeof my.atc.source() == "object") {
+ return my.atc.source().shortname();
+ } else {
+ return data.hash.aou[ my.atc.source() ].shortname();
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'transit_source_send_time',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_source_send_time'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : false,
+ 'editable' : false, 'render' : function(my) { return my.atc.source_send_time(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'transit_dest_lib',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_dest'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : false,
+ 'editable' : false, 'render' : function(my) {
+ if (typeof my.atc.dest() == "object") {
+ return my.atc.dest().shortname();
+ } else {
+ return data.hash.aou[ my.atc.dest() ].shortname();
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'transit_dest_recv_time',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_dest_recv_time'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : false,
+ 'editable' : false, 'render' : function(my) { return my.atc.dest_recv_time(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'transit_target_copy',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_target_copy'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.atc.target_copy(); }
+ },
+ ];
+ for (var i = 0; i < c.length; i++) {
+ if (modify[ c[i].id ]) {
+ for (var j in modify[ c[i].id ]) {
+ c[i][j] = modify[ c[i].id ][j];
+ }
+ }
+ }
+ if (params) {
+ if (params.just_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < params.just_these.length; i++) {
+ var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
+ new_c.push( function(y){ return y; }( x ) );
+ }
+ c = new_c;
+ }
+ if (params.except_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < c.length; i++) {
+ var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
+ if (!x) new_c.push(c[i]);
+ }
+ c = new_c;
+ }
+
+ }
+ return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
+};
+
+circ.util.hold_columns = function(modify,params) {
+
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+
+ var c = [
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'request_lib',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.request_lib'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (Number(my.ahr.request_lib())>=0) {
+ return data.hash.aou[ my.ahr.request_lib() ].name();
+ } else {
+ return my.ahr.request_lib().name();
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'request_lib_shortname',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.request_lib_shortname'),
+ 'flex' : 0,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (Number(my.ahr.request_lib())>=0) {
+ return data.hash.aou[ my.ahr.request_lib() ].shortname();
+ } else {
+ return my.ahr.request_lib().shortname();
+ }
+ }
+ },
+
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'request_timestamp',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.request_timestamp'),
+ 'flex' : 0,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.ahr.request_time().toString(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'request_time',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.request_time'),
+ 'flex' : 0,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.ahr.request_time().toString().substr(0,10); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'available_timestamp',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.available_timestamp'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (my.ahr.transit() && my.ahr.transit().dest_recv_time()) {
+ return my.ahr.transit().dest_recv_time().toString();
+ }
+ if (!my.ahr.transit() && my.ahr.capture_time()) {
+ return my.ahr.capture_time().toString();
+ }
+ return "";
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'available_time',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.available_time'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : false,
+ 'editable' : false, 'render' : function(my) {
+ if (my.ahr.transit() && my.ahr.transit().dest_recv_time()) {
+ return my.ahr.transit().dest_recv_time().toString().substr(0,10);
+ }
+ if (!my.ahr.transit() && my.ahr.capture_time()) {
+ return my.ahr.capture_time().toString().substr(0,10);
+ }
+ return "";
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'capture_timestamp',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.capture_timestamp'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.ahr.capture_time() ? my.ahr.capture_time().toString() : ""; }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'capture_time',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.capture_time'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.ahr.capture_time() ? my.ahr.capture_time().toString().substr(0,10) : ""; }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'status',
+ 'label' : document.getElementById('commonStrings').getString('staff.ahr_status_label'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : false,
+ 'editable' : false, 'render' : function(my) {
+ switch (Number(my.status)) {
+ case 1:
+ return document.getElementById('circStrings').getString('staff.circ.utils.hold_status.1');
+ break;
+ case 2:
+ return document.getElementById('circStrings').getString('staff.circ.utils.hold_status.2');
+ break;
+ case 3:
+ return document.getElementById('circStrings').getString('staff.circ.utils.hold_status.3');
+ break;
+ case 4:
+ return document.getElementById('circStrings').getString('staff.circ.utils.hold_status.4');
+ break;
+ case 5:
+ return document.getElementById('circStrings').getString('staff.circ.utils.hold_status.5');
+ break;
+ default:
+ return my.status;
+ break;
+ };
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'hold_type',
+ 'label' : document.getElementById('commonStrings').getString('staff.ahr_hold_type_label'),
+ 'flex' : 0,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.ahr.hold_type(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'frozen',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.active'),
+ 'flex' : 0,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (!get_bool( my.ahr.frozen() )) {
+ return document.getElementById('circStrings').getString('staff.circ.utils.yes');
+ } else {
+ return document.getElementById('circStrings').getString('staff.circ.utils.no');
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'thaw_date',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.thaw_date'),
+ 'flex' : 0,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (my.ahr.thaw_date() == null) {
+ return document.getElementById('circStrings').getString('staff.circ.utils.thaw_date.none');
+ } else {
+ return my.ahr.thaw_date().substr(0,10);
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'pickup_lib',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.pickup_lib'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (Number(my.ahr.pickup_lib())>=0) {
+ return data.hash.aou[ my.ahr.pickup_lib() ].name();
+ } else {
+ return my.ahr.pickup_lib().name();
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'pickup_lib_shortname',
+ 'label' : document.getElementById('commonStrings').getString('staff.ahr_pickup_lib_label'),
+ 'flex' : 0,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (Number(my.ahr.pickup_lib())>=0) {
+ return data.hash.aou[ my.ahr.pickup_lib() ].shortname();
+ } else {
+ return my.ahr.pickup_lib().shortname();
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'current_copy',
+ 'label' : document.getElementById('commonStrings').getString('staff.ahr_current_copy_label'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (my.acp) {
+ return my.acp.barcode();
+ } else {
+ return document.getElementById('circStrings').getString('staff.circ.utils.current_copy.none');
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'current_copy_location',
+ 'label' : document.getElementById('commonStrings').getString('staff.ahr_current_copy_location_label'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (!my.acp) { return ""; } else { if (Number(my.acp.location())>=0) return data.lookup("acpl", my.acp.location() ).name(); else return my.acp.location().name(); }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'email_notify',
+ 'label' : document.getElementById('commonStrings').getString('staff.ahr_email_notify_label'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) {
+ if (get_bool(my.ahr.email_notify())) {
+ return document.getElementById('circStrings').getString('staff.circ.utils.yes');
+ } else {
+ return document.getElementById('circStrings').getString('staff.circ.utils.no');
+ }
+ }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'expire_time',
+ 'label' : document.getElementById('commonStrings').getString('staff.ahr_expire_time_label'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.ahr.expire_time(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'expire_date',
+ 'label' : document.getElementById('commonStrings').getString('staff.ahr_expire_date_label'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.ahr.expire_time() ? my.ahr.expire_time().toString().substr(0,10) : ''; }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'fulfillment_time',
+ 'label' : document.getElementById('commonStrings').getString('staff.ahr_fulfillment_time_label'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.ahr.fulfillment_time(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'holdable_formats',
+ 'label' : document.getElementById('commonStrings').getString('staff.ahr_holdable_formats_label'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.ahr.holdable_formats(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'ahr_id',
+ 'label' : document.getElementById('commonStrings').getString('staff.ahr_id_label'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.ahr.id(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'phone_notify',
+ 'label' : document.getElementById('commonStrings').getString('staff.ahr_phone_notify_label'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.ahr.phone_notify(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'prev_check_time',
+ 'label' : document.getElementById('commonStrings').getString('staff.ahr_prev_check_time_label'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.ahr.prev_check_time(); }
+ },
{
'persist' : 'hidden width ordinal',
- 'fm_class' : 'circ',
- 'id' : 'checkin_workstation',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.checkin_workstation'),
+ 'id' : 'requestor',
+ 'label' : document.getElementById('commonStrings').getString('staff.ahr_requestor_label'),
'flex' : 1,
'primary' : false,
'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.circ ? ( typeof my.circ.checkin_workstation() == 'object' ? my.circ.checkin_workstation().name() : my.circ.checkin_workstation() ) : ( my.acp.circulations() ? ( typeof my.acp.circulations()[0].checkin_workstation() == 'object' ? my.acp.circulations().checkin_workstation().name() : my.acp.circulations().checkin_workstation() ) : ""); },
+ 'editable' : false, 'render' : function(my) { return my.ahr.requestor(); }
},
{
'persist' : 'hidden width ordinal',
- 'fm_class' : 'circ',
- 'id' : 'checkin_scan_time',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.checkin_scan_time'),
+ 'id' : 'selection_depth',
+ 'label' : document.getElementById('commonStrings').getString('staff.ahr_selection_depth_label'),
'flex' : 1,
'primary' : false,
'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.circ ? my.circ.checkin_scan_time().substr(0,10) : ( my.acp.circulations() ? my.acp.circulations()[0].checkin_scan_time().substr(0,10) : ""); },
+ 'editable' : false, 'render' : function(my) { return my.ahr.selection_depth(); }
},
{
'persist' : 'hidden width ordinal',
- 'fm_class' : 'circ',
- 'id' : 'checkin_scan_timestamp',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.checkin_scan_timestamp'),
+ 'id' : 'target',
+ 'label' : document.getElementById('commonStrings').getString('staff.ahr_target_label'),
'flex' : 1,
'primary' : false,
'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.circ ? my.circ.checkin_scan_time() : ( my.acp.circulations() ? my.acp.circulations()[0].checkin_scan_time() : ""); },
+ 'editable' : false, 'render' : function(my) { return my.ahr.target(); }
},
{
'persist' : 'hidden width ordinal',
- 'fm_class' : 'bre',
- 'id' : 'creator',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.creator'),
+ 'id' : 'usr',
+ 'label' : document.getElementById('commonStrings').getString('staff.ahr_usr_label'),
'flex' : 1,
'primary' : false,
'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.bre ? (typeof my.bre.creator() == 'object' ? my.bre.creator().usrname() : '#' + my.bre.creator() ) : ''; }
+ 'editable' : false, 'render' : function(my) { return my.ahr.usr(); }
},
{
'persist' : 'hidden width ordinal',
- 'fm_class' : 'bre',
- 'id' : 'editor',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.editor'),
+ 'id' : 'title',
+ 'label' : document.getElementById('commonStrings').getString('staff.mvr_label_title'),
'flex' : 1,
+ 'sort_type' : 'title',
'primary' : false,
'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.bre ? (typeof my.bre.editor() == 'object' ? my.bre.editor().usrname() : '#' + my.bre.editor() ) : ''; }
+ 'editable' : false, 'render' : function(my) {
+ if (my.mvr) {
+ return my.mvr.title();
+ } else {
+ return document.getElementById('circStrings').getString('staff.circ.utils.title.none');
+ }
+ }
},
{
'persist' : 'hidden width ordinal',
- 'fm_class' : 'bre',
- 'id' : 'create_date',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.create_date'),
+ 'id' : 'author',
+ 'label' : document.getElementById('commonStrings').getString('staff.mvr_label_author'),
'flex' : 1,
'primary' : false,
'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.bre ? my.bre.create_date() : ''; }
+ 'editable' : false, 'render' : function(my) {
+ if (my.mvr) {
+ return my.mvr.author();
+ } else {
+ return document.getElementById('circStrings').getString('staff.circ.utils.author.none');
+ }
+ }
},
{
'persist' : 'hidden width ordinal',
- 'fm_class' : 'bre',
- 'id' : 'edit_date',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.edit_date'),
+ 'id' : 'edition',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.edition'),
'flex' : 1,
'primary' : false,
'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.bre ? my.bre.edit_date() : ''; }
+ 'editable' : false, 'render' : function(my) { return my.mvr.edition(); }
},
{
'persist' : 'hidden width ordinal',
- 'fm_class' : 'bre',
- 'id' : 'tcn_value',
+ 'id' : 'isbn',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.isbn'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.mvr.isbn(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'pubdate',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.pubdate'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.mvr.pubdate(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'publisher',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.publisher'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.mvr.publisher(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'tcn',
'label' : document.getElementById('circStrings').getString('staff.circ.utils.tcn'),
'flex' : 1,
'primary' : false,
'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.bre ? my.bre.tcn_value() : ''; }
+ 'editable' : false, 'render' : function(my) { return my.mvr.tcn(); }
},
{
'persist' : 'hidden width ordinal',
- 'fm_class' : 'bre',
- 'id' : 'tcn_source',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.tcn_source'),
+ 'id' : 'notify_time',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.notify_time'),
'flex' : 1,
'primary' : false,
'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.bre ? my.bre.tcn_source() : ''; }
- }
-
- ];
- for (var i = 0; i < c.length; i++) {
- if (modify[ c[i].id ]) {
- for (var j in modify[ c[i].id ]) {
- c[i][j] = modify[ c[i].id ][j];
- }
- }
- }
- if (params) {
- if (params.just_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < params.just_these.length; i++) {
- var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
- new_c.push( function(y){ return y; }( x ) );
- }
- c = new_c;
- }
- if (params.except_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < c.length; i++) {
- var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
- if (!x) new_c.push(c[i]);
- }
- c = new_c;
- }
- }
- return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
-};
-
-circ.util.work_log_columns = function(modify,params) {
-
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
-
- var c = [
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'message',
- 'label' : document.getElementById('circStrings').getString('staff.circ.work_log_column.message'),
- 'flex' : 3,
- 'primary' : true,
- 'hidden' : false,
- 'editable' : false, 'render' : function(my) { return my.message; }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'when',
- 'label' : document.getElementById('circStrings').getString('staff.circ.work_log_column.when'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : false,
- 'editable' : false, 'render' : function(my) { return String( my.when ); }
- }
-
- ];
- for (var i = 0; i < c.length; i++) {
- if (modify[ c[i].id ]) {
- for (var j in modify[ c[i].id ]) {
- c[i][j] = modify[ c[i].id ][j];
- }
- }
- }
- if (params) {
- if (params.just_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < params.just_these.length; i++) {
- var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
- new_c.push( function(y){ return y; }( x ) );
- }
- c = new_c;
- }
- if (params.except_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < c.length; i++) {
- var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
- if (!x) new_c.push(c[i]);
- }
- c = new_c;
- }
-
- }
- return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
-};
-
-circ.util.transit_columns = function(modify,params) {
-
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
-
- var c = [
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'transit_item_barcode',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.barcode'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.acp.barcode(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'transit_item_title',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.title'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- try { return my.mvr.title(); }
- catch(E) { return my.acp.dummy_title(); }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'transit_item_author',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.author'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- try { return my.mvr.author(); }
- catch(E) { return my.acp.dummy_author(); }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'transit_item_callnumber',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.callnumber'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.acn.label(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'transit_id',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_id'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.atc.id(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'transit_source',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_source'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : false,
- 'editable' : false, 'render' : function(my) {
- if (typeof my.atc.source() == "object") {
- return my.atc.source().shortname();
- } else {
- return data.hash.aou[ my.atc.source() ].shortname();
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'transit_source_send_time',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_source_send_time'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : false,
- 'editable' : false, 'render' : function(my) { return my.atc.source_send_time(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'transit_dest_lib',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_dest'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : false,
- 'editable' : false, 'render' : function(my) {
- if (typeof my.atc.dest() == "object") {
- return my.atc.dest().shortname();
- } else {
- return data.hash.aou[ my.atc.dest() ].shortname();
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'transit_dest_recv_time',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_dest_recv_time'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : false,
- 'editable' : false, 'render' : function(my) { return my.atc.dest_recv_time(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'transit_target_copy',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_target_copy'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.atc.target_copy(); }
- },
- ];
- for (var i = 0; i < c.length; i++) {
- if (modify[ c[i].id ]) {
- for (var j in modify[ c[i].id ]) {
- c[i][j] = modify[ c[i].id ][j];
- }
- }
- }
- if (params) {
- if (params.just_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < params.just_these.length; i++) {
- var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
- new_c.push( function(y){ return y; }( x ) );
- }
- c = new_c;
- }
- if (params.except_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < c.length; i++) {
- var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
- if (!x) new_c.push(c[i]);
- }
- c = new_c;
- }
-
- }
- return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
-};
-
-circ.util.hold_columns = function(modify,params) {
-
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
-
- var c = [
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'request_lib',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.request_lib'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (Number(my.ahr.request_lib())>=0) {
- return data.hash.aou[ my.ahr.request_lib() ].name();
- } else {
- return my.ahr.request_lib().name();
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'request_lib_shortname',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.request_lib_shortname'),
- 'flex' : 0,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (Number(my.ahr.request_lib())>=0) {
- return data.hash.aou[ my.ahr.request_lib() ].shortname();
- } else {
- return my.ahr.request_lib().shortname();
- }
- }
- },
-
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'request_timestamp',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.request_timestamp'),
- 'flex' : 0,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.request_time().toString(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'request_time',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.request_time'),
- 'flex' : 0,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.request_time().toString().substr(0,10); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'available_timestamp',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.available_timestamp'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.ahr.transit() && my.ahr.transit().dest_recv_time()) {
- return my.ahr.transit().dest_recv_time().toString();
- }
- if (!my.ahr.transit() && my.ahr.capture_time()) {
- return my.ahr.capture_time().toString();
- }
- return "";
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'available_time',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.available_time'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : false,
- 'editable' : false, 'render' : function(my) {
- if (my.ahr.transit() && my.ahr.transit().dest_recv_time()) {
- return my.ahr.transit().dest_recv_time().toString().substr(0,10);
- }
- if (!my.ahr.transit() && my.ahr.capture_time()) {
- return my.ahr.capture_time().toString().substr(0,10);
- }
- return "";
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'capture_timestamp',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.capture_timestamp'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.capture_time() ? my.ahr.capture_time().toString() : ""; }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'capture_time',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.capture_time'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.capture_time() ? my.ahr.capture_time().toString().substr(0,10) : ""; }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'status',
- 'label' : document.getElementById('commonStrings').getString('staff.ahr_status_label'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : false,
- 'editable' : false, 'render' : function(my) {
- switch (Number(my.status)) {
- case 1:
- return document.getElementById('circStrings').getString('staff.circ.utils.hold_status.1');
- break;
- case 2:
- return document.getElementById('circStrings').getString('staff.circ.utils.hold_status.2');
- break;
- case 3:
- return document.getElementById('circStrings').getString('staff.circ.utils.hold_status.3');
- break;
- case 4:
- return document.getElementById('circStrings').getString('staff.circ.utils.hold_status.4');
- break;
- case 5:
- return document.getElementById('circStrings').getString('staff.circ.utils.hold_status.5');
- break;
- default:
- return my.status;
- break;
- };
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'hold_type',
- 'label' : document.getElementById('commonStrings').getString('staff.ahr_hold_type_label'),
- 'flex' : 0,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.hold_type(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'frozen',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.active'),
- 'flex' : 0,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (!get_bool( my.ahr.frozen() )) {
- return document.getElementById('circStrings').getString('staff.circ.utils.yes');
- } else {
- return document.getElementById('circStrings').getString('staff.circ.utils.no');
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'thaw_date',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.thaw_date'),
- 'flex' : 0,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.ahr.thaw_date() == null) {
- return document.getElementById('circStrings').getString('staff.circ.utils.thaw_date.none');
- } else {
- return my.ahr.thaw_date().substr(0,10);
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'pickup_lib',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.pickup_lib'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (Number(my.ahr.pickup_lib())>=0) {
- return data.hash.aou[ my.ahr.pickup_lib() ].name();
- } else {
- return my.ahr.pickup_lib().name();
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'pickup_lib_shortname',
- 'label' : document.getElementById('commonStrings').getString('staff.ahr_pickup_lib_label'),
- 'flex' : 0,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (Number(my.ahr.pickup_lib())>=0) {
- return data.hash.aou[ my.ahr.pickup_lib() ].shortname();
- } else {
- return my.ahr.pickup_lib().shortname();
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'current_copy',
- 'label' : document.getElementById('commonStrings').getString('staff.ahr_current_copy_label'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.acp) {
- return my.acp.barcode();
- } else {
- return document.getElementById('circStrings').getString('staff.circ.utils.current_copy.none');
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'current_copy_location',
- 'label' : document.getElementById('commonStrings').getString('staff.ahr_current_copy_location_label'),
- 'flex' : 1,
- 'primary' : false,
+ 'editable' : false, 'render' : function(my) { return my.ahr.notify_time(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'notify_count',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.notify_count'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.ahr.notify_count(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'transit_source',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_source'),
+ 'flex' : 1,
+ 'primary' : false,
'hidden' : true,
'editable' : false, 'render' : function(my) {
- if (!my.acp) { return ""; } else { if (Number(my.acp.location())>=0) return data.lookup("acpl", my.acp.location() ).name(); else return my.acp.location().name(); }
+ if (my.ahr.transit()) {
+ return data.hash.aou[ my.ahr.transit().source() ].shortname();
+ } else {
+ return "";
+ }
}
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'email_notify',
- 'label' : document.getElementById('commonStrings').getString('staff.ahr_email_notify_label'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (get_bool(my.ahr.email_notify())) {
- return document.getElementById('circStrings').getString('staff.circ.utils.yes');
- } else {
- return document.getElementById('circStrings').getString('staff.circ.utils.no');
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'expire_time',
- 'label' : document.getElementById('commonStrings').getString('staff.ahr_expire_time_label'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.expire_time(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'expire_date',
- 'label' : document.getElementById('commonStrings').getString('staff.ahr_expire_date_label'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.expire_time() ? my.ahr.expire_time().toString().substr(0,10) : ''; }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'fulfillment_time',
- 'label' : document.getElementById('commonStrings').getString('staff.ahr_fulfillment_time_label'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.fulfillment_time(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'holdable_formats',
- 'label' : document.getElementById('commonStrings').getString('staff.ahr_holdable_formats_label'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.holdable_formats(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'ahr_id',
- 'label' : document.getElementById('commonStrings').getString('staff.ahr_id_label'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.id(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'phone_notify',
- 'label' : document.getElementById('commonStrings').getString('staff.ahr_phone_notify_label'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.phone_notify(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'prev_check_time',
- 'label' : document.getElementById('commonStrings').getString('staff.ahr_prev_check_time_label'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.prev_check_time(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'requestor',
- 'label' : document.getElementById('commonStrings').getString('staff.ahr_requestor_label'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.requestor(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'selection_depth',
- 'label' : document.getElementById('commonStrings').getString('staff.ahr_selection_depth_label'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.selection_depth(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'target',
- 'label' : document.getElementById('commonStrings').getString('staff.ahr_target_label'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.target(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'usr',
- 'label' : document.getElementById('commonStrings').getString('staff.ahr_usr_label'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.usr(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'title',
- 'label' : document.getElementById('commonStrings').getString('staff.mvr_label_title'),
- 'flex' : 1,
- 'sort_type' : 'title',
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.mvr) {
- return my.mvr.title();
- } else {
- return document.getElementById('circStrings').getString('staff.circ.utils.title.none');
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'author',
- 'label' : document.getElementById('commonStrings').getString('staff.mvr_label_author'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.mvr) {
- return my.mvr.author();
- } else {
- return document.getElementById('circStrings').getString('staff.circ.utils.author.none');
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'edition',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.edition'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.mvr.edition(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'isbn',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.isbn'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.mvr.isbn(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'pubdate',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.pubdate'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.mvr.pubdate(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'publisher',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.publisher'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.mvr.publisher(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'tcn',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.tcn'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.mvr.tcn(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'notify_time',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.notify_time'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.notify_time(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'notify_count',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.notify_count'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.notify_count(); }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'transit_source',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_source'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) {
- if (my.ahr.transit()) {
- return data.hash.aou[ my.ahr.transit().source() ].shortname();
- } else {
- return "";
- }
- }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'transit_source_send_time',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_source_send_time'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.transit() ? my.ahr.transit().source_send_time() : ""; }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'transit_dest_lib',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_dest'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.transit() ? data.hash.aou[ my.ahr.transit().dest() ].shortname() : ""; }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'transit_dest_recv_time',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_dest_recv_time'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahr.transit() ? my.ahr.transit().dest_recv_time() : ""; }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'patron_barcode',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.patron_barcode'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.patron_barcode ? my.patron_barcode : ""; }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'patron_family_name',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.patron_family_name'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.patron_family_name ? my.patron_family_name : ""; }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'patron_first_given_name',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.patron_first_given_name'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.patron_first_given_name ? my.patron_first_given_name : ""; }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'callnumber',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.callnumber'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.acn.label(); }
- },
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'transit_source_send_time',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_source_send_time'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.ahr.transit() ? my.ahr.transit().source_send_time() : ""; }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'transit_dest_lib',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_dest'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.ahr.transit() ? data.hash.aou[ my.ahr.transit().dest() ].shortname() : ""; }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'transit_dest_recv_time',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.transit_dest_recv_time'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.ahr.transit() ? my.ahr.transit().dest_recv_time() : ""; }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'patron_barcode',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.offline.patron_barcode'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.patron_barcode ? my.patron_barcode : ""; }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'patron_family_name',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.patron_family_name'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.patron_family_name ? my.patron_family_name : ""; }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'patron_first_given_name',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.patron_first_given_name'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.patron_first_given_name ? my.patron_first_given_name : ""; }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'callnumber',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.callnumber'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.acn.label(); }
+ },
{
- 'persist' : 'hidden width ordinal',
- 'id' : 'total_holds',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.total_holds'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.total_holds; }
- },
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'total_holds',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.total_holds'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.total_holds; }
+ },
{
- 'persist' : 'hidden width ordinal',
- 'id' : 'queue_position',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.queue_position'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.queue_position; }
- },
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'queue_position',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.queue_position'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.queue_position; }
+ },
{
- 'persist' : 'hidden width ordinal',
- 'id' : 'potential_copies',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.potential_copies'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.potential_copies; }
- },
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'potential_copies',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.potential_copies'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.potential_copies; }
+ },
{
- 'persist' : 'hidden width ordinal',
- 'id' : 'estimated_wait',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.estimated_wait'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.estimated_wait; }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'hold_note',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.hold_note'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'editable' : false, 'render' : function(my) { return my.ahrn_count; }
- },
- {
- 'persist' : 'hidden width ordinal',
- 'id' : 'staff_hold',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.staff_hold'),
- 'flex' : 1,
- 'primary' : false,
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'estimated_wait',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.estimated_wait'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.estimated_wait; }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'hold_note',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.hold_note'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'editable' : false, 'render' : function(my) { return my.ahrn_count; }
+ },
+ {
+ 'persist' : 'hidden width ordinal',
+ 'id' : 'staff_hold',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.staff_hold'),
+ 'flex' : 1,
+ 'primary' : false,
'hidden' : true,
'editable' : false,
'render' : function(my) {
@@ -2109,108 +2109,108 @@ circ.util.hold_columns = function(modify,params) {
}
}
];
- for (var i = 0; i < c.length; i++) {
- if (modify[ c[i].id ]) {
- for (var j in modify[ c[i].id ]) {
- c[i][j] = modify[ c[i].id ][j];
- }
- }
- }
- if (params) {
- if (params.just_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < params.just_these.length; i++) {
- var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
- new_c.push( function(y){ return y; }( x ) );
- }
- c = new_c;
- }
- if (params.except_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < c.length; i++) {
- var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
- if (!x) new_c.push(c[i]);
- }
- c = new_c;
- }
-
- }
- return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
+ for (var i = 0; i < c.length; i++) {
+ if (modify[ c[i].id ]) {
+ for (var j in modify[ c[i].id ]) {
+ c[i][j] = modify[ c[i].id ][j];
+ }
+ }
+ }
+ if (params) {
+ if (params.just_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < params.just_these.length; i++) {
+ var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
+ new_c.push( function(y){ return y; }( x ) );
+ }
+ c = new_c;
+ }
+ if (params.except_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < c.length; i++) {
+ var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
+ if (!x) new_c.push(c[i]);
+ }
+ c = new_c;
+ }
+
+ }
+ return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
};
/*
circ.util.std_map_row_to_column = function(error_value) {
- return function(row,col) {
- // row contains { 'my' : { 'acp' : {}, 'circ' : {}, 'mvr' : {} } }
- // col contains one of the objects listed above in columns
-
- // mimicking some of the obj in circ.checkin and circ.checkout where map_row_to_column is usually defined
- var obj = {};
- JSAN.use('util.error'); obj.error = new util.error();
- JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
- JSAN.use('util.network'); obj.network = new util.network();
- JSAN.use('util.money');
-
- var my = row.my;
- var value;
- try {
- value = eval( col.render );
- } catch(E) {
- obj.error.sdump('D_WARN','map_row_to_column: ' + E);
- if (error_value) value = error_value; else value = ' ';
- }
- return value;
- }
+ return function(row,col) {
+ // row contains { 'my' : { 'acp' : {}, 'circ' : {}, 'mvr' : {} } }
+ // col contains one of the objects listed above in columns
+
+ // mimicking some of the obj in circ.checkin and circ.checkout where map_row_to_column is usually defined
+ var obj = {};
+ JSAN.use('util.error'); obj.error = new util.error();
+ JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
+ JSAN.use('util.network'); obj.network = new util.network();
+ JSAN.use('util.money');
+
+ var my = row.my;
+ var value;
+ try {
+ value = eval( col.render );
+ } catch(E) {
+ obj.error.sdump('D_WARN','map_row_to_column: ' + E);
+ if (error_value) value = error_value; else value = ' ';
+ }
+ return value;
+ }
};
*/
circ.util.std_map_row_to_columns = function(error_value) {
- return function(row,cols) {
- // row contains { 'my' : { 'acp' : {}, 'circ' : {}, 'mvr' : {} } }
- // cols contains all of the objects listed above in columns
-
- var obj = {};
- JSAN.use('util.error'); obj.error = new util.error();
- JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
- JSAN.use('util.network'); obj.network = new util.network();
- JSAN.use('util.money');
-
- var my = row.my;
- var values = [];
- var cmd = '';
- try {
- for (var i = 0; i < cols.length; i++) {
- switch (typeof cols[i].render) {
- case 'function': try { values[i] = cols[i].render(my); } catch(E) { values[i] = error_value; obj.error.sdump('D_COLUMN_RENDER_ERROR',E); } break;
- case 'string' : cmd += 'try { ' + cols[i].render + '; values['+i+'] = v; } catch(E) { values['+i+'] = error_value; }'; break;
- default: cmd += 'values['+i+'] = "??? '+(typeof cols[i].render)+'"; ';
- }
- }
- if (cmd) eval( cmd );
- } catch(E) {
- obj.error.sdump('D_WARN','map_row_to_column: ' + E);
- if (error_value) { value = error_value; } else { value = ' ' };
- }
- return values;
- }
+ return function(row,cols) {
+ // row contains { 'my' : { 'acp' : {}, 'circ' : {}, 'mvr' : {} } }
+ // cols contains all of the objects listed above in columns
+
+ var obj = {};
+ JSAN.use('util.error'); obj.error = new util.error();
+ JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
+ JSAN.use('util.network'); obj.network = new util.network();
+ JSAN.use('util.money');
+
+ var my = row.my;
+ var values = [];
+ var cmd = '';
+ try {
+ for (var i = 0; i < cols.length; i++) {
+ switch (typeof cols[i].render) {
+ case 'function': try { values[i] = cols[i].render(my); } catch(E) { values[i] = error_value; obj.error.sdump('D_COLUMN_RENDER_ERROR',E); } break;
+ case 'string' : cmd += 'try { ' + cols[i].render + '; values['+i+'] = v; } catch(E) { values['+i+'] = error_value; }'; break;
+ default: cmd += 'values['+i+'] = "??? '+(typeof cols[i].render)+'"; ';
+ }
+ }
+ if (cmd) eval( cmd );
+ } catch(E) {
+ obj.error.sdump('D_WARN','map_row_to_column: ' + E);
+ if (error_value) { value = error_value; } else { value = ' ' };
+ }
+ return values;
+ }
};
circ.util.checkin_via_barcode = function(session,params,backdate,auto_print,async) {
- try {
- JSAN.use('util.error'); var error = new util.error();
- JSAN.use('util.network'); var network = new util.network();
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
- JSAN.use('util.date'); JSAN.use('util.functional');
+ try {
+ JSAN.use('util.error'); var error = new util.error();
+ JSAN.use('util.network'); var network = new util.network();
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+ JSAN.use('util.date'); JSAN.use('util.functional');
- if (backdate && (backdate == util.date.formatted_date(new Date(),'%Y-%m-%d')) ) backdate = null;
+ if (backdate && (backdate == util.date.formatted_date(new Date(),'%Y-%m-%d')) ) backdate = null;
- //var params = { 'barcode' : barcode };
- if (backdate) params.backdate = util.date.formatted_date(backdate + ' 00:00:00','%{iso8601}');
+ //var params = { 'barcode' : barcode };
+ if (backdate) params.backdate = util.date.formatted_date(backdate + ' 00:00:00','%{iso8601}');
- if (typeof params.disable_textbox == 'function') {
- try { params.disable_textbox(); }
- catch(E) { error.sdump('D_ERROR','params.disable_textbox() = ' + E); };
- }
+ if (typeof params.disable_textbox == 'function') {
+ try { params.disable_textbox(); }
+ catch(E) { error.sdump('D_ERROR','params.disable_textbox() = ' + E); };
+ }
function checkin_callback(req) {
JSAN.use('util.error'); var error = new util.error();
@@ -2220,8 +2220,8 @@ circ.util.checkin_via_barcode = function(session,params,backdate,auto_print,asyn
if (typeof params.checkin_result == 'function') {
try { params.checkin_result(r); } catch(E) { error.sdump('D_ERROR','params.checkin_result() = ' + E); };
}
- if (typeof async == 'function') async(check);
- return check;
+ if (typeof async == 'function') async(check);
+ return check;
} catch(E) {
error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.error', ['1']), E);
if (typeof params.enable_textbox == 'function') {
@@ -2232,78 +2232,78 @@ circ.util.checkin_via_barcode = function(session,params,backdate,auto_print,asyn
}
}
- var check = network.request(
- api.CHECKIN_VIA_BARCODE.app,
- api.CHECKIN_VIA_BARCODE.method,
- [ session, util.functional.filter_object( params, function(i,o) { return typeof o != 'function'; } ) ],
- async ? checkin_callback : null,
- {
- 'title' : document.getElementById('circStrings').getString('staff.circ.utils.checkin.override'),
- 'overridable_events' : [
+ var check = network.request(
+ api.CHECKIN_VIA_BARCODE.app,
+ api.CHECKIN_VIA_BARCODE.method,
+ [ session, util.functional.filter_object( params, function(i,o) { return typeof o != 'function'; } ) ],
+ async ? checkin_callback : null,
+ {
+ 'title' : document.getElementById('circStrings').getString('staff.circ.utils.checkin.override'),
+ 'overridable_events' : [
null /* custom event */,
- 1203 /* COPY_BAD_STATUS */,
- 1213 /* PATRON_BARRED */,
- 1217 /* PATRON_INACTIVE */,
- 1224 /* PATRON_ACCOUNT_EXPIRED */,
- 1234 /* ITEM_DEPOSIT_PAID */,
- 7009 /* CIRC_CLAIMS_RETURNED */,
- 7010 /* COPY_ALERT_MESSAGE */,
- 7011 /* COPY_STATUS_LOST */,
- 7012 /* COPY_STATUS_MISSING */,
- 7013 /* PATRON_EXCEEDS_FINES */,
- ],
- 'text' : {
- '1203' : function(r) {
- return typeof r.payload.status() == 'object' ? r.payload.status().name() : data.hash.ccs[ r.payload.status() ].name();
- },
- '1234' : function(r) {
- return document.getElementById('circStrings').getString('staff.circ.utils.checkin.override.item_deposit_paid.warning');
- },
- '7010' : function(r) {
- return r.payload;
- }
- }
- }
- );
- if (! async ) {
- return checkin_callback( { 'getResultObject' : function() { return check; } } );
- }
-
-
- } catch(E) {
- JSAN.use('util.error'); var error = new util.error();
- error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.error', ['2']), E);
- if (typeof params.enable_textbox == 'function') {
- try { params.enable_textbox(); } catch(E) { error.sdump('D_ERROR','params.disable_textbox() = ' + E); };
- }
- return null;
- }
+ 1203 /* COPY_BAD_STATUS */,
+ 1213 /* PATRON_BARRED */,
+ 1217 /* PATRON_INACTIVE */,
+ 1224 /* PATRON_ACCOUNT_EXPIRED */,
+ 1234 /* ITEM_DEPOSIT_PAID */,
+ 7009 /* CIRC_CLAIMS_RETURNED */,
+ 7010 /* COPY_ALERT_MESSAGE */,
+ 7011 /* COPY_STATUS_LOST */,
+ 7012 /* COPY_STATUS_MISSING */,
+ 7013 /* PATRON_EXCEEDS_FINES */,
+ ],
+ 'text' : {
+ '1203' : function(r) {
+ return typeof r.payload.status() == 'object' ? r.payload.status().name() : data.hash.ccs[ r.payload.status() ].name();
+ },
+ '1234' : function(r) {
+ return document.getElementById('circStrings').getString('staff.circ.utils.checkin.override.item_deposit_paid.warning');
+ },
+ '7010' : function(r) {
+ return r.payload;
+ }
+ }
+ }
+ );
+ if (! async ) {
+ return checkin_callback( { 'getResultObject' : function() { return check; } } );
+ }
+
+
+ } catch(E) {
+ JSAN.use('util.error'); var error = new util.error();
+ error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.error', ['2']), E);
+ if (typeof params.enable_textbox == 'function') {
+ try { params.enable_textbox(); } catch(E) { error.sdump('D_ERROR','params.disable_textbox() = ' + E); };
+ }
+ return null;
+ }
};
circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,check) {
- try {
- JSAN.use('util.error'); var error = new util.error();
- JSAN.use('util.network'); var network = new util.network();
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
- JSAN.use('util.date');
+ try {
+ JSAN.use('util.error'); var error = new util.error();
+ JSAN.use('util.network'); var network = new util.network();
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+ JSAN.use('util.date');
- error.sdump('D_DEBUG','check = ' + error.pretty_print( js2JSON( check ) ) );
+ error.sdump('D_DEBUG','check = ' + error.pretty_print( js2JSON( check ) ) );
- check.message = check.textcode;
+ check.message = check.textcode;
- if (check.payload && check.payload.copy) { check.copy = check.payload.copy; }
- if (check.payload && check.payload.record) { check.record = check.payload.record; }
- if (check.payload && check.payload.circ) { check.circ = check.payload.circ; }
- if (check.payload && check.payload.patron) { check.patron = check.payload.patron; }
+ if (check.payload && check.payload.copy) { check.copy = check.payload.copy; }
+ if (check.payload && check.payload.record) { check.record = check.payload.record; }
+ if (check.payload && check.payload.circ) { check.circ = check.payload.circ; }
+ if (check.payload && check.payload.patron) { check.patron = check.payload.patron; }
- if (!check.route_to) { check.route_to = ' '; }
+ if (!check.route_to) { check.route_to = ' '; }
- if (document.getElementById('no_change_label')) {
- document.getElementById('no_change_label').setAttribute('value','');
- document.getElementById('no_change_label').setAttribute('hidden','true');
- }
+ if (document.getElementById('no_change_label')) {
+ document.getElementById('no_change_label').setAttribute('value','');
+ document.getElementById('no_change_label').setAttribute('hidden','true');
+ }
- var msg = '';
+ var msg = '';
var print_list = [];
var print_data = {
'error' : '',
@@ -2343,59 +2343,59 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
'slip_date_msg' : ''
};
- if (check.payload && check.payload.cancelled_hold_transit) {
- print_data.cancelled = document.getElementById('circStrings').getString('staff.circ.utils.transit_hold_cancelled');
+ if (check.payload && check.payload.cancelled_hold_transit) {
+ print_data.cancelled = document.getElementById('circStrings').getString('staff.circ.utils.transit_hold_cancelled');
msg += print_data.cancelled;
- msg += '\n\n';
- }
-
- /* SUCCESS / NO_CHANGE / ITEM_NOT_CATALOGED */
- if (check.ilsevent == 0 || check.ilsevent == 3 || check.ilsevent == 1202) {
- try { check.route_to = data.lookup('acpl', check.copy.location() ).name(); }
- catch(E) {
- print_data.error_msg = document.getElementById('commonStrings').getString('common.error');
- print_data.error_msg += '\nFIXME: ' + E + '\n';
+ msg += '\n\n';
+ }
+
+ /* SUCCESS / NO_CHANGE / ITEM_NOT_CATALOGED */
+ if (check.ilsevent == 0 || check.ilsevent == 3 || check.ilsevent == 1202) {
+ try { check.route_to = data.lookup('acpl', check.copy.location() ).name(); }
+ catch(E) {
+ print_data.error_msg = document.getElementById('commonStrings').getString('common.error');
+ print_data.error_msg += '\nFIXME: ' + E + '\n';
msg += print_data.error_msg;
- }
- if (check.ilsevent == 3 /* NO_CHANGE */) {
- //msg = 'This item is already checked in.\n';
- if (document.getElementById('no_change_label')) {
- var m = document.getElementById('no_change_label').getAttribute('value');
- document.getElementById('no_change_label').setAttribute('value', m + document.getElementById('circStrings').getFormattedString('staff.circ.utils.item_checked_in', [params.barcode]) + ' ');
- document.getElementById('no_change_label').setAttribute('hidden','false');
- }
- }
- if (check.ilsevent == 1202 /* ITEM_NOT_CATALOGED */ && check.copy.status() != 11) {
- var copy_status = (data.hash.ccs[ check.copy.status() ] ? data.hash.ccs[ check.copy.status() ].name() : check.copy.status().name() );
- var err_msg = document.getElementById('commonStrings').getString('common.error');
- err_msg += '\nFIXME --';
- err_msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.item_not_cataloged', [copy_status]);
- err_msg += '\n';
+ }
+ if (check.ilsevent == 3 /* NO_CHANGE */) {
+ //msg = 'This item is already checked in.\n';
+ if (document.getElementById('no_change_label')) {
+ var m = document.getElementById('no_change_label').getAttribute('value');
+ document.getElementById('no_change_label').setAttribute('value', m + document.getElementById('circStrings').getFormattedString('staff.circ.utils.item_checked_in', [params.barcode]) + ' ');
+ document.getElementById('no_change_label').setAttribute('hidden','false');
+ }
+ }
+ if (check.ilsevent == 1202 /* ITEM_NOT_CATALOGED */ && check.copy.status() != 11) {
+ var copy_status = (data.hash.ccs[ check.copy.status() ] ? data.hash.ccs[ check.copy.status() ].name() : check.copy.status().name() );
+ var err_msg = document.getElementById('commonStrings').getString('common.error');
+ err_msg += '\nFIXME --';
+ err_msg += document.getElementById('circStrings').getFormattedString('staff.circ.utils.item_not_cataloged', [copy_status]);
+ err_msg += '\n';
msg += err_msg;
print_data.error_msg += err_msg;
- }
- switch(Number(check.copy.status())) {
- case 0: /* AVAILABLE */
- case 7: /* RESHELVING */
- if (msg) {
- print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
+ }
+ switch(Number(check.copy.status())) {
+ case 0: /* AVAILABLE */
+ case 7: /* RESHELVING */
+ if (msg) {
+ print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
print_data.route_to = check.route_to;
msg += print_data.route_to_msg;
- msg += '\n';
- }
- break;
- case 8: /* ON HOLDS SHELF */
+ msg += '\n';
+ }
+ break;
+ case 8: /* ON HOLDS SHELF */
check.route_to = document.getElementById('circStrings').getString('staff.circ.route_to.hold_shelf');
- if (check.payload.hold) {
- if (check.payload.hold.pickup_lib() != data.list.au[0].ws_ou()) {
- var err_msg = document.getElementById('commonStrings').getString('common.error');
- err_msg += '\nFIXME: ';
- err_msg += document.getElementById('circStrings').getString('staff.circ.utils.route_item_error');
- err_msg += '\n';
+ if (check.payload.hold) {
+ if (check.payload.hold.pickup_lib() != data.list.au[0].ws_ou()) {
+ var err_msg = document.getElementById('commonStrings').getString('common.error');
+ err_msg += '\nFIXME: ';
+ err_msg += document.getElementById('circStrings').getString('staff.circ.utils.route_item_error');
+ err_msg += '\n';
msg += err_msg;
print_data.error_msg += err_msg;
- } else {
- print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
+ } else {
+ print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
print_data.route_to = check.route_to;
var behind_the_desk_support = String( data.hash.aous['circ.holds.behind_desk_pickup_supported'] ) == 'true';
if (behind_the_desk_support) {
@@ -2412,62 +2412,62 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
}
}
msg += print_data.route_to_msg;
- msg += '\n';
- }
- } else {
- var err_msg = document.getElementById('commonStrings').getString('common.error');
- err_msg += '\nFIXME: ';
- err_msg += document.getElementById('circStrings').getString('staff.circ.utils.route_item_status_error');
- err_msg += '\n';
+ msg += '\n';
+ }
+ } else {
+ var err_msg = document.getElementById('commonStrings').getString('common.error');
+ err_msg += '\nFIXME: ';
+ err_msg += document.getElementById('circStrings').getString('staff.circ.utils.route_item_status_error');
+ err_msg += '\n';
msg += err_msg;
print_data.error_msg += err_msg;
- }
- JSAN.use('util.date');
- if (check.payload.hold) {
- JSAN.use('patron.util');
- msg += '\n';
- print_data.item_barcode_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.barcode', [check.payload.copy.barcode()]);
+ }
+ JSAN.use('util.date');
+ if (check.payload.hold) {
+ JSAN.use('patron.util');
+ msg += '\n';
+ print_data.item_barcode_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.barcode', [check.payload.copy.barcode()]);
print_data.item_barcode = check.payload.copy.barcode();
msg += print_data.item_barcode_msg;
- msg += '\n';
- var payload_title = (check.payload.record ? check.payload.record.title() : check.payload.copy.dummy_title() );
- print_data.item_title_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.title', [payload_title]);
+ msg += '\n';
+ var payload_title = (check.payload.record ? check.payload.record.title() : check.payload.copy.dummy_title() );
+ print_data.item_title_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.title', [payload_title]);
print_data.item_title = payload_title;
msg += print_data.item_title_msg;
- msg += '\n';
- var au_obj = patron.util.retrieve_fleshed_au_via_id( session, check.payload.hold.usr() );
+ msg += '\n';
+ var au_obj = patron.util.retrieve_fleshed_au_via_id( session, check.payload.hold.usr() );
print_data.user = au_obj;
- msg += '\n';
+ msg += '\n';
if (au_obj.alias()) {
- print_data.hold_for_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.patron_alias', [au_obj.alias()]);
+ print_data.hold_for_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.patron_alias', [au_obj.alias()]);
print_data.hold_for_alias = au_obj.alias();
msg += print_data.hold_for_msg;
} else {
- print_data.hold_for_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.patron', [au_obj.family_name() ? au_obj.family_name() : '', au_obj.first_given_name() ? au_obj.first_given_name() : '', au_obj.second_given_name() ? au_obj.second_given_name() : '']);
+ print_data.hold_for_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.patron', [au_obj.family_name() ? au_obj.family_name() : '', au_obj.first_given_name() ? au_obj.first_given_name() : '', au_obj.second_given_name() ? au_obj.second_given_name() : '']);
msg += print_data.hold_for_msg;
print_data.hold_for_family_name = au_obj.family_name() ? au_obj.family_name() : '';
print_data.hold_for_first_given_name = au_obj.first_given_name() ? au_obj.first_given_name() : '';
print_data.hold_for_second_given_name = au_obj.second_given_name() ? au_obj.second_given_name() : '';
}
- msg += '\n';
- print_data.user_barcode_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.barcode', [au_obj.card().barcode()]);
+ msg += '\n';
+ print_data.user_barcode_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.barcode', [au_obj.card().barcode()]);
print_data.user_barcode = au_obj.card().barcode();
msg += print_data.user_barcode_msg;
- msg += '\n';
- if (check.payload.hold.phone_notify()) {
- print_data.notify_by_phone_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.phone_notify', [check.payload.hold.phone_notify()]);
+ msg += '\n';
+ if (check.payload.hold.phone_notify()) {
+ print_data.notify_by_phone_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.phone_notify', [check.payload.hold.phone_notify()]);
print_data.notify_by_phone = check.payload.hold.phone_notify();
msg += print_data.notify_by_phone_msg;
- msg += '\n';
- }
- if (get_bool(check.payload.hold.email_notify())) {
- var payload_email = au_obj.email() ? au_obj.email() : '';
- print_data.notify_by_email_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.email_notify', [payload_email]);
+ msg += '\n';
+ }
+ if (get_bool(check.payload.hold.email_notify())) {
+ var payload_email = au_obj.email() ? au_obj.email() : '';
+ print_data.notify_by_email_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.email_notify', [payload_email]);
print_data.notify_by_email = payload_email;
msg += print_data.notify_by_email_msg;
- msg += '\n';
- }
- msg += '\n';
+ msg += '\n';
+ }
+ msg += '\n';
var notes = check.payload.hold.notes();
print_data.notes_raw = notes;
for (var i = 0; i < notes.length; i++) {
@@ -2490,14 +2490,14 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
);
}
}
- msg += '\n';
- msg += '\n';
+ msg += '\n';
+ msg += '\n';
print_data.request_date = util.date.formatted_date(check.payload.hold.request_time(),'%F');
- print_data.request_date_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.request_date', [print_data.request_date]);
+ print_data.request_date_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.request_date', [print_data.request_date]);
msg += print_data.request_date_msg;
- msg += '\n';
- }
- var rv = 0;
+ msg += '\n';
+ }
+ var rv = 0;
var no_print_prompting = data.hash.aous['circ.staff_client.do_not_auto_attempt_print'];
if (no_print_prompting) {
if (no_print_prompting.indexOf( "Hold Slip" ) > -1) {
@@ -2505,25 +2505,25 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
}
}
print_data.slip_date = util.date.formatted_date(new Date(),'%F');
- print_data.slip_date_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.slip_date', [print_data.slip_date]);
+ print_data.slip_date_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.slip_date', [print_data.slip_date]);
msg += print_data.slip_date_msg;
- msg += '\n';
+ msg += '\n';
print_data.payload = check.payload;
- if (!auto_print) {
- rv = error.yns_alert_formatted(
- msg,
- document.getElementById('circStrings').getString('staff.circ.utils.hold_slip'),
- document.getElementById('circStrings').getString('staff.circ.utils.hold_slip.print.yes'),
- document.getElementById('circStrings').getString('staff.circ.utils.hold_slip.print.no'),
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg'),
- '/xul/server/skin/media/images/turtle.gif'
- );
- }
- if (rv == 0) {
- try {
- JSAN.use('util.print'); var print = new util.print();
+ if (!auto_print) {
+ rv = error.yns_alert_formatted(
+ msg,
+ document.getElementById('circStrings').getString('staff.circ.utils.hold_slip'),
+ document.getElementById('circStrings').getString('staff.circ.utils.hold_slip.print.yes'),
+ document.getElementById('circStrings').getString('staff.circ.utils.hold_slip.print.no'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg'),
+ '/xul/server/skin/media/images/turtle.gif'
+ );
+ }
+ if (rv == 0) {
+ try {
+ JSAN.use('util.print'); var print = new util.print();
var old_template = String( data.hash.aous['ui.circ.old_harcoded_slip_template'] ) == 'true';
if (old_template) {
msg = msg.replace(/&/g, '&').replace(//g, '>').replace(/\n/g,' ');
@@ -2543,129 +2543,129 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
};
print.tree_list( params );
}
- } catch(E) {
- var err_msg = document.getElementById('commonStrings').getString('common.error');
- err_msg += '\nFIXME: ' + E + '\n';
- dump(err_msg);
- alert(err_msg);
- }
- }
- msg = '';
- if (document.getElementById('no_change_label')) {
- var m = document.getElementById('no_change_label').getAttribute('value');
- m += document.getElementById('circStrings').getFormattedString('staff.circ.utils.capture', [params.barcode]);
- document.getElementById('no_change_label').setAttribute('value', m);
- document.getElementById('no_change_label').setAttribute('hidden','false');
- }
- break;
- case 6: /* IN TRANSIT */
- check.route_to = 'TRANSIT SHELF??';
+ } catch(E) {
+ var err_msg = document.getElementById('commonStrings').getString('common.error');
+ err_msg += '\nFIXME: ' + E + '\n';
+ dump(err_msg);
+ alert(err_msg);
+ }
+ }
+ msg = '';
+ if (document.getElementById('no_change_label')) {
+ var m = document.getElementById('no_change_label').getAttribute('value');
+ m += document.getElementById('circStrings').getFormattedString('staff.circ.utils.capture', [params.barcode]);
+ document.getElementById('no_change_label').setAttribute('value', m);
+ document.getElementById('no_change_label').setAttribute('hidden','false');
+ }
+ break;
+ case 6: /* IN TRANSIT */
+ check.route_to = 'TRANSIT SHELF??';
print_data.route_to;
- var err_msg = document.getElementById('commonStrings').getString('common.error');
- err_msg += "\nFIXME -- I didn't think we could get here.\n";
+ var err_msg = document.getElementById('commonStrings').getString('common.error');
+ err_msg += "\nFIXME -- I didn't think we could get here.\n";
print_data.error_msg += err_msg;
msg += err_msg;
- break;
- case 11: /* CATALOGING */
- check.route_to = 'CATALOGING';
+ break;
+ case 11: /* CATALOGING */
+ check.route_to = 'CATALOGING';
print_data.route_to;
- if (document.getElementById('do_not_alert_on_precat')) {
- var x = document.getElementById('do_not_alert_on_precat');
- if (x.getAttribute('checked') != 'true') {
- print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
+ if (document.getElementById('do_not_alert_on_precat')) {
+ var x = document.getElementById('do_not_alert_on_precat');
+ if (x.getAttribute('checked') != 'true') {
+ print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
msg += print_data.route_to_msg;
- }
- } else {
- print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
+ }
+ } else {
+ print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
msg += print_data.route_to_msg;
- }
- if (document.getElementById('no_change_label')) {
- var m = document.getElementById('no_change_label').getAttribute('value');
- var needs_cat = document.getElementById('circStrings').getFormattedString('staff.circ.utils.needs_cataloging', [params.barcode]);
- document.getElementById('no_change_label').setAttribute('value', m + needs_cat + ' ');
- document.getElementById('no_change_label').setAttribute('hidden','false');
- }
- break;
- default:
- msg += document.getElementById('commonStrings').getString('common.error');
- var copy_status = data.hash.ccs[check.copy.status()] ? data.hash.ccs[check.copy.status()].name() : check.copy.status().name();
- msg += '\n';
- var error_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.copy_status.error', [copy_status]);
+ }
+ if (document.getElementById('no_change_label')) {
+ var m = document.getElementById('no_change_label').getAttribute('value');
+ var needs_cat = document.getElementById('circStrings').getFormattedString('staff.circ.utils.needs_cataloging', [params.barcode]);
+ document.getElementById('no_change_label').setAttribute('value', m + needs_cat + ' ');
+ document.getElementById('no_change_label').setAttribute('hidden','false');
+ }
+ break;
+ default:
+ msg += document.getElementById('commonStrings').getString('common.error');
+ var copy_status = data.hash.ccs[check.copy.status()] ? data.hash.ccs[check.copy.status()].name() : check.copy.status().name();
+ msg += '\n';
+ var error_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.copy_status.error', [copy_status]);
print_data.error_msg += error_msg;
msg += error_msg;
- msg += '\n';
- print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
+ msg += '\n';
+ print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
msg += print_data.route_to_msg;
- break;
- }
- if (msg) {
- error.yns_alert(
- msg,
- document.getElementById('circStrings').getString('staff.circ.alert'),
- null,
- document.getElementById('circStrings').getString('staff.circ.utils.msg.ok'),
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg')
- );
- }
- } else /* ROUTE_ITEM */ if (check.ilsevent == 7000) {
-
- var lib = data.hash.aou[ check.org ];
- check.route_to = lib.shortname();
+ break;
+ }
+ if (msg) {
+ error.yns_alert(
+ msg,
+ document.getElementById('circStrings').getString('staff.circ.alert'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.utils.msg.ok'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg')
+ );
+ }
+ } else /* ROUTE_ITEM */ if (check.ilsevent == 7000) {
+
+ var lib = data.hash.aou[ check.org ];
+ check.route_to = lib.shortname();
print_data.route_to = check.route_to;
print_data.route_to_org = lib;
- print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.destination', [check.route_to]);
+ print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.destination', [check.route_to]);
print_data.route_to_org_fullname = lib.name();
msg += print_data.route_to_msg;
- msg += '\n\n';
- msg += lib.name();
- msg += '\n';
- try {
- if (lib.holds_address() ) {
- var a = network.simple_request('FM_AOA_RETRIEVE',[ lib.holds_address() ]);
- if (typeof a.ilsevent != 'undefined') throw(a);
- if (a.street1()) { msg += a.street1() + '\n'; print_data.street1 = a.street1(); }
- if (a.street2()) { msg += a.street2() + '\n'; print_data.street2 = a.street2(); }
- print_data.city_state_zip = (a.city() ? a.city() + ', ' : '') + (a.state() ? a.state() + ' ' : '') + (a.post_code() ? a.post_code() : '');
+ msg += '\n\n';
+ msg += lib.name();
+ msg += '\n';
+ try {
+ if (lib.holds_address() ) {
+ var a = network.simple_request('FM_AOA_RETRIEVE',[ lib.holds_address() ]);
+ if (typeof a.ilsevent != 'undefined') throw(a);
+ if (a.street1()) { msg += a.street1() + '\n'; print_data.street1 = a.street1(); }
+ if (a.street2()) { msg += a.street2() + '\n'; print_data.street2 = a.street2(); }
+ print_data.city_state_zip = (a.city() ? a.city() + ', ' : '') + (a.state() ? a.state() + ' ' : '') + (a.post_code() ? a.post_code() : '');
print_data.city = a.city();
print_data.state = a.state();
print_data.county = a.county();
print_data.country = a.country();
print_data.post_code = a.post_code();
msg += print_data.city_state_zip + '\n';
- } else {
- print_data.street1 = document.getElementById('circStrings').getString('staff.circ.utils.route_to.no_address');
+ } else {
+ print_data.street1 = document.getElementById('circStrings').getString('staff.circ.utils.route_to.no_address');
print_data.no_address = true;
msg += print_data.street1;
- msg += '\n';
- }
- } catch(E) {
- var err_msg = document.getElementById('circStrings').getString('staff.circ.utils.route_to.no_address.error');
+ msg += '\n';
+ }
+ } catch(E) {
+ var err_msg = document.getElementById('circStrings').getString('staff.circ.utils.route_to.no_address.error');
print_data.error_msg += err_msg + '\n';
- msg += err_msg + '\n';
- error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.utils.route_to.no_address.error'), E);
- }
- msg += '\n';
- print_data.item_barcode_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.barcode', [check.payload.copy.barcode()]);
+ msg += err_msg + '\n';
+ error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.utils.route_to.no_address.error'), E);
+ }
+ msg += '\n';
+ print_data.item_barcode_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.barcode', [check.payload.copy.barcode()]);
print_data.item_barcode = check.payload.copy.barcode();
msg += print_data.item_barcode_msg;
- msg += '\n';
- var payload_title = (check.payload.record ? check.payload.record.title() : check.payload.copy.dummy_title() );
- print_data.item_title_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.title', [payload_title]);
+ msg += '\n';
+ var payload_title = (check.payload.record ? check.payload.record.title() : check.payload.copy.dummy_title() );
+ print_data.item_title_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.title', [payload_title]);
print_data.item_title = payload_title;
msg += print_data.item_title_msg;
- msg += '\n';
- var payload_author = (check.payload.record ? check.payload.record.author() :check.payload.copy.dummy_author());
- print_data.item_author_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.author', [payload_author]);
+ msg += '\n';
+ var payload_author = (check.payload.record ? check.payload.record.author() :check.payload.copy.dummy_author());
+ print_data.item_author_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.author', [payload_author]);
print_data.item_author = payload_author;
msg += print_data.item_author_msg;
- msg += '\n';
- JSAN.use('util.date');
- if (check.payload.hold) {
- JSAN.use('patron.util');
- var au_obj = patron.util.retrieve_fleshed_au_via_id( session, check.payload.hold.usr() );
+ msg += '\n';
+ JSAN.use('util.date');
+ if (check.payload.hold) {
+ JSAN.use('patron.util');
+ var au_obj = patron.util.retrieve_fleshed_au_via_id( session, check.payload.hold.usr() );
print_data.user = au_obj;
- msg += '\n';
+ msg += '\n';
if (au_obj.alias()) {
print_data.hold_for_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.patron_alias', [au_obj.alias()]);
print_data.hold_for_alias = au_obj.alias();
@@ -2677,25 +2677,25 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
print_data.hold_for_first_given_name = au_obj.first_given_name() ? au_obj.first_given_name() : '';
print_data.hold_for_second_given_name = au_obj.second_given_name() ? au_obj.second_given_name() : '';
}
- msg += '\n';
+ msg += '\n';
print_data.user_barcode_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.barcode', [au_obj.card().barcode()]);
print_data.user_barcode = au_obj.card().barcode();
msg += print_data.user_barcode_msg;
- msg += '\n';
- if (check.payload.hold.phone_notify()) {
+ msg += '\n';
+ if (check.payload.hold.phone_notify()) {
print_data.notify_by_phone_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.phone_notify', [check.payload.hold.phone_notify()]);
print_data.notify_by_phone = check.payload.hold.phone_notify();
msg += print_data.notify_by_phone_msg;
- msg += '\n';
- }
- if (get_bool(check.payload.hold.email_notify())) {
- var payload_email = au_obj.email() ? au_obj.email() : '';
+ msg += '\n';
+ }
+ if (get_bool(check.payload.hold.email_notify())) {
+ var payload_email = au_obj.email() ? au_obj.email() : '';
print_data.notify_by_email_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.email_notify', [payload_email]);
print_data.notify_by_email = payload_email;
msg += print_data.notify_by_email_msg;
- msg += '\n';
- }
- msg += '\n';
+ msg += '\n';
+ }
+ msg += '\n';
var notes = check.payload.hold.notes();
print_data.notes_raw = notes;
for (var i = 0; i < notes.length; i++) {
@@ -2723,9 +2723,9 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
print_data.request_date = util.date.formatted_date(check.payload.hold.request_time(),'%F');
print_data.request_date_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.hold.request_date', [print_data.request_date]);
msg += print_data.request_date_msg;
- msg += '\n';
- }
- var rv = 0;
+ msg += '\n';
+ }
+ var rv = 0;
var no_print_prompting = data.hash.aous['circ.staff_client.do_not_auto_attempt_print'];
if (no_print_prompting) {
if (no_print_prompting.indexOf( check.payload.hold ? "Hold/Transit Slip" : "Transit Slip" ) > -1) {
@@ -2737,20 +2737,20 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
msg += print_data.slip_date_msg;
print_data.payload = check.payload;
- if (!auto_print) {
- rv = error.yns_alert_formatted(
- msg,
- document.getElementById('circStrings').getString('staff.circ.utils.transit_slip'),
- document.getElementById('circStrings').getString('staff.circ.utils.transit_slip.print.yes'),
- document.getElementById('circStrings').getString('staff.circ.utils.transit_slip.print.no'),
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg'),
- '/xul/server/skin/media/images/turtle.gif'
- );
- }
- if (rv == 0) {
- try {
- JSAN.use('util.print'); var print = new util.print();
+ if (!auto_print) {
+ rv = error.yns_alert_formatted(
+ msg,
+ document.getElementById('circStrings').getString('staff.circ.utils.transit_slip'),
+ document.getElementById('circStrings').getString('staff.circ.utils.transit_slip.print.yes'),
+ document.getElementById('circStrings').getString('staff.circ.utils.transit_slip.print.no'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg'),
+ '/xul/server/skin/media/images/turtle.gif'
+ );
+ }
+ if (rv == 0) {
+ try {
+ JSAN.use('util.print'); var print = new util.print();
var old_template = String( data.hash.aous['ui.circ.old_harcoded_slip_template'] ) == 'true';
if (old_template) {
msg = msg.replace(/&/g, '&').replace(//g, '>').replace(/\n/g,' ');
@@ -2770,111 +2770,111 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
};
print.tree_list( params );
}
- } catch(E) {
- var err_msg = document.getElementById('commonStrings').getString('common.error');
- err_msg += '\nFIXME: ' + E + '\n';
- dump(err_msg);
- alert(err_msg);
- }
- }
- if (document.getElementById('no_change_label')) {
- var m = document.getElementById('no_change_label').getAttribute('value');
- var trans_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.in_transit', [params.barcode]);
- document.getElementById('no_change_label').setAttribute('value', m + trans_msg + ' ');
- document.getElementById('no_change_label').setAttribute('hidden','false');
- }
-
- } else /* ASSET_COPY_NOT_FOUND */ if (check.ilsevent == 1502) {
-
- check.route_to = 'CATALOGING';
- var mis_scan_msg = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.status.copy_not_found', [params.barcode]);
- error.yns_alert(
- mis_scan_msg,
- document.getElementById('circStrings').getString('staff.circ.alert'),
- null,
- document.getElementById('circStrings').getString('staff.circ.utils.msg.ok'),
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg')
- );
- if (document.getElementById('no_change_label')) {
- var m = document.getElementById('no_change_label').getAttribute('value');
- document.getElementById('no_change_label').setAttribute('value',m + mis_scan_msg + ' ');
- document.getElementById('no_change_label').setAttribute('hidden','false');
- }
-
- } else /* HOLD_CAPTURE_DELAYED */ if (check.ilsevent == 7019) {
-
- var rv = 0;
- msg += document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.description');
- rv = error.yns_alert_formatted(
- msg,
- document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.titlebar'),
- document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.prompt_for_nocapture'),
- document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.prompt_for_capture'),
- null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg'),
- '/xul/server/skin/media/images/stop_sign.png'
- );
- params.capture = rv == 0 ? 'nocapture' : 'capture';
-
- return circ.util.checkin_via_barcode(session,params,backdate,auto_print,false);
-
- } else /* NETWORK TIMEOUT */ if (check.ilsevent == -1) {
- error.standard_network_error_alert(document.getElementById('circStrings').getString('staff.circ.checkin.suggest_offline'));
- } else {
+ } catch(E) {
+ var err_msg = document.getElementById('commonStrings').getString('common.error');
+ err_msg += '\nFIXME: ' + E + '\n';
+ dump(err_msg);
+ alert(err_msg);
+ }
+ }
+ if (document.getElementById('no_change_label')) {
+ var m = document.getElementById('no_change_label').getAttribute('value');
+ var trans_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.payload.in_transit', [params.barcode]);
+ document.getElementById('no_change_label').setAttribute('value', m + trans_msg + ' ');
+ document.getElementById('no_change_label').setAttribute('hidden','false');
+ }
+
+ } else /* ASSET_COPY_NOT_FOUND */ if (check.ilsevent == 1502) {
+
+ check.route_to = 'CATALOGING';
+ var mis_scan_msg = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.status.copy_not_found', [params.barcode]);
+ error.yns_alert(
+ mis_scan_msg,
+ document.getElementById('circStrings').getString('staff.circ.alert'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.utils.msg.ok'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg')
+ );
+ if (document.getElementById('no_change_label')) {
+ var m = document.getElementById('no_change_label').getAttribute('value');
+ document.getElementById('no_change_label').setAttribute('value',m + mis_scan_msg + ' ');
+ document.getElementById('no_change_label').setAttribute('hidden','false');
+ }
+
+ } else /* HOLD_CAPTURE_DELAYED */ if (check.ilsevent == 7019) {
+
+ var rv = 0;
+ msg += document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.description');
+ rv = error.yns_alert_formatted(
+ msg,
+ document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.titlebar'),
+ document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.prompt_for_nocapture'),
+ document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.prompt_for_capture'),
+ null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg'),
+ '/xul/server/skin/media/images/stop_sign.png'
+ );
+ params.capture = rv == 0 ? 'nocapture' : 'capture';
+
+ return circ.util.checkin_via_barcode(session,params,backdate,auto_print,false);
+
+ } else /* NETWORK TIMEOUT */ if (check.ilsevent == -1) {
+ error.standard_network_error_alert(document.getElementById('circStrings').getString('staff.circ.checkin.suggest_offline'));
+ } else {
if (check.ilsevent == null) { return null; /* handled */ }
- switch (Number(check.ilsevent)) {
- case 1203 /* COPY_BAD_STATUS */ :
- case 1213 /* PATRON_BARRED */ :
- case 1217 /* PATRON_INACTIVE */ :
- case 1224 /* PATRON_ACCOUNT_EXPIRED */ :
- case 1234 /* ITEM_DEPOSIT_PAID */ :
- case 7009 /* CIRC_CLAIMS_RETURNED */ :
- case 7010 /* COPY_ALERT_MESSAGE */ :
- case 7011 /* COPY_STATUS_LOST */ :
- case 7012 /* COPY_STATUS_MISSING */ :
- case 7013 /* PATRON_EXCEEDS_FINES */ :
- return null; /* handled */
- break;
- }
-
- throw(check);
-
- }
-
- return check;
- } catch(E) {
- JSAN.use('util.error'); var error = new util.error();
- error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.error', ['3']), E);
- return null;
- }
+ switch (Number(check.ilsevent)) {
+ case 1203 /* COPY_BAD_STATUS */ :
+ case 1213 /* PATRON_BARRED */ :
+ case 1217 /* PATRON_INACTIVE */ :
+ case 1224 /* PATRON_ACCOUNT_EXPIRED */ :
+ case 1234 /* ITEM_DEPOSIT_PAID */ :
+ case 7009 /* CIRC_CLAIMS_RETURNED */ :
+ case 7010 /* COPY_ALERT_MESSAGE */ :
+ case 7011 /* COPY_STATUS_LOST */ :
+ case 7012 /* COPY_STATUS_MISSING */ :
+ case 7013 /* PATRON_EXCEEDS_FINES */ :
+ return null; /* handled */
+ break;
+ }
+
+ throw(check);
+
+ }
+
+ return check;
+ } catch(E) {
+ JSAN.use('util.error'); var error = new util.error();
+ error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.error', ['3']), E);
+ return null;
+ }
};
circ.util.renew_via_barcode = function ( params, async ) {
- try {
- var obj = {};
- JSAN.use('util.network'); obj.network = new util.network();
- JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.stash_retrieve();
-
- function renew_callback(req) {
- try {
- JSAN.use('util.error'); var error = new util.error();
- var renew = req.getResultObject();
- if (typeof renew.ilsevent != 'undefined') renew = [ renew ];
- for (var j = 0; j < renew.length; j++) {
- switch(renew[j].ilsevent == null ? null : Number(renew[j].ilsevent)) {
- case 0 /* SUCCESS */ : break;
- case null /* custom event */ : break;
- case 5000 /* PERM_FAILURE */: break;
- case 1212 /* PATRON_EXCEEDS_OVERDUE_COUNT */ : break;
- case 1213 /* PATRON_BARRED */ : break;
- case 1215 /* CIRC_EXCEEDS_COPY_RANGE */ : break;
- case 1224 /* PATRON_ACCOUNT_EXPIRED */ : break;
+ try {
+ var obj = {};
+ JSAN.use('util.network'); obj.network = new util.network();
+ JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.stash_retrieve();
+
+ function renew_callback(req) {
+ try {
+ JSAN.use('util.error'); var error = new util.error();
+ var renew = req.getResultObject();
+ if (typeof renew.ilsevent != 'undefined') renew = [ renew ];
+ for (var j = 0; j < renew.length; j++) {
+ switch(renew[j].ilsevent == null ? null : Number(renew[j].ilsevent)) {
+ case 0 /* SUCCESS */ : break;
+ case null /* custom event */ : break;
+ case 5000 /* PERM_FAILURE */: break;
+ case 1212 /* PATRON_EXCEEDS_OVERDUE_COUNT */ : break;
+ case 1213 /* PATRON_BARRED */ : break;
+ case 1215 /* CIRC_EXCEEDS_COPY_RANGE */ : break;
+ case 1224 /* PATRON_ACCOUNT_EXPIRED */ : break;
case 1232 /* ITEM_DEPOSIT_REQUIRED */ : break;
case 1233 /* ITEM_RENTAL_FEE_REQUIRED */ : break;
- case 1234 /* ITEM_DEPOSIT_PAID */ : break;
- case 1500 /* ACTION_CIRCULATION_NOT_FOUND */ : break;
+ case 1234 /* ITEM_DEPOSIT_PAID */ : break;
+ case 1500 /* ACTION_CIRCULATION_NOT_FOUND */ : break;
case 1502 /* ASSET_COPY_NOT_FOUND */ :
var mis_scan_msg = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.status.copy_not_found', [params.barcode]);
error.yns_alert(
@@ -2891,91 +2891,91 @@ circ.util.renew_via_barcode = function ( params, async ) {
document.getElementById('no_change_label').setAttribute('hidden','false');
}
break;
- case 7002 /* PATRON_EXCEEDS_CHECKOUT_COUNT */ : break;
- case 7003 /* COPY_CIRC_NOT_ALLOWED */ : break;
- case 7004 /* COPY_NOT_AVAILABLE */ : break;
- case 7006 /* COPY_IS_REFERENCE */ : break;
- case 7007 /* COPY_NEEDED_FOR_HOLD */ : break;
- case 7008 /* MAX_RENEWALS_REACHED */ : break;
- case 7009 /* CIRC_CLAIMS_RETURNED */ : break;
- case 7010 /* COPY_ALERT_MESSAGE */ : break;
- case 7013 /* PATRON_EXCEEDS_FINES */ : break;
- default:
- throw(renew);
- break;
- }
- }
- if (typeof async == 'function') async(renew);
- return renew;
- } catch(E) {
- JSAN.use('util.error'); var error = new util.error();
- error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.renew_failed.error', [params.barcode]), E);
- return null;
- }
- }
-
- var renew = obj.network.simple_request(
- 'CHECKOUT_RENEW',
- [ ses(), params ],
- async ? renew_callback : null,
- {
- 'title' : document.getElementById('circStrings').getString('staff.circ.checkin.renew_failed.override'),
- 'overridable_events' : [
+ case 7002 /* PATRON_EXCEEDS_CHECKOUT_COUNT */ : break;
+ case 7003 /* COPY_CIRC_NOT_ALLOWED */ : break;
+ case 7004 /* COPY_NOT_AVAILABLE */ : break;
+ case 7006 /* COPY_IS_REFERENCE */ : break;
+ case 7007 /* COPY_NEEDED_FOR_HOLD */ : break;
+ case 7008 /* MAX_RENEWALS_REACHED */ : break;
+ case 7009 /* CIRC_CLAIMS_RETURNED */ : break;
+ case 7010 /* COPY_ALERT_MESSAGE */ : break;
+ case 7013 /* PATRON_EXCEEDS_FINES */ : break;
+ default:
+ throw(renew);
+ break;
+ }
+ }
+ if (typeof async == 'function') async(renew);
+ return renew;
+ } catch(E) {
+ JSAN.use('util.error'); var error = new util.error();
+ error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.renew_failed.error', [params.barcode]), E);
+ return null;
+ }
+ }
+
+ var renew = obj.network.simple_request(
+ 'CHECKOUT_RENEW',
+ [ ses(), params ],
+ async ? renew_callback : null,
+ {
+ 'title' : document.getElementById('circStrings').getString('staff.circ.checkin.renew_failed.override'),
+ 'overridable_events' : [
null /* custom event */,
- 1212 /* PATRON_EXCEEDS_OVERDUE_COUNT */,
- 1213 /* PATRON_BARRED */,
- 1215 /* CIRC_EXCEEDS_COPY_RANGE */,
+ 1212 /* PATRON_EXCEEDS_OVERDUE_COUNT */,
+ 1213 /* PATRON_BARRED */,
+ 1215 /* CIRC_EXCEEDS_COPY_RANGE */,
1232 /* ITEM_DEPOSIT_REQUIRED */,
1233 /* ITEM_RENTAL_FEE_REQUIRED */,
- 1234 /* ITEM_DEPOSIT_PAID */,
- 7002 /* PATRON_EXCEEDS_CHECKOUT_COUNT */,
- 7003 /* COPY_CIRC_NOT_ALLOWED */,
- 7004 /* COPY_NOT_AVAILABLE */,
- 7006 /* COPY_IS_REFERENCE */,
- 7007 /* COPY_NEEDED_FOR_HOLD */,
- 7008 /* MAX_RENEWALS_REACHED */,
- 7009 /* CIRC_CLAIMS_RETURNED */,
- 7010 /* COPY_ALERT_MESSAGE */,
- 7013 /* PATRON_EXCEEDS_FINES */,
- ],
- 'text' : {
- '1212' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
- '1213' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
- '1215' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
+ 1234 /* ITEM_DEPOSIT_PAID */,
+ 7002 /* PATRON_EXCEEDS_CHECKOUT_COUNT */,
+ 7003 /* COPY_CIRC_NOT_ALLOWED */,
+ 7004 /* COPY_NOT_AVAILABLE */,
+ 7006 /* COPY_IS_REFERENCE */,
+ 7007 /* COPY_NEEDED_FOR_HOLD */,
+ 7008 /* MAX_RENEWALS_REACHED */,
+ 7009 /* CIRC_CLAIMS_RETURNED */,
+ 7010 /* COPY_ALERT_MESSAGE */,
+ 7013 /* PATRON_EXCEEDS_FINES */,
+ ],
+ 'text' : {
+ '1212' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
+ '1213' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
+ '1215' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
'1232' : function(r) {
return document.getElementById('circStrings').getFormattedString('staff.circ.renew.override.item_deposit_required.warning.barcode', [params.barcode]);
},
'1233' : function(r) {
return document.getElementById('circStrings').getFormattedString('staff.circ.renew.override.item_rental_fee_required.warning.barcode', [params.barcode]);
},
- '1234' : function(r) {
- return document.getElementById('circStrings').getFormattedString('staff.circ.utils.checkin.override.item_deposit_paid.warning');
- },
- '7002' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
- '7003' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
- '7004' : function(r) {
- return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode.status', [params.barcode, typeof r.payload.status() == 'object' ? r.payload.status().name() : obj.data.hash.ccs[ r.payload.status() ].name()]);
- },
- '7006' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
- '7007' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
- '7008' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
- '7009' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
- '7010' : function(r) {
- return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode.msg', [params.barcode, r.payload]);
- },
- '7013' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); }
- }
- }
- );
- if (! async ) {
- return renew_callback( { 'getResultObject' : function() { return renew; } } );
- }
-
- } catch(E) {
- JSAN.use('util.error'); var error = new util.error();
- error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.renew_failed.error', [params.barcode]), E);
- return null;
- }
+ '1234' : function(r) {
+ return document.getElementById('circStrings').getFormattedString('staff.circ.utils.checkin.override.item_deposit_paid.warning');
+ },
+ '7002' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
+ '7003' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
+ '7004' : function(r) {
+ return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode.status', [params.barcode, typeof r.payload.status() == 'object' ? r.payload.status().name() : obj.data.hash.ccs[ r.payload.status() ].name()]);
+ },
+ '7006' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
+ '7007' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
+ '7008' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
+ '7009' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); },
+ '7010' : function(r) {
+ return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode.msg', [params.barcode, r.payload]);
+ },
+ '7013' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); }
+ }
+ }
+ );
+ if (! async ) {
+ return renew_callback( { 'getResultObject' : function() { return renew; } } );
+ }
+
+ } catch(E) {
+ JSAN.use('util.error'); var error = new util.error();
+ error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.renew_failed.error', [params.barcode]), E);
+ return null;
+ }
};
dump('exiting circ/util.js\n');
diff --git a/Open-ILS/xul/staff_client/server/main/verify_credentials.js b/Open-ILS/xul/staff_client/server/main/verify_credentials.js
index 72c768b9ff..3d2a4848f2 100644
--- a/Open-ILS/xul/staff_client/server/main/verify_credentials.js
+++ b/Open-ILS/xul/staff_client/server/main/verify_credentials.js
@@ -12,7 +12,7 @@ function verify_init() {
JSAN.errorLevel = "die"; // none, warn, or die
JSAN.addRepository('..');
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
XML_HTTP_SERVER = data.server_unadorned;
JSAN.use('util.network'); var net = new util.network();
diff --git a/Open-ILS/xul/staff_client/server/patron/bills.js b/Open-ILS/xul/staff_client/server/patron/bills.js
index 82f3c0d0e9..6e6f5e2391 100644
--- a/Open-ILS/xul/staff_client/server/patron/bills.js
+++ b/Open-ILS/xul/staff_client/server/patron/bills.js
@@ -5,675 +5,675 @@ function $(id) { return document.getElementById(id); }
if (typeof patron == 'undefined') patron = {};
patron.bills = function (params) {
- var obj = this;
- try { JSAN.use('util.error'); obj.error = new util.error(); } catch(E) { alert(E); }
- try { JSAN.use('util.network'); obj.network = new util.network(); } catch(E) { alert(E); }
- try {
- obj.OpenILS = {}; JSAN.use('OpenILS.data'); obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
- obj.data = obj.OpenILS.data;
- obj.data.voided_billings = []; obj.data.stash('voided_billings');
- } catch(E) {
- alert(E);
- }
+ var obj = this;
+ try { JSAN.use('util.error'); obj.error = new util.error(); } catch(E) { alert(E); }
+ try { JSAN.use('util.network'); obj.network = new util.network(); } catch(E) { alert(E); }
+ try {
+ obj.OpenILS = {}; JSAN.use('OpenILS.data'); obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
+ obj.data = obj.OpenILS.data;
+ obj.data.voided_billings = []; obj.data.stash('voided_billings');
+ } catch(E) {
+ alert(E);
+ }
}
patron.bills.prototype = {
- 'bill_map' : {},
+ 'bill_map' : {},
- 'current_payments' : [],
+ 'current_payments' : [],
- 'SHOW_ME_THE_BILLS' : 'FM_MOBTS_HAVING_BALANCE.authoritative',
+ 'SHOW_ME_THE_BILLS' : 'FM_MOBTS_HAVING_BALANCE.authoritative',
- 'refresh' : function(dont_show_me_the_money) {
- var obj = this;
- try {
+ 'refresh' : function(dont_show_me_the_money) {
+ var obj = this;
+ try {
if (document.getElementById('circulating_hint')) {
document.getElementById('circulating_hint').hidden = true;
}
- obj.bills = obj.network.simple_request(
- obj.SHOW_ME_THE_BILLS,
- [ ses(), obj.patron_id ]
- );
+ obj.bills = obj.network.simple_request(
+ obj.SHOW_ME_THE_BILLS,
+ [ ses(), obj.patron_id ]
+ );
if (typeof obj.bills.ilsevent != 'undefined' || typeof obj.bills == 'null') { throw(obj.bills); }
- for (var i = 0; i < obj.bills.length; i++) {
- if (instanceOf(obj.bills[i],mobts)) {
- obj.bills[i] = { 'transaction' : obj.bills[i] }
- } else if (instanceOf(obj.bills[i],mbts)) {
- obj.bills[i] = { 'transaction' : obj.bills[i] }
- } else {
- var robj = obj.network.simple_request('FM_MBTS_RETRIEVE.authoritative',[ses(),obj.bills[i]]);
- //alert('refresh robj = ' + js2JSON(robj));
- obj.bills[i] = { 'transaction' : robj }
- }
- }
-
- if (!dont_show_me_the_money) {
- //alert('dont_show_me_the_money = ' + dont_show_me_the_money);
- if (window.xulG && typeof window.xulG.on_money_change == 'function') {
- try { window.xulG.on_money_change(obj.bills); } catch(E) { this.error.sdump('D_ERROR',E); }
- }
- }
-
- var tbs = document.getElementsByTagName('textbox');
- for (var i = 0; i < tbs.length; i++) {
- tbs[i].value = ''; tbs[i].setAttribute('value','');
- }
- obj.init();
- obj.controller.view.bill_payment_amount.focus();
- obj.distribute_payment(obj.controller.view.bill_payment_amount);
- obj.tally_selected();
- obj.tally_voided();
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> refresh',E);
- }
- },
-
- 'init' : function( params ) {
-
- var obj = this;
-
- try {
- obj.init_controller( params );
-
- obj.retrieve();
-
- var total_owed = 0;
-
- JSAN.use('util.money');
-
- obj.current_payments = []; obj.list.clear();
- //FIXME//.bills virtual field
- for (var i = 0; i < obj.bills.length; i++) {
- var rparams = obj.list.append(
- { 'row' :
- { 'my' :
- { 'mobts' : obj.bills[i].transaction, 'circ' : obj.bills[i].circ, 'mvr' : obj.bills[i].record }
- },
- 'attributes' : { 'allowevents' : true }
- }
- );
- var rnode = rparams.my_node;
- obj.bill_map[ obj.bills[i].transaction.id() ] = obj.bills[i];
- var cb = rnode.getElementsByTagName('checkbox')[0];
- var tb = rnode.getElementsByTagName('textbox')[0];
- var bo = obj.bills[i].transaction.balance_owed();
- total_owed += util.money.dollars_float_to_cents_integer( bo );
- var id = obj.bills[i].transaction.id();
- obj.current_payments.push( { 'mobts_id' : id, 'balance_owed' : bo, 'checkbox' : cb, 'textbox' : tb } );
- }
- obj.controller.view.bill_total_owed.value = util.money.cents_as_dollars( total_owed );
- obj.controller.view.bill_total_owed.setAttribute('value',obj.controller.view.bill_total_owed.value);
- obj.distribute_payment(obj.controller.view.bill_payment_amount);
- obj.controller.view.bill_payment_amount.select();
- obj.tally_selected();
- obj.tally_voided();
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> init',E);
- }
- },
-
- 'init_controller' : function( params ) {
-
- var obj = this;
-
- try {
- if (obj._controller_inited) return;
-
- obj.patron_id = obj.patron_id || params['patron_id'];
-
- JSAN.use('util.list'); obj.list = new util.list('bill_list');
-
- obj.list.init(
- {
- 'columns' : [
- /*
- {
- 'id' : 'xact_dates', 'label' : document.getElementById('commonStrings').getString('staff.bills_xact_dates_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'render' : 'obj.xact_dates_box(my.mobts)'
- },
- */
- {
- 'id' : 'notes', 'label' : document.getElementById('commonStrings').getString('staff.bills_information'), 'flex' : 2,
- 'primary' : false, 'hidden' : false, 'render' : 'obj.info_box(my)'
- },
- {
- 'id' : 'money', 'label' : $('patronStrings').getString('staff.patron.bills.init_controller.money_summary_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'render' : 'obj.money_box(my.mobts)'
- },
- {
- 'id' : 'current_pay', 'label' : document.getElementById('commonStrings').getString('staff.bills_current_payment_label'), 'flex' : 0,
- 'render' : 'obj.payment_box()'
- }
- ],
- 'map_row_to_column' : obj.gen_map_row_to_column()
- }
- );
-
- JSAN.use('util.controller'); obj.controller = new util.controller();
- obj.controller.init(
- {
- 'control_map' : {
- 'cmd_broken' : [
- ['command'],
- function() { alert($("commonStrings").getString('common.unimplemented')); }
- ],
- 'cmd_bill_wizard' : [
- ['command'],
- function() {
- try {
- JSAN.use('util.window');
- var win = new util.window();
- var my_xulG = win.open(
- urls.XUL_PATRON_BILL_WIZARD,
- //+ '?patron_id=' + window.escape(obj.patron_id),
- 'billwizard',
- 'chrome,resizable,modal',
- { 'patron_id' : obj.patron_id }
- );
- obj.refresh();
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> cmd_bill_wizard',E);
- }
- }
- ],
- 'cmd_bill_history' : [
- ['command'],
- function() {
- try {
+ for (var i = 0; i < obj.bills.length; i++) {
+ if (instanceOf(obj.bills[i],mobts)) {
+ obj.bills[i] = { 'transaction' : obj.bills[i] }
+ } else if (instanceOf(obj.bills[i],mbts)) {
+ obj.bills[i] = { 'transaction' : obj.bills[i] }
+ } else {
+ var robj = obj.network.simple_request('FM_MBTS_RETRIEVE.authoritative',[ses(),obj.bills[i]]);
+ //alert('refresh robj = ' + js2JSON(robj));
+ obj.bills[i] = { 'transaction' : robj }
+ }
+ }
+
+ if (!dont_show_me_the_money) {
+ //alert('dont_show_me_the_money = ' + dont_show_me_the_money);
+ if (window.xulG && typeof window.xulG.on_money_change == 'function') {
+ try { window.xulG.on_money_change(obj.bills); } catch(E) { this.error.sdump('D_ERROR',E); }
+ }
+ }
+
+ var tbs = document.getElementsByTagName('textbox');
+ for (var i = 0; i < tbs.length; i++) {
+ tbs[i].value = ''; tbs[i].setAttribute('value','');
+ }
+ obj.init();
+ obj.controller.view.bill_payment_amount.focus();
+ obj.distribute_payment(obj.controller.view.bill_payment_amount);
+ obj.tally_selected();
+ obj.tally_voided();
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> refresh',E);
+ }
+ },
+
+ 'init' : function( params ) {
+
+ var obj = this;
+
+ try {
+ obj.init_controller( params );
+
+ obj.retrieve();
+
+ var total_owed = 0;
+
+ JSAN.use('util.money');
+
+ obj.current_payments = []; obj.list.clear();
+ //FIXME//.bills virtual field
+ for (var i = 0; i < obj.bills.length; i++) {
+ var rparams = obj.list.append(
+ { 'row' :
+ { 'my' :
+ { 'mobts' : obj.bills[i].transaction, 'circ' : obj.bills[i].circ, 'mvr' : obj.bills[i].record }
+ },
+ 'attributes' : { 'allowevents' : true }
+ }
+ );
+ var rnode = rparams.my_node;
+ obj.bill_map[ obj.bills[i].transaction.id() ] = obj.bills[i];
+ var cb = rnode.getElementsByTagName('checkbox')[0];
+ var tb = rnode.getElementsByTagName('textbox')[0];
+ var bo = obj.bills[i].transaction.balance_owed();
+ total_owed += util.money.dollars_float_to_cents_integer( bo );
+ var id = obj.bills[i].transaction.id();
+ obj.current_payments.push( { 'mobts_id' : id, 'balance_owed' : bo, 'checkbox' : cb, 'textbox' : tb } );
+ }
+ obj.controller.view.bill_total_owed.value = util.money.cents_as_dollars( total_owed );
+ obj.controller.view.bill_total_owed.setAttribute('value',obj.controller.view.bill_total_owed.value);
+ obj.distribute_payment(obj.controller.view.bill_payment_amount);
+ obj.controller.view.bill_payment_amount.select();
+ obj.tally_selected();
+ obj.tally_voided();
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> init',E);
+ }
+ },
+
+ 'init_controller' : function( params ) {
+
+ var obj = this;
+
+ try {
+ if (obj._controller_inited) return;
+
+ obj.patron_id = obj.patron_id || params['patron_id'];
+
+ JSAN.use('util.list'); obj.list = new util.list('bill_list');
+
+ obj.list.init(
+ {
+ 'columns' : [
+ /*
+ {
+ 'id' : 'xact_dates', 'label' : document.getElementById('commonStrings').getString('staff.bills_xact_dates_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'render' : 'obj.xact_dates_box(my.mobts)'
+ },
+ */
+ {
+ 'id' : 'notes', 'label' : document.getElementById('commonStrings').getString('staff.bills_information'), 'flex' : 2,
+ 'primary' : false, 'hidden' : false, 'render' : 'obj.info_box(my)'
+ },
+ {
+ 'id' : 'money', 'label' : $('patronStrings').getString('staff.patron.bills.init_controller.money_summary_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'render' : 'obj.money_box(my.mobts)'
+ },
+ {
+ 'id' : 'current_pay', 'label' : document.getElementById('commonStrings').getString('staff.bills_current_payment_label'), 'flex' : 0,
+ 'render' : 'obj.payment_box()'
+ }
+ ],
+ 'map_row_to_column' : obj.gen_map_row_to_column()
+ }
+ );
+
+ JSAN.use('util.controller'); obj.controller = new util.controller();
+ obj.controller.init(
+ {
+ 'control_map' : {
+ 'cmd_broken' : [
+ ['command'],
+ function() { alert($("commonStrings").getString('common.unimplemented')); }
+ ],
+ 'cmd_bill_wizard' : [
+ ['command'],
+ function() {
+ try {
+ JSAN.use('util.window');
+ var win = new util.window();
+ var my_xulG = win.open(
+ urls.XUL_PATRON_BILL_WIZARD,
+ //+ '?patron_id=' + window.escape(obj.patron_id),
+ 'billwizard',
+ 'chrome,resizable,modal',
+ { 'patron_id' : obj.patron_id }
+ );
+ obj.refresh();
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> cmd_bill_wizard',E);
+ }
+ }
+ ],
+ 'cmd_bill_history' : [
+ ['command'],
+ function() {
+ try {
xulG.display_window.g.patron.right_deck.reset_iframe(
- urls.XUL_PATRON_BILL_HISTORY,
- {},
- {
- 'patron_id' : obj.patron_id,
- 'refresh' : function() { obj.refresh(); }
- }
- );
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> cmd_bill_history',E);
- }
- }
- ],
- 'cmd_alternate_view' : [
- ['command'],
- function() {
- try {
+ urls.XUL_PATRON_BILL_HISTORY,
+ {},
+ {
+ 'patron_id' : obj.patron_id,
+ 'refresh' : function() { obj.refresh(); }
+ }
+ );
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> cmd_bill_history',E);
+ }
+ }
+ ],
+ 'cmd_alternate_view' : [
+ ['command'],
+ function() {
+ try {
xulG.display_window.g.patron.right_deck.reset_iframe(
- urls.XUL_PATRON_BILL_ALTERNATE_VIEW,
+ urls.XUL_PATRON_BILL_ALTERNATE_VIEW,
{},
- {
- 'current' : 1,
- 'patron_id' : obj.patron_id,
- 'refresh' : function() { obj.refresh(); }
- }
- );
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> cmd_alternate_view',E);
- }
- }
- ],
+ {
+ 'current' : 1,
+ 'patron_id' : obj.patron_id,
+ 'refresh' : function() { obj.refresh(); }
+ }
+ );
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> cmd_alternate_view',E);
+ }
+ }
+ ],
'cmd_print_bills' : [
['command'],
function() {
- try {
- obj.print_bills();
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> cmd_print_bills',E);
- }
+ try {
+ obj.print_bills();
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> cmd_print_bills',E);
+ }
}
],
- 'cmd_change_to_credit' : [
- ['command'],
- function() {
- try {
- obj.change_to_credit();
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> cmd_change_to_credit',E);
- }
- }
- ],
- 'cmd_bill_apply_payment' : [
- ['command'],
- function() {
- try {
- obj.apply_payment();
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> cmd_bill_apply_payment',E);
- }
- }
- ],
- 'cmd_check_all' : [
- ['command'],
- function() {
- for (var i = 0; i < obj.current_payments.length; i++) {
- obj.current_payments[i].checkbox.setAttribute('checked',true); //checked = true;
- }
- obj.distribute_payment(obj.controller.view.bill_payment_amount);
- obj.tally_selected();
- }
- ],
- 'cmd_uncheck_all' : [
- ['command'],
- function() {
- for (var i = 0; i < obj.current_payments.length; i++) {
- obj.current_payments[i].checkbox.setAttribute('checked',false); //checked = false;
- }
- obj.distribute_payment(obj.controller.view.bill_payment_amount);
- obj.tally_selected();
- }
- ],
- 'voided_balance' : [
- ['render'],
- function(e) { return function() {}; }
- ],
- 'selected_balance' : [
- ['render'],
- function(e) { return function() {}; }
- ],
- 'unselected_balance' : [
- ['render'],
- function(e) { return function() {}; }
- ],
- 'bill_total_owed' : [
- ['render'],
- function(e) { return function() {}; }
- ],
- 'payment_type' : [
- ['render'],
- function(e) { return function() {}; }
- ],
- 'bill_payment_amount' : [
- ['change','keypress'],
- function(ev) {
- try {
- if (ev.type == 'keypress') {
- if (! (ev.keyCode == 13 /* enter */ || ev.keyCode == 77 /* mac enter */) ) {
- return;
- }
- }
- if (ev.type == 'change' && obj.controller.view.payment_type.value == 'credit_payment') {
- JSAN.use('util.money');
- JSAN.use('patron.util'); var au_obj = patron.util.retrieve_au_via_id(ses(),obj.patron_id);
- var proposed = util.money.dollars_float_to_cents_integer(ev.target.value);
- var available = util.money.dollars_float_to_cents_integer(au_obj.credit_forward_balance());
- if (proposed > available) {
- alert($("patronStrings").getFormattedString('staff.patron.bills.bill_payment_amount.credit_amount', [au_obj.credit_forward_balance()]));
- ev.target.value = util.money.cents_as_dollars( available );
- ev.target.setAttribute('value',ev.target.value);
- }
- }
- obj.distribute_payment(ev.target);
- ev.target.select();
- obj.tally_selected();
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> bill_payment_amount',E);
- }
- }
- ],
- 'bill_payment_applied' : [
- ['render'],
- function(e) { return function() {}; }
- ],
- 'bill_change_amount' : [
- ['change'],
- function(ev) {
- try {
- JSAN.use('util.money');
- var tb = ev.target;
- var proposed_change = util.money.dollars_float_to_cents_integer( tb.value );
- var proposed_credit = 0;
- obj.update_payment_applied();
- var real_change = util.money.dollars_float_to_cents_integer( tb.value );
- if ( proposed_change > real_change ) {
- obj.error.sdump('D_ERROR',$("patronStrings").getString('staff.patron.bills.bill_change_amount.greedy'));
- proposed_change = real_change;
- } else if ( real_change > proposed_change ) {
- proposed_credit = real_change - proposed_change;
- }
- tb.value = util.money.cents_as_dollars( proposed_change );
- tb.setAttribute('value',tb.value);
- obj.controller.view.bill_credit_amount.value = util.money.cents_as_dollars( proposed_credit );
- obj.controller.view.bill_credit_amount.setAttribute(
- 'value',
- obj.controller.view.bill_credit_amount.value
- );
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> bill_change_amount',E);
- }
- }
- ],
- 'bill_credit_amount' : [
- ['render'],
- function(e) { return function() {}; }
- ],
- 'bill_new_balance' : [
- ['render'],
- function(e) { return function() {}; }
- ]
- }
- }
- );
-
- obj.controller.render();
- obj._controller_inited = true;
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> init_controller',E);
- }
-
- },
-
- /*****************************************************************************************************************************/
-
- 'distribute_payment' : function(node) {
- try {
- var obj = this;
- JSAN.use('util.money');
- var tb = node;
- tb.value = util.money.cents_as_dollars( util.money.dollars_float_to_cents_integer( tb.value ) );
- tb.setAttribute('value', tb.value );
- var total = util.money.dollars_float_to_cents_integer( tb.value );
- if (total < 0) { tb.value = '0.00'; tb.setAttribute('value','0.00'); total = 0; }
- for (var i = 0; i < obj.current_payments.length; i++) {
- var bill = obj.current_payments[i];
- if (bill.checkbox.checked || bill.checkbox.getAttribute('checked') == 'true') {
- var bo = util.money.dollars_float_to_cents_integer( bill.balance_owed );
- if ( bo > total ) {
- bill.textbox.value = util.money.cents_as_dollars( total );
- total = 0;
- } else {
- bill.textbox.value = util.money.cents_as_dollars( bo );
- total = total - bo;
- }
- } else {
- bill.textbox.value = '0.00';
- }
- bill.textbox.setAttribute('value',bill.textbox.value);
- }
- obj.update_payment_applied();
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> distribute payment',E);
- }
- },
-
- /*****************************************************************************************************************************/
-
- 'tally_selected' : function() {
-
- var obj = this;
- JSAN.use('util.money');
- var selected_total = 0;
- var unselected_total = 0;
- //var s = '';
-
- for (var i = 0; i < obj.current_payments.length; i++) {
- var bill = obj.current_payments[i];
- if (bill.checkbox.checked || bill.checkbox.getAttribute('checked') == 'true') {
- var bo = util.money.dollars_float_to_cents_integer( bill.balance_owed );
- selected_total += bo;
- //s += ('tallying ' + i + ' : checked, bo = ' + bo + ' total = ' + selected_total + '\n');
- } else {
- var bo = util.money.dollars_float_to_cents_integer( bill.balance_owed );
- unselected_total += bo;
- //s += ('tallying ' + i + ' : not checked, total = ' + selected_total + '\n');
- }
- }
- obj.controller.view.selected_balance.setAttribute('value', '$' + util.money.cents_as_dollars( selected_total ) );
- obj.controller.view.unselected_balance.setAttribute('value', '$' + util.money.cents_as_dollars( unselected_total ) );
- //dump(s); alert(s);
- },
-
- /*****************************************************************************************************************************/
-
- 'tally_voided' : function() {
-
- var obj = this;
- JSAN.use('util.money');
- var voided_total = 0;
-
- obj.data.stash_retrieve();
-
- for (var i = 0; i < obj.data.voided_billings.length; i++) {
- var billing = obj.data.voided_billings[i];
- var bv = util.money.dollars_float_to_cents_integer( billing.amount() );
- voided_total += bv;
- }
- obj.controller.view.voided_balance.setAttribute('value', '$' + util.money.cents_as_dollars( voided_total ) );
- },
-
- /*****************************************************************************************************************************/
-
- 'apply_payment' : function() {
-
- var obj = this;
- try {
- var payment_blob = {};
- JSAN.use('util.window');
- var win = new util.window();
- switch(obj.controller.view.payment_type.value) {
- case 'credit_card_payment' :
- obj.OpenILS.data.temp = '';
- obj.OpenILS.data.stash('temp');
- var my_xulG = win.open(
- urls.XUL_PATRON_BILL_CC_INFO,
- 'billccinfo',
- 'chrome,resizable,modal'
- );
- obj.OpenILS.data.stash_retrieve();
- //payment_blob = my_xulG.payment_blob; //JSON2js( obj.OpenILS.data.temp );
- payment_blob = JSON2js( obj.OpenILS.data.temp );
- break;
- case 'check_payment' :
- obj.OpenILS.data.temp = '';
- obj.OpenILS.data.stash('temp');
- var my_xulG = win.open(
- urls.XUL_PATRON_BILL_CHECK_INFO,
- 'billcheckinfo',
- 'chrome,resizable,modal'
- );
- obj.OpenILS.data.stash_retrieve();
- //payment_blob = my_xulG.payment_blob; //JSON2js( obj.OpenILS.data.temp );
- payment_blob = JSON2js( obj.OpenILS.data.temp );
- break;
- }
- if ((typeof payment_blob == 'undefined') || payment_blob=='' || payment_blob.cancelled=='true') { alert('cancelled'); return; }
- payment_blob.userid = obj.patron_id;
- payment_blob.note = payment_blob.note || '';
- //payment_blob.cash_drawer = 1; // FIXME: get new Config() to work
- payment_blob.payment_type = obj.controller.view.payment_type.value;
- payment_blob.payments = [];
- payment_blob.patron_credit = obj.controller.view.bill_credit_amount.value;
- for (var i = 0; i < obj.current_payments.length; i++) {
- var tb = obj.current_payments[ i ].textbox;
- if ( !(tb.value == '0.00' || tb.value == '') ) {
- payment_blob.payments.push(
- [
- obj.current_payments[ i ].mobts_id,
- tb.value
- ]
- );
- }
- }
+ 'cmd_change_to_credit' : [
+ ['command'],
+ function() {
+ try {
+ obj.change_to_credit();
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> cmd_change_to_credit',E);
+ }
+ }
+ ],
+ 'cmd_bill_apply_payment' : [
+ ['command'],
+ function() {
+ try {
+ obj.apply_payment();
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> cmd_bill_apply_payment',E);
+ }
+ }
+ ],
+ 'cmd_check_all' : [
+ ['command'],
+ function() {
+ for (var i = 0; i < obj.current_payments.length; i++) {
+ obj.current_payments[i].checkbox.setAttribute('checked',true); //checked = true;
+ }
+ obj.distribute_payment(obj.controller.view.bill_payment_amount);
+ obj.tally_selected();
+ }
+ ],
+ 'cmd_uncheck_all' : [
+ ['command'],
+ function() {
+ for (var i = 0; i < obj.current_payments.length; i++) {
+ obj.current_payments[i].checkbox.setAttribute('checked',false); //checked = false;
+ }
+ obj.distribute_payment(obj.controller.view.bill_payment_amount);
+ obj.tally_selected();
+ }
+ ],
+ 'voided_balance' : [
+ ['render'],
+ function(e) { return function() {}; }
+ ],
+ 'selected_balance' : [
+ ['render'],
+ function(e) { return function() {}; }
+ ],
+ 'unselected_balance' : [
+ ['render'],
+ function(e) { return function() {}; }
+ ],
+ 'bill_total_owed' : [
+ ['render'],
+ function(e) { return function() {}; }
+ ],
+ 'payment_type' : [
+ ['render'],
+ function(e) { return function() {}; }
+ ],
+ 'bill_payment_amount' : [
+ ['change','keypress'],
+ function(ev) {
+ try {
+ if (ev.type == 'keypress') {
+ if (! (ev.keyCode == 13 /* enter */ || ev.keyCode == 77 /* mac enter */) ) {
+ return;
+ }
+ }
+ if (ev.type == 'change' && obj.controller.view.payment_type.value == 'credit_payment') {
+ JSAN.use('util.money');
+ JSAN.use('patron.util'); var au_obj = patron.util.retrieve_au_via_id(ses(),obj.patron_id);
+ var proposed = util.money.dollars_float_to_cents_integer(ev.target.value);
+ var available = util.money.dollars_float_to_cents_integer(au_obj.credit_forward_balance());
+ if (proposed > available) {
+ alert($("patronStrings").getFormattedString('staff.patron.bills.bill_payment_amount.credit_amount', [au_obj.credit_forward_balance()]));
+ ev.target.value = util.money.cents_as_dollars( available );
+ ev.target.setAttribute('value',ev.target.value);
+ }
+ }
+ obj.distribute_payment(ev.target);
+ ev.target.select();
+ obj.tally_selected();
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> bill_payment_amount',E);
+ }
+ }
+ ],
+ 'bill_payment_applied' : [
+ ['render'],
+ function(e) { return function() {}; }
+ ],
+ 'bill_change_amount' : [
+ ['change'],
+ function(ev) {
+ try {
+ JSAN.use('util.money');
+ var tb = ev.target;
+ var proposed_change = util.money.dollars_float_to_cents_integer( tb.value );
+ var proposed_credit = 0;
+ obj.update_payment_applied();
+ var real_change = util.money.dollars_float_to_cents_integer( tb.value );
+ if ( proposed_change > real_change ) {
+ obj.error.sdump('D_ERROR',$("patronStrings").getString('staff.patron.bills.bill_change_amount.greedy'));
+ proposed_change = real_change;
+ } else if ( real_change > proposed_change ) {
+ proposed_credit = real_change - proposed_change;
+ }
+ tb.value = util.money.cents_as_dollars( proposed_change );
+ tb.setAttribute('value',tb.value);
+ obj.controller.view.bill_credit_amount.value = util.money.cents_as_dollars( proposed_credit );
+ obj.controller.view.bill_credit_amount.setAttribute(
+ 'value',
+ obj.controller.view.bill_credit_amount.value
+ );
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> bill_change_amount',E);
+ }
+ }
+ ],
+ 'bill_credit_amount' : [
+ ['render'],
+ function(e) { return function() {}; }
+ ],
+ 'bill_new_balance' : [
+ ['render'],
+ function(e) { return function() {}; }
+ ]
+ }
+ }
+ );
+
+ obj.controller.render();
+ obj._controller_inited = true;
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> init_controller',E);
+ }
+
+ },
+
+ /*****************************************************************************************************************************/
+
+ 'distribute_payment' : function(node) {
+ try {
+ var obj = this;
+ JSAN.use('util.money');
+ var tb = node;
+ tb.value = util.money.cents_as_dollars( util.money.dollars_float_to_cents_integer( tb.value ) );
+ tb.setAttribute('value', tb.value );
+ var total = util.money.dollars_float_to_cents_integer( tb.value );
+ if (total < 0) { tb.value = '0.00'; tb.setAttribute('value','0.00'); total = 0; }
+ for (var i = 0; i < obj.current_payments.length; i++) {
+ var bill = obj.current_payments[i];
+ if (bill.checkbox.checked || bill.checkbox.getAttribute('checked') == 'true') {
+ var bo = util.money.dollars_float_to_cents_integer( bill.balance_owed );
+ if ( bo > total ) {
+ bill.textbox.value = util.money.cents_as_dollars( total );
+ total = 0;
+ } else {
+ bill.textbox.value = util.money.cents_as_dollars( bo );
+ total = total - bo;
+ }
+ } else {
+ bill.textbox.value = '0.00';
+ }
+ bill.textbox.setAttribute('value',bill.textbox.value);
+ }
+ obj.update_payment_applied();
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> distribute payment',E);
+ }
+ },
+
+ /*****************************************************************************************************************************/
+
+ 'tally_selected' : function() {
+
+ var obj = this;
+ JSAN.use('util.money');
+ var selected_total = 0;
+ var unselected_total = 0;
+ //var s = '';
+
+ for (var i = 0; i < obj.current_payments.length; i++) {
+ var bill = obj.current_payments[i];
+ if (bill.checkbox.checked || bill.checkbox.getAttribute('checked') == 'true') {
+ var bo = util.money.dollars_float_to_cents_integer( bill.balance_owed );
+ selected_total += bo;
+ //s += ('tallying ' + i + ' : checked, bo = ' + bo + ' total = ' + selected_total + '\n');
+ } else {
+ var bo = util.money.dollars_float_to_cents_integer( bill.balance_owed );
+ unselected_total += bo;
+ //s += ('tallying ' + i + ' : not checked, total = ' + selected_total + '\n');
+ }
+ }
+ obj.controller.view.selected_balance.setAttribute('value', '$' + util.money.cents_as_dollars( selected_total ) );
+ obj.controller.view.unselected_balance.setAttribute('value', '$' + util.money.cents_as_dollars( unselected_total ) );
+ //dump(s); alert(s);
+ },
+
+ /*****************************************************************************************************************************/
+
+ 'tally_voided' : function() {
+
+ var obj = this;
+ JSAN.use('util.money');
+ var voided_total = 0;
+
+ obj.data.stash_retrieve();
+
+ for (var i = 0; i < obj.data.voided_billings.length; i++) {
+ var billing = obj.data.voided_billings[i];
+ var bv = util.money.dollars_float_to_cents_integer( billing.amount() );
+ voided_total += bv;
+ }
+ obj.controller.view.voided_balance.setAttribute('value', '$' + util.money.cents_as_dollars( voided_total ) );
+ },
+
+ /*****************************************************************************************************************************/
+
+ 'apply_payment' : function() {
+
+ var obj = this;
+ try {
+ var payment_blob = {};
+ JSAN.use('util.window');
+ var win = new util.window();
+ switch(obj.controller.view.payment_type.value) {
+ case 'credit_card_payment' :
+ obj.OpenILS.data.temp = '';
+ obj.OpenILS.data.stash('temp');
+ var my_xulG = win.open(
+ urls.XUL_PATRON_BILL_CC_INFO,
+ 'billccinfo',
+ 'chrome,resizable,modal'
+ );
+ obj.OpenILS.data.stash_retrieve();
+ //payment_blob = my_xulG.payment_blob; //JSON2js( obj.OpenILS.data.temp );
+ payment_blob = JSON2js( obj.OpenILS.data.temp );
+ break;
+ case 'check_payment' :
+ obj.OpenILS.data.temp = '';
+ obj.OpenILS.data.stash('temp');
+ var my_xulG = win.open(
+ urls.XUL_PATRON_BILL_CHECK_INFO,
+ 'billcheckinfo',
+ 'chrome,resizable,modal'
+ );
+ obj.OpenILS.data.stash_retrieve();
+ //payment_blob = my_xulG.payment_blob; //JSON2js( obj.OpenILS.data.temp );
+ payment_blob = JSON2js( obj.OpenILS.data.temp );
+ break;
+ }
+ if ((typeof payment_blob == 'undefined') || payment_blob=='' || payment_blob.cancelled=='true') { alert('cancelled'); return; }
+ payment_blob.userid = obj.patron_id;
+ payment_blob.note = payment_blob.note || '';
+ //payment_blob.cash_drawer = 1; // FIXME: get new Config() to work
+ payment_blob.payment_type = obj.controller.view.payment_type.value;
+ payment_blob.payments = [];
+ payment_blob.patron_credit = obj.controller.view.bill_credit_amount.value;
+ for (var i = 0; i < obj.current_payments.length; i++) {
+ var tb = obj.current_payments[ i ].textbox;
+ if ( !(tb.value == '0.00' || tb.value == '') ) {
+ payment_blob.payments.push(
+ [
+ obj.current_payments[ i ].mobts_id,
+ tb.value
+ ]
+ );
+ }
+ }
if ( payment_blob.payments.length == 0 && payment_blob.patron_credit == '0.00' ) {
alert($("patronStrings").getString('staff.patron.bills.apply_payment.nothing_applied'));
return;
}
- if ( obj.pay( payment_blob ) ) {
+ if ( obj.pay( payment_blob ) ) {
- obj.data.voided_billings = []; obj.data.stash('voided_billings');
- obj.refresh();
- try {
+ obj.data.voided_billings = []; obj.data.stash('voided_billings');
+ obj.refresh();
+ try {
var no_print_prompting = obj.data.hash.aous['circ.staff_client.do_not_auto_attempt_print'];
if (no_print_prompting) {
if (no_print_prompting.indexOf( "Bill Pay" ) > -1) return; // Skip print attempt
}
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.data.stash_retrieve();
- var template = 'bill_payment';
- JSAN.use('patron.util'); JSAN.use('util.functional');
- var params = {
- 'patron' : patron.util.retrieve_fleshed_au_via_id(ses(),obj.patron_id),
- 'lib' : obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ],
- 'staff' : obj.data.list.au[0],
- 'header' : obj.data.print_list_templates[template].header,
- 'line_item' : obj.data.print_list_templates[template].line_item,
- 'footer' : obj.data.print_list_templates[template].footer,
- 'type' : obj.data.print_list_templates[template].type,
- 'list' : util.functional.map_list(
- payment_blob.payments,
- function(o) {
- return {
- 'bill_id' : o[0],
- 'payment' : o[1],
- 'last_billing_type' : obj.bill_map[ o[0] ].transaction.last_billing_type(),
- 'last_billing_note' : obj.bill_map[ o[0] ].transaction.last_billing_note(),
- 'title' : typeof obj.bill_map[ o[0] ].title != 'undefined' ? obj.bill_map[ o[0] ].title : '',
- 'barcode' : typeof obj.bill_map[ o[0] ].barcode != 'undefined' ? obj.bill_map[ o[0] ].barcode : ''
- };
- }
- ),
- 'data' : obj.previous_summary
- };
- obj.error.sdump('D_DEBUG',js2JSON(params));
- if (document.getElementById('auto_print').checked) params.no_prompt = true;
- JSAN.use('util.print'); var print = new util.print();
- print.tree_list( params );
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bill receipt', E);
- }
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> apply_payment',E);
- }
- },
-
- 'pay' : function(payment_blob) {
- var obj = this;
- try {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ obj.data.stash_retrieve();
+ var template = 'bill_payment';
+ JSAN.use('patron.util'); JSAN.use('util.functional');
+ var params = {
+ 'patron' : patron.util.retrieve_fleshed_au_via_id(ses(),obj.patron_id),
+ 'lib' : obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ],
+ 'staff' : obj.data.list.au[0],
+ 'header' : obj.data.print_list_templates[template].header,
+ 'line_item' : obj.data.print_list_templates[template].line_item,
+ 'footer' : obj.data.print_list_templates[template].footer,
+ 'type' : obj.data.print_list_templates[template].type,
+ 'list' : util.functional.map_list(
+ payment_blob.payments,
+ function(o) {
+ return {
+ 'bill_id' : o[0],
+ 'payment' : o[1],
+ 'last_billing_type' : obj.bill_map[ o[0] ].transaction.last_billing_type(),
+ 'last_billing_note' : obj.bill_map[ o[0] ].transaction.last_billing_note(),
+ 'title' : typeof obj.bill_map[ o[0] ].title != 'undefined' ? obj.bill_map[ o[0] ].title : '',
+ 'barcode' : typeof obj.bill_map[ o[0] ].barcode != 'undefined' ? obj.bill_map[ o[0] ].barcode : ''
+ };
+ }
+ ),
+ 'data' : obj.previous_summary
+ };
+ obj.error.sdump('D_DEBUG',js2JSON(params));
+ if (document.getElementById('auto_print').checked) params.no_prompt = true;
+ JSAN.use('util.print'); var print = new util.print();
+ print.tree_list( params );
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bill receipt', E);
+ }
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> apply_payment',E);
+ }
+ },
+
+ 'pay' : function(payment_blob) {
+ var obj = this;
+ try {
var x = document.getElementById('annotate_payment');
if (x && x.checked && (! payment_blob.note)) {
payment_blob.note = window.prompt($("patronStrings").getString('staff.patron.bills.pay.annotate_payment'),'', $("patronStrings").getString('staff.patron.bills.pay.annotate_payment.title'));
}
- obj.previous_summary = {
- original_balance : obj.controller.view.bill_total_owed.value,
- voided_balance : obj.controller.view.voided_balance.value,
- payment_received : obj.controller.view.bill_payment_amount.value,
- payment_applied : obj.controller.view.bill_payment_applied.value,
- change_given : obj.controller.view.bill_change_amount.value,
- credit_given : obj.controller.view.bill_credit_amount.value,
- new_balance : obj.controller.view.bill_new_balance.value,
- payment_type : obj.controller.view.payment_type.getAttribute('label'),
- note : payment_blob.note
- }
- var robj = obj.network.request(
- api.BILL_PAY.app,
- api.BILL_PAY.method,
- [ ses(), payment_blob ]
- );
- if (robj == 1) { return true; }
- if (typeof robj.ilsevent != 'undefined') {
- switch(Number(robj.ilsevent)) {
- case 0 /* SUCCESS */ : return true; break;
- case 1226 /* REFUND_EXCEEDS_DESK_PAYMENTS */ : alert($("patronStrings").getFormattedString('staff.patron.bills.pay.refund_exceeds_desk_payment', [robj.desc])); return false; break;
- default: throw(robj); break;
- }
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.bills.pay.payment_failed'),E);
- return false;
- }
- },
-
- 'update_payment_applied' : function() {
- var obj = this;
- try {
- JSAN.use('util.money');
- var total_applied = 0;
- for (var i = 0; i < obj.current_payments.length; i++) {
- total_applied += util.money.dollars_float_to_cents_integer( obj.current_payments[ i ].textbox.value );
- }
- var total_payment = 0;
- if (obj.controller.view.bill_payment_amount.value) {
- try {
- total_payment = util.money.dollars_float_to_cents_integer( obj.controller.view.bill_payment_amount.value );
- } catch(E) {
- obj.error.sdump('D_ERROR',E + '\n');
- }
- }
- if ( total_applied > total_payment ) {
- total_payment = total_applied;
- obj.controller.view.bill_payment_amount.value = util.money.cents_as_dollars( total_applied );
- }
- obj.controller.view.bill_payment_applied.value = util.money.cents_as_dollars( total_applied );
- obj.controller.view.bill_payment_applied.setAttribute('value', obj.controller.view.bill_payment_applied.value )
- obj.controller.view.bill_credit_amount.value = '';
- if (total_payment > total_applied ) {
- obj.controller.view.bill_change_amount.value = util.money.cents_as_dollars( total_payment - total_applied);
- obj.controller.view.bill_credit_amount.value = '0.00';
- } else {
- obj.controller.view.bill_change_amount.value = '0.00';
- obj.controller.view.bill_credit_amount.value = '0.00';
- }
- var total_owed = util.money.dollars_float_to_cents_integer( obj.controller.view.bill_total_owed.value );
- obj.controller.view.bill_new_balance.value = util.money.cents_as_dollars( total_owed - total_applied );
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> update_payment_applied',E);
- }
- },
-
- 'change_to_credit' : function() {
- var obj = this;
- try {
- JSAN.use('util.money');
- var tb = obj.controller.view.bill_change_amount;
- var proposed_change = 0;
- var proposed_credit = util.money.dollars_float_to_cents_integer( tb.value );
- obj.update_payment_applied();
- var real_change = util.money.dollars_float_to_cents_integer( tb.value );
- if ( proposed_change > real_change ) {
- obj.error.sdump('D_ERROR',$("patronStrings").getString('staff.patron.bills.bill_change_amount.greedy'));
- proposed_change = real_change;
- } else if ( real_change > proposed_change ) {
- proposed_credit = real_change - proposed_change;
- }
- tb.value = util.money.cents_as_dollars( proposed_change );
- tb.setAttribute('value',tb.value);
- obj.controller.view.bill_credit_amount.value = util.money.cents_as_dollars( proposed_credit );
- obj.controller.view.bill_credit_amount.setAttribute('value',obj.controller.view.bill_credit_amount.value);
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> change_to_credit',E);
- }
- },
-
- 'retrieve' : function() {
- var obj = this;
- try {
- if (window.xulG && window.xulG.bills) {
- obj.bills = window.xulG.bills;
- } else {
- obj.bills = obj.network.simple_request(
- obj.SHOW_ME_THE_BILLS,
- [ ses(), obj.patron_id ]
- );
+ obj.previous_summary = {
+ original_balance : obj.controller.view.bill_total_owed.value,
+ voided_balance : obj.controller.view.voided_balance.value,
+ payment_received : obj.controller.view.bill_payment_amount.value,
+ payment_applied : obj.controller.view.bill_payment_applied.value,
+ change_given : obj.controller.view.bill_change_amount.value,
+ credit_given : obj.controller.view.bill_credit_amount.value,
+ new_balance : obj.controller.view.bill_new_balance.value,
+ payment_type : obj.controller.view.payment_type.getAttribute('label'),
+ note : payment_blob.note
+ }
+ var robj = obj.network.request(
+ api.BILL_PAY.app,
+ api.BILL_PAY.method,
+ [ ses(), payment_blob ]
+ );
+ if (robj == 1) { return true; }
+ if (typeof robj.ilsevent != 'undefined') {
+ switch(Number(robj.ilsevent)) {
+ case 0 /* SUCCESS */ : return true; break;
+ case 1226 /* REFUND_EXCEEDS_DESK_PAYMENTS */ : alert($("patronStrings").getFormattedString('staff.patron.bills.pay.refund_exceeds_desk_payment', [robj.desc])); return false; break;
+ default: throw(robj); break;
+ }
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.bills.pay.payment_failed'),E);
+ return false;
+ }
+ },
+
+ 'update_payment_applied' : function() {
+ var obj = this;
+ try {
+ JSAN.use('util.money');
+ var total_applied = 0;
+ for (var i = 0; i < obj.current_payments.length; i++) {
+ total_applied += util.money.dollars_float_to_cents_integer( obj.current_payments[ i ].textbox.value );
+ }
+ var total_payment = 0;
+ if (obj.controller.view.bill_payment_amount.value) {
+ try {
+ total_payment = util.money.dollars_float_to_cents_integer( obj.controller.view.bill_payment_amount.value );
+ } catch(E) {
+ obj.error.sdump('D_ERROR',E + '\n');
+ }
+ }
+ if ( total_applied > total_payment ) {
+ total_payment = total_applied;
+ obj.controller.view.bill_payment_amount.value = util.money.cents_as_dollars( total_applied );
+ }
+ obj.controller.view.bill_payment_applied.value = util.money.cents_as_dollars( total_applied );
+ obj.controller.view.bill_payment_applied.setAttribute('value', obj.controller.view.bill_payment_applied.value )
+ obj.controller.view.bill_credit_amount.value = '';
+ if (total_payment > total_applied ) {
+ obj.controller.view.bill_change_amount.value = util.money.cents_as_dollars( total_payment - total_applied);
+ obj.controller.view.bill_credit_amount.value = '0.00';
+ } else {
+ obj.controller.view.bill_change_amount.value = '0.00';
+ obj.controller.view.bill_credit_amount.value = '0.00';
+ }
+ var total_owed = util.money.dollars_float_to_cents_integer( obj.controller.view.bill_total_owed.value );
+ obj.controller.view.bill_new_balance.value = util.money.cents_as_dollars( total_owed - total_applied );
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> update_payment_applied',E);
+ }
+ },
+
+ 'change_to_credit' : function() {
+ var obj = this;
+ try {
+ JSAN.use('util.money');
+ var tb = obj.controller.view.bill_change_amount;
+ var proposed_change = 0;
+ var proposed_credit = util.money.dollars_float_to_cents_integer( tb.value );
+ obj.update_payment_applied();
+ var real_change = util.money.dollars_float_to_cents_integer( tb.value );
+ if ( proposed_change > real_change ) {
+ obj.error.sdump('D_ERROR',$("patronStrings").getString('staff.patron.bills.bill_change_amount.greedy'));
+ proposed_change = real_change;
+ } else if ( real_change > proposed_change ) {
+ proposed_credit = real_change - proposed_change;
+ }
+ tb.value = util.money.cents_as_dollars( proposed_change );
+ tb.setAttribute('value',tb.value);
+ obj.controller.view.bill_credit_amount.value = util.money.cents_as_dollars( proposed_credit );
+ obj.controller.view.bill_credit_amount.setAttribute('value',obj.controller.view.bill_credit_amount.value);
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> change_to_credit',E);
+ }
+ },
+
+ 'retrieve' : function() {
+ var obj = this;
+ try {
+ if (window.xulG && window.xulG.bills) {
+ obj.bills = window.xulG.bills;
+ } else {
+ obj.bills = obj.network.simple_request(
+ obj.SHOW_ME_THE_BILLS,
+ [ ses(), obj.patron_id ]
+ );
if (typeof obj.bills.ilsevent != 'undefined' || typeof obj.bills == 'null') { throw(obj.bills); }
- for (var i = 0; i < obj.bills.length; i++) {
- if (instanceOf(obj.bills[i],mobts)) {
- obj.bills[i] = { 'transaction' : obj.bills[i] }
- } else if (instanceOf(obj.bills[i],mbts)) {
- obj.bills[i] = { 'transaction' : obj.bills[i] }
- } else {
- var robj = obj.network.simple_request('FM_MBTS_RETRIEVE.authoritative',[ses(),obj.bills[i]]);
- //alert('robj = ' + js2JSON(robj));
- obj.bills[i] = { 'transaction' : robj }
- }
- }
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> retrieve',E);
- }
- },
+ for (var i = 0; i < obj.bills.length; i++) {
+ if (instanceOf(obj.bills[i],mobts)) {
+ obj.bills[i] = { 'transaction' : obj.bills[i] }
+ } else if (instanceOf(obj.bills[i],mbts)) {
+ obj.bills[i] = { 'transaction' : obj.bills[i] }
+ } else {
+ var robj = obj.network.simple_request('FM_MBTS_RETRIEVE.authoritative',[ses(),obj.bills[i]]);
+ //alert('robj = ' + js2JSON(robj));
+ obj.bills[i] = { 'transaction' : robj }
+ }
+ }
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> retrieve',E);
+ }
+ },
'print_bills' : function() {
var obj = this;
@@ -689,7 +689,7 @@ patron.bills.prototype = {
'line_item' : obj.data.print_list_templates[template].line_item,
'footer' : obj.data.print_list_templates[template].footer,
'type' : obj.data.print_list_templates[template].type,
- 'list' : util.functional.map_list(
+ 'list' : util.functional.map_list(
obj.bills,
function(o) {
var id = o.transaction.id();
@@ -709,402 +709,402 @@ patron.bills.prototype = {
print.tree_list( params );
} catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> print_bills',E);
+ obj.error.standard_unexpected_error_alert('bills -> print_bills',E);
}
},
- 'xact_dates_box' : function ( mobts ) {
- var obj = this;
- try {
- var grid = document.createElement('grid');
- var cols = document.createElement('columns');
- grid.appendChild( cols );
- cols.appendChild( document.createElement('column') );
- cols.appendChild( document.createElement('column') );
- var rows = document.createElement('rows');
- grid.appendChild( rows );
- var row0 = document.createElement('row');
- rows.appendChild( row0 );
- var cb_r0_0 = document.createElement('checkbox');
- row0.appendChild( cb_r0_0 );
- cb_r0_0.setAttribute('checked',true);
- var hb_r0_1 = document.createElement('hbox');
- row0.appendChild( hb_r0_1 );
- var label_r0_1 = document.createElement('label');
- hb_r0_1.appendChild( label_r0_1 );
- label_r0_1.setAttribute('value',document.getElementById('commonStrings').getString('staff.mbts_id_label'));
- var label_r0_2 = document.createElement('label');
- hb_r0_1.appendChild( label_r0_2 );
- label_r0_2.setAttribute('value',mobts.id());
- var row1 = document.createElement('row');
- rows.appendChild( row1 );
- var label_r1_1 = document.createElement('label');
- row1.appendChild( label_r1_1 );
- label_r1_1.setAttribute('value',document.getElementById('commonStrings').getString('staff.mbts_xact_start_label'));
- var label_r1_2 = document.createElement('label');
- row1.appendChild( label_r1_2 );
- label_r1_2.setAttribute('value',mobts.xact_start().toString().substr(0,10));
- var row2 = document.createElement('row');
- rows.appendChild( row2 );
- var label_r2_1 = document.createElement('label');
- row2.appendChild( label_r2_1 );
- label_r2_1.setAttribute('value',document.getElementById('commonStrings').getString('staff.mbts_xact_finish_label'));
- var label_r2_2 = document.createElement('label');
- row2.appendChild( label_r2_2 );
- try { label_r2_2.setAttribute('value',mobts.xact_finish().toString().substr(0,10));
- } catch(E) {}
-
- return grid;
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> xact_dates_box',E);
- }
- },
-
- 'money_box' : function ( mobts ) {
- var obj = this;
- try {
- JSAN.use('util.money');
- var grid = document.createElement('grid');
- var cols = document.createElement('columns');
- grid.appendChild( cols );
- cols.appendChild( document.createElement('column') );
- cols.appendChild( document.createElement('column') );
- var rows = document.createElement('rows');
- grid.appendChild( rows );
- var row1 = document.createElement('row');
- rows.appendChild( row1 );
- var label_r1_1 = document.createElement('label');
- row1.appendChild( label_r1_1 );
- label_r1_1.setAttribute('value',document.getElementById('commonStrings').getString('staff.mbts_total_owed_label'));
- var label_r1_2 = document.createElement('label');
- row1.appendChild( label_r1_2 );
- label_r1_2.setAttribute('value','$' + util.money.sanitize(mobts.total_owed() || '0') );
- var row2 = document.createElement('row');
- rows.appendChild( row2 );
- var label_r2_1 = document.createElement('label');
- row2.appendChild( label_r2_1 );
- label_r2_1.setAttribute('value',document.getElementById('commonStrings').getString('staff.mbts_total_paid_label'));
- var label_r2_2 = document.createElement('label');
- row2.appendChild( label_r2_2 );
- label_r2_2.setAttribute('value','$' + util.money.sanitize(mobts.total_paid() || '0') );
- var row3 = document.createElement('row');
- rows.appendChild( row3 );
- var label_r3_1 = document.createElement('label');
- row3.appendChild( label_r3_1 );
- label_r3_1.setAttribute('value',document.getElementById('commonStrings').getString('staff.mbts_balance_owed_label'));
- label_r3_1.setAttribute('style','font-weight: bold');
- var label_r3_2 = document.createElement('label');
- row3.appendChild( label_r3_2 );
- label_r3_2.setAttribute('value','$' + util.money.sanitize(mobts.balance_owed() || '0') );
- label_r3_2.setAttribute('style','font-weight: bold');
-
- return grid;
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> money_box',E);
- }
- },
-
- 'info_box' : function ( my ) {
- var obj = this;
- try {
- var vbox = document.createElement('vbox');
-
- var hbox = document.createElement('hbox');
- vbox.appendChild( hbox ); hbox.flex = 1;
-
- var cb = document.createElement('checkbox');
- hbox.appendChild( cb );
- if ( my.mobts.balance_owed() == 0 ) {
- cb.setAttribute('disabled', 'true');
- } else {
- if (my.mobts.balance_owed() > 0) {
- cb.setAttribute('checked', true);
- }
- }
- cb.addEventListener(
- 'command',
- function() {
- setTimeout(
- function() {
- obj.distribute_payment(obj.controller.view.bill_payment_amount);
- obj.tally_selected();
- }, 0
- );
- },
- false
- );
-
-
- var grid = document.createElement('grid');
- hbox.appendChild( grid );
-
- var cols = document.createElement('columns');
- grid.appendChild( cols );
- cols.appendChild( document.createElement('column') );
- cols.appendChild( document.createElement('column') );
- var rows = document.createElement('rows');
- grid.appendChild( rows );
-
- var xact_type = document.createElement('row');
- rows.appendChild( xact_type );
-
- var xt_label = document.createElement('label');
- xact_type.appendChild( xt_label );
- var xt_value = document.createElement('description');
- xact_type.appendChild( xt_value );
-
- try {
- switch(my.mobts.xact_type()) {
- case 'circulation':
- xt_label.setAttribute( 'value', $("patronStrings").getString('staff.patron.bills.info_box.label_value.title') );
- obj.network.simple_request(
- 'FM_CIRC_RETRIEVE_VIA_ID',
- [ ses(), my.mobts.id() ],
- function (req) {
- var r_circ = req.getResultObject();
- if (instanceOf(r_circ,circ)) {
- /*
- xt_start.setAttribute('value','Checked Out: ' + r_circ.xact_start().toString().substr(0,10) );
- if (r_circ.checkin_time()) {
- xt_finish.setAttribute('value','Returned: ' + r_circ.checkin_time().toString().substr(0,10) );
- } else {
- xt_finish.setAttribute('value','Due: ' + r_circ.due_date().toString().substr(0,10) );
- }
- */
- if (! r_circ.checkin_time()) {
- xt_value.setAttribute('style','background: red; color: white');
- if (document.getElementById('circulating_hint')) {
- document.getElementById('circulating_hint').hidden = false;
- }
- }
- obj.network.simple_request(
- 'MODS_SLIM_RECORD_RETRIEVE_VIA_COPY',
- [ r_circ.target_copy() ],
- function (rreq) {
- var r_mvr = rreq.getResultObject();
- if (instanceOf(r_mvr,mvr)) {
- xt_value.appendChild( document.createTextNode( String( r_mvr.title() ).substr(0,50) ) );
- obj.bill_map[ my.mobts.id() ].title = r_mvr.title();
- }
- }
- );
- obj.network.simple_request(
- 'FM_ACP_RETRIEVE',
- [ r_circ.target_copy() ],
- function (rrreq) {
- var r_acp = rrreq.getResultObject();
- if (instanceOf(r_acp,acp)) {
- xt_value.appendChild( document.createTextNode( r_acp.dummy_title() ) );
- if (r_acp.dummy_title()) obj.bill_map[ my.mobts.id() ].title = r_acp.dummy_title();
- obj.bill_map[ my.mobts.id() ].barcode = r_acp.barcode();
- }
- }
- );
- }
- }
- );
- break;
- default:
- xt_label.setAttribute( 'value',
- my.mvr ? $("patronStrings").getString('staff.patron.bills.info_box.label_value.title') : $("patronStrings").getString('staff.patron.bills.info_box.label_value.type') );
- xt_value.appendChild( document.createTextNode( my.mvr ? my.mvr.title() : my.mobts.xact_type() ) );
- break;
- }
- } catch(E) { alert(E); }
-
- var last_billing = document.createElement('row');
- rows.appendChild( last_billing );
-
- var lb_label = document.createElement('label');
- last_billing.appendChild( lb_label );
- lb_label.setAttribute( 'value', $("patronStrings").getString('staff.patron.bills.info_box.label_value.last_billing') );
-
- var lb_value = document.createElement('label');
- last_billing.appendChild( lb_value );
- if (my.mobts.last_billing_type())
- lb_value.setAttribute( 'value', my.mobts.last_billing_type() );
- /*
- var last_payment = document.createElement('row');
- rows.appendChild( last_payment );
-
- var lp_label = document.createElement('label');
- last_payment.appendChild( lp_label );
- lp_label.setAttribute( 'value', 'Last Payment:' );
-
- var lp_value = document.createElement('label');
- last_payment.appendChild( lp_value );
- if (my.mobts.last_payment_type())
- lp_value.setAttribute( 'value', my.mobts.last_payment_type() );
- */
- var btn_box = document.createElement('hbox');
- vbox.appendChild( btn_box ); btn_box.flex = 1;
- var btn = document.createElement('button');
- btn_box.appendChild( btn );
- btn.setAttribute( 'label', $("patronStrings").getString('staff.patron.bills.info_box.label_value.full_details') );
- btn.setAttribute( 'name', 'full_details' );
- btn.setAttribute( 'mobts_id', my.mobts.id() );
- btn.addEventListener(
- 'command',
- function(ev) {
- JSAN.use('util.window'); var win = new util.window();
- var my_xulG = win.open(
- urls.XUL_PATRON_BILL_DETAILS,
- //+ '?patron_id=' + window.escape(obj.patron_id)
- //+ '&mbts_id=' + window.escape(my.mobts.id()),
- 'test' + my.mobts.id(),
- 'chrome,resizable',
- {
- 'patron_id' : obj.patron_id,
- 'mbts_id' : my.mobts.id(),
- 'refresh' : function() { obj.refresh(); },
- }
- );
- },
- false
- );
- var btn2 = document.createElement('button');
- btn_box.appendChild( btn2 );
- btn2.setAttribute( 'label', $("patronStrings").getString('staff.patron.bills.info_box.label_value.add_billing') );
- btn2.setAttribute( 'mobts_id', my.mobts.id() );
- btn2.addEventListener(
- 'command',
- function(ev) {
- JSAN.use('util.window');
- var win = new util.window();
- var my_xulG = win.open(
- urls.XUL_PATRON_BILL_WIZARD,
- //+ '?patron_id=' + window.escape(obj.patron_id)
- //+ '&xact_id=' + window.escape( my.mobts.id() ),
- 'billwizard',
- 'chrome,resizable,modal',
- {
- 'patron_id' : obj.patron_id,
- 'xact_id' : my.mobts.id(),
- }
- );
- obj.refresh();
- },
- false
- );
- if (my.mobts.balance_owed() < 0) {
- var btn3 = document.createElement('button');
- btn_box.appendChild( btn3 );
- btn3.setAttribute( 'label', $("patronStrings").getString('staff.patron.bills.info_box.label_value.refund') );
- btn3.setAttribute( 'mobts_id', my.mobts.id() );
- btn3.addEventListener(
- 'command',
- function(ev) {
- cb.setAttribute('checked',true);
- obj.distribute_payment(obj.controller.view.bill_payment_amount);
- obj.tally_selected();
- },
- false
- );
- }
-
- var btn4 = document.createElement('button');
- btn_box.appendChild( btn4 );
- btn4.setAttribute( 'label', $("patronStrings").getString('staff.patron.bills.info_box.label_value.void_all_billings') );
- btn4.setAttribute( 'mobts_id', my.mobts.id() );
- btn4.addEventListener(
- 'command',
- function(ev) {
- obj.void_all_billings( my.mobts.id() );
- },
- false
- );
-
- return vbox;
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> info_box',E);
- }
- },
-
- 'payment_box' : function() {
- try {
- var vb = document.createElement('vbox');
- var tb = document.createElement('textbox');
- tb.setAttribute('readonly','true');
- vb.appendChild(tb);
- return vb;
- } catch(E) {
- this.error.standard_unexpected_error_alert('bills -> payment_box',E);
- }
- },
-
- 'void_all_billings' : function(mobts_id) {
- try {
- var obj = this;
- JSAN.use('util.functional');
-
- var mb_list = obj.network.simple_request( 'FM_MB_RETRIEVE_VIA_MBTS_ID.authoritative', [ ses(), mobts_id ] );
- if (typeof mb_list.ilsevent != 'undefined') throw(mb_list);
-
- mb_list = util.functional.filter_list( mb_list, function(o) { return ! get_bool( o.voided() ) });
-
- if (mb_list.length == 0) { alert($("patronStrings").getString('staff.patron.bills.void_all_billings.all_voided')); return; }
-
- var sum = 0;
- for (var i = 0; i < mb_list.length; i++) sum += util.money.dollars_float_to_cents_integer( mb_list[i].amount() );
- sum = util.money.cents_as_dollars( sum );
-
- var msg = $("patronStrings").getFormattedString('staff.patron.bills.void_all_billings.void.message', [sum]);
- var r = obj.error.yns_alert(msg,
- $("patronStrings").getString('staff.patron.bills.void_all_billings.void.title'),
- $("patronStrings").getString('staff.patron.bills.void_all_billings.void.yes'),
- $("patronStrings").getString('staff.patron.bills.void_all_billings.void.no'), null,
- $("patronStrings").getString('staff.patron.bills.void_all_billings.void.confirm_message'));
- if (r == 0) {
- var robj = obj.network.simple_request('FM_MB_VOID',[ses()].concat(util.functional.map_list(mb_list,function(o){return o.id();})));
- if (robj.ilsevent) {
- switch(Number(robj.ilsevent)) {
- default:
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.bills.void_all_billings.error_voiding_bills'),robj);
- obj.refresh(); return;
- break;
- }
- }
-
- obj.data.stash_retrieve(); if (! obj.data.voided_billings ) obj.data.voided_billings = [];
- for (var i = 0; i < mb_list.length; i++) {
- obj.data.voided_billings.push( mb_list[i] );
- }
- obj.data.stash('voided_billings');
- alert($("patronStrings").getString('staff.patron.bills.void_all_billings.billings_voided'));
- obj.refresh();
- }
- } catch(E) {
- try { obj.error.standard_unexpected_error_alert('bills.js, void_all_billings():',E); } catch(F) { alert(E); }
- }
-
- },
-
- 'gen_map_row_to_column' : function() {
- var obj = this;
-
- try {
-
- return function(row,col) {
- // row contains { 'my' : { 'mobts' : ... } }
- // col contains one of the objects listed above in columns
-
- var my = row.my;
- var value;
- try {
- value = eval( col.render );
- } catch(E) {
- try{obj.error.sdump('D_ERROR','map_row_to_column: ' + E);}
- catch(P){dump('?map_row_to_column: ' + E + '\n');}
- value = '???';
- }
- //dump('map_row_to_column: value = ' + value + '\n');
- return value;
- };
-
- } catch(E) {
- obj.error.standard_unexpected_error_alert('bills -> gen_map_row_to_column',E);
- }
- },
+ 'xact_dates_box' : function ( mobts ) {
+ var obj = this;
+ try {
+ var grid = document.createElement('grid');
+ var cols = document.createElement('columns');
+ grid.appendChild( cols );
+ cols.appendChild( document.createElement('column') );
+ cols.appendChild( document.createElement('column') );
+ var rows = document.createElement('rows');
+ grid.appendChild( rows );
+ var row0 = document.createElement('row');
+ rows.appendChild( row0 );
+ var cb_r0_0 = document.createElement('checkbox');
+ row0.appendChild( cb_r0_0 );
+ cb_r0_0.setAttribute('checked',true);
+ var hb_r0_1 = document.createElement('hbox');
+ row0.appendChild( hb_r0_1 );
+ var label_r0_1 = document.createElement('label');
+ hb_r0_1.appendChild( label_r0_1 );
+ label_r0_1.setAttribute('value',document.getElementById('commonStrings').getString('staff.mbts_id_label'));
+ var label_r0_2 = document.createElement('label');
+ hb_r0_1.appendChild( label_r0_2 );
+ label_r0_2.setAttribute('value',mobts.id());
+ var row1 = document.createElement('row');
+ rows.appendChild( row1 );
+ var label_r1_1 = document.createElement('label');
+ row1.appendChild( label_r1_1 );
+ label_r1_1.setAttribute('value',document.getElementById('commonStrings').getString('staff.mbts_xact_start_label'));
+ var label_r1_2 = document.createElement('label');
+ row1.appendChild( label_r1_2 );
+ label_r1_2.setAttribute('value',mobts.xact_start().toString().substr(0,10));
+ var row2 = document.createElement('row');
+ rows.appendChild( row2 );
+ var label_r2_1 = document.createElement('label');
+ row2.appendChild( label_r2_1 );
+ label_r2_1.setAttribute('value',document.getElementById('commonStrings').getString('staff.mbts_xact_finish_label'));
+ var label_r2_2 = document.createElement('label');
+ row2.appendChild( label_r2_2 );
+ try { label_r2_2.setAttribute('value',mobts.xact_finish().toString().substr(0,10));
+ } catch(E) {}
+
+ return grid;
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> xact_dates_box',E);
+ }
+ },
+
+ 'money_box' : function ( mobts ) {
+ var obj = this;
+ try {
+ JSAN.use('util.money');
+ var grid = document.createElement('grid');
+ var cols = document.createElement('columns');
+ grid.appendChild( cols );
+ cols.appendChild( document.createElement('column') );
+ cols.appendChild( document.createElement('column') );
+ var rows = document.createElement('rows');
+ grid.appendChild( rows );
+ var row1 = document.createElement('row');
+ rows.appendChild( row1 );
+ var label_r1_1 = document.createElement('label');
+ row1.appendChild( label_r1_1 );
+ label_r1_1.setAttribute('value',document.getElementById('commonStrings').getString('staff.mbts_total_owed_label'));
+ var label_r1_2 = document.createElement('label');
+ row1.appendChild( label_r1_2 );
+ label_r1_2.setAttribute('value','$' + util.money.sanitize(mobts.total_owed() || '0') );
+ var row2 = document.createElement('row');
+ rows.appendChild( row2 );
+ var label_r2_1 = document.createElement('label');
+ row2.appendChild( label_r2_1 );
+ label_r2_1.setAttribute('value',document.getElementById('commonStrings').getString('staff.mbts_total_paid_label'));
+ var label_r2_2 = document.createElement('label');
+ row2.appendChild( label_r2_2 );
+ label_r2_2.setAttribute('value','$' + util.money.sanitize(mobts.total_paid() || '0') );
+ var row3 = document.createElement('row');
+ rows.appendChild( row3 );
+ var label_r3_1 = document.createElement('label');
+ row3.appendChild( label_r3_1 );
+ label_r3_1.setAttribute('value',document.getElementById('commonStrings').getString('staff.mbts_balance_owed_label'));
+ label_r3_1.setAttribute('style','font-weight: bold');
+ var label_r3_2 = document.createElement('label');
+ row3.appendChild( label_r3_2 );
+ label_r3_2.setAttribute('value','$' + util.money.sanitize(mobts.balance_owed() || '0') );
+ label_r3_2.setAttribute('style','font-weight: bold');
+
+ return grid;
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> money_box',E);
+ }
+ },
+
+ 'info_box' : function ( my ) {
+ var obj = this;
+ try {
+ var vbox = document.createElement('vbox');
+
+ var hbox = document.createElement('hbox');
+ vbox.appendChild( hbox ); hbox.flex = 1;
+
+ var cb = document.createElement('checkbox');
+ hbox.appendChild( cb );
+ if ( my.mobts.balance_owed() == 0 ) {
+ cb.setAttribute('disabled', 'true');
+ } else {
+ if (my.mobts.balance_owed() > 0) {
+ cb.setAttribute('checked', true);
+ }
+ }
+ cb.addEventListener(
+ 'command',
+ function() {
+ setTimeout(
+ function() {
+ obj.distribute_payment(obj.controller.view.bill_payment_amount);
+ obj.tally_selected();
+ }, 0
+ );
+ },
+ false
+ );
+
+
+ var grid = document.createElement('grid');
+ hbox.appendChild( grid );
+
+ var cols = document.createElement('columns');
+ grid.appendChild( cols );
+ cols.appendChild( document.createElement('column') );
+ cols.appendChild( document.createElement('column') );
+ var rows = document.createElement('rows');
+ grid.appendChild( rows );
+
+ var xact_type = document.createElement('row');
+ rows.appendChild( xact_type );
+
+ var xt_label = document.createElement('label');
+ xact_type.appendChild( xt_label );
+ var xt_value = document.createElement('description');
+ xact_type.appendChild( xt_value );
+
+ try {
+ switch(my.mobts.xact_type()) {
+ case 'circulation':
+ xt_label.setAttribute( 'value', $("patronStrings").getString('staff.patron.bills.info_box.label_value.title') );
+ obj.network.simple_request(
+ 'FM_CIRC_RETRIEVE_VIA_ID',
+ [ ses(), my.mobts.id() ],
+ function (req) {
+ var r_circ = req.getResultObject();
+ if (instanceOf(r_circ,circ)) {
+ /*
+ xt_start.setAttribute('value','Checked Out: ' + r_circ.xact_start().toString().substr(0,10) );
+ if (r_circ.checkin_time()) {
+ xt_finish.setAttribute('value','Returned: ' + r_circ.checkin_time().toString().substr(0,10) );
+ } else {
+ xt_finish.setAttribute('value','Due: ' + r_circ.due_date().toString().substr(0,10) );
+ }
+ */
+ if (! r_circ.checkin_time()) {
+ xt_value.setAttribute('style','background: red; color: white');
+ if (document.getElementById('circulating_hint')) {
+ document.getElementById('circulating_hint').hidden = false;
+ }
+ }
+ obj.network.simple_request(
+ 'MODS_SLIM_RECORD_RETRIEVE_VIA_COPY',
+ [ r_circ.target_copy() ],
+ function (rreq) {
+ var r_mvr = rreq.getResultObject();
+ if (instanceOf(r_mvr,mvr)) {
+ xt_value.appendChild( document.createTextNode( String( r_mvr.title() ).substr(0,50) ) );
+ obj.bill_map[ my.mobts.id() ].title = r_mvr.title();
+ }
+ }
+ );
+ obj.network.simple_request(
+ 'FM_ACP_RETRIEVE',
+ [ r_circ.target_copy() ],
+ function (rrreq) {
+ var r_acp = rrreq.getResultObject();
+ if (instanceOf(r_acp,acp)) {
+ xt_value.appendChild( document.createTextNode( r_acp.dummy_title() ) );
+ if (r_acp.dummy_title()) obj.bill_map[ my.mobts.id() ].title = r_acp.dummy_title();
+ obj.bill_map[ my.mobts.id() ].barcode = r_acp.barcode();
+ }
+ }
+ );
+ }
+ }
+ );
+ break;
+ default:
+ xt_label.setAttribute( 'value',
+ my.mvr ? $("patronStrings").getString('staff.patron.bills.info_box.label_value.title') : $("patronStrings").getString('staff.patron.bills.info_box.label_value.type') );
+ xt_value.appendChild( document.createTextNode( my.mvr ? my.mvr.title() : my.mobts.xact_type() ) );
+ break;
+ }
+ } catch(E) { alert(E); }
+
+ var last_billing = document.createElement('row');
+ rows.appendChild( last_billing );
+
+ var lb_label = document.createElement('label');
+ last_billing.appendChild( lb_label );
+ lb_label.setAttribute( 'value', $("patronStrings").getString('staff.patron.bills.info_box.label_value.last_billing') );
+
+ var lb_value = document.createElement('label');
+ last_billing.appendChild( lb_value );
+ if (my.mobts.last_billing_type())
+ lb_value.setAttribute( 'value', my.mobts.last_billing_type() );
+ /*
+ var last_payment = document.createElement('row');
+ rows.appendChild( last_payment );
+
+ var lp_label = document.createElement('label');
+ last_payment.appendChild( lp_label );
+ lp_label.setAttribute( 'value', 'Last Payment:' );
+
+ var lp_value = document.createElement('label');
+ last_payment.appendChild( lp_value );
+ if (my.mobts.last_payment_type())
+ lp_value.setAttribute( 'value', my.mobts.last_payment_type() );
+ */
+ var btn_box = document.createElement('hbox');
+ vbox.appendChild( btn_box ); btn_box.flex = 1;
+ var btn = document.createElement('button');
+ btn_box.appendChild( btn );
+ btn.setAttribute( 'label', $("patronStrings").getString('staff.patron.bills.info_box.label_value.full_details') );
+ btn.setAttribute( 'name', 'full_details' );
+ btn.setAttribute( 'mobts_id', my.mobts.id() );
+ btn.addEventListener(
+ 'command',
+ function(ev) {
+ JSAN.use('util.window'); var win = new util.window();
+ var my_xulG = win.open(
+ urls.XUL_PATRON_BILL_DETAILS,
+ //+ '?patron_id=' + window.escape(obj.patron_id)
+ //+ '&mbts_id=' + window.escape(my.mobts.id()),
+ 'test' + my.mobts.id(),
+ 'chrome,resizable',
+ {
+ 'patron_id' : obj.patron_id,
+ 'mbts_id' : my.mobts.id(),
+ 'refresh' : function() { obj.refresh(); },
+ }
+ );
+ },
+ false
+ );
+ var btn2 = document.createElement('button');
+ btn_box.appendChild( btn2 );
+ btn2.setAttribute( 'label', $("patronStrings").getString('staff.patron.bills.info_box.label_value.add_billing') );
+ btn2.setAttribute( 'mobts_id', my.mobts.id() );
+ btn2.addEventListener(
+ 'command',
+ function(ev) {
+ JSAN.use('util.window');
+ var win = new util.window();
+ var my_xulG = win.open(
+ urls.XUL_PATRON_BILL_WIZARD,
+ //+ '?patron_id=' + window.escape(obj.patron_id)
+ //+ '&xact_id=' + window.escape( my.mobts.id() ),
+ 'billwizard',
+ 'chrome,resizable,modal',
+ {
+ 'patron_id' : obj.patron_id,
+ 'xact_id' : my.mobts.id(),
+ }
+ );
+ obj.refresh();
+ },
+ false
+ );
+ if (my.mobts.balance_owed() < 0) {
+ var btn3 = document.createElement('button');
+ btn_box.appendChild( btn3 );
+ btn3.setAttribute( 'label', $("patronStrings").getString('staff.patron.bills.info_box.label_value.refund') );
+ btn3.setAttribute( 'mobts_id', my.mobts.id() );
+ btn3.addEventListener(
+ 'command',
+ function(ev) {
+ cb.setAttribute('checked',true);
+ obj.distribute_payment(obj.controller.view.bill_payment_amount);
+ obj.tally_selected();
+ },
+ false
+ );
+ }
+
+ var btn4 = document.createElement('button');
+ btn_box.appendChild( btn4 );
+ btn4.setAttribute( 'label', $("patronStrings").getString('staff.patron.bills.info_box.label_value.void_all_billings') );
+ btn4.setAttribute( 'mobts_id', my.mobts.id() );
+ btn4.addEventListener(
+ 'command',
+ function(ev) {
+ obj.void_all_billings( my.mobts.id() );
+ },
+ false
+ );
+
+ return vbox;
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> info_box',E);
+ }
+ },
+
+ 'payment_box' : function() {
+ try {
+ var vb = document.createElement('vbox');
+ var tb = document.createElement('textbox');
+ tb.setAttribute('readonly','true');
+ vb.appendChild(tb);
+ return vb;
+ } catch(E) {
+ this.error.standard_unexpected_error_alert('bills -> payment_box',E);
+ }
+ },
+
+ 'void_all_billings' : function(mobts_id) {
+ try {
+ var obj = this;
+ JSAN.use('util.functional');
+
+ var mb_list = obj.network.simple_request( 'FM_MB_RETRIEVE_VIA_MBTS_ID.authoritative', [ ses(), mobts_id ] );
+ if (typeof mb_list.ilsevent != 'undefined') throw(mb_list);
+
+ mb_list = util.functional.filter_list( mb_list, function(o) { return ! get_bool( o.voided() ) });
+
+ if (mb_list.length == 0) { alert($("patronStrings").getString('staff.patron.bills.void_all_billings.all_voided')); return; }
+
+ var sum = 0;
+ for (var i = 0; i < mb_list.length; i++) sum += util.money.dollars_float_to_cents_integer( mb_list[i].amount() );
+ sum = util.money.cents_as_dollars( sum );
+
+ var msg = $("patronStrings").getFormattedString('staff.patron.bills.void_all_billings.void.message', [sum]);
+ var r = obj.error.yns_alert(msg,
+ $("patronStrings").getString('staff.patron.bills.void_all_billings.void.title'),
+ $("patronStrings").getString('staff.patron.bills.void_all_billings.void.yes'),
+ $("patronStrings").getString('staff.patron.bills.void_all_billings.void.no'), null,
+ $("patronStrings").getString('staff.patron.bills.void_all_billings.void.confirm_message'));
+ if (r == 0) {
+ var robj = obj.network.simple_request('FM_MB_VOID',[ses()].concat(util.functional.map_list(mb_list,function(o){return o.id();})));
+ if (robj.ilsevent) {
+ switch(Number(robj.ilsevent)) {
+ default:
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.bills.void_all_billings.error_voiding_bills'),robj);
+ obj.refresh(); return;
+ break;
+ }
+ }
+
+ obj.data.stash_retrieve(); if (! obj.data.voided_billings ) obj.data.voided_billings = [];
+ for (var i = 0; i < mb_list.length; i++) {
+ obj.data.voided_billings.push( mb_list[i] );
+ }
+ obj.data.stash('voided_billings');
+ alert($("patronStrings").getString('staff.patron.bills.void_all_billings.billings_voided'));
+ obj.refresh();
+ }
+ } catch(E) {
+ try { obj.error.standard_unexpected_error_alert('bills.js, void_all_billings():',E); } catch(F) { alert(E); }
+ }
+
+ },
+
+ 'gen_map_row_to_column' : function() {
+ var obj = this;
+
+ try {
+
+ return function(row,col) {
+ // row contains { 'my' : { 'mobts' : ... } }
+ // col contains one of the objects listed above in columns
+
+ var my = row.my;
+ var value;
+ try {
+ value = eval( col.render );
+ } catch(E) {
+ try{obj.error.sdump('D_ERROR','map_row_to_column: ' + E);}
+ catch(P){dump('?map_row_to_column: ' + E + '\n');}
+ value = '???';
+ }
+ //dump('map_row_to_column: value = ' + value + '\n');
+ return value;
+ };
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('bills -> gen_map_row_to_column',E);
+ }
+ },
}
diff --git a/Open-ILS/xul/staff_client/server/patron/display.js b/Open-ILS/xul/staff_client/server/patron/display.js
index 884cbe3d93..0bcd8f6525 100644
--- a/Open-ILS/xul/staff_client/server/patron/display.js
+++ b/Open-ILS/xul/staff_client/server/patron/display.js
@@ -5,61 +5,61 @@ function $(id) { return document.getElementById(id); }
if (typeof patron == 'undefined') patron = {};
patron.display = function (params) {
- JSAN.use('util.error'); this.error = new util.error();
- JSAN.use('util.window'); this.window = new util.window();
- JSAN.use('util.network'); this.network = new util.network();
+ JSAN.use('util.error'); this.error = new util.error();
+ JSAN.use('util.window'); this.window = new util.window();
+ JSAN.use('util.network'); this.network = new util.network();
JSAN.use('util.widgets');
- this.w = window;
+ this.w = window;
}
patron.display.prototype = {
- 'retrieve_ids' : [],
- 'stop_checkouts' : false,
- 'check_stop_checkouts' : function() { return this.stop_checkouts; },
-
- 'init' : function( params ) {
-
- var obj = this;
-
- obj.barcode = params['barcode'];
- obj.id = params['id'];
-
- JSAN.use('OpenILS.data'); this.OpenILS = {};
- obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
-
- //var horizontal_interface = String( obj.OpenILS.data.hash.aous['ui.circ.patron_summary.horizontal'] ) == 'true';
- //document.getElementById('ui.circ.patron_summary.horizontal').setAttribute('orient', horizontal_interface ? 'vertical' : 'horizontal');
- //document.getElementById('pdms1').setAttribute('orient', horizontal_interface ? 'vertical' : 'horizontal');
-
- JSAN.use('util.deck');
- obj.right_deck = new util.deck('patron_right_deck');
- obj.left_deck = new util.deck('patron_left_deck');
-
- JSAN.use('util.controller'); obj.controller = new util.controller();
- obj.controller.init(
- {
- control_map : {
- 'cmd_broken' : [
- ['command'],
- function() { alert($("commonStrings").getString('common.unimplemented')); }
- ],
- 'cmd_patron_retrieve' : [
- ['command'],
- function(ev) {
- if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') {
- for (var i = 0; i < obj.retrieve_ids.length; i++) {
- try {
- window.xulG.new_patron_tab(
- {}, { 'id' : obj.retrieve_ids[i] }
- );
- } catch(E) {
- alert(E);
- }
- }
- }
- }
- ],
+ 'retrieve_ids' : [],
+ 'stop_checkouts' : false,
+ 'check_stop_checkouts' : function() { return this.stop_checkouts; },
+
+ 'init' : function( params ) {
+
+ var obj = this;
+
+ obj.barcode = params['barcode'];
+ obj.id = params['id'];
+
+ JSAN.use('OpenILS.data'); this.OpenILS = {};
+ obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
+
+ //var horizontal_interface = String( obj.OpenILS.data.hash.aous['ui.circ.patron_summary.horizontal'] ) == 'true';
+ //document.getElementById('ui.circ.patron_summary.horizontal').setAttribute('orient', horizontal_interface ? 'vertical' : 'horizontal');
+ //document.getElementById('pdms1').setAttribute('orient', horizontal_interface ? 'vertical' : 'horizontal');
+
+ JSAN.use('util.deck');
+ obj.right_deck = new util.deck('patron_right_deck');
+ obj.left_deck = new util.deck('patron_left_deck');
+
+ JSAN.use('util.controller'); obj.controller = new util.controller();
+ obj.controller.init(
+ {
+ control_map : {
+ 'cmd_broken' : [
+ ['command'],
+ function() { alert($("commonStrings").getString('common.unimplemented')); }
+ ],
+ 'cmd_patron_retrieve' : [
+ ['command'],
+ function(ev) {
+ if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') {
+ for (var i = 0; i < obj.retrieve_ids.length; i++) {
+ try {
+ window.xulG.new_patron_tab(
+ {}, { 'id' : obj.retrieve_ids[i] }
+ );
+ } catch(E) {
+ alert(E);
+ }
+ }
+ }
+ }
+ ],
'cmd_patron_merge' : [
['command'],
function(ev) {
@@ -129,230 +129,230 @@ patron.display.prototype = {
}
}
],
- 'cmd_search_form' : [
- ['command'],
- function(ev) {
- obj.controller.view.cmd_search_form.setAttribute('disabled','true');
- obj.left_deck.node.selectedIndex = 0;
- obj.controller.view.patron_name.setAttribute('value', $("patronStrings").getString('staff.patron.display.cmd_search_form.no_patron'));
- removeCSSClass(document.documentElement,'PATRON_HAS_BILLS');
- removeCSSClass(document.documentElement,'PATRON_HAS_OVERDUES');
- removeCSSClass(document.documentElement,'PATRON_HAS_NOTES');
- removeCSSClass(document.documentElement,'PATRON_EXCEEDS_CHECKOUT_COUNT');
- removeCSSClass(document.documentElement,'PATRON_EXCEEDS_OVERDUE_COUNT');
- removeCSSClass(document.documentElement,'PATRON_EXCEEDS_FINES');
- removeCSSClass(document.documentElement,'NO_PENALTIES');
- removeCSSClass(document.documentElement,'ONE_PENALTY');
- removeCSSClass(document.documentElement,'MULTIPLE_PENALTIES');
- removeCSSClass(document.documentElement,'PATRON_HAS_ALERT');
- removeCSSClass(document.documentElement,'PATRON_BARRED');
- removeCSSClass(document.documentElement,'PATRON_INACTIVE');
- removeCSSClass(document.documentElement,'PATRON_EXPIRED');
- removeCSSClass(document.documentElement,'PATRON_HAS_INVALID_DOB');
- removeCSSClass(document.documentElement,'PATRON_JUVENILE');
- removeCSSClass(document.documentElement,'PATRON_HAS_INVALID_ADDRESS');
- removeCSSClass(document.documentElement,'PATRON_AGE_GE_65');
- removeCSSClass(document.documentElement,'PATRON_AGE_LT_65');
- removeCSSClass(document.documentElement,'PATRON_AGE_GE_24');
- removeCSSClass(document.documentElement,'PATRON_AGE_LT_24');
- removeCSSClass(document.documentElement,'PATRON_AGE_GE_21');
- removeCSSClass(document.documentElement,'PATRON_AGE_LT_21');
- removeCSSClass(document.documentElement,'PATRON_AGE_GE_18');
- removeCSSClass(document.documentElement,'PATRON_AGE_LT_18');
- removeCSSClass(document.documentElement,'PATRON_AGE_GE_13');
- removeCSSClass(document.documentElement,'PATRON_AGE_LT_13');
- removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_1');
- removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_2');
- removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_3');
- }
- ],
- 'cmd_patron_refresh' : [
- ['command'],
- function(ev) {
+ 'cmd_search_form' : [
+ ['command'],
+ function(ev) {
+ obj.controller.view.cmd_search_form.setAttribute('disabled','true');
+ obj.left_deck.node.selectedIndex = 0;
+ obj.controller.view.patron_name.setAttribute('value', $("patronStrings").getString('staff.patron.display.cmd_search_form.no_patron'));
+ removeCSSClass(document.documentElement,'PATRON_HAS_BILLS');
+ removeCSSClass(document.documentElement,'PATRON_HAS_OVERDUES');
+ removeCSSClass(document.documentElement,'PATRON_HAS_NOTES');
+ removeCSSClass(document.documentElement,'PATRON_EXCEEDS_CHECKOUT_COUNT');
+ removeCSSClass(document.documentElement,'PATRON_EXCEEDS_OVERDUE_COUNT');
+ removeCSSClass(document.documentElement,'PATRON_EXCEEDS_FINES');
+ removeCSSClass(document.documentElement,'NO_PENALTIES');
+ removeCSSClass(document.documentElement,'ONE_PENALTY');
+ removeCSSClass(document.documentElement,'MULTIPLE_PENALTIES');
+ removeCSSClass(document.documentElement,'PATRON_HAS_ALERT');
+ removeCSSClass(document.documentElement,'PATRON_BARRED');
+ removeCSSClass(document.documentElement,'PATRON_INACTIVE');
+ removeCSSClass(document.documentElement,'PATRON_EXPIRED');
+ removeCSSClass(document.documentElement,'PATRON_HAS_INVALID_DOB');
+ removeCSSClass(document.documentElement,'PATRON_JUVENILE');
+ removeCSSClass(document.documentElement,'PATRON_HAS_INVALID_ADDRESS');
+ removeCSSClass(document.documentElement,'PATRON_AGE_GE_65');
+ removeCSSClass(document.documentElement,'PATRON_AGE_LT_65');
+ removeCSSClass(document.documentElement,'PATRON_AGE_GE_24');
+ removeCSSClass(document.documentElement,'PATRON_AGE_LT_24');
+ removeCSSClass(document.documentElement,'PATRON_AGE_GE_21');
+ removeCSSClass(document.documentElement,'PATRON_AGE_LT_21');
+ removeCSSClass(document.documentElement,'PATRON_AGE_GE_18');
+ removeCSSClass(document.documentElement,'PATRON_AGE_LT_18');
+ removeCSSClass(document.documentElement,'PATRON_AGE_GE_13');
+ removeCSSClass(document.documentElement,'PATRON_AGE_LT_13');
+ removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_1');
+ removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_2');
+ removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_3');
+ }
+ ],
+ 'cmd_patron_refresh' : [
+ ['command'],
+ function(ev) {
try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible( document.getElementById("PatronNavBar_refresh" ) ); } catch(E) {};
- obj.network.simple_request(
- 'RECALCULATE_STANDING_PENALTIES',
- [ ses(), obj.patron.id() ]
- );
- obj.refresh_all();
- }
- ],
- 'cmd_patron_checkout' : [
- ['command'],
+ obj.network.simple_request(
+ 'RECALCULATE_STANDING_PENALTIES',
+ [ ses(), obj.patron.id() ]
+ );
+ obj.refresh_all();
+ }
+ ],
+ 'cmd_patron_checkout' : [
+ ['command'],
function(ev) {
- obj.reset_nav_styling('cmd_patron_checkout');
+ obj.reset_nav_styling('cmd_patron_checkout');
obj.spawn_checkout_interface();
}
- ],
- 'cmd_patron_items' : [
- ['command'],
- function(ev) {
+ ],
+ 'cmd_patron_items' : [
+ ['command'],
+ function(ev) {
try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible( document.getElementById("PatronNavBar_items" ) ); } catch(E) {};
- obj.reset_nav_styling('cmd_patron_items');
- var frame = obj.right_deck.set_iframe(
- urls.XUL_PATRON_ITEMS,
- //+ '?patron_id=' + window.escape( obj.patron.id() ),
- {},
- {
- 'patron_id' : obj.patron.id(),
- 'on_list_change' : function(b) {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.summary_window.g.summary.controller.render('patron_checkouts');
- obj.summary_window.g.summary.controller.render('patron_standing_penalties');
- obj.summary_window.g.summary.controller.render('patron_bill');
- obj.bill_window.g.bills.refresh(true);
- },
- 'url_prefix' : xulG.url_prefix,
- 'new_tab' : xulG.new_tab,
- 'new_patron_tab' : xulG.new_patron_tab
- }
- );
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.items_window = get_contentWindow(frame);
- }
- ],
- 'cmd_patron_edit' : [
- ['command'],
- function(ev) {
+ obj.reset_nav_styling('cmd_patron_items');
+ var frame = obj.right_deck.set_iframe(
+ urls.XUL_PATRON_ITEMS,
+ //+ '?patron_id=' + window.escape( obj.patron.id() ),
+ {},
+ {
+ 'patron_id' : obj.patron.id(),
+ 'on_list_change' : function(b) {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ obj.summary_window.g.summary.controller.render('patron_checkouts');
+ obj.summary_window.g.summary.controller.render('patron_standing_penalties');
+ obj.summary_window.g.summary.controller.render('patron_bill');
+ obj.bill_window.g.bills.refresh(true);
+ },
+ 'url_prefix' : xulG.url_prefix,
+ 'new_tab' : xulG.new_tab,
+ 'new_patron_tab' : xulG.new_patron_tab
+ }
+ );
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ obj.items_window = get_contentWindow(frame);
+ }
+ ],
+ 'cmd_patron_edit' : [
+ ['command'],
+ function(ev) {
try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible( document.getElementById("PatronNavBar_edit" ) ); } catch(E) {};
- obj.reset_nav_styling('cmd_patron_edit');
-
- function spawn_search(s) {
- obj.error.sdump('D_TRACE', $("commonStrings").getFormattedString('staff.patron.display.cmd_patron_edit.edit_search', [js2JSON(s)]) );
- obj.OpenILS.data.stash_retrieve();
- xulG.new_patron_tab( {}, { 'doit' : 1, 'query' : s } );
- }
-
- function spawn_editor(p) {
- var url = urls.XUL_PATRON_EDIT;
- //var param_count = 0;
- //for (var i in p) {
- // if (param_count++ == 0) url += '?'; else url += '&';
- // url += i + '=' + window.escape(p[i]);
- //}
- var loc = xulG.url_prefix( urls.XUL_REMOTE_BROWSER ); // + '?url=' + window.escape( url );
- xulG.new_tab(
- loc,
- {},
- {
- 'url' : url,
- 'show_print_button' : true ,
- 'tab_name' : $("patronStrings").getString('staff.patron.display.spawn_editor.editing_related_patron'),
- 'passthru_content_params' : {
- 'spawn_search' : spawn_search,
- 'spawn_editor' : spawn_editor,
- 'url_prefix' : xulG.url_prefix,
- 'new_tab' : xulG.new_tab,
- 'new_patron_tab' : xulG.new_patron_tab,
- 'params' : p
- }
- }
- );
- }
-
- obj.right_deck.set_iframe(
- urls.XUL_REMOTE_BROWSER + '?patron_edit=1',
- //+ '?url=' + window.escape(
- // urls.XUL_PATRON_EDIT
- // + '?ses=' + window.escape( ses() )
- // + '&usr=' + window.escape( obj.patron.id() )
- //),
- {}, {
- 'url' : urls.XUL_PATRON_EDIT,
- 'show_print_button' : true,
- 'passthru_content_params' : {
- 'params' : {
- 'ses' : ses(),
- 'usr' : obj.patron.id()
- },
- 'on_save' : function(p) {
- try {
- if (obj.barcode) obj.barcode = p.card().barcode();
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- //obj.summary_window.g.summary.retrieve();
- obj.refresh_all();
- } catch(E) {
- alert(E);
- }
- },
- 'spawn_search' : spawn_search,
- 'spawn_editor' : spawn_editor,
- 'url_prefix' : xulG.url_prefix,
- 'new_tab' : xulG.new_tab,
- 'new_patron_tab' : xulG.new_patron_tab
- }
- }
- );
- }
- ],
+ obj.reset_nav_styling('cmd_patron_edit');
+
+ function spawn_search(s) {
+ obj.error.sdump('D_TRACE', $("commonStrings").getFormattedString('staff.patron.display.cmd_patron_edit.edit_search', [js2JSON(s)]) );
+ obj.OpenILS.data.stash_retrieve();
+ xulG.new_patron_tab( {}, { 'doit' : 1, 'query' : s } );
+ }
+
+ function spawn_editor(p) {
+ var url = urls.XUL_PATRON_EDIT;
+ //var param_count = 0;
+ //for (var i in p) {
+ // if (param_count++ == 0) url += '?'; else url += '&';
+ // url += i + '=' + window.escape(p[i]);
+ //}
+ var loc = xulG.url_prefix( urls.XUL_REMOTE_BROWSER ); // + '?url=' + window.escape( url );
+ xulG.new_tab(
+ loc,
+ {},
+ {
+ 'url' : url,
+ 'show_print_button' : true ,
+ 'tab_name' : $("patronStrings").getString('staff.patron.display.spawn_editor.editing_related_patron'),
+ 'passthru_content_params' : {
+ 'spawn_search' : spawn_search,
+ 'spawn_editor' : spawn_editor,
+ 'url_prefix' : xulG.url_prefix,
+ 'new_tab' : xulG.new_tab,
+ 'new_patron_tab' : xulG.new_patron_tab,
+ 'params' : p
+ }
+ }
+ );
+ }
+
+ obj.right_deck.set_iframe(
+ urls.XUL_REMOTE_BROWSER + '?patron_edit=1',
+ //+ '?url=' + window.escape(
+ // urls.XUL_PATRON_EDIT
+ // + '?ses=' + window.escape( ses() )
+ // + '&usr=' + window.escape( obj.patron.id() )
+ //),
+ {}, {
+ 'url' : urls.XUL_PATRON_EDIT,
+ 'show_print_button' : true,
+ 'passthru_content_params' : {
+ 'params' : {
+ 'ses' : ses(),
+ 'usr' : obj.patron.id()
+ },
+ 'on_save' : function(p) {
+ try {
+ if (obj.barcode) obj.barcode = p.card().barcode();
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ //obj.summary_window.g.summary.retrieve();
+ obj.refresh_all();
+ } catch(E) {
+ alert(E);
+ }
+ },
+ 'spawn_search' : spawn_search,
+ 'spawn_editor' : spawn_editor,
+ 'url_prefix' : xulG.url_prefix,
+ 'new_tab' : xulG.new_tab,
+ 'new_patron_tab' : xulG.new_patron_tab
+ }
+ }
+ );
+ }
+ ],
'cmd_patron_other' : [
- ['command'],
- function(ev) {
+ ['command'],
+ function(ev) {
try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible( document.getElementById("PatronNavBar_other" ) ); } catch(E) {};
- obj.reset_nav_styling('cmd_patron_other');
+ obj.reset_nav_styling('cmd_patron_other');
try { document.getElementById('PatronNavBar_other').firstChild.showPopup(); } catch(E) {};
}
],
- 'cmd_patron_info_notes' : [
- ['command'],
- function(ev) {
- obj.right_deck.set_iframe(
+ 'cmd_patron_info_notes' : [
+ ['command'],
+ function(ev) {
+ obj.right_deck.set_iframe(
urls.XUL_PATRON_INFO_NOTES,
- {},
- {
- 'patron_id' : obj.patron.id(),
- 'url_prefix' : xulG.url_prefix,
- 'new_tab' : xulG.new_tab,
- 'new_patron_tab' : xulG.new_patron_tab
- }
- );
- }
- ],
- 'cmd_patron_info_stats' : [
- ['command'],
- function(ev) {
- obj.right_deck.set_iframe(
+ {},
+ {
+ 'patron_id' : obj.patron.id(),
+ 'url_prefix' : xulG.url_prefix,
+ 'new_tab' : xulG.new_tab,
+ 'new_patron_tab' : xulG.new_patron_tab
+ }
+ );
+ }
+ ],
+ 'cmd_patron_info_stats' : [
+ ['command'],
+ function(ev) {
+ obj.right_deck.set_iframe(
urls.XUL_PATRON_INFO_STAT_CATS,
- {},
- {
- 'patron_id' : obj.patron.id(),
- 'url_prefix' : xulG.url_prefix,
- 'new_tab' : xulG.new_tab,
- 'new_patron_tab' : xulG.new_patron_tab
- }
- );
- }
- ],
- 'cmd_patron_info_surveys' : [
- ['command'],
- function(ev) {
- obj.right_deck.set_iframe(
+ {},
+ {
+ 'patron_id' : obj.patron.id(),
+ 'url_prefix' : xulG.url_prefix,
+ 'new_tab' : xulG.new_tab,
+ 'new_patron_tab' : xulG.new_patron_tab
+ }
+ );
+ }
+ ],
+ 'cmd_patron_info_surveys' : [
+ ['command'],
+ function(ev) {
+ obj.right_deck.set_iframe(
urls.XUL_PATRON_INFO_SURVEYS,
- {},
- {
- 'patron_id' : obj.patron.id(),
- 'url_prefix' : xulG.url_prefix,
- 'new_tab' : xulG.new_tab,
- 'new_patron_tab' : xulG.new_patron_tab
- }
- );
- }
- ],
- 'cmd_patron_info_groups' : [
- ['command'],
- function(ev) {
- obj.right_deck.set_iframe(
+ {},
+ {
+ 'patron_id' : obj.patron.id(),
+ 'url_prefix' : xulG.url_prefix,
+ 'new_tab' : xulG.new_tab,
+ 'new_patron_tab' : xulG.new_patron_tab
+ }
+ );
+ }
+ ],
+ 'cmd_patron_info_groups' : [
+ ['command'],
+ function(ev) {
+ obj.right_deck.set_iframe(
urls.XUL_PATRON_INFO_GROUP,
- {},
- {
- 'patron_id' : obj.patron.id(),
- 'url_prefix' : xulG.url_prefix,
- 'new_tab' : xulG.new_tab,
- 'new_patron_tab' : xulG.new_patron_tab
- }
- );
- }
- ],
+ {},
+ {
+ 'patron_id' : obj.patron.id(),
+ 'url_prefix' : xulG.url_prefix,
+ 'new_tab' : xulG.new_tab,
+ 'new_patron_tab' : xulG.new_patron_tab
+ }
+ );
+ }
+ ],
'cmd_patron_alert' : [
['command'],
function(ev) {
@@ -363,20 +363,20 @@ patron.display.prototype = {
}
}
],
- 'cmd_patron_exit' : [
- ['command'],
- function(ev) {
- xulG.set_tab(urls.XUL_PATRON_BARCODE_ENTRY,{},{});
- }
- ],
- 'cmd_patron_holds' : [
- ['command'],
- function(ev) {
+ 'cmd_patron_exit' : [
+ ['command'],
+ function(ev) {
+ xulG.set_tab(urls.XUL_PATRON_BARCODE_ENTRY,{},{});
+ }
+ ],
+ 'cmd_patron_holds' : [
+ ['command'],
+ function(ev) {
try {
try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible( document.getElementById("PatronNavBar_holds" ) ); } catch(E) {};
obj.reset_nav_styling('cmd_patron_holds');
obj.right_deck.set_iframe(
- urls.XUL_PATRON_HOLDS,
+ urls.XUL_PATRON_HOLDS,
//+ '?patron_id=' + window.escape( obj.patron.id() ),
{},
{
@@ -393,55 +393,55 @@ patron.display.prototype = {
},
'url_prefix' : xulG.url_prefix,
'new_tab' : xulG.new_tab,
- 'new_patron_tab' : xulG.new_patron_tab
+ 'new_patron_tab' : xulG.new_patron_tab
}
);
} catch(E) {
alert(E);
}
- }
- ],
- 'cmd_patron_bills' : [
- ['command'],
- function(ev) {
+ }
+ ],
+ 'cmd_patron_bills' : [
+ ['command'],
+ function(ev) {
try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible( document.getElementById("PatronNavBar_bills" ) ); } catch(E) {};
- obj.reset_nav_styling('cmd_patron_bills');
- var f = obj.right_deck.set_iframe(
- urls.XUL_PATRON_BILLS,
- //+ '?patron_id=' + window.escape( obj.patron.id() ),
- {},
- {
+ obj.reset_nav_styling('cmd_patron_bills');
+ var f = obj.right_deck.set_iframe(
+ urls.XUL_PATRON_BILLS,
+ //+ '?patron_id=' + window.escape( obj.patron.id() ),
+ {},
+ {
'display_window' : window,
- 'patron_id' : obj.patron.id(),
- 'url_prefix' : xulG.url_prefix,
- 'on_money_change' : function(b) {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.refresh_all();
- }
- }
- );
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.bill_window = get_contentWindow(f);
- }
- ],
- 'patron_name' : [
- ['render'],
- function(e) {
- return function() {
- JSAN.use('patron.util');
- e.setAttribute('value',
+ 'patron_id' : obj.patron.id(),
+ 'url_prefix' : xulG.url_prefix,
+ 'on_money_change' : function(b) {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ obj.refresh_all();
+ }
+ }
+ );
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ obj.bill_window = get_contentWindow(f);
+ }
+ ],
+ 'patron_name' : [
+ ['render'],
+ function(e) {
+ return function() {
+ JSAN.use('patron.util');
+ e.setAttribute('value',
patron.util.format_name( obj.patron )
- );
+ );
patron.util.set_penalty_css(obj.patron);
- };
- }
- ],
- 'PatronNavBar' : [
- ['render'],
- function(e) {
- return function() {}
- }
- ],
+ };
+ }
+ ],
+ 'PatronNavBar' : [
+ ['render'],
+ function(e) {
+ return function() {}
+ }
+ ],
'cmd_verify_credentials' : [
['command'],
function() {
@@ -466,7 +466,7 @@ patron.display.prototype = {
function() {
function penalty_interface() {
try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible( document.getElementById("PatronNavBar_messages" ) ); } catch(E) {};
- obj.reset_nav_styling('cmd_standing_penalties');
+ obj.reset_nav_styling('cmd_standing_penalties');
return obj.right_deck.set_iframe(
urls.XUL_STANDING_PENALTIES,
{},
@@ -481,9 +481,9 @@ patron.display.prototype = {
penalty_interface();
}
]
- }
- }
- );
+ }
+ }
+ );
var x = document.getElementById("PatronNavBar_checkout");
x.addEventListener( 'focus', function(xx) { return function() { try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible(xx); } catch(E) {}; } }(x), false);
@@ -502,60 +502,60 @@ patron.display.prototype = {
var x = document.getElementById("PatronNavBar_messages");
x.addEventListener( 'focus', function(xx) { return function() { try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible(xx); } catch(E) {}; } }(x), false);
- if (obj.barcode || obj.id) {
- if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
- try { window.xulG.set_tab_name($("patronStrings").getString('staff.patron.display.init.retrieving_patron')); } catch(E) { alert(E); }
- }
-
- obj.controller.view.PatronNavBar.selectedIndex = 1;
- JSAN.use('util.widgets');
- util.widgets.enable_accesskeys_in_node_and_children(
- obj.controller.view.PatronNavBar.lastChild
- );
- util.widgets.disable_accesskeys_in_node_and_children(
- obj.controller.view.PatronNavBar.firstChild
- );
- obj.controller.view.cmd_patron_refresh.setAttribute('disabled','true');
- obj.controller.view.cmd_patron_checkout.setAttribute('disabled','true');
- obj.controller.view.cmd_patron_items.setAttribute('disabled','true');
- obj.controller.view.cmd_patron_holds.setAttribute('disabled','true');
- obj.controller.view.cmd_patron_bills.setAttribute('disabled','true');
- obj.controller.view.cmd_patron_edit.setAttribute('disabled','true');
- obj.controller.view.patron_name.setAttribute('value', $("patronStrings").getString('staff.patron.display.init.retrieving'));
- document.documentElement.setAttribute('class','');
- var frame = obj.left_deck.set_iframe(
- urls.XUL_PATRON_SUMMARY,
- {},
- {
+ if (obj.barcode || obj.id) {
+ if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
+ try { window.xulG.set_tab_name($("patronStrings").getString('staff.patron.display.init.retrieving_patron')); } catch(E) { alert(E); }
+ }
+
+ obj.controller.view.PatronNavBar.selectedIndex = 1;
+ JSAN.use('util.widgets');
+ util.widgets.enable_accesskeys_in_node_and_children(
+ obj.controller.view.PatronNavBar.lastChild
+ );
+ util.widgets.disable_accesskeys_in_node_and_children(
+ obj.controller.view.PatronNavBar.firstChild
+ );
+ obj.controller.view.cmd_patron_refresh.setAttribute('disabled','true');
+ obj.controller.view.cmd_patron_checkout.setAttribute('disabled','true');
+ obj.controller.view.cmd_patron_items.setAttribute('disabled','true');
+ obj.controller.view.cmd_patron_holds.setAttribute('disabled','true');
+ obj.controller.view.cmd_patron_bills.setAttribute('disabled','true');
+ obj.controller.view.cmd_patron_edit.setAttribute('disabled','true');
+ obj.controller.view.patron_name.setAttribute('value', $("patronStrings").getString('staff.patron.display.init.retrieving'));
+ document.documentElement.setAttribute('class','');
+ var frame = obj.left_deck.set_iframe(
+ urls.XUL_PATRON_SUMMARY,
+ {},
+ {
'display_window' : window,
- 'barcode' : obj.barcode,
- 'id' : obj.id,
+ 'barcode' : obj.barcode,
+ 'id' : obj.id,
'refresh' : function() { obj.refresh_all(); },
- 'on_finished' : obj.gen_patron_summary_finish_func(),
+ 'on_finished' : obj.gen_patron_summary_finish_func(),
'stop_sign_page' : obj.gen_patron_stop_sign_page_func(),
- 'on_error' : function(E) {
- try {
- var error;
- if (typeof E.ilsevent != 'undefined') {
- error = E.textcode;
- } else {
- error = js2JSON(E).substr(0,100);
- }
- location.href = urls.XUL_PATRON_BARCODE_ENTRY + '?error=' + window.escape(error);
- } catch(F) {
- alert(F);
- }
- }
- }
- );
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.summary_window = get_contentWindow(frame);
- } else {
- obj.render_search_form(params);
- }
- },
-
- 'reset_nav_styling' : function(btn,dont_hide_summary) {
+ 'on_error' : function(E) {
+ try {
+ var error;
+ if (typeof E.ilsevent != 'undefined') {
+ error = E.textcode;
+ } else {
+ error = js2JSON(E).substr(0,100);
+ }
+ location.href = urls.XUL_PATRON_BARCODE_ENTRY + '?error=' + window.escape(error);
+ } catch(F) {
+ alert(F);
+ }
+ }
+ }
+ );
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ obj.summary_window = get_contentWindow(frame);
+ } else {
+ obj.render_search_form(params);
+ }
+ },
+
+ 'reset_nav_styling' : function(btn,dont_hide_summary) {
try {
this.controller.view.cmd_patron_checkout.setAttribute('style','');
this.controller.view.cmd_patron_items.setAttribute('style','');
@@ -576,121 +576,121 @@ patron.display.prototype = {
} catch(E) {
alert(E);
}
- },
-
- 'render_search_form' : function(params) {
- var obj = this;
- if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
- try { window.xulG.set_tab_name($("patronStrings").getString('staff.patron.display.render_search_form.patron_search')); } catch(E) { alert(E); }
- }
-
- obj.controller.view.PatronNavBar.selectedIndex = 0;
- obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','true');
- obj.controller.view.cmd_patron_merge.setAttribute('disabled','true');
- obj.controller.view.cmd_search_form.setAttribute('disabled','true');
-
- var horizontal_interface = String( obj.OpenILS.data.hash.aous['ui.circ.patron_summary.horizontal'] ) == 'true';
- var loc = horizontal_interface ? urls.XUL_PATRON_HORIZONTAL_SEARCH_FORM : urls.XUL_PATRON_SEARCH_FORM;
- var my_xulG = {
- 'clear_left_deck' : function() {
- setTimeout( function() {
- obj.left_deck.clear_all_except(loc);
- obj.render_search_form(params);
- }, 0);
- },
- 'on_submit' : function(query,search_limit,search_sort) {
- obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','true');
- obj.controller.view.cmd_patron_merge.setAttribute('disabled','true');
- var list_frame = obj.right_deck.reset_iframe(
- urls.XUL_PATRON_SEARCH_RESULT, // + '?' + query,
- {},
- {
- 'query' : query,
- 'search_limit' : search_limit,
- 'search_sort' : search_sort,
- 'on_select' : function(list) {
- if (!list) return;
- if (list.length < 1) return;
- obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','false');
- if (list.length > 1) obj.controller.view.cmd_patron_merge.setAttribute('disabled','false');
- obj.controller.view.cmd_search_form.setAttribute('disabled','false');
- obj.retrieve_ids = list;
- obj.controller.view.patron_name.setAttribute('value',$("patronStrings").getString('staff.patron.display.init.retrieving'));
- document.documentElement.setAttribute('class','');
- setTimeout(
- function() {
- var frame = obj.left_deck.set_iframe(
- urls.XUL_PATRON_SUMMARY + '?id=' + window.escape(list[0]),
- {},
- {
- //'id' : list[0],
- 'on_finished' : function(patron) {
- obj.patron = patron;
- obj.controller.render();
- }
- }
- );
- netscape.security.PrivilegeManager.enablePrivilege(
- "UniversalXPConnect"
- );
- obj.summary_window = get_contentWindow(frame);
- obj.patron = obj.summary_window.g.summary.patron;
- obj.controller.render('patron_name');
- }, 0
- );
- }
- }
- );
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.search_result = get_contentWindow(list_frame);
- }
- };
-
- if (params['query']) {
- my_xulG.query = JSON2js(params['query']);
- if (params.doit) my_xulG.doit = 1;
- }
-
- var form_frame = obj.left_deck.set_iframe(
- loc,
- {},
- my_xulG
- );
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.search_window = get_contentWindow(form_frame);
- obj._checkout_spawned = true;
- },
-
- '_checkout_spawned' : false,
-
- 'refresh_deck' : function(url) {
- var obj = this;
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- for (var i = 0; i < obj.right_deck.node.childNodes.length; i++) {
- try {
- var f = obj.right_deck.node.childNodes[i];
- var w = get_contentWindow(f);
- if (url) {
- if (w.location.href == url) w.refresh(true);
- } else {
- if (typeof w.refresh == 'function') {
- w.refresh(true);
- }
- }
-
- } catch(E) {
- obj.error.sdump('D_ERROR','refresh_deck: ' + E + '\n');
- }
- }
- },
-
- 'refresh_all' : function() {
- var obj = this;
- obj.controller.view.patron_name.setAttribute('value', $("patronStrings").getString('staff.patron.display.init.retrieving'));
- document.documentElement.setAttribute('class','');
- try { obj.summary_window.refresh(); } catch(E) { obj.error.sdump('D_ERROR', E + '\n'); }
- try { obj.refresh_deck(); } catch(E) { obj.error.sdump('D_ERROR', E + '\n'); }
- },
+ },
+
+ 'render_search_form' : function(params) {
+ var obj = this;
+ if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
+ try { window.xulG.set_tab_name($("patronStrings").getString('staff.patron.display.render_search_form.patron_search')); } catch(E) { alert(E); }
+ }
+
+ obj.controller.view.PatronNavBar.selectedIndex = 0;
+ obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','true');
+ obj.controller.view.cmd_patron_merge.setAttribute('disabled','true');
+ obj.controller.view.cmd_search_form.setAttribute('disabled','true');
+
+ var horizontal_interface = String( obj.OpenILS.data.hash.aous['ui.circ.patron_summary.horizontal'] ) == 'true';
+ var loc = horizontal_interface ? urls.XUL_PATRON_HORIZONTAL_SEARCH_FORM : urls.XUL_PATRON_SEARCH_FORM;
+ var my_xulG = {
+ 'clear_left_deck' : function() {
+ setTimeout( function() {
+ obj.left_deck.clear_all_except(loc);
+ obj.render_search_form(params);
+ }, 0);
+ },
+ 'on_submit' : function(query,search_limit,search_sort) {
+ obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','true');
+ obj.controller.view.cmd_patron_merge.setAttribute('disabled','true');
+ var list_frame = obj.right_deck.reset_iframe(
+ urls.XUL_PATRON_SEARCH_RESULT, // + '?' + query,
+ {},
+ {
+ 'query' : query,
+ 'search_limit' : search_limit,
+ 'search_sort' : search_sort,
+ 'on_select' : function(list) {
+ if (!list) return;
+ if (list.length < 1) return;
+ obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','false');
+ if (list.length > 1) obj.controller.view.cmd_patron_merge.setAttribute('disabled','false');
+ obj.controller.view.cmd_search_form.setAttribute('disabled','false');
+ obj.retrieve_ids = list;
+ obj.controller.view.patron_name.setAttribute('value',$("patronStrings").getString('staff.patron.display.init.retrieving'));
+ document.documentElement.setAttribute('class','');
+ setTimeout(
+ function() {
+ var frame = obj.left_deck.set_iframe(
+ urls.XUL_PATRON_SUMMARY + '?id=' + window.escape(list[0]),
+ {},
+ {
+ //'id' : list[0],
+ 'on_finished' : function(patron) {
+ obj.patron = patron;
+ obj.controller.render();
+ }
+ }
+ );
+ netscape.security.PrivilegeManager.enablePrivilege(
+ "UniversalXPConnect"
+ );
+ obj.summary_window = get_contentWindow(frame);
+ obj.patron = obj.summary_window.g.summary.patron;
+ obj.controller.render('patron_name');
+ }, 0
+ );
+ }
+ }
+ );
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ obj.search_result = get_contentWindow(list_frame);
+ }
+ };
+
+ if (params['query']) {
+ my_xulG.query = JSON2js(params['query']);
+ if (params.doit) my_xulG.doit = 1;
+ }
+
+ var form_frame = obj.left_deck.set_iframe(
+ loc,
+ {},
+ my_xulG
+ );
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ obj.search_window = get_contentWindow(form_frame);
+ obj._checkout_spawned = true;
+ },
+
+ '_checkout_spawned' : false,
+
+ 'refresh_deck' : function(url) {
+ var obj = this;
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ for (var i = 0; i < obj.right_deck.node.childNodes.length; i++) {
+ try {
+ var f = obj.right_deck.node.childNodes[i];
+ var w = get_contentWindow(f);
+ if (url) {
+ if (w.location.href == url) w.refresh(true);
+ } else {
+ if (typeof w.refresh == 'function') {
+ w.refresh(true);
+ }
+ }
+
+ } catch(E) {
+ obj.error.sdump('D_ERROR','refresh_deck: ' + E + '\n');
+ }
+ }
+ },
+
+ 'refresh_all' : function() {
+ var obj = this;
+ obj.controller.view.patron_name.setAttribute('value', $("patronStrings").getString('staff.patron.display.init.retrieving'));
+ document.documentElement.setAttribute('class','');
+ try { obj.summary_window.refresh(); } catch(E) { obj.error.sdump('D_ERROR', E + '\n'); }
+ try { obj.refresh_deck(); } catch(E) { obj.error.sdump('D_ERROR', E + '\n'); }
+ },
'spawn_checkout_interface' : function() {
var obj = this;
diff --git a/Open-ILS/xul/staff_client/server/patron/edit_standing_penalty.js b/Open-ILS/xul/staff_client/server/patron/edit_standing_penalty.js
index 8523e06a48..5445826c47 100644
--- a/Open-ILS/xul/staff_client/server/patron/edit_standing_penalty.js
+++ b/Open-ILS/xul/staff_client/server/patron/edit_standing_penalty.js
@@ -17,7 +17,7 @@ function edit_penalty_init() {
JSAN.errorLevel = "die"; // none, warn, or die
JSAN.addRepository('..');
- JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
+ JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
JSAN.use('util.error'); error = new util.error();
JSAN.use('util.widgets');
diff --git a/Open-ILS/xul/staff_client/server/patron/hold_cancel.js b/Open-ILS/xul/staff_client/server/patron/hold_cancel.js
index 8f3bf51e87..9bef546223 100644
--- a/Open-ILS/xul/staff_client/server/patron/hold_cancel.js
+++ b/Open-ILS/xul/staff_client/server/patron/hold_cancel.js
@@ -17,7 +17,7 @@ function hold_cancel_init() {
JSAN.errorLevel = "die"; // none, warn, or die
JSAN.addRepository('..');
- JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
+ JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
JSAN.use('util.error'); error = new util.error();
JSAN.use('util.widgets');
diff --git a/Open-ILS/xul/staff_client/server/patron/holds.js b/Open-ILS/xul/staff_client/server/patron/holds.js
index 28e339e49a..57edc58e3f 100644
--- a/Open-ILS/xul/staff_client/server/patron/holds.js
+++ b/Open-ILS/xul/staff_client/server/patron/holds.js
@@ -5,9 +5,9 @@ function $(id) { return document.getElementById(id); }
if (typeof patron == 'undefined') patron = {};
patron.holds = function (params) {
- JSAN.use('util.error'); this.error = new util.error();
- JSAN.use('util.network'); this.network = new util.network();
- JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
+ JSAN.use('util.error'); this.error = new util.error();
+ JSAN.use('util.network'); this.network = new util.network();
+ JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
}
patron.holds.prototype = {
@@ -19,172 +19,172 @@ patron.holds.prototype = {
'current' : { 'limit' : 50, 'offset' : 0 }
},
- 'filter_lib' : null,
+ 'filter_lib' : null,
- 'retrieve_ids' : [],
+ 'retrieve_ids' : [],
- 'holds_map' : {},
+ 'holds_map' : {},
'flatten_copy' : function(hold) {
try { if ( hold.current_copy() && typeof hold.current_copy() == 'object') hold.current_copy( hold.current_copy().id() ); } catch(E) { alert('FIXME: Error flattening hold before hold update: ' + E); }
return hold;
},
- 'init' : function( params ) {
+ 'init' : function( params ) {
- var obj = this;
+ var obj = this;
- obj.patron_id = params['patron_id'];
- obj.patron_barcode = params['patron_barcode'];
- obj.docid = params['docid'];
- obj.shelf = params['shelf'];
- obj.tree_id = params['tree_id'];
+ obj.patron_id = params['patron_id'];
+ obj.patron_barcode = params['patron_barcode'];
+ obj.docid = params['docid'];
+ obj.shelf = params['shelf'];
+ obj.tree_id = params['tree_id'];
- JSAN.use('circ.util');
- var columns = circ.util.hold_columns(
- {
- 'title' : { 'hidden' : false, 'flex' : '3' },
- 'request_time' : { 'hidden' : false },
- 'pickup_lib_shortname' : { 'hidden' : false },
- 'hold_type' : { 'hidden' : false },
- 'current_copy' : { 'hidden' : false },
- 'capture_time' : { 'hidden' : false },
- 'notify_time' : { 'hidden' : false },
- 'notify_count' : { 'hidden' : false }
- }
- );
+ JSAN.use('circ.util');
+ var columns = circ.util.hold_columns(
+ {
+ 'title' : { 'hidden' : false, 'flex' : '3' },
+ 'request_time' : { 'hidden' : false },
+ 'pickup_lib_shortname' : { 'hidden' : false },
+ 'hold_type' : { 'hidden' : false },
+ 'current_copy' : { 'hidden' : false },
+ 'capture_time' : { 'hidden' : false },
+ 'notify_time' : { 'hidden' : false },
+ 'notify_count' : { 'hidden' : false }
+ }
+ );
- JSAN.use('util.list'); obj.list = new util.list( obj.tree_id || 'holds_list');
- obj.list.init(
- {
- 'columns' : columns,
- 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
- 'retrieve_row' : function(params) {
- var row = params.row;
- try {
- obj.network.simple_request('FM_AHR_BLOB_RETRIEVE.authoritative', [ ses(), row.my.hold_id ],
- function(blob_req) {
- try {
- var blob = blob_req.getResultObject();
- if (typeof blob.ilsevent != 'undefined') throw(blob);
- row.my.ahr = blob.hold;
- row.my.status = blob.status;
+ JSAN.use('util.list'); obj.list = new util.list( obj.tree_id || 'holds_list');
+ obj.list.init(
+ {
+ 'columns' : columns,
+ 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
+ 'retrieve_row' : function(params) {
+ var row = params.row;
+ try {
+ obj.network.simple_request('FM_AHR_BLOB_RETRIEVE.authoritative', [ ses(), row.my.hold_id ],
+ function(blob_req) {
+ try {
+ var blob = blob_req.getResultObject();
+ if (typeof blob.ilsevent != 'undefined') throw(blob);
+ row.my.ahr = blob.hold;
+ row.my.status = blob.status;
row.my.ahr.status( blob.status );
- row.my.acp = blob.copy;
- row.my.acn = blob.volume;
- row.my.mvr = blob.mvr;
- row.my.patron_family_name = blob.patron_last;
- row.my.patron_first_given_name = blob.patron_first;
- row.my.patron_barcode = blob.patron_barcode;
+ row.my.acp = blob.copy;
+ row.my.acn = blob.volume;
+ row.my.mvr = blob.mvr;
+ row.my.patron_family_name = blob.patron_last;
+ row.my.patron_first_given_name = blob.patron_first;
+ row.my.patron_barcode = blob.patron_barcode;
row.my.total_holds = blob.total_holds;
row.my.queue_position = blob.queue_position;
row.my.potential_copies = blob.potential_copies;
row.my.estimated_wait = blob.estimated_wait;
row.my.ahrn_count = blob.hold.notes().length;
- var copy_id = row.my.ahr.current_copy();
- if (typeof copy_id == 'object') {
- if (copy_id == null) {
- if (typeof row.my.acp == 'object' && row.my.acp != null) copy_id = row.my.acp.id();
- } else {
- copy_id = copy_id.id();
- }
- } else {
- copy_id = row.my.acp.id();
- }
+ var copy_id = row.my.ahr.current_copy();
+ if (typeof copy_id == 'object') {
+ if (copy_id == null) {
+ if (typeof row.my.acp == 'object' && row.my.acp != null) copy_id = row.my.acp.id();
+ } else {
+ copy_id = copy_id.id();
+ }
+ } else {
+ copy_id = row.my.acp.id();
+ }
- obj.holds_map[ row.my.ahr.id() ] = blob;
- params.row_node.setAttribute('retrieve_id',
- js2JSON({
- 'copy_id':copy_id,
+ obj.holds_map[ row.my.ahr.id() ] = blob;
+ params.row_node.setAttribute('retrieve_id',
+ js2JSON({
+ 'copy_id':copy_id,
'barcode':row.my.acp ? row.my.acp.barcode() : null,
- 'id':row.my.ahr.id(),
- 'type':row.my.ahr.hold_type(),
- 'target':row.my.ahr.target(),
- 'usr':row.my.ahr.usr()
- })
- );
- if (typeof params.on_retrieve == 'function') { params.on_retrieve(row); }
+ 'id':row.my.ahr.id(),
+ 'type':row.my.ahr.hold_type(),
+ 'target':row.my.ahr.target(),
+ 'usr':row.my.ahr.usr()
+ })
+ );
+ if (typeof params.on_retrieve == 'function') { params.on_retrieve(row); }
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.holds.init.hold_num_error', [row.my.hold_id]), E);
- }
- }
- );
- } catch(E) {
- obj.error.sdump('D_ERROR','retrieve_row: ' + E );
- }
- return row;
- },
- 'on_select' : function(ev) {
- JSAN.use('util.functional');
- var sel = obj.list.retrieve_selection();
- obj.controller.view.sel_clip.setAttribute('disabled',sel.length < 1);
- obj.retrieve_ids = util.functional.map_list(
- sel,
- function(o) { return JSON2js( o.getAttribute('retrieve_id') ); }
- );
- if (obj.retrieve_ids.length > 0) {
- obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','false');
- obj.controller.view.sel_mark_items_missing.setAttribute('disabled','false');
- obj.controller.view.sel_copy_details.setAttribute('disabled','false');
- obj.controller.view.sel_patron.setAttribute('disabled','false');
- obj.controller.view.cmd_retrieve_patron.setAttribute('disabled','false');
- obj.controller.view.cmd_holds_edit_pickup_lib.setAttribute('disabled','false');
- obj.controller.view.cmd_holds_edit_phone_notify.setAttribute('disabled','false');
- obj.controller.view.cmd_holds_edit_email_notify.setAttribute('disabled','false');
- obj.controller.view.cmd_holds_edit_selection_depth.setAttribute('disabled','false');
- obj.controller.view.cmd_holds_edit_expire_time.setAttribute('disabled','false');
- obj.controller.view.cmd_holds_edit_thaw_date.setAttribute('disabled','false');
- obj.controller.view.cmd_holds_activate.setAttribute('disabled','false');
- obj.controller.view.cmd_holds_suspend.setAttribute('disabled','false');
- obj.controller.view.cmd_alt_view.setAttribute('disabled','false');
- obj.controller.view.cmd_holds_retarget.setAttribute('disabled','false');
- obj.controller.view.cmd_holds_cancel.setAttribute('disabled','false');
- obj.controller.view.cmd_show_catalog.setAttribute('disabled','false');
- } else {
- obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','true');
- obj.controller.view.sel_mark_items_missing.setAttribute('disabled','true');
- obj.controller.view.sel_copy_details.setAttribute('disabled','true');
- obj.controller.view.sel_patron.setAttribute('disabled','true');
- obj.controller.view.cmd_retrieve_patron.setAttribute('disabled','true');
- obj.controller.view.cmd_holds_edit_pickup_lib.setAttribute('disabled','true');
- obj.controller.view.cmd_holds_edit_phone_notify.setAttribute('disabled','true');
- obj.controller.view.cmd_holds_edit_email_notify.setAttribute('disabled','true');
- obj.controller.view.cmd_holds_edit_selection_depth.setAttribute('disabled','true');
- obj.controller.view.cmd_holds_edit_expire_time.setAttribute('disabled','true');
- obj.controller.view.cmd_holds_edit_thaw_date.setAttribute('disabled','true');
- obj.controller.view.cmd_holds_activate.setAttribute('disabled','true');
- obj.controller.view.cmd_holds_suspend.setAttribute('disabled','true');
- obj.controller.view.cmd_alt_view.setAttribute('disabled','true');
- obj.controller.view.cmd_holds_retarget.setAttribute('disabled','true');
- obj.controller.view.cmd_holds_cancel.setAttribute('disabled','true');
- obj.controller.view.cmd_show_catalog.setAttribute('disabled','true');
- }
- }
- }
- );
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.holds.init.hold_num_error', [row.my.hold_id]), E);
+ }
+ }
+ );
+ } catch(E) {
+ obj.error.sdump('D_ERROR','retrieve_row: ' + E );
+ }
+ return row;
+ },
+ 'on_select' : function(ev) {
+ JSAN.use('util.functional');
+ var sel = obj.list.retrieve_selection();
+ obj.controller.view.sel_clip.setAttribute('disabled',sel.length < 1);
+ obj.retrieve_ids = util.functional.map_list(
+ sel,
+ function(o) { return JSON2js( o.getAttribute('retrieve_id') ); }
+ );
+ if (obj.retrieve_ids.length > 0) {
+ obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','false');
+ obj.controller.view.sel_mark_items_missing.setAttribute('disabled','false');
+ obj.controller.view.sel_copy_details.setAttribute('disabled','false');
+ obj.controller.view.sel_patron.setAttribute('disabled','false');
+ obj.controller.view.cmd_retrieve_patron.setAttribute('disabled','false');
+ obj.controller.view.cmd_holds_edit_pickup_lib.setAttribute('disabled','false');
+ obj.controller.view.cmd_holds_edit_phone_notify.setAttribute('disabled','false');
+ obj.controller.view.cmd_holds_edit_email_notify.setAttribute('disabled','false');
+ obj.controller.view.cmd_holds_edit_selection_depth.setAttribute('disabled','false');
+ obj.controller.view.cmd_holds_edit_expire_time.setAttribute('disabled','false');
+ obj.controller.view.cmd_holds_edit_thaw_date.setAttribute('disabled','false');
+ obj.controller.view.cmd_holds_activate.setAttribute('disabled','false');
+ obj.controller.view.cmd_holds_suspend.setAttribute('disabled','false');
+ obj.controller.view.cmd_alt_view.setAttribute('disabled','false');
+ obj.controller.view.cmd_holds_retarget.setAttribute('disabled','false');
+ obj.controller.view.cmd_holds_cancel.setAttribute('disabled','false');
+ obj.controller.view.cmd_show_catalog.setAttribute('disabled','false');
+ } else {
+ obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','true');
+ obj.controller.view.sel_mark_items_missing.setAttribute('disabled','true');
+ obj.controller.view.sel_copy_details.setAttribute('disabled','true');
+ obj.controller.view.sel_patron.setAttribute('disabled','true');
+ obj.controller.view.cmd_retrieve_patron.setAttribute('disabled','true');
+ obj.controller.view.cmd_holds_edit_pickup_lib.setAttribute('disabled','true');
+ obj.controller.view.cmd_holds_edit_phone_notify.setAttribute('disabled','true');
+ obj.controller.view.cmd_holds_edit_email_notify.setAttribute('disabled','true');
+ obj.controller.view.cmd_holds_edit_selection_depth.setAttribute('disabled','true');
+ obj.controller.view.cmd_holds_edit_expire_time.setAttribute('disabled','true');
+ obj.controller.view.cmd_holds_edit_thaw_date.setAttribute('disabled','true');
+ obj.controller.view.cmd_holds_activate.setAttribute('disabled','true');
+ obj.controller.view.cmd_holds_suspend.setAttribute('disabled','true');
+ obj.controller.view.cmd_alt_view.setAttribute('disabled','true');
+ obj.controller.view.cmd_holds_retarget.setAttribute('disabled','true');
+ obj.controller.view.cmd_holds_cancel.setAttribute('disabled','true');
+ obj.controller.view.cmd_show_catalog.setAttribute('disabled','true');
+ }
+ }
+ }
+ );
- JSAN.use('util.controller'); obj.controller = new util.controller();
- obj.controller.init(
- {
- 'control_map' : {
- 'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
- 'sel_clip' : [
- ['command'],
- function() { obj.list.clipboard(); }
- ],
- 'cmd_broken' : [
- ['command'],
- function() { alert($("commonStrings").getString('common.unimplemented')); }
- ],
- 'sel_patron' : [
- ['command'],
- function() {
- JSAN.use('circ.util');
- circ.util.show_last_few_circs(obj.retrieve_ids);
- }
- ],
+ JSAN.use('util.controller'); obj.controller = new util.controller();
+ obj.controller.init(
+ {
+ 'control_map' : {
+ 'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
+ 'sel_clip' : [
+ ['command'],
+ function() { obj.list.clipboard(); }
+ ],
+ 'cmd_broken' : [
+ ['command'],
+ function() { alert($("commonStrings").getString('common.unimplemented')); }
+ ],
+ 'sel_patron' : [
+ ['command'],
+ function() {
+ JSAN.use('circ.util');
+ circ.util.show_last_few_circs(obj.retrieve_ids);
+ }
+ ],
'alt_view_btn' : [
['render'],
function(e) {
@@ -222,136 +222,136 @@ patron.holds.prototype = {
}
},
],
- 'sel_mark_items_damaged' : [
- ['command'],
- function() {
- JSAN.use('cat.util'); JSAN.use('util.functional');
- cat.util.mark_item_damaged( util.functional.map_list( obj.retrieve_ids, function(o) { return o.copy_id; } ) );
- }
- ],
- 'sel_mark_items_missing' : [
- ['command'],
- function() {
- JSAN.use('cat.util'); JSAN.use('util.functional');
- cat.util.mark_item_missing( util.functional.map_list( obj.retrieve_ids, function(o) { return o.copy_id; } ) );
- }
- ],
- 'sel_copy_details' : [
- ['command'],
- function() {
- JSAN.use('circ.util');
- for (var i = 0; i < obj.retrieve_ids.length; i++) {
- if (obj.retrieve_ids[i].copy_id) circ.util.show_copy_details( obj.retrieve_ids[i].copy_id );
- }
- }
- ],
+ 'sel_mark_items_damaged' : [
+ ['command'],
+ function() {
+ JSAN.use('cat.util'); JSAN.use('util.functional');
+ cat.util.mark_item_damaged( util.functional.map_list( obj.retrieve_ids, function(o) { return o.copy_id; } ) );
+ }
+ ],
+ 'sel_mark_items_missing' : [
+ ['command'],
+ function() {
+ JSAN.use('cat.util'); JSAN.use('util.functional');
+ cat.util.mark_item_missing( util.functional.map_list( obj.retrieve_ids, function(o) { return o.copy_id; } ) );
+ }
+ ],
+ 'sel_copy_details' : [
+ ['command'],
+ function() {
+ JSAN.use('circ.util');
+ for (var i = 0; i < obj.retrieve_ids.length; i++) {
+ if (obj.retrieve_ids[i].copy_id) circ.util.show_copy_details( obj.retrieve_ids[i].copy_id );
+ }
+ }
+ ],
'cmd_holds_print' : [
- ['command'],
- function() {
- try {
- JSAN.use('patron.util');
- var params = {
- 'patron' : patron.util.retrieve_au_via_id(ses(),obj.patron_id),
- 'template' : 'holds'
- };
- obj.list.print(params);
- } catch(E) {
- obj.error.standard_unexpected_error_alert('print 1',E);
- }
- }
- ],
+ ['command'],
+ function() {
+ try {
+ JSAN.use('patron.util');
+ var params = {
+ 'patron' : patron.util.retrieve_au_via_id(ses(),obj.patron_id),
+ 'template' : 'holds'
+ };
+ obj.list.print(params);
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('print 1',E);
+ }
+ }
+ ],
'cmd_csv_to_clipboard' : [ ['command'], function() { obj.list.dump_csv_to_clipboard(); } ],
- 'cmd_csv_to_printer' : [ ['command'], function() { obj.list.dump_csv_to_printer(); } ],
- 'cmd_csv_to_file' : [ ['command'], function() { obj.list.dump_csv_to_file( { 'defaultFileName' : 'holds.txt' } ); } ],
+ 'cmd_csv_to_printer' : [ ['command'], function() { obj.list.dump_csv_to_printer(); } ],
+ 'cmd_csv_to_file' : [ ['command'], function() { obj.list.dump_csv_to_file( { 'defaultFileName' : 'holds.txt' } ); } ],
- 'cmd_holds_edit_selection_depth' : [
- ['command'],
- function() {
- try {
- JSAN.use('util.widgets'); JSAN.use('util.functional');
- var ws_type = obj.data.hash.aout[ obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ].ou_type() ];
- var list = util.functional.map_list(
- util.functional.filter_list(
- obj.data.list.aout,
- function(o) {
- if (o.depth() > ws_type.depth()) return false;
- if (o.depth() < ws_type.depth()) return true;
- return (o.id() == ws_type.id());
- }
- ),
- function(o) {
- return [
- o.opac_label(),
- o.id(),
- false,
- ( o.depth() * 2),
- ];
- }
- );
- ml = util.widgets.make_menulist( list, obj.data.list.au[0].ws_ou() );
- ml.setAttribute('id','selection');
- ml.setAttribute('name','fancy_data');
- var xml = '';
- xml += '' + $("patronStrings").getString('staff.patron.holds.holds_edit_selection_depth.choose_hold_range') + ' ';
- xml += util.widgets.serialize_node(ml);
- xml += ' ';
- var bot_xml = '';
- bot_xml += ' ';
- bot_xml += ' ';
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- //obj.data.temp_mid = xml; obj.data.stash('temp_mid');
- //obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_mid'
- //+ '&bottom_xml_in_stash=temp_bot'
- //+ '&title=' + window.escape('Choose a Pick Up Library'),
- 'fancy_prompt', 'chrome,resizable,modal',
- { 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : $("patronStrings").getString('staff.patron.holds.holds_edit_selection_depth.choose_library') }
- );
- if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
- var selection = fancy_prompt_data.selection;
+ 'cmd_holds_edit_selection_depth' : [
+ ['command'],
+ function() {
+ try {
+ JSAN.use('util.widgets'); JSAN.use('util.functional');
+ var ws_type = obj.data.hash.aout[ obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ].ou_type() ];
+ var list = util.functional.map_list(
+ util.functional.filter_list(
+ obj.data.list.aout,
+ function(o) {
+ if (o.depth() > ws_type.depth()) return false;
+ if (o.depth() < ws_type.depth()) return true;
+ return (o.id() == ws_type.id());
+ }
+ ),
+ function(o) {
+ return [
+ o.opac_label(),
+ o.id(),
+ false,
+ ( o.depth() * 2),
+ ];
+ }
+ );
+ ml = util.widgets.make_menulist( list, obj.data.list.au[0].ws_ou() );
+ ml.setAttribute('id','selection');
+ ml.setAttribute('name','fancy_data');
+ var xml = '';
+ xml += '' + $("patronStrings").getString('staff.patron.holds.holds_edit_selection_depth.choose_hold_range') + ' ';
+ xml += util.widgets.serialize_node(ml);
+ xml += ' ';
+ var bot_xml = '';
+ bot_xml += ' ';
+ bot_xml += ' ';
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
+ //obj.data.temp_mid = xml; obj.data.stash('temp_mid');
+ //obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_mid'
+ //+ '&bottom_xml_in_stash=temp_bot'
+ //+ '&title=' + window.escape('Choose a Pick Up Library'),
+ 'fancy_prompt', 'chrome,resizable,modal',
+ { 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : $("patronStrings").getString('staff.patron.holds.holds_edit_selection_depth.choose_library') }
+ );
+ if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
+ var selection = fancy_prompt_data.selection;
- var hold_list = util.functional.map_list(obj.retrieve_ids, function(o){return o.id;}).join(', ');
- var msg = '';
- if(obj.retrieve_ids.length > 1) {
- msg = $("patronStrings").getformattedString('staff.patron.holds.holds_edit_selection_depth.modify_holds_message.plural', [hold_list, obj.data.hash.aout[selection].opac_label()])
- } else {
- msg = $("patronStrings").getformattedString('staff.patron.holds.holds_edit_selection_depth.modify_holds_message.singular', [hold_list, obj.data.hash.aout[selection].opac_label()])
- }
+ var hold_list = util.functional.map_list(obj.retrieve_ids, function(o){return o.id;}).join(', ');
+ var msg = '';
+ if(obj.retrieve_ids.length > 1) {
+ msg = $("patronStrings").getformattedString('staff.patron.holds.holds_edit_selection_depth.modify_holds_message.plural', [hold_list, obj.data.hash.aout[selection].opac_label()])
+ } else {
+ msg = $("patronStrings").getformattedString('staff.patron.holds.holds_edit_selection_depth.modify_holds_message.singular', [hold_list, obj.data.hash.aout[selection].opac_label()])
+ }
- var r = obj.error.yns_alert(msg,
- $("patronStrings").getString('staff.patron.holds.holds_edit_selection_depth.modify_holds_title'),
- $("commonStrings").getString('common.yes'),
- $("commonStrings").getString('common.no'),
- null,
- $("commonStrings").getString('common.check_to_confirm')
- );
- if (r == 0) {
- for (var i = 0; i < obj.retrieve_ids.length; i++) {
- var hold = obj.holds_map[ obj.retrieve_ids[i].id ].hold;
- hold.selection_depth( obj.data.hash.aout[selection].depth() ); hold.ischanged('1');
+ var r = obj.error.yns_alert(msg,
+ $("patronStrings").getString('staff.patron.holds.holds_edit_selection_depth.modify_holds_title'),
+ $("commonStrings").getString('common.yes'),
+ $("commonStrings").getString('common.no'),
+ null,
+ $("commonStrings").getString('common.check_to_confirm')
+ );
+ if (r == 0) {
+ for (var i = 0; i < obj.retrieve_ids.length; i++) {
+ var hold = obj.holds_map[ obj.retrieve_ids[i].id ].hold;
+ hold.selection_depth( obj.data.hash.aout[selection].depth() ); hold.ischanged('1');
hold = obj.flatten_copy(hold);
- var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
- if (typeof robj.ilsevent != 'undefined') throw(robj);
- }
- obj.clear_and_retrieve(true);
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.holds.holds_not_modified'),E);
- }
- }
- ],
+ var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
+ if (typeof robj.ilsevent != 'undefined') throw(robj);
+ }
+ obj.clear_and_retrieve(true);
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.holds.holds_not_modified'),E);
+ }
+ }
+ ],
- 'cmd_holds_edit_pickup_lib' : [
- ['command'],
- function() {
- try {
- JSAN.use('util.widgets'); JSAN.use('util.functional');
+ 'cmd_holds_edit_pickup_lib' : [
+ ['command'],
+ function() {
+ try {
+ JSAN.use('util.widgets'); JSAN.use('util.functional');
var deny_edit_because_of_transit = false;
for (var i = 0; i < obj.retrieve_ids.length; i++) {
@@ -363,205 +363,205 @@ patron.holds.prototype = {
return;
}
- var list = util.functional.map_list(
- obj.data.list.aou,
- function(o) {
- var sname = o.shortname(); for (i = sname.length; i < 20; i++) sname += ' ';
- return [
- o.name() ? sname + ' ' + o.name() : o.shortname(),
- o.id(),
- ( obj.data.hash.aout[ o.ou_type() ].can_have_users() == 0),
- ( obj.data.hash.aout[ o.ou_type() ].depth() * 2),
- ];
- }
- );
- ml = util.widgets.make_menulist( list, obj.data.list.au[0].ws_ou() );
- ml.setAttribute('id','lib');
- ml.setAttribute('name','fancy_data');
- var xml = '';
- xml += ''+$("patronStrings").getString('staff.patron.holds.holds_edit_pickup_lib.new_pickup_lib.description')+' ';
- xml += util.widgets.serialize_node(ml);
- xml += ' ';
- var bot_xml = '';
- bot_xml += ' ';
- bot_xml += ' ';
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- //obj.data.temp_mid = xml; obj.data.stash('temp_mid');
- //obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_mid'
- //+ '&bottom_xml_in_stash=temp_bot'
- //+ '&title=' + window.escape('Choose a Pick Up Library'),
- 'fancy_prompt', 'chrome,resizable,modal',
- { 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : $("patronStrings").getString('staff.patron.holds.holds_edit_pickup_lib.choose_lib') }
- );
- if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
- var pickup_lib = fancy_prompt_data.lib;
+ var list = util.functional.map_list(
+ obj.data.list.aou,
+ function(o) {
+ var sname = o.shortname(); for (i = sname.length; i < 20; i++) sname += ' ';
+ return [
+ o.name() ? sname + ' ' + o.name() : o.shortname(),
+ o.id(),
+ ( obj.data.hash.aout[ o.ou_type() ].can_have_users() == 0),
+ ( obj.data.hash.aout[ o.ou_type() ].depth() * 2),
+ ];
+ }
+ );
+ ml = util.widgets.make_menulist( list, obj.data.list.au[0].ws_ou() );
+ ml.setAttribute('id','lib');
+ ml.setAttribute('name','fancy_data');
+ var xml = '';
+ xml += ''+$("patronStrings").getString('staff.patron.holds.holds_edit_pickup_lib.new_pickup_lib.description')+' ';
+ xml += util.widgets.serialize_node(ml);
+ xml += ' ';
+ var bot_xml = '';
+ bot_xml += ' ';
+ bot_xml += ' ';
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
+ //obj.data.temp_mid = xml; obj.data.stash('temp_mid');
+ //obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_mid'
+ //+ '&bottom_xml_in_stash=temp_bot'
+ //+ '&title=' + window.escape('Choose a Pick Up Library'),
+ 'fancy_prompt', 'chrome,resizable,modal',
+ { 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : $("patronStrings").getString('staff.patron.holds.holds_edit_pickup_lib.choose_lib') }
+ );
+ if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
+ var pickup_lib = fancy_prompt_data.lib;
- var hold_list = util.functional.map_list(obj.retrieve_ids, function(o){return o.id;}).join(', ');
- var msg = '';
- if(obj.retrieve_ids.length > 1) {
- msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_edit_pickup_lib.change_pickup_lib_message.plural',[hold_list, obj.data.hash.aou[pickup_lib].shortname()]);
- } else {
- msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_edit_pickup_lib.change_pickup_lib_message.singular',[hold_list, obj.data.hash.aou[pickup_lib].shortname()]);
- }
- var r = obj.error.yns_alert(msg,
- $("patronStrings").getString('staff.patron.holds.holds_edit_pickup_lib.change_pickup_lib_title'),
- $("commonStrings").getString('common.yes'),
- $("commonStrings").getString('common.no'),
- null,
- $("commonStrings").getString('common.check_to_confirm')
- );
- if (r == 0) {
- for (var i = 0; i < obj.retrieve_ids.length; i++) {
- var hold = obj.holds_map[ obj.retrieve_ids[i].id ].hold;
- hold.pickup_lib( pickup_lib ); hold.ischanged('1');
+ var hold_list = util.functional.map_list(obj.retrieve_ids, function(o){return o.id;}).join(', ');
+ var msg = '';
+ if(obj.retrieve_ids.length > 1) {
+ msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_edit_pickup_lib.change_pickup_lib_message.plural',[hold_list, obj.data.hash.aou[pickup_lib].shortname()]);
+ } else {
+ msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_edit_pickup_lib.change_pickup_lib_message.singular',[hold_list, obj.data.hash.aou[pickup_lib].shortname()]);
+ }
+ var r = obj.error.yns_alert(msg,
+ $("patronStrings").getString('staff.patron.holds.holds_edit_pickup_lib.change_pickup_lib_title'),
+ $("commonStrings").getString('common.yes'),
+ $("commonStrings").getString('common.no'),
+ null,
+ $("commonStrings").getString('common.check_to_confirm')
+ );
+ if (r == 0) {
+ for (var i = 0; i < obj.retrieve_ids.length; i++) {
+ var hold = obj.holds_map[ obj.retrieve_ids[i].id ].hold;
+ hold.pickup_lib( pickup_lib ); hold.ischanged('1');
hold = obj.flatten_copy(hold);
- var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
- if (typeof robj.ilsevent != 'undefined') throw(robj);
- }
- obj.clear_and_retrieve(true);
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.holds.holds_not_modified'),E);
- }
- }
- ],
- 'cmd_holds_edit_phone_notify' : [
- ['command'],
- function() {
- try {
- var xml = '';
- xml += ''+$("patronStrings").getString('staff.patron.holds.holds_edit_phone_notify.new_phone_number')+' ';
- xml += ' ';
- xml += ' ';
- var bot_xml = '';
- bot_xml += ' ';
- bot_xml += ' ';
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- //obj.data.temp_mid = xml; obj.data.stash('temp_mid');
- //obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_mid'
- //+ '&bottom_xml_in_stash=temp_bot'
- //+ '&title=' + window.escape('Choose a Hold Notification Phone Number')
- //+ '&focus=phone',
- 'fancy_prompt', 'chrome,resizable,modal',
- { 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : $("patronStrings").getString('staff.patron.holds.holds_edit_phone_notify.choose_phone_number'), 'focus' : 'phone' }
- );
- if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
- var phone = fancy_prompt_data.phone;
+ var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
+ if (typeof robj.ilsevent != 'undefined') throw(robj);
+ }
+ obj.clear_and_retrieve(true);
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.holds.holds_not_modified'),E);
+ }
+ }
+ ],
+ 'cmd_holds_edit_phone_notify' : [
+ ['command'],
+ function() {
+ try {
+ var xml = '';
+ xml += ''+$("patronStrings").getString('staff.patron.holds.holds_edit_phone_notify.new_phone_number')+' ';
+ xml += ' ';
+ xml += ' ';
+ var bot_xml = '';
+ bot_xml += ' ';
+ bot_xml += ' ';
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
+ //obj.data.temp_mid = xml; obj.data.stash('temp_mid');
+ //obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_mid'
+ //+ '&bottom_xml_in_stash=temp_bot'
+ //+ '&title=' + window.escape('Choose a Hold Notification Phone Number')
+ //+ '&focus=phone',
+ 'fancy_prompt', 'chrome,resizable,modal',
+ { 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : $("patronStrings").getString('staff.patron.holds.holds_edit_phone_notify.choose_phone_number'), 'focus' : 'phone' }
+ );
+ if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
+ var phone = fancy_prompt_data.phone;
- var hold_list = util.functional.map_list(obj.retrieve_ids, function(o){return o.id;}).join(', ');
- var msg = '';
- if(obj.retrieve_ids.length > 1) {
- msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_edit_phone_notify.confirm_phone_number_change.plural',[hold_list, phone]);
- } else {
- msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_edit_phone_notify.confirm_phone_number_change.singular',[hold_list, phone]);
- }
- var r = obj.error.yns_alert(msg,
- $("patronStrings").getString('staff.patron.holds.holds_edit_phone_notify.modifying_holds_title'),
- $("commonStrings").getString('common.yes'),
- $("commonStrings").getString('common.no'),
- null,
- $("commonStrings").getString('common.check_to_confirm')
- );
- if (r == 0) {
- for (var i = 0; i < obj.retrieve_ids.length; i++) {
- var hold = obj.holds_map[ obj.retrieve_ids[i].id ].hold;
- hold.phone_notify( phone ); hold.ischanged('1');
+ var hold_list = util.functional.map_list(obj.retrieve_ids, function(o){return o.id;}).join(', ');
+ var msg = '';
+ if(obj.retrieve_ids.length > 1) {
+ msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_edit_phone_notify.confirm_phone_number_change.plural',[hold_list, phone]);
+ } else {
+ msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_edit_phone_notify.confirm_phone_number_change.singular',[hold_list, phone]);
+ }
+ var r = obj.error.yns_alert(msg,
+ $("patronStrings").getString('staff.patron.holds.holds_edit_phone_notify.modifying_holds_title'),
+ $("commonStrings").getString('common.yes'),
+ $("commonStrings").getString('common.no'),
+ null,
+ $("commonStrings").getString('common.check_to_confirm')
+ );
+ if (r == 0) {
+ for (var i = 0; i < obj.retrieve_ids.length; i++) {
+ var hold = obj.holds_map[ obj.retrieve_ids[i].id ].hold;
+ hold.phone_notify( phone ); hold.ischanged('1');
hold = obj.flatten_copy(hold);
- var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
- if (typeof robj.ilsevent != 'undefined') throw(robj);
- }
- obj.clear_and_retrieve(true);
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.holds.holds_not_modified'),E);
- }
- }
- ],
- 'cmd_holds_edit_email_notify' : [
- ['command'],
- function() {
- try {
- var xml = '';
- xml += ''+$("patronStrings").getString('staff.patron.holds.holds_edit_email_notify.description')+' ';
- xml += ' ';
- xml += ' ';
- xml += ' ';
- var bot_xml = '';
- bot_xml += ' ';
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- //obj.data.temp_mid = xml; obj.data.stash('temp_mid');
- //obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_mid'
- //+ '&bottom_xml_in_stash=temp_bot'
- //+ '&title=' + window.escape('Set Email Notification for Holds'),
- 'fancy_prompt', 'chrome,resizable,modal',
- { 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : $("patronStrings").getString('staff.patron.holds.holds_edit_email_notify.set_notifs') }
- );
- if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
- var email = fancy_prompt_data.fancy_submit == 'email' ? get_db_true() : get_db_false();
+ var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
+ if (typeof robj.ilsevent != 'undefined') throw(robj);
+ }
+ obj.clear_and_retrieve(true);
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.holds.holds_not_modified'),E);
+ }
+ }
+ ],
+ 'cmd_holds_edit_email_notify' : [
+ ['command'],
+ function() {
+ try {
+ var xml = '';
+ xml += ''+$("patronStrings").getString('staff.patron.holds.holds_edit_email_notify.description')+' ';
+ xml += ' ';
+ xml += ' ';
+ xml += ' ';
+ var bot_xml = '';
+ bot_xml += ' ';
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
+ //obj.data.temp_mid = xml; obj.data.stash('temp_mid');
+ //obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_mid'
+ //+ '&bottom_xml_in_stash=temp_bot'
+ //+ '&title=' + window.escape('Set Email Notification for Holds'),
+ 'fancy_prompt', 'chrome,resizable,modal',
+ { 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : $("patronStrings").getString('staff.patron.holds.holds_edit_email_notify.set_notifs') }
+ );
+ if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
+ var email = fancy_prompt_data.fancy_submit == 'email' ? get_db_true() : get_db_false();
- var hold_list = util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ');
- var msg = '';
- if(get_bool(email)) {
- if(obj.retrieve_ids.length > 1) {
- msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_edit_email_notify.enable_email.plural', [hold_list]);
- } else {
- msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_edit_email_notify.enable_email.singular', [hold_list]);
- }
- } else {
- if(obj.retrieve_ids.length > 1) {
- msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_edit_email_notify.disable_email.plural', [hold_list]);
- } else {
- msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_edit_email_notify.disable_email.singular', [hold_list]);
- }
- }
+ var hold_list = util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ');
+ var msg = '';
+ if(get_bool(email)) {
+ if(obj.retrieve_ids.length > 1) {
+ msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_edit_email_notify.enable_email.plural', [hold_list]);
+ } else {
+ msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_edit_email_notify.enable_email.singular', [hold_list]);
+ }
+ } else {
+ if(obj.retrieve_ids.length > 1) {
+ msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_edit_email_notify.disable_email.plural', [hold_list]);
+ } else {
+ msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_edit_email_notify.disable_email.singular', [hold_list]);
+ }
+ }
- var r = obj.error.yns_alert(msg,
- $("patronStrings").getString('staff.patron.holds.holds_edit_email_notify.mod_holds_title'),
- $("commonStrings").getString('common.yes'),
- $("commonStrings").getString('common.no'),
- null,
- $("commonStrings").getString('common.check_to_confirm')
- );
- if (r == 0) {
- for (var i = 0; i < obj.retrieve_ids.length; i++) {
- var hold = obj.holds_map[ obj.retrieve_ids[i].id ].hold;
- hold.email_notify( email ); hold.ischanged('1');
+ var r = obj.error.yns_alert(msg,
+ $("patronStrings").getString('staff.patron.holds.holds_edit_email_notify.mod_holds_title'),
+ $("commonStrings").getString('common.yes'),
+ $("commonStrings").getString('common.no'),
+ null,
+ $("commonStrings").getString('common.check_to_confirm')
+ );
+ if (r == 0) {
+ for (var i = 0; i < obj.retrieve_ids.length; i++) {
+ var hold = obj.holds_map[ obj.retrieve_ids[i].id ].hold;
+ hold.email_notify( email ); hold.ischanged('1');
hold = obj.flatten_copy(hold);
- var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
- if (typeof robj.ilsevent != 'undefined') throw(robj);
- }
- obj.clear_and_retrieve(true);
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.holds.holds_not_modified'),E);
- }
- }
- ],
+ var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
+ if (typeof robj.ilsevent != 'undefined') throw(robj);
+ }
+ obj.clear_and_retrieve(true);
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.holds.holds_not_modified'),E);
+ }
+ }
+ ],
'cmd_holds_suspend' : [
- ['command'],
- function() {
- try {
+ ['command'],
+ function() {
+ try {
var hold_list = util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ');
- var r = obj.error.yns_alert(
+ var r = obj.error.yns_alert(
obj.retrieve_ids.length > 1 ?
document.getElementById('circStrings').getFormattedString('staff.circ.holds.suspend.prompt.plural',[hold_list]) :
document.getElementById('circStrings').getFormattedString('staff.circ.holds.suspend.prompt',[hold_list]),
@@ -571,39 +571,39 @@ patron.holds.prototype = {
null,
document.getElementById('commonStrings').getString('common.confirm')
);
- if (r == 0) {
+ if (r == 0) {
var already_suspended = [];
- for (var i = 0; i < obj.retrieve_ids.length; i++) {
- var hold = obj.holds_map[ obj.retrieve_ids[i].id ].hold;
+ for (var i = 0; i < obj.retrieve_ids.length; i++) {
+ var hold = obj.holds_map[ obj.retrieve_ids[i].id ].hold;
if ( get_bool( hold.frozen() ) ) {
already_suspended.push( hold.id() );
continue;
}
- hold.frozen('t');
- hold.thaw_date(null);
- hold.ischanged('1');
+ hold.frozen('t');
+ hold.thaw_date(null);
+ hold.ischanged('1');
hold = obj.flatten_copy(hold);
- var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
- if (typeof robj.ilsevent != 'undefined') throw(robj);
- }
+ var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
+ if (typeof robj.ilsevent != 'undefined') throw(robj);
+ }
if (already_suspended.length == 1) {
alert( document.getElementById('circStrings').getFormattedString('staff.circ.holds.already_suspended',[already_suspended[0]]) );
} else if (already_suspended.length > 1) {
alert( document.getElementById('circStrings').getFormattedString('staff.circ.holds.already_suspended.plural',[already_suspended.join(', ')]) );
}
- obj.clear_and_retrieve(true);
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.holds.unexpected_error.not_likely_suspended'),E);
- }
- }
- ],
+ obj.clear_and_retrieve(true);
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.holds.unexpected_error.not_likely_suspended'),E);
+ }
+ }
+ ],
'cmd_holds_activate' : [
- ['command'],
- function() {
- try {
+ ['command'],
+ function() {
+ try {
var hold_list = util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ');
- var r = obj.error.yns_alert(
+ var r = obj.error.yns_alert(
obj.retrieve_ids.length > 1 ?
document.getElementById('circStrings').getFormattedString('staff.circ.holds.activate.prompt.plural',[hold_list]) :
document.getElementById('circStrings').getFormattedString('staff.circ.holds.activate.prompt',[hold_list]),
@@ -613,37 +613,37 @@ patron.holds.prototype = {
null,
document.getElementById('commonStrings').getString('common.confirm')
);
- if (r == 0) {
+ if (r == 0) {
var already_activated = [];
- for (var i = 0; i < obj.retrieve_ids.length; i++) {
- var hold = obj.holds_map[ obj.retrieve_ids[i].id ].hold;
+ for (var i = 0; i < obj.retrieve_ids.length; i++) {
+ var hold = obj.holds_map[ obj.retrieve_ids[i].id ].hold;
if ( ! get_bool( hold.frozen() ) ) {
already_activated.push( hold.id() );
continue;
}
- hold.frozen('f');
- hold.thaw_date(null);
- hold.ischanged('1');
+ hold.frozen('f');
+ hold.thaw_date(null);
+ hold.ischanged('1');
hold = obj.flatten_copy(hold);
- var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
- if (typeof robj.ilsevent != 'undefined') throw(robj);
- }
+ var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
+ if (typeof robj.ilsevent != 'undefined') throw(robj);
+ }
if (already_activated.length == 1) {
alert( document.getElementById('circStrings').getFormattedString('staff.circ.holds.already_activated',[already_activated[0]]) );
} else if (already_activated.length > 1) {
alert( document.getElementById('circStrings').getFormattedString('staff.circ.holds.already_activated.plural',[already_activated.join(', ')]) );
}
- obj.clear_and_retrieve(true);
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.holds.unexpected_error.not_likely_activated'),E);
- }
- }
- ],
+ obj.clear_and_retrieve(true);
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.holds.unexpected_error.not_likely_activated'),E);
+ }
+ }
+ ],
'cmd_holds_edit_thaw_date' : [
- ['command'],
- function() {
- try {
+ ['command'],
+ function() {
+ try {
JSAN.use('util.date');
function check_date(value) {
try {
@@ -659,12 +659,12 @@ patron.holds.prototype = {
}
var hold_ids = util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ');
- var msg_singular = document.getElementById('circStrings').getFormattedString('staff.circ.holds.activation_date.prompt',[hold_ids]);
- var msg_plural = document.getElementById('circStrings').getFormattedString('staff.circ.holds.activation_date.prompt',[hold_ids]);
+ var msg_singular = document.getElementById('circStrings').getFormattedString('staff.circ.holds.activation_date.prompt',[hold_ids]);
+ var msg_plural = document.getElementById('circStrings').getFormattedString('staff.circ.holds.activation_date.prompt',[hold_ids]);
var msg = obj.retrieve_ids.length > 1 ? msg_plural : msg_singular;
var value = 'YYYY-MM-DD';
var title = document.getElementById('circStrings').getString('staff.circ.holds.modifying_holds');
- var thaw_date; var invalid = true;
+ var thaw_date; var invalid = true;
while(invalid) {
thaw_date = window.prompt(msg,value,title);
if (thaw_date) {
@@ -682,17 +682,17 @@ patron.holds.prototype = {
var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
if (typeof robj.ilsevent != 'undefined') throw(robj);
}
- obj.clear_and_retrieve(true);
+ obj.clear_and_retrieve(true);
}
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.holds.unexpected_error.not_likely_modified'),E);
- }
- }
- ],
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.holds.unexpected_error.not_likely_modified'),E);
+ }
+ }
+ ],
'cmd_holds_edit_expire_time' : [
- ['command'],
- function() {
- try {
+ ['command'],
+ function() {
+ try {
JSAN.use('util.date');
function check_date(value) {
try {
@@ -708,12 +708,12 @@ patron.holds.prototype = {
}
var hold_ids = util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ');
- var msg_singular = document.getElementById('circStrings').getFormattedString('staff.circ.holds.expire_time.prompt',[hold_ids]);
- var msg_plural = document.getElementById('circStrings').getFormattedString('staff.circ.holds.expire_time.prompt',[hold_ids]);
+ var msg_singular = document.getElementById('circStrings').getFormattedString('staff.circ.holds.expire_time.prompt',[hold_ids]);
+ var msg_plural = document.getElementById('circStrings').getFormattedString('staff.circ.holds.expire_time.prompt',[hold_ids]);
var msg = obj.retrieve_ids.length > 1 ? msg_plural : msg_singular;
var value = 'YYYY-MM-DD';
var title = document.getElementById('circStrings').getString('staff.circ.holds.modifying_holds');
- var expire_time; var invalid = true;
+ var expire_time; var invalid = true;
while(invalid) {
expire_time = window.prompt(msg,value,title);
if (expire_time) {
@@ -730,63 +730,63 @@ patron.holds.prototype = {
var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
if (typeof robj.ilsevent != 'undefined') throw(robj);
}
- obj.clear_and_retrieve(true);
+ obj.clear_and_retrieve(true);
}
- } catch(E) {
- obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.holds.unexpected_error.not_likely_modified'),E);
- }
- }
- ],
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.holds.unexpected_error.not_likely_modified'),E);
+ }
+ }
+ ],
- 'cmd_holds_retarget' : [
- ['command'],
- function() {
- try {
- JSAN.use('util.functional');
+ 'cmd_holds_retarget' : [
+ ['command'],
+ function() {
+ try {
+ JSAN.use('util.functional');
- var hold_list = util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ');
- var msg = '';
- if(obj.retrieve_ids.length > 1) {
- msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_retarget.reset_hold_message.plural',[hold_list]);
- } else {
- msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_retarget.reset_hold_message.singular',[hold_list]);
- }
- var r = obj.error.yns_alert(msg,
- $("patronStrings").getString('staff.patron.holds.holds_retarget.reset_hold_title'),
- $("commonStrings").getString('common.yes'),
- $("commonStrings").getString('common.no'),
- null,
- $("commonStrings").getString('common.check_to_confirm')
- );
- if (r == 0) {
- for (var i = 0; i < obj.retrieve_ids.length; i++) {
- var robj = obj.network.simple_request('FM_AHR_RESET',[ ses(), obj.retrieve_ids[i].id]);
- if (typeof robj.ilsevent != 'undefined') throw(robj);
- }
- obj.clear_and_retrieve();
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.holds.holds_retarget.holds_not_reset'),E);
- }
+ var hold_list = util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ');
+ var msg = '';
+ if(obj.retrieve_ids.length > 1) {
+ msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_retarget.reset_hold_message.plural',[hold_list]);
+ } else {
+ msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_retarget.reset_hold_message.singular',[hold_list]);
+ }
+ var r = obj.error.yns_alert(msg,
+ $("patronStrings").getString('staff.patron.holds.holds_retarget.reset_hold_title'),
+ $("commonStrings").getString('common.yes'),
+ $("commonStrings").getString('common.no'),
+ null,
+ $("commonStrings").getString('common.check_to_confirm')
+ );
+ if (r == 0) {
+ for (var i = 0; i < obj.retrieve_ids.length; i++) {
+ var robj = obj.network.simple_request('FM_AHR_RESET',[ ses(), obj.retrieve_ids[i].id]);
+ if (typeof robj.ilsevent != 'undefined') throw(robj);
+ }
+ obj.clear_and_retrieve();
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.holds.holds_retarget.holds_not_reset'),E);
+ }
- }
- ],
+ }
+ ],
- 'cmd_holds_cancel' : [
- ['command'],
- function() {
- try {
- JSAN.use('util.functional');
+ 'cmd_holds_cancel' : [
+ ['command'],
+ function() {
+ try {
+ JSAN.use('util.functional');
- var hold_list = util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ');
- var msg = '';
- if(obj.retrieve_ids.length > 1 ) {
- msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_cancel.cancel_hold_message.plural', [hold_list]);
- } else {
- msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_cancel.cancel_hold_message.singular', [hold_list]);
- }
+ var hold_list = util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ');
+ var msg = '';
+ if(obj.retrieve_ids.length > 1 ) {
+ msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_cancel.cancel_hold_message.plural', [hold_list]);
+ } else {
+ msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_cancel.cancel_hold_message.singular', [hold_list]);
+ }
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
JSAN.use('util.window');
@@ -797,30 +797,30 @@ patron.holds.prototype = {
'chrome,resizable,modal',
{}
);
- /*var r = obj.error.yns_alert(msg,
- $("patronStrings").getString('staff.patron.holds.holds_cancel.cancel_hold_title'),
- $("commonStrings").getString('common.yes'),
- $("commonStrings").getString('common.no'),
- null,
- $("commonStrings").getString('common.check_to_confirm')
- );*/
+ /*var r = obj.error.yns_alert(msg,
+ $("patronStrings").getString('staff.patron.holds.holds_cancel.cancel_hold_title'),
+ $("commonStrings").getString('common.yes'),
+ $("commonStrings").getString('common.no'),
+ null,
+ $("commonStrings").getString('common.check_to_confirm')
+ );*/
if (my_xulG.proceed) {
var transits = [];
- for (var i = 0; i < obj.retrieve_ids.length; i++) {
+ for (var i = 0; i < obj.retrieve_ids.length; i++) {
if (obj.holds_map[ obj.retrieve_ids[i].id ].hold.transit()) {
transits.push( obj.retrieve_ids[i].barcode );
}
- var robj = obj.network.simple_request('FM_AHR_CANCEL',[ ses(), obj.retrieve_ids[i].id, my_xulG.cancel_reason, my_xulG.note]);
- if (typeof robj.ilsevent != 'undefined') throw(robj);
- }
+ var robj = obj.network.simple_request('FM_AHR_CANCEL',[ ses(), obj.retrieve_ids[i].id, my_xulG.cancel_reason, my_xulG.note]);
+ if (typeof robj.ilsevent != 'undefined') throw(robj);
+ }
if (transits.length > 0) {
var msg2 = $("patronStrings").getFormattedString('staff.patron.holds.holds_cancel.cancel_for_barcodes', [transits.join(', ')]);
var r2 = obj.error.yns_alert(msg2,
$("patronStrings").getString('staff.patron.holds.holds_cancel.cancel_for_barcodes.title'),
$("commonStrings").getString('common.yes'),
$("commonStrings").getString('common.no'),
- null,
+ null,
$("commonStrings").getString('common.check_to_confirm'));
if (r2 == 0) {
try {
@@ -837,89 +837,89 @@ patron.holds.prototype = {
throw(robj);
break;
}
- }
+ }
}
} catch(E) {
obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.holds.holds_cancel.hold_transits_not_cancelled'),E);
}
}
}
- obj.clear_and_retrieve();
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.holds.holds_cancel.hold_not_cancelled'),E);
- }
- }
- ],
- 'cmd_retrieve_patron' : [
- ['command'],
- function() {
- try {
- var seen = {};
- for (var i = 0; i < obj.retrieve_ids.length; i++) {
- var patron_id = obj.retrieve_ids[i].usr;
- if (seen[patron_id]) continue; seen[patron_id] = true;
- xulG.new_patron_tab(
- {},
- { 'id' : patron_id }
- );
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert('',E);
- }
- }
- ],
- 'cmd_show_catalog' : [
- ['command'],
- function() {
- try {
- for (var i = 0; i < obj.retrieve_ids.length; i++) {
- var htarget = obj.retrieve_ids[i].target;
- var htype = obj.retrieve_ids[i].type;
- var opac_url;
- switch(htype) {
- case 'M' :
- opac_url = xulG.url_prefix( urls.opac_rresult ) + '?m=' + htarget;
- break;
- case 'T' :
- opac_url = xulG.url_prefix( urls.opac_rdetail ) + '?r=' + htarget;
- break;
- case 'V' :
- var my_acn = obj.network.simple_request( 'FM_ACN_RETRIEVE.authoritative', [ htarget ]);
- opac_url = xulG.url_prefix( urls.opac_rdetail) + '?r=' + my_acn.record();
- break;
- case 'C' :
- var my_acp = obj.network.simple_request( 'FM_ACP_RETRIEVE', [ htarget ]);
- var my_acn;
- if (typeof my_acp.call_number() == 'object') {
- my_acn = my.acp.call_number();
- } else {
- my_acn = obj.network.simple_request( 'FM_ACN_RETRIEVE.authoritative',
- [ my_acp.call_number() ]);
- }
- opac_url = xulG.url_prefix( urls.opac_rdetail) + '?r=' + my_acn.record();
- break;
- default:
- obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.holds.show_catalog.unknown_htype', [htype]), obj.retrieve_ids[i]);
- continue;
- break;
- }
- var content_params = {
- 'session' : ses(),
- 'authtime' : ses('authtime'),
- 'opac_url' : opac_url
- };
- xulG.new_tab(
- xulG.url_prefix(urls.XUL_OPAC_WRAPPER),
- {'tab_name': htype == 'M' ? 'Catalog' : $("patronStrings").getString('staff.patron.holds.show_catalog.retrieving_title') },
- content_params
- );
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert('',E);
- }
- }
- ],
+ obj.clear_and_retrieve();
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.holds.holds_cancel.hold_not_cancelled'),E);
+ }
+ }
+ ],
+ 'cmd_retrieve_patron' : [
+ ['command'],
+ function() {
+ try {
+ var seen = {};
+ for (var i = 0; i < obj.retrieve_ids.length; i++) {
+ var patron_id = obj.retrieve_ids[i].usr;
+ if (seen[patron_id]) continue; seen[patron_id] = true;
+ xulG.new_patron_tab(
+ {},
+ { 'id' : patron_id }
+ );
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('',E);
+ }
+ }
+ ],
+ 'cmd_show_catalog' : [
+ ['command'],
+ function() {
+ try {
+ for (var i = 0; i < obj.retrieve_ids.length; i++) {
+ var htarget = obj.retrieve_ids[i].target;
+ var htype = obj.retrieve_ids[i].type;
+ var opac_url;
+ switch(htype) {
+ case 'M' :
+ opac_url = xulG.url_prefix( urls.opac_rresult ) + '?m=' + htarget;
+ break;
+ case 'T' :
+ opac_url = xulG.url_prefix( urls.opac_rdetail ) + '?r=' + htarget;
+ break;
+ case 'V' :
+ var my_acn = obj.network.simple_request( 'FM_ACN_RETRIEVE.authoritative', [ htarget ]);
+ opac_url = xulG.url_prefix( urls.opac_rdetail) + '?r=' + my_acn.record();
+ break;
+ case 'C' :
+ var my_acp = obj.network.simple_request( 'FM_ACP_RETRIEVE', [ htarget ]);
+ var my_acn;
+ if (typeof my_acp.call_number() == 'object') {
+ my_acn = my.acp.call_number();
+ } else {
+ my_acn = obj.network.simple_request( 'FM_ACN_RETRIEVE.authoritative',
+ [ my_acp.call_number() ]);
+ }
+ opac_url = xulG.url_prefix( urls.opac_rdetail) + '?r=' + my_acn.record();
+ break;
+ default:
+ obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.holds.show_catalog.unknown_htype', [htype]), obj.retrieve_ids[i]);
+ continue;
+ break;
+ }
+ var content_params = {
+ 'session' : ses(),
+ 'authtime' : ses('authtime'),
+ 'opac_url' : opac_url
+ };
+ xulG.new_tab(
+ xulG.url_prefix(urls.XUL_OPAC_WRAPPER),
+ {'tab_name': htype == 'M' ? 'Catalog' : $("patronStrings").getString('staff.patron.holds.show_catalog.retrieving_title') },
+ content_params
+ );
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('',E);
+ }
+ }
+ ],
'fetch_more' : [
['command'],
function() {
@@ -985,9 +985,9 @@ patron.holds.prototype = {
}
]
- }
- }
- );
+ }
+ }
+ );
obj.determine_hold_interface_type();
var x_fetch_more = document.getElementById('fetch_more');
@@ -1031,9 +1031,9 @@ patron.holds.prototype = {
obj.controller.view.cmd_holds_edit_pickup_lib.setAttribute('disabled','true');
obj.controller.view.cmd_holds_edit_phone_notify.setAttribute('disabled','true');
obj.controller.view.cmd_holds_edit_email_notify.setAttribute('disabled','true');
- obj.controller.view.cmd_holds_edit_thaw_date.setAttribute('disabled','true');
- obj.controller.view.cmd_holds_activate.setAttribute('disabled','true');
- obj.controller.view.cmd_holds_suspend.setAttribute('disabled','true');
+ obj.controller.view.cmd_holds_edit_thaw_date.setAttribute('disabled','true');
+ obj.controller.view.cmd_holds_activate.setAttribute('disabled','true');
+ obj.controller.view.cmd_holds_suspend.setAttribute('disabled','true');
obj.controller.view.cmd_holds_edit_selection_depth.setAttribute('disabled','true');
obj.controller.view.cmd_alt_view.setAttribute('disabled','true');
obj.controller.view.cmd_holds_retarget.setAttribute('disabled','true');
@@ -1055,21 +1055,21 @@ patron.holds.prototype = {
}
);
- },
+ },
'determine_hold_interface_type' : function() {
- var obj = this;
+ var obj = this;
if (obj.patron_id) { /*************************************************** PATRON ******************************/
obj.hold_interface_type = 'patron';
- } else if (obj.docid) { /*************************************************** RECORD ******************************/
+ } else if (obj.docid) { /*************************************************** RECORD ******************************/
obj.hold_interface_type = 'record';
- } else if (obj.pull) { /*************************************************** PULL ******************************/
+ } else if (obj.pull) { /*************************************************** PULL ******************************/
obj.hold_interface_type = 'pull';
- } else if (obj.shelf) { /*************************************************** HOLD SHELF ******************************/
+ } else if (obj.shelf) { /*************************************************** HOLD SHELF ******************************/
obj.hold_interface_type = 'shelf';
- } else { /*************************************************** PULL ******************************/
+ } else { /*************************************************** PULL ******************************/
obj.hold_interface_type = 'pull';
- }
+ }
},
'clear_and_retrieve' : function() {
@@ -1085,21 +1085,21 @@ patron.holds.prototype = {
}
},
- 'retrieve' : function() {
- var obj = this; var holds = [];
- if (window.xulG && window.xulG.holds) {
- holds = window.xulG.holds;
- } else {
- var method; var params = [ ses() ];
+ 'retrieve' : function() {
+ var obj = this; var holds = [];
+ if (window.xulG && window.xulG.holds) {
+ holds = window.xulG.holds;
+ } else {
+ var method; var params = [ ses() ];
switch(obj.hold_interface_type) {
case 'patron' :
- method = 'FM_AHR_ID_LIST_RETRIEVE_VIA_AU.authoritative';
- params.push( obj.patron_id );
- obj.controller.view.cmd_retrieve_patron.setAttribute('hidden','true');
+ method = 'FM_AHR_ID_LIST_RETRIEVE_VIA_AU.authoritative';
+ params.push( obj.patron_id );
+ obj.controller.view.cmd_retrieve_patron.setAttribute('hidden','true');
break;
case 'record' :
- method = 'FM_AHR_RETRIEVE_ALL_VIA_BRE';
- params.push( obj.docid );
+ method = 'FM_AHR_RETRIEVE_ALL_VIA_BRE';
+ params.push( obj.docid );
var x_lib_filter = document.getElementById('lib_filter_checkbox');
var x_lib_type_menu = document.getElementById('lib_type_menu');
if (x_lib_filter) {
@@ -1111,24 +1111,24 @@ patron.holds.prototype = {
}
}
}
- obj.controller.view.cmd_retrieve_patron.setAttribute('hidden','false');
+ obj.controller.view.cmd_retrieve_patron.setAttribute('hidden','false');
break;
case 'shelf' :
- method = 'FM_AHR_ID_LIST_ONSHELF_RETRIEVE';
+ method = 'FM_AHR_ID_LIST_ONSHELF_RETRIEVE';
params.push( obj.filter_lib || obj.data.list.au[0].ws_ou() );
- obj.controller.view.cmd_retrieve_patron.setAttribute('hidden','false');
+ obj.controller.view.cmd_retrieve_patron.setAttribute('hidden','false');
break;
case 'pull' :
default:
- method = 'FM_AHR_ID_LIST_PULL_LIST';
- params.push( obj.pull_from_shelf_interface.current.limit ); params.push( obj.pull_from_shelf_interface.current.offset );
- //obj.controller.view.cmd_retrieve_patron.setAttribute('hidden','false');
+ method = 'FM_AHR_ID_LIST_PULL_LIST';
+ params.push( obj.pull_from_shelf_interface.current.limit ); params.push( obj.pull_from_shelf_interface.current.offset );
+ //obj.controller.view.cmd_retrieve_patron.setAttribute('hidden','false');
break;
- }
- var robj = obj.network.simple_request( method, params );
- if (robj != null && typeof robj.ilsevent != 'undefined') throw(robj);
- if (method == 'FM_AHR_RETRIEVE_ALL_VIA_BRE') {
- holds = [];
+ }
+ var robj = obj.network.simple_request( method, params );
+ if (robj != null && typeof robj.ilsevent != 'undefined') throw(robj);
+ if (method == 'FM_AHR_RETRIEVE_ALL_VIA_BRE') {
+ holds = [];
if (robj != null) {
holds = holds.concat( robj.copy_holds );
holds = holds.concat( robj.volume_holds );
@@ -1136,7 +1136,7 @@ patron.holds.prototype = {
holds = holds.concat( robj.metarecord_holds );
holds = holds.sort();
}
- } else {
+ } else {
if (robj == null ) {
holds = [];
} else {
@@ -1146,9 +1146,9 @@ patron.holds.prototype = {
holds = robj;
}
}
- }
- //alert('method = ' + method + ' params = ' + js2JSON(params));
- }
+ }
+ //alert('method = ' + method + ' params = ' + js2JSON(params));
+ }
var x_fetch_more = document.getElementById('fetch_more');
if (holds.length == 0) {
@@ -1196,14 +1196,14 @@ patron.holds.prototype = {
exec.chain( rows );
} catch(E) {
- this.error.standard_unexpected_error_alert('holds.js, render():',E);
+ this.error.standard_unexpected_error_alert('holds.js, render():',E);
}
- },
+ },
- 'render_lib_menus' : function(types) {
- try {
- var obj = this;
- JSAN.use('util.widgets'); JSAN.use('util.functional'); JSAN.use('util.fm_utils');
+ 'render_lib_menus' : function(types) {
+ try {
+ var obj = this;
+ JSAN.use('util.widgets'); JSAN.use('util.functional'); JSAN.use('util.fm_utils');
var x = document.getElementById('lib_type_menu');
if (types) {
@@ -1213,33 +1213,33 @@ patron.holds.prototype = {
}
x.setAttribute('oncommand','g.holds.clear_and_retrieve()');
- x = document.getElementById('lib_menu_placeholder');
- util.widgets.remove_children( x );
+ x = document.getElementById('lib_menu_placeholder');
+ util.widgets.remove_children( x );
JSAN.use('util.file');
- var file = new util.file('offline_ou_list');
- if (file._file.exists()) {
- var list_data = file.get_object(); file.close();
- var ml = util.widgets.make_menulist( list_data[0], obj.data.list.au[0].ws_ou() );
+ var file = new util.file('offline_ou_list');
+ if (file._file.exists()) {
+ var list_data = file.get_object(); file.close();
+ var ml = util.widgets.make_menulist( list_data[0], obj.data.list.au[0].ws_ou() );
ml.setAttribute('id','lib_menu');
x.appendChild( ml );
- ml.addEventListener(
- 'command',
- function(ev) {
- obj.filter_lib = ev.target.value;
- obj.clear_and_retrieve();
- },
- false
- );
- obj.controller.view.lib_menu = ml;
- } else {
- throw($("patronStrings").getString('staff.patron.holds.lib_menus.missing_library_list'));
- }
+ ml.addEventListener(
+ 'command',
+ function(ev) {
+ obj.filter_lib = ev.target.value;
+ obj.clear_and_retrieve();
+ },
+ false
+ );
+ obj.controller.view.lib_menu = ml;
+ } else {
+ throw($("patronStrings").getString('staff.patron.holds.lib_menus.missing_library_list'));
+ }
- } catch(E) {
- this.error.standard_unexpected_error_alert('rendering lib menu',E);
- }
- }
+ } catch(E) {
+ this.error.standard_unexpected_error_alert('rendering lib menu',E);
+ }
+ }
}
dump('exiting patron.holds.js\n');
diff --git a/Open-ILS/xul/staff_client/server/patron/items.js b/Open-ILS/xul/staff_client/server/patron/items.js
index 9e6d21a6ce..ec1547c8a4 100644
--- a/Open-ILS/xul/staff_client/server/patron/items.js
+++ b/Open-ILS/xul/staff_client/server/patron/items.js
@@ -5,278 +5,278 @@ function $(id) { return document.getElementById(id); }
if (typeof patron == 'undefined') patron = {};
patron.items = function (params) {
- JSAN.use('util.error'); this.error = new util.error();
- JSAN.use('util.network'); this.network = new util.network();
- JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
+ JSAN.use('util.error'); this.error = new util.error();
+ JSAN.use('util.network'); this.network = new util.network();
+ JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
}
patron.items.prototype = {
- 'list_circ_map' : {},
-
- 'init' : function( params ) {
-
- var obj = this;
-
- obj.patron_id = params['patron_id'];
-
- obj.init_lists();
-
- JSAN.use('util.controller'); obj.controller = new util.controller();
- obj.controller.init(
- {
- 'control_map' : {
- 'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
- 'save_columns2' : [ [ 'command' ], function() { obj.list2.save_columns(); } ],
- 'cmd_broken' : [ ['command'], function() { alert('Not Yet Implemented'); } ],
- 'sel_clip' : [ ['command'], function() { obj.list.clipboard(); } ],
- 'sel_clip2' : [ ['command'], function() { obj.list2.clipboard(); } ],
- 'sel_patron' : [ ['command'], function() { JSAN.use('circ.util'); circ.util.show_last_few_circs(obj.retrieve_ids); } ],
- 'sel_bucket' : [
- ['command'],
- function() {
- JSAN.use('cat.util');
- cat.util.add_copies_to_bucket(util.functional.map_list( obj.retrieve_ids, function(o) { return o.copy_id; } ) );
- }
- ],
- 'sel_bucket2' : [
- ['command'],
- function() {
- JSAN.use('cat.util');
- cat.util.add_copies_to_bucket(util.functional.map_list( obj.retrieve_ids2, function(o) { return o.copy_id; } ) );
- }
- ],
- 'sel_mark_items_damaged' : [
- ['command'],
- function() {
- JSAN.use('cat.util'); JSAN.use('util.functional');
- cat.util.mark_item_damaged( util.functional.map_list( obj.retrieve_ids, function(o) { return o.copy_id; } ) );
- }
- ],
- 'sel_mark_items_missing' : [
- ['command'],
- function() {
- JSAN.use('cat.util'); JSAN.use('util.functional');
- cat.util.mark_item_missing( util.functional.map_list( obj.retrieve_ids, function(o) { return o.copy_id; } ) );
- }
- ],
- 'sel_mark_items_damaged2' : [
- ['command'],
- function() {
- JSAN.use('cat.util'); JSAN.use('util.functional');
- cat.util.mark_item_damaged( util.functional.map_list( obj.retrieve_ids2, function(o) { return o.copy_id; } ) );
- }
- ],
- 'sel_mark_items_missing2' : [
- ['command'],
- function() {
- JSAN.use('cat.util'); JSAN.use('util.functional');
- cat.util.mark_item_missing( util.functional.map_list( obj.retrieve_ids2, function(o) { return o.copy_id; } ) );
- }
- ],
- 'sel_copy_details' : [ ['command'],
- function() {
- JSAN.use('circ.util');
- for (var i = 0; i < obj.retrieve_ids.length; i++) { circ.util.show_copy_details( obj.retrieve_ids[i].copy_id ); }
- }
- ],
- 'sel_patron2' : [ ['command'], function() { JSAN.use('circ.util'); circ.util.show_last_few_circs(obj.retrieve_ids2); } ],
- 'sel_copy_details2' : [ ['command'],
- function() {
- JSAN.use('circ.util');
- for (var i = 0; i < obj.retrieve_ids2.length; i++) { circ.util.show_copy_details( obj.retrieve_ids2[i].copy_id ); }
- }
- ],
- 'cmd_items_print' : [ ['command'], function() { obj.items_print(1); } ],
- 'cmd_items_print2' : [ ['command'], function() { obj.items_print(2); } ],
- 'cmd_items_export' : [ ['command'], function() { obj.items_export(1); } ],
- 'cmd_items_export2' : [ ['command'], function() { obj.items_export(2); } ],
- 'cmd_items_renew' : [ ['command'], function() { obj.items_renew(1); /* obj.retrieve();*/ } ],
- 'cmd_items_renew_all' : [ ['command'], function() { obj.items_renew_all(); } ],
- 'cmd_items_renew2' : [ ['command'], function() { obj.items_renew(2); /* obj.retrieve();*/ } ],
- 'cmd_items_edit' : [ ['command'], function() { obj.items_edit(1); /*obj.retrieve();*/ } ],
- 'cmd_items_edit2' : [ ['command'], function() { obj.items_edit(2); /*obj.retrieve();*/ } ],
- 'cmd_items_mark_lost' : [ ['command'], function() { obj.items_mark_lost(1); /*obj.retrieve();*/ } ],
- 'cmd_items_mark_lost2' : [ ['command'], function() { obj.items_mark_lost(2); /*obj.retrieve();*/ } ],
- 'cmd_items_claimed_returned' : [ ['command'], function() { obj.items_claimed_returned(1); /*obj.retrieve();*/ } ],
- 'cmd_items_claimed_returned2' : [ ['command'], function() { obj.items_claimed_returned(2); /*obj.retrieve();*/ } ],
- 'cmd_items_checkin' : [ ['command'], function() { obj.items_checkin(1); /*obj.retrieve();*/ } ],
- 'cmd_items_checkin2' : [ ['command'], function() { obj.items_checkin(2); /*obj.retrieve();*/ } ],
- 'cmd_show_catalog' : [ ['command'], function() { obj.show_catalog(1); } ],
- 'cmd_show_catalog2' : [ ['command'], function() { obj.show_catalog(2); } ],
- 'cmd_add_billing' : [ ['command'], function() { obj.add_billing(1); /*obj.retrieve();*/ } ],
- 'cmd_add_billing2' : [ ['command'], function() { obj.add_billing(2); /*obj.retrieve();*/ } ],
- 'cmd_show_noncats' : [ ['command'], function() { obj.show_noncats(); } ]
- }
- }
- );
-
- obj.retrieve();
-
- obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','true');
- obj.controller.view.sel_mark_items_missing.setAttribute('disabled','true');
- obj.controller.view.sel_mark_items_damaged2.setAttribute('disabled','true');
- obj.controller.view.sel_mark_items_missing2.setAttribute('disabled','true');
- obj.controller.view.sel_clip.setAttribute('disabled','true');
- obj.controller.view.sel_clip2.setAttribute('disabled','true');
- obj.controller.view.sel_bucket.setAttribute('disabled','true');
- obj.controller.view.sel_bucket2.setAttribute('disabled','true');
- obj.controller.view.sel_copy_details.setAttribute('disabled','true');
- obj.controller.view.sel_patron.setAttribute('disabled','true');
- obj.controller.view.sel_copy_details2.setAttribute('disabled','true');
- obj.controller.view.sel_patron2.setAttribute('disabled','true');
- obj.controller.view.cmd_items_claimed_returned.setAttribute('disabled','true');
- obj.controller.view.cmd_items_renew.setAttribute('disabled','true');
- obj.controller.view.cmd_items_checkin.setAttribute('disabled','true');
- obj.controller.view.cmd_items_edit.setAttribute('disabled','true');
- obj.controller.view.cmd_items_mark_lost.setAttribute('disabled','true');
- obj.controller.view.cmd_show_catalog.setAttribute('disabled','true');
- obj.controller.view.cmd_items_claimed_returned2.setAttribute('disabled','true');
- obj.controller.view.cmd_items_renew2.setAttribute('disabled','true');
- obj.controller.view.cmd_items_checkin2.setAttribute('disabled','true');
- obj.controller.view.cmd_items_edit2.setAttribute('disabled','true');
- obj.controller.view.cmd_items_mark_lost2.setAttribute('disabled','true');
- 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.authoritative',[ 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.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() ];
- if (!t) {
- var robj2 = obj.network.simple_request('FM_CNCT_RETRIEVE',[ nc_circ.circ_lib() ]);
- if (typeof robj2.ilsevent != 'undefined') throw(robj);
- obj.data.stash_retrieve();
- for (var j = 0; j < robj2.length; j++) {
- if (! obj.data.hash.cnct[ robj2[j].id() ] ) {
- obj.data.hash.cnct[ robj2[j].id() ] = robj2[j];
- obj.data.list.cnct.push( robj2[j] );
- }
- }
- obj.data.stash('hash','list');
- t = obj.data.hash.cnct[ nc_circ.item_type() ];
- }
- var cd = t.circ_duration() || $("patronStrings").getString('staff.patron.items.show_noncats.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( '' );
- fake_copy.circ_lib( nc_circ.circ_lib() );
-
- obj.list.append( { 'row' : { 'my' : { 'circ' : fake_circ, 'mvr' : fake_record, 'acp' : fake_copy } }, 'to_bottom' : true, 'no_auto_select' : true } );
-
- } catch(F) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.items.show_noncats.err_showing_noncat', [robj[ii].id()]),F);
- }
- }
-
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.show_noncats.err_showing_circulations'),E);
- }
- },
-
- 'items_print' : function(which) {
- var obj = this;
- try {
- var list = (which==2 ? obj.list2 : obj.list);
+ 'list_circ_map' : {},
+
+ 'init' : function( params ) {
+
+ var obj = this;
+
+ obj.patron_id = params['patron_id'];
+
+ obj.init_lists();
+
+ JSAN.use('util.controller'); obj.controller = new util.controller();
+ obj.controller.init(
+ {
+ 'control_map' : {
+ 'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
+ 'save_columns2' : [ [ 'command' ], function() { obj.list2.save_columns(); } ],
+ 'cmd_broken' : [ ['command'], function() { alert('Not Yet Implemented'); } ],
+ 'sel_clip' : [ ['command'], function() { obj.list.clipboard(); } ],
+ 'sel_clip2' : [ ['command'], function() { obj.list2.clipboard(); } ],
+ 'sel_patron' : [ ['command'], function() { JSAN.use('circ.util'); circ.util.show_last_few_circs(obj.retrieve_ids); } ],
+ 'sel_bucket' : [
+ ['command'],
+ function() {
+ JSAN.use('cat.util');
+ cat.util.add_copies_to_bucket(util.functional.map_list( obj.retrieve_ids, function(o) { return o.copy_id; } ) );
+ }
+ ],
+ 'sel_bucket2' : [
+ ['command'],
+ function() {
+ JSAN.use('cat.util');
+ cat.util.add_copies_to_bucket(util.functional.map_list( obj.retrieve_ids2, function(o) { return o.copy_id; } ) );
+ }
+ ],
+ 'sel_mark_items_damaged' : [
+ ['command'],
+ function() {
+ JSAN.use('cat.util'); JSAN.use('util.functional');
+ cat.util.mark_item_damaged( util.functional.map_list( obj.retrieve_ids, function(o) { return o.copy_id; } ) );
+ }
+ ],
+ 'sel_mark_items_missing' : [
+ ['command'],
+ function() {
+ JSAN.use('cat.util'); JSAN.use('util.functional');
+ cat.util.mark_item_missing( util.functional.map_list( obj.retrieve_ids, function(o) { return o.copy_id; } ) );
+ }
+ ],
+ 'sel_mark_items_damaged2' : [
+ ['command'],
+ function() {
+ JSAN.use('cat.util'); JSAN.use('util.functional');
+ cat.util.mark_item_damaged( util.functional.map_list( obj.retrieve_ids2, function(o) { return o.copy_id; } ) );
+ }
+ ],
+ 'sel_mark_items_missing2' : [
+ ['command'],
+ function() {
+ JSAN.use('cat.util'); JSAN.use('util.functional');
+ cat.util.mark_item_missing( util.functional.map_list( obj.retrieve_ids2, function(o) { return o.copy_id; } ) );
+ }
+ ],
+ 'sel_copy_details' : [ ['command'],
+ function() {
+ JSAN.use('circ.util');
+ for (var i = 0; i < obj.retrieve_ids.length; i++) { circ.util.show_copy_details( obj.retrieve_ids[i].copy_id ); }
+ }
+ ],
+ 'sel_patron2' : [ ['command'], function() { JSAN.use('circ.util'); circ.util.show_last_few_circs(obj.retrieve_ids2); } ],
+ 'sel_copy_details2' : [ ['command'],
+ function() {
+ JSAN.use('circ.util');
+ for (var i = 0; i < obj.retrieve_ids2.length; i++) { circ.util.show_copy_details( obj.retrieve_ids2[i].copy_id ); }
+ }
+ ],
+ 'cmd_items_print' : [ ['command'], function() { obj.items_print(1); } ],
+ 'cmd_items_print2' : [ ['command'], function() { obj.items_print(2); } ],
+ 'cmd_items_export' : [ ['command'], function() { obj.items_export(1); } ],
+ 'cmd_items_export2' : [ ['command'], function() { obj.items_export(2); } ],
+ 'cmd_items_renew' : [ ['command'], function() { obj.items_renew(1); /* obj.retrieve();*/ } ],
+ 'cmd_items_renew_all' : [ ['command'], function() { obj.items_renew_all(); } ],
+ 'cmd_items_renew2' : [ ['command'], function() { obj.items_renew(2); /* obj.retrieve();*/ } ],
+ 'cmd_items_edit' : [ ['command'], function() { obj.items_edit(1); /*obj.retrieve();*/ } ],
+ 'cmd_items_edit2' : [ ['command'], function() { obj.items_edit(2); /*obj.retrieve();*/ } ],
+ 'cmd_items_mark_lost' : [ ['command'], function() { obj.items_mark_lost(1); /*obj.retrieve();*/ } ],
+ 'cmd_items_mark_lost2' : [ ['command'], function() { obj.items_mark_lost(2); /*obj.retrieve();*/ } ],
+ 'cmd_items_claimed_returned' : [ ['command'], function() { obj.items_claimed_returned(1); /*obj.retrieve();*/ } ],
+ 'cmd_items_claimed_returned2' : [ ['command'], function() { obj.items_claimed_returned(2); /*obj.retrieve();*/ } ],
+ 'cmd_items_checkin' : [ ['command'], function() { obj.items_checkin(1); /*obj.retrieve();*/ } ],
+ 'cmd_items_checkin2' : [ ['command'], function() { obj.items_checkin(2); /*obj.retrieve();*/ } ],
+ 'cmd_show_catalog' : [ ['command'], function() { obj.show_catalog(1); } ],
+ 'cmd_show_catalog2' : [ ['command'], function() { obj.show_catalog(2); } ],
+ 'cmd_add_billing' : [ ['command'], function() { obj.add_billing(1); /*obj.retrieve();*/ } ],
+ 'cmd_add_billing2' : [ ['command'], function() { obj.add_billing(2); /*obj.retrieve();*/ } ],
+ 'cmd_show_noncats' : [ ['command'], function() { obj.show_noncats(); } ]
+ }
+ }
+ );
+
+ obj.retrieve();
+
+ obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','true');
+ obj.controller.view.sel_mark_items_missing.setAttribute('disabled','true');
+ obj.controller.view.sel_mark_items_damaged2.setAttribute('disabled','true');
+ obj.controller.view.sel_mark_items_missing2.setAttribute('disabled','true');
+ obj.controller.view.sel_clip.setAttribute('disabled','true');
+ obj.controller.view.sel_clip2.setAttribute('disabled','true');
+ obj.controller.view.sel_bucket.setAttribute('disabled','true');
+ obj.controller.view.sel_bucket2.setAttribute('disabled','true');
+ obj.controller.view.sel_copy_details.setAttribute('disabled','true');
+ obj.controller.view.sel_patron.setAttribute('disabled','true');
+ obj.controller.view.sel_copy_details2.setAttribute('disabled','true');
+ obj.controller.view.sel_patron2.setAttribute('disabled','true');
+ obj.controller.view.cmd_items_claimed_returned.setAttribute('disabled','true');
+ obj.controller.view.cmd_items_renew.setAttribute('disabled','true');
+ obj.controller.view.cmd_items_checkin.setAttribute('disabled','true');
+ obj.controller.view.cmd_items_edit.setAttribute('disabled','true');
+ obj.controller.view.cmd_items_mark_lost.setAttribute('disabled','true');
+ obj.controller.view.cmd_show_catalog.setAttribute('disabled','true');
+ obj.controller.view.cmd_items_claimed_returned2.setAttribute('disabled','true');
+ obj.controller.view.cmd_items_renew2.setAttribute('disabled','true');
+ obj.controller.view.cmd_items_checkin2.setAttribute('disabled','true');
+ obj.controller.view.cmd_items_edit2.setAttribute('disabled','true');
+ obj.controller.view.cmd_items_mark_lost2.setAttribute('disabled','true');
+ 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.authoritative',[ 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.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() ];
+ if (!t) {
+ var robj2 = obj.network.simple_request('FM_CNCT_RETRIEVE',[ nc_circ.circ_lib() ]);
+ if (typeof robj2.ilsevent != 'undefined') throw(robj);
+ obj.data.stash_retrieve();
+ for (var j = 0; j < robj2.length; j++) {
+ if (! obj.data.hash.cnct[ robj2[j].id() ] ) {
+ obj.data.hash.cnct[ robj2[j].id() ] = robj2[j];
+ obj.data.list.cnct.push( robj2[j] );
+ }
+ }
+ obj.data.stash('hash','list');
+ t = obj.data.hash.cnct[ nc_circ.item_type() ];
+ }
+ var cd = t.circ_duration() || $("patronStrings").getString('staff.patron.items.show_noncats.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( '' );
+ fake_copy.circ_lib( nc_circ.circ_lib() );
+
+ obj.list.append( { 'row' : { 'my' : { 'circ' : fake_circ, 'mvr' : fake_record, 'acp' : fake_copy } }, 'to_bottom' : true, 'no_auto_select' : true } );
+
+ } catch(F) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.items.show_noncats.err_showing_noncat', [robj[ii].id()]),F);
+ }
+ }
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.show_noncats.err_showing_circulations'),E);
+ }
+ },
+
+ 'items_print' : function(which) {
+ var obj = this;
+ try {
+ var list = (which==2 ? obj.list2 : obj.list);
JSAN.use('patron.util');
var params = {
'patron' : patron.util.retrieve_fleshed_au_via_id(ses(),obj.patron_id),
'template' : 'items_out'
};
list.print( params );
- } catch(E) {
- obj.error.standard_unexpected_error_alert('printing 1',E);
- }
- },
-
- 'items_export' : function(which) {
- var obj = this;
- try {
- var list = (which==2 ? obj.list2 : obj.list);
- list.dump_csv_to_clipboard();
- } catch(E) {
- obj.error.standard_unexpected_error_alert('export 1',E);
- }
- },
-
- 'items_renew_all' : function() {
- try {
- var obj = this; var list = obj.list;
- if (list.on_all_fleshed != null) {
- var r = window.confirm($("patronStrings").getString('staff.patron.items.items_renew_all.list_is_busy'));
- if (!r) return;
- }
- var r = window.confirm($("patronStrings").getString('staff.patron.items.items_renew_all.renew_items_in_list'));
- if (!r) return;
- function flesh_callback() {
- try {
- obj.list.select_all();
- obj.items_renew(1,true);
- setTimeout(function(){list.on_all_fleshed = null; /* obj.retrieve();*/ },0);
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.items.items_renew_all.items_not_renewed', ['2']),E);
- }
- }
- list.on_all_fleshed = flesh_callback;
- list.full_retrieve();
- } catch(E) {
- this.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.items.items_renew_all.items_not_renewed', ['1']),E);
- }
- },
-
- 'items_renew' : function(which,skip_prompt) {
- var obj = this;
- try{
- JSAN.use('circ.util');
- var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
- if (!retrieve_ids || retrieve_ids.length == 0) return;
- JSAN.use('util.functional');
- if (!skip_prompt) {
- var msg = '';
- if(retrieve_ids.length > 1) {
- msg += $("patronStrings").getFormattedString('staff.patron.items.items_renew.renew_item_plural',[util.functional.map_list( retrieve_ids, function(o){return o.barcode;}).join(', ')]);
- } else {
- msg += $("patronStrings").getFormattedString('staff.patron.items.items_renew.renew_item_singular', [util.functional.map_list( retrieve_ids, function(o){return o.barcode;}).join(', ')]);
- }
- var r = window.confirm(msg);
- if (!r) { return; }
- }
-
- var count = 0;
-
- function gen_renew(bc,circ_id) {
- var x = document.getElementById('renew_msgs');
- if (x) {
- var l = document.createElement('label');
- l.setAttribute('value', $("patronStrings").getFormattedString('staff.patron.items.items_renew.renewing',[bc]));
- x.appendChild(l);
- }
- var renew = circ.util.renew_via_barcode( { 'barcode' : bc, 'patron' : obj.patron_id },
- function(r) {
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('printing 1',E);
+ }
+ },
+
+ 'items_export' : function(which) {
+ var obj = this;
+ try {
+ var list = (which==2 ? obj.list2 : obj.list);
+ list.dump_csv_to_clipboard();
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('export 1',E);
+ }
+ },
+
+ 'items_renew_all' : function() {
+ try {
+ var obj = this; var list = obj.list;
+ if (list.on_all_fleshed != null) {
+ var r = window.confirm($("patronStrings").getString('staff.patron.items.items_renew_all.list_is_busy'));
+ if (!r) return;
+ }
+ var r = window.confirm($("patronStrings").getString('staff.patron.items.items_renew_all.renew_items_in_list'));
+ if (!r) return;
+ function flesh_callback() {
+ try {
+ obj.list.select_all();
+ obj.items_renew(1,true);
+ setTimeout(function(){list.on_all_fleshed = null; /* obj.retrieve();*/ },0);
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.items.items_renew_all.items_not_renewed', ['2']),E);
+ }
+ }
+ list.on_all_fleshed = flesh_callback;
+ list.full_retrieve();
+ } catch(E) {
+ this.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.items.items_renew_all.items_not_renewed', ['1']),E);
+ }
+ },
+
+ 'items_renew' : function(which,skip_prompt) {
+ var obj = this;
+ try{
+ JSAN.use('circ.util');
+ var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
+ if (!retrieve_ids || retrieve_ids.length == 0) return;
+ JSAN.use('util.functional');
+ if (!skip_prompt) {
+ var msg = '';
+ if(retrieve_ids.length > 1) {
+ msg += $("patronStrings").getFormattedString('staff.patron.items.items_renew.renew_item_plural',[util.functional.map_list( retrieve_ids, function(o){return o.barcode;}).join(', ')]);
+ } else {
+ msg += $("patronStrings").getFormattedString('staff.patron.items.items_renew.renew_item_singular', [util.functional.map_list( retrieve_ids, function(o){return o.barcode;}).join(', ')]);
+ }
+ var r = window.confirm(msg);
+ if (!r) { return; }
+ }
+
+ var count = 0;
+
+ function gen_renew(bc,circ_id) {
+ var x = document.getElementById('renew_msgs');
+ if (x) {
+ var l = document.createElement('label');
+ l.setAttribute('value', $("patronStrings").getFormattedString('staff.patron.items.items_renew.renewing',[bc]));
+ x.appendChild(l);
+ }
+ var renew = circ.util.renew_via_barcode( { 'barcode' : bc, 'patron' : obj.patron_id },
+ function(r) {
try {
if ( (typeof r[0].ilsevent != 'undefined' && r[0].ilsevent == 0) ) {
l.setAttribute('value', $("patronStrings").getFormattedString('staff.patron.items.items_renew.renewed',[bc]));
@@ -297,96 +297,96 @@ patron.items.prototype = {
}
obj.refresh(circ_id);
} catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.items.items_renew.err_in_renew_via_barcode',[bc]), E);
+ obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.items.items_renew.err_in_renew_via_barcode',[bc]), E);
+ }
+ }
+ );
+ }
+
+ for (var i = 0; i < retrieve_ids.length; i++) {
+ try {
+ count++;
+ var barcode = retrieve_ids[i].barcode;
+ var circ_id = retrieve_ids[i].circ_id;
+ gen_renew(barcode,circ_id);
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.items.items_renew.no_renew_for_barcode',[barcode]), E);
+ }
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.items_renew.no_renew'),E);
+ }
+ },
+
+ 'items_edit' : function(which) {
+ var obj = this;
+ try {
+ var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
+ if (!retrieve_ids || retrieve_ids.length == 0) return;
+ function check_date(value) {
+ JSAN.use('util.date');
+ try {
+ if (! util.date.check('YYYY-MM-DD',value) ) {
+ throw($("patronStrings").getString('staff.patron.items.items_edit.invalid_date'));
}
- }
- );
- }
-
- for (var i = 0; i < retrieve_ids.length; i++) {
- try {
- count++;
- var barcode = retrieve_ids[i].barcode;
- var circ_id = retrieve_ids[i].circ_id;
- gen_renew(barcode,circ_id);
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.items.items_renew.no_renew_for_barcode',[barcode]), E);
- }
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.items_renew.no_renew'),E);
- }
- },
-
- 'items_edit' : function(which) {
- var obj = this;
- try {
- var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
- if (!retrieve_ids || retrieve_ids.length == 0) return;
- function check_date(value) {
- JSAN.use('util.date');
- try {
- if (! util.date.check('YYYY-MM-DD',value) ) {
- throw($("patronStrings").getString('staff.patron.items.items_edit.invalid_date'));
- }
- if (util.date.check_past('YYYY-MM-DD',value) ) {
- throw($("patronStrings").getString('staff.patron.items.items_edit.need_later_date'));
- }
- /*
- if ( util.date.formatted_date(new Date(),'%F') == value) {
- throw('Due date needs to be after today.');
- }
- */
- return true;
- } catch(E) {
- alert(E);
- return false;
- }
- }
-
- JSAN.use('util.functional');
- var title = '';
- if (retrieve_ids.length > 1) {
- title += $("patronStrings").getString('staff.patron.items.items_edit.edit_due_date.plural');
- } else {
- title += $("patronStrings").getString('staff.patron.items.items_edit.edit_due_date.singular');
- }
- var value = 'YYYY-MM-DD';
- var text = $("patronStrings").getFormattedString('staff.patron.items.items_edit.new_due_date', [util.functional.map_list(retrieve_ids,function(o){return o.barcode;}).join(', ')]);
- var due_date; var invalid = true;
- while(invalid) {
- due_date = window.prompt(text,value,title);
- if (due_date) {
- invalid = ! check_date(due_date);
- } else {
- invalid = false;
- }
- }
- if (due_date) {
- var circs = util.functional.map_list(retrieve_ids,function(o){return o.circ_id;});
- for (var i = 0; i < circs.length; i++) {
- var robj = obj.network.simple_request('FM_CIRC_EDIT_DUE_DATE',[ses(),circs[i],due_date]);
- if (typeof robj.ilsevent != 'undefined') { if (robj.ilsevent != 0) throw(robj); }
- }
- }
- for (var i = 0; i < obj.retrieve_ids.length; i++) {
- obj.refresh(retrieve_ids[i].circ_id);
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.items_edit.dates_not_modified'),E);
- }
- },
-
- 'items_mark_lost' : function(which) {
- var obj = this;
- try {
- var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
- if (!retrieve_ids || retrieve_ids.length == 0) return;
- for (var i = 0; i < retrieve_ids.length; i++) {
- var barcode = retrieve_ids[i].barcode;
- dump($("patronStrings").getFormattedString('staff.patron.items.items_edit.mark_barcode_lost', [barcode]));
- var robj = obj.network.simple_request( 'MARK_ITEM_LOST', [ ses(), { barcode: barcode } ]);
- if (typeof robj.ilsevent != 'undefined') {
+ if (util.date.check_past('YYYY-MM-DD',value) ) {
+ throw($("patronStrings").getString('staff.patron.items.items_edit.need_later_date'));
+ }
+ /*
+ if ( util.date.formatted_date(new Date(),'%F') == value) {
+ throw('Due date needs to be after today.');
+ }
+ */
+ return true;
+ } catch(E) {
+ alert(E);
+ return false;
+ }
+ }
+
+ JSAN.use('util.functional');
+ var title = '';
+ if (retrieve_ids.length > 1) {
+ title += $("patronStrings").getString('staff.patron.items.items_edit.edit_due_date.plural');
+ } else {
+ title += $("patronStrings").getString('staff.patron.items.items_edit.edit_due_date.singular');
+ }
+ var value = 'YYYY-MM-DD';
+ var text = $("patronStrings").getFormattedString('staff.patron.items.items_edit.new_due_date', [util.functional.map_list(retrieve_ids,function(o){return o.barcode;}).join(', ')]);
+ var due_date; var invalid = true;
+ while(invalid) {
+ due_date = window.prompt(text,value,title);
+ if (due_date) {
+ invalid = ! check_date(due_date);
+ } else {
+ invalid = false;
+ }
+ }
+ if (due_date) {
+ var circs = util.functional.map_list(retrieve_ids,function(o){return o.circ_id;});
+ for (var i = 0; i < circs.length; i++) {
+ var robj = obj.network.simple_request('FM_CIRC_EDIT_DUE_DATE',[ses(),circs[i],due_date]);
+ if (typeof robj.ilsevent != 'undefined') { if (robj.ilsevent != 0) throw(robj); }
+ }
+ }
+ for (var i = 0; i < obj.retrieve_ids.length; i++) {
+ obj.refresh(retrieve_ids[i].circ_id);
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.items_edit.dates_not_modified'),E);
+ }
+ },
+
+ 'items_mark_lost' : function(which) {
+ var obj = this;
+ try {
+ var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
+ if (!retrieve_ids || retrieve_ids.length == 0) return;
+ for (var i = 0; i < retrieve_ids.length; i++) {
+ var barcode = retrieve_ids[i].barcode;
+ dump($("patronStrings").getFormattedString('staff.patron.items.items_edit.mark_barcode_lost', [barcode]));
+ var robj = obj.network.simple_request( 'MARK_ITEM_LOST', [ ses(), { barcode: barcode } ]);
+ if (typeof robj.ilsevent != 'undefined') {
switch(Number(robj.ilsevent)) {
case 7018 /* COPY_MARKED_LOST */ :
alert( $("patronStrings").getFormattedString('staff.patron.items.items_edit.item_barcode', [barcode, robj.desc]) );
@@ -394,61 +394,61 @@ patron.items.prototype = {
default: throw(robj);
}
} else {
- obj.refresh(retrieve_ids[i].circ_id,true);
+ obj.refresh(retrieve_ids[i].circ_id,true);
+ }
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.items_edit.items_not_marked_lost'),E);
+ }
+ },
+
+ 'items_claimed_returned' : function(which) {
+ var obj = this;
+ try {
+ JSAN.use('util.date');
+ var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
+ if (!retrieve_ids || retrieve_ids.length == 0) return;
+ function check_date(value) {
+ try {
+ if (! util.date.check('YYYY-MM-DD',value) ) {
+ throw($("patronStrings").getString('staff.patron.items.items_edit.invalid_date'));
+ }
+ if ( util.date.formatted_date(new Date(),'%F') == value) {
+ return true;
+ }
+ if (! util.date.check_past('YYYY-MM-DD',value) ) {
+ throw($("patronStrings").getString('staff.patron.items.items_claimed_returned.date_cannot_be_in_future'));
+ }
+ return true;
+ } catch(E) {
+ alert(E);
+ return false;
+ }
+ }
+
+ JSAN.use('util.functional');
+ var title = $("patronStrings").getString('staff.patron.items.items_claimed_returned.claimed_returned');
+ var value = 'YYYY-MM-DD';
+ var text = $("patronStrings").getFormattedString('staff.patron.items.items_claimed_returned.enter_returned_date',
+ [util.functional.map_list(retrieve_ids,function(o){return o.barcode;}).join(', ')]);
+ var backdate; var invalid = true;
+ while(invalid) {
+ backdate = window.prompt(text,value,title);
+ if (backdate) {
+ invalid = ! check_date(backdate);
+ } else {
+ invalid = false;
}
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.items_edit.items_not_marked_lost'),E);
- }
- },
-
- 'items_claimed_returned' : function(which) {
- var obj = this;
- try {
- JSAN.use('util.date');
- var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
- if (!retrieve_ids || retrieve_ids.length == 0) return;
- function check_date(value) {
- try {
- if (! util.date.check('YYYY-MM-DD',value) ) {
- throw($("patronStrings").getString('staff.patron.items.items_edit.invalid_date'));
- }
- if ( util.date.formatted_date(new Date(),'%F') == value) {
- return true;
- }
- if (! util.date.check_past('YYYY-MM-DD',value) ) {
- throw($("patronStrings").getString('staff.patron.items.items_claimed_returned.date_cannot_be_in_future'));
- }
- return true;
- } catch(E) {
- alert(E);
- return false;
- }
- }
-
- JSAN.use('util.functional');
- var title = $("patronStrings").getString('staff.patron.items.items_claimed_returned.claimed_returned');
- var value = 'YYYY-MM-DD';
- var text = $("patronStrings").getFormattedString('staff.patron.items.items_claimed_returned.enter_returned_date',
- [util.functional.map_list(retrieve_ids,function(o){return o.barcode;}).join(', ')]);
- var backdate; var invalid = true;
- while(invalid) {
- backdate = window.prompt(text,value,title);
- if (backdate) {
- invalid = ! check_date(backdate);
- } else {
- invalid = false;
- }
- }
- //alert('backdate = ' + backdate);
- if (backdate) {
- backdate = util.date.formatted_date(backdate + ' 00:00:00','%{iso8601}');
- var barcodes = util.functional.map_list(retrieve_ids,function(o){return o.barcode;});
+ }
+ //alert('backdate = ' + backdate);
+ if (backdate) {
+ backdate = util.date.formatted_date(backdate + ' 00:00:00','%{iso8601}');
+ var barcodes = util.functional.map_list(retrieve_ids,function(o){return o.barcode;});
var do_not_move_these = {};
- for (var i = 0; i < barcodes.length; i++) {
- var robj = obj.network.simple_request(
- 'MARK_ITEM_CLAIM_RETURNED',
- [ ses(), { barcode: barcodes[i], backdate: backdate } ],
+ for (var i = 0; i < barcodes.length; i++) {
+ var robj = obj.network.simple_request(
+ 'MARK_ITEM_CLAIM_RETURNED',
+ [ ses(), { barcode: barcodes[i], backdate: backdate } ],
null,
{
'title' : $("patronStrings").getString('staff.patron.items.set_claim_returned_failure'),
@@ -456,8 +456,8 @@ patron.items.prototype = {
'PATRON_EXCEEDS_CLAIMS_RETURN_COUNT'
]
}
- );
- if (typeof robj.ilsevent != 'undefined') {
+ );
+ if (typeof robj.ilsevent != 'undefined') {
if (robj.ilsevent != 0 && robj.textcode != 'PATRON_EXCEEDS_CLAIMS_RETURN_COUNT' ) {
do_not_move_these[ barcodes[i] ] = true;
obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.items_claimed_returned.not_marked_claimed_returned'),E);
@@ -466,386 +466,386 @@ patron.items.prototype = {
do_not_move_these[ barcodes[i] ] = true;
}
}
- }
- }
- for (var i = 0; i < retrieve_ids.length; i++) {
+ }
+ }
+ for (var i = 0; i < retrieve_ids.length; i++) {
obj.refresh(retrieve_ids[i].circ_id, !do_not_move_these[ retrieve_ids[i].barcode ]);
}
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.items_claimed_returned.not_marked_claimed_returned'),E);
- }
- },
-
- 'items_checkin' : function(which) {
- var obj = this;
- try {
- var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
- if (!retrieve_ids || retrieve_ids.length == 0) return;
- JSAN.use('util.functional');
- var msg = '';
- if (retrieve_ids.length > 1) {
- msg += $("patronStrings").getFormattedString('staff.patron.items.items_checkin.confirm_item_check_in.plural',
- [util.functional.map_list( retrieve_ids, function(o){return o.barcode;}).join(', ')]);
- } else {
- msg += $("patronStrings").getFormattedString('staff.patron.items.items_checkin.confirm_item_check_in.singular',
- [util.functional.map_list( retrieve_ids, function(o){return o.barcode;}).join(', ')]);
- }
- var r = window.confirm(msg);
- if (!r) { return; }
- JSAN.use('circ.util');
- for (var i = 0; i < retrieve_ids.length; i++) {
- var copy_id = retrieve_ids[i].copy_id;
- dump('Check in copy_id = ' + copy_id + ' barcode = ' + retrieve_ids[i].barcode + '\n');
- var robj = circ.util.checkin_via_barcode(
- ses(), { 'copy_id' : copy_id }
- );
- /* circ.util.checkin_via_barcode handles errors currently */
- }
- obj.retrieve();
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.items_checkin.no_checkin'),E);
- }
- },
-
- 'show_catalog' : function(which) {
- var obj = this;
- try {
- var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
- if (!retrieve_ids || retrieve_ids.length == 0) return;
- for (var i = 0; i < retrieve_ids.length; i++) {
- var doc_id = retrieve_ids[i].doc_id;
- if (!doc_id) {
- alert($("patronStrings").getFormattedString('staff.patron.items.show_catalog.barcode_not_cataloged', [retrieve_ids[i].barcode]));
- continue;
- }
- var opac_url = xulG.url_prefix( urls.opac_rdetail ) + '?r=' + doc_id;
- var content_params = {
- 'session' : ses(),
- 'authtime' : ses('authtime'),
- 'opac_url' : opac_url
- };
- xulG.new_tab(
- xulG.url_prefix(urls.XUL_OPAC_WRAPPER),
- {'tab_name': $("patronStrings").getString('staff.patron.items.show_catalog.retrieving_title')},
- content_params
- );
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert('',E);
- }
- },
-
- 'add_billing' : function(which) {
- var obj = this;
- try {
- var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
- if (!retrieve_ids || retrieve_ids.length == 0) return;
- JSAN.use('util.window'); var win = new util.window();
- for (var i = 0; i < retrieve_ids.length; i++) {
- var circ_id = retrieve_ids[i].circ_id;
- var my_xulG = win.open(
- urls.XUL_PATRON_BILL_WIZARD,
- //+ '?patron_id=' + window.escape(obj.patron_id)
- //+ '&xact_id=' + window.escape( circ_id ),
- 'billwizard',
- 'chrome,resizable,modal',
- { 'patron_id' : obj.patron_id, 'xact_id' : circ_id }
- );
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert('',E);
- }
- },
-
- 'init_lists' : function() {
- var obj = this;
-
- JSAN.use('circ.util');
- var columns = circ.util.columns(
- {
- 'barcode' : { 'hidden' : false },
- 'checkout_lib' : { 'hidden' : false },
- 'circ_lib' : { 'hidden' : false },
- 'title' : { 'hidden' : false, 'flex' : '3' },
- 'due_date' : { 'hidden' : false },
- 'renewal_remaining' : { 'hidden' : false },
- 'stop_fines' : { 'hidden' : false }
- }
- );
- var columns2 = circ.util.columns(
- {
- 'barcode' : { 'hidden' : false },
- 'checkout_lib' : { 'hidden' : false },
- 'circ_lib' : { 'hidden' : false },
- 'title' : { 'hidden' : false, 'flex' : '3' },
- 'checkin_time' : { 'hidden' : false },
- 'stop_fines' : { 'hidden' : false }
- }
- );
-
- function retrieve_row(params) {
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.items_claimed_returned.not_marked_claimed_returned'),E);
+ }
+ },
+
+ 'items_checkin' : function(which) {
+ var obj = this;
+ try {
+ var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
+ if (!retrieve_ids || retrieve_ids.length == 0) return;
+ JSAN.use('util.functional');
+ var msg = '';
+ if (retrieve_ids.length > 1) {
+ msg += $("patronStrings").getFormattedString('staff.patron.items.items_checkin.confirm_item_check_in.plural',
+ [util.functional.map_list( retrieve_ids, function(o){return o.barcode;}).join(', ')]);
+ } else {
+ msg += $("patronStrings").getFormattedString('staff.patron.items.items_checkin.confirm_item_check_in.singular',
+ [util.functional.map_list( retrieve_ids, function(o){return o.barcode;}).join(', ')]);
+ }
+ var r = window.confirm(msg);
+ if (!r) { return; }
+ JSAN.use('circ.util');
+ for (var i = 0; i < retrieve_ids.length; i++) {
+ var copy_id = retrieve_ids[i].copy_id;
+ dump('Check in copy_id = ' + copy_id + ' barcode = ' + retrieve_ids[i].barcode + '\n');
+ var robj = circ.util.checkin_via_barcode(
+ ses(), { 'copy_id' : copy_id }
+ );
+ /* circ.util.checkin_via_barcode handles errors currently */
+ }
+ obj.retrieve();
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.items_checkin.no_checkin'),E);
+ }
+ },
+
+ 'show_catalog' : function(which) {
+ var obj = this;
+ try {
+ var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
+ if (!retrieve_ids || retrieve_ids.length == 0) return;
+ for (var i = 0; i < retrieve_ids.length; i++) {
+ var doc_id = retrieve_ids[i].doc_id;
+ if (!doc_id) {
+ alert($("patronStrings").getFormattedString('staff.patron.items.show_catalog.barcode_not_cataloged', [retrieve_ids[i].barcode]));
+ continue;
+ }
+ var opac_url = xulG.url_prefix( urls.opac_rdetail ) + '?r=' + doc_id;
+ var content_params = {
+ 'session' : ses(),
+ 'authtime' : ses('authtime'),
+ 'opac_url' : opac_url
+ };
+ xulG.new_tab(
+ xulG.url_prefix(urls.XUL_OPAC_WRAPPER),
+ {'tab_name': $("patronStrings").getString('staff.patron.items.show_catalog.retrieving_title')},
+ content_params
+ );
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('',E);
+ }
+ },
+
+ 'add_billing' : function(which) {
+ var obj = this;
+ try {
+ var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
+ if (!retrieve_ids || retrieve_ids.length == 0) return;
+ JSAN.use('util.window'); var win = new util.window();
+ for (var i = 0; i < retrieve_ids.length; i++) {
+ var circ_id = retrieve_ids[i].circ_id;
+ var my_xulG = win.open(
+ urls.XUL_PATRON_BILL_WIZARD,
+ //+ '?patron_id=' + window.escape(obj.patron_id)
+ //+ '&xact_id=' + window.escape( circ_id ),
+ 'billwizard',
+ 'chrome,resizable,modal',
+ { 'patron_id' : obj.patron_id, 'xact_id' : circ_id }
+ );
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('',E);
+ }
+ },
+
+ 'init_lists' : function() {
+ var obj = this;
+
+ JSAN.use('circ.util');
+ var columns = circ.util.columns(
+ {
+ 'barcode' : { 'hidden' : false },
+ 'checkout_lib' : { 'hidden' : false },
+ 'circ_lib' : { 'hidden' : false },
+ 'title' : { 'hidden' : false, 'flex' : '3' },
+ 'due_date' : { 'hidden' : false },
+ 'renewal_remaining' : { 'hidden' : false },
+ 'stop_fines' : { 'hidden' : false }
+ }
+ );
+ var columns2 = circ.util.columns(
+ {
+ 'barcode' : { 'hidden' : false },
+ 'checkout_lib' : { 'hidden' : false },
+ 'circ_lib' : { 'hidden' : false },
+ 'title' : { 'hidden' : false, 'flex' : '3' },
+ 'checkin_time' : { 'hidden' : false },
+ 'stop_fines' : { 'hidden' : false }
+ }
+ );
+
+ function retrieve_row(params) {
try {
- var row = params.row;
+ var row = params.row;
- if (!row.my.circ_id) {
- if (typeof params.on_retrieve == 'function') {
+ if (!row.my.circ_id) {
+ if (typeof params.on_retrieve == 'function') {
params.on_retrieve(row);
}
- return row;
- }
+ return row;
+ }
- if (!row.my.circ) {
- obj.network.simple_request(
- 'FM_CIRC_DETAILS.authoritative',
- [ row.my.circ_id ],
- function(req) {
- try {
- var robj = req.getResultObject();
- if (typeof robj.ilsevent != 'undefined') throw(robj);
- if (typeof robj.ilsevent == 'null') throw('null result');
- row.my.circ = robj.circ;
- row.my.acp = robj.copy;
- row.my.mvr = robj.mvr;
- row.my.acn = robj.volume;
+ if (!row.my.circ) {
+ obj.network.simple_request(
+ 'FM_CIRC_DETAILS.authoritative',
+ [ row.my.circ_id ],
+ function(req) {
+ try {
+ var robj = req.getResultObject();
+ if (typeof robj.ilsevent != 'undefined') throw(robj);
+ if (typeof robj.ilsevent == 'null') throw('null result');
+ row.my.circ = robj.circ;
+ row.my.acp = robj.copy;
+ row.my.mvr = robj.mvr;
+ row.my.acn = robj.volume;
row.my.record = robj.record;
-
- var copy_id = row.my.circ.target_copy();
- if (typeof copy_id == 'object') {
- if (copy_id != null) {
- copy_id = copy_id.id();
- } else {
- if (typeof robj.copy == 'object' && robj.copy != null) copy_id = robj.copy.id();
- }
- } else {
- if (typeof robj.copy == 'object' && robj.copy != null) copy_id = robj.copy.id();
- }
-
- params.row_node.setAttribute( 'retrieve_id', js2JSON({'copy_id':copy_id,'circ_id':row.my.circ.id(),'barcode':row.my.acp.barcode(),'doc_id': ( row.my.record ? row.my.record.id() : null ) }) );
-
- if (typeof params.on_retrieve == 'function') {
- params.on_retrieve(row);
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.retrieve_row.callback_error'), E);
- }
- }
- );
- } else {
+
+ var copy_id = row.my.circ.target_copy();
+ if (typeof copy_id == 'object') {
+ if (copy_id != null) {
+ copy_id = copy_id.id();
+ } else {
+ if (typeof robj.copy == 'object' && robj.copy != null) copy_id = robj.copy.id();
+ }
+ } else {
+ if (typeof robj.copy == 'object' && robj.copy != null) copy_id = robj.copy.id();
+ }
+
+ params.row_node.setAttribute( 'retrieve_id', js2JSON({'copy_id':copy_id,'circ_id':row.my.circ.id(),'barcode':row.my.acp.barcode(),'doc_id': ( row.my.record ? row.my.record.id() : null ) }) );
+
+ if (typeof params.on_retrieve == 'function') {
+ params.on_retrieve(row);
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.retrieve_row.callback_error'), E);
+ }
+ }
+ );
+ } else {
var copy_id = row.my.circ ? row.my.circ.target_copy() : null;
- if (typeof copy_id == 'object') {
- if (copy_id != null) {
- copy_id = copy_id.id();
- } else {
- if (typeof row.my.acp == 'object' && row.my.acp != null) copy_id = row.my.acp.id();
- }
- } else {
- if (typeof row.my.acp == 'object' && row.my.acp != null) copy_id = row.my.acp.id();
- }
+ if (typeof copy_id == 'object') {
+ if (copy_id != null) {
+ copy_id = copy_id.id();
+ } else {
+ if (typeof row.my.acp == 'object' && row.my.acp != null) copy_id = row.my.acp.id();
+ }
+ } else {
+ if (typeof row.my.acp == 'object' && row.my.acp != null) copy_id = row.my.acp.id();
+ }
- params.row_node.setAttribute( 'retrieve_id', js2JSON({'copy_id':row.my.acp.id(),'circ_id':row.my.circ.id(),'barcode':row.my.acp.barcode(),'doc_id': (row.my.record ? row.my.record.id() : null) }) );
- if (typeof params.on_retrieve == 'function') {
- params.on_retrieve(row);
- }
- }
+ params.row_node.setAttribute( 'retrieve_id', js2JSON({'copy_id':row.my.acp.id(),'circ_id':row.my.circ.id(),'barcode':row.my.acp.barcode(),'doc_id': (row.my.record ? row.my.record.id() : null) }) );
+ if (typeof params.on_retrieve == 'function') {
+ params.on_retrieve(row);
+ }
+ }
- return row;
+ return row;
} catch(E) {
obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.retrieve_row.error_in_retrieve_row'),E);
return params.row;
}
- }
-
- JSAN.use('util.list'); obj.list = new util.list('items_list');
- obj.list.init(
- {
- 'columns' : columns,
- 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
- 'retrieve_row' : retrieve_row,
- 'on_select' : function(ev) {
- JSAN.use('util.functional');
- var sel = obj.list.retrieve_selection();
- obj.controller.view.sel_clip.setAttribute('disabled',sel.length < 1);
- var list = util.functional.map_list(
- sel,
- function(o) { return JSON2js( o.getAttribute('retrieve_id') ); }
- );
- if (typeof obj.on_select == 'function') {
- obj.on_select(list);
- }
- if (typeof window.xulG == 'object' && typeof window.xulG.on_select == 'function') {
- obj.error.sdump('D_PATRON','patron.items: Calling external .on_select()\n');
- window.xulG.on_select(list);
- } else {
- obj.error.sdump('D_PATRON','patron.items: No external .on_select()\n');
- }
- }
- }
- );
-
- obj.list2 = new util.list('items_list2');
- obj.list2.init(
- {
- 'columns' : columns2,
- 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
- 'retrieve_row' : retrieve_row,
- 'on_select' : function(ev) {
- JSAN.use('util.functional');
- var sel = obj.list2.retrieve_selection();
- obj.controller.view.sel_clip2.setAttribute('disabled',sel.length < 1);
- var list = util.functional.map_list(
- sel,
- function(o) { return JSON2js( o.getAttribute('retrieve_id') ); }
- );
- if (typeof obj.on_select2 == 'function') {
- obj.on_select2(list);
- }
- }
- }
- );
- },
-
- 'refresh' : function(circ_id,move_to_bottom_list) {
- var obj = this;
- try {
- var nparams = obj.list_circ_map[circ_id];
+ }
+
+ JSAN.use('util.list'); obj.list = new util.list('items_list');
+ obj.list.init(
+ {
+ 'columns' : columns,
+ 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
+ 'retrieve_row' : retrieve_row,
+ 'on_select' : function(ev) {
+ JSAN.use('util.functional');
+ var sel = obj.list.retrieve_selection();
+ obj.controller.view.sel_clip.setAttribute('disabled',sel.length < 1);
+ var list = util.functional.map_list(
+ sel,
+ function(o) { return JSON2js( o.getAttribute('retrieve_id') ); }
+ );
+ if (typeof obj.on_select == 'function') {
+ obj.on_select(list);
+ }
+ if (typeof window.xulG == 'object' && typeof window.xulG.on_select == 'function') {
+ obj.error.sdump('D_PATRON','patron.items: Calling external .on_select()\n');
+ window.xulG.on_select(list);
+ } else {
+ obj.error.sdump('D_PATRON','patron.items: No external .on_select()\n');
+ }
+ }
+ }
+ );
+
+ obj.list2 = new util.list('items_list2');
+ obj.list2.init(
+ {
+ 'columns' : columns2,
+ 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
+ 'retrieve_row' : retrieve_row,
+ 'on_select' : function(ev) {
+ JSAN.use('util.functional');
+ var sel = obj.list2.retrieve_selection();
+ obj.controller.view.sel_clip2.setAttribute('disabled',sel.length < 1);
+ var list = util.functional.map_list(
+ sel,
+ function(o) { return JSON2js( o.getAttribute('retrieve_id') ); }
+ );
+ if (typeof obj.on_select2 == 'function') {
+ obj.on_select2(list);
+ }
+ }
+ }
+ );
+ },
+
+ 'refresh' : function(circ_id,move_to_bottom_list) {
+ var obj = this;
+ try {
+ var nparams = obj.list_circ_map[circ_id];
if (move_to_bottom_list) {
obj.list_circ_map[circ_id].my_node.setAttribute('hidden','true');
- var nparams2 = obj.list2.append( { 'row' : { 'my' : { 'circ_id' : circ_id } }, 'to_bottom' : true, 'which_list' : 1 } );
- obj.list_circ_map[circ_id] = nparams2;
+ var nparams2 = obj.list2.append( { 'row' : { 'my' : { 'circ_id' : circ_id } }, 'to_bottom' : true, 'which_list' : 1 } );
+ obj.list_circ_map[circ_id] = nparams2;
} else {
- var which_list = nparams.which_list;
+ var which_list = nparams.which_list;
switch(which_list) {
case 1:
- case '1':
+ case '1':
setTimeout(function(){try{obj.list2.refresh_row(nparams);}catch(E){
- obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.items.refresh.error_refreshing_row2', [circ_id, nparams]),E);}},1000);
+ obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.items.refresh.error_refreshing_row2', [circ_id, nparams]),E);}},1000);
break;
default:
setTimeout(function(){try{obj.list.refresh_row(nparams);}catch(E){
- obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.items.refresh.error_refreshing_row2', [circ_id, nparams]),E);}},1000);
+ obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.items.refresh.error_refreshing_row2', [circ_id, nparams]),E);}},1000);
+ break;
+ }
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.items.refresh.error_refreshing_row', [circ_id, nparams]),E);
+ }
+ },
+
+ 'retrieve' : function(dont_show_me_the_list_change) {
+ var obj = this;
+ if (window.xulG && window.xulG.checkouts) {
+ obj.checkouts = window.xulG.checkouts;
+ } else {
+ obj.checkouts = [];
+ obj.checkouts2 = [];
+ var robj = obj.network.simple_request(
+ 'FM_CIRC_RETRIEVE_VIA_USER.authoritative',
+ [ ses(), obj.patron_id ]
+ );
+ if (typeof robj.ilsevent!='undefined') {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.retrieve.err_retrieving_circulations'),E);
+ } else {
+ obj.checkouts = obj.checkouts.concat( robj.overdue );
+ obj.checkouts = obj.checkouts.concat( robj.out );
+ obj.checkouts2 = obj.checkouts2.concat( robj.lost );
+ obj.checkouts2 = obj.checkouts2.concat( robj.claims_returned );
+ obj.checkouts2 = obj.checkouts2.concat( robj.long_overdue );
+ }
+ var robj = obj.network.simple_request(
+ 'FM_CIRC_IN_WITH_FINES_VIA_USER.authoritative',
+ [ ses(), obj.patron_id ]
+ );
+ if (typeof robj.ilsevent!='undefined') {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.retrieve.err_retrieving_circulations'),E);
+ } else {
+ obj.checkouts2 = obj.checkouts2.concat( robj.lost );
+ obj.checkouts2 = obj.checkouts2.concat( robj.claims_returned );
+ obj.checkouts2 = obj.checkouts2.concat( robj.long_overdue );
+ }
+ }
+
+ function gen_list_append(circ_id,which_list) {
+ return function() {
+ try {
+ var nparams;
+ switch(which_list) {
+ case 1:
+ nparams = obj.list2.append( { 'row' : { 'my' : { 'circ_id' : circ_id } }, 'to_bottom' : true, 'which_list' : which_list } );
break;
+ default:
+ nparams = obj.list.append( { 'row' : { 'my' : { 'circ_id' : circ_id } }, 'to_bottom' : true, 'which_list' : which_list } );
+ break;
+ }
+ if (nparams) {
+ obj.list_circ_map[circ_id] = nparams; // unlike item status interface, each circ should be in this list only once
+ } else {
+ throw('typeof nparams = ' + typeof nparams);
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.gen_list_append.error'),E);
}
+ };
+ }
+
+ obj.list.clear(); obj.list2.clear();
+
+ JSAN.use('util.exec'); var exec = new util.exec();
+ var rows = [];
+ for (var i in obj.checkouts) {
+ rows.push( gen_list_append(obj.checkouts[i],0) );
+ }
+ for (var i in obj.checkouts2) {
+ rows.push( gen_list_append(obj.checkouts2[i],1) );
+ }
+ exec.chain( rows );
+ if (!dont_show_me_the_list_change) {
+ if (window.xulG && typeof window.xulG.on_list_change == 'function') {
+ try { window.xulG.on_list_change(obj.checkouts); } catch(E) { this.error.sdump('D_ERROR',E); }
}
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getFormattedString('staff.patron.items.refresh.error_refreshing_row', [circ_id, nparams]),E);
- }
- },
-
- 'retrieve' : function(dont_show_me_the_list_change) {
- var obj = this;
- if (window.xulG && window.xulG.checkouts) {
- obj.checkouts = window.xulG.checkouts;
- } else {
- obj.checkouts = [];
- obj.checkouts2 = [];
- var robj = obj.network.simple_request(
- 'FM_CIRC_RETRIEVE_VIA_USER.authoritative',
- [ ses(), obj.patron_id ]
- );
- if (typeof robj.ilsevent!='undefined') {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.retrieve.err_retrieving_circulations'),E);
- } else {
- obj.checkouts = obj.checkouts.concat( robj.overdue );
- obj.checkouts = obj.checkouts.concat( robj.out );
- obj.checkouts2 = obj.checkouts2.concat( robj.lost );
- obj.checkouts2 = obj.checkouts2.concat( robj.claims_returned );
- obj.checkouts2 = obj.checkouts2.concat( robj.long_overdue );
- }
- var robj = obj.network.simple_request(
- 'FM_CIRC_IN_WITH_FINES_VIA_USER.authoritative',
- [ ses(), obj.patron_id ]
- );
- if (typeof robj.ilsevent!='undefined') {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.retrieve.err_retrieving_circulations'),E);
- } else {
- obj.checkouts2 = obj.checkouts2.concat( robj.lost );
- obj.checkouts2 = obj.checkouts2.concat( robj.claims_returned );
- obj.checkouts2 = obj.checkouts2.concat( robj.long_overdue );
- }
- }
-
- function gen_list_append(circ_id,which_list) {
- return function() {
- try {
- var nparams;
- switch(which_list) {
- case 1:
- nparams = obj.list2.append( { 'row' : { 'my' : { 'circ_id' : circ_id } }, 'to_bottom' : true, 'which_list' : which_list } );
- break;
- default:
- nparams = obj.list.append( { 'row' : { 'my' : { 'circ_id' : circ_id } }, 'to_bottom' : true, 'which_list' : which_list } );
- break;
- }
- if (nparams) {
- obj.list_circ_map[circ_id] = nparams; // unlike item status interface, each circ should be in this list only once
- } else {
- throw('typeof nparams = ' + typeof nparams);
- }
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.items.gen_list_append.error'),E);
- }
- };
- }
-
- obj.list.clear(); obj.list2.clear();
-
- JSAN.use('util.exec'); var exec = new util.exec();
- var rows = [];
- for (var i in obj.checkouts) {
- rows.push( gen_list_append(obj.checkouts[i],0) );
- }
- for (var i in obj.checkouts2) {
- rows.push( gen_list_append(obj.checkouts2[i],1) );
- }
- exec.chain( rows );
- if (!dont_show_me_the_list_change) {
- if (window.xulG && typeof window.xulG.on_list_change == 'function') {
- try { window.xulG.on_list_change(obj.checkouts); } catch(E) { this.error.sdump('D_ERROR',E); }
- }
- }
- },
-
- 'on_select' : function(list) {
-
- dump('patron.items.on_select list = ' + js2JSON(list) + '\n');
-
- var obj = this;
-
- obj.controller.view.cmd_items_claimed_returned.setAttribute('disabled','false');
- obj.controller.view.cmd_items_renew.setAttribute('disabled','false');
- obj.controller.view.cmd_items_checkin.setAttribute('disabled','false');
- obj.controller.view.cmd_items_edit.setAttribute('disabled','false');
- obj.controller.view.cmd_items_mark_lost.setAttribute('disabled','false');
- obj.controller.view.cmd_show_catalog.setAttribute('disabled','false');
- obj.controller.view.sel_copy_details.setAttribute('disabled','false');
- obj.controller.view.sel_bucket.setAttribute('disabled','false');
- obj.controller.view.sel_patron.setAttribute('disabled','false');
- obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','false');
- obj.controller.view.sel_mark_items_missing.setAttribute('disabled','false');
-
- obj.retrieve_ids = list;
- },
-
- 'on_select2' : function(list) {
-
- dump('patron.items.on_select2 list = ' + js2JSON(list) + '\n');
-
- var obj = this;
-
- obj.controller.view.cmd_items_claimed_returned2.setAttribute('disabled','false');
- obj.controller.view.cmd_items_renew2.setAttribute('disabled','false');
- obj.controller.view.cmd_items_checkin2.setAttribute('disabled','false');
- obj.controller.view.cmd_items_edit2.setAttribute('disabled','false');
- obj.controller.view.cmd_items_mark_lost2.setAttribute('disabled','false');
- obj.controller.view.cmd_show_catalog2.setAttribute('disabled','false');
- obj.controller.view.sel_copy_details2.setAttribute('disabled','false');
- obj.controller.view.sel_bucket2.setAttribute('disabled','false');
- obj.controller.view.sel_patron2.setAttribute('disabled','false');
- obj.controller.view.sel_mark_items_damaged2.setAttribute('disabled','false');
- obj.controller.view.sel_mark_items_missing2.setAttribute('disabled','false');
-
- this.retrieve_ids2 = list;
- }
+ }
+ },
+
+ 'on_select' : function(list) {
+
+ dump('patron.items.on_select list = ' + js2JSON(list) + '\n');
+
+ var obj = this;
+
+ obj.controller.view.cmd_items_claimed_returned.setAttribute('disabled','false');
+ obj.controller.view.cmd_items_renew.setAttribute('disabled','false');
+ obj.controller.view.cmd_items_checkin.setAttribute('disabled','false');
+ obj.controller.view.cmd_items_edit.setAttribute('disabled','false');
+ obj.controller.view.cmd_items_mark_lost.setAttribute('disabled','false');
+ obj.controller.view.cmd_show_catalog.setAttribute('disabled','false');
+ obj.controller.view.sel_copy_details.setAttribute('disabled','false');
+ obj.controller.view.sel_bucket.setAttribute('disabled','false');
+ obj.controller.view.sel_patron.setAttribute('disabled','false');
+ obj.controller.view.sel_mark_items_damaged.setAttribute('disabled','false');
+ obj.controller.view.sel_mark_items_missing.setAttribute('disabled','false');
+
+ obj.retrieve_ids = list;
+ },
+
+ 'on_select2' : function(list) {
+
+ dump('patron.items.on_select2 list = ' + js2JSON(list) + '\n');
+
+ var obj = this;
+
+ obj.controller.view.cmd_items_claimed_returned2.setAttribute('disabled','false');
+ obj.controller.view.cmd_items_renew2.setAttribute('disabled','false');
+ obj.controller.view.cmd_items_checkin2.setAttribute('disabled','false');
+ obj.controller.view.cmd_items_edit2.setAttribute('disabled','false');
+ obj.controller.view.cmd_items_mark_lost2.setAttribute('disabled','false');
+ obj.controller.view.cmd_show_catalog2.setAttribute('disabled','false');
+ obj.controller.view.sel_copy_details2.setAttribute('disabled','false');
+ obj.controller.view.sel_bucket2.setAttribute('disabled','false');
+ obj.controller.view.sel_patron2.setAttribute('disabled','false');
+ obj.controller.view.sel_mark_items_damaged2.setAttribute('disabled','false');
+ obj.controller.view.sel_mark_items_missing2.setAttribute('disabled','false');
+
+ this.retrieve_ids2 = list;
+ }
}
diff --git a/Open-ILS/xul/staff_client/server/patron/new_standing_penalty.js b/Open-ILS/xul/staff_client/server/patron/new_standing_penalty.js
index dffdc24ad0..d3c56ec0f6 100644
--- a/Open-ILS/xul/staff_client/server/patron/new_standing_penalty.js
+++ b/Open-ILS/xul/staff_client/server/patron/new_standing_penalty.js
@@ -17,7 +17,7 @@ function new_penalty_init() {
JSAN.errorLevel = "die"; // none, warn, or die
JSAN.addRepository('..');
- JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
+ JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
JSAN.use('util.error'); error = new util.error();
JSAN.use('util.widgets');
diff --git a/Open-ILS/xul/staff_client/server/patron/search_form.js b/Open-ILS/xul/staff_client/server/patron/search_form.js
index fceecc083e..2426200261 100644
--- a/Open-ILS/xul/staff_client/server/patron/search_form.js
+++ b/Open-ILS/xul/staff_client/server/patron/search_form.js
@@ -3,16 +3,16 @@ dump('entering patron/search_form.js\n');
if (typeof patron == 'undefined') patron = {};
patron.search_form = function (params) {
- JSAN.use('util.error'); this.error = new util.error();
- JSAN.use('util.network'); this.network = new util.network();
- this.w = window;
+ JSAN.use('util.error'); this.error = new util.error();
+ JSAN.use('util.network'); this.network = new util.network();
+ this.w = window;
}
patron.search_form.prototype = {
- 'init' : function( params ) {
+ 'init' : function( params ) {
- var obj = this;
+ var obj = this;
// The bulk of params.query is getting parsed/rendered by obj.controller.init below, and will be reconstituted from possibly modified XUL elements upon Submit.
// But we're going to let search_limit and search_sort be configurable now by those spawning this interface, and let's assume there are no corresponding widgets for now.
@@ -20,219 +20,219 @@ patron.search_form.prototype = {
obj.search_limit = params.query.search_limit;
obj.search_sort = JSON2js( params.query.search_sort ); // Let's assume this is encoded as JSON
- JSAN.use('OpenILS.data'); this.OpenILS = {};
- obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
+ JSAN.use('OpenILS.data'); this.OpenILS = {};
+ obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
- JSAN.use('util.controller'); obj.controller = new util.controller();
- obj.controller.init(
- {
- control_map : {
- 'cmd_broken' : [
- ['command'],
- function() { alert($("commonStrings").getString('common.unimplemented')); }
- ],
- 'cmd_patron_search_submit' : [
- ['command'],
- function() {
- obj.submit();
- }
- ],
- 'cmd_patron_search_clear' : [
- ['command'],
- function() {
- obj.controller.render();
- window.xulG.clear_left_deck();
- }
- ],
- 'family_name' : [
- ['render'],
- function(e) {
- return function() {
- if (params.query&¶ms.query.family_name) {
- e.setAttribute('value',params.query.family_name);
- e.value = params.query.family_name;
- } else {
- e.value = '';
- }
- };
- }
- ],
- 'first_given_name' : [
- ['render'],
- function(e) {
- return function() {
- if (params.query&¶ms.query.first_given_name) {
- e.setAttribute('value',params.query.first_given_name);
- e.value = params.query.first_given_name;
- } else {
- e.value = '';
- }
- };
- }
- ],
- 'second_given_name' : [
- ['render'],
- function(e) {
- return function() {
- if (params.query&¶ms.query.second_given_name) {
- e.setAttribute('value',params.query.second_given_name);
- e.value = params.query.second_given_name;
- } else {
- e.value = '';
- }
- };
- }
- ],
- 'alias' : [
- ['render'],
- function(e) {
- return function() {
- if (params.query&¶ms.query.alias) {
- e.setAttribute('value',params.query.alias);
- e.value = params.query.alias;
- } else {
- e.value = '';
- }
- };
- }
- ],
- 'usrname' : [
- ['render'],
- function(e) {
- return function() {
- if (params.query&¶ms.query.usrname) {
- e.setAttribute('value',params.query.usrname);
- e.value = params.query.usrname;
- } else {
- e.value = '';
- }
- };
- }
- ],
- 'card' : [
- ['render'],
- function(e) {
- return function() {
- if (params.query&¶ms.query.card) {
- e.setAttribute('value',params.query.card);
- e.value = params.query.card;
- } else {
- e.value = '';
- }
- };
- }
- ],
- 'email' : [
- ['render'],
- function(e) {
- return function() {
- if (params.query&¶ms.query.email) {
- e.setAttribute('value',params.query.email);
- e.value = params.query.email;
- } else {
- e.value = '';
- }
- };
- }
- ],
- 'phone' : [
- ['render'],
- function(e) {
- return function() {
- if (params.query&¶ms.query.phone) {
- e.setAttribute('value',params.query.phone);
- e.value = params.query.phone;
- } else {
- e.value = '';
- }
- };
- }
- ],
- 'ident' : [
- ['render'],
- function(e) {
- return function() {
- if (params.query&¶ms.query.ident) {
- e.setAttribute('value',params.query.ident);
- e.value = params.query.ident;
- } else if (params.query&¶ms.query.ident_value) {
- e.setAttribute('value',params.query.ident_value);
- e.value = params.query.ident_value;
- } else if (params.query&¶ms.query.ident_value2) {
- e.setAttribute('value',params.query.ident_value2);
- e.value = params.query.ident_value2;
- } else {
- e.value = '';
- }
- };
- }
- ],
- 'street1' : [
- ['render'],
- function(e) {
- return function() {
- if (params.query&¶ms.query.street1) {
- e.setAttribute('value',params.query.street1);
- e.value = params.query.street1;
- } else {
- e.value = '';
- }
- };
- }
- ],
- 'street2' : [
- ['render'],
- function(e) {
- return function() {
- if (params.query&¶ms.query.street2) {
- e.setAttribute('value',params.query.street2);
- e.value = params.query.street2;
- } else {
- e.value = '';
- }
- };
- }
- ],
- 'city' : [
- ['render'],
- function(e) {
- return function() {
- if (params.query&¶ms.query.city) {
- e.setAttribute('value',params.query.city);
- e.value = params.query.city;
- } else {
- e.value = '';
- }
- };
- }
- ],
- 'state' : [
- ['render'],
- function(e) {
- return function() {
- if (params.query&¶ms.query.state) {
- e.setAttribute('value',params.query.state);
- e.value = params.query.state;
- } else {
- e.value = '';
- }
- };
- }
- ],
- 'post_code' : [
- ['render'],
- function(e) {
- return function() {
- if (params.query&¶ms.query.post_code) {
- e.setAttribute('value',params.query.post_code);
- e.value = params.query.post_code;
- } else {
- e.value = '';
- }
- };
- }
- ],
- 'inactive' : [ ['render'], function(e) {
+ JSAN.use('util.controller'); obj.controller = new util.controller();
+ obj.controller.init(
+ {
+ control_map : {
+ 'cmd_broken' : [
+ ['command'],
+ function() { alert($("commonStrings").getString('common.unimplemented')); }
+ ],
+ 'cmd_patron_search_submit' : [
+ ['command'],
+ function() {
+ obj.submit();
+ }
+ ],
+ 'cmd_patron_search_clear' : [
+ ['command'],
+ function() {
+ obj.controller.render();
+ window.xulG.clear_left_deck();
+ }
+ ],
+ 'family_name' : [
+ ['render'],
+ function(e) {
+ return function() {
+ if (params.query&¶ms.query.family_name) {
+ e.setAttribute('value',params.query.family_name);
+ e.value = params.query.family_name;
+ } else {
+ e.value = '';
+ }
+ };
+ }
+ ],
+ 'first_given_name' : [
+ ['render'],
+ function(e) {
+ return function() {
+ if (params.query&¶ms.query.first_given_name) {
+ e.setAttribute('value',params.query.first_given_name);
+ e.value = params.query.first_given_name;
+ } else {
+ e.value = '';
+ }
+ };
+ }
+ ],
+ 'second_given_name' : [
+ ['render'],
+ function(e) {
+ return function() {
+ if (params.query&¶ms.query.second_given_name) {
+ e.setAttribute('value',params.query.second_given_name);
+ e.value = params.query.second_given_name;
+ } else {
+ e.value = '';
+ }
+ };
+ }
+ ],
+ 'alias' : [
+ ['render'],
+ function(e) {
+ return function() {
+ if (params.query&¶ms.query.alias) {
+ e.setAttribute('value',params.query.alias);
+ e.value = params.query.alias;
+ } else {
+ e.value = '';
+ }
+ };
+ }
+ ],
+ 'usrname' : [
+ ['render'],
+ function(e) {
+ return function() {
+ if (params.query&¶ms.query.usrname) {
+ e.setAttribute('value',params.query.usrname);
+ e.value = params.query.usrname;
+ } else {
+ e.value = '';
+ }
+ };
+ }
+ ],
+ 'card' : [
+ ['render'],
+ function(e) {
+ return function() {
+ if (params.query&¶ms.query.card) {
+ e.setAttribute('value',params.query.card);
+ e.value = params.query.card;
+ } else {
+ e.value = '';
+ }
+ };
+ }
+ ],
+ 'email' : [
+ ['render'],
+ function(e) {
+ return function() {
+ if (params.query&¶ms.query.email) {
+ e.setAttribute('value',params.query.email);
+ e.value = params.query.email;
+ } else {
+ e.value = '';
+ }
+ };
+ }
+ ],
+ 'phone' : [
+ ['render'],
+ function(e) {
+ return function() {
+ if (params.query&¶ms.query.phone) {
+ e.setAttribute('value',params.query.phone);
+ e.value = params.query.phone;
+ } else {
+ e.value = '';
+ }
+ };
+ }
+ ],
+ 'ident' : [
+ ['render'],
+ function(e) {
+ return function() {
+ if (params.query&¶ms.query.ident) {
+ e.setAttribute('value',params.query.ident);
+ e.value = params.query.ident;
+ } else if (params.query&¶ms.query.ident_value) {
+ e.setAttribute('value',params.query.ident_value);
+ e.value = params.query.ident_value;
+ } else if (params.query&¶ms.query.ident_value2) {
+ e.setAttribute('value',params.query.ident_value2);
+ e.value = params.query.ident_value2;
+ } else {
+ e.value = '';
+ }
+ };
+ }
+ ],
+ 'street1' : [
+ ['render'],
+ function(e) {
+ return function() {
+ if (params.query&¶ms.query.street1) {
+ e.setAttribute('value',params.query.street1);
+ e.value = params.query.street1;
+ } else {
+ e.value = '';
+ }
+ };
+ }
+ ],
+ 'street2' : [
+ ['render'],
+ function(e) {
+ return function() {
+ if (params.query&¶ms.query.street2) {
+ e.setAttribute('value',params.query.street2);
+ e.value = params.query.street2;
+ } else {
+ e.value = '';
+ }
+ };
+ }
+ ],
+ 'city' : [
+ ['render'],
+ function(e) {
+ return function() {
+ if (params.query&¶ms.query.city) {
+ e.setAttribute('value',params.query.city);
+ e.value = params.query.city;
+ } else {
+ e.value = '';
+ }
+ };
+ }
+ ],
+ 'state' : [
+ ['render'],
+ function(e) {
+ return function() {
+ if (params.query&¶ms.query.state) {
+ e.setAttribute('value',params.query.state);
+ e.value = params.query.state;
+ } else {
+ e.value = '';
+ }
+ };
+ }
+ ],
+ 'post_code' : [
+ ['render'],
+ function(e) {
+ return function() {
+ if (params.query&¶ms.query.post_code) {
+ e.setAttribute('value',params.query.post_code);
+ e.value = params.query.post_code;
+ } else {
+ e.value = '';
+ }
+ };
+ }
+ ],
+ 'inactive' : [ ['render'], function(e) {
return function() {};
}
],
@@ -240,19 +240,19 @@ patron.search_form.prototype = {
return function() {};
}
],
- }
- }
- );
+ }
+ }
+ );
- obj.controller.render();
- var nl = document.getElementsByTagName('textbox');
- for (var i = 0; i < nl.length; i++) {
- nl[i].addEventListener('keypress',function(ev){
- if (ev.target.tagName != 'textbox') return;
- if (ev.keyCode == 13 /* enter */ || ev.keyCode == 77 /* enter on a mac */) setTimeout( function() { obj.submit(); }, 0);
- },false);
- }
- document.getElementById('family_name').focus();
+ obj.controller.render();
+ var nl = document.getElementsByTagName('textbox');
+ for (var i = 0; i < nl.length; i++) {
+ nl[i].addEventListener('keypress',function(ev){
+ if (ev.target.tagName != 'textbox') return;
+ if (ev.keyCode == 13 /* enter */ || ev.keyCode == 77 /* enter on a mac */) setTimeout( function() { obj.submit(); }, 0);
+ },false);
+ }
+ document.getElementById('family_name').focus();
JSAN.use('util.file'); JSAN.use('util.widgets'); JSAN.use('util.functional');
util.widgets.remove_children(obj.controller.view.search_depth);
@@ -278,13 +278,13 @@ patron.search_form.prototype = {
ml.setAttribute('id','search_depth_ml');
obj.controller.view.search_depth.appendChild(ml);
- var file = new util.file('patron_search_prefs.'+obj.OpenILS.data.server_unadorned);
- util.widgets.load_attributes(file);
- ml.value = ml.getAttribute('value');
- if (! ml.value) {
- ml.value = 0
- ml.setAttribute('value',ml.value);
- }
+ var file = new util.file('patron_search_prefs.'+obj.OpenILS.data.server_unadorned);
+ util.widgets.load_attributes(file);
+ ml.value = ml.getAttribute('value');
+ if (! ml.value) {
+ ml.value = 0
+ ml.setAttribute('value',ml.value);
+ }
var cb = obj.controller.view.inactive;
cb.addEventListener('command',function() {
@@ -295,56 +295,56 @@ patron.search_form.prototype = {
);
cb.checked = cb.getAttribute('value') == "true" ? true : false;
- },
+ },
- 'on_submit' : function(q) {
- var msg = 'Query = ' + q;
- this.error.sdump('D_PATRON', msg);
- },
+ 'on_submit' : function(q) {
+ var msg = 'Query = ' + q;
+ this.error.sdump('D_PATRON', msg);
+ },
- 'submit' : function() {
- window.xulG.clear_left_deck();
- var obj = this;
- var query = {};
- for (var i = 0; i < obj.controller.render_list.length; i++) {
- var id = obj.controller.render_list[i][0];
- var node = document.getElementById(id);
- if (node && node.value != '') {
- if (id == 'inactive') {
- query[id] = node.getAttribute('value');
- obj.error.sdump('D_DEBUG','id = ' + id + ' value = ' + node.getAttribute('value') + '\n');
+ 'submit' : function() {
+ window.xulG.clear_left_deck();
+ var obj = this;
+ var query = {};
+ for (var i = 0; i < obj.controller.render_list.length; i++) {
+ var id = obj.controller.render_list[i][0];
+ var node = document.getElementById(id);
+ if (node && node.value != '') {
+ if (id == 'inactive') {
+ query[id] = node.getAttribute('value');
+ obj.error.sdump('D_DEBUG','id = ' + id + ' value = ' + node.getAttribute('value') + '\n');
} else {
if (id == 'search_depth') {
query[id] = node.firstChild.getAttribute('value');
- } else {
- var value = node.value.replace(/^\s+/,'').replace(/[\\\s]+$/,'');
- //value = value.replace(/\d/g,'');
- switch(id) {
- case 'family_name' :
- case 'first_given_name' :
- case 'second_given_name' :
- value = value.replace(/^[\d\s]+/g,'').replace(/[\d\s]+$/g,'')
- break;
- }
- if (value != '') {
- query[id] = value;
- obj.error.sdump('D_DEBUG','id = ' + id + ' value = ' + value + '\n');
- }
- }
+ } else {
+ var value = node.value.replace(/^\s+/,'').replace(/[\\\s]+$/,'');
+ //value = value.replace(/\d/g,'');
+ switch(id) {
+ case 'family_name' :
+ case 'first_given_name' :
+ case 'second_given_name' :
+ value = value.replace(/^[\d\s]+/g,'').replace(/[\d\s]+$/g,'')
+ break;
+ }
+ if (value != '') {
+ query[id] = value;
+ obj.error.sdump('D_DEBUG','id = ' + id + ' value = ' + value + '\n');
+ }
+ }
}
- }
- }
- if (typeof obj.on_submit == 'function') {
- obj.on_submit(query,obj.search_limit,obj.search_sort);
- }
- if (typeof window.xulG == 'object'
- && typeof window.xulG.on_submit == 'function') {
- obj.error.sdump('D_PATRON','patron.search_form: Calling external .on_submit()\n');
- window.xulG.on_submit(query,obj.search_limit,obj.search_sort);
- } else {
- obj.error.sdump('D_PATRON','patron.search_form: No external .on_query()\n');
- }
- },
+ }
+ }
+ if (typeof obj.on_submit == 'function') {
+ obj.on_submit(query,obj.search_limit,obj.search_sort);
+ }
+ if (typeof window.xulG == 'object'
+ && typeof window.xulG.on_submit == 'function') {
+ obj.error.sdump('D_PATRON','patron.search_form: Calling external .on_submit()\n');
+ window.xulG.on_submit(query,obj.search_limit,obj.search_sort);
+ } else {
+ obj.error.sdump('D_PATRON','patron.search_form: No external .on_query()\n');
+ }
+ },
}
diff --git a/Open-ILS/xul/staff_client/server/patron/search_result.js b/Open-ILS/xul/staff_client/server/patron/search_result.js
index 89c59d4a74..b7d2b2974c 100644
--- a/Open-ILS/xul/staff_client/server/patron/search_result.js
+++ b/Open-ILS/xul/staff_client/server/patron/search_result.js
@@ -5,241 +5,241 @@ function $(id) { return document.getElementById(id); }
if (typeof patron == 'undefined') patron = {};
patron.search_result = function (params) {
- JSAN.use('util.error'); this.error = new util.error();
- JSAN.use('util.network'); this.network = new util.network();
- this.w = window;
+ JSAN.use('util.error'); this.error = new util.error();
+ JSAN.use('util.network'); this.network = new util.network();
+ this.w = window;
}
patron.search_result.prototype = {
- 'result_cap' : 50,
+ 'result_cap' : 50,
- 'init' : function( params ) {
+ 'init' : function( params ) {
- var obj = this;
+ var obj = this;
- obj.query = params['query'];
+ obj.query = params['query'];
obj.search_limit = params['search_limit'];
obj.search_sort = params['search_sort'];
- JSAN.use('OpenILS.data'); this.OpenILS = {};
- obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
+ JSAN.use('OpenILS.data'); this.OpenILS = {};
+ obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
var obscure_dob = String( obj.OpenILS.data.hash.aous['circ.obscure_dob'] ) == 'true';
- JSAN.use('util.list'); obj.list = new util.list('patron_list');
-
- JSAN.use('patron.util');
- var columns = patron.util.columns(
- {
- /* 'active' : { 'hidden' : 'false' }, */
- 'barred' : { 'hidden' : 'false' },
- 'family_name' : { 'hidden' : 'false' },
- 'first_given_name' : { 'hidden' : 'false' },
- 'second_given_name' : { 'hidden' : 'false' },
- 'dob' : { 'hidden' : obscure_dob }
- },
- {
- 'except_these' : [
- 'barcode',
- ]
- }
- );
- obj.list.init(
- {
- 'columns' : columns,
- 'map_row_to_columns' : patron.util.std_map_row_to_columns(),
- 'retrieve_row' : function(params) {
- var id = params.retrieve_id;
- var au_obj = patron.util.retrieve_au_via_id( ses(), id,
- function(req) {
- try {
- var row = params.row;
- if (typeof row.my == 'undefined') row.my = {};
- row.my.au = req.getResultObject();
- if (typeof params.on_retrieve == 'function') {
- params.on_retrieve(row);
- } else {
- alert($("patronStrings").getFormattedString('staff.patron.search_result.init.typeof_params', [typeof params.on_retrieve]));
- }
- } catch(E) {
- alert('error: ' + E);
- }
- }
- );
- },
- 'on_select' : function(ev) {
- JSAN.use('util.functional');
- var sel = obj.list.retrieve_selection();
- var list = util.functional.map_list(
- sel,
- function(o) { return o.getAttribute('retrieve_id'); }
- );
- obj.controller.view.cmd_sel_clip.setAttribute('disabled', list.length < 1 );
- if (typeof obj.on_select == 'function') {
- obj.on_select(list);
- }
- if (typeof window.xulG == 'object' && typeof window.xulG.on_select == 'function') {
- obj.error.sdump('D_PATRON','patron.search_result: Calling external .on_select()\n');
- window.xulG.on_select(list);
- } else {
- obj.error.sdump('D_PATRON','patron.search_result: No external .on_select()\n');
- }
- }
- }
- );
- JSAN.use('util.controller'); obj.controller = new util.controller();
- obj.controller.init(
- {
- control_map : {
- 'cmd_broken' : [
- ['command'],
- function() { alert($("commonStrings").getString('common.unimplemented')); }
- ],
- 'cmd_search_print' : [
- ['command'],
- function() {
+ JSAN.use('util.list'); obj.list = new util.list('patron_list');
+
+ JSAN.use('patron.util');
+ var columns = patron.util.columns(
+ {
+ /* 'active' : { 'hidden' : 'false' }, */
+ 'barred' : { 'hidden' : 'false' },
+ 'family_name' : { 'hidden' : 'false' },
+ 'first_given_name' : { 'hidden' : 'false' },
+ 'second_given_name' : { 'hidden' : 'false' },
+ 'dob' : { 'hidden' : obscure_dob }
+ },
+ {
+ 'except_these' : [
+ 'barcode',
+ ]
+ }
+ );
+ obj.list.init(
+ {
+ 'columns' : columns,
+ 'map_row_to_columns' : patron.util.std_map_row_to_columns(),
+ 'retrieve_row' : function(params) {
+ var id = params.retrieve_id;
+ var au_obj = patron.util.retrieve_au_via_id( ses(), id,
+ function(req) {
+ try {
+ var row = params.row;
+ if (typeof row.my == 'undefined') row.my = {};
+ row.my.au = req.getResultObject();
+ if (typeof params.on_retrieve == 'function') {
+ params.on_retrieve(row);
+ } else {
+ alert($("patronStrings").getFormattedString('staff.patron.search_result.init.typeof_params', [typeof params.on_retrieve]));
+ }
+ } catch(E) {
+ alert('error: ' + E);
+ }
+ }
+ );
+ },
+ 'on_select' : function(ev) {
+ JSAN.use('util.functional');
+ var sel = obj.list.retrieve_selection();
+ var list = util.functional.map_list(
+ sel,
+ function(o) { return o.getAttribute('retrieve_id'); }
+ );
+ obj.controller.view.cmd_sel_clip.setAttribute('disabled', list.length < 1 );
+ if (typeof obj.on_select == 'function') {
+ obj.on_select(list);
+ }
+ if (typeof window.xulG == 'object' && typeof window.xulG.on_select == 'function') {
+ obj.error.sdump('D_PATRON','patron.search_result: Calling external .on_select()\n');
+ window.xulG.on_select(list);
+ } else {
+ obj.error.sdump('D_PATRON','patron.search_result: No external .on_select()\n');
+ }
+ }
+ }
+ );
+ JSAN.use('util.controller'); obj.controller = new util.controller();
+ obj.controller.init(
+ {
+ control_map : {
+ 'cmd_broken' : [
+ ['command'],
+ function() { alert($("commonStrings").getString('common.unimplemented')); }
+ ],
+ 'cmd_search_print' : [
+ ['command'],
+ function() {
+ try {
+ var p = {
+ 'template' : 'patron'
+ };
+ obj.list.print( p );
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.search_result.init.search_print'),E);
+ }
+ }
+ ],
+ 'cmd_sel_clip' : [
+ ['command'],
+ function() {
try {
- var p = {
- 'template' : 'patron'
- };
- obj.list.print( p );
+ obj.list.clipboard();
} catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.search_result.init.search_print'),E);
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.search_result.init.search_clipboard'),E);
}
- }
- ],
- 'cmd_sel_clip' : [
- ['command'],
- function() {
- try {
- obj.list.clipboard();
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.search_result.init.search_clipboard'),E);
- }
- }
- ],
- 'cmd_save_cols' : [
- ['command'],
- function() {
- try {
- obj.list.save_columns();
- } catch(E) {
- obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.search_result.init.search_saving_columns'),E);
- }
- }
- ],
- }
- }
- );
-
- if (obj.query) obj.search(obj.query);
- },
-
- 'search' : function(query) {
- var obj = this;
- var search_hash = {};
- obj.search_term_count = 0;
- var inactive = false;
+ }
+ ],
+ 'cmd_save_cols' : [
+ ['command'],
+ function() {
+ try {
+ obj.list.save_columns();
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.search_result.init.search_saving_columns'),E);
+ }
+ }
+ ],
+ }
+ }
+ );
+
+ if (obj.query) obj.search(obj.query);
+ },
+
+ 'search' : function(query) {
+ var obj = this;
+ var search_hash = {};
+ obj.search_term_count = 0;
+ var inactive = false;
var search_depth = 0;
- for (var i in query) {
- switch( i ) {
+ for (var i in query) {
+ switch( i ) {
case 'card':
- search_hash[ i ] = {};
- search_hash[ i ].value = query[i];
- search_hash[i].group = 3;
- obj.search_term_count++;
- break;
-
- case 'phone': case 'ident':
-
- search_hash[ i ] = {};
- search_hash[ i ].value = query[i];
- search_hash[i].group = 2;
- obj.search_term_count++;
- break;
-
- case 'street1': case 'street2': case 'city': case 'state': case 'post_code':
-
- search_hash[ i ] = {};
- search_hash[ i ].value = query[i];
- search_hash[i].group = 1;
- obj.search_term_count++;
- break;
-
- case 'family_name': case 'first_given_name': case 'second_given_name': case 'email': case 'alias': case 'usrname':
-
- search_hash[ i ] = {};
- search_hash[ i ].value = query[i];
- search_hash[i].group = 0;
- obj.search_term_count++;
- break;
-
- case 'inactive':
- if (query[i] == 'checked' || query[i] == 'true') inactive = true;
- break;
+ search_hash[ i ] = {};
+ search_hash[ i ].value = query[i];
+ search_hash[i].group = 3;
+ obj.search_term_count++;
+ break;
+
+ case 'phone': case 'ident':
+
+ search_hash[ i ] = {};
+ search_hash[ i ].value = query[i];
+ search_hash[i].group = 2;
+ obj.search_term_count++;
+ break;
+
+ case 'street1': case 'street2': case 'city': case 'state': case 'post_code':
+
+ search_hash[ i ] = {};
+ search_hash[ i ].value = query[i];
+ search_hash[i].group = 1;
+ obj.search_term_count++;
+ break;
+
+ case 'family_name': case 'first_given_name': case 'second_given_name': case 'email': case 'alias': case 'usrname':
+
+ search_hash[ i ] = {};
+ search_hash[ i ].value = query[i];
+ search_hash[i].group = 0;
+ obj.search_term_count++;
+ break;
+
+ case 'inactive':
+ if (query[i] == 'checked' || query[i] == 'true') inactive = true;
+ break;
case 'search_depth':
search_depth = function(a){return a;}(query[i]);
break;
- }
- }
- try {
- var results = [];
+ }
+ }
+ try {
+ var results = [];
- var params = [
+ var params = [
ses(),
search_hash,
typeof obj.search_limit != 'undefined' && typeof obj.search_limit != 'null' ? obj.search_limit : obj.result_cap + 1,
typeof obj.search_sort != 'undefined' ? obj.search_sort : [ 'family_name ASC', 'first_given_name ASC', 'second_given_name ASC', 'dob DESC' ]
];
- if (inactive) {
- params.push(1);
- if (document.getElementById('active')) {
- document.getElementById('active').setAttribute('hidden','false');
- document.getElementById('active').hidden = false;
- }
- } else {
+ if (inactive) {
+ params.push(1);
+ if (document.getElementById('active')) {
+ document.getElementById('active').setAttribute('hidden','false');
+ document.getElementById('active').hidden = false;
+ }
+ } else {
params.push(0);
}
params.push(search_depth);
- if (obj.search_term_count > 0) {
- //alert('search params = ' + obj.error.pretty_print( js2JSON( params ) ) );
- results = this.network.simple_request( 'FM_AU_IDS_RETRIEVE_VIA_HASH', params );
+ if (obj.search_term_count > 0) {
+ //alert('search params = ' + obj.error.pretty_print( js2JSON( params ) ) );
+ results = this.network.simple_request( 'FM_AU_IDS_RETRIEVE_VIA_HASH', params );
if ( results == null ) results = [];
- if (typeof results.ilsevent != 'undefined') throw(results);
- if (results.length == 0) {
- alert($("patronStrings").getString('staff.patron.search_result.search.no_patrons_found'));
- return;
- }
- if (results.length == typeof obj.search_limit != 'undefined' && typeof obj.search_limit != 'null' ? obj.search_limit : obj.result_cap+1) {
- results.pop();
- alert($("patronStrings").getFormattedString('staff.patron.search_result.search.capped_results', [typeof obj.search_limit != 'undefined' && typeof obj.search_limit != 'null' ? obj.search_limit : obj.result_cap]));
- }
- } else {
- alert($("patronStrings").getString('staff.patron.search_result.search.enter_search_terms'));
- return;
- }
+ if (typeof results.ilsevent != 'undefined') throw(results);
+ if (results.length == 0) {
+ alert($("patronStrings").getString('staff.patron.search_result.search.no_patrons_found'));
+ return;
+ }
+ if (results.length == typeof obj.search_limit != 'undefined' && typeof obj.search_limit != 'null' ? obj.search_limit : obj.result_cap+1) {
+ results.pop();
+ alert($("patronStrings").getFormattedString('staff.patron.search_result.search.capped_results', [typeof obj.search_limit != 'undefined' && typeof obj.search_limit != 'null' ? obj.search_limit : obj.result_cap]));
+ }
+ } else {
+ alert($("patronStrings").getString('staff.patron.search_result.search.enter_search_terms'));
+ return;
+ }
obj.list.clear();
- //this.list.append( { 'retrieve_id' : results[i], 'row' : {} } );
- var funcs = [];
-
- function gen_func(r) {
- return function() {
- obj.list.append( { 'retrieve_id' : r, 'row' : {}, 'to_bottom' : true, 'no_auto_select' : true } );
- }
- }
-
- for (var i = 0; i < results.length; i++) {
- funcs.push( gen_func(results[i]) );
- }
- JSAN.use('util.exec'); var exec = new util.exec(4);
- exec.chain( funcs );
-
- } catch(E) {
- this.error.standard_unexpected_error_alert('patron.search_result.search',E);
- }
- }
+ //this.list.append( { 'retrieve_id' : results[i], 'row' : {} } );
+ var funcs = [];
+
+ function gen_func(r) {
+ return function() {
+ obj.list.append( { 'retrieve_id' : r, 'row' : {}, 'to_bottom' : true, 'no_auto_select' : true } );
+ }
+ }
+
+ for (var i = 0; i < results.length; i++) {
+ funcs.push( gen_func(results[i]) );
+ }
+ JSAN.use('util.exec'); var exec = new util.exec(4);
+ exec.chain( funcs );
+
+ } catch(E) {
+ this.error.standard_unexpected_error_alert('patron.search_result.search',E);
+ }
+ }
}
diff --git a/Open-ILS/xul/staff_client/server/patron/standing_penalties.js b/Open-ILS/xul/staff_client/server/patron/standing_penalties.js
index 95ed7d5ba3..9534a1091f 100644
--- a/Open-ILS/xul/staff_client/server/patron/standing_penalties.js
+++ b/Open-ILS/xul/staff_client/server/patron/standing_penalties.js
@@ -18,7 +18,7 @@ function penalty_init() {
JSAN.errorLevel = "die"; // none, warn, or die
JSAN.addRepository('..');
- JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
+ JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
XML_HTTP_SERVER = data.server_unadorned;
JSAN.use('util.error'); error = new util.error();
diff --git a/Open-ILS/xul/staff_client/server/patron/summary.js b/Open-ILS/xul/staff_client/server/patron/summary.js
index 90a22f477f..b94f344fa9 100644
--- a/Open-ILS/xul/staff_client/server/patron/summary.js
+++ b/Open-ILS/xul/staff_client/server/patron/summary.js
@@ -6,103 +6,103 @@ var patronStrings = $('patronStrings');
if (typeof patron == 'undefined') patron = {};
patron.summary = function (params) {
- JSAN.use('util.error'); this.error = new util.error();
- JSAN.use('util.window'); this.window = new util.window();
- JSAN.use('util.network'); this.network = new util.network();
+ JSAN.use('util.error'); this.error = new util.error();
+ JSAN.use('util.window'); this.window = new util.window();
+ JSAN.use('util.network'); this.network = new util.network();
JSAN.use('util.widgets');
- this.w = window;
+ this.w = window;
}
patron.summary.prototype = {
- 'init' : function( params ) {
+ 'init' : function( params ) {
- var obj = this;
+ var obj = this;
- obj.barcode = params['barcode'];
- obj.id = params['id'];
- if (params['show_name']) {
- document.getElementById('patron_name').hidden = false;
- document.getElementById('patron_name').setAttribute('hidden','false');
- }
+ obj.barcode = params['barcode'];
+ obj.id = params['id'];
+ if (params['show_name']) {
+ document.getElementById('patron_name').hidden = false;
+ document.getElementById('patron_name').setAttribute('hidden','false');
+ }
- JSAN.use('OpenILS.data'); this.OpenILS = {};
- obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
+ JSAN.use('OpenILS.data'); this.OpenILS = {};
+ obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
var obscure_dob = String( obj.OpenILS.data.hash.aous['circ.obscure_dob'] ) == 'true';
- JSAN.use('util.controller'); obj.controller = new util.controller();
- obj.controller.init(
- {
- control_map : {
- 'cmd_broken' : [
- ['command'],
- function() { alert($("commonStrings").getString('common.unimplemented')); }
- ],
- 'patron_alert' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text( e, obj.patron.alert_message() || '' );
- if (obj.patron.alert_message()) {
- e.parentNode.hidden = false;
- } else {
- e.parentNode.hidden = true;
- }
- };
- }
- ],
- 'patron_usrname' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,obj.patron.usrname());
- };
- }
- ],
- 'patron_profile' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.OpenILS.data.hash.pgt[
- obj.patron.profile()
- ].name()
- );
- };
- }
- ],
- 'patron_net_access' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- patronStrings.getString('staff.patron.summary.patron_net_access') +
- ' ' + obj.OpenILS.data.hash.cnal[
- obj.patron.net_access_level()
- ].name()
- );
- };
- }
- ],
- 'patron_credit' : [
- ['render'],
- function(e) {
- return function() {
- JSAN.use('util.money');
- util.widgets.set_text(e,
- '$' +
- util.money.sanitize(
- obj.patron.credit_forward_balance()
- )
- );
- };
- }
- ],
- 'patron_bill' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,'...');
+ JSAN.use('util.controller'); obj.controller = new util.controller();
+ obj.controller.init(
+ {
+ control_map : {
+ 'cmd_broken' : [
+ ['command'],
+ function() { alert($("commonStrings").getString('common.unimplemented')); }
+ ],
+ 'patron_alert' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text( e, obj.patron.alert_message() || '' );
+ if (obj.patron.alert_message()) {
+ e.parentNode.hidden = false;
+ } else {
+ e.parentNode.hidden = true;
+ }
+ };
+ }
+ ],
+ 'patron_usrname' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,obj.patron.usrname());
+ };
+ }
+ ],
+ 'patron_profile' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.OpenILS.data.hash.pgt[
+ obj.patron.profile()
+ ].name()
+ );
+ };
+ }
+ ],
+ 'patron_net_access' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ patronStrings.getString('staff.patron.summary.patron_net_access') +
+ ' ' + obj.OpenILS.data.hash.cnal[
+ obj.patron.net_access_level()
+ ].name()
+ );
+ };
+ }
+ ],
+ 'patron_credit' : [
+ ['render'],
+ function(e) {
+ return function() {
+ JSAN.use('util.money');
+ util.widgets.set_text(e,
+ '$' +
+ util.money.sanitize(
+ obj.patron.credit_forward_balance()
+ )
+ );
+ };
+ }
+ ],
+ 'patron_bill' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,'...');
var under_btn;
if (xulG) {
if (xulG.display_window) {
@@ -110,10 +110,10 @@ patron.summary.prototype = {
if (under_btn) util.widgets.set_text(under_btn,'...');
}
}
- obj.network.simple_request(
- 'FM_MOUS_RETRIEVE.authoritative',
- [ ses(), obj.patron.id() ],
- function(req) {
+ obj.network.simple_request(
+ 'FM_MOUS_RETRIEVE.authoritative',
+ [ ses(), obj.patron.id() ],
+ function(req) {
try {
JSAN.use('util.money');
var robj = req.getResultObject();
@@ -138,21 +138,21 @@ patron.summary.prototype = {
} catch(E) {
alert('Error in summary.js, patron_bill callback: ' + E);
}
- }
- );
- };
- }
- ],
- 'patron_checkouts' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,'...');
- var e2 = document.getElementById( 'patron_overdue' ); if (e2) util.widgets.set_text(e2,'...');
- var e3 = document.getElementById( 'patron_claimed_returned' ); if (e3) util.widgets.set_text(e3,'...');
- var e4 = document.getElementById( 'patron_long_overdue' ); if (e4) util.widgets.set_text(e4,'...');
- var e5 = document.getElementById( 'patron_lost' ); if (e5) util.widgets.set_text(e5,'...');
- var e6 = document.getElementById( 'patron_noncat' ); if (e6) util.widgets.set_text(e6,'...');
+ }
+ );
+ };
+ }
+ ],
+ 'patron_checkouts' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,'...');
+ var e2 = document.getElementById( 'patron_overdue' ); if (e2) util.widgets.set_text(e2,'...');
+ var e3 = document.getElementById( 'patron_claimed_returned' ); if (e3) util.widgets.set_text(e3,'...');
+ var e4 = document.getElementById( 'patron_long_overdue' ); if (e4) util.widgets.set_text(e4,'...');
+ var e5 = document.getElementById( 'patron_lost' ); if (e5) util.widgets.set_text(e5,'...');
+ var e6 = document.getElementById( 'patron_noncat' ); if (e6) util.widgets.set_text(e6,'...');
var under_btn;
if (xulG) {
if (xulG.display_window) {
@@ -160,52 +160,52 @@ patron.summary.prototype = {
if (under_btn) util.widgets.set_text(under_btn,'...');
}
}
- obj.network.simple_request(
- 'FM_CIRC_COUNT_RETRIEVE_VIA_USER.authoritative',
- [ ses(), obj.patron.id() ],
- function(req) {
- try {
- var robj = req.getResultObject();
- util.widgets.set_text(e, robj.out + robj.overdue + robj.claims_returned + robj.long_overdue );
- if (e2) util.widgets.set_text(e2, robj.overdue );
- if (e3) util.widgets.set_text(e3, robj.claims_returned );
- if (e4) util.widgets.set_text(e4, robj.long_overdue );
- if (e5) util.widgets.set_text(e5, robj.lost );
+ obj.network.simple_request(
+ 'FM_CIRC_COUNT_RETRIEVE_VIA_USER.authoritative',
+ [ ses(), obj.patron.id() ],
+ function(req) {
+ try {
+ var robj = req.getResultObject();
+ util.widgets.set_text(e, robj.out + robj.overdue + robj.claims_returned + robj.long_overdue );
+ if (e2) util.widgets.set_text(e2, robj.overdue );
+ if (e3) util.widgets.set_text(e3, robj.claims_returned );
+ if (e4) util.widgets.set_text(e4, robj.long_overdue );
+ if (e5) util.widgets.set_text(e5, robj.lost );
if (under_btn) util.widgets.set_text(under_btn,
String( robj.out + robj.overdue + robj.claims_returned + robj.long_overdue) +
( robj.overdue > 0 ? '*' : '' )
);
- } catch(E) {
- alert(E);
- }
- }
- );
- obj.network.simple_request(
- 'FM_ANCC_RETRIEVE_VIA_USER.authoritative',
- [ ses(), obj.patron.id() ],
- function(req) {
- var robj = req.getResultObject();
- if (e6) util.widgets.set_text(e6,robj.length);
- }
- );
- };
- }
- ],
- 'patron_overdue' : [
- ['render'],
- function(e) {
- return function() {
- /* handled by 'patron_checkouts' */
- };
- }
- ],
- 'patron_holds' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,'...');
- var e2 = document.getElementById('patron_holds_available');
- if (e2) util.widgets.set_text(e2,'...');
+ } catch(E) {
+ alert(E);
+ }
+ }
+ );
+ obj.network.simple_request(
+ 'FM_ANCC_RETRIEVE_VIA_USER.authoritative',
+ [ ses(), obj.patron.id() ],
+ function(req) {
+ var robj = req.getResultObject();
+ if (e6) util.widgets.set_text(e6,robj.length);
+ }
+ );
+ };
+ }
+ ],
+ 'patron_overdue' : [
+ ['render'],
+ function(e) {
+ return function() {
+ /* handled by 'patron_checkouts' */
+ };
+ }
+ ],
+ 'patron_holds' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,'...');
+ var e2 = document.getElementById('patron_holds_available');
+ if (e2) util.widgets.set_text(e2,'...');
var under_btn;
if (xulG) {
if (xulG.display_window) {
@@ -213,109 +213,109 @@ patron.summary.prototype = {
if (under_btn) util.widgets.set_text(under_btn,'...');
}
}
- obj.network.simple_request(
- 'FM_AHR_COUNT_RETRIEVE.authoritative',
- [ ses(), obj.patron.id() ],
- function(req) {
+ obj.network.simple_request(
+ 'FM_AHR_COUNT_RETRIEVE.authoritative',
+ [ ses(), obj.patron.id() ],
+ function(req) {
var robj = req.getResultObject();
- util.widgets.set_text(e,
- robj.total
- );
- if (e2) util.widgets.set_text(e2,
- robj.ready
- );
+ util.widgets.set_text(e,
+ robj.total
+ );
+ if (e2) util.widgets.set_text(e2,
+ robj.ready
+ );
if (under_btn) util.widgets.set_text(under_btn, req.getResultObject().ready + '/' + req.getResultObject().total );
obj.holds_summary = robj;
if (obj.holds_summary && obj.bills_summary)
- if (typeof window.xulG == 'object' && typeof window.xulG.stop_sign_page == 'function')
+ if (typeof window.xulG == 'object' && typeof window.xulG.stop_sign_page == 'function')
window.xulG.stop_sign_page( obj.patron, { 'holds_summary' : obj.holds_summary, 'bills_summary' : obj.bills_summary } );
- }
- );
- };
- }
- ],
- 'patron_holds_available' : [
- ['render'],
- function(e) {
- return function() {
- /* handled by 'patron_holds' */
- };
- }
- ],
- 'patron_card' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.card().barcode()
- );
- };
- }
- ],
- 'patron_ident_type_1' : [
- ['render'],
- function(e) {
- return function() {
- var ident_string = '';
- var ident = obj.OpenILS.data.hash.cit[
- obj.patron.ident_type()
- ];
- if (ident) ident_string = ident.name()
- util.widgets.set_text(e,
- ident_string
- );
- };
- }
- ],
- 'patron_ident_value_1' : [
- ['render'],
- function(e) {
- return function() {
- var val = obj.patron.ident_value();
- val = val.replace(/.+(\d\d\d\d)$/,'xxxx$1');
- util.widgets.set_text(e, val);
- };
- }
- ],
- 'patron_ident_type_2' : [
- ['render'],
- function(e) {
- return function() {
- var ident_string = '';
- var ident = obj.OpenILS.data.hash.cit[
- obj.patron.ident_type2()
- ];
- if (ident) ident_string = ident.name()
- util.widgets.set_text(e,
- ident_string
- );
- };
- }
- ],
- 'patron_ident_value_2' : [
- ['render'],
- function(e) {
- return function() {
- var val = obj.patron.ident_value2();
- val = val.replace(/.+(\d\d\d\d)$/,'xxxx$1');
- util.widgets.set_text(e, val);
- };
- }
- ],
- 'patron_date_of_exp' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- patronStrings.getString('staff.patron.summary.expires_on') + ' ' + (
- obj.patron.expire_date() ?
- obj.patron.expire_date().substr(0,10) :
- patronStrings.getString('staff.patron.field.unset')
- )
- );
- };
- }
- ],
+ }
+ );
+ };
+ }
+ ],
+ 'patron_holds_available' : [
+ ['render'],
+ function(e) {
+ return function() {
+ /* handled by 'patron_holds' */
+ };
+ }
+ ],
+ 'patron_card' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.patron.card().barcode()
+ );
+ };
+ }
+ ],
+ 'patron_ident_type_1' : [
+ ['render'],
+ function(e) {
+ return function() {
+ var ident_string = '';
+ var ident = obj.OpenILS.data.hash.cit[
+ obj.patron.ident_type()
+ ];
+ if (ident) ident_string = ident.name()
+ util.widgets.set_text(e,
+ ident_string
+ );
+ };
+ }
+ ],
+ 'patron_ident_value_1' : [
+ ['render'],
+ function(e) {
+ return function() {
+ var val = obj.patron.ident_value();
+ val = val.replace(/.+(\d\d\d\d)$/,'xxxx$1');
+ util.widgets.set_text(e, val);
+ };
+ }
+ ],
+ 'patron_ident_type_2' : [
+ ['render'],
+ function(e) {
+ return function() {
+ var ident_string = '';
+ var ident = obj.OpenILS.data.hash.cit[
+ obj.patron.ident_type2()
+ ];
+ if (ident) ident_string = ident.name()
+ util.widgets.set_text(e,
+ ident_string
+ );
+ };
+ }
+ ],
+ 'patron_ident_value_2' : [
+ ['render'],
+ function(e) {
+ return function() {
+ var val = obj.patron.ident_value2();
+ val = val.replace(/.+(\d\d\d\d)$/,'xxxx$1');
+ util.widgets.set_text(e, val);
+ };
+ }
+ ],
+ 'patron_date_of_exp' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ patronStrings.getString('staff.patron.summary.expires_on') + ' ' + (
+ obj.patron.expire_date() ?
+ obj.patron.expire_date().substr(0,10) :
+ patronStrings.getString('staff.patron.field.unset')
+ )
+ );
+ };
+ }
+ ],
'patron_hold_alias' : [
['render'],
function(e) {
@@ -326,10 +326,10 @@ patron.summary.prototype = {
}
}
],
- 'patron_date_of_birth' : [
- ['render'],
- function(e) {
- return function() {
+ 'patron_date_of_birth' : [
+ ['render'],
+ function(e) {
+ return function() {
var hide_value = e.getAttribute('hide_value');
if ( obscure_dob && hide_value == 'true' ) {
e.setAttribute( 'hidden_value',
@@ -368,372 +368,372 @@ patron.summary.prototype = {
}
}
}
- };
- }
- ],
- 'patron_day_phone' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.day_phone()
- );
- };
- }
- ],
- 'patron_evening_phone' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.evening_phone()
- );
- };
- }
- ],
- 'patron_other_phone' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.other_phone()
- );
- };
- }
- ],
- 'patron_email' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.email()
- );
- };
- }
- ],
- 'patron_alias' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.alias()
- );
- };
- }
- ],
- 'patron_photo_url' : [
- ['render'],
- function(e) {
- return function() {
- e.setAttribute('src',
- obj.patron.photo_url()
- );
- };
- }
- ],
- 'patron_library' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.OpenILS.data.hash.aou[
- obj.patron.home_ou()
- ].shortname()
- );
- e.setAttribute('tooltiptext',
- obj.OpenILS.data.hash.aou[
- obj.patron.home_ou()
- ].name()
- );
- };
- }
- ],
- 'patron_last_library' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.OpenILS.data.hash.aou[
- obj.patron.home_ou()
- ].shortname()
- );
- e.setAttribute('tooltiptext',
- obj.OpenILS.data.hash.aou[
- obj.patron.home_ou()
- ].name()
- );
- };
- }
- ],
- 'patron_mailing_address_street1' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.mailing_address().street1()
- );
- if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
- };
- }
- ],
- 'patron_mailing_address_street2' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.mailing_address().street2()
- );
- if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
- };
- }
- ],
- 'patron_mailing_address_city' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.mailing_address().city()
- );
- if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
- };
- }
- ],
- 'patron_mailing_address_state' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.mailing_address().state()
- );
- if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
- };
- }
- ],
- 'patron_mailing_address_post_code' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.mailing_address().post_code()
- );
- if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
- };
- }
- ],
- 'patron_physical_address_street1' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.billing_address().street1()
- );
- if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
- };
- }
- ],
- 'patron_physical_address_street2' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.billing_address().street2()
- );
- if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
- };
- }
- ],
- 'patron_physical_address_city' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.billing_address().city()
- );
- if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
- };
- }
- ],
- 'patron_physical_address_state' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.billing_address().state()
- );
- if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
- };
- }
- ],
- 'patron_physical_address_post_code' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.billing_address().post_code()
- );
- if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
- };
- }
- ]
- }
- }
- );
-
- obj.retrieve();
-
- try {
- var caption = document.getElementById("PatronSummaryContact_caption");
- var arrow = document.getAnonymousNodes(caption)[0];
- var gb_content = document.getAnonymousNodes(caption.parentNode)[1];
- arrow.addEventListener(
- 'click',
- function() {
- setTimeout(
- function() {
- //alert('setting shrink_state to ' + gb_content.hidden);
- //caption.setAttribute('shrink_state',gb_content.hidden);
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- JSAN.use('util.file'); var file = new util.file('patron_id_shrink');
- file.set_object(String(gb_content.hidden)); file.close();
- }, 0
- );
- }, false
- );
- //var shrink_state = caption.getAttribute('shrink_state');
- var shrink_state = false;
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- JSAN.use('util.file'); var file = new util.file('patron_id_shrink');
- if (file._file.exists()) {
- shrink_state = file.get_object(); file.close();
- }
- //alert('shrink_state retrieved as ' + shrink_state);
- if (shrink_state != 'false' && shrink_state) {
- //alert('clicking the widget');
- util.widgets.click( arrow );
- }
- } catch(E) {
- obj.error.sdump('D_ERROR','with shrink_state in summary.js: ' + E);
- }
- },
-
- 'retrieve' : function() {
-
- try {
-
- var obj = this;
-
- var chain = [];
-
- // Retrieve the patron
- function blah_retrieve() {
- try {
- var robj;
- if (obj.barcode && obj.barcode != 'null') {
- robj = obj.network.simple_request(
- 'FM_AU_RETRIEVE_VIA_BARCODE.authoritative',
- [ ses(), obj.barcode ]
- );
- } else if (obj.id && obj.id != 'null') {
- robj = obj.network.simple_request(
- 'FM_AU_FLESHED_RETRIEVE_VIA_ID',
- [ ses(), obj.id ]
- );
- } else {
- throw(patronStrings.getString('staff.patron.summary.retrieve.no_barcode'));
- }
- if (robj) {
-
- if (instanceOf(robj,au)) {
-
- obj.patron = robj;
- JSAN.use('patron.util');
- util.widgets.set_text('patron_name',
+ };
+ }
+ ],
+ 'patron_day_phone' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.patron.day_phone()
+ );
+ };
+ }
+ ],
+ 'patron_evening_phone' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.patron.evening_phone()
+ );
+ };
+ }
+ ],
+ 'patron_other_phone' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.patron.other_phone()
+ );
+ };
+ }
+ ],
+ 'patron_email' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.patron.email()
+ );
+ };
+ }
+ ],
+ 'patron_alias' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.patron.alias()
+ );
+ };
+ }
+ ],
+ 'patron_photo_url' : [
+ ['render'],
+ function(e) {
+ return function() {
+ e.setAttribute('src',
+ obj.patron.photo_url()
+ );
+ };
+ }
+ ],
+ 'patron_library' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.OpenILS.data.hash.aou[
+ obj.patron.home_ou()
+ ].shortname()
+ );
+ e.setAttribute('tooltiptext',
+ obj.OpenILS.data.hash.aou[
+ obj.patron.home_ou()
+ ].name()
+ );
+ };
+ }
+ ],
+ 'patron_last_library' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.OpenILS.data.hash.aou[
+ obj.patron.home_ou()
+ ].shortname()
+ );
+ e.setAttribute('tooltiptext',
+ obj.OpenILS.data.hash.aou[
+ obj.patron.home_ou()
+ ].name()
+ );
+ };
+ }
+ ],
+ 'patron_mailing_address_street1' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.patron.mailing_address().street1()
+ );
+ if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
+ };
+ }
+ ],
+ 'patron_mailing_address_street2' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.patron.mailing_address().street2()
+ );
+ if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
+ };
+ }
+ ],
+ 'patron_mailing_address_city' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.patron.mailing_address().city()
+ );
+ if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
+ };
+ }
+ ],
+ 'patron_mailing_address_state' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.patron.mailing_address().state()
+ );
+ if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
+ };
+ }
+ ],
+ 'patron_mailing_address_post_code' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.patron.mailing_address().post_code()
+ );
+ if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
+ };
+ }
+ ],
+ 'patron_physical_address_street1' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.patron.billing_address().street1()
+ );
+ if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
+ };
+ }
+ ],
+ 'patron_physical_address_street2' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.patron.billing_address().street2()
+ );
+ if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
+ };
+ }
+ ],
+ 'patron_physical_address_city' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.patron.billing_address().city()
+ );
+ if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
+ };
+ }
+ ],
+ 'patron_physical_address_state' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.patron.billing_address().state()
+ );
+ if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
+ };
+ }
+ ],
+ 'patron_physical_address_post_code' : [
+ ['render'],
+ function(e) {
+ return function() {
+ util.widgets.set_text(e,
+ obj.patron.billing_address().post_code()
+ );
+ if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
+ };
+ }
+ ]
+ }
+ }
+ );
+
+ obj.retrieve();
+
+ try {
+ var caption = document.getElementById("PatronSummaryContact_caption");
+ var arrow = document.getAnonymousNodes(caption)[0];
+ var gb_content = document.getAnonymousNodes(caption.parentNode)[1];
+ arrow.addEventListener(
+ 'click',
+ function() {
+ setTimeout(
+ function() {
+ //alert('setting shrink_state to ' + gb_content.hidden);
+ //caption.setAttribute('shrink_state',gb_content.hidden);
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+ JSAN.use('util.file'); var file = new util.file('patron_id_shrink');
+ file.set_object(String(gb_content.hidden)); file.close();
+ }, 0
+ );
+ }, false
+ );
+ //var shrink_state = caption.getAttribute('shrink_state');
+ var shrink_state = false;
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+ JSAN.use('util.file'); var file = new util.file('patron_id_shrink');
+ if (file._file.exists()) {
+ shrink_state = file.get_object(); file.close();
+ }
+ //alert('shrink_state retrieved as ' + shrink_state);
+ if (shrink_state != 'false' && shrink_state) {
+ //alert('clicking the widget');
+ util.widgets.click( arrow );
+ }
+ } catch(E) {
+ obj.error.sdump('D_ERROR','with shrink_state in summary.js: ' + E);
+ }
+ },
+
+ 'retrieve' : function() {
+
+ try {
+
+ var obj = this;
+
+ var chain = [];
+
+ // Retrieve the patron
+ function blah_retrieve() {
+ try {
+ var robj;
+ if (obj.barcode && obj.barcode != 'null') {
+ robj = obj.network.simple_request(
+ 'FM_AU_RETRIEVE_VIA_BARCODE.authoritative',
+ [ ses(), obj.barcode ]
+ );
+ } else if (obj.id && obj.id != 'null') {
+ robj = obj.network.simple_request(
+ 'FM_AU_FLESHED_RETRIEVE_VIA_ID',
+ [ ses(), obj.id ]
+ );
+ } else {
+ throw(patronStrings.getString('staff.patron.summary.retrieve.no_barcode'));
+ }
+ if (robj) {
+
+ if (instanceOf(robj,au)) {
+
+ obj.patron = robj;
+ JSAN.use('patron.util');
+ util.widgets.set_text('patron_name',
patron.util.format_name( obj.patron )
- );
- patron.util.set_penalty_css(obj.patron);
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
- data.last_patron = obj.patron.id(); data.stash('last_patron');
-
- } else {
-
- throw(robj);
-
- }
- } else {
-
- throw(robj);
-
- }
-
- } catch(E) {
- throw(E);
- }
- };
- blah_retrieve();
-
- /*
- // Retrieve the survey responses for required surveys
- chain.push(
- function() {
- try {
- var surveys = obj.OpenILS.data.list.my_asv;
- var survey_responses = {};
- for (var i = 0; i < surveys.length; i++) {
- var s = obj.network.request(
- api.FM_ASVR_RETRIEVE.app,
- api.FM_ASVR_RETRIEVE.method,
- [ ses(), surveys[i].id(), obj.patron.id() ]
- );
- survey_responses[ surveys[i].id() ] = s;
- }
- obj.patron.survey_responses( survey_responses );
- } catch(E) {
- var error = ('patron.summary.retrieve : ' + js2JSON(E));
- obj.error.sdump('D_ERROR',error);
- throw(error);
- }
- }
- );
- */
-
- // Update the screen
- chain.push( function() { obj.controller.render(); } );
-
- // On Complete
-
- chain.push( function() {
-
- if (typeof window.xulG == 'object' && typeof window.xulG.on_finished == 'function') {
- obj.error.sdump('D_PATRON_SUMMARY',
- 'patron.summary: Calling external .on_finished()\n');
- window.xulG.on_finished(obj.patron);
- } else {
- obj.error.sdump('D_PATRON_SUMMARY','patron.summary: No external .on_finished()\n');
- }
-
- } );
-
- // Do it
- JSAN.use('util.exec'); obj.exec = new util.exec();
- obj.exec.on_error = function(E) {
-
- if (typeof window.xulG == 'object' && typeof window.xulG.on_error == 'function') {
- window.xulG.on_error(E);
- } else {
- alert(js2JSON(E));
- }
-
- }
- this.exec.chain( chain );
-
- } catch(E) {
- if (typeof window.xulG == 'object' && typeof window.xulG.on_error == 'function') {
- window.xulG.on_error(E);
- } else {
- alert(js2JSON(E));
- }
- }
- }
+ );
+ patron.util.set_penalty_css(obj.patron);
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+ data.last_patron = obj.patron.id(); data.stash('last_patron');
+
+ } else {
+
+ throw(robj);
+
+ }
+ } else {
+
+ throw(robj);
+
+ }
+
+ } catch(E) {
+ throw(E);
+ }
+ };
+ blah_retrieve();
+
+ /*
+ // Retrieve the survey responses for required surveys
+ chain.push(
+ function() {
+ try {
+ var surveys = obj.OpenILS.data.list.my_asv;
+ var survey_responses = {};
+ for (var i = 0; i < surveys.length; i++) {
+ var s = obj.network.request(
+ api.FM_ASVR_RETRIEVE.app,
+ api.FM_ASVR_RETRIEVE.method,
+ [ ses(), surveys[i].id(), obj.patron.id() ]
+ );
+ survey_responses[ surveys[i].id() ] = s;
+ }
+ obj.patron.survey_responses( survey_responses );
+ } catch(E) {
+ var error = ('patron.summary.retrieve : ' + js2JSON(E));
+ obj.error.sdump('D_ERROR',error);
+ throw(error);
+ }
+ }
+ );
+ */
+
+ // Update the screen
+ chain.push( function() { obj.controller.render(); } );
+
+ // On Complete
+
+ chain.push( function() {
+
+ if (typeof window.xulG == 'object' && typeof window.xulG.on_finished == 'function') {
+ obj.error.sdump('D_PATRON_SUMMARY',
+ 'patron.summary: Calling external .on_finished()\n');
+ window.xulG.on_finished(obj.patron);
+ } else {
+ obj.error.sdump('D_PATRON_SUMMARY','patron.summary: No external .on_finished()\n');
+ }
+
+ } );
+
+ // Do it
+ JSAN.use('util.exec'); obj.exec = new util.exec();
+ obj.exec.on_error = function(E) {
+
+ if (typeof window.xulG == 'object' && typeof window.xulG.on_error == 'function') {
+ window.xulG.on_error(E);
+ } else {
+ alert(js2JSON(E));
+ }
+
+ }
+ this.exec.chain( chain );
+
+ } catch(E) {
+ if (typeof window.xulG == 'object' && typeof window.xulG.on_error == 'function') {
+ window.xulG.on_error(E);
+ } else {
+ alert(js2JSON(E));
+ }
+ }
+ }
}
dump('exiting patron.summary.js\n');
diff --git a/Open-ILS/xul/staff_client/server/patron/ue.js b/Open-ILS/xul/staff_client/server/patron/ue.js
index 6d8306409f..793f5be0b6 100644
--- a/Open-ILS/xul/staff_client/server/patron/ue.js
+++ b/Open-ILS/xul/staff_client/server/patron/ue.js
@@ -1,17 +1,17 @@
-var cgi = null;
-var clone = false;
-var patron = null;
-var counter = 0;
-var identTypesCache = {};
-var statCatsCache = {};
-var surveysCache = {};
-var surveyQuestionsCache = {};
-var surveyAnswersCache = {};
-var userCache = {};
-var groupsCache = {};
-var netLevelsCache = {};
+var cgi = null;
+var clone = false;
+var patron = null;
+var counter = 0;
+var identTypesCache = {};
+var statCatsCache = {};
+var surveysCache = {};
+var surveyQuestionsCache = {};
+var surveyAnswersCache = {};
+var userCache = {};
+var groupsCache = {};
+var netLevelsCache = {};
var orgSettings = [];
-//var guardianNote = null;
+//var guardianNote = null;
var uEditUsePhonePw = false;
if(!window.xulG) var xulG = null;
@@ -21,22 +21,22 @@ function $(id) { return document.getElementById(id); }
/* fetch the necessary data to start off */
function uEditInit() {
- _debug('uEditInit(): ' + location.search);
+ _debug('uEditInit(): ' + location.search);
- cgi = new CGI();
- session = cgi.param('ses');
- if (xulG) if (xulG.ses) session = xulG.ses;
- if (xulG) if (xulG.params) if (xulG.params.ses) session = xulG.params.ses;
- clone = cgi.param('clone');
- if (xulG) if (xulG.clone) clone = xulG.clone;
- if (xulG) if (xulG.params) if (xulG.params.clone) clone = xulG.params.clone;
- if(!session) throw $("patronStrings").getString('web.staff.patron.ue.session_no_defined');
+ cgi = new CGI();
+ session = cgi.param('ses');
+ if (xulG) if (xulG.ses) session = xulG.ses;
+ if (xulG) if (xulG.params) if (xulG.params.ses) session = xulG.params.ses;
+ clone = cgi.param('clone');
+ if (xulG) if (xulG.clone) clone = xulG.clone;
+ if (xulG) if (xulG.params) if (xulG.params.clone) clone = xulG.params.clone;
+ if(!session) throw $("patronStrings").getString('web.staff.patron.ue.session_no_defined');
- fetchUser(session);
- $('uedit_user').appendChild(text(USER.usrname()));
+ fetchUser(session);
+ $('uedit_user').appendChild(text(USER.usrname()));
- setTimeout( function() {
- uEditBuild(); uEditShowPage('uedit_userid'); }, 20 );
+ setTimeout( function() {
+ uEditBuild(); uEditShowPage('uedit_userid'); }, 20 );
}
function uEditSetUnload() {
@@ -59,53 +59,53 @@ function uEditClearUnload() {
/* Fetch code
/* ------------------------------------------------------------------------------ */
function uEditFetchIdentTypes() {
- _debug("uEditFetchIdentTypes()");
- var s = fetchXULStash();
- if (typeof s.list != 'undefined')
- if (typeof s.list.cit != 'undefined') return s.list.cit;
- var req = new Request(FETCH_ID_TYPES);
- req.send(true);
- return req.result();
+ _debug("uEditFetchIdentTypes()");
+ var s = fetchXULStash();
+ if (typeof s.list != 'undefined')
+ if (typeof s.list.cit != 'undefined') return s.list.cit;
+ var req = new Request(FETCH_ID_TYPES);
+ req.send(true);
+ return req.result();
}
function uEditFetchStatCats() {
- _debug("uEditFetchStatCats()");
- var s = fetchXULStash();
- if (typeof s.list != 'undefined')
- if (typeof s.list.my_actsc != 'undefined') return s.list.my_actsc;
- var req = new Request(SC_FETCH_ALL, SESSION);
- req.send(true);
- return req.result();
+ _debug("uEditFetchStatCats()");
+ var s = fetchXULStash();
+ if (typeof s.list != 'undefined')
+ if (typeof s.list.my_actsc != 'undefined') return s.list.my_actsc;
+ var req = new Request(SC_FETCH_ALL, SESSION);
+ req.send(true);
+ return req.result();
}
function uEditFetchSurveys() {
- _debug("uEditFetchSurveys()");
- var s = fetchXULStash();
- if (typeof s.list != 'undefined')
- if (typeof s.list.asv != 'undefined') return s.list.asv;
- var req = new Request(SV_FETCH_ALL, SESSION);
- req.send(true);
- return req.result();
+ _debug("uEditFetchSurveys()");
+ var s = fetchXULStash();
+ if (typeof s.list != 'undefined')
+ if (typeof s.list.asv != 'undefined') return s.list.asv;
+ var req = new Request(SV_FETCH_ALL, SESSION);
+ req.send(true);
+ return req.result();
}
function uEditFetchGroups() {
- _debug("uEditFetchGroups()");
- var s = fetchXULStash();
- if (typeof s.tree != 'undefined')
- if (typeof s.tree.pgt != 'undefined') return s.tree.pgt;
- var req = new Request(FETCH_GROUPS);
- req.send(true);
- return req.result();
+ _debug("uEditFetchGroups()");
+ var s = fetchXULStash();
+ if (typeof s.tree != 'undefined')
+ if (typeof s.tree.pgt != 'undefined') return s.tree.pgt;
+ var req = new Request(FETCH_GROUPS);
+ req.send(true);
+ return req.result();
}
function uEditFetchNetLevels() {
- _debug("uEditFetchNetLevels()");
- var s = fetchXULStash();
- if (typeof s.list != 'undefined')
- if (typeof s.list.cnal != 'undefined') return s.list.cnal;
- var req = new Request(FETCH_NET_LEVELS, SESSION);
- req.send(true);
- return req.result();
+ _debug("uEditFetchNetLevels()");
+ var s = fetchXULStash();
+ if (typeof s.list != 'undefined')
+ if (typeof s.list.cnal != 'undefined') return s.list.cnal;
+ var req = new Request(FETCH_NET_LEVELS, SESSION);
+ req.send(true);
+ return req.result();
}
/* ------------------------------------------------------------------------------ */
@@ -116,8 +116,8 @@ function uEditFetchNetLevels() {
* provided by descending through the group tree
*/
function buildAppPermList(list, group) {
- if(!group) return;
- if(group.application_perm() )
+ if(!group) return;
+ if(group.application_perm() )
list.push(group.application_perm());
for(i in group.children()) {
buildAppPermList(list, group.children()[i]);
@@ -141,12 +141,12 @@ function uEditBuild() {
perms.push(myPerms[p]);
myPerms = perms;
- fetchHighestPermOrgs( SESSION, USER.id(), myPerms );
+ fetchHighestPermOrgs( SESSION, USER.id(), myPerms );
- uEditBuildLibSelector();
- var usr = cgi.param('usr');
- if (xulG) if (xulG.usr) usr = xulG.usr;
- if (xulG) if (xulG.params) if (xulG.params.usr) usr = xulG.params.usr;
+ uEditBuildLibSelector();
+ var usr = cgi.param('usr');
+ if (xulG) if (xulG.usr) usr = xulG.usr;
+ if (xulG) if (xulG.params) if (xulG.params.usr) usr = xulG.params.usr;
orgSettings = fetchBatchOrgSetting(USER.ws_ou(), [
'global.juvenile_age_threshold',
@@ -156,37 +156,37 @@ function uEditBuild() {
uEditUsePhonePw = (orgSettings['patron.password.use_phone'] &&
orgSettings['patron.password.use_phone'].value);
- patron = fetchFleshedUser(usr);
- if(!patron) patron = uEditNewPatron();
-
- uEditDraw(
- uEditFetchIdentTypes(),
+ patron = fetchFleshedUser(usr);
+ if(!patron) patron = uEditNewPatron();
+
+ uEditDraw(
+ uEditFetchIdentTypes(),
groups,
- uEditFetchStatCats(),
- uEditFetchSurveys(),
- uEditFetchNetLevels()
- );
+ uEditFetchStatCats(),
+ uEditFetchSurveys(),
+ uEditFetchNetLevels()
+ );
- if(patron.isnew()) {
- if(clone) uEditClone(clone);
- else uEditCreateNewAddr();
+ if(patron.isnew()) {
+ if(clone) uEditClone(clone);
+ else uEditCreateNewAddr();
- } else {
+ } else {
- /* do we need to display the parent / gurdian field? */
- uEditCheckDOB(uEditFindFieldByKey('dob'));
+ /* do we need to display the parent / gurdian field? */
+ uEditCheckDOB(uEditFindFieldByKey('dob'));
- $('ue_barcode').disabled = true;
- unHideMe($('ue_mark_card_lost'));
- unHideMe($('ue_reset_pw'));
- uEditCheckEditPerm();
- }
+ $('ue_barcode').disabled = true;
+ unHideMe($('ue_mark_card_lost'));
+ unHideMe($('ue_reset_pw'));
+ uEditCheckEditPerm();
+ }
uEditCheckBarredPerm();
}
function uEditCheckBarredPerm() {
- if(PERMS['BAR_PATRON'] != -1)
+ if(PERMS['BAR_PATRON'] != -1)
return;
if(isTrue(patron.barred()) && PERMS['UNBAR_PATRON'] != -1)
@@ -197,76 +197,76 @@ function uEditCheckBarredPerm() {
/* if this user does not have permission to put users into
- the edited users group, they do not have permission to
- edit this user */
+ the edited users group, they do not have permission to
+ edit this user */
function uEditCheckEditPerm() {
- var perm = uEditFindGroupPerm(groupsCache[patron.profile()]);
- /*
- _debug("editing user with group app perm "+patron.profile()+' : '+
- groupsCache[patron.profile()].name() +', and perm = ' + perm);
- */
-
- if(PERMS[perm] != -1) return;
-
- /* we can edit our own account, but not others in our group */
- if( patron.id() != USER.id() ){
- _debug("we are not allowed to edit this user");
-
- $('ue_save').disabled = true;
- $('ue_save_clone').disabled = true;
- $('ue_mark_card_lost').disabled = true;
- $('ue_reset_pw').disabled = true;
-
- uEditIterateFields(
- function(f) {
- if( f && f.widget && f.widget.node )
- f.widget.node.disabled = true;
- }
- );
+ var perm = uEditFindGroupPerm(groupsCache[patron.profile()]);
+ /*
+ _debug("editing user with group app perm "+patron.profile()+' : '+
+ groupsCache[patron.profile()].name() +', and perm = ' + perm);
+ */
+
+ if(PERMS[perm] != -1) return;
+
+ /* we can edit our own account, but not others in our group */
+ if( patron.id() != USER.id() ){
+ _debug("we are not allowed to edit this user");
+
+ $('ue_save').disabled = true;
+ $('ue_save_clone').disabled = true;
+ $('ue_mark_card_lost').disabled = true;
+ $('ue_reset_pw').disabled = true;
+
+ uEditIterateFields(
+ function(f) {
+ if( f && f.widget && f.widget.node )
+ f.widget.node.disabled = true;
+ }
+ );
- }
+ }
- var node = $('ue_profile').parentNode;
- node.removeChild($('ue_profile'));
- node.appendChild(elem('span',null,groupsCache[patron.profile()].name()));
+ var node = $('ue_profile').parentNode;
+ node.removeChild($('ue_profile'));
+ node.appendChild(elem('span',null,groupsCache[patron.profile()].name()));
- var field = uEditFindFieldByKey('profile');
- field.required = false;
- removeCSSClass(field.widget.node, CSS_INVALID_DATA);
- uEditCheckErrors();
+ var field = uEditFindFieldByKey('profile');
+ field.required = false;
+ removeCSSClass(field.widget.node, CSS_INVALID_DATA);
+ uEditCheckErrors();
}
/* creates a new patron object with card attached */
var uEditCardVirtId = -1;
function uEditNewPatron() {
- var patron = new au();
- patron.isnew(1);
- patron.id(-1);
- card = new ac();
- card.id(uEditCardVirtId--);
- card.isnew(1);
- patron.card(card);
- patron.cards([card]);
+ var patron = new au();
+ patron.isnew(1);
+ patron.id(-1);
+ card = new ac();
+ card.id(uEditCardVirtId--);
+ card.isnew(1);
+ patron.card(card);
+ patron.cards([card]);
patron.net_access_level(defaultNetLevel);
- patron.stat_cat_entries([]);
- patron.survey_responses([]);
- patron.addresses([]);
- patron.home_ou(USER.ws_ou());
- uEditMakeRandomPw(patron);
- return patron;
+ patron.stat_cat_entries([]);
+ patron.survey_responses([]);
+ patron.addresses([]);
+ patron.home_ou(USER.ws_ou());
+ uEditMakeRandomPw(patron);
+ return patron;
}
function uEditMakeRandomPw(patron) {
if(uEditUsePhonePw) return;
- var rand = Math.random();
- rand = parseInt(rand * 10000) + '';
- while(rand.length < 4) rand += '0';
- appendClear($('ue_password_plain'),text(rand));
- unHideMe($('ue_password_gen'));
- patron.passwd(rand);
- return rand;
+ var rand = Math.random();
+ rand = parseInt(rand * 10000) + '';
+ while(rand.length < 4) rand += '0';
+ appendClear($('ue_password_plain'),text(rand));
+ unHideMe($('ue_password_gen'));
+ patron.passwd(rand);
+ return rand;
}
function uEditMakePhonePw() {
@@ -275,328 +275,328 @@ function uEditMakePhonePw() {
(pw = patron.evening_phone()) || (pw = patron.other_phone()) ) {
pw = pw.substring(pw.length - 4); // this is iffy
uEditResetPw(pw);
- appendClear($('ue_password_plain'), text(pw));
- unHideMe($('ue_password_gen'));
- patron.passwd(pw);
+ appendClear($('ue_password_plain'), text(pw));
+ unHideMe($('ue_password_gen'));
+ patron.passwd(pw);
}
}
function uEditResetPw(pw) {
- if(!pw) pw = uEditMakeRandomPw(patron);
- $('ue_password1').value = pw;
- $('ue_password2').value = pw;
+ if(!pw) pw = uEditMakeRandomPw(patron);
+ $('ue_password1').value = pw;
+ $('ue_password2').value = pw;
$('ue_password1').onchange();
}
function uEditClone(clone) {
- var cloneUser = fetchFleshedUser(clone);
- patron.usrgroup(cloneUser.usrgroup());
+ var cloneUser = fetchFleshedUser(clone);
+ patron.usrgroup(cloneUser.usrgroup());
- if( cloneUser.day_phone() ) {
- $('ue_day_phone').value = cloneUser.day_phone();
- $('ue_day_phone').onchange();
+ if( cloneUser.day_phone() ) {
+ $('ue_day_phone').value = cloneUser.day_phone();
+ $('ue_day_phone').onchange();
}
- if( cloneUser.evening_phone() ) {
- $('ue_night_phone').value = cloneUser.evening_phone();
- $('ue_night_phone').onchange();
+ if( cloneUser.evening_phone() ) {
+ $('ue_night_phone').value = cloneUser.evening_phone();
+ $('ue_night_phone').onchange();
}
- if( cloneUser.other_phone() ) {
- $('ue_other_phone').value = cloneUser.other_phone();
- $('ue_other_phone').onchange();
+ if( cloneUser.other_phone() ) {
+ $('ue_other_phone').value = cloneUser.other_phone();
+ $('ue_other_phone').onchange();
}
- setSelector($('ue_org_selector'), cloneUser.home_ou());
- setSelector($('ue_profile'), cloneUser.profile());
-
- /* force the expire date to be set */
- $('ue_profile').onchange();
- $('ue_org_selector').onchange();
-
- for( var a in cloneUser.addresses() ) {
- var addr = cloneUser.addresses()[a];
- if( cloneUser.mailing_address &&
- addr.id() == cloneUser.mailing_address().id() )
- patron.mailing_address(addr);
- if( cloneUser.billing_address() &&
- addr.id() == cloneUser.billing_address().id() )
- patron.billing_address(addr);
- patron.addresses().push(addr);
- }
+ setSelector($('ue_org_selector'), cloneUser.home_ou());
+ setSelector($('ue_profile'), cloneUser.profile());
+
+ /* force the expire date to be set */
+ $('ue_profile').onchange();
+ $('ue_org_selector').onchange();
+
+ for( var a in cloneUser.addresses() ) {
+ var addr = cloneUser.addresses()[a];
+ if( cloneUser.mailing_address &&
+ addr.id() == cloneUser.mailing_address().id() )
+ patron.mailing_address(addr);
+ if( cloneUser.billing_address() &&
+ addr.id() == cloneUser.billing_address().id() )
+ patron.billing_address(addr);
+ patron.addresses().push(addr);
+ }
- uEditBuildAddrs(patron);
+ uEditBuildAddrs(patron);
}
/* Creates a new blank address,
- adds it to the user and the fields array */
+ adds it to the user and the fields array */
var uEditVirtualAddrId = -1;
function uEditCreateNewAddr() {
- var addr = new aua();
+ var addr = new aua();
- addr.id(uEditVirtualAddrId--);
- addr.isnew(1);
- addr.usr(patron.id());
- addr.country(defaultCountry);
+ addr.id(uEditVirtualAddrId--);
+ addr.isnew(1);
+ addr.usr(patron.id());
+ addr.country(defaultCountry);
- if(!patron.addresses())
- patron.addresses([]);
+ if(!patron.addresses())
+ patron.addresses([]);
- if(patron.addresses().length == 0) {
- patron.mailing_address(addr);
- patron.billing_address(addr);
- }
+ if(patron.addresses().length == 0) {
+ patron.mailing_address(addr);
+ patron.billing_address(addr);
+ }
- addr.valid(1);
- addr.within_city_limits(1);
+ addr.valid(1);
+ addr.within_city_limits(1);
- uEditBuildAddrFields(patron, addr);
- patron.addresses().push(addr);
- uEditIterateFields(function(f) { uEditCheckValid(f); });
- uEditCheckErrors();
+ uEditBuildAddrFields(patron, addr);
+ patron.addresses().push(addr);
+ uEditIterateFields(function(f) { uEditCheckValid(f); });
+ uEditCheckErrors();
}
/* kicks off the UI drawing */
function uEditDraw(identTypes, groups, statCats, surveys, netLevels ) {
- hideMe($('uedit_loading'));
- unHideMe($('ue_maintd'));
+ hideMe($('uedit_loading'));
+ unHideMe($('ue_maintd'));
- dataFields = [];
- uEditDrawIDTypes(identTypes);
- uEditDrawGroups(groups, null, null, true);
- uEditDrawStatCats(statCats);
- uEditDrawSurveys(surveys);
- uEditDrawNetLevels(netLevels);
- uEditDefineData(patron);
+ dataFields = [];
+ uEditDrawIDTypes(identTypes);
+ uEditDrawGroups(groups, null, null, true);
+ uEditDrawStatCats(statCats);
+ uEditDrawSurveys(surveys);
+ uEditDrawNetLevels(netLevels);
+ uEditDefineData(patron);
- uEditIterateFields(function(f) { uEditActivateField(f) });
- uEditIterateFields(function(f) { uEditCheckValid(f); });
- uEditCheckErrors();
+ uEditIterateFields(function(f) { uEditActivateField(f) });
+ uEditIterateFields(function(f) { uEditCheckValid(f); });
+ uEditCheckErrors();
}
/** Applies the event handlers and sets the data for the field */
function uEditActivateField(field) {
- if( field.widget.id ) {
- field.widget.node = $(field.widget.id);
+ if( field.widget.id ) {
+ field.widget.node = $(field.widget.id);
- } else {
- field.widget.node =
- $n(field.widget.base, field.widget.name);
- }
+ } else {
+ field.widget.node =
+ $n(field.widget.base, field.widget.name);
+ }
- uEditSetOnchange(field);
+ uEditSetOnchange(field);
- if(field.widget.onblur) {
- field.widget.node.onblur =
- function() { field.widget.onblur(field); };
- }
+ if(field.widget.onblur) {
+ field.widget.node.onblur =
+ function() { field.widget.onblur(field); };
+ }
- field.widget.node.disabled = field.widget.disabled;
- if(field.object == null) return;
- var val = field.object[field.key]();
- if(val == null) return;
+ field.widget.node.disabled = field.widget.disabled;
+ if(field.object == null) return;
+ var val = field.object[field.key]();
+ if(val == null) return;
- if( field.widget.type == 'input' )
- field.widget.node.value = val;
+ if( field.widget.type == 'input' )
+ field.widget.node.value = val;
- if( field.widget.type == 'select' )
- setSelector(field.widget.node, val);
+ if( field.widget.type == 'select' )
+ setSelector(field.widget.node, val);
- if( field.widget.type == 'checkbox' )
- field.widget.node.checked =
- (val && val != 'f') ? true : false;
+ if( field.widget.type == 'checkbox' )
+ field.widget.node.checked =
+ (val && val != 'f') ? true : false;
- if( field.widget.onload )
- field.widget.onload(val);
+ if( field.widget.onload )
+ field.widget.onload(val);
}
/* set up the onchange event for the field */
function uEditSetOnchange(field) {
- var func = function() {uEditOnChange( field );}
- field.widget.node.onchange = func;
+ var func = function() {uEditOnChange( field );}
+ field.widget.node.onchange = func;
- if(field.widget.type != 'select')
- field.widget.node.onkeyup = func;
+ if(field.widget.type != 'select')
+ field.widget.node.onkeyup = func;
}
/* find the current value of the field object's widget */
function uEditNodeVal(field) {
- if(field.widget.type == 'input')
- return field.widget.node.value;
+ if(field.widget.type == 'input')
+ return field.widget.node.value;
- if(field.widget.type == 'checkbox')
- return field.widget.node.checked;
+ if(field.widget.type == 'checkbox')
+ return field.widget.node.checked;
- if(field.widget.type == 'select')
- return getSelectorVal(field.widget.node);
+ if(field.widget.type == 'select')
+ return getSelectorVal(field.widget.node);
}
/* update a field value */
function uEditOnChange(field) {
- var newval = uEditNodeVal(field);
- field.object[field.key](newval);
- field.object.ischanged(1);
+ var newval = uEditNodeVal(field);
+ field.object[field.key](newval);
+ field.object.ischanged(1);
- if(field.widget.onpostchange)
- field.widget.onpostchange(field, newval);
+ if(field.widget.onpostchange)
+ field.widget.onpostchange(field, newval);
- //_debug(field.key+' = '+newval);
+ //_debug(field.key+' = '+newval);
- uEditIterateFields(function(f) { uEditCheckValid(f); });
- uEditCheckErrors();
+ uEditIterateFields(function(f) { uEditCheckValid(f); });
+ uEditCheckErrors();
uEditSetUnload();
}
function uEditCheckValid(field) {
- var newval = uEditNodeVal(field);
+ var newval = uEditNodeVal(field);
- if(newval) {
+ if(newval) {
- if(field.widget.regex) {
- if(newval.match(field.widget.regex))
- removeCSSClass(field.widget.node, CSS_INVALID_DATA);
- else
- addCSSClass(field.widget.node, CSS_INVALID_DATA);
+ if(field.widget.regex) {
+ if(newval.match(field.widget.regex))
+ removeCSSClass(field.widget.node, CSS_INVALID_DATA);
+ else
+ addCSSClass(field.widget.node, CSS_INVALID_DATA);
- } else {
- removeCSSClass(field.widget.node, CSS_INVALID_DATA);
- }
+ } else {
+ removeCSSClass(field.widget.node, CSS_INVALID_DATA);
+ }
- } else {
+ } else {
- if(field.required) {
- addCSSClass(field.widget.node, CSS_INVALID_DATA);
+ if(field.required) {
+ addCSSClass(field.widget.node, CSS_INVALID_DATA);
- } else {
- removeCSSClass(field.widget.node, CSS_INVALID_DATA);
- }
- }
+ } else {
+ removeCSSClass(field.widget.node, CSS_INVALID_DATA);
+ }
+ }
}
/* find a field object by object key */
function uEditFindFieldByKey(key) {
- var fields = grep( dataFields,
- function(item) { return (item.key == key); });
- return (fields) ? fields[0] : null;
+ var fields = grep( dataFields,
+ function(item) { return (item.key == key); });
+ return (fields) ? fields[0] : null;
}
/* find a list of fields by object key */
function uEditFindFieldsByKey(key) {
- return grep( dataFields,
- function(item) { return (item.key == key); });
+ return grep( dataFields,
+ function(item) { return (item.key == key); });
}
/* find a field object by widget id */
function uEditFindFieldByWId(id) {
- var fields = grep( dataFields,
- function(item) { return (item.widget.id == id); });
- return (fields) ? fields[0] : null;
+ var fields = grep( dataFields,
+ function(item) { return (item.widget.id == id); });
+ return (fields) ? fields[0] : null;
}
function uEditIterateFields(callback) {
- for( var f in dataFields )
- callback(dataFields[f]);
+ for( var f in dataFields )
+ callback(dataFields[f]);
}
function uEditGetErrorStrings() {
- var errors = [];
- uEditIterateFields(
- function(field) {
- if(field.errkey) {
- if( !field.object.isdeleted() ) {
- if( field.widget.node.className.indexOf(CSS_INVALID_DATA) != -1) {
- var str = $(field.errkey).innerHTML;
- if(str) errors.push(str);
- }
- }
- }
- }
- );
-
- /* munge up something for all of the required surveys
- (which are not registered with the fields) */
- if( patron.isnew() ) {
- var sel = $('ue_survey_table');
-
- if( sel ) {
- var rows = sel.getElementsByTagName('tr');
-
- for( var r in rows ) {
-
- var row = rows[r];
- var sel = $n(row, 'ue_survey_answer');
- if(!sel) continue;
- var qstn = row.getAttribute('question');
-
- if(qstn) {
- qstn = surveyQuestionsCache[qstn];
- survey = surveysCache[qstn.survey()];
- var val = getSelectorVal(sel);
- if(!val && isTrue(survey.required()))
- errors.push($('ue_bad_survey').innerHTML + ' : ' + qstn.question());
- }
- }
- }
- }
-
- /* ------------------------------------------------------------ */
-
- if(errors[0]) return errors;
- return null;
+ var errors = [];
+ uEditIterateFields(
+ function(field) {
+ if(field.errkey) {
+ if( !field.object.isdeleted() ) {
+ if( field.widget.node.className.indexOf(CSS_INVALID_DATA) != -1) {
+ var str = $(field.errkey).innerHTML;
+ if(str) errors.push(str);
+ }
+ }
+ }
+ }
+ );
+
+ /* munge up something for all of the required surveys
+ (which are not registered with the fields) */
+ if( patron.isnew() ) {
+ var sel = $('ue_survey_table');
+
+ if( sel ) {
+ var rows = sel.getElementsByTagName('tr');
+
+ for( var r in rows ) {
+
+ var row = rows[r];
+ var sel = $n(row, 'ue_survey_answer');
+ if(!sel) continue;
+ var qstn = row.getAttribute('question');
+
+ if(qstn) {
+ qstn = surveyQuestionsCache[qstn];
+ survey = surveysCache[qstn.survey()];
+ var val = getSelectorVal(sel);
+ if(!val && isTrue(survey.required()))
+ errors.push($('ue_bad_survey').innerHTML + ' : ' + qstn.question());
+ }
+ }
+ }
+ }
+
+ /* ------------------------------------------------------------ */
+
+ if(errors[0]) return errors;
+ return null;
}
function uEditAlertErrors() {
- var errors = uEditGetErrorStrings();
- if(!errors) return false;
- alert(errors.join("\n"));
- return true;
+ var errors = uEditGetErrorStrings();
+ if(!errors) return false;
+ alert(errors.join("\n"));
+ return true;
}
/* send the user to the database */
function uEditSaveUser(cloneme) {
- if(uEditGetErrorStrings()) {
- uEditAlertErrors();
- return;
- }
+ if(uEditGetErrorStrings()) {
+ uEditAlertErrors();
+ return;
+ }
- /* null is unique in the db, but '' is not */
- if( ! patron.ident_value() ) patron.ident_value(null);
- //if( ! patron.ident_type2() ) patron.ident_type2(null);
- if( ! patron.ident_value2() ) patron.ident_value2(null);
- patron.ident_type2(null);
+ /* null is unique in the db, but '' is not */
+ if( ! patron.ident_value() ) patron.ident_value(null);
+ //if( ! patron.ident_type2() ) patron.ident_type2(null);
+ if( ! patron.ident_value2() ) patron.ident_value2(null);
+ patron.ident_type2(null);
- if(! patron.dob() ) patron.dob(null);
+ if(! patron.dob() ) patron.dob(null);
- _debug("Saving patron with card: " + js2JSON(patron.card()));
- _debug("Saving full patron: " + js2JSON(patron));
+ _debug("Saving patron with card: " + js2JSON(patron.card()));
+ _debug("Saving full patron: " + js2JSON(patron));
- //for( var c in patron
+ //for( var c in patron
- var req = new Request(UPDATE_PATRON, SESSION, patron);
- req.alertEvent = false;
- req.send(true);
- var newuser = req.result();
+ var req = new Request(UPDATE_PATRON, SESSION, patron);
+ req.alertEvent = false;
+ req.send(true);
+ var newuser = req.result();
uEditClearUnload();
- var evt;
- if( (evt = checkILSEvent(newuser)) || ! newuser ) {
- if(evt) {
+ var evt;
+ if( (evt = checkILSEvent(newuser)) || ! newuser ) {
+ if(evt) {
evt = newuser;
if( evt.textcode == 'XACT_COLLISION' ) {
if( confirmId('ue_xact_collision') )
@@ -604,75 +604,75 @@ function uEditSaveUser(cloneme) {
return;
}
var j = js2JSON(evt);
- alert(j);
- _debug("USER UPDATE FAILED:\n" + j);
- }
- return;
- }
+ alert(j);
+ _debug("USER UPDATE FAILED:\n" + j);
+ }
+ return;
+ }
- alert($('ue_success').innerHTML);
+ alert($('ue_success').innerHTML);
- if(cloneme) {
- /* if the user we just created was a clone, and we want to clone it,
- we really want to clone the original */
- if( clone ) cloneme = clone;
- else cloneme = newuser.id();
- }
+ if(cloneme) {
+ /* if the user we just created was a clone, and we want to clone it,
+ we really want to clone the original */
+ if( clone ) cloneme = clone;
+ else cloneme = newuser.id();
+ }
- if( cloneme ) {
+ if( cloneme ) {
- if(window.xulG &&
- typeof window.xulG.spawn_editor == 'function' &&
+ if(window.xulG &&
+ typeof window.xulG.spawn_editor == 'function' &&
- !patron.isnew() ) {
- _debug("xulG clone spawning new interface...");
- var ses = cgi.param('ses');
- if (xulG) if (xulG.ses) ses = xulG.ses;
- if (xulG) if (xulG.params) if (xulG.params.ses) ses = xulG.params.ses;
- window.xulG.spawn_editor({ses:ses,clone:cloneme});
- uEditRefresh();
+ !patron.isnew() ) {
+ _debug("xulG clone spawning new interface...");
+ var ses = cgi.param('ses');
+ if (xulG) if (xulG.ses) ses = xulG.ses;
+ if (xulG) if (xulG.params) if (xulG.params.ses) ses = xulG.params.ses;
+ window.xulG.spawn_editor({ses:ses,clone:cloneme});
+ uEditRefresh();
- } else {
+ } else {
- var href = location.href;
- href = href.replace(/\&?usr=\d+/, '');
- href = href.replace(/\&?clone=\d+/, '');
- href += '&clone=' + cloneme;
- location.href = href;
- }
+ var href = location.href;
+ href = href.replace(/\&?usr=\d+/, '');
+ href = href.replace(/\&?clone=\d+/, '');
+ href += '&clone=' + cloneme;
+ location.href = href;
+ }
- } else {
+ } else {
- uEditRefresh();
- }
+ uEditRefresh();
+ }
- uEditRefreshXUL(newuser);
+ uEditRefreshXUL(newuser);
}
function uEditRefreshXUL(newuser) {
- if (window.xulG && typeof window.xulG.on_save == 'function')
- window.xulG.on_save(newuser);
+ if (window.xulG && typeof window.xulG.on_save == 'function')
+ window.xulG.on_save(newuser);
}
function uEditRefresh() {
- var href = location.href;
- href = href.replace(/\&?clone=\d+/, '');
- location.href = href;
+ var href = location.href;
+ href = href.replace(/\&?clone=\d+/, '');
+ location.href = href;
}
function uEditCancel() {
- var href = location.href;
- href = href.replace(/\&?usr=\d+/, '');
- href = href.replace(/\&?clone=\d+/, '');
- var id = cgi.param('usr');
- if (xulG) if (xulG.usr) id = xulG.usr;
- if (xulG) if (xulG.params) if (xulG.params.usr) id = xulG.params.usr;
- /* reload the current user if available */
- if( id ) href += (href.match(/\?/) ? "&" : "?") + "usr=" + id;
- location.href = href;
+ var href = location.href;
+ href = href.replace(/\&?usr=\d+/, '');
+ href = href.replace(/\&?clone=\d+/, '');
+ var id = cgi.param('usr');
+ if (xulG) if (xulG.usr) id = xulG.usr;
+ if (xulG) if (xulG.params) if (xulG.params.usr) id = xulG.params.usr;
+ /* reload the current user if available */
+ if( id ) href += (href.match(/\?/) ? "&" : "?") + "usr=" + id;
+ location.href = href;
}
@@ -681,131 +681,131 @@ var uEditDupTemplate;
function uEditRunDupeSearch(type, search_hash) {
- if(!patron.isnew()) return;
+ if(!patron.isnew()) return;
- _debug('dup search: ' + js2JSON(search_hash));
+ _debug('dup search: ' + js2JSON(search_hash));
- var req = new Request(PATRON_SEARCH, SESSION, search_hash);
+ var req = new Request(PATRON_SEARCH, SESSION, search_hash);
- var container = $('dup_div_container');
- if(!uEditDupTemplate)
- uEditDupTemplate = container.removeChild($('dup_div'));
+ var container = $('dup_div_container');
+ if(!uEditDupTemplate)
+ uEditDupTemplate = container.removeChild($('dup_div'));
- /* clear any existing dups for this type */
- iterate( container.getElementsByTagName('div'),
- function(d) {
- if( d.getAttribute('type') == type ) {
- container.removeChild(d)
- return;
- }
- }
- );
+ /* clear any existing dups for this type */
+ iterate( container.getElementsByTagName('div'),
+ function(d) {
+ if( d.getAttribute('type') == type ) {
+ container.removeChild(d)
+ return;
+ }
+ }
+ );
- req.callback(
- function(r) {
- uEditHandleDupResults( r.getResultObject(), search_hash, type, container );
- }
- );
- req.send();
+ req.callback(
+ function(r) {
+ uEditHandleDupResults( r.getResultObject(), search_hash, type, container );
+ }
+ );
+ req.send();
}
function uEditHandleDupResults(ids, search_hash, type, container) {
- _debug('dup search results: ' + js2JSON(ids));
+ _debug('dup search results: ' + js2JSON(ids));
- if(!(ids && ids[0])) /* no results */
- return uEditDupHashes[type] = null;
+ if(!(ids && ids[0])) /* no results */
+ return uEditDupHashes[type] = null;
- /* add a dup link to the UI and plug in the data */
- var node = uEditDupTemplate.cloneNode(true);
- container.appendChild(node);
- node.setAttribute('type', type);
+ /* add a dup link to the UI and plug in the data */
+ var node = uEditDupTemplate.cloneNode(true);
+ container.appendChild(node);
+ node.setAttribute('type', type);
- var link = $n(node, 'link');
- link.setAttribute('type', type);
- unHideMe(link);
- $n(node,'count').appendChild(text(ids.length));
+ var link = $n(node, 'link');
+ link.setAttribute('type', type);
+ unHideMe(link);
+ $n(node,'count').appendChild(text(ids.length));
- for( var o in search_hash )
- $n(node, 'data').appendChild(
- text(search_hash[o].value + ' '));
+ for( var o in search_hash )
+ $n(node, 'data').appendChild(
+ text(search_hash[o].value + ' '));
- uEditDupHashes[type] = search_hash;
+ uEditDupHashes[type] = search_hash;
- switch(type) {
- case 'ident' :
- if(confirm($('ue_dup_ident1').innerHTML))
- uEditShowSearch(null, type);
- break;
- }
+ switch(type) {
+ case 'ident' :
+ if(confirm($('ue_dup_ident1').innerHTML))
+ uEditShowSearch(null, type);
+ break;
+ }
}
function uEditShowSearch(link,type) {
- if(!type) type = link.getAttribute('type');
- if(window.xulG)
- window.xulG.spawn_search(uEditDupHashes[type]);
- else alert($("patronStrings").getString('web.staff.patron.ue.uedit_show_search.search_would_be', js2JSON(uEditDupHashes[type])));
+ if(!type) type = link.getAttribute('type');
+ if(window.xulG)
+ window.xulG.spawn_search(uEditDupHashes[type]);
+ else alert($("patronStrings").getString('web.staff.patron.ue.uedit_show_search.search_would_be', js2JSON(uEditDupHashes[type])));
}
function uEditMarkCardLost() {
- for( var c in patron.cards() ) {
-
- var card = patron.cards()[c];
- if( patron.card().id() == card.id() ) {
+ for( var c in patron.cards() ) {
- /* de-activite the current card */
- card.ischanged(1);
- card.active(0);
+ var card = patron.cards()[c];
+ if( patron.card().id() == card.id() ) {
- if( !card.barcode() ) {
- /* a card exists in the array with no barcode */
- ueRemoveCard(card.id());
+ /* de-activite the current card */
+ card.ischanged(1);
+ card.active(0);
- } else if( card.isnew() && card.active() == 0 ) {
- /* a new card was created, then never used, removing.. */
- _debug("removing new inactive card "+card.barcode());
- ueRemoveCard(card.id());
- }
-
- /* create a new card for the patron */
- var newcard = new ac();
- newcard.id(uEditCardVirtId--);
- newcard.isnew(1);
- patron.card(newcard);
- patron.cards().push(newcard);
+ if( !card.barcode() ) {
+ /* a card exists in the array with no barcode */
+ ueRemoveCard(card.id());
+ } else if( card.isnew() && card.active() == 0 ) {
+ /* a new card was created, then never used, removing.. */
+ _debug("removing new inactive card "+card.barcode());
+ ueRemoveCard(card.id());
+ }
- /* reset the widget */
- var field = uEditFindFieldByWId('ue_barcode');
- field.widget.node.disabled = false;
- field.widget.node.value = "";
- field.widget.node.onchange();
- field.object = newcard;
- _debug("uEditMarkCardLost(): created new card object for user");
- }
- }
+ /* create a new card for the patron */
+ var newcard = new ac();
+ newcard.id(uEditCardVirtId--);
+ newcard.isnew(1);
+ patron.card(newcard);
+ patron.cards().push(newcard);
+
+
+ /* reset the widget */
+ var field = uEditFindFieldByWId('ue_barcode');
+ field.widget.node.disabled = false;
+ field.widget.node.value = "";
+ field.widget.node.onchange();
+ field.object = newcard;
+ _debug("uEditMarkCardLost(): created new card object for user");
+ }
+ }
}
function ueRemoveCard(id) {
- _debug("removing card from cards() array: " + id);
- var cds = grep( patron.cards(), function(c){return (c.id() != id)});
- if(!cds) cds = [];
- for( var j = 0; j < cds.length; j++ )
- _debug("patron card array now has : "+cds[j].id());
- patron.cards(cds);
+ _debug("removing card from cards() array: " + id);
+ var cds = grep( patron.cards(), function(c){return (c.id() != id)});
+ if(!cds) cds = [];
+ for( var j = 0; j < cds.length; j++ )
+ _debug("patron card array now has : "+cds[j].id());
+ patron.cards(cds);
}
function compactArray(arr) {
- var a = [];
- for( var i = 0; arr && i < arr.length; i++ ) {
- if( arr[i] != null )
- a.push(arr[i]);
- }
- return a;
+ var a = [];
+ for( var i = 0; arr && i < arr.length; i++ ) {
+ if( arr[i] != null )
+ a.push(arr[i]);
+ }
+ return a;
}
diff --git a/Open-ILS/xul/staff_client/server/patron/ue_config.js b/Open-ILS/xul/staff_client/server/patron/ue_config.js
index 925a99ed4c..32c3951e8e 100644
--- a/Open-ILS/xul/staff_client/server/patron/ue_config.js
+++ b/Open-ILS/xul/staff_client/server/patron/ue_config.js
@@ -1,300 +1,300 @@
/* -----------------------------------------------------------------------
- ----------------------------------------------------------------------- */
-const SC_FETCH_ALL = 'open-ils.circ:open-ils.circ.stat_cat.actor.retrieve.all';
-const SC_CREATE_MAP = 'open-ils.circ:open-ils.circ.stat_cat.actor.user_map.create';
-const SV_FETCH_ALL = 'open-ils.circ:open-ils.circ.survey.retrieve.all';
-const FETCH_ID_TYPES = 'open-ils.actor:open-ils.actor.user.ident_types.retrieve';
-const FETCH_GROUPS = 'open-ils.actor:open-ils.actor.groups.tree.retrieve';
-const FETCH_NET_LEVELS = 'open-ils.actor:open-ils.actor.net_access_level.retrieve.all';
-const UPDATE_PATRON = 'open-ils.actor:open-ils.actor.patron.update';
-const PATRON_SEARCH = 'open-ils.actor:open-ils.actor.patron.search.advanced';
-const ZIP_SEARCH = 'open-ils.search:open-ils.search.zip';
-const APPROVE_ADDR = 'open-ils.actor:open-ils.actor.user.pending_address.approve';
-const FETCH_ADDR_MEMS = 'open-ils.actor:open-ils.actor.address.members';
-const FETCH_GRP_MEMS = 'open-ils.actor:open-ils.actor.usergroup.members.retrieve';
-const CREATE_USER_NOTE = 'open-ils.actor:open-ils.actor.note.create';
-const CHECK_BARCODE = 'open-ils.actor:open-ils.actor.barcode.exists';
-const defaultState = 'GA';
-const defaultCountry = 'USA';
-const defaultNetAccess = 'None';
+ ----------------------------------------------------------------------- */
+const SC_FETCH_ALL = 'open-ils.circ:open-ils.circ.stat_cat.actor.retrieve.all';
+const SC_CREATE_MAP = 'open-ils.circ:open-ils.circ.stat_cat.actor.user_map.create';
+const SV_FETCH_ALL = 'open-ils.circ:open-ils.circ.survey.retrieve.all';
+const FETCH_ID_TYPES = 'open-ils.actor:open-ils.actor.user.ident_types.retrieve';
+const FETCH_GROUPS = 'open-ils.actor:open-ils.actor.groups.tree.retrieve';
+const FETCH_NET_LEVELS = 'open-ils.actor:open-ils.actor.net_access_level.retrieve.all';
+const UPDATE_PATRON = 'open-ils.actor:open-ils.actor.patron.update';
+const PATRON_SEARCH = 'open-ils.actor:open-ils.actor.patron.search.advanced';
+const ZIP_SEARCH = 'open-ils.search:open-ils.search.zip';
+const APPROVE_ADDR = 'open-ils.actor:open-ils.actor.user.pending_address.approve';
+const FETCH_ADDR_MEMS = 'open-ils.actor:open-ils.actor.address.members';
+const FETCH_GRP_MEMS = 'open-ils.actor:open-ils.actor.usergroup.members.retrieve';
+const CREATE_USER_NOTE = 'open-ils.actor:open-ils.actor.note.create';
+const CHECK_BARCODE = 'open-ils.actor:open-ils.actor.barcode.exists';
+const defaultState = 'GA';
+const defaultCountry = 'USA';
+const defaultNetAccess = 'None';
const defaultNetLevel = 1;
-const CSS_INVALID_DATA = 'invalid_value';
+const CSS_INVALID_DATA = 'invalid_value';
// if no org setting exists
-const DEFAULT_ADULT_AGE = '18 years';
+const DEFAULT_ADULT_AGE = '18 years';
-//const GUARDIAN_NOTE = 'SYSTEM: Parent/Guardian';
+//const GUARDIAN_NOTE = 'SYSTEM: Parent/Guardian';
var dataFields;
-const numRegex = /^\d+$/;
-const wordRegex = /^[\w-]+$/;
-const unameRegex = /^\w[\.\w\@-]*$/;
-const ssnRegex = /^\d{3}-\d{2}-\d{4}$/;
-const dlRegex = /^[a-zA-Z]{2}-\w+/; /* driver's license */
-const phoneRegex = /^\d{3}-\d{3}-\d{4}(| \S+.*)$/i;
-const nonumRegex = /^[^\d\s]+[\d]*$/; /* no numbers, no beginning whitespace */
-const dateRegex = /^\d{4}-\d{2}-\d{2}/;
-const zipRegex = /^\d{5}(-\d{4}|-?$)|(^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$)/;
+const numRegex = /^\d+$/;
+const wordRegex = /^[\w-]+$/;
+const unameRegex = /^\w[\.\w\@-]*$/;
+const ssnRegex = /^\d{3}-\d{2}-\d{4}$/;
+const dlRegex = /^[a-zA-Z]{2}-\w+/; /* driver's license */
+const phoneRegex = /^\d{3}-\d{3}-\d{4}(| \S+.*)$/i;
+const nonumRegex = /^[^\d\s]+[\d]*$/; /* no numbers, no beginning whitespace */
+const dateRegex = /^\d{4}-\d{2}-\d{2}/;
+const zipRegex = /^\d{5}(-\d{4}|-?$)|(^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$)/;
var barredAlerted = false;
function uEditUsrnameBlur(field) {
- var usrname = uEditNodeVal(field);
- if (!usrname) { return; }
- var req = new Request(CHECK_USERNAME, SESSION, usrname);
- req.callback(
- function(r) {
- var res = r.getResultObject();
- if( res !== null && res != patron.id() ) {
- field.widget.onblur = null; /* prevent alert storm */
- alertId('ue_dup_username');
- field.widget.onblur = uEditUsrnameBlur;
- setTimeout(
- function() {
- field.widget.node.focus();
- field.widget.node.select();
- }, 10
- );
- }
- }
- );
- req.send();
+ var usrname = uEditNodeVal(field);
+ if (!usrname) { return; }
+ var req = new Request(CHECK_USERNAME, SESSION, usrname);
+ req.callback(
+ function(r) {
+ var res = r.getResultObject();
+ if( res !== null && res != patron.id() ) {
+ field.widget.onblur = null; /* prevent alert storm */
+ alertId('ue_dup_username');
+ field.widget.onblur = uEditUsrnameBlur;
+ setTimeout(
+ function() {
+ field.widget.node.focus();
+ field.widget.node.select();
+ }, 10
+ );
+ }
+ }
+ );
+ req.send();
}
function uEditBarcodeBlur(field) {
- var barcode = uEditNodeVal(field);
- if(!barcode) return;
- _debug("blurring card with new value " + barcode);
- var req = new Request(CHECK_BARCODE, SESSION, barcode);
- req.callback(
- function(r) {
- var res = r.getResultObject();
- if( res == 1 ) {
- field.widget.onblur = null; /* prevent alert storm */
- alertId('ue_dup_barcode');
- field.widget.onblur = uEditBarcodeBlur;
- setTimeout(
- function() {
- field.widget.node.focus();
- field.widget.node.select();
- }, 10
- );
- } else {
- var node = uEditFindFieldByWId("ue_username");
- if(!node.widget.node.value) {
- node.widget.node.value = barcode;
- node.widget.node.onchange();
- }
- }
- }
- );
- req.send();
+ var barcode = uEditNodeVal(field);
+ if(!barcode) return;
+ _debug("blurring card with new value " + barcode);
+ var req = new Request(CHECK_BARCODE, SESSION, barcode);
+ req.callback(
+ function(r) {
+ var res = r.getResultObject();
+ if( res == 1 ) {
+ field.widget.onblur = null; /* prevent alert storm */
+ alertId('ue_dup_barcode');
+ field.widget.onblur = uEditBarcodeBlur;
+ setTimeout(
+ function() {
+ field.widget.node.focus();
+ field.widget.node.select();
+ }, 10
+ );
+ } else {
+ var node = uEditFindFieldByWId("ue_username");
+ if(!node.widget.node.value) {
+ node.widget.node.value = barcode;
+ node.widget.node.onchange();
+ }
+ }
+ }
+ );
+ req.send();
}
function uEditDefineData(patron) {
- var fields = [
- {
- required : true,
- object : patron.card(),
- key : 'barcode',
- errkey : 'ue_bad_barcode',
- widget : {
- id : 'ue_barcode',
- regex : wordRegex,
- type : 'input',
- onblur : uEditBarcodeBlur
- }
- },
- {
- required : true,
- object : patron,
- key : 'usrname',
- errkey : 'ue_bad_username',
- widget : {
- id : 'ue_username',
- regex : unameRegex,
- type : 'input',
- onblur : uEditUsrnameBlur
- }
- },
- {
- required : (patron.isnew()) ? true : false,
- object : patron,
- key : 'passwd',
- errkey : 'ue_bad_password',
- widget : {
- id : 'ue_password1',
- type : 'input',
- onpostchange : function(field, newval) {
- var pw2 = uEditFindFieldByWId('ue_password2');
- /* tell the second passsword input to re-validate */
- pw2.widget.node.onchange();
- }
-
- }
- },
- {
- required : (patron.isnew()) ? true : false,
- object : patron,
- key : 'passwd',
- errkey : 'ue_bad_password',
- widget : {
- id : 'ue_password2',
- type : 'input',
- onpostchange : function(field, newval) {
- var pw1f = uEditFindFieldByWId('ue_password1');
- var pw1 = uEditNodeVal(pw1f);
- field.widget.regex = new RegExp('^'+pw1+'$');
- if( pw1 ) field.required = true;
- else {
- if(!patron.isnew())
- field.required = false;
- }
- }
- }
- },
- {
- required : true,
- object : patron,
- key : 'first_given_name',
- errkey : 'ue_bad_firstname',
- widget : {
- id : 'ue_firstname',
- regex : nonumRegex,
- type : 'input',
- onblur : function(field) {
- uEditCheckNamesDup('first', field );
- }
- }
- },
- {
- required : false,
- object : patron,
- key : 'second_given_name',
- errkey : 'ue_bad_middlename',
- widget : {
- id : 'ue_middlename',
- regex : nonumRegex,
- type : 'input'
- }
- },
- {
- required : true,
- object : patron,
- key : 'family_name',
- errkey : 'ue_bad_lastname',
- widget : {
- id : 'ue_lastname',
- regex : nonumRegex,
- type : 'input',
- onblur : function(field) {
- uEditCheckNamesDup('last', field );
- }
- }
- },
- {
- required : false,
- object : patron,
- key : 'suffix',
- widget : {
- id : 'ue_suffix',
- type : 'input',
- onload : function(val) {
- setSelector($('ue_suffix_selector'), val);
- $('ue_suffix_selector').onchange = function() {
- uEditFindFieldByKey('suffix').widget.node.onchange();
- }
- },
- }
- },
- {
- required : false,
- object : patron,
- key : 'alias',
- widget : {
- id : 'ue_alias',
- type : 'input',
- }
- },
- {
- required : false,
- object : patron,
- key : 'dob',
- errkey : 'ue_bad_dob',
- widget : {
- id : 'ue_dob',
- regex : dateRegex,
- type : 'input',
- onpostchange : function(field) { uEditCheckDOB(field); },
- onblur : function(field) { uEditCheckDOB(field); }
- }
- },
- {
- required : true,
- object : patron,
- key : 'ident_type',
- errkey : 'ue_no_ident',
- widget : {
- id : 'ue_primary_ident_type',
- regex : numRegex,
- type : 'select',
- onpostchange : function(field, newval)
- { _uEditIdentPostchange('primary', field, newval); }
- }
- },
- {
- required : false,
- object : patron,
- key : 'ident_value',
- widget : {
- id : 'ue_primary_ident',
- type : 'input',
- onblur : function(field) {
- uEditCheckIdentDup(field);
- }
- }
- },
- {
- required : false,
- object : patron,
- key : 'ident_value2',
- widget : {
- id : 'ue_secondary_ident',
- type : 'input'
- }
- },
- {
- required : false,
- object : patron,
- key : 'email',
- errkey : 'ue_bad_email',
- widget : {
- id : 'ue_email',
- type : 'input',
- regex : /.+\@.+\..+/, /* make me better */
- onblur : function(field) {
- var val = uEditNodeVal(field);
- if( val && val != field.oldemail ) {
- uEditRunDupeSearch('email',
- { email : { value : val, group : 0 } });
- field.oldemail = val;
- }
- }
- }
- },
- {
- required : false,
- object : patron,
- key : 'day_phone',
- errkey : 'ue_bad_phone',
- widget : {
- id : 'ue_day_phone',
- type : 'input',
- regex : phoneRegex,
+ var fields = [
+ {
+ required : true,
+ object : patron.card(),
+ key : 'barcode',
+ errkey : 'ue_bad_barcode',
+ widget : {
+ id : 'ue_barcode',
+ regex : wordRegex,
+ type : 'input',
+ onblur : uEditBarcodeBlur
+ }
+ },
+ {
+ required : true,
+ object : patron,
+ key : 'usrname',
+ errkey : 'ue_bad_username',
+ widget : {
+ id : 'ue_username',
+ regex : unameRegex,
+ type : 'input',
+ onblur : uEditUsrnameBlur
+ }
+ },
+ {
+ required : (patron.isnew()) ? true : false,
+ object : patron,
+ key : 'passwd',
+ errkey : 'ue_bad_password',
+ widget : {
+ id : 'ue_password1',
+ type : 'input',
+ onpostchange : function(field, newval) {
+ var pw2 = uEditFindFieldByWId('ue_password2');
+ /* tell the second passsword input to re-validate */
+ pw2.widget.node.onchange();
+ }
+
+ }
+ },
+ {
+ required : (patron.isnew()) ? true : false,
+ object : patron,
+ key : 'passwd',
+ errkey : 'ue_bad_password',
+ widget : {
+ id : 'ue_password2',
+ type : 'input',
+ onpostchange : function(field, newval) {
+ var pw1f = uEditFindFieldByWId('ue_password1');
+ var pw1 = uEditNodeVal(pw1f);
+ field.widget.regex = new RegExp('^'+pw1+'$');
+ if( pw1 ) field.required = true;
+ else {
+ if(!patron.isnew())
+ field.required = false;
+ }
+ }
+ }
+ },
+ {
+ required : true,
+ object : patron,
+ key : 'first_given_name',
+ errkey : 'ue_bad_firstname',
+ widget : {
+ id : 'ue_firstname',
+ regex : nonumRegex,
+ type : 'input',
+ onblur : function(field) {
+ uEditCheckNamesDup('first', field );
+ }
+ }
+ },
+ {
+ required : false,
+ object : patron,
+ key : 'second_given_name',
+ errkey : 'ue_bad_middlename',
+ widget : {
+ id : 'ue_middlename',
+ regex : nonumRegex,
+ type : 'input'
+ }
+ },
+ {
+ required : true,
+ object : patron,
+ key : 'family_name',
+ errkey : 'ue_bad_lastname',
+ widget : {
+ id : 'ue_lastname',
+ regex : nonumRegex,
+ type : 'input',
+ onblur : function(field) {
+ uEditCheckNamesDup('last', field );
+ }
+ }
+ },
+ {
+ required : false,
+ object : patron,
+ key : 'suffix',
+ widget : {
+ id : 'ue_suffix',
+ type : 'input',
+ onload : function(val) {
+ setSelector($('ue_suffix_selector'), val);
+ $('ue_suffix_selector').onchange = function() {
+ uEditFindFieldByKey('suffix').widget.node.onchange();
+ }
+ },
+ }
+ },
+ {
+ required : false,
+ object : patron,
+ key : 'alias',
+ widget : {
+ id : 'ue_alias',
+ type : 'input',
+ }
+ },
+ {
+ required : false,
+ object : patron,
+ key : 'dob',
+ errkey : 'ue_bad_dob',
+ widget : {
+ id : 'ue_dob',
+ regex : dateRegex,
+ type : 'input',
+ onpostchange : function(field) { uEditCheckDOB(field); },
+ onblur : function(field) { uEditCheckDOB(field); }
+ }
+ },
+ {
+ required : true,
+ object : patron,
+ key : 'ident_type',
+ errkey : 'ue_no_ident',
+ widget : {
+ id : 'ue_primary_ident_type',
+ regex : numRegex,
+ type : 'select',
+ onpostchange : function(field, newval)
+ { _uEditIdentPostchange('primary', field, newval); }
+ }
+ },
+ {
+ required : false,
+ object : patron,
+ key : 'ident_value',
+ widget : {
+ id : 'ue_primary_ident',
+ type : 'input',
+ onblur : function(field) {
+ uEditCheckIdentDup(field);
+ }
+ }
+ },
+ {
+ required : false,
+ object : patron,
+ key : 'ident_value2',
+ widget : {
+ id : 'ue_secondary_ident',
+ type : 'input'
+ }
+ },
+ {
+ required : false,
+ object : patron,
+ key : 'email',
+ errkey : 'ue_bad_email',
+ widget : {
+ id : 'ue_email',
+ type : 'input',
+ regex : /.+\@.+\..+/, /* make me better */
+ onblur : function(field) {
+ var val = uEditNodeVal(field);
+ if( val && val != field.oldemail ) {
+ uEditRunDupeSearch('email',
+ { email : { value : val, group : 0 } });
+ field.oldemail = val;
+ }
+ }
+ }
+ },
+ {
+ required : false,
+ object : patron,
+ key : 'day_phone',
+ errkey : 'ue_bad_phone',
+ widget : {
+ id : 'ue_day_phone',
+ type : 'input',
+ regex : phoneRegex,
onblur : function() {
if(uEditUsePhonePw)
uEditMakePhonePw();
@@ -308,274 +308,274 @@ function uEditDefineData(patron) {
uEditMakePhonePw();
}
}
- }
- },
- {
- required : false,
- object : patron,
- key : 'evening_phone',
- errkey : 'ue_bad_phone',
- widget : {
- id : 'ue_night_phone',
- type : 'input',
- regex : phoneRegex,
+ }
+ },
+ {
+ required : false,
+ object : patron,
+ key : 'evening_phone',
+ errkey : 'ue_bad_phone',
+ widget : {
+ id : 'ue_night_phone',
+ type : 'input',
+ regex : phoneRegex,
onblur : function() {
if(uEditUsePhonePw)
uEditMakePhonePw();
}
- }
- },
- {
- required : false,
- object : patron,
- key : 'other_phone',
- errkey : 'ue_bad_phone',
- widget : {
- id : 'ue_other_phone',
- type : 'input',
- regex : phoneRegex,
+ }
+ },
+ {
+ required : false,
+ object : patron,
+ key : 'other_phone',
+ errkey : 'ue_bad_phone',
+ widget : {
+ id : 'ue_other_phone',
+ type : 'input',
+ regex : phoneRegex,
onblur : function() {
if(uEditUsePhonePw)
uEditMakePhonePw();
}
- }
- },
- {
- required : true,
- object : patron,
- key : 'home_ou',
- widget : {
- id : 'ue_org_selector',
- type : 'select',
- regex : numRegex,
- }
- },
- {
- required : true,
- object : patron,
- key : 'expire_date',
- errkey : 'ue_bad_expire',
- widget : {
- id : 'ue_expire',
- type : 'input',
- regex : dateRegex,
- }
- },
- {
- required : false,
- object : patron,
- key : 'active',
- widget : {
- id : 'ue_active',
- type : 'checkbox',
- }
- },
- {
- required : false,
- object : patron,
- key : 'juvenile',
- widget : {
- id : 'ue_juvenile',
- type : 'checkbox',
- onpostchange : function(field) { uEditCheckDOB(uEditFindFieldByKey('dob')); },
- onblur : function(field) { uEditCheckDOB(uEditFindFieldByKey('dob')); }
- }
- },
- {
- required : false,
- object : patron,
- key : 'barred',
- widget : {
- id : 'ue_barred',
- type : 'checkbox',
- onpostchange : function(field, val) {
- var afield = uEditFindFieldByKey('alert_message');
- if( val ) {
- if( !barredAlerted ) {
- barredAlerted = true;
- alertId('ue_made_barred');
- }
- afield.required = true;
- } else {
- afield.required = false;
- }
- }
- }
- },
- {
- required : true,
- object : patron,
- key : 'profile',
- errkey : 'ue_no_profile',
- widget : {
- id : 'ue_profile',
- type : 'select',
- regex : numRegex,
- onpostchange : function(field, value) {
- var type = groupsCache[value];
- if(!type) return;
- var interval = type.perm_interval();
-
- /* interval_to_seconds expects 'M' for months, 'm' for minutes */
- interval = interval.replace(/mon/, 'Mon');
- var intsecs = parseInt(interval_to_seconds(interval));
-
- var expdate = new Date();
- var exptime = expdate.getTime();
- exptime += intsecs * 1000;
- expdate.setTime(exptime);
-
- _debug("profile change (interval= '"+interval+"', seconds="+intsecs+")\n\tgenerated a date of " + expdate);
-
- var year = expdate.getYear() + 1900;
- var month = (expdate.getMonth() + 1) + '';
- var day = (expdate.getDate()) + '';
-
- if(!month.match(/\d{2}/)) month = '0' + month;
- if(!day.match(/\d{2}/)) day = '0' + day;
-
-
- var node = $('ue_expire');
- node.value = year+'-'+month+'-'+day;
-
- _debug("profile change formatted date to "+ node.value);
- node.onchange();
- }
- }
- },
- {
- required : false,
- object : patron,
- key : 'net_access_level',
- widget : {
- id : 'ue_net_level',
- type : 'select'
- }
- },
- {
- required : false,
- object : patron,
- key : 'master_account',
- widget : {
- id : 'ue_group_lead',
- type : 'checkbox',
- }
- },
- {
- required : true,
- object : patron,
- key : 'claims_returned_count',
- widget : {
- id : 'ue_claims_returned',
- type : 'input',
- regex : numRegex,
- disabled : true
- }
- },
- {
- required : false,
- object : patron,
- key : 'alert_message',
- widget : {
- id : 'ue_alert_message',
- type : 'input',
- }
- }
- ];
-
- for( var f in fields )
- dataFields.push(fields[f]);
-
- uEditBuildAddrs(patron);
- uEditBuildPatronSCM(patron);
+ }
+ },
+ {
+ required : true,
+ object : patron,
+ key : 'home_ou',
+ widget : {
+ id : 'ue_org_selector',
+ type : 'select',
+ regex : numRegex,
+ }
+ },
+ {
+ required : true,
+ object : patron,
+ key : 'expire_date',
+ errkey : 'ue_bad_expire',
+ widget : {
+ id : 'ue_expire',
+ type : 'input',
+ regex : dateRegex,
+ }
+ },
+ {
+ required : false,
+ object : patron,
+ key : 'active',
+ widget : {
+ id : 'ue_active',
+ type : 'checkbox',
+ }
+ },
+ {
+ required : false,
+ object : patron,
+ key : 'juvenile',
+ widget : {
+ id : 'ue_juvenile',
+ type : 'checkbox',
+ onpostchange : function(field) { uEditCheckDOB(uEditFindFieldByKey('dob')); },
+ onblur : function(field) { uEditCheckDOB(uEditFindFieldByKey('dob')); }
+ }
+ },
+ {
+ required : false,
+ object : patron,
+ key : 'barred',
+ widget : {
+ id : 'ue_barred',
+ type : 'checkbox',
+ onpostchange : function(field, val) {
+ var afield = uEditFindFieldByKey('alert_message');
+ if( val ) {
+ if( !barredAlerted ) {
+ barredAlerted = true;
+ alertId('ue_made_barred');
+ }
+ afield.required = true;
+ } else {
+ afield.required = false;
+ }
+ }
+ }
+ },
+ {
+ required : true,
+ object : patron,
+ key : 'profile',
+ errkey : 'ue_no_profile',
+ widget : {
+ id : 'ue_profile',
+ type : 'select',
+ regex : numRegex,
+ onpostchange : function(field, value) {
+ var type = groupsCache[value];
+ if(!type) return;
+ var interval = type.perm_interval();
+
+ /* interval_to_seconds expects 'M' for months, 'm' for minutes */
+ interval = interval.replace(/mon/, 'Mon');
+ var intsecs = parseInt(interval_to_seconds(interval));
+
+ var expdate = new Date();
+ var exptime = expdate.getTime();
+ exptime += intsecs * 1000;
+ expdate.setTime(exptime);
+
+ _debug("profile change (interval= '"+interval+"', seconds="+intsecs+")\n\tgenerated a date of " + expdate);
+
+ var year = expdate.getYear() + 1900;
+ var month = (expdate.getMonth() + 1) + '';
+ var day = (expdate.getDate()) + '';
+
+ if(!month.match(/\d{2}/)) month = '0' + month;
+ if(!day.match(/\d{2}/)) day = '0' + day;
+
+
+ var node = $('ue_expire');
+ node.value = year+'-'+month+'-'+day;
+
+ _debug("profile change formatted date to "+ node.value);
+ node.onchange();
+ }
+ }
+ },
+ {
+ required : false,
+ object : patron,
+ key : 'net_access_level',
+ widget : {
+ id : 'ue_net_level',
+ type : 'select'
+ }
+ },
+ {
+ required : false,
+ object : patron,
+ key : 'master_account',
+ widget : {
+ id : 'ue_group_lead',
+ type : 'checkbox',
+ }
+ },
+ {
+ required : true,
+ object : patron,
+ key : 'claims_returned_count',
+ widget : {
+ id : 'ue_claims_returned',
+ type : 'input',
+ regex : numRegex,
+ disabled : true
+ }
+ },
+ {
+ required : false,
+ object : patron,
+ key : 'alert_message',
+ widget : {
+ id : 'ue_alert_message',
+ type : 'input',
+ }
+ }
+ ];
+
+ for( var f in fields )
+ dataFields.push(fields[f]);
+
+ uEditBuildAddrs(patron);
+ uEditBuildPatronSCM(patron);
}
var uEditOldFirstName;
var uEditOldMiddleName; /* future */
var uEditOldLastName;
function uEditCheckNamesDup(type, field) {
- var newval = uEditNodeVal(field);
- if(!newval) return;
-
- var dosearch = false;
-
- if(type =='first') {
- if( newval != uEditOldFirstName )
- dosearch = true;
- uEditOldFirstName = newval;
- }
-
- if(type =='last') {
- if( newval != uEditOldLastName )
- dosearch = true;
- uEditOldLastName = newval;
- }
-
- if( dosearch && uEditOldFirstName && uEditOldLastName ) {
- var search_hash = {};
- search_hash['first_given_name'] = { value : uEditOldFirstName, group : 0 };
- search_hash['family_name'] = { value : uEditOldLastName, group : 0 };
- uEditRunDupeSearch('names', search_hash);
- }
+ var newval = uEditNodeVal(field);
+ if(!newval) return;
+
+ var dosearch = false;
+
+ if(type =='first') {
+ if( newval != uEditOldFirstName )
+ dosearch = true;
+ uEditOldFirstName = newval;
+ }
+
+ if(type =='last') {
+ if( newval != uEditOldLastName )
+ dosearch = true;
+ uEditOldLastName = newval;
+ }
+
+ if( dosearch && uEditOldFirstName && uEditOldLastName ) {
+ var search_hash = {};
+ search_hash['first_given_name'] = { value : uEditOldFirstName, group : 0 };
+ search_hash['family_name'] = { value : uEditOldLastName, group : 0 };
+ uEditRunDupeSearch('names', search_hash);
+ }
}
var uEditOldIdentValue;
function uEditCheckIdentDup(field) {
- var newval = uEditNodeVal(field);
- if( newval && newval != uEditOldIdentValue ) {
- /* searches all ident_value fields */
- var search_hash = { ident : { value : newval, group : 2 } };
- uEditRunDupeSearch('ident', search_hash);
- uEditOldIdentValue = newval;
- }
+ var newval = uEditNodeVal(field);
+ if( newval && newval != uEditOldIdentValue ) {
+ /* searches all ident_value fields */
+ var search_hash = { ident : { value : newval, group : 2 } };
+ uEditRunDupeSearch('ident', search_hash);
+ uEditOldIdentValue = newval;
+ }
}
/* Adds all of the addresses attached to the patron object
- to the fields array */
+ to the fields array */
var uEditAddrTemplate;
function uEditBuildAddrs(patron) {
- var tbody = $('ue_address_tbody');
- if(!uEditAddrTemplate)
- uEditAddrTemplate = tbody.removeChild($('ue_address_template'));
- for( var a in patron.addresses() )
- uEditBuildAddrFields( patron, patron.addresses()[a]);
+ var tbody = $('ue_address_tbody');
+ if(!uEditAddrTemplate)
+ uEditAddrTemplate = tbody.removeChild($('ue_address_template'));
+ for( var a in patron.addresses() )
+ uEditBuildAddrFields( patron, patron.addresses()[a]);
}
function uEditDeleteAddr( tbody, row, address, detach ) {
- if(!confirm($('ue_delete_addr_warn').innerHTML)) return;
- if(address.isnew()) {
- patron.addresses(
- grep( patron.addresses(),
- function(i) {
- return (i.id() != address.id());
- }
- )
- );
+ if(!confirm($('ue_delete_addr_warn').innerHTML)) return;
+ if(address.isnew()) {
+ patron.addresses(
+ grep( patron.addresses(),
+ function(i) {
+ return (i.id() != address.id());
+ }
+ )
+ );
if(!patron.addresses())
patron.addresses([]);
- /* XXX */
- for( var f in dataFields ) {
- if( dataFields[f].object == address ) {
- dataFields[f] = null;
- }
- }
-
- dataFields = compactArray(dataFields);
-
- } else {
-
- if( detach ) { /* remove the offending address from the list */
- patron.addresses(
- grep(
- patron.addresses(),
- function(i) {
- return (i.id() != address.id());
- }
- )
- );
+ /* XXX */
+ for( var f in dataFields ) {
+ if( dataFields[f].object == address ) {
+ dataFields[f] = null;
+ }
+ }
+
+ dataFields = compactArray(dataFields);
+
+ } else {
+
+ if( detach ) { /* remove the offending address from the list */
+ patron.addresses(
+ grep(
+ patron.addresses(),
+ function(i) {
+ return (i.id() != address.id());
+ }
+ )
+ );
if(!patron.addresses()) {
patron.addresses([]);
patron.billing_address(null);
@@ -584,49 +584,49 @@ function uEditDeleteAddr( tbody, row, address, detach ) {
}
- } else {
- address.isdeleted(1);
- }
- }
+ } else {
+ address.isdeleted(1);
+ }
+ }
- tbody.removeChild(row);
+ tbody.removeChild(row);
- var bid = patron.billing_address();
+ var bid = patron.billing_address();
bid = (bid != null && typeof bid == 'object') ? bid.id() : bid;
- var mid = patron.mailing_address();
+ var mid = patron.mailing_address();
mid = (mid != null && typeof mid == 'object') ? mid.id() : mid;
- /* -----------------------------------------------------------------------
- if we're deleting a billing or mailing address
- make sure some other address is automatically
- assigned as the billing or mailng address
- ----------------------------------------------------------------------- */
-
- if( bid == address.id() ) {
- for( var a in patron.addresses() ) {
- var addr = patron.addresses()[a];
- if(!addr.isdeleted() && addr.id() != address.id()) {
- var node = uEditFindAddrInput('billing', addr.id());
- node.checked = true;
- uEditAddrTypeClick(node, 'billing');
- break;
- }
- }
- }
-
- if( mid == address.id() ) {
- for( var a in patron.addresses() ) {
- var addr = patron.addresses()[a];
- if(!addr.isdeleted() && addr.id() != address.id()) {
- var node = uEditFindAddrInput('mailing', addr.id());
- node.checked = true;
- uEditAddrTypeClick(node, 'mailing');
- break;
- }
- }
- }
+ /* -----------------------------------------------------------------------
+ if we're deleting a billing or mailing address
+ make sure some other address is automatically
+ assigned as the billing or mailng address
+ ----------------------------------------------------------------------- */
+
+ if( bid == address.id() ) {
+ for( var a in patron.addresses() ) {
+ var addr = patron.addresses()[a];
+ if(!addr.isdeleted() && addr.id() != address.id()) {
+ var node = uEditFindAddrInput('billing', addr.id());
+ node.checked = true;
+ uEditAddrTypeClick(node, 'billing');
+ break;
+ }
+ }
+ }
+
+ if( mid == address.id() ) {
+ for( var a in patron.addresses() ) {
+ var addr = patron.addresses()[a];
+ if(!addr.isdeleted() && addr.id() != address.id()) {
+ var node = uEditFindAddrInput('mailing', addr.id());
+ node.checked = true;
+ uEditAddrTypeClick(node, 'mailing');
+ break;
+ }
+ }
+ }
}
@@ -638,17 +638,17 @@ function uEditApproveAddr( tbody, row, address ) {
var oldId = r.getResultObject();
if(oldId != null) {
// remove the replaced address
- patron.addresses(
- grep( patron.addresses(),
- function(i) { return (i.id() != oldId); }
- )
- );
+ patron.addresses(
+ grep( patron.addresses(),
+ function(i) { return (i.id() != oldId); }
+ )
+ );
// update the ID on the new address
address.id(oldId);
address.replaces(null);
address.pending('f');
removeChildren($('ue_address_tbody'));
- uEditBuildAddrs(patron);
+ uEditBuildAddrs(patron);
}
}
);
@@ -657,31 +657,31 @@ function uEditApproveAddr( tbody, row, address ) {
function uEditFindAddrInput(type, id) {
- var tbody = $('ue_address_tbody');
- var rows = tbody.getElementsByTagName('tr');
- for( var r in rows ) {
- var row = rows[r];
- if(row.parentNode != tbody) continue;
- var node = $n(row, 'ue_addr_'+type+'_yes');
- if( node.getAttribute('address') == id )
- return node;
- }
+ var tbody = $('ue_address_tbody');
+ var rows = tbody.getElementsByTagName('tr');
+ for( var r in rows ) {
+ var row = rows[r];
+ if(row.parentNode != tbody) continue;
+ var node = $n(row, 'ue_addr_'+type+'_yes');
+ if( node.getAttribute('address') == id )
+ return node;
+ }
}
function uEditAddrTypeClick(input, type) {
- var tbody = $('ue_address_tbody');
- var rows = tbody.getElementsByTagName('tr');
- for( var r in rows ) {
- var row = rows[r];
- if(row.parentNode != tbody) continue;
- var node = $n(row, 'ue_addr_'+type+'_yes');
- removeCSSClass(node.parentNode,'addr_info_checked');
- }
-
- addCSSClass(input.parentNode,'addr_info_checked');
- patron[type+'_address'](input.getAttribute('address'));
- patron.ischanged(1);
+ var tbody = $('ue_address_tbody');
+ var rows = tbody.getElementsByTagName('tr');
+ for( var r in rows ) {
+ var row = rows[r];
+ if(row.parentNode != tbody) continue;
+ var node = $n(row, 'ue_addr_'+type+'_yes');
+ removeCSSClass(node.parentNode,'addr_info_checked');
+ }
+
+ addCSSClass(input.parentNode,'addr_info_checked');
+ patron[type+'_address'](input.getAttribute('address'));
+ patron.ischanged(1);
}
@@ -690,12 +690,12 @@ function uEditAddrTypeClick(input, type) {
/* Creates the field entries for an address object. */
function uEditBuildAddrFields(patron, address) {
- var tbody = $('ue_address_tbody');
+ var tbody = $('ue_address_tbody');
- var row = tbody.appendChild(
- uEditAddrTemplate.cloneNode(true));
+ var row = tbody.appendChild(
+ uEditAddrTemplate.cloneNode(true));
- uEditCheckSharedAddr(patron, address, tbody, row);
+ uEditCheckSharedAddr(patron, address, tbody, row);
// see if this is a pending address
if( isTrue(address.pending()) ) {
@@ -719,271 +719,271 @@ function uEditBuildAddrFields(patron, address) {
}
}
- $n(row, 'ue_addr_delete').onclick =
- function() {
- uEditDeleteAddr(tbody, row, address);
- uEditCheckErrors();
- };
-
- if( patron.billing_address() &&
- address.id() == patron.billing_address().id() )
- $n(row, 'ue_addr_billing_yes').checked = true;
-
- if( patron.mailing_address() &&
- address.id() == patron.mailing_address().id() )
- $n(row, 'ue_addr_mailing_yes').checked = true;
-
- $n(row, 'ue_addr_billing_yes').setAttribute('address', address.id());
- $n(row, 'ue_addr_mailing_yes').setAttribute('address', address.id());
-
- /* currently, non-owners cannot edit an address */
- var disabled = (address.usr() != patron.id())
-
- var fields = [
- {
- required : false,
- object : address,
- key : 'address_type',
- widget : {
- base : row,
- name : 'ue_addr_label',
- type : 'input',
- disabled : disabled,
- }
- },
- {
- required : true,
- object : address,
- key : 'street1',
- errkey : 'ue_bad_addr_street',
- widget : {
- base : row,
- name : 'ue_addr_street1',
- type : 'input',
- disabled : disabled,
- }
- },
- {
- required : false,
- object : address,
- key : 'street2',
- errkey : 'ue_bad_addr_street',
- widget : {
- base : row,
- name : 'ue_addr_street2',
- type : 'input',
- disabled : disabled,
- }
- },
- {
- required : true,
- object : address,
- key : 'city',
- errkey : 'ue_bad_addr_city',
- widget : {
- base : row,
- name : 'ue_addr_city',
- type : 'input',
- disabled : disabled,
- }
- },
- {
- required : false,
- object : address,
- key : 'county',
- widget : {
- base : row,
- name : 'ue_addr_county',
- type : 'input',
- disabled : disabled,
- }
- },
- {
- required : true,
- object : address,
- key : 'state',
- errkey : 'ue_bad_addr_state',
- widget : {
- base : row,
- name : 'ue_addr_state',
- type : 'input',
- disabled : disabled,
- }
- },
- {
- required : true,
- object : address,
- key : 'country',
- errkey : 'ue_bad_addr_country',
- widget : {
- base : row,
- name : 'ue_addr_country',
- type : 'input',
- disabled : disabled,
- }
- },
- {
- required : true,
- object : address,
- key : 'post_code',
- errkey : 'ue_bad_addr_zip',
- widget : {
- base : row,
- name : 'ue_addr_zip',
- type : 'input',
- disabled : disabled,
- regex : zipRegex,
- onblur : function(f) {
- var v = uEditNodeVal(f);
- var req = new Request(ZIP_SEARCH, v);
- req.callback(
- function(r) {
- var info = r.getResultObject();
- if(!info) return;
- var state = $n(f.widget.base, 'ue_addr_state');
- var county = $n(f.widget.base, 'ue_addr_county');
- var city = $n(f.widget.base, 'ue_addr_city');
- state.value = info.state;
- state.onchange();
- county.value = info.county;
- county.onchange();
- city.value = info.city;
- city.onchange();
- }
- );
- req.send();
- }
- }
- },
- {
- required : false,
- object : address,
- key : 'within_city_limits',
- widget : {
- base : row,
- name : 'ue_addr_inc_yes',
- type : 'checkbox',
- disabled : disabled,
- }
- },
- {
- required : false,
- object : address,
- key : 'valid',
- widget : {
- base : row,
- name : 'ue_addr_valid_yes',
- type : 'checkbox',
- disabled : disabled,
- }
- }
- ];
-
- for( var f in fields ) {
- dataFields.push(fields[f]);
- uEditActivateField(fields[f]);
- }
+ $n(row, 'ue_addr_delete').onclick =
+ function() {
+ uEditDeleteAddr(tbody, row, address);
+ uEditCheckErrors();
+ };
+
+ if( patron.billing_address() &&
+ address.id() == patron.billing_address().id() )
+ $n(row, 'ue_addr_billing_yes').checked = true;
+
+ if( patron.mailing_address() &&
+ address.id() == patron.mailing_address().id() )
+ $n(row, 'ue_addr_mailing_yes').checked = true;
+
+ $n(row, 'ue_addr_billing_yes').setAttribute('address', address.id());
+ $n(row, 'ue_addr_mailing_yes').setAttribute('address', address.id());
+
+ /* currently, non-owners cannot edit an address */
+ var disabled = (address.usr() != patron.id())
+
+ var fields = [
+ {
+ required : false,
+ object : address,
+ key : 'address_type',
+ widget : {
+ base : row,
+ name : 'ue_addr_label',
+ type : 'input',
+ disabled : disabled,
+ }
+ },
+ {
+ required : true,
+ object : address,
+ key : 'street1',
+ errkey : 'ue_bad_addr_street',
+ widget : {
+ base : row,
+ name : 'ue_addr_street1',
+ type : 'input',
+ disabled : disabled,
+ }
+ },
+ {
+ required : false,
+ object : address,
+ key : 'street2',
+ errkey : 'ue_bad_addr_street',
+ widget : {
+ base : row,
+ name : 'ue_addr_street2',
+ type : 'input',
+ disabled : disabled,
+ }
+ },
+ {
+ required : true,
+ object : address,
+ key : 'city',
+ errkey : 'ue_bad_addr_city',
+ widget : {
+ base : row,
+ name : 'ue_addr_city',
+ type : 'input',
+ disabled : disabled,
+ }
+ },
+ {
+ required : false,
+ object : address,
+ key : 'county',
+ widget : {
+ base : row,
+ name : 'ue_addr_county',
+ type : 'input',
+ disabled : disabled,
+ }
+ },
+ {
+ required : true,
+ object : address,
+ key : 'state',
+ errkey : 'ue_bad_addr_state',
+ widget : {
+ base : row,
+ name : 'ue_addr_state',
+ type : 'input',
+ disabled : disabled,
+ }
+ },
+ {
+ required : true,
+ object : address,
+ key : 'country',
+ errkey : 'ue_bad_addr_country',
+ widget : {
+ base : row,
+ name : 'ue_addr_country',
+ type : 'input',
+ disabled : disabled,
+ }
+ },
+ {
+ required : true,
+ object : address,
+ key : 'post_code',
+ errkey : 'ue_bad_addr_zip',
+ widget : {
+ base : row,
+ name : 'ue_addr_zip',
+ type : 'input',
+ disabled : disabled,
+ regex : zipRegex,
+ onblur : function(f) {
+ var v = uEditNodeVal(f);
+ var req = new Request(ZIP_SEARCH, v);
+ req.callback(
+ function(r) {
+ var info = r.getResultObject();
+ if(!info) return;
+ var state = $n(f.widget.base, 'ue_addr_state');
+ var county = $n(f.widget.base, 'ue_addr_county');
+ var city = $n(f.widget.base, 'ue_addr_city');
+ state.value = info.state;
+ state.onchange();
+ county.value = info.county;
+ county.onchange();
+ city.value = info.city;
+ city.onchange();
+ }
+ );
+ req.send();
+ }
+ }
+ },
+ {
+ required : false,
+ object : address,
+ key : 'within_city_limits',
+ widget : {
+ base : row,
+ name : 'ue_addr_inc_yes',
+ type : 'checkbox',
+ disabled : disabled,
+ }
+ },
+ {
+ required : false,
+ object : address,
+ key : 'valid',
+ widget : {
+ base : row,
+ name : 'ue_addr_valid_yes',
+ type : 'checkbox',
+ disabled : disabled,
+ }
+ }
+ ];
+
+ for( var f in fields ) {
+ dataFields.push(fields[f]);
+ uEditActivateField(fields[f]);
+ }
}
function uEditBuildPatronSCM(patron) {
- /* get the list of pre-defined maps */
- var fields = uEditFindFieldsByKey('stat_cat_entry');
- var map;
- var newmaps = [];
-
- /* for each user stat cat, pop it off the list,
- updated the existing stat map field to match
- the popped map and shove the existing stat
- map field onto the user's list of stat maps */
- while( (map = patron.stat_cat_entries().pop()) ) {
-
- var field = grep(fields,
- function(item) {
- return (item.object.stat_cat() == map.stat_cat());
- }
- );
-
- if(field) {
- var val = map.stat_cat_entry();
- field = field[0];
- $n(field.widget.base, field.widget.name).value = val;
- setSelector($n(field.widget.base, 'ue_stat_cat_selector'), val );
- field.object.stat_cat_entry(val);
- field.object.id(map.id());
- newmaps.push(field.object);
- }
- }
-
- for( var m in newmaps )
- patron.stat_cat_entries().push(newmaps[m]);
+ /* get the list of pre-defined maps */
+ var fields = uEditFindFieldsByKey('stat_cat_entry');
+ var map;
+ var newmaps = [];
+
+ /* for each user stat cat, pop it off the list,
+ updated the existing stat map field to match
+ the popped map and shove the existing stat
+ map field onto the user's list of stat maps */
+ while( (map = patron.stat_cat_entries().pop()) ) {
+
+ var field = grep(fields,
+ function(item) {
+ return (item.object.stat_cat() == map.stat_cat());
+ }
+ );
+
+ if(field) {
+ var val = map.stat_cat_entry();
+ field = field[0];
+ $n(field.widget.base, field.widget.name).value = val;
+ setSelector($n(field.widget.base, 'ue_stat_cat_selector'), val );
+ field.object.stat_cat_entry(val);
+ field.object.id(map.id());
+ newmaps.push(field.object);
+ }
+ }
+
+ for( var m in newmaps )
+ patron.stat_cat_entries().push(newmaps[m]);
}
function uEditBuildSCMField(statcat, row) {
- var map = new actscecm();
- map.stat_cat(statcat.id());
- map.target_usr(patron.id());
-
- var field = {
- required : false,
- object : map,
- key : 'stat_cat_entry',
- widget : {
- base : row,
- name : 'ue_stat_cat_newval',
- type : 'input',
-
- onpostchange : function( field, newval ) {
-
- /* see if the current map already resides in
- the patron entry list */
- var exists = grep( patron.stat_cat_entries(),
- function(item) {
- return (item.stat_cat() == statcat.id());
- }
- );
-
- if(newval) {
- map.isdeleted(0);
- setSelector($n(row, 'ue_stat_cat_selector'), newval);
- }
-
- if(exists) {
- if(!newval) {
-
- /* if the map is new but currently contains no value
- remove it from the set of new maps */
- if(map.isnew()) {
- patron.stat_cat_entries(
- grep( patron.stat_cat_entries(),
- function(item) {
- return (item.stat_cat() != map.stat_cat());
- }
- )
- );
-
- } else {
- map.isdeleted(1);
- map.ischanged(0);
- }
- }
-
- } else {
-
- /* map does not exist in the map array but now has data */
- if(newval) {
- map.isnew(1);
- if(!patron.stat_cat_entries())
- patron.stat_cat_entries([]);
- patron.stat_cat_entries().push(map);
- }
- }
- }
- }
- }
-
- dataFields.push(field);
+ var map = new actscecm();
+ map.stat_cat(statcat.id());
+ map.target_usr(patron.id());
+
+ var field = {
+ required : false,
+ object : map,
+ key : 'stat_cat_entry',
+ widget : {
+ base : row,
+ name : 'ue_stat_cat_newval',
+ type : 'input',
+
+ onpostchange : function( field, newval ) {
+
+ /* see if the current map already resides in
+ the patron entry list */
+ var exists = grep( patron.stat_cat_entries(),
+ function(item) {
+ return (item.stat_cat() == statcat.id());
+ }
+ );
+
+ if(newval) {
+ map.isdeleted(0);
+ setSelector($n(row, 'ue_stat_cat_selector'), newval);
+ }
+
+ if(exists) {
+ if(!newval) {
+
+ /* if the map is new but currently contains no value
+ remove it from the set of new maps */
+ if(map.isnew()) {
+ patron.stat_cat_entries(
+ grep( patron.stat_cat_entries(),
+ function(item) {
+ return (item.stat_cat() != map.stat_cat());
+ }
+ )
+ );
+
+ } else {
+ map.isdeleted(1);
+ map.ischanged(0);
+ }
+ }
+
+ } else {
+
+ /* map does not exist in the map array but now has data */
+ if(newval) {
+ map.isnew(1);
+ if(!patron.stat_cat_entries())
+ patron.stat_cat_entries([]);
+ patron.stat_cat_entries().push(map);
+ }
+ }
+ }
+ }
+ }
+
+ dataFields.push(field);
}
@@ -991,41 +991,41 @@ function uEditBuildSCMField(statcat, row) {
/** Run this after a new ident type is selected */
function _uEditIdentPostchange(type, field, newval) {
- if(!newval) return;
-
- /* When the ident type is changed, we change the
- regex on the ident_value to match the selected type */
- var vfname = 'ident_value';
- if(type == 'secondary') vfname = 'ident_value2';
- var vfield = uEditFindFieldByKey(vfname);
- var name = identTypesCache[uEditNodeVal(field)].name();
-
- hideMe($(type+'_ident_ssn_help'));
- hideMe($(type+'_ident_dl_help'));
-
- if(name.match(/ssn/i)) {
- vfield.widget.regex = ssnRegex;
- vfield.errkey = 'ue_bad_ident_ssn';
- unHideMe($(type+'_ident_ssn_help'));
-
- } else {
-
- if(name.match(/driver/i)) {
- vfield.widget.regex = dlRegex;
- vfield.errkey = 'ue_bad_ident_dl';
- unHideMe($(type+'_ident_dl_help'));
- if(!uEditNodeVal(vfield))
- vfield.widget.node.value = defaultState + '-';
-
- } else {
- vfield.widget.regex = null;
- vfield.errkey = null;
- }
- }
-
- /* focus then valdate the value field */
- vfield.widget.node.onchange();
- vfield.widget.node.focus();
+ if(!newval) return;
+
+ /* When the ident type is changed, we change the
+ regex on the ident_value to match the selected type */
+ var vfname = 'ident_value';
+ if(type == 'secondary') vfname = 'ident_value2';
+ var vfield = uEditFindFieldByKey(vfname);
+ var name = identTypesCache[uEditNodeVal(field)].name();
+
+ hideMe($(type+'_ident_ssn_help'));
+ hideMe($(type+'_ident_dl_help'));
+
+ if(name.match(/ssn/i)) {
+ vfield.widget.regex = ssnRegex;
+ vfield.errkey = 'ue_bad_ident_ssn';
+ unHideMe($(type+'_ident_ssn_help'));
+
+ } else {
+
+ if(name.match(/driver/i)) {
+ vfield.widget.regex = dlRegex;
+ vfield.errkey = 'ue_bad_ident_dl';
+ unHideMe($(type+'_ident_dl_help'));
+ if(!uEditNodeVal(vfield))
+ vfield.widget.node.value = defaultState + '-';
+
+ } else {
+ vfield.widget.regex = null;
+ vfield.errkey = null;
+ }
+ }
+
+ /* focus then valdate the value field */
+ vfield.widget.node.onchange();
+ vfield.widget.node.focus();
}
@@ -1035,80 +1035,80 @@ function _uEditIdentPostchange(type, field, newval) {
function uEditCheckSharedAddr(patron, address, tbody, row) {
- if( address.isnew() || (patron.isnew() && !clone) ) return;
-
- var req = new Request(FETCH_ADDR_MEMS, SESSION, address.id());
- req.callback(
- function(r) {
-
- var members = r.getResultObject();
- var shared = false;
-
- for( var m in members ) {
- var id = members[m];
-
- if( id != patron.id() ) {
-
- addCSSClass(row.getElementsByTagName('table')[0], 'shared_address');
- unHideMe($n(row, 'shared_row'));
- $n(row, 'ue_addr_delete').disabled = true;
-
- if( address.usr() != patron.id() ) {
- var button = $n(row, 'ue_addr_detach');
- unHideMe(button);
- button.onclick =
- function() { uEditDeleteAddr( tbody, row, address, true ); }
- }
-
- shared = true;
- break;
- }
- }
-
- if( shared ) {
-
- /* if this is a shared address, set the owner field and
- give the staff a chance to edit the owner if it's not this user */
-
- var nnode = $n(row, 'addr_owner_name');
- var link = $n(row, 'addr_owner');
- var id = address.usr();
-
- if( id == patron.id() ) {
-
- nnode.appendChild(text(
- patron.first_given_name() + ' ' + patron.family_name()));
- hideMe($n(row, 'owner_link_div'));
-
- } else {
-
- var ses = cgi.param('ses');
- if (xulG) if (xulG.ses) ses = xulG.ses;
- if (xulG) if (xulG.params) if (xulG.params.ses) ses = xulG.params.ses;
- link.onclick =
- function() { window.xulG.spawn_editor({ses:ses,usr:id}) };
-
- if( userCache[id] ) {
+ if( address.isnew() || (patron.isnew() && !clone) ) return;
+
+ var req = new Request(FETCH_ADDR_MEMS, SESSION, address.id());
+ req.callback(
+ function(r) {
+
+ var members = r.getResultObject();
+ var shared = false;
+
+ for( var m in members ) {
+ var id = members[m];
+
+ if( id != patron.id() ) {
+
+ addCSSClass(row.getElementsByTagName('table')[0], 'shared_address');
+ unHideMe($n(row, 'shared_row'));
+ $n(row, 'ue_addr_delete').disabled = true;
+
+ if( address.usr() != patron.id() ) {
+ var button = $n(row, 'ue_addr_detach');
+ unHideMe(button);
+ button.onclick =
+ function() { uEditDeleteAddr( tbody, row, address, true ); }
+ }
+
+ shared = true;
+ break;
+ }
+ }
+
+ if( shared ) {
+
+ /* if this is a shared address, set the owner field and
+ give the staff a chance to edit the owner if it's not this user */
+
+ var nnode = $n(row, 'addr_owner_name');
+ var link = $n(row, 'addr_owner');
+ var id = address.usr();
+
+ if( id == patron.id() ) {
+
+ nnode.appendChild(text(
+ patron.first_given_name() + ' ' + patron.family_name()));
+ hideMe($n(row, 'owner_link_div'));
+
+ } else {
+
+ var ses = cgi.param('ses');
+ if (xulG) if (xulG.ses) ses = xulG.ses;
+ if (xulG) if (xulG.params) if (xulG.params.ses) ses = xulG.params.ses;
+ link.onclick =
+ function() { window.xulG.spawn_editor({ses:ses,usr:id}) };
+
+ if( userCache[id] ) {
var usr = userCache[id];
- nnode.appendChild(text(
- usr.first_given_name() + ' ' + usr.family_name()));
-
- } else {
-
- fetchFleshedUser( id,
- function(usr) {
- userCache[usr.id()] = usr;
- nnode.appendChild(text(
- usr.first_given_name() + ' ' + usr.family_name()));
- }
- );
- }
- }
- }
- }
- );
-
- req.send();
+ nnode.appendChild(text(
+ usr.first_given_name() + ' ' + usr.family_name()));
+
+ } else {
+
+ fetchFleshedUser( id,
+ function(usr) {
+ userCache[usr.id()] = usr;
+ nnode.appendChild(text(
+ usr.first_given_name() + ' ' + usr.family_name()));
+ }
+ );
+ }
+ }
+ }
+ }
+ );
+
+ req.send();
}
@@ -1117,7 +1117,7 @@ function uEditCheckSharedAddr(patron, address, tbody, row) {
var __lastdob;
function uEditCheckDOB(field) {
- var dob = uEditNodeVal(field);
+ var dob = uEditNodeVal(field);
var ident_field = uEditFindFieldByKey('ident_value2');
if(dob) {
@@ -1153,7 +1153,7 @@ function uEditCheckDOB(field) {
unHideMe(ident_field.widget.node.parentNode.parentNode.parentNode);
if( dob < base ) { /* patron is of age */
ident_field.required = false;
- uEditFindFieldByKey('juvenile').widget.node.checked = false;
+ uEditFindFieldByKey('juvenile').widget.node.checked = false;
if(!uEditNodeVal(ident_field))
hideMe(ident_field.widget.node.parentNode.parentNode.parentNode);
return;
@@ -1170,9 +1170,9 @@ function uEditCheckDOB(field) {
unHideMe(ident_field.widget.node.parentNode.parentNode.parentNode);
if(!uEditFindFieldByKey('juvenile').widget.node.checked)
- uEditFindFieldByKey('juvenile').widget.node.checked = true;
- ident_field.required = true;
- uEditCheckErrors();
+ uEditFindFieldByKey('juvenile').widget.node.checked = true;
+ ident_field.required = true;
+ uEditCheckErrors();
}
diff --git a/Open-ILS/xul/staff_client/server/patron/ue_ui.js b/Open-ILS/xul/staff_client/server/patron/ue_ui.js
index afa17ca67e..4bf4967419 100644
--- a/Open-ILS/xul/staff_client/server/patron/ue_ui.js
+++ b/Open-ILS/xul/staff_client/server/patron/ue_ui.js
@@ -1,46 +1,46 @@
/* -----------------------------------------------------------------------
- UI code for the user editor. Handles breaking up the components
- into a wizard-like interface.
- ----------------------------------------------------------------------- */
+ UI code for the user editor. Handles breaking up the components
+ into a wizard-like interface.
+ ----------------------------------------------------------------------- */
var pages = [
- 'uedit_userid',
- 'uedit_contact_info',
- 'uedit_addresses',
- 'uedit_groups',
- 'uedit_stat_cats',
- 'uedit_surveys',
- 'uedit_finalize',
- ];
+ 'uedit_userid',
+ 'uedit_contact_info',
+ 'uedit_addresses',
+ 'uedit_groups',
+ 'uedit_stat_cats',
+ 'uedit_surveys',
+ 'uedit_finalize',
+ ];
/* ID's of objects that should be focused when their page is made visible */
var pageFocus = [
- 'ue_barcode',
- 'ue_email',
- 'ue_addr_label_1',
- 'ue_profile',
- 'ue_stat_cat_selector_1',
- 'ue_survey_selector_1',
- 'ue_view_summary'
+ 'ue_barcode',
+ 'ue_email',
+ 'ue_addr_label_1',
+ 'ue_profile',
+ 'ue_stat_cat_selector_1',
+ 'ue_survey_selector_1',
+ 'ue_view_summary'
];
function uEditNext() {
- var i = _findActive();
- if( i < (pages.length - 1)) uEditShowPage(pages[i+1]);
+ var i = _findActive();
+ if( i < (pages.length - 1)) uEditShowPage(pages[i+1]);
}
function uEditPrev() {
- var i = _findActive();
- if( i > 0 ) uEditShowPage(pages[i-1]);
+ var i = _findActive();
+ if( i > 0 ) uEditShowPage(pages[i-1]);
}
function uEditCheckErrors() {
- var errors = uEditGetErrorStrings();
- if(errors) unHideMe($('ue_errors'));
- else hideMe($('ue_errors'));
+ var errors = uEditGetErrorStrings();
+ if(errors) unHideMe($('ue_errors'));
+ else hideMe($('ue_errors'));
}
/*
@@ -48,51 +48,51 @@ function uEditFetchError(id) { if($(id)) return $(id).innerHTML + "\n"; return "
*/
function uEditShowPage(id) {
- if( id == null ) return;
+ if( id == null ) return;
- for( var p in pages ) {
- var page = pages[p];
- hideMe($(page));
- removeCSSClass($(page+'_label'), 'label_active');
- }
+ for( var p in pages ) {
+ var page = pages[p];
+ hideMe($(page));
+ removeCSSClass($(page+'_label'), 'label_active');
+ }
- var idx = _findPageIdx(id);
+ var idx = _findPageIdx(id);
- unHideMe($(id));
- addCSSClass($(id+'_label'), 'label_active');
- var fpage = pageFocus[idx];
+ unHideMe($(id));
+ addCSSClass($(id+'_label'), 'label_active');
+ var fpage = pageFocus[idx];
- var pnode = $(fpage);
- if( id == 'uedit_addresses' )
- pnode = $n( $('ue_address_tbody').
- getElementsByTagName('tr')[0], 'ue_addr_label');
+ var pnode = $(fpage);
+ if( id == 'uedit_addresses' )
+ pnode = $n( $('ue_address_tbody').
+ getElementsByTagName('tr')[0], 'ue_addr_label');
- if(pnode) {
- pnode.focus();
- try{pnode.select()}catch(e){}
- }
+ if(pnode) {
+ pnode.focus();
+ try{pnode.select()}catch(e){}
+ }
- unHideMe($('ue_back'));
- unHideMe($('ue_fwd'));
+ unHideMe($('ue_back'));
+ unHideMe($('ue_fwd'));
- if(idx == 0) hideMe($('ue_back'));
- if(idx == (pages.length-1)) hideMe($('ue_fwd'));
+ if(idx == 0) hideMe($('ue_back'));
+ if(idx == (pages.length-1)) hideMe($('ue_fwd'));
}
function _findActive() {
- for( var p in pages ) {
- if(! $(pages[p]).className.match(/hide_me/) )
- return parseInt(p);
- }
- return null;
+ for( var p in pages ) {
+ if(! $(pages[p]).className.match(/hide_me/) )
+ return parseInt(p);
+ }
+ return null;
}
function _findPageIdx(name) {
- for( var i in pages ) {
- var page = pages[i];
- if( page == name ) return i;
- }
- return -1;
+ for( var i in pages ) {
+ var page = pages[i];
+ if( page == name ) return i;
+ }
+ return -1;
}
/* ------------------------------------------------------------------------------ */
@@ -102,202 +102,202 @@ function _findPageIdx(name) {
/* org selector */
function uEditBuildLibSelector( node, depth, selector ) {
- if(!selector) selector = $('ue_org_selector');
- if(!node) { depth = 0; node = globalOrgTree; }
- var opt = insertSelectorVal(
- selector, -1, node.name(), node.id(), null, depth++ );
- if(!findOrgType(node.ou_type()).can_have_users()) opt.disabled = true;
- if( node.id() == USER.ws_ou() )
- setSelector(selector, node.id());
-
- for( var c in node.children() )
- uEditBuildLibSelector(node.children()[c], depth, selector);
+ if(!selector) selector = $('ue_org_selector');
+ if(!node) { depth = 0; node = globalOrgTree; }
+ var opt = insertSelectorVal(
+ selector, -1, node.name(), node.id(), null, depth++ );
+ if(!findOrgType(node.ou_type()).can_have_users()) opt.disabled = true;
+ if( node.id() == USER.ws_ou() )
+ setSelector(selector, node.id());
+
+ for( var c in node.children() )
+ uEditBuildLibSelector(node.children()[c], depth, selector);
}
/* group tree selector */
function uEditDrawGroups(tree, depth, selector, drawme) {
- if(!selector) {
- selector = $('ue_profile');
- depth = 0;
- }
- groupsCache[tree.id()] = tree;
-
- /* if the staff does not have perms to access this group,
- remove it from the tree and don't add it's children */
- var perm = uEditFindGroupPerm(tree);
- var org = PERMS[perm];
- if( org == -1 ) drawme = false;
-
- if( drawme ) {
- var opt = insertSelectorVal( selector, -1, tree.name(), tree.id(), null, depth++ );
- if(!isTrue(tree.usergroup())) opt.disabled = true;
- }
-
- for( var c in tree.children() )
- uEditDrawGroups( tree.children()[c], depth, selector, drawme );
+ if(!selector) {
+ selector = $('ue_profile');
+ depth = 0;
+ }
+ groupsCache[tree.id()] = tree;
+
+ /* if the staff does not have perms to access this group,
+ remove it from the tree and don't add it's children */
+ var perm = uEditFindGroupPerm(tree);
+ var org = PERMS[perm];
+ if( org == -1 ) drawme = false;
+
+ if( drawme ) {
+ var opt = insertSelectorVal( selector, -1, tree.name(), tree.id(), null, depth++ );
+ if(!isTrue(tree.usergroup())) opt.disabled = true;
+ }
+
+ for( var c in tree.children() )
+ uEditDrawGroups( tree.children()[c], depth, selector, drawme );
}
function uEditFindGroupPerm(group) {
- if(!group) return null;
- if( group.application_perm() )
- return group.application_perm();
- return uEditFindGroupPerm(groupsCache[group.parent()]);
+ if(!group) return null;
+ if( group.application_perm() )
+ return group.application_perm();
+ return uEditFindGroupPerm(groupsCache[group.parent()]);
}
/* user identification types */
function uEditDrawIDTypes(types) {
- var pri_sel = $('ue_primary_ident_type');
- //var sec_sel = $('ue_secondary_ident_type');
- var idx = 1;
- for( var t in types ) {
- var type = types[t];
- if(!type.name()) continue;
- identTypesCache[type.id()] = type;
- setSelectorVal( pri_sel, idx, type.name(), type.id() );
- //setSelectorVal( sec_sel, idx++, type.name(), type.id() );
- idx++;
- }
+ var pri_sel = $('ue_primary_ident_type');
+ //var sec_sel = $('ue_secondary_ident_type');
+ var idx = 1;
+ for( var t in types ) {
+ var type = types[t];
+ if(!type.name()) continue;
+ identTypesCache[type.id()] = type;
+ setSelectorVal( pri_sel, idx, type.name(), type.id() );
+ //setSelectorVal( sec_sel, idx++, type.name(), type.id() );
+ idx++;
+ }
}
/* user statistical catagories */
function uEditDrawStatCats(cats) {
- var tbody = $('ue_stat_cat_tbody');
- var templ = tbody.removeChild($('ue_stat_cat_row'));
-
- for( var c in cats ) {
- var row = templ.cloneNode(true);
- uEditInsertCat( row, cats[c], c );
- tbody.appendChild(row);
- }
+ var tbody = $('ue_stat_cat_tbody');
+ var templ = tbody.removeChild($('ue_stat_cat_row'));
+
+ for( var c in cats ) {
+ var row = templ.cloneNode(true);
+ uEditInsertCat( row, cats[c], c );
+ tbody.appendChild(row);
+ }
}
function uEditInsertCat( row, cat, idx ) {
- cat.entries().sort( /* sort the entries by value */
- function( a, b ) {
- if( !a.value() ) return -1;
- if( !b.value() ) return 1;
- if( (a.value()+'').toLowerCase() > (b.value()+'').toLowerCase()) return 1;
- if( (a.value()+'').toLowerCase() < (b.value()+'').toLowerCase()) return -1;
- return 0;
- }
- );
+ cat.entries().sort( /* sort the entries by value */
+ function( a, b ) {
+ if( !a.value() ) return -1;
+ if( !b.value() ) return 1;
+ if( (a.value()+'').toLowerCase() > (b.value()+'').toLowerCase()) return 1;
+ if( (a.value()+'').toLowerCase() < (b.value()+'').toLowerCase()) return -1;
+ return 0;
+ }
+ );
- statCatsCache[cat.id()] = cat;
+ statCatsCache[cat.id()] = cat;
- /* register the new map object */
- uEditBuildSCMField(cat, row);
+ /* register the new map object */
+ uEditBuildSCMField(cat, row);
- var newval = $n(row, 'ue_stat_cat_newval');
- var selector = $n(row, 'ue_stat_cat_selector');
+ var newval = $n(row, 'ue_stat_cat_newval');
+ var selector = $n(row, 'ue_stat_cat_selector');
- selector.onchange = function() {
- newval.value = getSelectorVal(selector);
- if(newval.onchange) newval.onchange();
- }
+ selector.onchange = function() {
+ newval.value = getSelectorVal(selector);
+ if(newval.onchange) newval.onchange();
+ }
- if( idx == 0 ) selector.id = 'ue_stat_cat_selector_1';
+ if( idx == 0 ) selector.id = 'ue_stat_cat_selector_1';
- $n(row, 'ue_stat_cat_name').appendChild(text(cat.name()));
- $n(row, 'ue_stat_cat_owner').appendChild(
- text(fetchOrgUnit(cat.owner()).shortname()));
+ $n(row, 'ue_stat_cat_name').appendChild(text(cat.name()));
+ $n(row, 'ue_stat_cat_owner').appendChild(
+ text(fetchOrgUnit(cat.owner()).shortname()));
- for( var e in cat.entries() ) {
- var entry = cat.entries()[e];
- setSelectorVal( selector,
- (parseInt(e)+1), entry.value(), entry.value() );
- }
+ for( var e in cat.entries() ) {
+ var entry = cat.entries()[e];
+ setSelectorVal( selector,
+ (parseInt(e)+1), entry.value(), entry.value() );
+ }
}
/* draw the surveys */
function uEditDrawSurveys(surveys) {
- var div = $('uedit_surveys');
- var table = div.removeChild($('ue_survey_table'));
- if( surveys.length == 0 ) unHideMe($('uedit_no_surveys'));
-
- for( var s in surveys ) {
- var survey = surveys[s];
- surveysCache[survey.id()] = survey;
- var clone = table.cloneNode(true);
- uEditInsertSurvey( div, clone, survey, s );
- div.appendChild(clone);
- }
+ var div = $('uedit_surveys');
+ var table = div.removeChild($('ue_survey_table'));
+ if( surveys.length == 0 ) unHideMe($('uedit_no_surveys'));
+
+ for( var s in surveys ) {
+ var survey = surveys[s];
+ surveysCache[survey.id()] = survey;
+ var clone = table.cloneNode(true);
+ uEditInsertSurvey( div, clone, survey, s );
+ div.appendChild(clone);
+ }
}
/* insert the servey then insert each of that surveys questions */
function uEditInsertSurvey( div, table, survey, sidx ) {
- $n(table, 'ue_survey_name').appendChild(text(survey.name()));
- $n(table, 'ue_survey_desc').appendChild(text(survey.description()));
+ $n(table, 'ue_survey_name').appendChild(text(survey.name()));
+ $n(table, 'ue_survey_desc').appendChild(text(survey.description()));
- var tbody = $n(table, 'ue_survey_tbody');
- var templ = tbody.removeChild($n(table, 'ue_survey_row'));
+ var tbody = $n(table, 'ue_survey_tbody');
+ var templ = tbody.removeChild($n(table, 'ue_survey_row'));
- for( var q in survey.questions() ) {
- var row = templ.cloneNode(true);
- var quest = survey.questions()[q];
- uEditInsertSurveyQuestion( row, survey, quest );
- tbody.appendChild(row);
- }
+ for( var q in survey.questions() ) {
+ var row = templ.cloneNode(true);
+ var quest = survey.questions()[q];
+ uEditInsertSurveyQuestion( row, survey, quest );
+ tbody.appendChild(row);
+ }
}
function uEditInsertSurveyQuestion( row, survey, question ) {
- var selector = $n(row, 'ue_survey_answer');
- row.setAttribute('question', question.id());
- $n(row, 'ue_survey_question').appendChild(text(question.question()));
+ var selector = $n(row, 'ue_survey_answer');
+ row.setAttribute('question', question.id());
+ $n(row, 'ue_survey_question').appendChild(text(question.question()));
- for( var a in question.answers() ) {
- var answer = question.answers()[a];
- surveyAnswersCache[answer.id()] = answer;
- insertSelectorVal(selector, -1, answer.answer(), answer.id() );
- }
+ for( var a in question.answers() ) {
+ var answer = question.answers()[a];
+ surveyAnswersCache[answer.id()] = answer;
+ insertSelectorVal(selector, -1, answer.answer(), answer.id() );
+ }
- surveyQuestionsCache[question.id()] = question;
+ surveyQuestionsCache[question.id()] = question;
- if( patron.isnew() && isTrue(survey.required()) )
- addCSSClass(selector, 'invalid_value');
+ if( patron.isnew() && isTrue(survey.required()) )
+ addCSSClass(selector, 'invalid_value');
- selector.onchange = function() {
+ selector.onchange = function() {
- /* remove any existing responses for this survey */
- patron.survey_responses(
- grep( patron.survey_responses(),
- function(item) {
- return (item.survey() != survey.id());
- }
- )
- );
+ /* remove any existing responses for this survey */
+ patron.survey_responses(
+ grep( patron.survey_responses(),
+ function(item) {
+ return (item.survey() != survey.id());
+ }
+ )
+ );
- if(!patron.survey_responses())
- patron.survey_responses([]);
+ if(!patron.survey_responses())
+ patron.survey_responses([]);
- var val = getSelectorVal(selector);
+ var val = getSelectorVal(selector);
- if( patron.isnew() && isTrue(survey.required()) ) {
- if(val)
- removeCSSClass(selector, 'invalid_value');
- else
- addCSSClass(selector, 'invalid_value');
- uEditCheckErrors();
- }
+ if( patron.isnew() && isTrue(survey.required()) ) {
+ if(val)
+ removeCSSClass(selector, 'invalid_value');
+ else
+ addCSSClass(selector, 'invalid_value');
+ uEditCheckErrors();
+ }
- if(!val) return;
+ if(!val) return;
- var resp = new asvr();
- resp.isnew(1);
- resp.survey(survey.id());
- resp.usr(patron.id());
- resp.question(row.getAttribute('question'));
- resp.answer(val);
- patron.survey_responses().push( resp );
- }
+ var resp = new asvr();
+ resp.isnew(1);
+ resp.survey(survey.id());
+ resp.usr(patron.id());
+ resp.question(row.getAttribute('question'));
+ resp.answer(val);
+ patron.survey_responses().push( resp );
+ }
}
@@ -305,41 +305,41 @@ function uEditInsertSurveyQuestion( row, survey, question ) {
/* -----------------------------------------------------------------------
- Spit out the patron info to the summary display tables...
- ----------------------------------------------------------------------- */
+ Spit out the patron info to the summary display tables...
+ ----------------------------------------------------------------------- */
function uEditShowSummary() {
- hideMe($('main_div_container'));
- unHideMe($('summary_div_container'));
+ hideMe($('main_div_container'));
+ unHideMe($('summary_div_container'));
- for( var f in dataFields ) {
+ for( var f in dataFields ) {
- var field = dataFields[f];
- if( field.object == patron ) {
+ var field = dataFields[f];
+ if( field.object == patron ) {
- var val = uEditNodeVal(field);
+ var val = uEditNodeVal(field);
- if( field.key == 'profile' ||
- field.key == 'home_ou' ||
- field.key == 'ident_type' ||
- field.key == 'ident_type2') {
+ if( field.key == 'profile' ||
+ field.key == 'home_ou' ||
+ field.key == 'ident_type' ||
+ field.key == 'ident_type2') {
- val = getSelectorName($(field.widget.id));
- }
+ val = getSelectorName($(field.widget.id));
+ }
- var node = $('ue_summary_'+field.key);
- if(node) appendClear(node, text(val));
- }
+ var node = $('ue_summary_'+field.key);
+ if(node) appendClear(node, text(val));
+ }
- if( field.object == patron.card() )
- appendClear($('ue_summary_barcode'), text(uEditNodeVal(field)));
+ if( field.object == patron.card() )
+ appendClear($('ue_summary_barcode'), text(uEditNodeVal(field)));
- }
+ }
- var table = $('ue_summary_table');
- uEditFleshSummaryAddresses( table, patron );
- uEditFleshSummaryStatCats( table, patron );
- uEditFleshSummarySurveys( table, patron );
+ var table = $('ue_summary_table');
+ uEditFleshSummaryAddresses( table, patron );
+ uEditFleshSummaryStatCats( table, patron );
+ uEditFleshSummarySurveys( table, patron );
}
@@ -347,76 +347,76 @@ function uEditShowSummary() {
var uEditSummaryAddrRow;
function uEditFleshSummaryAddresses( table, patron ) {
- var addrtbody = $n(table, 'ue_summary_addr_tbody');
- if(!uEditSummaryAddrRow)
- uEditSummaryAddrRow =
- addrtbody.removeChild($n(addrtbody, 'ue_summary_addr_row'));
- var rowtmpl = uEditSummaryAddrRow;
- removeChildren(addrtbody);
-
- for( var a in patron.addresses() ) {
- var address = patron.addresses()[a];
- var row = rowtmpl.cloneNode(true);
- uEditFleshSummaryAddr( address, patron, row );
- addrtbody.appendChild(row);
- if(address.isdeleted()) addCSSClass(row, 'deleted');
- }
+ var addrtbody = $n(table, 'ue_summary_addr_tbody');
+ if(!uEditSummaryAddrRow)
+ uEditSummaryAddrRow =
+ addrtbody.removeChild($n(addrtbody, 'ue_summary_addr_row'));
+ var rowtmpl = uEditSummaryAddrRow;
+ removeChildren(addrtbody);
+
+ for( var a in patron.addresses() ) {
+ var address = patron.addresses()[a];
+ var row = rowtmpl.cloneNode(true);
+ uEditFleshSummaryAddr( address, patron, row );
+ addrtbody.appendChild(row);
+ if(address.isdeleted()) addCSSClass(row, 'deleted');
+ }
}
function uEditFleshSummaryAddr( address, patron, row ) {
- var yes = $('yes').innerHTML;
- var no = $('no').innerHTML;
-
- $n(row, 'label').appendChild(text(address.address_type()));
- $n(row, 'street1').appendChild(text(address.street1()));
- $n(row, 'street2').appendChild(text(address.street2()));
- $n(row, 'city').appendChild(text(address.city()));
- $n(row, 'county').appendChild(text(address.county()));
- $n(row, 'state').appendChild(text(address.state()));
- $n(row, 'country').appendChild(text(address.country()));
- $n(row, 'zip').appendChild(text(address.post_code()));
- $n(row, 'valid').appendChild(text( (isTrue(address.valid())) ? yes : no ));
- $n(row, 'incorporated').appendChild(text( (isTrue(address.within_city_limits())) ? yes : no ));
-
- var mid = patron.mailing_address();
- if( typeof patron.mailing_address() == 'object' )
- mid = patron.mailing_address().id();
- $n(row, 'mailing').appendChild(text((mid == address.id()) ? yes : no ));
-
- var bid = patron.billing_address();
- if( typeof patron.billing_address() == 'object' )
- bid = patron.billing_address().id();
- $n(row, 'billing').appendChild(text((bid == address.id()) ? yes : no ));
+ var yes = $('yes').innerHTML;
+ var no = $('no').innerHTML;
+
+ $n(row, 'label').appendChild(text(address.address_type()));
+ $n(row, 'street1').appendChild(text(address.street1()));
+ $n(row, 'street2').appendChild(text(address.street2()));
+ $n(row, 'city').appendChild(text(address.city()));
+ $n(row, 'county').appendChild(text(address.county()));
+ $n(row, 'state').appendChild(text(address.state()));
+ $n(row, 'country').appendChild(text(address.country()));
+ $n(row, 'zip').appendChild(text(address.post_code()));
+ $n(row, 'valid').appendChild(text( (isTrue(address.valid())) ? yes : no ));
+ $n(row, 'incorporated').appendChild(text( (isTrue(address.within_city_limits())) ? yes : no ));
+
+ var mid = patron.mailing_address();
+ if( typeof patron.mailing_address() == 'object' )
+ mid = patron.mailing_address().id();
+ $n(row, 'mailing').appendChild(text((mid == address.id()) ? yes : no ));
+
+ var bid = patron.billing_address();
+ if( typeof patron.billing_address() == 'object' )
+ bid = patron.billing_address().id();
+ $n(row, 'billing').appendChild(text((bid == address.id()) ? yes : no ));
}
var uEditSummaryStatCatRow;
function uEditFleshSummaryStatCats( table, patron ) {
- var tbody = $n(table, 'ue_summary_stats_tbody');
-
- if(!uEditSummaryStatCatRow)
- uEditSummaryStatCatRow =
- tbody.removeChild($n(tbody, 'ue_summary_stats_row'));
- var rowtmpl = uEditSummaryStatCatRow;
- removeChildren(tbody);
-
- for( var s in patron.stat_cat_entries() ) {
- row = rowtmpl.cloneNode(true);
- var entry = patron.stat_cat_entries()[s];
- var cat = statCatsCache[entry.stat_cat()];
- $n(row, 'ue_summary_stat_name').appendChild(text(cat.name()));
- $n(row, 'ue_summary_stat_value').appendChild(text(entry.stat_cat_entry()));
- row.setAttribute('statcat', entry.stat_cat());
- if( entry.isdeleted() ) addCSSClass(row, 'deleted');
- tbody.appendChild(row);
- }
-
- if( ! getElementsByTagNameFlat( tbody, 'tr' )[0] )
- hideMe(tbody.parentNode);
- else
- unHideMe(tbody.parentNode);
+ var tbody = $n(table, 'ue_summary_stats_tbody');
+
+ if(!uEditSummaryStatCatRow)
+ uEditSummaryStatCatRow =
+ tbody.removeChild($n(tbody, 'ue_summary_stats_row'));
+ var rowtmpl = uEditSummaryStatCatRow;
+ removeChildren(tbody);
+
+ for( var s in patron.stat_cat_entries() ) {
+ row = rowtmpl.cloneNode(true);
+ var entry = patron.stat_cat_entries()[s];
+ var cat = statCatsCache[entry.stat_cat()];
+ $n(row, 'ue_summary_stat_name').appendChild(text(cat.name()));
+ $n(row, 'ue_summary_stat_value').appendChild(text(entry.stat_cat_entry()));
+ row.setAttribute('statcat', entry.stat_cat());
+ if( entry.isdeleted() ) addCSSClass(row, 'deleted');
+ tbody.appendChild(row);
+ }
+
+ if( ! getElementsByTagNameFlat( tbody, 'tr' )[0] )
+ hideMe(tbody.parentNode);
+ else
+ unHideMe(tbody.parentNode);
}
@@ -424,41 +424,41 @@ function uEditFleshSummaryStatCats( table, patron ) {
var uEditSummarySurveyRow;
function uEditFleshSummarySurveys( table, patron ) {
- var tbody = $n(table, 'ue_summary_survey_tbody');
- if(!uEditSummarySurveyRow)
- uEditSummarySurveyRow =
- tbody.removeChild($n(tbody, 'ue_summary_survey_row'));
- var rowtmpl = uEditSummarySurveyRow;
-
- removeChildren(tbody);
-
- for( var r in patron.survey_responses() ) {
- var row = rowtmpl.cloneNode(true);
- var resp = patron.survey_responses()[r];
- var survey = surveysCache[resp.survey()];
- var quest = surveyQuestionsCache[resp.question()];
- var answer = surveyAnswersCache[resp.answer()];
- $n(row, 'ue_summary_survey_name').appendChild(text(survey.name()));
- $n(row, 'ue_summary_survey_question').appendChild(text(quest.question()));
- $n(row, 'ue_summary_survey_answer').appendChild(text(answer.answer()));
- tbody.appendChild(row);
- }
-
- if( ! getElementsByTagNameFlat(tbody, 'tr')[0])
- hideMe(tbody.parentNode);
- else
- unHideMe(tbody.parentNode);
+ var tbody = $n(table, 'ue_summary_survey_tbody');
+ if(!uEditSummarySurveyRow)
+ uEditSummarySurveyRow =
+ tbody.removeChild($n(tbody, 'ue_summary_survey_row'));
+ var rowtmpl = uEditSummarySurveyRow;
+
+ removeChildren(tbody);
+
+ for( var r in patron.survey_responses() ) {
+ var row = rowtmpl.cloneNode(true);
+ var resp = patron.survey_responses()[r];
+ var survey = surveysCache[resp.survey()];
+ var quest = surveyQuestionsCache[resp.question()];
+ var answer = surveyAnswersCache[resp.answer()];
+ $n(row, 'ue_summary_survey_name').appendChild(text(survey.name()));
+ $n(row, 'ue_summary_survey_question').appendChild(text(quest.question()));
+ $n(row, 'ue_summary_survey_answer').appendChild(text(answer.answer()));
+ tbody.appendChild(row);
+ }
+
+ if( ! getElementsByTagNameFlat(tbody, 'tr')[0])
+ hideMe(tbody.parentNode);
+ else
+ unHideMe(tbody.parentNode);
}
function uEditDrawNetLevels(netLevels) {
- var sel = $('ue_net_level');
- iterate( netLevels,
- function(i) {
- insertSelectorVal( sel, -1, i.name(), i.id() );
- }
- );
- setSelector(sel, defaultNetLevel);
+ var sel = $('ue_net_level');
+ iterate( netLevels,
+ function(i) {
+ insertSelectorVal( sel, -1, i.name(), i.id() );
+ }
+ );
+ setSelector(sel, defaultNetLevel);
}
diff --git a/Open-ILS/xul/staff_client/server/patron/user_edit.js b/Open-ILS/xul/staff_client/server/patron/user_edit.js
index cf1999ce13..8ce5769869 100644
--- a/Open-ILS/xul/staff_client/server/patron/user_edit.js
+++ b/Open-ILS/xul/staff_client/server/patron/user_edit.js
@@ -48,432 +48,432 @@ function set_work_ou(row) {
}
function set_perm(row) {
- var pid = findNodeByName(row,'p.code').getAttribute('permid');
- var papply = findNodeByName(row,'p.id').checked;
- var pdepth = findNodeByName(row,'p.depth').options[findNodeByName(row,'p.depth').selectedIndex].value;
- var pgrant = findNodeByName(row,'p.grantable').checked;
-
- var p;
- for (var i in user_perms) {
- if (user_perms[i].perm() == pid) {
- p = user_perms[i];
- if (papply) {
- p.isdeleted(0);
- p.ischanged(1);
- p.depth(pdepth);
- p.grantable(pgrant ? 1 : 0);
- } else {
- if (p.isnew()) {
- user_perms[i] = null;
- } else {
- p.isdeleted(1);
- }
- }
- break;
- }
- }
-
- if (!p) {
- if (papply) {
- p = new pupm();
- p.isnew(1);
- p.perm(pid);
- p.usr(user.id());
- p.depth('' + pdepth);
- p.grantable(pgrant ? 1 : 0);
-
- user_perms.push(p);
- }
- }
+ var pid = findNodeByName(row,'p.code').getAttribute('permid');
+ var papply = findNodeByName(row,'p.id').checked;
+ var pdepth = findNodeByName(row,'p.depth').options[findNodeByName(row,'p.depth').selectedIndex].value;
+ var pgrant = findNodeByName(row,'p.grantable').checked;
+
+ var p;
+ for (var i in user_perms) {
+ if (user_perms[i].perm() == pid) {
+ p = user_perms[i];
+ if (papply) {
+ p.isdeleted(0);
+ p.ischanged(1);
+ p.depth(pdepth);
+ p.grantable(pgrant ? 1 : 0);
+ } else {
+ if (p.isnew()) {
+ user_perms[i] = null;
+ } else {
+ p.isdeleted(1);
+ }
+ }
+ break;
+ }
+ }
+
+ if (!p) {
+ if (papply) {
+ p = new pupm();
+ p.isnew(1);
+ p.perm(pid);
+ p.usr(user.id());
+ p.depth('' + pdepth);
+ p.grantable(pgrant ? 1 : 0);
+
+ user_perms.push(p);
+ }
+ }
}
function save_user () {
- try {
+ try {
- var save_perms = [];
- for (var i in user_perms) {
- // Group based perm? skip it.
- if (user_perms[i].id() < 0) continue;
+ var save_perms = [];
+ for (var i in user_perms) {
+ // Group based perm? skip it.
+ if (user_perms[i].id() < 0) continue;
- if (user_perms[i].depth() == null) {
- var p;
- for (var j in perm_list) {
- if (perm_list[j].id() == user_perms[i].perm()) {
- p = perm_list[j];
- break;
- }
- }
- throw $("patronStrings").getFormattedString('staff.patron.user_edit.save_user.depth_required', [p.code()]);
- }
+ if (user_perms[i].depth() == null) {
+ var p;
+ for (var j in perm_list) {
+ if (perm_list[j].id() == user_perms[i].perm()) {
+ p = perm_list[j];
+ break;
+ }
+ }
+ throw $("patronStrings").getFormattedString('staff.patron.user_edit.save_user.depth_required', [p.code()]);
+ }
- save_perms.push( user_perms[i] );
- }
+ save_perms.push( user_perms[i] );
+ }
- var save_ous = [];
- for (var i in user_work_ous) {
- if (!user_work_ous[i]) continue;
- save_ous.push( user_work_ous[i] );
- }
+ var save_ous = [];
+ for (var i in user_work_ous) {
+ if (!user_work_ous[i]) continue;
+ save_ous.push( user_work_ous[i] );
+ }
- var req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.user.work_ous.update', ses_id, save_ous );
- req.send(true);
- var wok = req.getResultObject();
+ var req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.user.work_ous.update', ses_id, save_ous );
+ req.send(true);
+ var wok = req.getResultObject();
- if (wok.ilsevent) throw wok;
+ if (wok.ilsevent) throw wok;
- req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.user.permissions.update', ses_id, save_perms );
- req.send(true);
- var pok = req.getResultObject();
+ req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.user.permissions.update', ses_id, save_perms );
+ req.send(true);
+ var pok = req.getResultObject();
- if (pok.ilsevent) throw pok;
+ if (pok.ilsevent) throw pok;
- if (pok || wok) {
- alert($("patronStrings").getFormattedString('staff.patron.user_edit.save_user.user_modified_successfully', [user.usrname(), user.card().barcode(), pok, wok]));
- }
+ if (pok || wok) {
+ alert($("patronStrings").getFormattedString('staff.patron.user_edit.save_user.user_modified_successfully', [user.usrname(), user.card().barcode(), pok, wok]));
+ }
- init_editor();
+ init_editor();
- } catch (e) {
- dump( js2JSON( e ));
- alert( js2JSON( e ));
- };
+ } catch (e) {
+ dump( js2JSON( e ));
+ alert( js2JSON( e ));
+ };
- return false;
+ return false;
}
var adv_mode = true;
function apply_adv_mode (root) {
- adv_items = findNodesByClass(root,'advanced');
- for (var i in adv_items) {
- adv_mode ?
- removeCSSClass(adv_items[i], 'hideme') :
- addCSSClass(adv_items[i], 'hideme');
- }
+ adv_items = findNodesByClass(root,'advanced');
+ for (var i in adv_items) {
+ adv_mode ?
+ removeCSSClass(adv_items[i], 'hideme') :
+ addCSSClass(adv_items[i], 'hideme');
+ }
}
function init_editor (u) {
-
- var x = document.getElementById('editor').elements;
-
- cgi = new CGI();
- if (cgi.param('adv')) adv_mode = true;
- try {
- if (xulG) if (xulG.adv) adv_mode = true;
- if (xulG) if (xulG.params) if (xulG.params.adv) adv_mode = true;
- } catch (e) {}
-
- apply_adv_mode(document.getElementById('editor'));
-
- ses_id = cgi.param('ses');
- try {
- if (xulG) if (xulG.ses) ses_id = xulG.ses;
- if (xulG) if (xulG.params) if (xulG.params.ses) ses_id = xulG.params.ses;
- } catch (e) {}
-
- var usr_id = cgi.param('usr');
- try {
- if (xulG) if (xulG.usr_id) usr_id = xulG.usr_id;
- if (xulG) if (xulG.params) if (xulG.params.usr_id) usr_id = xulG.params.usr_id;
- } catch (e) {}
-
- var usr_barcode = cgi.param('barcode');
- try {
- if (xulG) if (xulG.usr_barcode) usr_ibarcode = xulG.usr_barcode;
- if (xulG) if (xulG.params) if (xulG.params.usr_barcode) usr_ibarcode = xulG.params.usr_barcode;
- } catch (e) {}
-
- try {
- var req;
- if (usr_id) {
- req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.user.fleshed.retrieve', ses_id, usr_id );
- } else {
- req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.user.fleshed.retrieve_by_barcode', ses_id, usr_barcode );
- }
- req.send(true);
- user = req.getResultObject();
- } catch (E) {
- alert(E);
- }
-
- if (user.usrname()) x['user.usrname'].value = user.usrname();
- x['user.usrname'].setAttribute('onchange','user.usrname(this.value)');
-
- if (user.card() && user.card().barcode()) x['user.card.barcode'].value = user.card().barcode();
- x['user.card.barcode'].setAttribute('onchange','user.card().barcode(this.value)');
-
- if (user.first_given_name()) x['user.first_given_name'].value = user.first_given_name();
- x['user.first_given_name'].setAttribute('onchange','user.first_given_name(this.value)');
-
- if (user.second_given_name()) x['user.second_given_name'].value = user.second_given_name();
- x['user.second_given_name'].setAttribute('onchange','user.second_given_name(this.value);');
-
- if (user.family_name()) x['user.family_name'].value = user.family_name();
- x['user.family_name'].setAttribute('onchange','user.family_name(this.value)');
-
- // grab the editing staff user object
- req = new RemoteRequest( 'open-ils.auth', 'open-ils.auth.session.retrieve', ses_id );
- req.send(true);
- var staff = req.getResultObject();
-
- req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.permissions.user_perms.retrieve', ses_id );
- req.send(true);
- var staff_perms = req.getResultObject();
-
- // Get the top of the staff perm org for ASSIGN_WORK_ORG_UNIT
- req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.user.perm.highest_org', ses_id, staff.id(), 'ASSIGN_WORK_ORG_UNIT' );
- req.send(true);
- var top_work_ou = req.getResultObject();
-
- // and now, the orgs where this staff member can apply the perms
- req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.org_tree.descendants.retrieve', top_work_ou);
- req.send(true);
- var work_ou_tree = req.getResultObject();
-
- // and now, the orgs where this staff member can apply the perms
- req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.user.get_work_ous', ses_id, user.id());
- req.send(true);
- user_work_ous = req.getResultObject();
-
- // and finally, the ou types
- req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.org_types.retrieve' );
- req.send(true);
- ou_type_list = req.getResultObject();
-
- user_perms = [];
- perm_list = [];
- if (user.id() > 0) {
- req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.permissions.user_perms.retrieve', ses_id, user.id() );
- req.send(true);
- user_perms = req.getResultObject();
-
- req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.permissions.retrieve' );
- req.send(true);
- perm_list = req.getResultObject();
- }
-
- f = document.getElementById('permissions');
- while (f.firstChild) f.removeChild(f.lastChild);
-
- var rcount = 0;
- for (var i in perm_list.sort(function(a,b){ if (a.code() < b.code()) return -1;return 1; }))
- display_perm(f,perm_list[i],staff_perms, rcount++);
-
- f = document.getElementById('work_ous');
- while (f.firstChild) f.removeChild(f.lastChild);
-
- //flatten the ou tree, keep only those with can_hav_users = true
- work_ou_list = [];
- trim_ou_tree( [work_ou_tree], work_ou_list );
-
- rcount = 0;
- for (var i in work_ou_list.sort( function(a,b){ if (a.name() < b.name()) return -1;return 1; }) )
- display_work_ou(f,work_ou_list[i], rcount++);
-
- return true;
+
+ var x = document.getElementById('editor').elements;
+
+ cgi = new CGI();
+ if (cgi.param('adv')) adv_mode = true;
+ try {
+ if (xulG) if (xulG.adv) adv_mode = true;
+ if (xulG) if (xulG.params) if (xulG.params.adv) adv_mode = true;
+ } catch (e) {}
+
+ apply_adv_mode(document.getElementById('editor'));
+
+ ses_id = cgi.param('ses');
+ try {
+ if (xulG) if (xulG.ses) ses_id = xulG.ses;
+ if (xulG) if (xulG.params) if (xulG.params.ses) ses_id = xulG.params.ses;
+ } catch (e) {}
+
+ var usr_id = cgi.param('usr');
+ try {
+ if (xulG) if (xulG.usr_id) usr_id = xulG.usr_id;
+ if (xulG) if (xulG.params) if (xulG.params.usr_id) usr_id = xulG.params.usr_id;
+ } catch (e) {}
+
+ var usr_barcode = cgi.param('barcode');
+ try {
+ if (xulG) if (xulG.usr_barcode) usr_ibarcode = xulG.usr_barcode;
+ if (xulG) if (xulG.params) if (xulG.params.usr_barcode) usr_ibarcode = xulG.params.usr_barcode;
+ } catch (e) {}
+
+ try {
+ var req;
+ if (usr_id) {
+ req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.user.fleshed.retrieve', ses_id, usr_id );
+ } else {
+ req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.user.fleshed.retrieve_by_barcode', ses_id, usr_barcode );
+ }
+ req.send(true);
+ user = req.getResultObject();
+ } catch (E) {
+ alert(E);
+ }
+
+ if (user.usrname()) x['user.usrname'].value = user.usrname();
+ x['user.usrname'].setAttribute('onchange','user.usrname(this.value)');
+
+ if (user.card() && user.card().barcode()) x['user.card.barcode'].value = user.card().barcode();
+ x['user.card.barcode'].setAttribute('onchange','user.card().barcode(this.value)');
+
+ if (user.first_given_name()) x['user.first_given_name'].value = user.first_given_name();
+ x['user.first_given_name'].setAttribute('onchange','user.first_given_name(this.value)');
+
+ if (user.second_given_name()) x['user.second_given_name'].value = user.second_given_name();
+ x['user.second_given_name'].setAttribute('onchange','user.second_given_name(this.value);');
+
+ if (user.family_name()) x['user.family_name'].value = user.family_name();
+ x['user.family_name'].setAttribute('onchange','user.family_name(this.value)');
+
+ // grab the editing staff user object
+ req = new RemoteRequest( 'open-ils.auth', 'open-ils.auth.session.retrieve', ses_id );
+ req.send(true);
+ var staff = req.getResultObject();
+
+ req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.permissions.user_perms.retrieve', ses_id );
+ req.send(true);
+ var staff_perms = req.getResultObject();
+
+ // Get the top of the staff perm org for ASSIGN_WORK_ORG_UNIT
+ req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.user.perm.highest_org', ses_id, staff.id(), 'ASSIGN_WORK_ORG_UNIT' );
+ req.send(true);
+ var top_work_ou = req.getResultObject();
+
+ // and now, the orgs where this staff member can apply the perms
+ req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.org_tree.descendants.retrieve', top_work_ou);
+ req.send(true);
+ var work_ou_tree = req.getResultObject();
+
+ // and now, the orgs where this staff member can apply the perms
+ req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.user.get_work_ous', ses_id, user.id());
+ req.send(true);
+ user_work_ous = req.getResultObject();
+
+ // and finally, the ou types
+ req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.org_types.retrieve' );
+ req.send(true);
+ ou_type_list = req.getResultObject();
+
+ user_perms = [];
+ perm_list = [];
+ if (user.id() > 0) {
+ req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.permissions.user_perms.retrieve', ses_id, user.id() );
+ req.send(true);
+ user_perms = req.getResultObject();
+
+ req = new RemoteRequest( 'open-ils.actor', 'open-ils.actor.permissions.retrieve' );
+ req.send(true);
+ perm_list = req.getResultObject();
+ }
+
+ f = document.getElementById('permissions');
+ while (f.firstChild) f.removeChild(f.lastChild);
+
+ var rcount = 0;
+ for (var i in perm_list.sort(function(a,b){ if (a.code() < b.code()) return -1;return 1; }))
+ display_perm(f,perm_list[i],staff_perms, rcount++);
+
+ f = document.getElementById('work_ous');
+ while (f.firstChild) f.removeChild(f.lastChild);
+
+ //flatten the ou tree, keep only those with can_hav_users = true
+ work_ou_list = [];
+ trim_ou_tree( [work_ou_tree], work_ou_list );
+
+ rcount = 0;
+ for (var i in work_ou_list.sort( function(a,b){ if (a.name() < b.name()) return -1;return 1; }) )
+ display_work_ou(f,work_ou_list[i], rcount++);
+
+ return true;
}
function grep ( code, list ) {
- var ret = [];
- for (var i in list) {
- if (code(list[i])) ret.push(list[i]);
- }
- return ret;
+ var ret = [];
+ for (var i in list) {
+ if (code(list[i])) ret.push(list[i]);
+ }
+ return ret;
}
function trim_ou_tree (tree, list) {
- for (var i in tree) {
- if (!tree[i]) continue;
+ for (var i in tree) {
+ if (!tree[i]) continue;
- var type = grep( function(x) {return x.id() == tree[i].ou_type()}, ou_type_list )[0];
- if ( type && type.can_have_users() == 't' )
- list.push(tree[i]);
+ var type = grep( function(x) {return x.id() == tree[i].ou_type()}, ou_type_list )[0];
+ if ( type && type.can_have_users() == 't' )
+ list.push(tree[i]);
- if (tree[i].children()) trim_ou_tree(tree[i].children(), list);
- }
+ if (tree[i].children()) trim_ou_tree(tree[i].children(), list);
+ }
}
function display_work_ou (root,ou_def,r) {
- var wrow = findNodeByName(document.getElementById('work_ou-tmpl'), 'wrow').cloneNode(true);
- root.appendChild(wrow);
+ var wrow = findNodeByName(document.getElementById('work_ou-tmpl'), 'wrow').cloneNode(true);
+ root.appendChild(wrow);
- var label_cell = findNodeByName(wrow,'label');
- findNodeByName(label_cell,'a.name').appendChild(text(ou_def.name()));
- findNodeByName(label_cell,'a.shortname').appendChild(text(ou_def.shortname()));
- if (r % 2) label_cell.className += ' odd';
+ var label_cell = findNodeByName(wrow,'label');
+ findNodeByName(label_cell,'a.name').appendChild(text(ou_def.name()));
+ findNodeByName(label_cell,'a.shortname').appendChild(text(ou_def.shortname()));
+ if (r % 2) label_cell.className += ' odd';
- var apply_cell = findNodeByName(wrow,'wapply');
- findNodeByName(apply_cell,'a.id').setAttribute('workou_id', ou_def.id());
- if (r % 2) apply_cell.className += ' odd';
+ var apply_cell = findNodeByName(wrow,'wapply');
+ findNodeByName(apply_cell,'a.id').setAttribute('workou_id', ou_def.id());
+ if (r % 2) apply_cell.className += ' odd';
- var has_it = grep(
- function(x){ return x.work_ou() == ou_def.id() },
- user_work_ous
- ).length;
+ var has_it = grep(
+ function(x){ return x.work_ou() == ou_def.id() },
+ user_work_ous
+ ).length;
- findNodeByName(apply_cell,'a.id').checked = has_it > 0 ? true : false;
+ findNodeByName(apply_cell,'a.id').checked = has_it > 0 ? true : false;
}
function display_perm (root,perm_def,staff_perms, r) {
- var prow = findNodeByName(document.getElementById('permission-tmpl'), 'prow').cloneNode(true);
- root.appendChild(prow);
-
- var all = false;
- for (var i in staff_perms) {
- if (staff_perms[i].perm() == -1) {
- all = true;
- break;
- }
- }
-
-
- var sp,up;
- if (!all) {
- for (var i in staff_perms) {
- if (perm_def.id() == staff_perms[i].perm() || staff_perms[i].perm() == -1) {
- sp = staff_perms[i];
- break;
- }
- }
- }
-
- for (var i in user_perms) {
- if (perm_def.id() == user_perms[i].perm())
- up = user_perms[i];
- }
-
-
- var dis = false;
- if ((up && up.id() < 0) || !sp || !sp.grantable()) dis = true;
- if (all) dis = false;
-
- var label_cell = findNodeByName(prow,'plabel');
- findNodeByName(label_cell,'p.code').appendChild(text(perm_def.code()));
- findNodeByName(label_cell,'p.code').setAttribute('title', perm_def.description());
- findNodeByName(label_cell,'p.code').setAttribute('permid', perm_def.id());
- if (r % 2) label_cell.className += ' odd';
-
- var apply_cell = findNodeByName(prow,'papply');
- findNodeByName(apply_cell,'p.id').disabled = dis;
- findNodeByName(apply_cell,'p.id').checked = up ? true : false;
- if (r % 2) apply_cell.className += ' odd';
-
- var depth_cell = findNodeByName(prow,'pdepth');
- findNodeByName(depth_cell,'p.depth').disabled = dis;
- findNodeByName(depth_cell,'p.depth').id = 'perm-depth-' + perm_def.id();
- if (r % 2) depth_cell.className += ' odd';
- selectBuilder(
- 'perm-depth-' + perm_def.id(),
- globalOrgTypes,
- (up ? up.depth() : findOrgDepth(user.home_ou())),
- { label_field : 'name',
- value_field : 'depth',
- empty_label : $("patronStrings").getString('staff.patron.user_edit.display_perm.select_one'),
- empty_value : '',
- clear : true }
- );
-
- var grant_cell = findNodeByName(prow,'pgrant');
- findNodeByName(grant_cell,'p.grantable').disabled = dis;
- findNodeByName(grant_cell,'p.grantable').checked = up ? (up.grantable() ? true : false) : false;
- if (r % 2) grant_cell.className += ' odd';
+ var prow = findNodeByName(document.getElementById('permission-tmpl'), 'prow').cloneNode(true);
+ root.appendChild(prow);
+
+ var all = false;
+ for (var i in staff_perms) {
+ if (staff_perms[i].perm() == -1) {
+ all = true;
+ break;
+ }
+ }
+
+
+ var sp,up;
+ if (!all) {
+ for (var i in staff_perms) {
+ if (perm_def.id() == staff_perms[i].perm() || staff_perms[i].perm() == -1) {
+ sp = staff_perms[i];
+ break;
+ }
+ }
+ }
+
+ for (var i in user_perms) {
+ if (perm_def.id() == user_perms[i].perm())
+ up = user_perms[i];
+ }
+
+
+ var dis = false;
+ if ((up && up.id() < 0) || !sp || !sp.grantable()) dis = true;
+ if (all) dis = false;
+
+ var label_cell = findNodeByName(prow,'plabel');
+ findNodeByName(label_cell,'p.code').appendChild(text(perm_def.code()));
+ findNodeByName(label_cell,'p.code').setAttribute('title', perm_def.description());
+ findNodeByName(label_cell,'p.code').setAttribute('permid', perm_def.id());
+ if (r % 2) label_cell.className += ' odd';
+
+ var apply_cell = findNodeByName(prow,'papply');
+ findNodeByName(apply_cell,'p.id').disabled = dis;
+ findNodeByName(apply_cell,'p.id').checked = up ? true : false;
+ if (r % 2) apply_cell.className += ' odd';
+
+ var depth_cell = findNodeByName(prow,'pdepth');
+ findNodeByName(depth_cell,'p.depth').disabled = dis;
+ findNodeByName(depth_cell,'p.depth').id = 'perm-depth-' + perm_def.id();
+ if (r % 2) depth_cell.className += ' odd';
+ selectBuilder(
+ 'perm-depth-' + perm_def.id(),
+ globalOrgTypes,
+ (up ? up.depth() : findOrgDepth(user.home_ou())),
+ { label_field : 'name',
+ value_field : 'depth',
+ empty_label : $("patronStrings").getString('staff.patron.user_edit.display_perm.select_one'),
+ empty_value : '',
+ clear : true }
+ );
+
+ var grant_cell = findNodeByName(prow,'pgrant');
+ findNodeByName(grant_cell,'p.grantable').disabled = dis;
+ findNodeByName(grant_cell,'p.grantable').checked = up ? (up.grantable() ? true : false) : false;
+ if (r % 2) grant_cell.className += ' odd';
}
function selectBuilder (id, objects, def, args) {
- var label_field = args['label_field'];
- var value_field = args['value_field'];
- var depth = args['depth'];
-
- if (!depth) depth = 0;
-
- args['depth'] = parseInt(depth) + 1;
-
- var child_field_name = args['child_field_name'];
-
- var sel = id;
- if (typeof sel != 'object')
- sel = document.getElementById(sel);
-
- if (args['clear']) {
- for (var o in sel.options) {
- sel.options[o] = null;
- }
- args['clear'] = false;
- if (args['empty_label']) {
- sel.options[0] = new Option( args['empty_label'], args['empty_value'] );
- sel.selectedIndex = 0;
- }
- }
-
- for (var i in objects) {
- var l = objects[i][label_field];
- var v = objects[i][value_field];
-
- if (typeof l == 'function')
- l = objects[i][label_field]();
-
- if (typeof v == 'function')
- v = objects[i][value_field]();
-
- var opt = new Option( l, v );
-
- if (depth) {
- var d = 10 * depth;
- opt.style.paddingLeft = '' + d + 'px';
- }
-
- sel.options[sel.options.length] = opt;
-
-
- if (typeof def == 'object') {
- for (var j in def) {
- if (v == def[j]) {
- opt.selected = true;
- sel.value = v;
- }
- }
- } else {
- if (v == def) {
- opt.selected = true;
- sel.value = v;
- }
- }
-
- if (child_field_name) {
- var c = objects[i][child_field_name];
- if (typeof c == 'function')
- c = objects[i][child_field_name]();
-
- selectBuilder(
- id,
- c,
- def,
- { label_field : args['label_field'],
- value_field : args['value_field'],
- depth : args['depth'],
- child_field_name : args['child_field_name'] }
- );
- }
-
- }
-}
+ var label_field = args['label_field'];
+ var value_field = args['value_field'];
+ var depth = args['depth'];
+
+ if (!depth) depth = 0;
+
+ args['depth'] = parseInt(depth) + 1;
+
+ var child_field_name = args['child_field_name'];
+
+ var sel = id;
+ if (typeof sel != 'object')
+ sel = document.getElementById(sel);
+
+ if (args['clear']) {
+ for (var o in sel.options) {
+ sel.options[o] = null;
+ }
+ args['clear'] = false;
+ if (args['empty_label']) {
+ sel.options[0] = new Option( args['empty_label'], args['empty_value'] );
+ sel.selectedIndex = 0;
+ }
+ }
+
+ for (var i in objects) {
+ var l = objects[i][label_field];
+ var v = objects[i][value_field];
+
+ if (typeof l == 'function')
+ l = objects[i][label_field]();
+
+ if (typeof v == 'function')
+ v = objects[i][value_field]();
+
+ var opt = new Option( l, v );
+
+ if (depth) {
+ var d = 10 * depth;
+ opt.style.paddingLeft = '' + d + 'px';
+ }
+
+ sel.options[sel.options.length] = opt;
+
+
+ if (typeof def == 'object') {
+ for (var j in def) {
+ if (v == def[j]) {
+ opt.selected = true;
+ sel.value = v;
+ }
+ }
+ } else {
+ if (v == def) {
+ opt.selected = true;
+ sel.value = v;
+ }
+ }
+
+ if (child_field_name) {
+ var c = objects[i][child_field_name];
+ if (typeof c == 'function')
+ c = objects[i][child_field_name]();
+
+ selectBuilder(
+ id,
+ c,
+ def,
+ { label_field : args['label_field'],
+ value_field : args['value_field'],
+ depth : args['depth'],
+ child_field_name : args['child_field_name'] }
+ );
+ }
+
+ }
+}
function findNodesByClass(root, nodeClass, list) {
- if(!list) list = [];
+ if(!list) list = [];
if( !root || !nodeClass) {
- return null;
- }
+ return null;
+ }
if(root.nodeType != 1) {
- return null;
- }
+ return null;
+ }
if(root.className.match(nodeClass)) list.push( root );
diff --git a/Open-ILS/xul/staff_client/server/patron/util.js b/Open-ILS/xul/staff_client/server/patron/util.js
index 1769d73b09..f8ac731d54 100644
--- a/Open-ILS/xul/staff_client/server/patron/util.js
+++ b/Open-ILS/xul/staff_client/server/patron/util.js
@@ -3,746 +3,746 @@ dump('entering patron/util.js\n');
if (typeof patron == 'undefined') var patron = {};
patron.util = {};
-patron.util.EXPORT_OK = [
- 'columns', 'mbts_columns', 'mb_columns', 'mp_columns', /*'std_map_row_to_column',*/ 'std_map_row_to_columns',
- 'retrieve_au_via_id', 'retrieve_fleshed_au_via_id', 'retrieve_fleshed_au_via_barcode', 'set_penalty_css', 'retrieve_name_via_id',
+patron.util.EXPORT_OK = [
+ 'columns', 'mbts_columns', 'mb_columns', 'mp_columns', /*'std_map_row_to_column',*/ 'std_map_row_to_columns',
+ 'retrieve_au_via_id', 'retrieve_fleshed_au_via_id', 'retrieve_fleshed_au_via_barcode', 'set_penalty_css', 'retrieve_name_via_id',
'merge', 'ausp_columns', 'format_name'
];
-patron.util.EXPORT_TAGS = { ':all' : patron.util.EXPORT_OK };
+patron.util.EXPORT_TAGS = { ':all' : patron.util.EXPORT_OK };
patron.util.mbts_columns = function(modify,params) {
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
- JSAN.use('util.money'); JSAN.use('util.date');
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+ JSAN.use('util.money'); JSAN.use('util.date');
var commonStrings = document.getElementById('commonStrings');
- var c = [
- {
- 'persist' : 'hidden width ordinal', 'id' : 'mbts_id', 'label' : commonStrings.getString('staff.mbts_id_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mbts.id(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'usr', 'label' : commonStrings.getString('staff.mbts_usr_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mbts.usr() ? "Id = " + my.mbts.usr() : ""; }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'xact_type', 'label' : commonStrings.getString('staff.mbts_xact_type_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mbts.xact_type(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'balance_owed', 'label' : commonStrings.getString('staff.mbts_balance_owed_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return util.money.sanitize( my.mbts.balance_owed() ); },
- 'sort_type' : 'money'
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'total_owed', 'label' : commonStrings.getString('staff.mbts_total_owed_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return util.money.sanitize( my.mbts.total_owed() ); },
- 'sort_type' : 'money'
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'total_paid', 'label' : commonStrings.getString('staff.mbts_total_paid_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return util.money.sanitize( my.mbts.total_paid() ); },
- 'sort_type' : 'money'
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'last_billing_note', 'label' : commonStrings.getString('staff.mbts_last_billing_note_label'), 'flex' : 2,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mbts.last_billing_note(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'last_billing_type', 'label' : commonStrings.getString('staff.mbts_last_billing_type_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mbts.last_billing_type(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'last_billing_ts', 'label' : commonStrings.getString('staff.mbts_last_billing_timestamp_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.mbts.last_billing_ts(), "" ); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'last_payment_note', 'label' : commonStrings.getString('staff.mbts_last_payment_note_label'), 'flex' : 2,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mbts.last_payment_note(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'last_payment_type', 'label' : commonStrings.getString('staff.mbts_last_payment_type_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mbts.last_payment_type(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'last_payment_ts', 'label' : commonStrings.getString('staff.mbts_last_payment_timestamp_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.mbts.last_payment_ts(), "" ); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'xact_start', 'label' : commonStrings.getString('staff.mbts_xact_start_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mbts.xact_start() ? my.mbts.xact_start().toString().substr(0,10) : ""; }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'xact_finish', 'label' : commonStrings.getString('staff.mbts_xact_finish_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mbts.xact_finish() ? my.mbts.xact_finish().toString().substr(0,10) : ""; }
- },
- ];
- for (var i = 0; i < c.length; i++) {
- if (modify[ c[i].id ]) {
- for (var j in modify[ c[i].id ]) {
- c[i][j] = modify[ c[i].id ][j];
- }
- }
- }
- if (params) {
- if (params.just_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < params.just_these.length; i++) {
- var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
- new_c.push( function(y){ return y; }( x ) );
- }
- c = new_c;
- }
- if (params.except_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < c.length; i++) {
- var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
- if (!x) new_c.push(c[i]);
- }
- c = new_c;
- }
- }
- return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
+ var c = [
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'mbts_id', 'label' : commonStrings.getString('staff.mbts_id_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mbts.id(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'usr', 'label' : commonStrings.getString('staff.mbts_usr_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mbts.usr() ? "Id = " + my.mbts.usr() : ""; }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'xact_type', 'label' : commonStrings.getString('staff.mbts_xact_type_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mbts.xact_type(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'balance_owed', 'label' : commonStrings.getString('staff.mbts_balance_owed_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return util.money.sanitize( my.mbts.balance_owed() ); },
+ 'sort_type' : 'money'
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'total_owed', 'label' : commonStrings.getString('staff.mbts_total_owed_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return util.money.sanitize( my.mbts.total_owed() ); },
+ 'sort_type' : 'money'
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'total_paid', 'label' : commonStrings.getString('staff.mbts_total_paid_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return util.money.sanitize( my.mbts.total_paid() ); },
+ 'sort_type' : 'money'
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'last_billing_note', 'label' : commonStrings.getString('staff.mbts_last_billing_note_label'), 'flex' : 2,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mbts.last_billing_note(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'last_billing_type', 'label' : commonStrings.getString('staff.mbts_last_billing_type_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mbts.last_billing_type(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'last_billing_ts', 'label' : commonStrings.getString('staff.mbts_last_billing_timestamp_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.mbts.last_billing_ts(), "" ); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'last_payment_note', 'label' : commonStrings.getString('staff.mbts_last_payment_note_label'), 'flex' : 2,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mbts.last_payment_note(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'last_payment_type', 'label' : commonStrings.getString('staff.mbts_last_payment_type_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mbts.last_payment_type(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'last_payment_ts', 'label' : commonStrings.getString('staff.mbts_last_payment_timestamp_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.mbts.last_payment_ts(), "" ); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'xact_start', 'label' : commonStrings.getString('staff.mbts_xact_start_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mbts.xact_start() ? my.mbts.xact_start().toString().substr(0,10) : ""; }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'xact_finish', 'label' : commonStrings.getString('staff.mbts_xact_finish_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mbts.xact_finish() ? my.mbts.xact_finish().toString().substr(0,10) : ""; }
+ },
+ ];
+ for (var i = 0; i < c.length; i++) {
+ if (modify[ c[i].id ]) {
+ for (var j in modify[ c[i].id ]) {
+ c[i][j] = modify[ c[i].id ][j];
+ }
+ }
+ }
+ if (params) {
+ if (params.just_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < params.just_these.length; i++) {
+ var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
+ new_c.push( function(y){ return y; }( x ) );
+ }
+ c = new_c;
+ }
+ if (params.except_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < c.length; i++) {
+ var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
+ if (!x) new_c.push(c[i]);
+ }
+ c = new_c;
+ }
+ }
+ return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
}
patron.util.mb_columns = function(modify,params) {
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
- JSAN.use('util.money'); JSAN.use('util.date');
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+ JSAN.use('util.money'); JSAN.use('util.date');
var commonStrings = document.getElementById('commonStrings');
- var c = [
- {
- 'persist' : 'hidden width ordinal', 'id' : 'mb_id', 'label' : commonStrings.getString('staff.mb_id_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mb.id(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'voided', 'label' : commonStrings.getString('staff.mb_voided_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return get_bool( my.mb.voided() ) ? "Yes" : "No"; }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'voider', 'label' : commonStrings.getString('staff.mb_voider_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mb.voider() ? "Id = " + my.mb.voider() : ""; }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'void_time', 'label' : commonStrings.getString('staff.mb_void_time_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mb.void_time(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'amount', 'label' : commonStrings.getString('staff.mb_amount_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return util.money.sanitize( my.mb.amount() ); },
- 'sort_type' : 'money'
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'billing_type', 'label' : commonStrings.getString('staff.mb_billing_type_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mb.billing_type(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'billing_ts', 'label' : commonStrings.getString('staff.mb_billing_ts_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.mb.billing_ts(), "" ); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'note', 'label' : commonStrings.getString('staff.mb_note_label'), 'flex' : 2,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mb.note(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'xact', 'label' : commonStrings.getString('staff.mb_xact_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mb.xact(); }
- },
- ];
- for (var i = 0; i < c.length; i++) {
- if (modify[ c[i].id ]) {
- for (var j in modify[ c[i].id ]) {
- c[i][j] = modify[ c[i].id ][j];
- }
- }
- }
- if (params) {
- if (params.just_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < params.just_these.length; i++) {
- var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
- new_c.push( function(y){ return y; }( x ) );
- }
- c = new_c;
- }
- if (params.except_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < c.length; i++) {
- var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
- if (!x) new_c.push(c[i]);
- }
- c = new_c;
- }
-
- }
- return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
+ var c = [
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'mb_id', 'label' : commonStrings.getString('staff.mb_id_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mb.id(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'voided', 'label' : commonStrings.getString('staff.mb_voided_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return get_bool( my.mb.voided() ) ? "Yes" : "No"; }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'voider', 'label' : commonStrings.getString('staff.mb_voider_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mb.voider() ? "Id = " + my.mb.voider() : ""; }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'void_time', 'label' : commonStrings.getString('staff.mb_void_time_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mb.void_time(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'amount', 'label' : commonStrings.getString('staff.mb_amount_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return util.money.sanitize( my.mb.amount() ); },
+ 'sort_type' : 'money'
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'billing_type', 'label' : commonStrings.getString('staff.mb_billing_type_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mb.billing_type(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'billing_ts', 'label' : commonStrings.getString('staff.mb_billing_ts_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.mb.billing_ts(), "" ); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'note', 'label' : commonStrings.getString('staff.mb_note_label'), 'flex' : 2,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mb.note(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'xact', 'label' : commonStrings.getString('staff.mb_xact_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mb.xact(); }
+ },
+ ];
+ for (var i = 0; i < c.length; i++) {
+ if (modify[ c[i].id ]) {
+ for (var j in modify[ c[i].id ]) {
+ c[i][j] = modify[ c[i].id ][j];
+ }
+ }
+ }
+ if (params) {
+ if (params.just_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < params.just_these.length; i++) {
+ var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
+ new_c.push( function(y){ return y; }( x ) );
+ }
+ c = new_c;
+ }
+ if (params.except_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < c.length; i++) {
+ var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
+ if (!x) new_c.push(c[i]);
+ }
+ c = new_c;
+ }
+
+ }
+ return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
}
patron.util.mp_columns = function(modify,params) {
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
- JSAN.use('util.money'); JSAN.use('util.date'); JSAN.use('patron.util');
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+ JSAN.use('util.money'); JSAN.use('util.date'); JSAN.use('patron.util');
var commonStrings = document.getElementById('commonStrings');
- var c = [
- {
- 'persist' : 'hidden width ordinal', 'id' : 'mp_id', 'label' : commonStrings.getString('staff.mp_id_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mp.id(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'mp_amount', 'label' : commonStrings.getString('staff.mp_amount_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return util.money.sanitize( my.mp.amount() ); },
- 'sort_type' : 'money'
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'mp_payment_type', 'label' : commonStrings.getString('staff.mp_payment_type_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mp.payment_type(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'mp_payment_ts', 'label' : commonStrings.getString('staff.mp_payment_timestamp_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.mp.payment_ts(), "" ); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'mp_note', 'label' : commonStrings.getString('staff.mp_note_label'), 'flex' : 2,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mp.note(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'mp_ws', 'label' : commonStrings.getString('staff.mp_cash_drawer_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mp.cash_drawer().name(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'mp_staff', 'label' : commonStrings.getString('staff.mp_accepting_usr_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { var s = my.mp.accepting_usr(); if (s && typeof s != "object") s = patron.util.retrieve_fleshed_au_via_id(ses(),s); return s.family_name() + " (" + s.card().barcode() + ") @ " + data.hash.aou[ s.home_ou() ].shortname(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'mp_xact', 'label' : commonStrings.getString('staff.mp_xact_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mp.xact(); }
- },
- ];
- for (var i = 0; i < c.length; i++) {
- if (modify[ c[i].id ]) {
- for (var j in modify[ c[i].id ]) {
- c[i][j] = modify[ c[i].id ][j];
- }
- }
- }
- if (params) {
- if (params.just_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < params.just_these.length; i++) {
- var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
- new_c.push( function(y){ return y; }( x ) );
- }
- c = new_c;
- }
- if (params.except_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < c.length; i++) {
- var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
- if (!x) new_c.push(c[i]);
- }
- c = new_c;
- }
-
- }
- return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
+ var c = [
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'mp_id', 'label' : commonStrings.getString('staff.mp_id_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mp.id(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'mp_amount', 'label' : commonStrings.getString('staff.mp_amount_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return util.money.sanitize( my.mp.amount() ); },
+ 'sort_type' : 'money'
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'mp_payment_type', 'label' : commonStrings.getString('staff.mp_payment_type_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mp.payment_type(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'mp_payment_ts', 'label' : commonStrings.getString('staff.mp_payment_timestamp_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.mp.payment_ts(), "" ); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'mp_note', 'label' : commonStrings.getString('staff.mp_note_label'), 'flex' : 2,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mp.note(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'mp_ws', 'label' : commonStrings.getString('staff.mp_cash_drawer_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mp.cash_drawer().name(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'mp_staff', 'label' : commonStrings.getString('staff.mp_accepting_usr_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { var s = my.mp.accepting_usr(); if (s && typeof s != "object") s = patron.util.retrieve_fleshed_au_via_id(ses(),s); return s.family_name() + " (" + s.card().barcode() + ") @ " + data.hash.aou[ s.home_ou() ].shortname(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'mp_xact', 'label' : commonStrings.getString('staff.mp_xact_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mp.xact(); }
+ },
+ ];
+ for (var i = 0; i < c.length; i++) {
+ if (modify[ c[i].id ]) {
+ for (var j in modify[ c[i].id ]) {
+ c[i][j] = modify[ c[i].id ][j];
+ }
+ }
+ }
+ if (params) {
+ if (params.just_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < params.just_these.length; i++) {
+ var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
+ new_c.push( function(y){ return y; }( x ) );
+ }
+ c = new_c;
+ }
+ if (params.except_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < c.length; i++) {
+ var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
+ if (!x) new_c.push(c[i]);
+ }
+ c = new_c;
+ }
+
+ }
+ return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
}
patron.util.ausp_columns = function(modify,params) {
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
JSAN.use('util.functional');
var commonStrings = document.getElementById('commonStrings');
- var c = [
- {
- 'persist' : 'hidden width ordinal', 'id' : 'csp_id', 'label' : commonStrings.getString('staff.csp_id_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return typeof my.csp == 'object' ? my.csp.id() : my.csp; }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'csp_name', 'label' : commonStrings.getString('staff.csp_name_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return typeof my.csp == 'object' ? my.csp.name() : data.hash.csp[ my.csp ].name(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'csp_label', 'label' : commonStrings.getString('staff.csp_label_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return typeof my.csp == 'object' ? my.csp.label() : data.hash.csp[ my.csp ].label(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'csp_block_list', 'label' : commonStrings.getString('staff.csp_block_list_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return typeof my.csp == 'object' ? my.csp.block_list() : data.hash.csp[ my.csp ].block_list(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'csp_block_circ', 'label' : commonStrings.getString('staff.csp_block_circ_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) {
+ var c = [
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'csp_id', 'label' : commonStrings.getString('staff.csp_id_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return typeof my.csp == 'object' ? my.csp.id() : my.csp; }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'csp_name', 'label' : commonStrings.getString('staff.csp_name_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return typeof my.csp == 'object' ? my.csp.name() : data.hash.csp[ my.csp ].name(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'csp_label', 'label' : commonStrings.getString('staff.csp_label_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return typeof my.csp == 'object' ? my.csp.label() : data.hash.csp[ my.csp ].label(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'csp_block_list', 'label' : commonStrings.getString('staff.csp_block_list_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return typeof my.csp == 'object' ? my.csp.block_list() : data.hash.csp[ my.csp ].block_list(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'csp_block_circ', 'label' : commonStrings.getString('staff.csp_block_circ_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) {
var my_csp = typeof my.csp == 'object' ? my.csp : data.hash.csp[ my.csp ];
return String( my_csp.block_list() ).match('CIRC') ? commonStrings.getString('staff.csp_block_circ_yes') : commonStrings.getString('staff.csp_block_circ_no');
}
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'csp_block_renew', 'label' : commonStrings.getString('staff.csp_block_renew_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) {
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'csp_block_renew', 'label' : commonStrings.getString('staff.csp_block_renew_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) {
var my_csp = typeof my.csp == 'object' ? my.csp : data.hash.csp[ my.csp ];
return String( my_csp.block_list() ).match('RENEW') ? commonStrings.getString('staff.csp_block_renew_yes') : commonStrings.getString('staff.csp_block_renew_no');
}
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'csp_block_hold', 'label' : commonStrings.getString('staff.csp_block_hold_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) {
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'csp_block_hold', 'label' : commonStrings.getString('staff.csp_block_hold_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) {
var my_csp = typeof my.csp == 'object' ? my.csp : data.hash.csp[ my.csp ];
return String( my_csp.block_list() ).match('HOLD') ? commonStrings.getString('staff.csp_block_hold_yes') : commonStrings.getString('staff.csp_block_hold_no');
}
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'ausp_id', 'label' : commonStrings.getString('staff.ausp_id_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.ausp ? my.ausp.id() : ''; }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'ausp_staff', 'label' : commonStrings.getString('staff.ausp_staff_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) {
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'ausp_id', 'label' : commonStrings.getString('staff.ausp_id_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.ausp ? my.ausp.id() : ''; }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'ausp_staff', 'label' : commonStrings.getString('staff.ausp_staff_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) {
return my.ausp ? my.ausp.staff() : '';
}
},
- {
- 'persist' : 'hidden width ordinal', 'id' : 'ausp_set_date', 'label' : commonStrings.getString('staff.ausp_set_date_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) {
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'ausp_set_date', 'label' : commonStrings.getString('staff.ausp_set_date_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) {
return my.ausp ? my.ausp.set_date() : '';
}
},
- {
- 'persist' : 'hidden width ordinal', 'id' : 'ausp_note', 'label' : commonStrings.getString('staff.ausp_note_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) {
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'ausp_note', 'label' : commonStrings.getString('staff.ausp_note_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) {
return my.ausp ? my.ausp.note() : '';
}
},
- {
- 'persist' : 'hidden width ordinal', 'id' : 'ausp_org_unit', 'label' : commonStrings.getString('staff.ausp_org_unit_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) {
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'ausp_org_unit', 'label' : commonStrings.getString('staff.ausp_org_unit_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) {
return my.ausp ? data.hash.aou[ my.ausp.org_unit() ].shortname() : '';
}
}
- ];
- for (var i = 0; i < c.length; i++) {
- if (modify[ c[i].id ]) {
- for (var j in modify[ c[i].id ]) {
- c[i][j] = modify[ c[i].id ][j];
- }
- }
- }
- if (params) {
- if (params.just_these) {
- var new_c = [];
- for (var i = 0; i < params.just_these.length; i++) {
- var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
- new_c.push( function(y){ return y; }( x ) );
- }
- c = new_c;
- }
- if (params.except_these) {
- var new_c = [];
- for (var i = 0; i < c.length; i++) {
- var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
- if (!x) new_c.push(c[i]);
- }
- c = new_c;
- }
-
- }
- return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
+ ];
+ for (var i = 0; i < c.length; i++) {
+ if (modify[ c[i].id ]) {
+ for (var j in modify[ c[i].id ]) {
+ c[i][j] = modify[ c[i].id ][j];
+ }
+ }
+ }
+ if (params) {
+ if (params.just_these) {
+ var new_c = [];
+ for (var i = 0; i < params.just_these.length; i++) {
+ var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
+ new_c.push( function(y){ return y; }( x ) );
+ }
+ c = new_c;
+ }
+ if (params.except_these) {
+ var new_c = [];
+ for (var i = 0; i < c.length; i++) {
+ var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
+ if (!x) new_c.push(c[i]);
+ }
+ c = new_c;
+ }
+
+ }
+ return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
}
patron.util.columns = function(modify,params) {
-
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
var commonStrings = document.getElementById('commonStrings');
- var c = [
- {
- 'persist' : 'hidden width ordinal', 'id' : 'barcode', 'label' : commonStrings.getString('staff.card_barcode_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.card().barcode(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'usrname', 'label' : commonStrings.getString('staff.au_usrname_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.usrname(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'profile', 'label' : commonStrings.getString('staff.au_profile_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return data.hash.pgt[ my.au.profile() ].name(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'active', 'label' : commonStrings.getString('staff.au_active_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return get_bool( my.au.active() ) ? "Yes" : "No"; }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'barred', 'label' : commonStrings.getString('staff.au_barred_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return get_bool( my.au.barred() ) ? "Yes" : "No"; }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'au_id', 'label' : document.getElementById('commonStrings').getString('staff.au_id_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.id(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'prefix', 'label' : document.getElementById('commonStrings').getString('staff.au_name_prefix_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.prefix(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'family_name', 'label' : document.getElementById('commonStrings').getString('staff.au_family_name_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.family_name(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'first_given_name', 'label' : document.getElementById('commonStrings').getString('staff.au_first_given_name_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.first_given_name(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'second_given_name', 'label' : document.getElementById('commonStrings').getString('staff.au_second_given_name_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.second_given_name(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'suffix', 'label' : document.getElementById('commonStrings').getString('staff.au_name_suffix_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.suffix(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'alert_message', 'label' : commonStrings.getString('staff.au_alert_message_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.alert_message(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'claims_returned_count', 'label' : commonStrings.getString('staff.au_claims_returned_count_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.claims_returned_count(); },
- 'sort_type' : 'number'
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'create_date', 'label' : commonStrings.getString('staff.au_create_date_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.create_date(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'expire_date', 'label' : commonStrings.getString('staff.au_expire_date_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.expire_date().substr(0,10); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'home_ou', 'label' : commonStrings.getString('staff.au_home_library_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return data.hash.aou[ my.au.home_ou() ].shortname(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'home_ou_fullname', 'label' : commonStrings.getString('staff.au_home_library_fullname_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return data.hash.aou[ my.au.home_ou() ].name(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'credit_forward_balance', 'label' : commonStrings.getString('staff.au_credit_forward_balance_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.credit_forward_balance(); },
- 'sort_type' : 'money'
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'day_phone', 'label' : commonStrings.getString('staff.au_day_phone_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.day_phone(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'evening_phone', 'label' : commonStrings.getString('staff.au_evening_phone_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.evening_phone(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'other_phone', 'label' : commonStrings.getString('staff.au_other_phone_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.other_phone(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'email', 'label' : commonStrings.getString('staff.au_email_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.email(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'alias', 'label' : commonStrings.getString('staff.au_alias_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.alias(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'dob', 'label' : commonStrings.getString('staff.au_birth_date_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.dob().substr(0,10); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'ident_type', 'label' : commonStrings.getString('staff.au_ident_type_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return data.hash.cit[ my.au.ident_type() ].name(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'ident_value', 'label' : commonStrings.getString('staff.au_ident_value_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.ident_value(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'ident_type2', 'label' : commonStrings.getString('staff.au_ident_type2_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return data.hash.cit[ my.au.ident_type2() ].name(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'ident_value2', 'label' : commonStrings.getString('staff.au_ident_value2_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.ident_value2(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'net_access_level', 'label' : commonStrings.getString('staff.au_net_access_level_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.net_access_level(); }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'master_account', 'label' : commonStrings.getString('staff.au_master_account_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return get_bool( my.au.master_account() ) ? "Yes" : "No"; }
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'usrgroup', 'label' : commonStrings.getString('staff.au_group_id_label'), 'flex' : 1,
- 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.usrgroup(); }
- },
- ];
- for (var i = 0; i < c.length; i++) {
- if (modify[ c[i].id ]) {
- for (var j in modify[ c[i].id ]) {
- c[i][j] = modify[ c[i].id ][j];
- }
- }
- }
- if (params) {
- if (params.just_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < params.just_these.length; i++) {
- var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
- new_c.push( function(y){ return y; }( x ) );
- }
- c = new_c;
- }
- if (params.except_these) {
- JSAN.use('util.functional');
- var new_c = [];
- for (var i = 0; i < c.length; i++) {
- var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
- if (!x) new_c.push(c[i]);
- }
- c = new_c;
- }
-
- }
- return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
+ var c = [
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'barcode', 'label' : commonStrings.getString('staff.card_barcode_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.card().barcode(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'usrname', 'label' : commonStrings.getString('staff.au_usrname_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.usrname(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'profile', 'label' : commonStrings.getString('staff.au_profile_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return data.hash.pgt[ my.au.profile() ].name(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'active', 'label' : commonStrings.getString('staff.au_active_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return get_bool( my.au.active() ) ? "Yes" : "No"; }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'barred', 'label' : commonStrings.getString('staff.au_barred_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return get_bool( my.au.barred() ) ? "Yes" : "No"; }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'au_id', 'label' : document.getElementById('commonStrings').getString('staff.au_id_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.id(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'prefix', 'label' : document.getElementById('commonStrings').getString('staff.au_name_prefix_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.prefix(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'family_name', 'label' : document.getElementById('commonStrings').getString('staff.au_family_name_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.family_name(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'first_given_name', 'label' : document.getElementById('commonStrings').getString('staff.au_first_given_name_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.first_given_name(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'second_given_name', 'label' : document.getElementById('commonStrings').getString('staff.au_second_given_name_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.second_given_name(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'suffix', 'label' : document.getElementById('commonStrings').getString('staff.au_name_suffix_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.suffix(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'alert_message', 'label' : commonStrings.getString('staff.au_alert_message_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.alert_message(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'claims_returned_count', 'label' : commonStrings.getString('staff.au_claims_returned_count_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.claims_returned_count(); },
+ 'sort_type' : 'number'
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'create_date', 'label' : commonStrings.getString('staff.au_create_date_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.create_date(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'expire_date', 'label' : commonStrings.getString('staff.au_expire_date_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.expire_date().substr(0,10); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'home_ou', 'label' : commonStrings.getString('staff.au_home_library_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return data.hash.aou[ my.au.home_ou() ].shortname(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'home_ou_fullname', 'label' : commonStrings.getString('staff.au_home_library_fullname_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return data.hash.aou[ my.au.home_ou() ].name(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'credit_forward_balance', 'label' : commonStrings.getString('staff.au_credit_forward_balance_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.credit_forward_balance(); },
+ 'sort_type' : 'money'
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'day_phone', 'label' : commonStrings.getString('staff.au_day_phone_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.day_phone(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'evening_phone', 'label' : commonStrings.getString('staff.au_evening_phone_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.evening_phone(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'other_phone', 'label' : commonStrings.getString('staff.au_other_phone_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.other_phone(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'email', 'label' : commonStrings.getString('staff.au_email_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.email(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'alias', 'label' : commonStrings.getString('staff.au_alias_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.alias(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'dob', 'label' : commonStrings.getString('staff.au_birth_date_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.dob().substr(0,10); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'ident_type', 'label' : commonStrings.getString('staff.au_ident_type_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return data.hash.cit[ my.au.ident_type() ].name(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'ident_value', 'label' : commonStrings.getString('staff.au_ident_value_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.ident_value(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'ident_type2', 'label' : commonStrings.getString('staff.au_ident_type2_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return data.hash.cit[ my.au.ident_type2() ].name(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'ident_value2', 'label' : commonStrings.getString('staff.au_ident_value2_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.ident_value2(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'net_access_level', 'label' : commonStrings.getString('staff.au_net_access_level_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.net_access_level(); }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'master_account', 'label' : commonStrings.getString('staff.au_master_account_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return get_bool( my.au.master_account() ) ? "Yes" : "No"; }
+ },
+ {
+ 'persist' : 'hidden width ordinal', 'id' : 'usrgroup', 'label' : commonStrings.getString('staff.au_group_id_label'), 'flex' : 1,
+ 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.au.usrgroup(); }
+ },
+ ];
+ for (var i = 0; i < c.length; i++) {
+ if (modify[ c[i].id ]) {
+ for (var j in modify[ c[i].id ]) {
+ c[i][j] = modify[ c[i].id ][j];
+ }
+ }
+ }
+ if (params) {
+ if (params.just_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < params.just_these.length; i++) {
+ var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);});
+ new_c.push( function(y){ return y; }( x ) );
+ }
+ c = new_c;
+ }
+ if (params.except_these) {
+ JSAN.use('util.functional');
+ var new_c = [];
+ for (var i = 0; i < c.length; i++) {
+ var x = util.functional.find_list(params.except_these,function(d){return(d==c[i].id);});
+ if (!x) new_c.push(c[i]);
+ }
+ c = new_c;
+ }
+
+ }
+ return c.sort( function(a,b) { if (a.label < b.label) return -1; if (a.label > b.label) return 1; return 0; } );
}
patron.util.std_map_row_to_columns = function(error_value) {
- return function(row,cols) {
- // row contains { 'my' : { 'au' : {} } }
- // cols contains all of the objects listed above in columns
-
- var obj = {}; obj.OpenILS = {};
- JSAN.use('util.error'); obj.error = new util.error();
- JSAN.use('OpenILS.data'); obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
- JSAN.use('util.date'); JSAN.use('util.money');
-
- var my = row.my;
- var values = [];
- var cmd = '';
- try {
- for (var i = 0; i < cols.length; i++) {
- switch (typeof cols[i].render) {
- case 'function': try { values[i] = cols[i].render(my); } catch(E) { values[i] = error_value; obj.error.sdump('D_COLUMN_RENDER_ERROR',E); } break;
- case 'string' : cmd += 'try { ' + cols[i].render + '; values['+i+'] = v; } catch(E) { values['+i+'] = error_value; }'; break;
- default: cmd += 'values['+i+'] = "??? '+(typeof cols[i].render)+'"; ';
- }
- }
- if (cmd) eval( cmd );
- } catch(E) {
- obj.error.sdump('D_WARN','map_row_to_column: ' + E);
- if (error_value) { value = error_value; } else { value = ' ' };
- }
- return values;
- }
+ return function(row,cols) {
+ // row contains { 'my' : { 'au' : {} } }
+ // cols contains all of the objects listed above in columns
+
+ var obj = {}; obj.OpenILS = {};
+ JSAN.use('util.error'); obj.error = new util.error();
+ JSAN.use('OpenILS.data'); obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
+ JSAN.use('util.date'); JSAN.use('util.money');
+
+ var my = row.my;
+ var values = [];
+ var cmd = '';
+ try {
+ for (var i = 0; i < cols.length; i++) {
+ switch (typeof cols[i].render) {
+ case 'function': try { values[i] = cols[i].render(my); } catch(E) { values[i] = error_value; obj.error.sdump('D_COLUMN_RENDER_ERROR',E); } break;
+ case 'string' : cmd += 'try { ' + cols[i].render + '; values['+i+'] = v; } catch(E) { values['+i+'] = error_value; }'; break;
+ default: cmd += 'values['+i+'] = "??? '+(typeof cols[i].render)+'"; ';
+ }
+ }
+ if (cmd) eval( cmd );
+ } catch(E) {
+ obj.error.sdump('D_WARN','map_row_to_column: ' + E);
+ if (error_value) { value = error_value; } else { value = ' ' };
+ }
+ return values;
+ }
}
patron.util.retrieve_au_via_id = function(session, id, f) {
- JSAN.use('util.network');
- var network = new util.network();
- var patron_obj = network.simple_request(
- 'FM_AU_RETRIEVE_VIA_ID',
- [ session, id ],
- f
- );
- return patron_obj;
+ JSAN.use('util.network');
+ var network = new util.network();
+ var patron_obj = network.simple_request(
+ 'FM_AU_RETRIEVE_VIA_ID',
+ [ session, id ],
+ f
+ );
+ return patron_obj;
}
patron.util.retrieve_name_via_id = function(session, id) {
- JSAN.use('util.network');
- var network = new util.network();
- var parts = network.simple_request(
- 'BLOB_AU_PARTS_RETRIEVE',
- [ session, id, ['family_name', 'first_given_name', 'second_given_name', 'home_ou' ] ]
- );
- return parts;
+ JSAN.use('util.network');
+ var network = new util.network();
+ var parts = network.simple_request(
+ 'BLOB_AU_PARTS_RETRIEVE',
+ [ session, id, ['family_name', 'first_given_name', 'second_given_name', 'home_ou' ] ]
+ );
+ return parts;
}
patron.util.retrieve_fleshed_au_via_id = function(session, id) {
- JSAN.use('util.network');
- var network = new util.network();
- var patron_obj = network.simple_request(
- 'FM_AU_FLESHED_RETRIEVE_VIA_ID.authoritative',
- [ session, id ]
- );
- patron.util.set_penalty_css(patron_obj);
- return patron_obj;
+ JSAN.use('util.network');
+ var network = new util.network();
+ var patron_obj = network.simple_request(
+ 'FM_AU_FLESHED_RETRIEVE_VIA_ID.authoritative',
+ [ session, id ]
+ );
+ patron.util.set_penalty_css(patron_obj);
+ return patron_obj;
}
patron.util.retrieve_fleshed_au_via_barcode = function(session, id) {
- JSAN.use('util.network');
- var network = new util.network();
- var patron_obj = network.simple_request(
- 'FM_AU_RETRIEVE_VIA_BARCODE.authoritative',
- [ session, id ]
- );
- if (typeof patron_obj.ilsevent == 'undefined') patron.util.set_penalty_css(patron_obj);
- return patron_obj;
+ JSAN.use('util.network');
+ var network = new util.network();
+ var patron_obj = network.simple_request(
+ 'FM_AU_RETRIEVE_VIA_BARCODE.authoritative',
+ [ session, id ]
+ );
+ if (typeof patron_obj.ilsevent == 'undefined') patron.util.set_penalty_css(patron_obj);
+ return patron_obj;
}
var TIME = { minute : 60, hour : 60*60, day : 60*60*24, year : 60*60*24*365 };
patron.util.set_penalty_css = function(patron) {
- try {
- removeCSSClass(document.documentElement,'PATRON_HAS_BILLS');
- removeCSSClass(document.documentElement,'PATRON_HAS_OVERDUES');
- removeCSSClass(document.documentElement,'PATRON_HAS_NOTES');
- removeCSSClass(document.documentElement,'PATRON_EXCEEDS_CHECKOUT_COUNT');
- removeCSSClass(document.documentElement,'PATRON_EXCEEDS_OVERDUE_COUNT');
- removeCSSClass(document.documentElement,'PATRON_EXCEEDS_FINES');
- removeCSSClass(document.documentElement,'NO_PENALTIES');
- removeCSSClass(document.documentElement,'ONE_PENALTY');
- removeCSSClass(document.documentElement,'MULTIPLE_PENALTIES');
- removeCSSClass(document.documentElement,'PATRON_HAS_ALERT');
- removeCSSClass(document.documentElement,'PATRON_BARRED');
- removeCSSClass(document.documentElement,'PATRON_INACTIVE');
- removeCSSClass(document.documentElement,'PATRON_EXPIRED');
- removeCSSClass(document.documentElement,'PATRON_HAS_INVALID_DOB');
- removeCSSClass(document.documentElement,'PATRON_HAS_INVALID_ADDRESS');
- removeCSSClass(document.documentElement,'PATRON_AGE_GE_65');
- removeCSSClass(document.documentElement,'PATRON_AGE_LT_65');
- removeCSSClass(document.documentElement,'PATRON_AGE_GE_24');
- removeCSSClass(document.documentElement,'PATRON_AGE_LT_24');
- removeCSSClass(document.documentElement,'PATRON_AGE_GE_21');
- removeCSSClass(document.documentElement,'PATRON_AGE_LT_21');
- removeCSSClass(document.documentElement,'PATRON_AGE_GE_18');
- removeCSSClass(document.documentElement,'PATRON_AGE_LT_18');
- removeCSSClass(document.documentElement,'PATRON_AGE_GE_13');
- removeCSSClass(document.documentElement,'PATRON_AGE_LT_13');
- removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_1');
- removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_2');
- removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_3');
-
- JSAN.use('util.network'); var net = new util.network();
- net.simple_request('FM_MOUS_RETRIEVE.authoritative',[ ses(), patron.id() ], function(req) {
- if (req.getResultObject().balance_owed() > 0) addCSSClass(document.documentElement,'PATRON_HAS_BILLS');
- });
- net.simple_request('FM_CIRC_COUNT_RETRIEVE_VIA_USER.authoritative',[ ses(), patron.id() ], function(req) {
- try {
- var co = req.getResultObject();
- if (co.overdue > 0 || co.long_overdue > 0) addCSSClass(document.documentElement,'PATRON_HAS_OVERDUES');
- } catch(E) {
- alert(E);
- }
- });
- net.simple_request('FM_AUN_RETRIEVE_ALL.authoritative',[ ses(), { 'patronid' : patron.id() } ], function(req) {
- var notes = req.getResultObject();
- if (notes.length > 0) addCSSClass(document.documentElement,'PATRON_HAS_NOTES');
- });
-
- /*
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
- data.last_patron = patron.id(); data.stash('last_patron');
- */
-
- var penalties = patron.standing_penalties();
- for (var i = 0; i < penalties.length; i++) {
- /* this comes from /opac/common/js/utils.js */
- addCSSClass(document.documentElement,penalties[i].standing_penalty().name());
- }
-
- switch(penalties.length) {
- case 0: addCSSClass(document.documentElement,'NO_PENALTIES'); break;
- case 1: addCSSClass(document.documentElement,'ONE_PENALTY'); break;
- default: addCSSClass(document.documentElement,'MULTIPLE_PENALTIES'); break;
- }
-
- if (patron.alert_message()) {
- addCSSClass(document.documentElement,'PATRON_HAS_ALERT');
- }
-
- if (get_bool( patron.barred() )) {
- addCSSClass(document.documentElement,'PATRON_BARRED');
- }
-
- if (!get_bool( patron.active() )) {
- addCSSClass(document.documentElement,'PATRON_INACTIVE');
- }
-
- try { addCSSClass(document.documentElement,'PATRON_NET_ACCESS_' + patron.net_access_level()); } catch(E) {}
-
- var now = new Date();
- now = now.getTime()/1000;
-
- var expire_parts = patron.expire_date().substr(0,10).split('-');
- expire_parts[1] = expire_parts[1] - 1;
-
- var expire = new Date();
- expire.setFullYear(expire_parts[0], expire_parts[1], expire_parts[2]);
- expire = expire.getTime()/1000
-
- if (expire < now) addCSSClass(document.documentElement,'PATRON_EXPIRED');
-
- if (patron.dob()) {
- var age_parts = patron.dob().substr(0,10).split('-');
- age_parts[1] = age_parts[1] - 1;
-
- var born = new Date();
- born.setFullYear(age_parts[0], age_parts[1], age_parts[2]);
- born = born.getTime()/1000
-
- var patron_age = now - born;
- var years_old = Number(patron_age / TIME.year);
-
- addCSSClass(document.documentElement,'PATRON_AGE_IS_' + years_old);
-
- if ( years_old >= 65 ) addCSSClass(document.documentElement,'PATRON_AGE_GE_65');
- if ( years_old < 65 ) addCSSClass(document.documentElement,'PATRON_AGE_LT_65');
-
- if ( years_old >= 24 ) addCSSClass(document.documentElement,'PATRON_AGE_GE_24');
- if ( years_old < 24 ) addCSSClass(document.documentElement,'PATRON_AGE_LT_24');
-
- if ( years_old >= 21 ) addCSSClass(document.documentElement,'PATRON_AGE_GE_21');
- if ( years_old < 21 ) addCSSClass(document.documentElement,'PATRON_AGE_LT_21');
-
- if ( years_old >= 18 ) addCSSClass(document.documentElement,'PATRON_AGE_GE_18');
- if ( years_old < 18 ) addCSSClass(document.documentElement,'PATRON_AGE_LT_18');
-
- if ( years_old >= 13 ) addCSSClass(document.documentElement,'PATRON_AGE_GE_13');
- if ( years_old < 13 ) addCSSClass(document.documentElement,'PATRON_AGE_LT_13');
- } else {
- addCSSClass(document.documentElement,'PATRON_HAS_INVALID_DOB');
- }
+ try {
+ removeCSSClass(document.documentElement,'PATRON_HAS_BILLS');
+ removeCSSClass(document.documentElement,'PATRON_HAS_OVERDUES');
+ removeCSSClass(document.documentElement,'PATRON_HAS_NOTES');
+ removeCSSClass(document.documentElement,'PATRON_EXCEEDS_CHECKOUT_COUNT');
+ removeCSSClass(document.documentElement,'PATRON_EXCEEDS_OVERDUE_COUNT');
+ removeCSSClass(document.documentElement,'PATRON_EXCEEDS_FINES');
+ removeCSSClass(document.documentElement,'NO_PENALTIES');
+ removeCSSClass(document.documentElement,'ONE_PENALTY');
+ removeCSSClass(document.documentElement,'MULTIPLE_PENALTIES');
+ removeCSSClass(document.documentElement,'PATRON_HAS_ALERT');
+ removeCSSClass(document.documentElement,'PATRON_BARRED');
+ removeCSSClass(document.documentElement,'PATRON_INACTIVE');
+ removeCSSClass(document.documentElement,'PATRON_EXPIRED');
+ removeCSSClass(document.documentElement,'PATRON_HAS_INVALID_DOB');
+ removeCSSClass(document.documentElement,'PATRON_HAS_INVALID_ADDRESS');
+ removeCSSClass(document.documentElement,'PATRON_AGE_GE_65');
+ removeCSSClass(document.documentElement,'PATRON_AGE_LT_65');
+ removeCSSClass(document.documentElement,'PATRON_AGE_GE_24');
+ removeCSSClass(document.documentElement,'PATRON_AGE_LT_24');
+ removeCSSClass(document.documentElement,'PATRON_AGE_GE_21');
+ removeCSSClass(document.documentElement,'PATRON_AGE_LT_21');
+ removeCSSClass(document.documentElement,'PATRON_AGE_GE_18');
+ removeCSSClass(document.documentElement,'PATRON_AGE_LT_18');
+ removeCSSClass(document.documentElement,'PATRON_AGE_GE_13');
+ removeCSSClass(document.documentElement,'PATRON_AGE_LT_13');
+ removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_1');
+ removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_2');
+ removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_3');
+
+ JSAN.use('util.network'); var net = new util.network();
+ net.simple_request('FM_MOUS_RETRIEVE.authoritative',[ ses(), patron.id() ], function(req) {
+ if (req.getResultObject().balance_owed() > 0) addCSSClass(document.documentElement,'PATRON_HAS_BILLS');
+ });
+ net.simple_request('FM_CIRC_COUNT_RETRIEVE_VIA_USER.authoritative',[ ses(), patron.id() ], function(req) {
+ try {
+ var co = req.getResultObject();
+ if (co.overdue > 0 || co.long_overdue > 0) addCSSClass(document.documentElement,'PATRON_HAS_OVERDUES');
+ } catch(E) {
+ alert(E);
+ }
+ });
+ net.simple_request('FM_AUN_RETRIEVE_ALL.authoritative',[ ses(), { 'patronid' : patron.id() } ], function(req) {
+ var notes = req.getResultObject();
+ if (notes.length > 0) addCSSClass(document.documentElement,'PATRON_HAS_NOTES');
+ });
+
+ /*
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+ data.last_patron = patron.id(); data.stash('last_patron');
+ */
+
+ var penalties = patron.standing_penalties();
+ for (var i = 0; i < penalties.length; i++) {
+ /* this comes from /opac/common/js/utils.js */
+ addCSSClass(document.documentElement,penalties[i].standing_penalty().name());
+ }
+
+ switch(penalties.length) {
+ case 0: addCSSClass(document.documentElement,'NO_PENALTIES'); break;
+ case 1: addCSSClass(document.documentElement,'ONE_PENALTY'); break;
+ default: addCSSClass(document.documentElement,'MULTIPLE_PENALTIES'); break;
+ }
+
+ if (patron.alert_message()) {
+ addCSSClass(document.documentElement,'PATRON_HAS_ALERT');
+ }
+
+ if (get_bool( patron.barred() )) {
+ addCSSClass(document.documentElement,'PATRON_BARRED');
+ }
+
+ if (!get_bool( patron.active() )) {
+ addCSSClass(document.documentElement,'PATRON_INACTIVE');
+ }
+
+ try { addCSSClass(document.documentElement,'PATRON_NET_ACCESS_' + patron.net_access_level()); } catch(E) {}
+
+ var now = new Date();
+ now = now.getTime()/1000;
+
+ var expire_parts = patron.expire_date().substr(0,10).split('-');
+ expire_parts[1] = expire_parts[1] - 1;
+
+ var expire = new Date();
+ expire.setFullYear(expire_parts[0], expire_parts[1], expire_parts[2]);
+ expire = expire.getTime()/1000
+
+ if (expire < now) addCSSClass(document.documentElement,'PATRON_EXPIRED');
+
+ if (patron.dob()) {
+ var age_parts = patron.dob().substr(0,10).split('-');
+ age_parts[1] = age_parts[1] - 1;
+
+ var born = new Date();
+ born.setFullYear(age_parts[0], age_parts[1], age_parts[2]);
+ born = born.getTime()/1000
+
+ var patron_age = now - born;
+ var years_old = Number(patron_age / TIME.year);
+
+ addCSSClass(document.documentElement,'PATRON_AGE_IS_' + years_old);
+
+ if ( years_old >= 65 ) addCSSClass(document.documentElement,'PATRON_AGE_GE_65');
+ if ( years_old < 65 ) addCSSClass(document.documentElement,'PATRON_AGE_LT_65');
+
+ if ( years_old >= 24 ) addCSSClass(document.documentElement,'PATRON_AGE_GE_24');
+ if ( years_old < 24 ) addCSSClass(document.documentElement,'PATRON_AGE_LT_24');
+
+ if ( years_old >= 21 ) addCSSClass(document.documentElement,'PATRON_AGE_GE_21');
+ if ( years_old < 21 ) addCSSClass(document.documentElement,'PATRON_AGE_LT_21');
+
+ if ( years_old >= 18 ) addCSSClass(document.documentElement,'PATRON_AGE_GE_18');
+ if ( years_old < 18 ) addCSSClass(document.documentElement,'PATRON_AGE_LT_18');
+
+ if ( years_old >= 13 ) addCSSClass(document.documentElement,'PATRON_AGE_GE_13');
+ if ( years_old < 13 ) addCSSClass(document.documentElement,'PATRON_AGE_LT_13');
+ } else {
+ addCSSClass(document.documentElement,'PATRON_HAS_INVALID_DOB');
+ }
if ( get_bool( patron.juvenile() ) ) addCSSClass(document.documentElement,'PATRON_JUVENILE');
else removeCSSClass(document.documentElement,'PATRON_JUVENILE');
- if (patron.mailing_address()) {
- if (!get_bool(patron.mailing_address().valid())) {
- addCSSClass(document.documentElement,'PATRON_HAS_INVALID_ADDRESS');
- }
- }
- if (patron.billing_address()) {
- if (!get_bool(patron.billing_address().valid())) {
- addCSSClass(document.documentElement,'PATRON_HAS_INVALID_ADDRESS');
- }
- }
-
- } catch(E) {
- dump('patron.util.set_penalty_css: ' + E + '\n');
- alert('patron.util.set_penalty_css: ' + E + '\n');
- }
+ if (patron.mailing_address()) {
+ if (!get_bool(patron.mailing_address().valid())) {
+ addCSSClass(document.documentElement,'PATRON_HAS_INVALID_ADDRESS');
+ }
+ }
+ if (patron.billing_address()) {
+ if (!get_bool(patron.billing_address().valid())) {
+ addCSSClass(document.documentElement,'PATRON_HAS_INVALID_ADDRESS');
+ }
+ }
+
+ } catch(E) {
+ dump('patron.util.set_penalty_css: ' + E + '\n');
+ alert('patron.util.set_penalty_css: ' + E + '\n');
+ }
}
patron.util.merge = function(record_ids) {
@@ -802,7 +802,7 @@ patron.util.merge = function(record_ids) {
if (Number(robj) != 1) { throw(robj); }
return fancy_prompt_data.lead;
} catch(E) {
- dump('patron.util.merge: ' + js2JSON(E) + '\n');
+ dump('patron.util.merge: ' + js2JSON(E) + '\n');
try { error.standard_unexpected_error_alert('Error in patron.util.merge',E); } catch(F) { alert('patron.util.merge: ' + E + '\n'); }
return false;
}
--
2.11.0