LP#1303987: Fully populate Ills from context menu
authorMike Rylander <mrylander@gmail.com>
Mon, 7 Apr 2014 19:42:45 +0000 (15:42 -0400)
committerDan Wells <dbw2@calvin.edu>
Wed, 9 Apr 2014 21:17:12 +0000 (17:17 -0400)
The Ills fixed field is 4 characters long (allowing for up to four
types of illustrations to be noted, per 008/006), but the fixed field
editor dropdown menus are not (a) multi-select capable nor (b) ready
to support multi-value-per-field, because, well Ills is the only one
like this, and that would be a pretty big complication to the code.
However, even though multi-select is not supported, we should still
apply the value selected and update the fixed field, otherwise the
value is not updated in the record itself.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Remington Steed <rjs7@calvin.edu>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
Open-ILS/xul/staff_client/server/cat/marcedit.js

index e48cc62..1057d71 100644 (file)
@@ -1344,8 +1344,9 @@ sub fixed_field_values_by_rec_type {
     my $e = new_editor;
     my $values = $e->json_query({
         select => {
-            crad => ["fixed_field"],
-            ccvm => [qw/code value/],
+            crad  => ["fixed_field"],
+            ccvm  => [qw/code value/],
+            cmfpm => [qw/length default_val/],
         },
         distinct => 1,
         from => {
@@ -1374,7 +1375,7 @@ sub fixed_field_values_by_rec_type {
     my $result = {};
     for my $row (@$values) {
         $result->{$row->{fixed_field}} ||= [];
-        push @{$result->{$row->{fixed_field}}}, [@$row{qw/code value/}];
+        push @{$result->{$row->{fixed_field}}}, [@$row{qw/code value length default_val/}];
     }
 
     return $result;
index 61adec9..8359afc 100644 (file)
@@ -991,9 +991,14 @@ function getFFContextMenu(type, name) {
                  * a function of the size of the dataset defined in the
                  * ccvm/cmfpm tables. */
                 var code = v[0];
+                var len = v[2];
+                var def = v[3];
                 var el = document.getElementById(name + "_tb");
                 window[funcname] = function() {
                     el.value = code;
+                    while (el.value.length < len) {
+                        el.value += def;
+                    }
                     updateFixedFields(el);
                     oils_lock_page();
                 };