LP#1742779: Distinguish between no statcat values and multiple values in copy editor... user/miker/lp-1742779-none-vs-multi-statcats
authorMike Rylander <mrylander@gmail.com>
Wed, 10 Jan 2018 16:25:27 +0000 (11:25 -0500)
committerMike Rylander <mrylander@gmail.com>
Thu, 11 Jan 2018 19:25:59 +0000 (14:25 -0500)
WRT stat cats, the copy editor in the web client will display the value of a
stat cat IFF all selected copies both use the stat cat AND use the same value
for that stat cat. Otherwise it displays <NONE>, which is confusing in the
case of some selected copies just not using the stat cat, or all selected
copies using it, but using different values.

This commit provides tracking of the mixed-use stat, and displays <MULTIPLE>
for the value instead of <NONE> in that case.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2
Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js

index 8b61610..e5a81ae 100644 (file)
                                 ng-model="working.statcats[sc.id()]"
                                 ng-options="e.id() as e.value() for e in sc.entries()"
                                 ng-required="sc.required() == 't'">
-                                <option value="">[% l('&lt;NONE&gt;') %]</option>
+                                <option value="">
+                                    {{ !working.statcats_multi[sc.id()] ? '[% l('&lt;NONE&gt;') %]' : '[% l('&lt;MULTIPLE&gt;') %]' }}
+                                </option>
                             </select>
                         </div>
                     </div>
index 2efd975..8bef416 100644 (file)
@@ -1093,6 +1093,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
 
     $scope.working = {
         statcats: {},
+        statcats_multi: {},
         statcat_filter: undefined
     };
 
@@ -1502,6 +1503,8 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                                 } else {
                                     none = true;
                                 }
+                            } else {
+                                none = true;
                             }
                         } else {
                             none = true;
@@ -1510,9 +1513,15 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
 
                     if (!none && Object.keys(value_hash).length == 1) {
                         $scope.working.statcats[sc.id()] = value_hash[Object.keys(value_hash)[0]];
+                        $scope.working.statcats_multi[sc.id()] = false;
+                    } else if (item_list.length > 1 && Object.keys(value_hash).length > 0) {
+                        $scope.working.statcats[sc.id()] = undefined;
+                        $scope.working.statcats_multi[sc.id()] = true;
                     } else {
                         $scope.working.statcats[sc.id()] = undefined;
+                        $scope.working.statcats_multi[sc.id()] = false;
                     }
+
                 });
 
             } else {
@@ -1564,7 +1573,9 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                             angular.forEach($scope.statcats, function (s) {
 
                                 if (!$scope.working)
-                                    $scope.working = { statcats: {}, statcat_filter: undefined};
+                                    $scope.working = { statcats_multi: {}, statcats: {}, statcat_filter: undefined};
+                                if (!$scope.working.statcats_multi)
+                                    $scope.working.statcats_multi = {};
                                 if (!$scope.working.statcats)
                                     $scope.working.statcats = {};