|
@@ -2238,6 +2238,22 @@ function(){
|
|
crfSetup.parseSetup(action);
|
|
crfSetup.parseSetup(action);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+crfVisit.findAppropriateRole=
|
|
|
|
+function(formStatus){
|
|
|
|
+//in order, from least powerful to most powerful
|
|
|
|
+
|
|
|
|
+ let roles=['crfEditor','crfMonitor','crfSponsor','crfManager'];
|
|
|
|
+ for (let i=0; i<roles.length;i++){
|
|
|
|
+ let role=roles[i];
|
|
|
|
+ let roleStatus=this.formEntry[role+'Status'];
|
|
|
|
+ if (roleStatus==formStatus){
|
|
|
|
+ return role;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
crfVisit.parseSetup=
|
|
crfVisit.parseSetup=
|
|
function(){
|
|
function(){
|
|
|
|
|
|
@@ -2268,10 +2284,23 @@ function(){
|
|
let formId=crfData.getCrfEntry()['Form'];
|
|
let formId=crfData.getCrfEntry()['Form'];
|
|
this.formEntry=crfSetup.getEntryMap('dataForms')[formId];
|
|
this.formEntry=crfSetup.getEntryMap('dataForms')[formId];
|
|
|
|
|
|
- let accessModeColumn=this.role+'Status';
|
|
|
|
- let targetStatus=this.formEntry[accessModeColumn];
|
|
|
|
let formStatus=crfData.getCrfEntry()['FormStatus'];
|
|
let formStatus=crfData.getCrfEntry()['FormStatus'];
|
|
|
|
|
|
|
|
+ if (!this.role){
|
|
|
|
+ this.print('Role undefined: ['+this.role+']');
|
|
|
|
+ let possibleRole=this.findAppropriateRole(formStatus);
|
|
|
|
+ this.print('Found possible role: ['+possibleRole+']');
|
|
|
|
+ this.role=possibleRole;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (this.role==null){
|
|
|
|
+ alert('Could not find appropriate role for form');
|
|
|
|
+ this.redirect();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let accessModeColumn=this.role+'Status';
|
|
|
|
+ let targetStatus=this.formEntry[accessModeColumn];
|
|
|
|
+
|
|
this.print(fName+' comparing status '+formStatus+'/'+targetStatus);
|
|
this.print(fName+' comparing status '+formStatus+'/'+targetStatus);
|
|
|
|
|
|
if (targetStatus!=formStatus){
|
|
if (targetStatus!=formStatus){
|