Pārlūkot izejas kodu

Adding insertRows and have onSubmit throw a copy of data to History snapshot lists

Andrej Studen 2 gadi atpakaļ
vecāks
revīzija
897665179b
1 mainītis faili ar 19 papildinājumiem un 2 dzēšanām
  1. 19 2
      web/crfTecant/crfVisit.js

+ 19 - 2
web/crfTecant/crfVisit.js

@@ -18,6 +18,20 @@ function print(msg){
 	el.value+="\n"+msg;
 }
 
+function insertRows(rows,schema,query,container,action){
+	//insert rows to container/schema/query and return with action
+	let fName="[insertRows]";
+	print(fName);
+	let qconfig=new Object();
+	qconfig.schemaName=schema;
+	qconfig.queryName=query;
+	qconfig.containerPath=container;
+	qconfig.rows=rows;
+	qconfig.success=action;
+	LABKEY.Query.insertRows(qconfig);
+	print(fName+" done");
+}
+
 function getCRFrefFirst(){
 	//crfRef is part of html call and gets stored in the page
 	return config.document.getElementById(config.crfRefId).innerHTML;
@@ -2030,9 +2044,12 @@ function verifyData(){
 	for (q in queries){
 		let qData=queries[q];
 		if (q=="reviewComments") continue;
+		//copy snapshot to history
+		insertRows(qData.rows,'lists',q+'History',getContainer('data'),doNothing);
 		//if it doesn't have additionalData, it is a sub query
-		if (!(q in config.formConfig.additionalData))
+		if (!(q in config.formConfig.additionalData)){
 			continue;
+		}
 		if (qData.rows.length<1){
 			printErr('Missing entry for query '+q);
 			return false;
@@ -3166,7 +3183,7 @@ function setFormConfig(){
 	//add object to store form related data
 	config.formConfig=new Object();
 
-	config.formConfig.softwareVersion='T.15.34';
+	config.formConfig.softwareVersion='T.15.35';
 	let debug=true;
 
 	if (debug)