Mozilla has a printer settings object which we serialize when saving the settings...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 9 Nov 2009 18:46:36 +0000 (18:46 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 9 Nov 2009 18:46:36 +0000 (18:46 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14844 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js
Open-ILS/xul/staff_client/chrome/content/util/print.js
Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties

index 1cf9ab1..b6e8e38 100644 (file)
@@ -445,6 +445,9 @@ OpenILS.data.prototype = {
         }
         file.close();
 
+        JSAN.use('util.print'); (new util.print()).GetPrintSettings();
+        obj.data_progress('Printer settings retrieved. ');
+
         JSAN.use('util.functional');
         JSAN.use('util.fm_utils');
 
index 97078cb..0a757dc 100644 (file)
@@ -411,12 +411,13 @@ util.print.prototype = {
 
     'load_settings' : function() {
         try {
+            var error_msg = '';
             netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
             var file = new util.file('gPrintSettings');
             if (file._file.exists()) {
                 temp = file.get_object(); file.close();
                 for (var i in temp) {
-                    this.gPrintSettings[i] = temp[i];
+                    try { this.gPrintSettings[i] = temp[i]; } catch(E) { error_msg += 'Error trying to set gPrintSettings.'+i+'='+temp[i]+' : ' + js2JSON(E) + '\n'; }
                 }
             } else {
                 this.gPrintSettings.marginTop = 0;
@@ -430,6 +431,17 @@ util.print.prototype = {
                 this.gPrintSettings.footerStrCenter = '';
                 this.gPrintSettings.footerStrRight = '';
             }
+            if (error_msg) {
+                this.error.sdump('D_PRINT',error_msg);
+                this.error.yns_alert(
+                    document.getElementById('offlineStrings').getString('load_printer_settings_error_description'),
+                    document.getElementById('offlineStrings').getString('load_printer_settings_error_title'),
+                    document.getElementById('offlineStrings').getString('common.ok'),
+                    null,
+                    null,
+                    null
+                );
+            }
         } catch(E) {
             this.error.standard_unexpected_error_alert("load_settings()",E);
         }
index f95bf1c..12f3723 100644 (file)
@@ -231,3 +231,5 @@ menu.cmd_acq_view_distrib_formula.tab=Distribution Formulas
 menu.local_admin.circ_matrix_matchpoint.tab=Circulation Policies
 menu.local_admin.hold_matrix_matchpoint.tab=Hold Policies
 menu.local_admin.work_log.tab=Work Log
+load_printer_settings_error_description=Printer settings did not load cleanly with this version of Evergreen.  You should reconfigure your printer under Printer Settings Editor.
+load_printer_settings_error_title=Printer Settings