LP#1642337: more tweaks to the patch series
authorGalen Charlton <gmc@equinoxinitiative.org>
Thu, 23 May 2019 14:32:44 +0000 (10:32 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 24 May 2019 18:42:22 +0000 (14:42 -0400)
This patch makes the following changes:

- ensures that the Boolean values get saved as 't' or 'f', as
  the reporter builder doesn't recognize JSON true or false in
  this context.
- pretty-prints the current filter value in the dialog
- removes a logging line

To test
-------
[1] Apply the patch.
[2] Create or clone one or more report templates and add Boolean
    column filters. Change the filter value and verify that
    it displays the current value and lets you change it.
[3] Run reports from the template(s) created in step 2 and
    verify that the reports produce the expected results.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Dawn Dale <ddale@georgialibraries.org>

Open-ILS/web/js/ui/default/staff/reporter/template/app.js

index 25ee4cc..0fa3d29 100644 (file)
@@ -497,14 +497,17 @@ function($scope , $q , $routeParams , $location , $timeout , $window,  egCore ,
     $scope.changeFilterValue = function (items) {
         items.forEach(function(item) {
             var l = null;
-            console.log(item);
             if (item.datatype == "bool") {
-                egConfirmDialog.open(egCore.strings.TEMPLATE_CONF_DEFAULT, (typeof item.value === "undefined" ? egCore.strings.TEMPLATE_CONF_UNSET : item.value.toString()),
+                var displayVal = typeof item.value === "undefined" ? egCore.strings.TEMPLATE_CONF_UNSET :
+                                 item.value === 't'                ? egCore.strings.TEMPLATE_CONF_TRUE :
+                                 item.value === 'f'                ? egCore.strings.TEMPLATE_CONF_FALSE :
+                                 item.value.toString();
+                egConfirmDialog.open(egCore.strings.TEMPLATE_CONF_DEFAULT, displayVal,
                     {ok : function() {
-                        egReportTemplateSvc.filter_fields[item.index].value = true;
+                        egReportTemplateSvc.filter_fields[item.index].value = 't';
                     },
                     cancel : function() {
-                        egReportTemplateSvc.filter_fields[item.index].value = false;
+                        egReportTemplateSvc.filter_fields[item.index].value = 'f';
                     }}, egCore.strings.TEMPLATE_CONF_TRUE, egCore.strings.TEMPLATE_CONF_FALSE
                 );
             } else {