1 dojo.requireLocalization("openils.reports", "reports");
3 var rpt_strings = dojo.i18n.getLocalization("openils.reports", "reports");
5 function removeReportAtom (args) {
8 var active_tab = filterByAttribute(
9 $('used-source-fields-tabbox').getElementsByTagName('tab'),
13 var tabname = active_tab.getAttribute('id');
15 var tabpanel = $( tabname + 'panel' );
16 var tree = tabpanel.getElementsByTagName('tree')[0];
17 var fields = getSelectedItems(tree);
20 for (var i in fields) {
21 var field = fields[i];
22 var colname = field.firstChild.firstChild.nextSibling.getAttribute('label');
23 var relation_alias = field.getAttribute('relation');
25 delete rpt_rel_cache[relation_alias].fields[tabname][colname];
26 if (tabname == 'dis_tab') {
28 for each (var _o_col in rpt_rel_cache.order_by) {
29 if (_o_col.relation == relation_alias && _o_col.field == colname) continue;
30 _o_tmp.push( _o_col );
32 rpt_rel_cache.order_by = _o_tmp
35 with (rpt_rel_cache[relation_alias].fields) {
36 if ( getKeys(dis_tab).length == 0 && getKeys(filter_tab).length == 0 && getKeys(aggfilter_tab).length == 0 )
37 delete rpt_rel_cache[relation_alias];
46 function getSourceDefinition(aClass) {
47 var class_obj = getIDLClass(aClass);
48 return class_obj.getAttributeNS(persistNS,'tablename') ||
49 '(' + class_obj.getElementsByTagNameNS(persistNS,'source_definition')[0].textContent + ')';
52 function addReportAtoms () {
53 var nope = $( 'source-add' ).getAttribute('disabled');
54 if (nope == 'true') return false;
56 var class_tree = $('class-view');
57 var transform_tree = $('trans-view');
59 var active_tab = filterByAttribute(
60 $('used-source-fields-tabbox').getElementsByTagName('tab'),
65 var tabname = active_tab.getAttribute('id')
67 var items = getSelectedItems(class_tree);
68 var transform = getSelectedItems(transform_tree)[0];
70 var reltype = $('path-label').getAttribute('reltype');
71 var class_label = $('path-label').value;
72 var relation_alias = hex_md5(class_label);
74 for (var i in items) {
77 var class_path = item.getAttribute('fullpath');
78 var field_class = item.getAttribute('idlclass');
79 var datatype = item.getAttribute('datatype');
80 var colname = item.getAttribute('idlfield');
81 var jointype = item.getAttribute('join');
82 var field_label = item.firstChild.firstChild.getAttribute('label');
84 var table_name = getSourceDefinition(field_class);
86 if ( !rpt_rel_cache[relation_alias] ) {
87 rpt_rel_cache[relation_alias] =
88 { label : class_label,
89 alias : relation_alias,
93 idlclass : field_class,
95 fields : { dis_tab : {}, filter_tab : {}, aggfilter_tab : {} }
99 if ( !rpt_rel_cache[relation_alias].fields[tabname][colname] ) {
100 rpt_rel_cache[relation_alias].fields[tabname][colname] =
102 transform : (transform && transform.getAttribute('name')) || rpt_strings.TEMPLATE_CONF_BARE,
103 aggregate : transform && transform.getAttribute('aggregate'),
104 params : transform && transform.getAttribute('params'),
105 transform_label: (transform && transform.getAttribute('alias')) || rpt_strings.TEMPLATE_CONF_RAW_DATA,
109 op : (datatype == 'array') ? '= any' : '=',
110 op_label : rpt_strings.TEMPLATE_CONF_EQUALS,
114 if (!rpt_rel_cache.order_by)
115 rpt_rel_cache.order_by = [];
117 if (tabname == 'dis_tab')
118 rpt_rel_cache.order_by.push( { relation : relation_alias, field : colname } );
120 } else if (confirm(dojo.string.substitute( rpt_strings.TEMPLATE_CONF_CONFIRM_RESET, [field_label, class_label] )) ) {
121 rpt_rel_cache[relation_alias].fields[tabname][colname] =
123 transform : (transform && transform.getAttribute('name')) || rpt_strings.TEMPLATE_CONF_BARE,
124 aggregate : transform && transform.getAttribute('aggregate'),
125 params : transform && transform.getAttribute('params'),
126 transform_label: (transform && transform.getAttribute('alias')) || rpt_strings.TEMPLATE_CONF_RAW_DATA,
131 op_label : rpt_strings.TEMPLATE_CONF_EQUALS,
142 function changeDisplayOrder (dir) {
143 var active_tab = filterByAttribute(
144 $('used-source-fields-tabbox').getElementsByTagName('tab'),
149 var tabname = active_tab.getAttribute('id');
151 var tabpanel = $( tabname + 'panel' );
152 var tree = tabpanel.getElementsByTagName('tree')[0];
153 var item = getSelectedItems(tree)[0];
155 var item_pos = tree.view.selection.currentIndex;
158 if ( item.previousSibling ) {
159 item.parentNode.insertBefore( item, item.previousSibling );
162 } else if (dir == 'd') {
163 if ( item.nextSibling ) {
164 if (item.nextSibling.nextSibling ) item.parentNode.insertBefore( item, item.nextSibling.nextSibling );
165 else item.parentNode.appendChild( item );
170 rpt_rel_cache.order_by = [];
171 var ordered_list = tree.getElementsByTagName('treeitem');
172 for (var i = 0; i < ordered_list.length; i++) {
173 rpt_rel_cache.order_by.push(
174 { relation : ordered_list[i].getAttribute('relation'),
175 field : ordered_list[i].firstChild.firstChild.nextSibling.getAttribute('label')
180 tree.view.selection.select( item_pos );
184 function alterColumnLabel () {
185 var active_tab = filterByAttribute(
186 $('used-source-fields-tabbox').getElementsByTagName('tab'),
191 var tabname = active_tab.getAttribute('id');
193 var tabpanel = $( tabname + 'panel' );
194 var tree = tabpanel.getElementsByTagName('tree')[0];
195 var item_pos = tree.view.selection.currentIndex;
197 var item = getSelectedItems(tree)[0];
198 var relation_alias = item.getAttribute('relation');
200 var field = item.firstChild.firstChild;
201 var colname = field.nextSibling.getAttribute('label');
203 var old_label = field.getAttribute("label");
204 var new_label = prompt( dojo.string.substitute(rpt_strings.TEMPLATE_CONF_PROMPT_CHANGE, [old_label]), old_label );
207 rpt_rel_cache[relation_alias].fields[tabname][colname].alias = new_label;
209 tree.view.selection.select( item_pos );
217 function alterColumnTransform (trans) {
219 var transform = OILS_RPT_TRANSFORMS[trans];
221 var active_tab = filterByAttribute(
222 $('used-source-fields-tabbox').getElementsByTagName('tab'),
227 var tabname = active_tab.getAttribute('id');
229 var tabpanel = $( tabname + 'panel' );
230 var tree = tabpanel.getElementsByTagName('tree')[0];
231 var item_pos = tree.view.selection.currentIndex;
232 var item = getSelectedItems(tree)[0];
233 var relation_alias = item.getAttribute('relation');
235 var field = item.firstChild.firstChild;
236 var colname = field.nextSibling.getAttribute('label');
238 rpt_rel_cache[relation_alias].fields[tabname][colname].transform = trans;
239 rpt_rel_cache[relation_alias].fields[tabname][colname].aggregate = transform.aggregate;
240 rpt_rel_cache[relation_alias].fields[tabname][colname].params = transform.params;
241 rpt_rel_cache[relation_alias].fields[tabname][colname].transform_label = transform.label;
244 tree.view.selection.select( item_pos );
248 $(tabname + '_trans_menu').hidePopup();
252 function changeOperator (args) {
254 var active_tab = filterByAttribute(
255 $('used-source-fields-tabbox').getElementsByTagName('tab'),
260 var tabname = active_tab.getAttribute('id');
262 var tabpanel = $( tabname + 'panel' );
263 var tree = tabpanel.getElementsByTagName('tree')[0];
264 var item_pos = tree.view.selection.currentIndex;
265 var item = getSelectedItems(tree)[0];
267 var relation_alias = item.getAttribute('relation');
269 var field = item.firstChild.firstChild;
270 var colname = field.nextSibling.getAttribute('label');
272 rpt_rel_cache[relation_alias].fields[tabname][colname].op = args.op;
273 rpt_rel_cache[relation_alias].fields[tabname][colname].op_label = args.label;
276 tree.view.selection.select( item_pos );
280 $(tabname + '_op_menu').hidePopup();
284 function removeTemplateFilterValue () {
286 var active_tab = filterByAttribute(
287 $('used-source-fields-tabbox').getElementsByTagName('tab'),
292 var tabname = active_tab.getAttribute('id');
294 var tabpanel = $( tabname + 'panel' );
295 var tree = tabpanel.getElementsByTagName('tree')[0];
296 var item_pos = tree.view.selection.currentIndex;
297 var items = getSelectedItems(tree);
299 for (var i in items) {
301 var relation_alias = item.getAttribute('relation');
303 var field = item.firstChild.firstChild;
304 var colname = field.nextSibling.getAttribute('label');
306 rpt_rel_cache[relation_alias].fields[tabname][colname].op_value = {};
310 tree.view.selection.select( item_pos );
314 function timestampSetDate (obj, cal, date) {
315 obj.op_value.value = date;
316 obj.op_value.object = cal.date;
317 obj.op_value.label = '"' + date + '"';
325 function changeTemplateFilterValue () {
327 var active_tab = filterByAttribute(
328 $('used-source-fields-tabbox').getElementsByTagName('tab'),
333 var tabname = active_tab.getAttribute('id');
335 var tabpanel = $( tabname + 'panel' );
336 var tree = tabpanel.getElementsByTagName('tree')[0];
337 var items = getSelectedItems(tree);
339 var targetCmd = $( tabname + '_value_action' );
341 targetCmd.menu = null;
342 targetCmd.command = null;
343 targetCmd.oncommand = null;
344 targetCmd.removeEventListener( 'command', __handler_cache, true );
346 for (var i in items) {
348 var relation_alias = item.getAttribute('relation');
350 var field = item.firstChild.firstChild;
351 var colname = field.nextSibling.getAttribute('label');
353 var obj = rpt_rel_cache[relation_alias].fields[tabname][colname]
354 var operation = OILS_RPT_FILTERS[obj.op];
356 switch (obj.datatype) {
358 var cal_popup = $('calendar-widget');
360 while (cal_popup.firstChild) cal_popup.removeChild(cal_popup.lastChild);
361 var calendar = new Calendar(
364 function (cal,date) { return timestampSetDate(obj,cal,date) },
365 function (cal) { cal_popup.hidePopup(); cal.destroy(); return true; }
368 var format = OILS_RPT_TRANSFORMS[obj.transform].cal_format || '%Y-%m-%d';
370 calendar.setDateFormat(format);
371 calendar.create(cal_popup);
373 targetCmd.menu = 'calendar-widget';
379 function __bool_value_event_handler () {
383 // get a reference to the prompt service component.
384 var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
385 .getService(Components.interfaces.nsIPromptService);
387 // set the buttons that will appear on the dialog. It should be
388 // a set of constants multiplied by button position constants. In this case,
389 // three buttons appear, Save, Cancel and a custom button.
390 var flags=promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0 +
391 promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_1 +
392 promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_2;
394 // display the dialog box. The flags set above are passed
395 // as the fourth argument. The next three arguments are custom labels used for
396 // the buttons, which are used if BUTTON_TITLE_IS_STRING is assigned to a
397 // particular button. The last two arguments are for an optional check box.
398 answer = promptService.select(
400 rpt_strings.TEMPLATE_CONF_BOOLEAN_VALUE,
401 rpt_strings.TEMPLATE_CONF_SELECT_CANCEL,
402 2, [rpt_strings.TEMPLATE_CONF_TRUE, rpt_strings.TEMPLATE_CONF_FALSE], state
406 state = confirm(rpt_strings.TEMPLATE_CONF_CONFIRM_STATE);
407 state ? state = 0 : state = 1;
412 obj.op_value.value = 'f';
413 obj.op_value.label = rpt_strings.TEMPLATE_CONF_FALSE;
415 obj.op_value.value = 't';
416 obj.op_value.label = rpt_strings.TEMPLATE_CONF_TRUE;
420 targetCmd.removeEventListener( 'command', __bool_value_event_handler, true );
422 tree.view.selection.select( item_pos );
426 __handler_cache = __bool_value_event_handler;
427 targetCmd.addEventListener( 'command', __bool_value_event_handler, true );
434 var promptstring = rpt_strings.TEMPLATE_CONF_NO_MATCH;
438 promptstring = rpt_strings.TEMPLATE_CONF_NOT_BETWEEN;
442 promptstring = rpt_strings.TEMPLATE_CONF_BETWEEN;
446 promptstring = rpt_strings.TEMPLATE_CONF_NOT_IN;
450 promptstring = rpt_strings.TEMPLATE_CONF_IN;
454 promptstring = dojo.string.substitute( rpt_strings.TEMPLATE_CONF_DEFAULT, [obj.op_label]);
458 function __default_value_event_handler () {
460 if (_v = prompt( promptstring, obj.op_value.value || '' )) {
466 obj.op_value.value = _v.split(/\s*,\s*/);
470 obj.op_value.value = _v;
474 obj.op_value.label = '"' + obj.op_value.value + '"';
477 targetCmd.removeEventListener( 'command', __default_value_event_handler, true );
479 tree.view.selection.select( item_pos );
483 __handler_cache = __default_value_event_handler;
484 targetCmd.addEventListener( 'command', __default_value_event_handler, true );
493 function populateOperatorContext () {
495 var active_tab = filterByAttribute(
496 $('used-source-fields-tabbox').getElementsByTagName('tab'),
501 var tabname = active_tab.getAttribute('id');
503 var tabpanel = $( tabname + 'panel' );
504 var tree = tabpanel.getElementsByTagName('tree')[0];
505 var items = getSelectedItems(tree);
508 for (var i in items) {
510 dtypes.push( item.getAttribute('datatype') );
513 var menu = $(tabname + '_op_menu');
514 while (menu.firstChild) menu.removeChild(menu.lastChild);
516 for (var i in OILS_RPT_FILTERS) {
517 var o = OILS_RPT_FILTERS[i];
522 onmouseup : "changeOperator({op:'"+i+"',label:'"+o.label+"'})"
529 var keys = getKeys(o.labels);
530 for ( var k in keys ) {
532 if ( grep(function(x){return key==x},dtypes).length ) {
535 { label : o.labels[key],
536 onmouseup : "changeOperator({op:'"+i+"',label:'"+o.labels[key]+"'});"
546 function populateTransformContext () {
548 var active_tab = filterByAttribute(
549 $('used-source-fields-tabbox').getElementsByTagName('tab'),
554 var tabname = active_tab.getAttribute('id');
556 var tabpanel = $( tabname + 'panel' );
557 var tree = tabpanel.getElementsByTagName('tree')[0];
558 var items = getSelectedItems(tree);
561 for (var i in items) {
563 var dtype = item.getAttribute('datatype');
564 var item_transforms = getTransforms({ datatype : dtype });
566 for (var j in item_transforms) {
567 transforms[item_transforms[j]] = OILS_RPT_TRANSFORMS[item_transforms[j]];
568 transforms[item_transforms[j]].name = item_transforms[j];
572 var transformList = [];
573 for (var i in transforms) {
574 transformList.push( transforms[i] );
577 transformList.sort( sortHashLabels );
579 var menu = $(tabname + '_trans_menu');
580 while (menu.firstChild) menu.removeChild(menu.lastChild);
582 for (var i in transformList) {
583 var t = transformList[i];
585 if (tabname.match(/filter/)) {
586 if (tabname.match(/^agg/)) {
587 if (!t.aggregate) continue;
589 if (t.aggregate) continue;
595 { aggregate : t.aggregate,
600 onmouseup : "alterColumnTransform('"+t.name+"')"
606 menu.parentNode.setAttribute('disabled','false');
607 if (menu.childNodes.length == 0) {
608 menu.parentNode.setAttribute('disabled','true');
613 function renderSources (selected) {
615 var tree = $('used-sources');
616 var sources = $('used-sources-treetop');
617 var tabs = $('used-source-fields-tabbox').getElementsByTagName('tab');
620 while (sources.firstChild) sources.removeChild(sources.lastChild);
622 selected = getSelectedItems(tree);
623 if (!selected.length) {
624 selected = undefined;
625 while (sources.firstChild) sources.removeChild(sources.lastChild);
629 for (var j = 0; j < tabs.length; j++) {
631 var tabname = tab.getAttribute('id')
632 var tabpanel = $( tab.getAttribute('id') + 'panel' );
633 var fieldtree = tabpanel.getElementsByTagName('treechildren')[0];
635 while (fieldtree.firstChild) fieldtree.removeChild(fieldtree.lastChild);
638 for (var relation_alias in rpt_rel_cache) {
639 if (!rpt_rel_cache[relation_alias].fields) continue;
645 return x.getAttribute('relation') == relation_alias;
652 $('used-sources-treetop').appendChild(
654 { relation : rpt_rel_cache[relation_alias].alias,
655 idlclass : rpt_rel_cache[relation_alias].idlclass,
656 reltype : rpt_rel_cache[relation_alias].reltype,
657 path : rpt_rel_cache[relation_alias].path
661 createTreeCell({ label : rpt_rel_cache[relation_alias].label }),
662 createTreeCell({ label : rpt_rel_cache[relation_alias].table }),
663 createTreeCell({ label : rpt_rel_cache[relation_alias].alias }),
664 createTreeCell({ label : rpt_rel_cache[relation_alias].reltype })
670 for each (var tabname in ['filter_tab','aggfilter_tab']) {
671 tabpanel = $( tabname + 'panel' );
672 fieldtree = tabpanel.getElementsByTagName('treechildren')[0];
674 for (var colname in rpt_rel_cache[relation_alias].fields[tabname]) {
675 with (rpt_rel_cache[relation_alias].fields[tabname][colname]) {
676 fieldtree.appendChild(
678 { relation : relation_alias, datatype : datatype },
681 createTreeCell({ label : alias }),
682 createTreeCell({ label : colname }),
683 createTreeCell({ label : datatype }),
684 createTreeCell({ label : transform_label }),
685 createTreeCell({ label : transform })
690 fieldtree.lastChild.firstChild.appendChild(
691 createTreeCell({ op : op, label : op_label })
694 if (op_value.value != undefined) {
695 fieldtree.lastChild.firstChild.appendChild(
696 createTreeCell({ label : op_value.label })
704 tabpanel = $( 'dis_tabpanel' );
705 fieldtree = tabpanel.getElementsByTagName('treechildren')[0];
706 for each (var order in rpt_rel_cache.order_by) {
712 return x.getAttribute('relation') == order.relation;
719 with (rpt_rel_cache[order.relation].fields.dis_tab[order.field]) {
720 fieldtree.appendChild(
722 { relation : order.relation, datatype : datatype },
725 createTreeCell({ label : alias }),
726 createTreeCell({ label : colname }),
727 createTreeCell({ label : datatype }),
728 createTreeCell({ label : transform_label }),
729 createTreeCell({ label : transform })
734 fieldtree.lastChild.firstChild.appendChild(
735 createTreeCell({ op : op, label : op_label })
738 if (op_value.value != undefined) {
739 fieldtree.lastChild.firstChild.appendChild(
740 createTreeCell({ label : op_value.label })
750 filter_tab : 'where',
751 aggfilter_tab : 'having',
755 function save_template () {
760 core_class : $('sources-treetop').getElementsByTagName('treeitem')[0].getAttribute('idlclass'),
768 for (var relname in rpt_rel_cache) {
769 var relation = rpt_rel_cache[relname];
770 if (!relation.fields) continue;
772 // first, add the where and having clauses (easier)
773 for each (var tab_name in [ 'filter_tab', 'aggfilter_tab' ]) {
774 var tab = relation.fields[tab_name];
775 for (var field in tab) {
776 fleshTemplateField( template, relation, tab_name, field );
780 // now the from clause
781 fleshFromPath( template, relation );
784 // and now for select (based on order_by)
785 for each (var order in rpt_rel_cache.order_by)
786 fleshTemplateField( template, rpt_rel_cache[order.relation], 'dis_tab', order.field );
788 template.rel_cache = rpt_rel_cache;
790 //prompt( 'template', js2JSON( template ) );
792 // and the saving throw ...
794 var session = cgi.param('ses');
795 fetchUser( session );
798 tmpl.name( $('template-name').value );
799 tmpl.description( $('template-description').value );
800 tmpl.owner(USER.id());
801 tmpl.folder(cgi.param('folder'));
802 tmpl.data(js2JSON(template));
804 if(!confirm(dojo.string.substitute( rpt_strings.TEMPLATE_CONF_CONFIRM_SAVE, [tmpl.name(), tmpl.description()] )))
807 var req = new Request('open-ils.reporter:open-ils.reporter.template.create', session, tmpl);
808 req.request.alertEvent = false;
811 var res = r.getResultObject();
812 if(checkILSEvent(res)) {
815 if( res && res != '0' ) {
816 alert(dojo.string.substitute( rpt_strings.TEMPLATE_CONF_SUCCESS_SAVE, [tmpl.name()] ));
817 _l('../oils_rpt.xhtml');
826 function fleshFromPath ( template, rel ) {
827 var table_path = rel.path.split( /\./ );
828 if (table_path.length > 1 || rel.path.indexOf('-') > -1) table_path.push( rel.idlclass );
832 var current_path = '';
833 var current_obj = template.from;
835 while (link = table_path.shift()) {
837 if (prev_link != '') {
838 var prev_class = getIDLClass( prev_link.split(/-/)[0] );
839 var prev_field = prev_link.split(/-/)[1];
841 var prev_join = prev_field;
843 prev_field = prev_field.split(/>/)[0];
844 prev_join = prev_join.split(/>/)[1];
846 var current_link = getIDLLink( prev_class, prev_field );
847 current_obj.key = current_link.getAttribute('key');
849 //console.log("prev_link in fleshFromPath is: " + prev_link);
850 //console.log("prev_join in fleshFromPath is: " + prev_join);
852 if (prev_join) current_obj.type = prev_join
855 current_link.getAttribute('reltype') != 'has_a' ||
856 prev_type == 'left' ||
857 rel.reltype != 'has_a'
859 // This disallows outer joins when the item is used in a filter
861 // getKeys(rel.fields.filter_tab).length == 0 &&
862 // getKeys(rel.fields.aggfitler_tab).length == 0
865 ) current_obj.type = 'left';
867 prev_type = current_obj.type;
871 if (current_path) current_path += '-';
872 current_path += link.split(/>/)[0];
874 var leaf = table_path.length == 0 ? true : false;
876 current_obj.path = current_path;
877 current_obj.table = getSourceDefinition( link.split(/-/)[0] );
882 var join_type = link.split(/-/)[1];
884 join_type = join_type.split(/>/)[1];
885 if (join_type && join_type != 'undefined') current_obj.type = join_type;
888 current_obj.label = rel.label;
889 current_obj.alias = rel.alias;
890 current_obj.idlclass = rel.idlclass;
891 current_obj.template_path = rel.path;
893 var current_class = getIDLClass( link.split(/-/)[0] );
894 var join_field = link.split(/-/)[1];
895 var join_type = join_field;
897 join_field = join_field.split(/>/)[0];
898 join_type = join_type.split(/>/)[1];
900 //console.log("join_field in fleshFromPath is: " + join_field);
902 var join_link = getIDLLink(current_class, join_field);
904 if (join_link.getAttribute('reltype') != 'has_a') {
905 var fields_el = current_class.getElementsByTagName('fields')[0];
907 fields_el.getAttributeNS(persistNS, 'primary') +
908 '-' + join_link.getAttribute('class') +
909 '-' + join_link.getAttribute('key');
912 if (!current_obj.alias) current_obj.alias = hex_md5( current_path ) ;
913 join_field += '-' + current_obj.alias;
915 if (!current_obj.join) current_obj.join = {};
916 if (!current_obj.join[join_field]) current_obj.join[join_field] = {};
918 if (current_obj.type == 'left') current_obj.join[join_field].type = 'left';
920 current_obj = current_obj.join[join_field];
929 function fleshTemplateField ( template, rel, tab_name, field ) {
931 if (!rel.fields[tab_name] || !rel.fields[tab_name][field]) return;
933 var tab = rel.fields[tab_name];
935 var table_path = rel.path.split( /\./ );
936 if (table_path.length > 1 || rel.path.indexOf('-') > -1)
937 table_path.push( rel.idlclass );
939 table_path.push( field );
941 var field_path = table_path.join('-');
944 alias : tab[field].alias,
947 transform : tab[field].transform,
948 transform_label : tab[field].transform_label
954 if (tab_name.match(/filter/)) {
955 element.condition = {};
956 if (tab[field].op == 'is' || tab[field].op == 'is not' || tab[field].op == 'is blank' || tab[field].op == 'is not blank') {
957 element.condition[tab[field].op] = null;
959 element.condition[tab[field].op] =
960 tab[field].op_value.value ?
961 tab[field].op_value.value :
962 '::P' + param_count++;
966 template[tab_use[tab_name]].push(element);