From: miker Date: Fri, 29 Sep 2006 04:07:25 +0000 (+0000) Subject: has_many/might_have support in the from clause X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=da0361c7bd9718885bd66e506fb42f1159df2f53;p=evergreen%2Fpines.git has_many/might_have support in the from clause git-svn-id: svn://svn.open-ils.org/ILS/trunk@6263 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/reports/oils_rpt_builder.js b/Open-ILS/web/reports/oils_rpt_builder.js index 9ce344ea0a..791771c762 100644 --- a/Open-ILS/web/reports/oils_rpt_builder.js +++ b/Open-ILS/web/reports/oils_rpt_builder.js @@ -122,6 +122,7 @@ function oilsRptBuildFromClause(path) { contains relevant info, plus a list of "fields", or column objects */ var node = oilsIDL[cls]; + var pkey = oilsRptFindField(node.pkey); /* a "field" is a parsed version of a column from the IDL, contains datatype, column name, etc. */ @@ -138,14 +139,19 @@ function oilsRptBuildFromClause(path) { if( i == (parts.length - 2) ) break; /* we still have columns left in the path, keep adding join's */ + var path_col = col; + if(field.reltype != 'has_a') + col = pkey.name + '-' + col; + tobj.join = {}; tobj = tobj.join; + tobj[col] = {}; tobj = tobj[col]; if( field.type == 'link' ) tobj.key = field.key; - newpath = newpath + '-'+ col; + newpath = newpath + '-'+ path_col; } _debug("built 'from' clause: path="+path+"\n"+formatJSON(js2JSON(obj))); diff --git a/Open-ILS/web/reports/oils_rpt_tree.js b/Open-ILS/web/reports/oils_rpt_tree.js index c053452df9..c67e8144d5 100644 --- a/Open-ILS/web/reports/oils_rpt_tree.js +++ b/Open-ILS/web/reports/oils_rpt_tree.js @@ -34,13 +34,15 @@ function oilsParseRptTree(IDL, callback) { for( var i = 0; i < classes.length; i++ ) { var node = classes[i]; var id = node.getAttribute('id'); + var fields = node.getElementsByTagName('fields')[0]; var obj = { fields : oilsRptParseFields(node), name : node.getAttribute('id'), table : node.getAttributeNS(oilsIDLPersistNS, 'tablename'), core : node.getAttributeNS(oilsIDLReportsNS, 'core'), - label : node.getAttributeNS(oilsIDLReportsNS, 'label') + label : node.getAttributeNS(oilsIDLReportsNS, 'label'), + pkey : fields.getAttributeNS(oilsIDLPersistNS, 'primary') }; if( obj.core == 'true' ) obj.core = true; @@ -91,7 +93,6 @@ function oilsRptParseFields( node ) { obj.key = link.getAttribute('key'); obj['class'] = link.getAttribute('class'); obj.reltype = link.getAttribute('reltype'); - if( obj.reltype == 'might_have' ) continue; } else { if( fields[i].getAttributeNS(oilsIDLPersistNS, 'virtual') == 'true' ) continue;