Serials: allow freer input in holding code mini-wizard
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Thu, 10 Nov 2011 22:22:22 +0000 (17:22 -0500)
committerDan Wells <dbw2@calvin.edu>
Fri, 11 Nov 2011 21:42:46 +0000 (16:42 -0500)
In the Subscription Details interface of the Alternate Serials Control
View, under the Issuance tab, if you create a new issuance you can
now enter things like "01/02" in (say) the month field to denote a combined
January/February issue.  All those fields are now free-form, whereas some of
them used to be numeric only.

Also, avoid an occasional issue where an error message about
dijit.form.DateTextBox not being a constructor would appear in the
JavaScript console.  The problem was in a race condition among some
co-dependent JavaScript files that were all being loaded at the same
time.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/web/js/dojo/openils/widget/HoldingCode.js
Open-ILS/web/js/ui/default/serial/subscription/issuance.js

index 4722cba..1221c7c 100644 (file)
@@ -3,7 +3,6 @@ if (!dojo._hasResource["openils.widget.HoldingCode"]) {
     dojo.require("dijit.layout.ContentPane");
     dojo.require("dijit.form.DropDownButton");
     dojo.require("dijit.form.TextBox");
-    dojo.require("dijit.form.NumberTextBox");
 
     var _needed_fields = "abcdefghijklm";
 
@@ -67,13 +66,8 @@ if (!dojo._hasResource["openils.widget.HoldingCode"]) {
                 }
 
                 dojo.create("td", {"innerHTML": field.caption}, tr);
-                var dij = field.subfield > "h" ?
-                    dijit.form.NumberTextBox : dijit.form.TextBox;
-                var input = new dij(
-                    {
-                        "name": field.subfield,
-                        "constraints": {"pattern": "####"}
-                    },
+                var input = new dijit.form.TextBox(
+                    {"name": field.subfield},
                     dojo.create("td", null, tr)
                 );
                 input.startup();
@@ -89,7 +83,7 @@ if (!dojo._hasResource["openils.widget.HoldingCode"]) {
                     inputs.forEach(
                         function(input) {
                             var value = input.input.attr("value");
-                            if (value === null || isNaN(value)) {
+                            if (value === null || value === "") {
                                 /* XXX i18n */
                                 alert("A valid holding code cannot be " +
                                     "produced with any blank fields.");
index 75484c5..eb4fae4 100644 (file)
@@ -1,3 +1,5 @@
+dojo.require("dijit.form.DateTextBox");
+
 function fresh_scap_selector(grid) {
     /* this really needs to be sync, not async */
     pcrud.search(