Ignore:
Timestamp:
Mar 10, 2011, 1:06:54 PM (10 years ago)
Author:
robert@…
Message:

Bugfix in advanced query

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/exporter/ExporterController.groovy

    r1588 r1617  
    5050
    5151    def export = {
    52 
     52                def ids = params.list( 'ids' );
    5353        def studies = []
    54         for ( j in dbnp.studycapturing.Study.list() ){
    55             if (params.containsKey(j.code)){
    56                 studies.add(j)
    57             }
    58         }
     54               
     55                ids.each {
     56                        if( it.toString().isLong() ) {
     57                                def study = Study.get( Long.valueOf( it ) );
     58                                if( study )
     59                                        studies << study
     60                        }
     61                }
    5962       
    6063        if(studies.size()>1){
     
    6366            for (studyInstance in studies){
    6467                downloadFile(studyInstance,false)
    65                 files.add(new File("web-app/fileuploads/"+studyInstance.code+"_SimpleTox.xls"))
     68                files.add(new File("web-app/fileuploads/"+studyInstance.id+"_SimpleTox.xls"))
    6669            }
    6770
     
    166169        if(dl) {
    167170            println "Creation for downloading the file "+studyInstance.title+"_SimpleTox.xls"
    168             response.setHeader("Content-disposition", "attachment;filename=\"${studyInstance.code}_SimpleTox.xls\"")
     171            response.setHeader("Content-disposition", "attachment;filename=\"${studyInstance.title}_SimpleTox.xls\"")
    169172            response.setContentType("application/octet-stream")
    170173            wb.write(response.outputStream)
     
    174177        // Create the file and save into ZIP
    175178        if(!dl){
    176             FileOutputStream fileOut = new FileOutputStream("web-app/fileuploads/"+studyInstance.code+"_SimpleTox.xls", true)
     179            FileOutputStream fileOut = new FileOutputStream("web-app/fileuploads/"+studyInstance.id+"_SimpleTox.xls", true)
    177180            wb.write(fileOut)
    178181            fileOut.close()
Note: See TracChangeset for help on using the changeset viewer.