Author: bleny Date: 2012-03-13 15:31:25 +0100 (Tue, 13 Mar 2012) New Revision: 1562 Url: http://forge.codelutin.com/repositories/revision/wao/1562 Log: correction test suite ?\195?\160 changement des r?\195?\168gles de validation contact Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java 2012-03-13 10:57:45 UTC (rev 1561) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java 2012-03-13 14:31:25 UTC (rev 1562) @@ -376,37 +376,10 @@ message = "La date de saisie des données ne peut pas être postérieure à la date du jour"; } - // Non abouti, Refus ou Refus Définitif - if (success && contactState.isUnfinishedState()) { - - if (oldContact != null) { - - String newComment = contact.getComment(); - - boolean commentDefined = StringUtils.isNotEmpty(newComment); - boolean commentChanged = commentDefined && - !newComment.equals(oldContact.getComment()); - - // Ano #2540 : NPE on oldState, extract boolean for - // previous unfinishedState case - boolean previousUnfinishedState = commentDefined && - oldContact.getContactState() != null && oldContact.getContactState().isUnfinishedState(); - - // Ano #2440 : no restriction if previous state is unfinished - if (previousUnfinishedState || commentChanged) { - - // RAZ des champs - contact.setObservationBeginDate(null); - contact.setObservationEndDate(null); - contact.setMammalsCapture(false); - contact.setMammalsObservation(false); - contact.setDataInputDate(null); - - } else { - success = false; - message = WaoUtils._("wao.business.contact.validation.commentMissingForState", contact.getContactState().toString()); - } - } + // Non abouti + if (success && contactState == ContactState.OBSERVATION_CANCELLED && StringUtils.isBlank(contact.getComment())) { + success = false; + message = WaoUtils._("wao.business.contact.validation.commentMissingForState", contact.getContactState().toString()); // Observation réalisée } else if (success && contactState.equals(ContactState.OBSERVATION_DONE)) {