[open-ils-commits] [GIT] Evergreen ILS branch rel_3_3 updated. bf37b1e3efa16a2a67aa0902a42afc4616b23cf6

Evergreen Git git at git.evergreen-ils.org
Wed Aug 14 09:07:10 EDT 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_3_3 has been updated
       via  bf37b1e3efa16a2a67aa0902a42afc4616b23cf6 (commit)
       via  a31074eb5073086d54d8208c00b6958505ead30a (commit)
      from  094fe6e0ed99bdd188777f71c1966cc25a01b22c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit bf37b1e3efa16a2a67aa0902a42afc4616b23cf6
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date:   Wed May 22 11:12:37 2019 -0400

    LP#1785061: move the filter value munging to the template service
    
    This allows the reporter app to stay a bit more focused on
    display concerns.
    
    Here's a test plan for the patch series
    ---------------------------------------
    [1] Create a reporter template that has a filter field
        and a filter operator of "In list", "Not in list", "Between",
        or "Not between" and hard-code a value for that filter
        in the template, separating values with a comma.
    [2] Try to create a report from that template; note that it
        fails with an error.
    [3] Apply the patch and repeat steps 1 and 2. This time, the
        report should succeed.
    
    Note that this fix applies only to hardcoding filter values in the
    template; it doesn't change any behavior when attempting to set
    a filter value for any of the four operators above at the point of
    creating a report.
    
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
    
    Conflicts:
            Open-ILS/web/js/ui/default/staff/reporter/template/app.js
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>

diff --git a/Open-ILS/web/js/ui/default/staff/reporter/services/template.js b/Open-ILS/web/js/ui/default/staff/reporter/services/template.js
index 1c3b4e027f..043dd47638 100644
--- a/Open-ILS/web/js/ui/default/staff/reporter/services/template.js
+++ b/Open-ILS/web/js/ui/default/staff/reporter/services/template.js
@@ -379,6 +379,30 @@ function($uibModal , $q , egCore , egConfirmDialog , egAlertDialog) {
         });
     }
 
+    service.updateFilterValue = function(item, value) {
+        switch (item.operator.op) {
+            case 'between':
+            case 'not between':
+            case 'not in':
+            case 'in':
+                //if value isn't an array yet, split into an array for
+                //  operators that need it
+                if (typeof value === 'string') {
+                    value = value.split(/\s*,\s*/);
+                }
+                break;
+
+            default:
+                //if value was split but shouldn't be, then convert back to
+                //  comma-separated string
+                if (Array.isArray(value)) {
+                    value = value.toString();
+                }
+        }
+
+        service.filter_fields[item.index].value = value;
+    }
+
     service.removeField = function (type, field) {
         var new_list = [];
         while (service[type].length) {
diff --git a/Open-ILS/web/js/ui/default/staff/reporter/template/app.js b/Open-ILS/web/js/ui/default/staff/reporter/template/app.js
index 6e3f9501d4..5dde15936f 100644
--- a/Open-ILS/web/js/ui/default/staff/reporter/template/app.js
+++ b/Open-ILS/web/js/ui/default/staff/reporter/template/app.js
@@ -513,7 +513,7 @@ function($scope , $q , $routeParams , $location , $timeout , $window,  egCore ,
             } else {
                 egPromptDialog.open(egCore.strings.TEMPLATE_CONF_DEFAULT, item.value || '',
                     {ok : function(value) {
-                        if (value) _update_filter_value(item, value);
+                        if (value) egReportTemplateSvc.updateFilterValue(item, value);
                     }}
                 );
             }
@@ -521,30 +521,6 @@ function($scope , $q , $routeParams , $location , $timeout , $window,  egCore ,
         fgrid.refresh();
     }
 
-    _update_filter_value = function(item, value) {
-        switch (item.operator.op) {
-            case 'between':
-            case 'not between':
-            case 'not in':
-            case 'in':
-                //if value isn't an array yet, split into an array for
-                //  operators that need it
-                if (typeof value === 'string') {
-                    value = value.split(/\s*,\s*/);
-                }
-                break;
-
-            default:
-                //if value was split but shouldn't be, then convert back to
-                //  comma-separated string
-                if (Array.isArray(value)) {
-                    value = value.toString();
-                }
-        }
-
-        egReportTemplateSvc.filter_fields[item.index].value = value;
-    }
-
     $scope.changeTransform = function (items) {
 
         var f = items[0];
@@ -599,7 +575,7 @@ function($scope , $q , $routeParams , $location , $timeout , $window,  egCore ,
 
                         //Update the filter value based on the new operator, because
                         //  different operators treat the value differently
-                        _update_filter_value(item, egReportTemplateSvc.filter_fields[item.index].value);
+                        egReportTemplateSvc.updateFilterValue(item, egReportTemplateSvc.filter_fields[item.index].value);
                     }
                 }}
             );

