From: Lebbeous Fogle-Weekley Date: Mon, 21 Jan 2013 19:54:55 +0000 (-0500) Subject: Serials: Caption/pattern wizard use enum fields for chronology when no enum X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fcollab%2Fsenator%2Fscap-wizard-enum-is-chron;p=working%2FEvergreen.git Serials: Caption/pattern wizard use enum fields for chronology when no enum MFHD spec says that when there are no ‡a - ‡f enumeration captions, any chronology captions should move back from their usual ‡i - ‡m places back into enumeration space. The predictions engine we already have deals with this better than with the wrong patterns we were creating before, e.g.: 853 20 ‡81 ‡i(year) ‡j(month) ‡wm Signed-off-by: Lebbeous Fogle-Weekley --- diff --git a/Open-ILS/xul/staff_client/server/serial/pattern_wizard.js b/Open-ILS/xul/staff_client/server/serial/pattern_wizard.js index 68c58d3e09..684256229a 100644 --- a/Open-ILS/xul/staff_client/server/serial/pattern_wizard.js +++ b/Open-ILS/xul/staff_client/server/serial/pattern_wizard.js @@ -545,6 +545,13 @@ function ChronEditor() { } }; + /* When a caption and pattern has no enumeration, the chronology + * fields should go into the enumeration fields. */ + this._shift_to_enum = function(subfield) { + /* i -> a, j -> b, ... */ + return String.fromCharCode(subfield.charCodeAt(0) - 8); + }; + this.remove_row = function(subfield) { if (this._test_removability(subfield)) { hard_empty(this.rows[subfield].element); @@ -582,7 +589,7 @@ function ChronEditor() { (this.active ? show : hide)("chron_editor_here"); }; - this.compile = function() { + this.compile = function(enum_used) { if (!this.active) return []; return this.subfields.filter( @@ -592,7 +599,12 @@ function ChronEditor() { var caption = self.rows[subfield].fields.caption.value; if (!self.rows[subfield].fields.display_in_holding.checked) caption = "(" + caption + ")"; - return result.concat([subfield, caption]); + return result.concat( + [ + (enum_used ? subfield : self._shift_to_enum(subfield)), + caption + ] + ); }, [] ); }; @@ -896,7 +908,7 @@ function Wizard() { ]; code = code.concat(this.enum_editor.compile()); - code = code.concat(this.chron_editor.compile()); + code = code.concat(this.chron_editor.compile(this.enum_editor.active)); code = code.concat("w", this.field_w.value);