[open-ils-commits] [GIT] Evergreen ILS branch master updated. 53e455073ce19264a45f8dd8c5fe8a6805fd9c1b

Evergreen Git git at git.evergreen-ils.org
Thu Aug 22 14:22:13 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, master has been updated
       via  53e455073ce19264a45f8dd8c5fe8a6805fd9c1b (commit)
       via  6cdbb3da33fb0b295a74b9cef8b33bd697e4d267 (commit)
      from  22589defd677b552bfba0e8cf05f6e675d64aafe (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 53e455073ce19264a45f8dd8c5fe8a6805fd9c1b
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Thu Aug 15 10:20:17 2019 -0400

    LP#1796945 Match new path_label/alias standard
    
    The old reporter used '::' as a path separator in some labels, while the
    new version uses '->' in its place.  This would normally be just a
    curiosity, except that the hashes used as join aliases are generated
    from these path labels.  The end result is that while a report can be
    cloned, if you add a field anywhere other than the top level, it
    references a join alias which does not exist, and the report breaks.
    
    Now, the method by which report templates are upgraded from v4 to v5
    does not happen all in one pass, but rather a first pass is made
    populate the interface, then the rest is done when the user saves the
    clone.  Because of this, it actually seems adequate to only fix the
    label, then allow the other steps to fill in the other bits upon saving
    of the report.
    
    Thank you to J. Boyer for helping track down the culprit.
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>
    Signed-off-by: Jason Boyer <jboyer at library.in.gov>

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 c9f6c28dae..336a28bd75 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
@@ -341,7 +341,7 @@ function($scope , $q , $routeParams , $location , $timeout , $window,  egCore ,
                                     transform : orig.transform,
                                     aggregate : (orig.aggregate == "undefined") ? undefined : orig.aggregate  // old structure sometimes has undefined as a quoted string
                                   },
-                    path_label  : rel.label
+                    path_label  : rel.label.replace('::', '->')
                 };
                 if (col_type == 'filter_cols') {
                     col['operator'] = {

commit 6cdbb3da33fb0b295a74b9cef8b33bd697e4d267
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Fri May 3 13:17:50 2019 -0400

    LP#1796945 Reporter cloning and creation fixes
    
    This commit addresses a variety of issues with the webstaff reporter
    interface, particularly cases of cloning reports created in the XUL
    client.
    
    1. The conversion process did not account for manually selected JOIN
    operations (aka nullability).  These JOINs are now honored by the
    conversion code.
    
    2. The conversion process did not account for aggregate filters.  These
    filters are now converted where present.
    
    3. The previous reporter interface attempted to intelligently apply LEFT
    and INNER JOINs by default.  The new interface applied INNER joins
    exclusively by default, leading in many cases to different results.
    This commit reinstates the previous logic.  One side effect of this
    change is that the IDL tree itself is no longer opinionated about JOIN
    type, and the default JOIN is undefined.
    
    4. The nullability selector has been expanded to allow for manual
    selection of INNER joins, as they will longer be the default in some
    cases.
    
    5. Cloned-converted reports did not retain column order.  The order is
    now preserved.
    
    6. Some templates created in the older interface could, in some cases,
    have aggregate values set as the string "undefined" rather than
    actually being undefined.  This led to converted templates failing with
    "column [xxx] must appear in the GROUP BY clause...", as they were
    incorrectly converted as aggregates.  The conversion code now accounts
    for this latent bug.
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>
    Signed-off-by: Jason Boyer <jboyer at library.in.gov>

diff --git a/Open-ILS/src/templates/staff/reporter/t_edit_template.tt2 b/Open-ILS/src/templates/staff/reporter/t_edit_template.tt2
index cab7bd06bb..99bdfb0e37 100644
--- a/Open-ILS/src/templates/staff/reporter/t_edit_template.tt2
+++ b/Open-ILS/src/templates/staff/reporter/t_edit_template.tt2
@@ -66,7 +66,7 @@
       <select
           ng-show="enable_nullability"
           ng-model="node.jtype"
-          ng-init="join_types = [{type:'inner',label:'[% l('Default') %]'},{type:'left',label:'[% l('Child nullable') %]'},{type:'right',label:'[% l('Parent nullable') %]'}]"
+          ng-init="join_types = [{type:undefined,label:'[% l('Default') %]'},{type:'left',label:'[% l('Child nullable') %]'},{type:'right',label:'[% l('Parent nullable') %]'},{type:'inner',label:'[% l('None nullable') %]'}]"
           ng-options="j.type as j.label for j in join_types"></select>
       {{ node.label || n.id }}
     </treecontrol>
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 5dde15936f..c9f6c28dae 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
@@ -113,6 +113,7 @@ function($scope , $q , $routeParams , $location , $timeout , $window,  egCore ,
             var t = tree;
             var join_path = '';
 
+            var last_jtype = '';
             item.path.forEach(function (p, i, a) {
                 var alias; // unpredictable hashes are fine for intermediate tables
 
@@ -138,9 +139,15 @@ function($scope , $q , $routeParams , $location , $timeout , $window,  egCore ,
                     t = t.join[uplink_alias];
 
                     var djtype = 'inner';
-                    if (p.uplink.reltype != 'has_a') djtype = 'left';
+                    // we use LEFT JOINs for might_have and has_many, AND
+                    // also if our previous JOIN was a LEFT JOIN
+                    //
+                    // The last piece prevents later joins from limiting those
+                    // closer to the core table
+                    if (p.uplink.reltype != 'has_a' || last_jtype == 'left') djtype = 'left';
 
                     t.type = p.jtype || djtype;
+                    last_jtype = t.type;
                     t.key = p.uplink.key;
                 } else {
                     join_path = p.classname + '-' + p.classname;
@@ -271,11 +278,16 @@ function($scope , $q , $routeParams , $location , $timeout , $window,  egCore ,
             }
         }
 
+        // preserve the old select order for the display cols
+        var sel_order = {};
+        template.data.select.map(function(val, idx) {
+            // set key to unique value easily derived from relcache
+            sel_order[val.relation + val.column.colname] = idx;
+        });
+
         template.data['display_cols'] = [];
         template.data['filter_cols'] = [];
 
-        var dispcol_index = 0;
-
         function _convertPath(orig, rel) {
             var newPath = [];
 
@@ -291,13 +303,16 @@ function($scope , $q , $routeParams , $location , $timeout , $window,  egCore ,
                     label : egCore.idl.classes[cls].label
                 }
                 if (prev_link != '') {
-                    args['from'] = prev_link.split(/-/)[0];
-                    var prev_col = prev_link.split(/-/)[1].split(/>/)[0];
+                    var link_parts = prev_link.split(/-/);
+                    args['from'] = link_parts[0];
+                    var join_parts = link_parts[1].split(/>/);
+                    var prev_col = join_parts[0];
                     egCore.idl.classes[prev_link.split(/-/)[0]].fields.forEach(function(f) {
                         if (prev_col == f.name) {
                             args['link'] = f;
                         }
                     });
+                    args['jtype'] = join_parts[1]; // frequently undefined
                 }
                 newPath.push(egCore.idl.classTree.buildNode(cls, args));
                 prev_link = link;
@@ -306,55 +321,52 @@ function($scope , $q , $routeParams , $location , $timeout , $window,  egCore ,
 
         }
 
-        rels.map(function(rel) {
-            for (var col in rel.fields.dis_tab) {
-                var orig = rel.fields.dis_tab[col];
-                var display_col = {
-                    name        : orig.colname,
-                    path        : _convertPath(orig, rel),
-                    index       : dispcol_index++,
-                    label       : orig.alias,
-                    datatype    : orig.datatype,
-                    doc_text    : orig.field_doc,
-                    transform   : {
-                                    label     : orig.transform_label,
-                                    transform : orig.transform,
-                                    aggregate : orig.aggregate
-                                  },
-                    path_label  : rel.label
-                };
-                template.data.display_cols.push(display_col);
+        function _buildCols(rel, tab_type, col_idx) {
+            if (tab_type == 'dis_tab') {
+                col_type = 'display_cols';
+            } else {
+                col_type = 'filter_cols';
             }
-        });
 
-        rels.map(function(rel) {
-            for (var col in rel.fields.filter_tab) {
-                var orig = rel.fields.filter_tab[col];
-                var filter_col = {
+            for (var col in rel.fields[tab_type]) {
+                var orig = rel.fields[tab_type][col];
+                var col = {
                     name        : orig.colname,
                     path        : _convertPath(orig, rel),
-                    index       : dispcol_index++,
                     label       : orig.alias,
                     datatype    : orig.datatype,
                     doc_text    : orig.field_doc,
-                    operator    : {
-                                    op        : orig.op,
-                                    label     : orig.op_label
-                                  },
                     transform   : {
                                     label     : orig.transform_label,
                                     transform : orig.transform,
-                                    aggregate : orig.aggregate
+                                    aggregate : (orig.aggregate == "undefined") ? undefined : orig.aggregate  // old structure sometimes has undefined as a quoted string
                                   },
                     path_label  : rel.label
                 };
-                if ('value' in orig.op_value) {
-                    filter_col['value'] = orig.op_value.value;
+                if (col_type == 'filter_cols') {
+                    col['operator'] = {
+                        op        : orig.op,
+                        label     : orig.op_label
+                    };
+                    col['index'] = col_idx++;
+                    if ('value' in orig.op_value) {
+                        col['value'] = orig.op_value.value;
+                    }
+                } else { // display
+                    col['index'] = sel_order[rel.alias + orig.colname];
                 }
-                template.data.filter_cols.push(filter_col);
+
+                template.data[col_type].push(col);
             }
+        }
+
+        rels.map(function(rel) {
+            _buildCols(rel, 'dis_tab');
+            _buildCols(rel, 'filter_tab', template.data.filter_cols.length);
+            _buildCols(rel, 'aggfilter_tab', template.data.filter_cols.length);
         });
 
+        template.data['display_cols'].sort(function(a, b){return a.index - b.index});
     }
 
     function loadTemplate () {
@@ -675,7 +687,7 @@ function($scope , $q , $routeParams , $location , $timeout , $window,  egCore ,
             $scope.selected_source = node;
             $scope.currentPathLabel = $scope.currentPath.map(function(n,i){
                 var l = n.label
-                if (i) l += ' (' + n.jtype + ')';
+                if (i && n.jtype) l += ' (' + n.jtype + ')';
                 return l;
             }).join( ' -> ' );
             angular.forEach( node.fields, function (f) {
diff --git a/Open-ILS/web/js/ui/default/staff/services/idl.js b/Open-ILS/web/js/ui/default/staff/services/idl.js
index 629e5958e0..78faa9883c 100644
--- a/Open-ILS/web/js/ui/default/staff/services/idl.js
+++ b/Open-ILS/web/js/ui/default/staff/services/idl.js
@@ -328,7 +328,6 @@ angular.module('egCoreMod')
 
         return angular.extend( args, {
             idl     : service[cls],
-            jtype   : 'inner',
             uplink  : args.link,
             classname: cls,
             struct  : n,

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

Summary of changes:
 .../templates/staff/reporter/t_edit_template.tt2   |  2 +-
 .../js/ui/default/staff/reporter/template/app.js   | 90 ++++++++++++----------
 Open-ILS/web/js/ui/default/staff/services/idl.js   |  1 -
 3 files changed, 52 insertions(+), 41 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list