Skip to content

Commit

Permalink
Bugfix/issue 206 providermap error (#212)
Browse files Browse the repository at this point in the history
* issue #206 prevent saving new ProviderMap with a collection from an existing providerMap

* adding bugfix and feature branches to travis config
  • Loading branch information
sughics authored Jul 24, 2023
1 parent 3551bf4 commit bbbc2fb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ branches:
only:
- master
- develop
- feature/issue-175
- feature/grails5
- /^feature\/.*$/
- /^bugfix\/.*$/

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,14 @@ class ProviderMapController {
@Transactional
def save () {
def providerMapInstance = new ProviderMap(params)
if (providerMapInstance.collection && providerMapInstance.collection.providerMap){
flash.message = "${message(code: 'providerMap.collection.used.label', args: [providerMapInstance.collection.uid])}"
render(view: "create", model: [providerMapInstance: providerMapInstance, returnTo: params.returnTo])
return
}
if (providerMapInstance.save(flush: true)) {
flash.message = "${message(code: 'default.created.message', args: [message(code: 'providerMap.label', default: 'ProviderMap'), providerMapInstance.id])}"
redirect(action: "show", id: providerMapInstance.id, params:[returnTo: params.returnTo])
render(view: "create", model: [providerMapInstance: providerMapInstance, returnTo: params.returnTo])
}
else {
render(view: "create", model: [providerMapInstance: providerMapInstance, returnTo: params.returnTo])
Expand Down
1 change: 1 addition & 0 deletions grails-app/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,7 @@ providerMap.dateCreated.label=Date Created
providerMap.providerGroup.label=Provider Group
providerMap.institution.label=Institution
providerMap.collection.label=Collection
providerMap.collection.used.label= Unable to create or update ProviderMap. Collection {0} is already in use with another ProviderMap


#The following messages are for the Web Service page. They are not urgent to translate
Expand Down
2 changes: 1 addition & 1 deletion grails-app/views/providerMap/create.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div class="body">
<h1><g:message code="default.create.label" args="[entityName]" /></h1>
<g:if test="${flash.message}">
<div class="message">${flash.message}</div>
<div class="message alert alert-warning">${flash.message}</div>
</g:if>
<g:hasErrors bean="${providerMapInstance}">
<div class="errors">
Expand Down

0 comments on commit bbbc2fb

Please sign in to comment.