- Timestamp:
- Nov 17, 2010, 6:05:04 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/studycapturing/WizardController.groovy
r1155 r1162 647 647 on("switchTemplate") { 648 648 // handle form data 649 assayPage(flow, flash, params) 650 651 // find assay template 652 def template = Template.findByName( params.get('template') ) 653 654 if (flow.assay) { 655 // set template 656 flow.assay.template = template 657 } else { 658 // create a new assay instance 659 flow.assay = new Assay(template: template) 660 } 649 assayPage(flow, flash, params) 650 651 // find assay template 652 def template = Template.findByName(params.get('template')) 653 if (flow.assay) { 654 // set template 655 flow.assay.template = template 656 if (template) { 657 flow.assay.setFieldValue( 658 'externalAssayID', 659 this.ucwords(flow.study.code).replaceAll("([ ]{1,})", "") + '_' + this.ucwords(template.name).replaceAll("([ ]{1,})", "") 660 ) 661 } 662 } else { 663 // create a new assay instance 664 flow.assay = new Assay(template: template) 665 if (template) { 666 flow.assay.setFieldValue( 667 'externalAssayID', 668 this.ucwords(flow.study.code).replaceAll("([ ]{1,})", "") + '_' + this.ucwords(template.name).replaceAll("([ ]{1,})", "") 669 ) 670 } 671 } 661 672 662 673 // reset errors … … 890 901 */ 891 902 def loadStudy(flow, flash, params, user) { 892 // def authenticationService893 894 903 flash.wizardErrors = new LinkedHashMap() 895 904 … … 902 911 // the used should had never seen a link to this page, so he should never get 903 912 // here. That's why we just return false 904 // if (!study.canWrite(authenticationService.getLoggedInUser())) {905 913 if (!study.canWrite(user)){ 906 914 return false … … 1324 1332 // instantiate a sample for this subject / event 1325 1333 def samplingEventName = this.ucwords(event.template.name) 1326 def eventGroupName = eventGroup.name.replaceAll(/\w+/, { it[0].toUpperCase() + ((it.size() > 1) ? it[1..-1] : '') }).replaceAll("([ ]{1,})", "")1334 def eventGroupName = this.ucwords(eventGroup).replaceAll("([ ]{1,})", "") 1327 1335 def sampleName = (this.ucwords(subject.name) + '_' + samplingEventName + '_' + eventGroupName + '_' + new RelTime(event.startTime).toString()).replaceAll("([ ]{1,})", "") 1328 1336 def tempSampleIterator = 0 … … 1421 1429 eventGroup.samplingEvents.each() { samplingEvent -> 1422 1430 def samplingEventName = this.ucwords(samplingEvent.template.name) 1423 def eventGroupName = eventGroup.name.replaceAll(/\w+/, { it[0].toUpperCase() + ((it.size() > 1) ? it[1..-1] : '') }).replaceAll("([ ]{1,})", "")1431 def eventGroupName = this.ucwords(eventGroup) 1424 1432 def sampleName = (this.ucwords(subject.name) + '_' + samplingEventName + '_' + eventGroupName + '_' + new RelTime(samplingEvent.startTime).toString()).replaceAll("([ ]{1,})", "") 1425 1433 def tempSampleIterator = 0 … … 1491 1499 // set field value 1492 1500 if (!(field.name == 'name' && !value)) { 1493 println"setting "+field.name+" to "+value1501 log.info "setting "+field.name+" to "+value 1494 1502 sample.setFieldValue(field.name, value) 1495 1503 } … … 1506 1514 errors = true 1507 1515 this.appendErrors(sample, flash.wizardErrors, 'sample_' + sample.getIdentifier() + '_' ) 1508 println'error-> sample_'+sample.getIdentifier()1516 log.info 'error-> sample_'+sample.getIdentifier() 1509 1517 } 1510 1518 }
Note: See TracChangeset
for help on using the changeset viewer.