Browse Source

Verbosity in crfVisit

Andrej Studen 2 years ago
parent
commit
671b184391
1 changed files with 11 additions and 3 deletions
  1. 11 3
      web/crf/crfVisit.js

+ 11 - 3
web/crf/crfVisit.js

@@ -1486,8 +1486,8 @@ function populateTable(listName,writeMode,setup){
 }
 
 function getHelpVar(queryName,code,setup){
-   let fName='[getHelpVar('+code+')]';
-   print(fName);
+   let fName='[getHelpVar]';
+   print(fName+' code '+code);
    let subs=code.match(/_[^_]*_/g);
    if (!subs){
       print(fName+' no match for '+code);
@@ -1496,11 +1496,13 @@ function getHelpVar(queryName,code,setup){
    let rpc=new Object();
    for (let i=0;i<subs.length;i++){
       let c=subs[i].replace(/_/g,'');
+      print(fName+' ['+i+'] '+c);
       let qf=c.match(/\[[^\]]*\]/g);
       let lField=undefined;
       if (qf){
          qf[0]=qf[0].replace(/[\[\]]/g,'');
          lField=qf[0];
+         print(fName+' lField '+lField);
       }
       //drop field
       c=c.replace(/\[[^\]]*\]/,'');
@@ -1514,18 +1516,24 @@ function getHelpVar(queryName,code,setup){
          query=qq[0];
          vField=qq[1];
       }
+      
       let value='';
       if (vField in setup.setVariables){
          value=setup.setVariables[vField];
       }
       else{
          //robustify
+         if (!(query in config.formConfig.dataQueries)){
+            print(fName+' query '+query+' not available, check configuration');
+            return "INVALID";
+         }
          if (config.formConfig.dataQueries[query].rows.length==0){
             print(fName+' returning INVALID');
             return "INVALID";
          }
          value=config.formConfig.dataQueries[query].rows[0][vField];
       }
+      print(fName+' query '+query+' vField '+vField+' value '+value);
       if (lField==undefined){
          rpc[subs[i]]=value;
          continue;
@@ -3208,7 +3216,7 @@ function setFormConfig(){
 	//add object to store form related data
 	config.formConfig=new Object();
 
-	config.formConfig.softwareVersion='0.15.07';
+	config.formConfig.softwareVersion='0.15.09';
 	let debug=true;
 
 	if (debug)