r2126 - in trunk: wao-services/src/main/java/fr/ifremer/wao/services/service wao-web/src/main/webapp/WEB-INF/content
Author: bleny Date: 2014-07-07 15:24:56 +0200 (Mon, 07 Jul 2014) New Revision: 2126 Url: http://forge.codelutin.com/projects/wao/repository/revisions/2126 Log: fixes #5388 fixe contact form for refusal state Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/UpdateContactCommand.java trunk/wao-web/src/main/webapp/WEB-INF/content/edit-contact-input.jsp Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java =================================================================== --- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java 2014-07-07 12:42:39 UTC (rev 2125) +++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java 2014-07-07 13:24:56 UTC (rev 2126) @@ -251,6 +251,11 @@ updateContactCommand.setTerrestrialLocationId(terrestrialLocationId); } + if (contact.getContactStateMotif() != null) { + String contactStateMotifId = contact.getContactStateMotif().getTopiaId(); + updateContactCommand.setContactStateMotifId(contactStateMotifId); + } + } else { throw new UnknownContactIdException(contactId); @@ -489,6 +494,14 @@ updateContactCommand.getContact().setTerrestrialLocation(terrestrialLocation); } + String contactStateMotifId = updateContactCommand.getContactStateMotifId(); + if (StringUtils.isBlank(contactStateMotifId)) { + updateContactCommand.getContact().setContactStateMotif(null); + } else { + ContactStateMotif contactStateMotif = getContactStateMotifDao().forTopiaIdEquals(contactStateMotifId).findUnique(); + updateContactCommand.getContact().setContactStateMotif(contactStateMotif); + } + } public void validate(AuthenticatedWaoUser authenticatedWaoUser, Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/UpdateContactCommand.java =================================================================== --- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/UpdateContactCommand.java 2014-07-07 12:42:39 UTC (rev 2125) +++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/UpdateContactCommand.java 2014-07-07 13:24:56 UTC (rev 2126) @@ -57,8 +57,10 @@ protected Set<String> secondaryObserverIds = new HashSet<>(); - private String terrestrialLocationId; + protected String terrestrialLocationId; + protected String contactStateMotifId; + public boolean isCreation() { return creation; } @@ -190,4 +192,12 @@ public void setTerrestrialLocationId(String terrestrialLocationId) { this.terrestrialLocationId = terrestrialLocationId; } + + public String getContactStateMotifId() { + return contactStateMotifId; + } + + public void setContactStateMotifId(String contactStateMotifId) { + this.contactStateMotifId = contactStateMotifId; + } } Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/edit-contact-input.jsp =================================================================== --- trunk/wao-web/src/main/webapp/WEB-INF/content/edit-contact-input.jsp 2014-07-07 12:42:39 UTC (rev 2125) +++ trunk/wao-web/src/main/webapp/WEB-INF/content/edit-contact-input.jsp 2014-07-07 13:24:56 UTC (rev 2126) @@ -35,7 +35,7 @@ $(document).ready(function () { - <s:if test="contact.obsProgram.obsMer"> + <s:if test="updateContactCommand.contact.obsProgram.obsMer"> var $mammalsCaptureCheckbox = $('#mammalsCaptureCheckbox'); var $mammalsInfo = $('#mammalsInfo'); @@ -52,12 +52,14 @@ var $contactStateMotif = $('#contactStateMotif'); var $contactStateSelect = $('select[name="updateContactCommand.contact.contactState"]'); + var $contactStateMotifSelect = $('select[name="updateContactCommand.contactStateMotifId"]'); var showHideContactStateMotif = function () { var contactState = $contactStateSelect.val(); if (contactState === 'CONTACT_REFUSED' || contactState === 'CONTACT_DEFINITELY_REFUSED') { $contactStateMotif.show(); } else { + $contactStateMotifSelect.val(''); $contactStateMotif.hide(); } }; @@ -261,8 +263,8 @@ <s:if test="updateContactCommand.contact.obsProgram.obsMer"> <div id="contactStateMotif"> - <s:select name="updateContactCommand.contact.contactStateMotif" - value="%{updateContactCommand.contact.contactState.topiaId}" + <s:select name="updateContactCommand.contactStateMotifId" + value="%{updateContactCommand.contactStateMotifId}" label="%{getText('wao.ui.field.Contact.contactStateMotif')}" list="contactStateMotives" emptyOption="true"
participants (1)
-
bleny@users.forge.codelutin.com