瀏覽代碼

Modifying action call in sendEmail content; skip sending emails for empty recipient field

Andrej Studen 2 年之前
父節點
當前提交
216f21b189
共有 1 個文件被更改,包括 9 次插入3 次删除
  1. 9 3
      web/crfTecant/crfVisit.js

+ 9 - 3
web/crfTecant/crfVisit.js

@@ -2059,17 +2059,23 @@ function sendEmail(data,recipient='crfEditor',cb=redirect,subj='Form submitted')
 		print(cvar+' set to '+st[cvar]);
 		if (st[cvar]=='FALSE'){
 			print('Skipping sending emails');
-			redirect();
+			cb();
 			return;
 		}
 	}
-	
+	if (recpient==null){
+      print('Skipping sending emails w/ no recipients');
+      cb();
+      return;
+   }
+
+
 	print('send email '+data.rows.length);
 	let crf=data.rows[0]['entryId'];
 	let formId=data.rows[0]['Form'];
 	let link=LABKEY.ActionURL.getBaseURL();
 	link+=LABKEY.ActionURL.getContainer();
-	link+='/crf-visit.view?';
+	link+='/crf_tecant-visit.view?';
 	link+='entryId='+crf;
 	link+='&formId='+formId;
 	link+='&role='+recipient;