webstaff serials: support combined pattern regularity
authorGalen Charlton <gmc@equinoxinitiative.org>
Mon, 24 Jul 2017 21:40:20 +0000 (17:40 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Mon, 24 Jul 2017 21:40:20 +0000 (17:40 -0400)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2
Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js

index 2596a46..cd97232 100644 (file)
                </div>
                <div class="col-md-6">
                  <div class="row" ng-repeat="part in reg.parts">
-                   <div class="col-md-8">
+                   <div class="col-md-8" ng-if="reg.regularity_type == 'c'">
+                     <label>[% l('Combined issue code') %] <input type="text" ng-model="part.combined_code"></label>
+                   </div>
+                   <div class="col-md-8" ng-if="reg.regularity_type != 'c'">
                      <div ng-if="reg.chron_type == 's'">
                        <label>[% l('Every') %] <eg-season-selector ng-model="part.season"></eg-season-selector></label>
                      </div>
index b575d48..d9beaff 100644 (file)
@@ -204,7 +204,9 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider) {
                     var chron_type = value.substring(1, 2);
                     value.substring(2).split(/,/).forEach(function(value) {
                         var piece = {};
-                        if (chron_type == 'd') {
+                        if (regularity_type == 'c') {
+                            piece.combined_code = value;
+                        } else if (chron_type == 'd') {
                             if (value.match(/^\d\d$/)) {
                                 piece.sub_type = 'day_of_month';
                                 piece.day_of_month = value;
@@ -347,7 +349,9 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider) {
                     patternCode.push('y');
                     var val = reg.regularity_type + reg.chron_type;
                     val += reg.parts.map(function(part) {
-                        if (reg.chron_type == 'd') {
+                        if (reg.regularity_type == 'c') {
+                            return part.combined_code;
+                        } else if (reg.chron_type == 'd') {
                             return part[part.sub_type];
                         } else if (reg.chron_type == 'm') {
                             return part.month;