'type' : 'items',
'header' : 'The following items have been examined:<hr/><ol>',
'line_item' : '<li>%title%<br/>\r\nBarcode: %barcode%\r\n',
- 'footer' : '</ol><hr />%PINES_CODE% %TODAY_TRIM%<br/>\r\n<br/>\r\n',
+ 'footer' : '</ol><hr />%SHORTNAME% %TODAY_TRIM%<br/>\r\n<br/>\r\n',
},
'transit_list' : {
'type' : 'transits',
'header' : 'Transits:<hr/><ol>',
'line_item' : '<li>From: %transit_source% To: %transit_dest_lib%<br/>\r\nWhen: %transit_source_send_time%<br />\r\nBarcode: %transit_item_barcode% Title: %transit_item_title%<br/>\r\n',
- 'footer' : '</ol><hr />%PINES_CODE% %TODAY_TRIM%<br/>\r\n<br/>\r\n',
+ 'footer' : '</ol><hr />%SHORTNAME% %TODAY_TRIM%<br/>\r\n<br/>\r\n',
},
'items_out' : {
'type' : 'items',
'header' : 'Welcome to %LIBRARY%!<br/>\r\nYou have the following items:<hr/><ol>',
'line_item' : '<li>%title%<br/>\r\nBarcode: %barcode% Due: %due_date%\r\n',
- 'footer' : '</ol><hr />%PINES_CODE% %TODAY_TRIM%<br/>\r\nYou were helped by %STAFF_FIRSTNAME%<br/>\r\n<br/>\r\n',
+ 'footer' : '</ol><hr />%SHORTNAME% %TODAY_TRIM%<br/>\r\nYou were helped by %STAFF_FIRSTNAME%<br/>\r\n<br/>\r\n',
},
'checkout' : {
'type' : 'items',
'header' : 'Welcome to %LIBRARY%!<br/>\r\nYou checked out the following items:<hr/><ol>',
'line_item' : '<li>%title%<br/>\r\nBarcode: %barcode% Due: %due_date%\r\n',
- 'footer' : '</ol><hr />%PINES_CODE% %TODAY_TRIM%<br/>\r\nYou were helped by %STAFF_FIRSTNAME%<br/>\r\n<br/>\r\n',
+ 'footer' : '</ol><hr />%SHORTNAME% %TODAY_TRIM%<br/>\r\nYou were helped by %STAFF_FIRSTNAME%<br/>\r\n<br/>\r\n',
},
'offline_checkout' : {
'type' : 'offline_checkout',
'type' : 'items',
'header' : 'You checked in the following items:<hr/><ol>',
'line_item' : '<li>%title%<br/>\r\nBarcode: %barcode% Call Number: %call_number%\r\n',
- 'footer' : '</ol><hr />%PINES_CODE% %TODAY_TRIM%<br/>\r\n<br/>\r\n',
+ 'footer' : '</ol><hr />%SHORTNAME% %TODAY_TRIM%<br/>\r\n<br/>\r\n',
},
'bill_payment' : {
'type' : 'payment',
'header' : 'Welcome to %LIBRARY%!<br/>A receipt of your transaction:<hr/> <table width="100%"> <tr> <td>Original Balance:</td> <td align="right">$%original_balance%</td> </tr> <tr> <td>Payment Method:</td> <td align="right">%payment_type%</td> </tr> <tr> <td>Payment Received:</td> <td align="right">$%payment_received%</td> </tr> <tr> <td>Payment Applied:</td> <td align="right">$%payment_applied%</td> </tr> <tr> <td>Billings Voided:</td> <td align="right">%voided_balance%</td> </tr> <tr> <td>Change Given:</td> <td align="right">$%change_given%</td> </tr> <tr> <td>New Balance:</td> <td align="right">$%new_balance%</td> </tr> </table> <p> Note: %note% </p> <p> Specific bills: <blockquote>',
'line_item' : 'Bill #%bill_id% %last_billing_type% Received: $%payment%<br />%barcode% %title%<br /><br />',
- 'footer' : '</blockquote> </p> <hr />%PINES_CODE% %TODAY_TRIM%<br/> <br/> ',
+ 'footer' : '</blockquote> </p> <hr />%SHORTNAME% %TODAY_TRIM%<br/> <br/> ',
},
'bills_historical' : {
'type' : 'bills',
'header' : 'Welcome to %LIBRARY%!<br/>You had the following bills:<hr/><ol>',
'line_item' : '<dt><b>Bill #%id%</b></dt> <dd> <table> <tr valign="top"><td>Date:</td><td>%xact_start%</td></tr> <tr valign="top"><td>Type:</td><td>%xact_type%</td></tr> <tr valign="top"><td>Last Billing:</td><td>%last_billing_type%<br/>%last_billing_note%</td></tr> <tr valign="top"><td>Total Billed:</td><td>$%total_owed%</td></tr> <tr valign="top"><td>Last Payment:</td><td>%last_payment_type%<br/>%last_payment_note%</td></tr> <tr valign="top"><td>Total Paid:</td><td>$%total_paid%</td></tr> <tr valign="top"><td><b>Balance:</b></td><td><b>$%balance_owed%</b></td></tr> </table><br/>',
- 'footer' : '</ol><hr />%PINES_CODE% %TODAY_TRIM%<br/>\r\n<br/>\r\n',
+ 'footer' : '</ol><hr />%SHORTNAME% %TODAY_TRIM%<br/>\r\n<br/>\r\n',
},
'bills_current' : {
'type' : 'bills',
'header' : 'Welcome to %LIBRARY%!<br/>You have the following bills:<hr/><ol>',
'line_item' : '<dt><b>Bill #%id%</b></dt> <dd> <table> <tr valign="top"><td>Date:</td><td>%xact_start%</td></tr> <tr valign="top"><td>Type:</td><td>%xact_type%</td></tr> <tr valign="top"><td>Last Billing:</td><td>%last_billing_type%<br/>%last_billing_note%</td></tr> <tr valign="top"><td>Total Billed:</td><td>$%total_owed%</td></tr> <tr valign="top"><td>Last Payment:</td><td>%last_payment_type%<br/>%last_payment_note%</td></tr> <tr valign="top"><td>Total Paid:</td><td>$%total_paid%</td></tr> <tr valign="top"><td><b>Balance:</b></td><td><b>$%balance_owed%</b></td></tr> </table><br/>',
- 'footer' : '</ol><hr />%PINES_CODE% %TODAY_TRIM%<br/>\r\n<br/>\r\n',
+ 'footer' : '</ol><hr />%SHORTNAME% %TODAY_TRIM%<br/>\r\n<br/>\r\n',
},
'offline_checkin' : {
'type' : 'offline_checkin',
'type' : 'holds',
'header' : 'Welcome to %LIBRARY%!<br/>\r\nYou have the following titles on hold:<hr/><ol>',
'line_item' : '<li>%title%\r\n',
- 'footer' : '</ol><hr />%PINES_CODE% %TODAY_TRIM%<br/>\r\nYou were helped by %STAFF_FIRSTNAME%<br/>\r\n<br/>\r\n',
+ 'footer' : '</ol><hr />%SHORTNAME% %TODAY_TRIM%<br/>\r\nYou were helped by %STAFF_FIRSTNAME%<br/>\r\n<br/>\r\n',
}
};
'check_perm' : function(perms) {
var obj = this;
- var robj = obj.network.simple_request('PERM_CHECK',[ses(),obj.data.list.au[0].id(),obj.data.list.au[0].ws_ou(),perms]);
- if (typeof robj.ilsevent != 'undefined') {
- obj.error.standard_unexpected_error_alert('check permission',E);
- return false;
+ try {
+ var robj = obj.network.simple_request('PERM_CHECK',[ses(),obj.data.list.au[0].id(),obj.data.list.au[0].ws_ou(),perms]);
+ if (typeof robj.ilsevent != 'undefined') {
+ obj.error.standard_unexpected_error_alert('check permission',E);
+ return false;
+ }
+ return robj.length == 0 ? true : false;
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('Error checking permissions',E);
}
- return robj.length == 0 ? true : false;
},
'execute_ses' : function() {
var obj = this;
+ try {
+
clear_the_cache();
obj.data.stash_retrieve();
x.send(null);
dump(url + ' = ' + x.responseText + '\n' );
+ if (!x.responseText) throw('Bad response from CGI component');
var robj = JSON2js(x.responseText);
if (robj.ilsevent != 0) { alert('Execute error: ' + x.responseText); }
obj.retrieve_seslist(); obj.render_seslist();
}
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('Error executing session',E);
+ }
},
'ses_errors' : function() {
var obj = this;
+ try {
+
clear_the_cache();
obj.data.stash_retrieve();
x.send(null);
dump(url + ' = ' + x.responseText + '\n' );
+ if (!x.responseText) throw('Bad response from CGI component');
var robj = JSON2js(x.responseText);
return { 'errors' : robj, 'description' : obj.seslist[ obj.sel_list[0] ].description };
+ } catch(E) {
+ throw('Error retrieving session errors: ' + E);
+ }
+
},
'rename_file' : function() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var obj = this;
+
+ try {
+
JSAN.use('util.file');
var pending = new util.file('pending_xacts');
if ( !pending._file.exists() ) { throw("Can't rename a non-existent file"); }
if (count++>100) throw("Taking too long to find a unique filename.");
}
pending._file.moveTo(null,obj.transition_filename);
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('Error renaming xact file',E);
+ }
},
'revert_file' : function() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var obj = this;
+
+ try {
+
JSAN.use('util.file');
var pending = new util.file('pending_xacts');
if (pending._file.exists()) { obj.error.yns_alert('Something bad happened. New offline transactions were accumulated during our attempted upload. Tell your system admin that the file involved is ' + obj.transition_filename,'Scary Error','Ok',null,null,'Check here to confirm this message'); return; }
var file = new util.file(obj.transition_filename);
file._file.moveTo(null,'pending_xacts');
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('Error reverting xact file',E);
+ }
},
'archive_file' : function() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var obj = this;
+
+ try {
+
JSAN.use('util.file');
var file = new util.file(obj.transition_filename);
- if (file._file.exists()) file._file.moveTo(null,obj.transition_filename + '.complete')
+ if (file._file.exists()) file._file.moveTo(null,obj.transition_filename + '.complete');
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('Error archiving xact file',E);
+ }
},
'upload' : function() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var obj = this;
+
+ try {
+
if (obj.sel_list.length == 0) { alert('Please select a session to upload to.'); return; }
if (obj.sel_list.length > 1) { alert('Please select a single session to upload to.'); return; }
}
};
x.contentWindow.xulG = newG;
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('Error uploading xacts',E);
+ }
},
'ses_status' : function() {
var obj = this;
+ try {
+
clear_the_cache();
obj.data.stash_retrieve();
x.send(null);
dump(url + ' = ' + x.responseText + '\n' );
+ if (!x.responseText) throw('Bad response from CGI component');
var robj = JSON2js(x.responseText);
return robj;
+
+ } catch(E) {
+
+ obj.error.standard_unexpected_error_alert('Error retrieving session status',E);
+ return { 'ilsevent' : -2 };
+
+ }
},
'create_ses' : function() {
var obj = this;
+ try {
+
var desc = window.prompt('Please enter a description:','','Create an Offline Transaction Session');
if (desc=='' || desc==null) { return; }
x.send(null);
dump(url + ' = ' + x.responseText + '\n' );
+ if (!x.responseText) throw('Bad response from CGI component');
var robj = JSON2js(x.responseText);
if (robj.ilsevent == 0) {
obj.retrieve_seslist(); obj.render_seslist();
} else {
alert('Error: ' + x.responseText);
}
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('Error creating session',E);
+ }
+
},
'retrieve_seslist' : function() {
x.open("GET",url,false);
x.send(null);
- dump(url + ' = ' + x.responseText + '\n' );
+ dump(url + ' = ' + typeof(x.responseText) + '\n' );
+
+ if (!x.responseText) throw('Bad response from CGI component');
var robj = JSON2js( x.responseText );
if (typeof robj.ilsevent != 'undefined') throw(robj);
+ if (!robj) throw(robj);
+
obj.seslist = robj.sort(
function(a,b) {
return b.create_time - a.create_time;
var obj = this;
+ try {
+
var old_idx = obj.list.node.currentIndex;
if (old_idx < 0) old_idx = 0;
funcs.push(
function(idx,row){
return function(){
- obj.list.append( { 'retrieve_id' : idx, 'row' : row } );
+ obj.list.append( { 'retrieve_id' : idx, 'row' : row, 'no_auto_select' : true } );
if (idx == old_idx) obj.list.node.view.selection.select(idx);
};
}(i,{ 'my' : obj.seslist[i] })
document.getElementById('execute').disabled = true;
document.getElementById('upload').disabled = true;
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('Error rendering session list',E);
+ }
},
'render_scriptlist' : function() {
dump('render_scriptlist\n');
- document.getElementById('deck').selectedIndex = 1;
-
var obj = this;
+ try {
+
+ document.getElementById('deck').selectedIndex = 1;
+
obj.script_list.clear();
var status = obj.ses_status();
funcs.push(
function(row){
return function(){
- obj.script_list.append( { 'row' : row } );
+ obj.script_list.append( { 'row' : row, 'no_auto_select' : true } );
};
}({ 'my' : scripts[i] })
);
}
JSAN.use('util.exec'); var exec = new util.exec();
exec.chain( funcs );
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('Error rendering script list',E);
+ }
},
'render_errorlist' : function() {
dump('render_errorlist\n');
- document.getElementById('deck').selectedIndex = 2;
-
var obj = this;
+ try {
+
+ document.getElementById('deck').selectedIndex = 2;
+
obj.error_list.clear();
var error_meta = obj.ses_errors();
funcs.push(
function(idx,row){
return function(){
- obj.error_list.append( { 'retrieve_id' : idx, 'row' : row } );
+ obj.error_list.append( { 'retrieve_id' : idx, 'row' : row, 'no_auto_select' : true } );
};
}(i,{ 'my' : obj.errors[i] })
);
}
JSAN.use('util.exec'); var exec = new util.exec();
exec.chain( funcs );
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('Error rendering error list',E);
+ }
},
'render_status' : function() {