commit a31074eb5073086d54d8208c00b6958505ead30a
Author: Remington Steed <rjs7 at calvin.edu>
Date:   Thu May 2 09:15:30 2019 -0400

    LP#1785061: Split filter value on comma for "in list" and the like
    
    This commit borrows directly from the XUL reporter code (see
    function __default_value_event_handler () in
    Open-ILS/web/reports/xul/template-config.js). Basically, when the filter
    value is saved, certain cases need special treatment, such as splitting
    an "in list" value on commas. This commit includes a helper function
    which does the special treatment and saves the filter value. This helper
    is called both when the value itself is changed, and when the operator
    is changed.
    
    Signed-off-by: Remington Steed <rjs7 at calvin.edu>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
    
    Conflicts:
            Open-ILS/web/js/ui/default/staff/reporter/template/app.js
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>

diff --git a/Open-ILS/web/js/ui/default/staff/reporter/template/app.js b/Open-ILS/web/js/ui/default/staff/reporter/template/app.js
index 0fa3d29a99..6e3f9501d4 100644
--- a/Open-ILS/web/js/ui/default/staff/reporter/template/app.js
+++ b/Open-ILS/web/js/ui/default/staff/reporter/template/app.js
@@ -513,7 +513,7 @@ function($scope , $q , $routeParams , $location , $timeout , $window,  egCore ,
             } else {
                 egPromptDialog.open(egCore.strings.TEMPLATE_CONF_DEFAULT, item.value || '',
                     {ok : function(value) {
-                        if (value) egReportTemplateSvc.filter_fields[item.index].value = value;
+                        if (value) _update_filter_value(item, value);
                     }}
                 );
             }
@@ -521,6 +521,30 @@ function($scope , $q , $routeParams , $location , $timeout , $window,  egCore ,
         fgrid.refresh();
     }
 
+    _update_filter_value = function(item, value) {
+        switch (item.operator.op) {
+            case 'between':
+            case 'not between':
+            case 'not in':
+            case 'in':
+                //if value isn't an array yet, split into an array for
+                //  operators that need it
+                if (typeof value === 'string') {
+                    value = value.split(/\s*,\s*/);
+                }
+                break;
+
+            default:
+                //if value was split but shouldn't be, then convert back to
+                //  comma-separated string
+                if (Array.isArray(value)) {
+                    value = value.toString();
+                }
+        }
+
+        egReportTemplateSvc.filter_fields[item.index].value = value;
+    }
+
     $scope.changeTransform = function (items) {
 
         var f = items[0];
@@ -572,6 +596,10 @@ function($scope , $q , $routeParams , $location , $timeout , $window,  egCore ,
                     if (value) {
                         var t = egReportTemplateSvc.getFilterByLabel(value);
                         item.operator = { label: value, op : t };
+
+                        //Update the filter value based on the new operator, because
+                        //  different operators treat the value differently
+                        _update_filter_value(item, egReportTemplateSvc.filter_fields[item.index].value);
                     }
                 }}
             );

-----------------------------------------------------------------------

Summary of changes:
 .../ui/default/staff/reporter/services/template.js | 24 ++++++++++++++++++++++
 .../js/ui/default/staff/reporter/template/app.js   |  6 +++++-
 2 files changed, 29 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list