|
@@ -1849,44 +1849,6 @@ function onUpdateForReview(){
|
|
|
}
|
|
|
|
|
|
function updateFlag(flag,action){
|
|
|
- let qconfig=new Object();
|
|
|
- qconfig.schemaName='lists';
|
|
|
- qconfig.queryName='crfEntry';
|
|
|
- qconfig.containerPath=getContainer('data');
|
|
|
- qconfig.success=function(data){setFlag(data,flag,action);}
|
|
|
- qconfig.filterArray=[LABKEY.Filter.create("entryId",getCRFref())];
|
|
|
- LABKEY.Query.selectRows(qconfig);
|
|
|
-}
|
|
|
-
|
|
|
-function setFlag(data,flag,action){
|
|
|
- let fName='[setFlag]';
|
|
|
- let debug=true;
|
|
|
- if (data.rows.length!=1){
|
|
|
- let msg=fName+": ERROR: Found "+data.rows.length;
|
|
|
- msg+=" entries for crfrefid "+getCRFref();
|
|
|
- print(msg);
|
|
|
- return;
|
|
|
- }
|
|
|
- let entry=data.rows[0];
|
|
|
- entry.FormStatus=flag;
|
|
|
- let uId=config.formConfig.currentUser.UserId;
|
|
|
- entry[config.formConfig.operator]=uId;
|
|
|
-
|
|
|
- print(fName+': Form: '+entry.Form);
|
|
|
- print(fName+": set form status to "+entry.FormStatus);
|
|
|
-
|
|
|
- let qconfig=new Object();
|
|
|
- qconfig.schemaName='lists';
|
|
|
- qconfig.queryName='crfEntry';
|
|
|
- qconfig.containerPath=getContainer('data');
|
|
|
- qconfig.rows=[entry];
|
|
|
-
|
|
|
- qconfig.success=function(data){completeWithFlag(data,action);};
|
|
|
- LABKEY.Query.updateRows(qconfig);
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-function updateFlag1(flag,action){
|
|
|
let fName='[updateFlag 1]';
|
|
|
let debug=true;
|
|
|
|
|
@@ -2598,32 +2560,29 @@ function afterData(){
|
|
|
let accessMode=config.formConfig.operator+'Mode';
|
|
|
let rowsSetup=config.formConfig.formSetupRows;
|
|
|
|
|
|
- let allowNewLocalId=config.formConfig.form['allowNewLocalId'];
|
|
|
+ let idMode=config.formConfig.form['idMode'];
|
|
|
|
|
|
- if (!allowNewLocalId) allowNewLocalId="FALSE";
|
|
|
+ if (!idMode) idMode="STUDY:EDIT";
|
|
|
|
|
|
- print(fName+': '+'generatePariticpantEntry '+allowNewLocalId);
|
|
|
+ print(fName+': idMode '+idMode);
|
|
|
|
|
|
|
|
|
config.print=print;
|
|
|
let pM=getParticipantManagerObject(config);
|
|
|
|
|
|
- if (allowNewLocalId=="TRUE") {
|
|
|
+ let idModeArray=idMode.split(':');
|
|
|
+ if (idModeArray.includes("LOCAL")) {
|
|
|
pM.mode="LOCAL";
|
|
|
}
|
|
|
else {
|
|
|
pM.mode="STUDY";
|
|
|
}
|
|
|
-
|
|
|
- pM.updateCrfEntry=function(){updateFlag1(config.formConfig.crfEntry['FormStatus'],doNothing);};
|
|
|
+ if (idModeArray.includes("READONLY")){
|
|
|
+ pM.readOnly="TRUE";
|
|
|
+ }
|
|
|
+ pM.updateCrfEntry=function(){updateFlag(config.formConfig.crfEntry['FormStatus'],doNothing);};
|
|
|
|
|
|
- print(fName+': pariticpantManager: '+pM+' config '+pM.config);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
let pId=pM.getParticipantIdFromCrfEntry();
|
|
|
- print(fName+' pId '+pId+' config '+pM.config);
|
|
|
if (!pId){
|
|
|
pM.setEditMode();
|
|
|
}
|
|
@@ -2744,7 +2703,8 @@ function populateSection(queryName){
|
|
|
|
|
|
|
|
|
function onGenerateQuery(queryName){
|
|
|
- print('onGenerateQuery '+queryName);
|
|
|
+ let fName='[onGenerateQuery]';
|
|
|
+ print(fName+' '+queryName);
|
|
|
|
|
|
let cfgRows=config.formConfig.generateConfigData.rows;
|
|
|
|
|
@@ -2786,15 +2746,16 @@ function onGenerateQuery(queryName){
|
|
|
}
|
|
|
|
|
|
function checkGenerationFields(queryName){
|
|
|
+ let fName='[checkGenerationFields]';
|
|
|
let genForm=config.formConfig.generateForm[queryName];
|
|
|
let genCfg=config.formConfig.generateConfig[queryName];
|
|
|
let mailRecipient=genCfg.emailRecipient;
|
|
|
|
|
|
|
|
|
- print('checkRegistrationFields');
|
|
|
- print('setRecipient: '+mailRecipient);
|
|
|
+ print(fName);
|
|
|
+ print(fName+' setRecipient: '+mailRecipient);
|
|
|
let formId=genForm.Key;
|
|
|
- print("Checking form w/id "+formId);
|
|
|
+ print(fName+" Checking form w/id "+formId);
|
|
|
let selectGenerationRows=selectFormSetupRows(formId);
|
|
|
|
|
|
for (let i=0;i<selectGenerationRows.length;i++){
|
|
@@ -2851,7 +2812,7 @@ function generateMessage(queryName,msg){
|
|
|
|
|
|
function generateForm(data,queryName,mailRecipient){
|
|
|
|
|
|
- print('generateForm, recpioent: '+mailRecipient);
|
|
|
+ print('generateForm, recipient: '+mailRecipient);
|
|
|
|
|
|
const nData=data.rows.length;
|
|
|
print('Registration: '+nData+' rows');
|
|
@@ -2874,6 +2835,10 @@ function generateForm(data,queryName,mailRecipient){
|
|
|
crfEntry["Date"]=new Date();
|
|
|
crfEntry["View"]="[VIEW]";
|
|
|
crfEntry.formStatus=1;
|
|
|
+
|
|
|
+ let pM=getParticipantManagerObject(config);
|
|
|
+
|
|
|
+ crfEntry[pM.getCrfEntryFieldName()]=pM.getParticipantIdFromCrfEntry();
|
|
|
|
|
|
|
|
|
|
|
@@ -2930,20 +2895,15 @@ function generateListEntry(formId,queryName,cb){
|
|
|
}
|
|
|
let nData=config.formConfig.dataQueries[queryName].rows.length
|
|
|
if (nData>0) return;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
+ let pM=getParticipantManagerObject(config);
|
|
|
+
|
|
|
+
|
|
|
let e2=new Object();
|
|
|
e2.crfRef=getCRFref();
|
|
|
e2.registrationStatus=0;
|
|
|
e2.submissionDate=new Date();
|
|
|
+ e2[pM.getCrfEntryFieldName()]=pM.getParticipantIdFromCrfEntry();
|
|
|
print('set values');
|
|
|
|
|
|
let qconfig=new Object();
|