branch develop updated (6d26882 -> 49c9fba)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository pollen_1.x. See https://gitlab.nuiton.org/None/pollen_1.x.git from 6d26882 Update parent pom new 49c9fba fixes #1230 Can't add choice date in poll with message 'Date obligatoire', but date is correct The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 49c9fba10ddee0bc1acfc119c069025b53421b63 Author: Kevin Morin <morin@codelutin.com> Date: Fri Feb 24 16:41:20 2017 +0100 fixes #1230 Can't add choice date in poll with message 'Date obligatoire', but date is correct Summary of changes: .../pollen/ui/actions/poll/vote/AddChoice.java | 23 ++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen_1.x. See https://gitlab.nuiton.org/None/pollen_1.x.git commit 49c9fba10ddee0bc1acfc119c069025b53421b63 Author: Kevin Morin <morin@codelutin.com> Date: Fri Feb 24 16:41:20 2017 +0100 fixes #1230 Can't add choice date in poll with message 'Date obligatoire', but date is correct --- .../pollen/ui/actions/poll/vote/AddChoice.java | 23 ++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/AddChoice.java b/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/AddChoice.java index c5f1a8f..8ee7934 100644 --- a/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/AddChoice.java +++ b/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/AddChoice.java @@ -25,10 +25,11 @@ package org.chorem.pollen.ui.actions.poll.vote; import com.opensymphony.xwork2.Preparable; import com.opensymphony.xwork2.interceptor.annotations.InputConfig; import org.apache.commons.lang3.StringUtils; +import org.chorem.pollen.bean.PollDateChoice; import org.chorem.pollen.bean.PollImageChoice; import org.chorem.pollen.business.persistence.Choice; -import org.chorem.pollen.business.persistence.Poll; import org.chorem.pollen.business.persistence.ChoiceType; +import org.chorem.pollen.business.persistence.Poll; import org.chorem.pollen.services.PollenServiceFunctions; import org.chorem.pollen.services.exceptions.PollNotFoundException; import org.chorem.pollen.ui.actions.FileUploadAware; @@ -101,10 +102,7 @@ public class AddChoice extends AbstractVoteAction implements Preparable, FileUpl String propName = PollenServiceFunctions.CHOICE_TYPE_TO_PROPERTY_NAME.apply(choiceType); - String choiceName = choice.getName(); - - // -- Validate value notEmpty - if (StringUtils.isBlank(choiceName)) { + if (!isChoiceValid(choiceType)) { // -- Validate value notEmpty String typeLabel = getText(choiceType.getI18nKey()); addFieldError("choice." + propName, _("pollen.error.choice.empty", typeLabel)); @@ -116,7 +114,7 @@ public class AddChoice extends AbstractVoteAction implements Preparable, FileUpl for (Choice pollChoice : poll.getChoice()) { String pollChoiceName = pollChoice.getName(); - if (pollChoiceName.equals(choiceName)) { + if (pollChoiceName.equals(choice.getName())) { addFieldError("choice." + propName, _("pollen.error.poll.choice.already.used.name")); break; @@ -135,4 +133,17 @@ public class AddChoice extends AbstractVoteAction implements Preparable, FileUpl return SUCCESS; } + private boolean isChoiceValid(ChoiceType choiceType) { + boolean result = false; + if (choice != null) { + if (ChoiceType.DATE == choiceType) { + PollDateChoice datechoice = (PollDateChoice) choice; + result = datechoice.getDate() != null; + } else { + result = StringUtils.isNotBlank(choice.getName()); + } + } + return result; + } + } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm