Changeset 1188

Show
Ignore:
Timestamp:
23-11-10 09:47:15 (3 years ago)
Author:
robert@…
Message:

Fixed deletion of studies (see ticket #201)

Location:
trunk/grails-app
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/studycapturing/StudyController.groovy

    r1181 r1188  
    202202    } 
    203203 
     204    def delete = { 
     205        def studyInstance = Study.get(params.id) 
     206        if (studyInstance) { 
     207            try { 
     208                studyInstance.delete(flush: true) 
     209                flash.message = "${message(code: 'default.deleted.message', args: [message(code: 'study.label', default: 'Study'), params.id])}" 
     210                redirect(action: "list") 
     211            } 
     212            catch (org.springframework.dao.DataIntegrityViolationException e) { 
     213                flash.message = "${message(code: 'default.not.deleted.message', args: [message(code: 'study.label', default: 'Study'), params.id])}" 
     214                redirect(action: "show", id: params.id) 
     215            } 
     216        } 
     217        else { 
     218            flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'study.label', default: 'Study'), params.id])}" 
     219            redirect(action: "list") 
     220        } 
     221    } 
     222 
    204223    /*def edit = { 
    205224        def studyInstance = Study.get(params.id) 
     
    239258        } 
    240259    } 
    241  
    242     def delete = { 
    243         def studyInstance = Study.get(params.id) 
    244         if (studyInstance) { 
    245             try { 
    246                 studyInstance.delete(flush: true) 
    247                 flash.message = "${message(code: 'default.deleted.message', args: [message(code: 'study.label', default: 'Study'), params.id])}" 
    248                 redirect(action: "list") 
    249             } 
    250             catch (org.springframework.dao.DataIntegrityViolationException e) { 
    251                 flash.message = "${message(code: 'default.not.deleted.message', args: [message(code: 'study.label', default: 'Study'), params.id])}" 
    252                 redirect(action: "show", id: params.id) 
    253             } 
    254         } 
    255         else { 
    256             flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'study.label', default: 'Study'), params.id])}" 
    257             redirect(action: "list") 
    258         } 
    259     }*/ 
     260*/ 
    260261} 
  • trunk/grails-app/views/study/show.gsp

    r1182 r1188  
    867867    <br> 
    868868    <div class="buttons"> 
    869       <g:form> 
     869      <g:form action="delete"> 
    870870        <g:if test="${studyList?.size() == 1}"> 
    871871          <g:set var="studyInstance" value="${studyList[0]}" />