fix printer settings interface.. stale data
authorpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 31 Jan 2007 08:08:07 +0000 (08:08 +0000)
committerpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 31 Jan 2007 08:08:07 +0000 (08:08 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@6839 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/util/print.js
Open-ILS/xul/staff_client/server/admin/printer_settings.js

index 13388ad..f292ba6 100644 (file)
@@ -205,7 +205,10 @@ util.print.prototype = {
                if (!w) w = window;
                var obj = this;
                try {
+                       if (!params) params = {};
+
                        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                       obj.data.init({'via':'stash'});
 
                        if (params.print_strategy || obj.data.print_strategy) {
 
@@ -231,7 +234,7 @@ util.print.prototype = {
                        }
 
                } catch (e) {
-                       //alert('Probably not printing: ' + e);
+                       alert('Probably not printing: ' + e);
                        this.error.sdump('D_ERROR','PRINT EXCEPTION: ' + js2JSON(e) + '\n');
                }
 
@@ -240,6 +243,7 @@ util.print.prototype = {
        '_NSPrint_dos_print' : function(w,silent,params) {
                var obj = this;
                try {
+
                        /* This is a kludge/workaround.  webBrowserPrint doesn't always work.  So we're going to let
                                the html window handle our receipt template rendering, and then force a selection of all
                                the text nodes and dump that to a file, for printing through a dos utility */
@@ -393,9 +397,12 @@ util.print.prototype = {
 
        'save_settings' : function() {
                try {
+                       var obj = this;
                        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                        var file = new util.file('gPrintSettings');
-                       file.set_object(this.gPrintSettings); file.close();
+                       if (typeof obj.gPrintSettings == 'undefined') obj.GetPrintSettings();
+                       if (obj.gPrintSettings) file.set_object(obj.gPrintSettings); 
+                       file.close();
                } catch(E) {
                        this.error.standard_unexpected_error_alert("save_settings()",E);
                }
index 80c759a..7d9b6e6 100644 (file)
@@ -33,7 +33,7 @@ g.page_settings = function() {
 g.printer_settings = function() {
        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
        var w = document.getElementById('sample').contentWindow;
-       g.print.NSPrint(w ? w : window);
+       g.print.NSPrint(w ? w : window, false, {});
        g.print.save_settings();
 }