From fbded261a9e82a9135e9e346ceee6cfa3c6e087a Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Mon, 21 Jan 2013 14:54:55 -0500 Subject: [PATCH] Serials: Caption/pattern wizard use enum fields for chronology when no enum MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Dan Wells --- .../server/serial/pattern_wizard.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) 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); -- 2.43.2