|
@@ -117,7 +117,7 @@ function generateFormArray(){
|
|
|
print("generateFormArray "+getMode());
|
|
|
|
|
|
config.formConfig=new Object();
|
|
|
- config.formConfig.softwareVersion='0.1.9';
|
|
|
+ config.formConfig.softwareVersion='T.1.11';
|
|
|
//report software version
|
|
|
config.document.getElementById('version').innerText=config.formConfig.softwareVersion;
|
|
|
|
|
@@ -212,6 +212,44 @@ function addStudyData(){
|
|
|
|
|
|
}
|
|
|
|
|
|
+function filterEntry(entry,filter,settings){
|
|
|
+
|
|
|
+ if (entry.Form!=filter.form)
|
|
|
+ return false;
|
|
|
+
|
|
|
+ //only select forms where status matches the target status
|
|
|
+ if (entry.FormStatus!=filter.formStatus){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ print('Candidate '+entry.entryId);
|
|
|
+ //TODO: smart filter on user (now we get to see all)
|
|
|
+ //
|
|
|
+ //for editors
|
|
|
+
|
|
|
+ if ("filterUser" in settings && filter.role=='crfEditor' && entry.UserId!=filter.userId){
|
|
|
+ print('Skipping identity mismatch: '+entry.UserId+'/'+filter.userId);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //for others
|
|
|
+ let matchingSite=-1;
|
|
|
+ let potentialSiteNumbers="[";
|
|
|
+ for (let k=0;k<filter.sites.length;k++){
|
|
|
+ if (k>0) potentialSiteNumbers+=',';
|
|
|
+ potentialSiteNumbers+=filter.sites[k].siteNumber;
|
|
|
+ //skip mismatching sites
|
|
|
+ if (entry.Site!=filter.sites[k].siteNumber) continue;
|
|
|
+ matchingSite=filter.sites[k].siteNumber;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ potentialSiteNumbers+=']';
|
|
|
+ if (matchingSite==-1){
|
|
|
+ print('Skipping wrong site: '+entry.Site+'/'+potentialSiteNumbers);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+}
|
|
|
|
|
|
function fcontinue(){
|
|
|
let fName='[fcontinue]';
|
|
@@ -294,12 +332,19 @@ function fcontinue(){
|
|
|
msg+=')';
|
|
|
printMessage(msg);
|
|
|
|
|
|
+ let filter=new Object();
|
|
|
+ filter.role=config.role;
|
|
|
+ filter.userId=currentUser.UserId;
|
|
|
+ filter.sites=currentSites;
|
|
|
+
|
|
|
//browse through forms
|
|
|
for (let i=0;i<dataForms.length;i++){
|
|
|
|
|
|
//dataForms is Forms
|
|
|
let qForm=dataForms[i];
|
|
|
let formKey=qForm.Key;
|
|
|
+ filter.form=qForm.Key;
|
|
|
+
|
|
|
|
|
|
//add row for each form
|
|
|
let row=formConfig.table.insertRow(i);
|
|
@@ -311,44 +356,14 @@ function fcontinue(){
|
|
|
|
|
|
//get the target status
|
|
|
let formStatus=qForm[accessModeColumn];
|
|
|
+ filter.formStatus=qForm[accessModeColumn];
|
|
|
print('target formStatus '+formStatus);
|
|
|
|
|
|
- for (let j=0;j<fEntries.length;j++){
|
|
|
- let entry=fEntries[j];
|
|
|
- let formId=entry.Form;
|
|
|
-
|
|
|
- if (formId!=formKey)
|
|
|
- continue;
|
|
|
-
|
|
|
- //only select forms where status matches the target status
|
|
|
- if (entry.FormStatus!=formStatus){
|
|
|
- continue;
|
|
|
- }
|
|
|
|
|
|
- print('Candidate '+entry.entryId);
|
|
|
- //TODO: smart filter on user (now we get to see all)
|
|
|
- //
|
|
|
- //for editors
|
|
|
- if (config.role=='crfEditor' && entry.UserId!=currentUser.UserId){
|
|
|
- print('Skipping identity mismatch: '+entry.UserId+'/'+currentUser.UserId);
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- //for others
|
|
|
- let matchingSite=-1;
|
|
|
- let potentialSiteNumbers="[";
|
|
|
- for (let k=0;k<currentSites.length;k++){
|
|
|
- if (k>0) potentialSiteNumbers+=',';
|
|
|
- potentialSiteNumbers+=currentSites[k].siteNumber;
|
|
|
- if (entry.Site!=currentSites[k].siteNumber) continue;
|
|
|
- matchingSite=currentSites[k].siteNumber;
|
|
|
- break;
|
|
|
- }
|
|
|
- potentialSiteNumbers+=']';
|
|
|
- if (matchingSite==-1){
|
|
|
- print('Skipping wrong site: '+entry.Site+'/'+potentialSiteNumbers);
|
|
|
- continue;
|
|
|
- }
|
|
|
+ for (let j=0;j<fEntries.length;j++){
|
|
|
+ let entry=fEntries[j];
|
|
|
+ if (!filterEntry(entry,filter,config.formConfig.settings))
|
|
|
+ continue;
|
|
|
|
|
|
//insert form
|
|
|
//
|