This is an automated email from the git hooks/post-receive script. New commit to branch feature/9795_Mettre_référence_dans_mail in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git commit 8abdbf4d7d22e378cb49765ef26abb0537c46d36 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Jun 5 14:23:52 2018 +0200 refs #9795 : Mettre la référence dans le mail lors d'une réponse --- .../demande/actions/OpenReplyFormAction.java | 1 + .../actions/SaveAndOpenReplyFormAction.java | 1 + .../ui/swing/content/reply/ReplyFormUIHandler.java | 32 ++++++++++++++++++++++ .../i18n/faxtomail-ui-swing_fr_FR.properties | 2 ++ 4 files changed, 36 insertions(+) diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/OpenReplyFormAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/OpenReplyFormAction.java index 2248e6ac..2bb82348 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/OpenReplyFormAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/OpenReplyFormAction.java @@ -90,6 +90,7 @@ public class OpenReplyFormAction extends AbstractFaxToMailAction<DemandeListUIMo sender = FaxToMailServiceUtils.addFaxDomainToFaxNumber(sender, selectedFolder); } model.setTo(sender); + frameContent.getHandler().addReferences(); } } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/SaveAndOpenReplyFormAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/SaveAndOpenReplyFormAction.java index 4af49bde..e8d4b119 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/SaveAndOpenReplyFormAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/SaveAndOpenReplyFormAction.java @@ -77,5 +77,6 @@ public class SaveAndOpenReplyFormAction extends SaveAndOpenModalFrameAction<Repl sender = FaxToMailServiceUtils.addFaxDomainToFaxNumber(sender, currentDemand.getMailFolder()); } model.setTo(sender); + frameContent.getHandler().addReferences(); } } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java index 8efd789f..bfbf7d3b 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java @@ -40,6 +40,7 @@ import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; import com.google.common.collect.Lists; import jaxx.runtime.SwingUtil; import jaxx.runtime.validator.swing.SwingValidator; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; @@ -580,6 +581,37 @@ public class ReplyFormUIHandler extends AbstractFaxToMailUIHandler<ReplyFormUIMo } } + public void addReferences() { + ReplyFormUIModel model = getModel(); + String message = model.getMessage(); + DemandeUIModel demand = model.getOriginalDemand(); + if (message != null && demand != null) { + message = createReferences(demand) + message; + model.setMessage(message); + } + } + + protected String createReferences(DemandeUIModel demande) { + String refs = ""; + String projectReference = demande.getProjectReference(); + String companyReference = demande.getCompanyReference(); + String commandNumber = ""; + if (CollectionUtils.isNotEmpty(demande.getValidRangeRowModels())) { + commandNumber = demande.getValidRangeRowModels().get(0).getCommandNumber(); + } + + if (StringUtils.isNotBlank(projectReference)) { + refs += t("faxtomail.reply.projectReference", projectReference); + } + if (StringUtils.isNotBlank(companyReference) || StringUtils.isNotBlank(commandNumber)) { + refs += t("faxtomail.reply.companyReference", companyReference, commandNumber); + } + if (StringUtils.isNotBlank(refs)) { + refs += "<br>"; + } + return refs; + } + public void replaceSigning() { ReplyFormUIModel model = getModel(); String signing = createSigningContent(model.getFrom()); diff --git a/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties b/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties index cf93f20d..17b9ef35 100644 --- a/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties +++ b/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties @@ -311,6 +311,7 @@ faxtomail.reply.action.validate.tip=Envoyer la réponse au mail faxtomail.reply.attachment.label=%1$s (%2$s ko) faxtomail.reply.attachments.add.label=Ajouter des pièces jointes faxtomail.reply.attachments.title=Pièces-jointes (%1$s / %2$s ko autorisés) +faxtomail.reply.companyReference=Notre référence \: %1$s %2$s<br> faxtomail.reply.forward=Transfert de la réponse \: %s faxtomail.reply.forwardsubject=Tr\: %s faxtomail.reply.label.cc=Copie \: @@ -320,6 +321,7 @@ faxtomail.reply.label.from=De \: faxtomail.reply.label.subject=Objet \: faxtomail.reply.label.to=À \: faxtomail.reply.message=<html><body><p></p>%s<p>Le %s, %s a écrit \:</p><div style\='border-left\: 2px solid blue;padding-left\: 5px;'>%s</div> +faxtomail.reply.projectReference=Votre référence \: %1$s<br> faxtomail.reply.subject=Re \: %s faxtomail.reply.title=Réponse à \: %s faxtomail.reply.titleForward=Transfert à \: %s -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.