Default the Dojo OU selector to the current WS value
authorDan Scott <dscott@laurentian.ca>
Wed, 23 Dec 2015 20:18:31 +0000 (15:18 -0500)
committerDan Scott <dscott@laurentian.ca>
Fri, 25 May 2018 21:25:46 +0000 (17:25 -0400)
Because this.orgDefaultsToWs does not appear to be set, even though
po/create.js tries to set it, we want a sane default anyway.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js

index 149d53d..ff112d8 100644 (file)
@@ -653,6 +653,12 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
 
             if(this.widgetValue == null && this.orgDefaultsToWs) 
                 this.widgetValue = user.user.ws_ou();
+
+            // this.orgDefaultsToWs seems to always be undefined, so
+            // fall back to a sane default
+            if (this.widgetValue == null) {
+                this.widgetValue = user.user.ws_ou();
+            }
             
             // if we have a limit perm, find the relevent orgs (async)
             if(this.orgLimitPerms && this.orgLimitPerms.length > 0) {