Browse Source

Adding crfRefForData which points to correct crfRef, actual or parentCrf for data entries

Andrej Studen 1 year ago
parent
commit
64ad1f57e5
1 changed files with 10 additions and 1 deletions
  1. 10 1
      web/crf/crfData.js

+ 10 - 1
web/crf/crfData.js

@@ -125,7 +125,12 @@ function(key=null){
    return qMap;
 }
 
-
+crfData.getCrfRefForData=
+function(){
+   let parentCrf=this.getCrfEntry()['parentCrf'];
+   if (!parentCrf) return this.getCrfEntry()['entryId'];
+   return parentCrf;
+}
 
 
 crfData.setDataLayout=
@@ -167,6 +172,10 @@ function(formId,role,cb){
    let q='reviewComments';
    queryArray.push(runQuery.makeQuery(dS,'data',q,q,[]));
    let rQueryId=qMapInverse[q];
+   if (!rQueryId){
+      this.print(fName+' missing query '+q+' in inputLists');
+      return
+   }
    this.addActiveQuery(crfSetup.getEntryMap('inputLists')[rQueryId]);
 	
    //debug