better handling of mingling readOnly and non-readOnly widgets during copy update...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 17 May 2010 19:57:03 +0000 (19:57 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 17 May 2010 19:57:03 +0000 (19:57 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16443 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/acq/common/li_table.js

index b881630..4e029af 100644 (file)
@@ -1437,25 +1437,31 @@ function AcqLiTable() {
                     orgLimitPerms : ['CREATE_PICKLIST', 'CREATE_PURCHASE_ORDER'],
                     readOnly : readOnly,
                 });
+
                 widget.build(
                     // make sure we capture the value from any async widgets
                     function(w, ww) { 
+
                         if (field == "fund" && w.store)
                             self._ensureCSSFundClasses(w.store);
-                        copy[field](ww.getFormattedValue()) 
+
+                        if(!readOnly) 
+                            copy[field](ww.getFormattedValue()) 
+
                         self.copyWidgetCache[copy.id()][field] = w;
-                    }
-                );
-                dojo.connect(widget.widget, 'onChange', 
-                    function(val) { 
-                        if (field == "fund")
-                            self._updateFundSelectorStyle(widget, val);
-
-                        if (copy.isnew() || val != copy[field]()) {
-                            // prevent setting ischanged() automatically on widget load for existing copies
-                            copy[field](widget.getFormattedValue()) 
-                            copy.ischanged(true);
-                        }
+
+                        dojo.connect(w, 'onChange', 
+                            function(val) { 
+                                if (field == "fund")
+                                    self._updateFundSelectorStyle(widget, val);
+
+                                if (!readOnly && (copy.isnew() || val != copy[field]())) {
+                                    // prevent setting ischanged() automatically on widget load for existing copies
+                                    copy[field](widget.getFormattedValue()) 
+                                    copy.ischanged(true);
+                                }
+                            }
+                        );
                     }
                 );
             }