branch develop updated (40300ca -> 40099ed)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git from 40300ca montées de version new 40099ed fixes #8917 Envoi d’un mail d’accusé de réception pour chaque document reçu 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 40099ed8ede5c124c0ebfc402d33d74dd4b55e87 Author: Kevin Morin <morin@codelutin.com> Date: Thu Jan 19 16:50:32 2017 +0100 fixes #8917 Envoi d’un mail d’accusé de réception pour chaque document reçu Summary of changes: faxtomail-persistence/pom.xml | 2 +- .../persistence/entities/ClientTopiaDao.java | 23 +++ faxtomail-persistence/src/main/xmi/faxtomail.zargo | Bin 32870 -> 33422 bytes faxtomail-service/pom.xml | 2 +- .../faxtomail/services/FaxToMailServiceUtils.java | 4 +- .../faxtomail/services/service/ClientService.java | 2 + .../services/service/ClientServiceImpl.java | 5 + .../faxtomail/services/service/EmailService.java | 2 +- .../services/service/EmailServiceImpl.java | 17 +- ..._add_acknowledgements_and_client_exceptions.sql | 27 +++ ..._add_acknowledgements_and_client_exceptions.sql | 31 ++++ faxtomail-ui-swing/pom.xml | 2 +- faxtomail-ui-web/pom.xml | 28 +++- .../web/action/admin/ClientJsonAction.java | 63 +++++++ .../faxtomail/web/job/MailFilterJob.java | 91 +++++++--- faxtomail-ui-web/src/main/resources/log4j2.xml | 2 +- .../WEB-INF/content/admin/configuration-input.jsp | 186 +++++++++++++++++---- faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml | 19 +++ .../web/HasUploadedFile.java => webapp/data.json} | 70 ++++++-- .../src/main/webapp/js/configuration.js | 157 ++++++++++++++--- pom.xml | 50 +++++- 21 files changed, 663 insertions(+), 120 deletions(-) create mode 100644 faxtomail-service/src/main/resources/db/migration/h2/V2_2_0_170109__add_acknowledgements_and_client_exceptions.sql create mode 100644 faxtomail-service/src/main/resources/db/migration/sqlserver/V2_2_0_170109__add_acknowledgements_and_client_exceptions.sql create mode 100644 faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ClientJsonAction.java copy faxtomail-ui-web/src/main/{java/com/franciaflex/faxtomail/web/HasUploadedFile.java => webapp/data.json} (50%) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git commit 40099ed8ede5c124c0ebfc402d33d74dd4b55e87 Author: Kevin Morin <morin@codelutin.com> Date: Thu Jan 19 16:50:32 2017 +0100 fixes #8917 Envoi d’un mail d’accusé de réception pour chaque document reçu --- faxtomail-persistence/pom.xml | 2 +- .../persistence/entities/ClientTopiaDao.java | 23 +++ faxtomail-persistence/src/main/xmi/faxtomail.zargo | Bin 32870 -> 33422 bytes faxtomail-service/pom.xml | 2 +- .../faxtomail/services/FaxToMailServiceUtils.java | 4 +- .../faxtomail/services/service/ClientService.java | 2 + .../services/service/ClientServiceImpl.java | 5 + .../faxtomail/services/service/EmailService.java | 2 +- .../services/service/EmailServiceImpl.java | 17 +- ..._add_acknowledgements_and_client_exceptions.sql | 27 +++ ..._add_acknowledgements_and_client_exceptions.sql | 31 ++++ faxtomail-ui-swing/pom.xml | 2 +- faxtomail-ui-web/pom.xml | 28 +++- .../web/action/admin/ClientJsonAction.java | 63 +++++++ .../faxtomail/web/job/MailFilterJob.java | 91 +++++++--- faxtomail-ui-web/src/main/resources/log4j2.xml | 2 +- .../WEB-INF/content/admin/configuration-input.jsp | 186 +++++++++++++++++---- faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml | 19 +++ faxtomail-ui-web/src/main/webapp/data.json | 74 ++++++++ .../src/main/webapp/js/configuration.js | 157 ++++++++++++++--- pom.xml | 50 +++++- 21 files changed, 684 insertions(+), 103 deletions(-) diff --git a/faxtomail-persistence/pom.xml b/faxtomail-persistence/pom.xml index 2415088..6c12bd7 100644 --- a/faxtomail-persistence/pom.xml +++ b/faxtomail-persistence/pom.xml @@ -25,7 +25,7 @@ <parent> <artifactId>faxtomail</artifactId> <groupId>com.franciaflex</groupId> - <version>2.1.5-SNAPSHOT</version> + <version>2.2.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java b/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java index eea5560..48125a5 100644 --- a/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java +++ b/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java @@ -54,4 +54,27 @@ public class ClientTopiaDao extends AbstractClientTopiaDao<Client> { return result; } + public List<Client> forNameStartsWith(String nameQuery) { + + String query = "FROM " + Client.class.getName() + " WHERE UPPER(" + Client.PROPERTY_NAME + ") LIKE :propValue"; + + Map<String, Object> args = new HashMap<>(); + args.put("propValue", nameQuery.toUpperCase() + "%"); + return findAll(query, args); + } + + + public List<Client> forEmailAddressOrCodeLike(String searchQuery) { + Preconditions.checkArgument(StringUtils.isNotBlank(searchQuery), "Empty query can produce unexcepted results"); + + String query = "FROM " + Client.class.getName() + + " WHERE LOWER(" + Client.PROPERTY_EMAIL_ADDRESSES_JSON + ") LIKE :searchEmail" + + " OR UPPER(" + Client.PROPERTY_CODE + ") LIKE :searchCode"; + + Map<String, Object> args = new HashMap<>(); + args.put("searchEmail", "%" + searchQuery.toLowerCase() + "%"); + args.put("searchCode", searchQuery.toUpperCase() + "%"); + return findAll(query, args); + } + } //ClientTopiaDao diff --git a/faxtomail-persistence/src/main/xmi/faxtomail.zargo b/faxtomail-persistence/src/main/xmi/faxtomail.zargo index 7ad8168..23ac433 100644 Binary files a/faxtomail-persistence/src/main/xmi/faxtomail.zargo and b/faxtomail-persistence/src/main/xmi/faxtomail.zargo differ diff --git a/faxtomail-service/pom.xml b/faxtomail-service/pom.xml index 622663b..57fbbd8 100644 --- a/faxtomail-service/pom.xml +++ b/faxtomail-service/pom.xml @@ -27,7 +27,7 @@ <parent> <artifactId>faxtomail</artifactId> <groupId>com.franciaflex</groupId> - <version>2.1.5-SNAPSHOT</version> + <version>2.2.0-SNAPSHOT</version> </parent> <groupId>com.franciaflex.faxtomail</groupId> diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java index 636e576..f708e7a 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java @@ -180,8 +180,8 @@ public class FaxToMailServiceUtils { text = (String) message.getContent(); } catch (Exception e) { - if (log.isWarnEnabled()) { - log.warn("Error while getting the text from the message, reading the raw data", e); + if (log.isDebugEnabled()) { + log.debug("Error while getting the text from the message, reading the raw data", e); } InputStream inputStream = message.getRawInputStream(); Charset charset = getCharset(message); diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java index 29c436a..9400479 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java @@ -46,4 +46,6 @@ public interface ClientService extends FaxToMailService { void updateNewClients(); List<Client> getAllClientsForUser(FaxToMailUser currentUser); + + List<Client> getAllClientsForEmailOrFax(String query); } diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java index 7382c76..1df87b4 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java @@ -334,6 +334,11 @@ public class ClientServiceImpl extends FaxToMailServiceSupport implements Client return result; } + @Override + public List<Client> getAllClientsForEmailOrFax(String query) { + return getPersistenceContext().getClientDao().forEmailAddressOrCodeLike(query); + } + protected void fetchCompaniesFromFolders(Collection<MailFolder> folders, Set<String> companies) { for (MailFolder folder : folders) { if (folder.isUseCurrentLevelCompany()) { diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java index 1489b25..76f4249 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java @@ -122,7 +122,7 @@ public interface EmailService extends FaxToMailService { void unlockMails(List<String> mailLockIds); - void rejectEmail(String from, String to, String subject, String content) + void sendHtmlEmail(String from, String to, String subject, String content, String signing) throws EmailException, MessagingException, IOException; void updateRangeRowsWithEdiReturns(); diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java index cc7c8b5..1a906ed 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java @@ -114,7 +114,6 @@ import org.apache.commons.mail.DefaultAuthenticator; import org.apache.commons.mail.EmailConstants; import org.apache.commons.mail.EmailException; import org.apache.commons.mail.HtmlEmail; -import org.apache.commons.mail.MultiPartEmail; import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.StatelessSession; @@ -1121,7 +1120,6 @@ public class EmailServiceImpl extends FaxToMailServiceSupport implements EmailSe * @param bcc bcc * @param subject subject * @param content content - * @param signing signing * @param attachments attachement * @param originalEmailId mail topia id * @param user user to add new history entry for user @@ -1319,14 +1317,14 @@ public class EmailServiceImpl extends FaxToMailServiceSupport implements EmailSe } @Override - public void rejectEmail(String from, String to, String subject, String content) + public void sendHtmlEmail(String from, String to, String subject, String content, String signing) throws EmailException, MessagingException, IOException { final String smtpUser = getApplicationConfig().getSmtpUser(); final String password = getApplicationConfig().getSmtpPassword(); final boolean useSsl = getApplicationConfig().isSmtpUseSsl(); - MultiPartEmail message = new MultiPartEmail(); + HtmlEmail message = new HtmlEmail(); message.setHostName(getApplicationConfig().getSmtpHost()); message.setSmtpPort(getApplicationConfig().getSmtpPort()); if (StringUtils.isNotBlank(smtpUser) && password != null) { @@ -1336,9 +1334,18 @@ public class EmailServiceImpl extends FaxToMailServiceSupport implements EmailSe message.setCharset(EmailConstants.UTF_8); message.setFrom(from); + message.addTo(to); message.setSubject(subject); - message.setMsg(content); + + StringBuilder toSendContent = new StringBuilder("<html><body>"); + toSendContent.append(content); + if (StringUtils.isNotEmpty(signing)) { + toSendContent.append("<p><img src='").append(signing).append("'/></p>"); + } + toSendContent.append("</body></html>"); + + message.setHtmlMsg(toSendContent.toString()); message.send(); } diff --git a/faxtomail-service/src/main/resources/db/migration/h2/V2_2_0_170109__add_acknowledgements_and_client_exceptions.sql b/faxtomail-service/src/main/resources/db/migration/h2/V2_2_0_170109__add_acknowledgements_and_client_exceptions.sql new file mode 100644 index 0000000..8ec6e83 --- /dev/null +++ b/faxtomail-service/src/main/resources/db/migration/h2/V2_2_0_170109__add_acknowledgements_and_client_exceptions.sql @@ -0,0 +1,27 @@ +-- add mail folder acknowledgement +alter table mailfolder add SENDACKNOWLEDGEMENTTOSENDER boolean; +alter table mailfolder add ACKNOWLEDGEMENTMAILADDRESS varchar(255); +alter table mailfolder add ACKNOWLEDGEMENTMESSAGE varchar(255); +alter table mailfolder add ACKNOWLEDGEMENTSIGNING varchar(MAX); +alter table mailfolder add rejectResponseSigning varchar(MAX); +alter table mailfolder drop REJECTUNKNOWNSENDER; +update mailfolder set SENDACKNOWLEDGEMENTTOSENDER = 'f'; + +-- add matching clients in email + +create table ACKNOWLEDGEMENTEXCEPTION_MAILFOLDER ( + MAILFOLDER varchar(255) not null, + ACKNOWLEDGEMENTEXCEPTION varchar(255) not null +); + +alter table ACKNOWLEDGEMENTEXCEPTION_MAILFOLDER + add constraint FK_NNT5VNK8P09DIU5YP1V9FD1LS + foreign key (ACKNOWLEDGEMENTEXCEPTION) + references client; + +alter table ACKNOWLEDGEMENTEXCEPTION_MAILFOLDER + add constraint FK_MSSQC9QI74V9XH1CJIIDJWYU8 + foreign key (MAILFOLDER) + references mailfolder; + +CREATE INDEX idx_ACKNOWLEDGEMENTEXCEPTION_MAILFOLDER ON ACKNOWLEDGEMENTEXCEPTION_MAILFOLDER(MAILFOLDER); \ No newline at end of file diff --git a/faxtomail-service/src/main/resources/db/migration/sqlserver/V2_2_0_170109__add_acknowledgements_and_client_exceptions.sql b/faxtomail-service/src/main/resources/db/migration/sqlserver/V2_2_0_170109__add_acknowledgements_and_client_exceptions.sql new file mode 100644 index 0000000..785ddc1 --- /dev/null +++ b/faxtomail-service/src/main/resources/db/migration/sqlserver/V2_2_0_170109__add_acknowledgements_and_client_exceptions.sql @@ -0,0 +1,31 @@ +-- add mail folder acknowledgement +alter table mailfolder add SENDACKNOWLEDGEMENTTOSENDER bit; +alter table mailfolder add ACKNOWLEDGEMENTMAILADDRESS varchar(255); +alter table mailfolder add ACKNOWLEDGEMENTMESSAGE varchar(MAX); +alter table mailfolder add ACKNOWLEDGEMENTSIGNING varchar(MAX); +alter table mailfolder add rejectResponseSigning varchar(MAX); +alter table mailfolder drop REJECTUNKNOWNSENDER; +GO +update mailfolder set SENDACKNOWLEDGEMENTTOSENDER = '0'; +GO + +-- add matching clients in email + +create table ACKNOWLEDGEMENTEXCEPTION_MAILFOLDER ( + MAILFOLDER varchar(255) not null, + ACKNOWLEDGEMENTEXCEPTION varchar(255) not null +); +GO + +alter table ACKNOWLEDGEMENTEXCEPTION_MAILFOLDER + add constraint FK_NNT5VNK8P09DIU5YP1V9FD1LS + foreign key (ACKNOWLEDGEMENTEXCEPTION) + references client; + +alter table ACKNOWLEDGEMENTEXCEPTION_MAILFOLDER + add constraint FK_MSSQC9QI74V9XH1CJIIDJWYU8 + foreign key (MAILFOLDER) + references mailfolder; + +CREATE INDEX idx_ACKNOWLEDGEMENTEXCEPTION_MAILFOLDER ON ACKNOWLEDGEMENTEXCEPTION_MAILFOLDER(MAILFOLDER); +GO \ No newline at end of file diff --git a/faxtomail-ui-swing/pom.xml b/faxtomail-ui-swing/pom.xml index 456756c..d1084e5 100644 --- a/faxtomail-ui-swing/pom.xml +++ b/faxtomail-ui-swing/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>com.franciaflex</groupId> <artifactId>faxtomail</artifactId> - <version>2.1.5-SNAPSHOT</version> + <version>2.2.0-SNAPSHOT</version> </parent> <groupId>com.franciaflex.faxtomail</groupId> diff --git a/faxtomail-ui-web/pom.xml b/faxtomail-ui-web/pom.xml index d1cc186..75ca1fb 100644 --- a/faxtomail-ui-web/pom.xml +++ b/faxtomail-ui-web/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>com.franciaflex</groupId> <artifactId>faxtomail</artifactId> - <version>2.1.5-SNAPSHOT</version> + <version>2.2.0-SNAPSHOT</version> </parent> <groupId>com.franciaflex.faxtomail</groupId> @@ -233,13 +233,23 @@ <artifactId>select2</artifactId> <exclusions> <exclusion> - <artifactId>jquery</artifactId> <groupId>org.webjars</groupId> + <artifactId>jquery</artifactId> </exclusion> </exclusions> </dependency> <dependency> + <groupId>org.webjars</groupId> + <artifactId>ui-select</artifactId> + </dependency> + + <dependency> + <groupId>org.webjars</groupId> + <artifactId>angular-sanitize</artifactId> + </dependency> + + <dependency> <groupId>org.nuiton.js</groupId> <artifactId>nuiton-js-angularjs</artifactId> </dependency> @@ -259,8 +269,8 @@ <artifactId>angular-ui-bootstrap</artifactId> <exclusions> <exclusion> - <artifactId>bootstrap</artifactId> <groupId>org.webjars</groupId> + <artifactId>bootstrap</artifactId> </exclusion> </exclusions> </dependency> @@ -270,8 +280,8 @@ <artifactId>angular-ui-sortable</artifactId> <exclusions> <exclusion> - <artifactId>jquery-ui</artifactId> <groupId>org.webjars</groupId> + <artifactId>jquery-ui</artifactId> </exclusion> </exclusions> </dependency> @@ -287,6 +297,16 @@ </dependency> <dependency> + <groupId>org.webjars.bower</groupId> + <artifactId>trix</artifactId> + </dependency> + + <dependency> + <groupId>org.webjars.bower</groupId> + <artifactId>angular-trix</artifactId> + </dependency> + + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> </dependency> diff --git a/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ClientJsonAction.java b/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ClientJsonAction.java new file mode 100644 index 0000000..b78c8f0 --- /dev/null +++ b/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ClientJsonAction.java @@ -0,0 +1,63 @@ +package com.franciaflex.faxtomail.web.action.admin; + +/*- + * #%L + * FaxToMail :: Web + * $Id:$ + * $HeadURL:$ + * %% + * Copyright (C) 2014 - 2017 Mac-Groupe, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.franciaflex.faxtomail.services.service.ClientService; +import com.franciaflex.faxtomail.web.FaxToMailJsonAction; +import org.apache.struts2.convention.annotation.Action; + +/** + * @author Kevin Morin (Code Lutin) + * @since x.x + */ +public class ClientJsonAction extends FaxToMailJsonAction { + + protected ClientService clientService; + + /** Start of the client name to search */ + protected String clientQuery; + + protected Object jsonData; + + public void setClientService(ClientService clientService) { + this.clientService = clientService; + } + + public void setClientQuery(String clientQuery) { + this.clientQuery = clientQuery; + } + + @Action("search-clients-json") + public String searchClients() { + jsonData = clientService.getAllClientsForEmailOrFax(clientQuery); + return SUCCESS; + } + + @Override + public Object getJsonData() { + return jsonData; + } + +} diff --git a/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java b/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java index 02d5c5e..f9994d7 100644 --- a/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java +++ b/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java @@ -47,6 +47,7 @@ import com.franciaflex.faxtomail.services.service.MailFolderService; import com.google.common.base.Function; import com.google.common.collect.Collections2; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -393,7 +394,7 @@ public class MailFilterJob extends AbstractFaxToMailJob { if (mailFolder == null) { // to default folder - mailFolder = filter.getMailFolder(); + mailFolder = filterFolder; } email.setMailFolder(mailFolder); @@ -401,22 +402,19 @@ public class MailFilterJob extends AbstractFaxToMailJob { // if client is null and folder if (client == null && emailAccount.isRejectAllowed()) { - Boolean reject = null; String rejectMessage = null; + String rejectSiging = null; String senderEmail = null; // find reject conf MailFolder rejectMailFolder = mailFolder; - while (!Boolean.FALSE.equals(reject) && rejectMailFolder != null - && (reject == null - || !rejectMailFolder.isUseCurrentLevelRejectResponseMessage() + while (rejectMailFolder != null + && (!rejectMailFolder.isUseCurrentLevelRejectResponseMessage() || !rejectMailFolder.isUseCurrentLevelRejectResponseMailAddress())) { - if (reject == null) { - reject = rejectMailFolder.getRejectUnknownSender(); - } if (rejectMessage == null && rejectMailFolder.isUseCurrentLevelRejectResponseMessage()) { rejectMessage = rejectMailFolder.getRejectResponseMessage(); + rejectSiging = rejectMailFolder.getRejectResponseSigning(); } if (senderEmail == null && rejectMailFolder.isUseCurrentLevelRejectResponseMailAddress()) { senderEmail = rejectMailFolder.getRejectResponseMailAddress(); @@ -424,28 +422,27 @@ public class MailFilterJob extends AbstractFaxToMailJob { rejectMailFolder = rejectMailFolder.getParent(); } - if (Boolean.TRUE.equals(reject)) { - - if (StringUtils.isAnyBlank(senderEmail, rejectMessage)) { - if (log.isWarnEnabled()) { - log.warn("Can't send reject message due to invalid configuration"); - } - } else { - // unknown client -> message rejected - String recipient = email.getSender(); - if (email.isFax()) { - recipient = FaxToMailServiceUtils.addFaxDomainToFaxNumber(recipient, mailFolder); - } - emailService.rejectEmail(senderEmail, recipient, t("faxtomail.email.subject.re", message.getSubject()), rejectMessage); - - // important, delete mail - deleteMail(message); + if (StringUtils.isNoneBlank(senderEmail, rejectMessage)) { + // unknown client -> message rejected + String recipient = email.getSender(); + if (email.isFax()) { + recipient = FaxToMailServiceUtils.addFaxDomainToFaxNumber(recipient, mailFolder); } - - continue; + emailService.sendHtmlEmail(senderEmail, + recipient, + t("faxtomail.email.subject.re", message.getSubject()), + rejectMessage, + rejectSiging); + + // important, delete mail + deleteMail(message); } + + continue; } + } else { + email.setMailFolder(filterFolder); } Date receivedDate = new Date(); @@ -482,6 +479,47 @@ public class MailFilterJob extends AbstractFaxToMailJob { log.debug(" ==> Message placé dans le dossier " + email.getMailFolder().getName()); } + // send acknowledgement if needed + MailFolder rootFolder = email.getMailFolder(); + while (rootFolder.getParent() != null) { + rootFolder = rootFolder.getParent(); + } + boolean sendAcknowledgementToSender = BooleanUtils.isTrue(rootFolder.getSendAcknowledgementToSender()) + && !rootFolder.containsAcknowledgementException(email.getClient()) + || BooleanUtils.isNotTrue(rootFolder.getSendAcknowledgementToSender()) + && rootFolder.containsAcknowledgementException(email.getClient()); + if (log.isDebugEnabled()) { + log.debug(email.getClient()); + log.debug(rootFolder.containsAcknowledgementException(email.getClient())); + log.debug("Send acknowledgement ? " + sendAcknowledgementToSender); + } + + if (sendAcknowledgementToSender) { + + String acknowledgementMailAddress = rootFolder.getAcknowledgementMailAddress(); + String acknowledgementMessage = rootFolder.getAcknowledgementMessage(); + + if (StringUtils.isAnyBlank(acknowledgementMailAddress, acknowledgementMessage)) { + if (log.isErrorEnabled()) { + log.error("Can't send acknowledgement message due to invalid configuration"); + } + } else { + String recipient = email.getSender(); + if (email.isFax()) { + recipient = FaxToMailServiceUtils.addFaxDomainToFaxNumber(recipient, email.getMailFolder()); + } + if (log.isDebugEnabled()) { + log.debug("Send acknowledgement to " + recipient); + } + emailService.sendHtmlEmail(acknowledgementMailAddress, + recipient, + t("faxtomail.email.subject.re", message.getSubject()), + acknowledgementMessage, + rootFolder.getAcknowledgementSigning()); + } + + } + // important, delete mail deleteMail(message); @@ -515,5 +553,4 @@ public class MailFilterJob extends AbstractFaxToMailJob { message.setFlag(Flags.Flag.DELETED, true); } } - } diff --git a/faxtomail-ui-web/src/main/resources/log4j2.xml b/faxtomail-ui-web/src/main/resources/log4j2.xml index d036632..21135da 100644 --- a/faxtomail-ui-web/src/main/resources/log4j2.xml +++ b/faxtomail-ui-web/src/main/resources/log4j2.xml @@ -44,7 +44,7 @@ </Appenders> <Loggers> - <Logger name="com.franciaflex.faxtomail" level="info"/> + <Logger name="com.franciaflex.faxtomail" level="debug"/> <!-- annoying errors --> <Logger name="com.opensymphony.xwork2.interceptor.ParametersInterceptor" level="FATAL"/> diff --git a/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp b/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp index fc46124..dfa8b08 100644 --- a/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp +++ b/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp @@ -58,7 +58,8 @@ 'groups': <s:property value="toJson(groups)" escapeHtml="false"/>, // remote service urls 'remoteCheckFolder': "<s:url action="configuration-check-directory-json" />", - 'remoteCheckEmailAccount': "<s:url action="configuration-check-mailaccount-json" />" + 'remoteCheckEmailAccount': "<s:url action="configuration-check-mailaccount-json" />", + 'remoteSearchClients': "<s:url action="search-clients-json" />" }); </script> </head> @@ -280,7 +281,7 @@ <img id="stampPreview"/> </output> - </div> + </div> </div> @@ -356,7 +357,7 @@ </div> - <div id="tabs-tree" class="tab-pane" ng-controller="ConfigurationTreeController"> + <div id="tabs-tree" class="tab-pane" ng-controller="ConfigurationTreeController as ctrl"> <input type="hidden" name="mailFoldersJson" value="{{mailFolders}}" /> <div class="row"> @@ -483,31 +484,6 @@ </div> <div class="form-group" ng-if="selectedMailFolder.$parent"> - <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMailAddress" ng-value="false" /> - Hériter de l'adresse de réponse pour les rejets :</label> - <input type="text" class="form-control" disabled - ng-model="parentScopeValues.rejectResponseMailAddress" ng-if="!selectedMailFolder.useCurrentLevelRejectResponseMailAddress"> - </div> - <div class="form-group" ng-class="{'has-error': generalForm.rejectResponseMailAddress.$dirty && generalForm.rejectResponseMailAddress.$invalid, - 'has-success': generalForm.rejectResponseMailAddress.$dirty && generalForm.rejectResponseMailAddress.$valid}"> - <label> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMailAddress" ng-value="true" ng-if="selectedMailFolder.$parent" /> - Définir l'adresse de réponse pour les rejets :</label> - <input name="rejectResponseMailAddress" type="email" class="form-control" ng-model="selectedMailFolder.rejectResponseMailAddress" ng-if="selectedMailFolder.useCurrentLevelRejectResponseMailAddress || !selectedMailFolder.$parent"> - </div> - <div class="form-group" ng-if="selectedMailFolder.$parent"> - <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMessage" ng-value="false" /> - Hériter du message de réponse pour les rejets :</label> - <textarea type="text" class="form-control" disabled - ng-model="parentScopeValues.rejectResponseMessage" ng-if="!selectedMailFolder.useCurrentLevelRejectResponseMessage"></textarea> - </div> - <div class="form-group"> - <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMessage" ng-value="true" ng-if="selectedMailFolder.$parent" /> - Définir le message de réponse pour les rejets :</label> - <textarea class="form-control" ng-model="selectedMailFolder.rejectResponseMessage" ng-if="selectedMailFolder.useCurrentLevelRejectResponseMessage || !selectedMailFolder.$parent"></textarea> - </div> - - <div class="form-group" ng-if="selectedMailFolder.$parent"> <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelNbElementToDisplay" ng-value="false" /> Hériter du nombre d'éléments à afficher à l'utilisateur :</label> <select class="form-control" disabled @@ -590,6 +566,152 @@ </div> </div> + <!-- Réception d'un mail --> + <div class="panel panel-default"> + <div class="panel-heading"> + <h4 class="panel-title"> + <a data-toggle="collapse" data-parent="#accordion" href="#collapse1"> + À la réception d'un email + </a> + </h4> + </div> + + <div id="collapse1" class="panel-collapse collapse" ng-form="emailReception"> + <div class="panel-body"> + + <div class="form-group" ng-if="!selectedMailFolder.$parent"> + <label> + <input type="checkbox" ng-model="selectedMailFolder.sendAcknowledgementToSender"> + Envoyer un accusé de réception à la réception d'un email dans ce dossier + </label> + </div> + + <div class="form-group" ng-if="!selectedMailFolder.$parent" + ng-class="{'has-error': emailReception.acknowledgementMailAddress.$dirty && emailReception.acknowledgementMailAddress.$invalid, + 'has-success': emailReception.acknowledgementMailAddress.$dirty && emailReception.acknowledgementMailAddress.$valid}"> + <label>Définir l'adresse expéditeur pour les accusés de réception :</label> + <input name="acknowledgementMailAddress" type="email" class="form-control" + ng-model="selectedMailFolder.acknowledgementMailAddress"> + </div> + <div class="form-group" ng-if="!selectedMailFolder.$parent"> + <label>Définir le message des accusés de réception :</label> + <trix-editor angular-trix class="trix-content" + ng-model="selectedMailFolder.acknowledgementMessage" + ng-model-options="{ updateOn: 'change' }" + name="acknowledgementMessage" + trix-change="trixChange(e, editor);" + trix-blur="trixBlur(e, editor);" ></trix-editor> + </div> + <div class="form-group" ng-if="!selectedMailFolder.$parent"> + <label>Signature de l'accusé de réception':</label> + <input type="file" accept="image/*" id="acknowledgementSigning" + class="form-control" + onchange="angular.element(this).scope().imageChanged(this, 'acknowledgementSigning')"/> + <output> + <img id="acknowledgementSigningPreview" ng-src="{{selectedMailFolder.acknowledgementSigning}}"/> + </output> + </div> + + <div class="form" ng-if="!selectedMailFolder.$parent"> + <div class="form-group"> + <table id="rights" class="table table-bordered"> + <thead> + <tr> + <th>Exception pour les clients suivants :</th> + </tr> + </thead> + <tbody> + <tr ng-repeat="client in selectedMailFolder.acknowledgementException"> + <td> + <div class="pull-right"> + <a class="btn btn-danger btn-xs" ng-click="removeAcknowledgementException($index, client)"> + <span class="glyphicon glyphicon-remove"></span> + </a> + </div> + <div> + <strong>{{client.name}}</strong>, + société : {{client.company}} + <span ng-if="client.brand">, marque : {{client.brand}}</span> + , code : {{client.code}} + </div> + <div> + <span ng-if="client.emailAddresses">emails : {{client.emailAddresses}}</span> + </div> + </td> + </tr> + </tbody> + </table> + + <a class="btn btn-success btn-xs pull-right" + ng-click="addAcknowledgementException(newAcknowledgementException)" + ng-disabled="!newAcknowledgementException"> + <span class="glyphicon glyphicon-plus"></span> + </a> + <ui-select ng-model="newAcknowledgementException " theme="bootstrap" + name="newAcknowledgementException" + on-select="onSelectCallback($item, $model)" + style="max-width: 95%"> + <ui-select-match placeholder="Tapez au moins deux caractères pour obtenir la liste des clients"> + {{$select.selected.name}}, + société : {{$select.selected.company}}, + marque : {{$select.selected.brand ? $select.selected.brand : "Non renseignée"}}, + code : {{$select.selected.code}}, + emails : {{$select.selected.emailAddresses ? $select.selected.emailAddresses : "Non renseigné"}} + </ui-select-match> + <ui-select-choices repeat="client in matchingClients | filter:filterByAlreadyInCollection(selectedMailFolder.acknowledgementException) | orderBy:'name'" + refresh="loadClients($select)" + refresh-delay="500"> + <div> + {{client.name}}, + société : {{client.company}} + <span ng-if="client.brand">, marque : {{client.brand}}</span> + <span ng-bind-html="', code : ' + client.code | highlight: $select.search"></span> + </div> + <div> + <span ng-if="client.emailAddresses" ng-bind-html="'emails : ' + client.emailAddresses | highlight: $select.search"></span> + </div> + </ui-select-choices> + </ui-select> + </div> + </div> + + <hr ng-if="!selectedMailFolder.$parent"/> + + <div class="form-group" ng-if="selectedMailFolder.$parent"> + <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMailAddress" ng-value="false" /> + Hériter de l'adresse expéditeur de réponse pour les rejets :</label> + <input type="text" class="form-control" disabled + ng-model="parentScopeValues.rejectResponseMailAddress" ng-if="!selectedMailFolder.useCurrentLevelRejectResponseMailAddress"> + </div> + <div class="form-group" ng-class="{'has-error': generalForm.rejectResponseMailAddress.$dirty && generalForm.rejectResponseMailAddress.$invalid, + 'has-success': generalForm.rejectResponseMailAddress.$dirty && generalForm.rejectResponseMailAddress.$valid}"> + <label> + <input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMailAddress" ng-value="true" ng-if="selectedMailFolder.$parent" /> + Définir l'adresse de réponse pour les rejets :</label> + <input name="rejectResponseMailAddress" type="email" class="form-control" ng-model="selectedMailFolder.rejectResponseMailAddress" ng-if="selectedMailFolder.useCurrentLevelRejectResponseMailAddress || !selectedMailFolder.$parent"> + </div> + <div class="form-group" ng-if="selectedMailFolder.$parent"> + <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMessage" ng-value="false" /> + Hériter du message de réponse pour les rejets :</label> + <textarea type="text" class="form-control" disabled + ng-model="parentScopeValues.rejectResponseMessage" ng-if="!selectedMailFolder.useCurrentLevelRejectResponseMessage"></textarea> + </div> + <div class="form-group"> + <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMessage" ng-value="true" ng-if="selectedMailFolder.$parent" /> + Définir le message de réponse pour les rejets :</label> + <textarea class="form-control" ng-model="selectedMailFolder.rejectResponseMessage" ng-if="selectedMailFolder.useCurrentLevelRejectResponseMessage || !selectedMailFolder.$parent"></textarea> + <label>Signature :</label> + <input type="file" accept="image/*" id="rejectResponseSigning" + class="form-control" + onchange="angular.element(this).scope().imageChanged(this, 'rejectResponseSigning')"/> + <output> + <img id="rejectResponseSigningPreview" ng-src="{{selectedMailFolder.rejectResponseSigning}}"/> + </output> + </div> + </div> + </div> + </div> + <!-- Liste des chargés de clientèle --> <div class="panel panel-default"> <div class="panel-heading"> @@ -976,7 +1098,7 @@ <tr ng-repeat="group in selectedMailFolder.rightGroups"> <td> <span class="fa fa-users"></span> {{group.completeName}} - <a class="pull-right btn btn-danger btn-xs pull-right" ng-click="removeRightGroup($index, group)"> + <a class="pull-right btn btn-danger btn-xs" ng-click="removeRightGroup($index, group)"> <span class="glyphicon glyphicon-remove"></span> </a> </td> @@ -1001,7 +1123,7 @@ <tr ng-repeat="user in selectedMailFolder.rightUsers"> <td> <span class="fa fa-user"></span> {{user.firstName}} {{user.lastName}} - <a class="pull-right btn btn-danger btn-xs pull-right" ng-click="removeRightUser($index, user)"> + <a class="pull-right btn btn-danger btn-xs" ng-click="removeRightUser($index, user)"> <span class="glyphicon glyphicon-remove"></span> </a> </td> @@ -1096,7 +1218,7 @@ <tr ng-repeat="group in selectedMailFolder.rightGroups"> <td> <span class="fa fa-users"></span> {{group.completeName}} - <a class="pull-right btn btn-danger btn-xs pull-right" ng-click="removeRightGroup($index, group)"> + <a class="pull-right btn btn-danger btn-xs" ng-click="removeRightGroup($index, group)"> <span class="glyphicon glyphicon-remove"></span> </a> </td> @@ -1111,7 +1233,7 @@ <tr ng-repeat="user in selectedMailFolder.rightUsers"> <td> <span class="fa fa-user"></span> {{user.firstName}} {{user.lastName}} - <a class="pull-right btn btn-danger btn-xs pull-right" ng-click="removeRightUser($index, user)"> + <a class="pull-right btn btn-danger btn-xs" ng-click="removeRightUser($index, user)"> <span class="glyphicon glyphicon-remove"></span> </a> </td> diff --git a/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml b/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml index a22e386..93681fa 100644 --- a/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml +++ b/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml @@ -54,6 +54,21 @@ <js>classpath:META-INF/resources/webjars/respond/1.4.2/src/respond.js</js> </group> + <group name='webjar-ui-select' abstract="true"> + <css>classpath:META-INF/resources/webjars/ui-select/0.19.6/select.css</css> + <js>classpath:META-INF/resources/webjars/ui-select/0.19.6/select.js</js> + </group> + + <group name="webjar-angular-sanitize" abstract="true"> + <js>classpath:META-INF/resources/webjars/angular-sanitize/1.2.16/angular-sanitize.js</js> + </group> + + <group name="webjar-angular-trix" abstract="true"> + <css>classpath:META-INF/resources/webjars/trix/0.9.9/dist/trix.css</css> + <js>classpath:META-INF/resources/webjars/trix/0.9.9/dist/trix.js</js> + <js>classpath:META-INF/resources/webjars/angular-trix/1.0.2/dist/angular-trix.js</js> + </group> + <group name='faxtomail'> <group-ref>jquery</group-ref> <group-ref>jquery-ui</group-ref> @@ -72,9 +87,13 @@ <group name='faxtomail-configuration'> <group-ref>select2</group-ref> + <group-ref>webjar-select2</group-ref> + <group-ref>webjar-ui-select</group-ref> + <group-ref>webjar-angular-sanitize</group-ref> <group-ref>select2sortable</group-ref> <group-ref>webjar-angular-ui-sortable</group-ref> <group-ref>font-awesome</group-ref> + <group-ref>webjar-angular-trix</group-ref> <js>/js/configuration.js</js> <css>/css/faxtomail.css</css> </group> diff --git a/faxtomail-ui-web/src/main/webapp/data.json b/faxtomail-ui-web/src/main/webapp/data.json new file mode 100644 index 0000000..dbdaec5 --- /dev/null +++ b/faxtomail-ui-web/src/main/webapp/data.json @@ -0,0 +1,74 @@ +/*- + * #%L + * FaxToMail :: Web + * $Id:$ + * $HeadURL:$ + * %% + * Copyright (C) 2014 - 2017 Mac-Groupe, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ +[ + { + "id" : 1, + "text" : "First" + }, + { + "id" : 2, + "text" : "Second", + "color" : "red" + }, + { + "id" : 3, + "text" : "Third", + "color" : "orange" + }, + { + "id" : 4, + "text" : "Fourth", + "color" : "red" + }, + { + "id" : 5, + "text" : "Fifth", + "color" : "pink" + }, + { + "id" : 6, + "text" : "Sixth", + "color" : "yellow" + }, + { + "id" : 7, + "text" : "Seventh", + "color" : "blue" + }, + { + "id" : 8, + "text" : "Eighth", + "color" : "blue" + }, + { + "id" : 9, + "text" : "Ninth", + "color" : "purple" + }, + { + "id" : 10, + "text" : "Tenth", + "color" : "green" + } +] diff --git a/faxtomail-ui-web/src/main/webapp/js/configuration.js b/faxtomail-ui-web/src/main/webapp/js/configuration.js index 31a2097..bc15581 100644 --- a/faxtomail-ui-web/src/main/webapp/js/configuration.js +++ b/faxtomail-ui-web/src/main/webapp/js/configuration.js @@ -22,7 +22,45 @@ * #L% */ -var ConfigurationModule = angular.module('ConfigurationModule', ['FaxToMail', 'ui.tree', 'ui.select2', 'ui.sortable', 'ui.select2.sortable']); +var ConfigurationModule = angular.module('ConfigurationModule', ['FaxToMail', 'ngSanitize', 'ui.tree', 'ui.select', 'ui.sortable', 'ui.select2.sortable', 'angularTrix']); + +/** + * AngularJS default filter with the following expression: + * "person in people | filter: {name: $select.search, age: $select.search}" + * performs an AND between 'name: $select.search' and 'age: $select.search'. + * We want to perform an OR. + */ +ConfigurationModule.filter('propsFilter', function() { + return function(items, props) { + var out = []; + + if (angular.isArray(items)) { + var keys = Object.keys(props); + + items.forEach(function(item) { + var itemMatches = false; + + for (var i = 0; i < keys.length; i++) { + var prop = keys[i]; + var text = props[prop].toLowerCase(); + if (item[prop].toString().toLowerCase().indexOf(text) !== -1) { + itemMatches = true; + break; + } + } + + if (itemMatches) { + out.push(item); + } + }); + } else { + // Let the output be the input untouched + out = items; + } + + return out; + }; +}); /** * Global configuration controller. @@ -102,7 +140,6 @@ ConfigurationModule.controller('ConfigurationController', ['$scope', 'Configurat // update $scope.flatMailFolders when $scope.mailFolders changes $scope._updateFlatMailFolders = function() { - console.log("Update flatMailFolders map"); $scope.flatMailFolders = {}; angular.forEach($scope.mailFolders, function(mailFolder) { $scope.flatMailFolders[mailFolder.topiaId] = []; @@ -134,7 +171,6 @@ ConfigurationModule.controller('ConfigurationController', ['$scope', 'Configurat }; $scope.updateMetaFilter = function(news, olds) { - console.log("Udpate MetaFilter"); $scope.rootFolderMailFilters = {}; _updateMetaFilter(); }; @@ -251,7 +287,6 @@ ConfigurationModule.controller('ConfigurationWaitingStateController', ['$scope', angular.forEach(mailFolders, function(mailFolder) { var index = mailFolder.waitingStates.indexOfByTopiaId(waitingState); if (index != -1) { - console.log("Remove etat from " + mailFolder.name); mailFolder.waitingStates.splice(index, 1); } removeWaitingStateFromMailFolder(waitingState, mailFolder.children); @@ -360,13 +395,15 @@ ConfigurationModule.controller('ConfigurationStampsController', ['$scope', '$win } $scope.$watch("selectedStamp.isImageType", function(newValue) { - if (newValue) { - $scope.selectedStamp.text = null; - $scope.selectedStamp.image = $scope.selectedStamp.oldImage; + if ($scope.selectedStamp) { + if (newValue) { + $scope.selectedStamp.text = null; + $scope.selectedStamp.image = $scope.selectedStamp.oldImage; - } else { - $scope.selectedStamp.image = null; - $scope.selectedStamp.text = $scope.selectedStamp.oldText; + } else { + $scope.selectedStamp.image = null; + $scope.selectedStamp.text = $scope.selectedStamp.oldText; + } } }); @@ -640,8 +677,14 @@ ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$windo // edit mail folder $scope.editMailFolder = function(mailFolder) { + $('#acknowledgementSigning').val(null); + $('#acknowledgementSigningPreview').attr('src', null); + $('#rejectResponseSigning').val(null); + $('#rejectResponseSigningPreview').attr('src', null); + $scope.selectedMailFolder = mailFolder; - + $scope.editingAcknowledgementMessage = mailFolder.acknowledgementMessage; + // edit undefined collections if (!$scope.selectedMailFolder.customerResponsibles) { $scope.selectedMailFolder.customerResponsibles = []; @@ -682,7 +725,11 @@ ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$windo if (!$scope.selectedMailFolder.moveRightGroups) { $scope.selectedMailFolder.moveRightGroups = []; } - + + // parse acknowledgement exception emailaddresses + angular.forEach($scope.selectedMailFolder.acknowledgementException, function(acknowledgementException) { + acknowledgementException.emailAddresses = JSON.parse(acknowledgementException.emailAddressesJson).toString(); + }); // initialise la liste des colonnes pour le dossier courant $scope.folderTableColumns = []; @@ -738,7 +785,6 @@ ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$windo $scope.selectedMailFolder.allowMoveDemandIntoFolder = $scope.selectedMailFolder.allowMoveDemandIntoFolder || false; $scope.selectedMailFolder.openAttachmentReportNoTaken = $scope.selectedMailFolder.openAttachmentReportNoTaken || false; $scope.selectedMailFolder.printActionEqualTakeAction = $scope.selectedMailFolder.printActionEqualTakeAction || false; - $scope.selectedMailFolder.rejectUnknownSender = $scope.selectedMailFolder.rejectUnknownSender || false; $scope.selectedMailFolder.ediTransfer = $scope.selectedMailFolder.ediTransfer|| false; } @@ -823,9 +869,6 @@ ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$windo if (angular.isUndefined($scope.parentScopeValues.printActionEqualTakeAction)) { $scope.parentScopeValues.printActionEqualTakeAction = folder.printActionEqualTakeAction; } - if (angular.isUndefined($scope.parentScopeValues.rejectUnknownSender)) { - $scope.parentScopeValues.rejectUnknownSender = folder.rejectUnknownSender; - } if (angular.isUndefined($scope.parentScopeValues.ediTransfer)) { $scope.parentScopeValues.ediTransfer = folder.ediTransfer; } @@ -894,6 +937,36 @@ ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$windo } }; + // acknowledgement message + // force apply on blur of the rich editor, otherwise the data do not update + $scope.trixBlur = function() { + $scope.$apply(); + }; + + // acknowledgement exceptions + $scope.newAcknowledgementException = null; + $scope.matchingClients = []; + + $scope.loadClients = function(select) { + var search = select.search; + if (search && search.length > 1) { + $http.post(ConfigurationData.remoteSearchClients, "clientQuery=" + search, {headers: {'Content-Type': 'application/x-www-form-urlencoded'}}) + .success(function(data, status, headers, config) { + for (var i = 0 ; i < data.length ; i++) { + var client = data[i]; + if (client.emailAddressesJson) { + client.emailAddresses = JSON.parse(client.emailAddressesJson).toString(); + } + } + $scope.matchingClients = data; + }); + } + }; + + $scope.onSelectCallback = function (item, model) { + $scope.newAcknowledgementException = item; + }; + // vérifie sur le serveur que le répertoire existe et a les droits d'écriture $scope.checkRemotePath = function() { $http.get(ConfigurationData.remoteCheckFolder + @@ -1220,6 +1293,40 @@ ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$windo $scope.selectedMailFolder.moveRightUsers.push(user); } }; + + // when the signingImageChange + $scope.imageChanged = function(input, attribute, preview) { + var f = input.files[0]; // FileList object + + // Only process image files. + if (!f.type.match('image.*')) { + $window.alert("Erreur lors du chargement de l'image"); + } + + var reader = new FileReader(); + + // Closure to capture the file information. + reader.onloadend = function() { + + $scope.$apply(function() { + $scope.selectedMailFolder[attribute] = reader.result; + }); + }; + + // Read in the image file as a data URL. + reader.readAsDataURL(f); + }; + + $scope.addAcknowledgementException = function(newAcknowledgementException) { + $scope.selectedMailFolder.acknowledgementException.push(newAcknowledgementException); + delete $scope.newAcknowledgementException; + }; + + $scope.removeAcknowledgementException = function(index, client) { + if ($window.confirm("Êtes-vous sur de vouloir supprimer cette exception ?")) { + $scope.selectedMailFolder.acknowledgementException.splice(index, 1); + } + }; }]); @@ -1340,7 +1447,6 @@ ConfigurationModule.controller('ConfigurationEmailAccountsController', ['$scope' $http.post(ConfigurationData.remoteCheckEmailAccount, "emailAccount=" + angular.toJson($scope.newAccount), {headers: {'Content-Type': 'application/x-www-form-urlencoded'}}) .success(function(data, status, headers, config) { - console.log(data, status, headers, config); if (data.ok) { $window.alert("Le test de connexion est passé avec succès."); } else { @@ -1410,13 +1516,15 @@ ConfigurationModule.controller('ConfigurationSigningsController', ['$scope', '$w } $scope.$watch("selectedSigning.isImageType", function(newValue) { - if (newValue) { - $scope.selectedSigning.text = null; - $scope.selectedSigning.image = $scope.selectedSigning.oldImage; + if ($scope.selectedSigning) { + if (newValue) { + $scope.selectedSigning.text = null; + $scope.selectedSigning.image = $scope.selectedSigning.oldImage; - } else { - $scope.selectedSigning.image = null; - $scope.selectedSigning.text = $scope.selectedSigning.oldText; + } else { + $scope.selectedSigning.image = null; + $scope.selectedSigning.text = $scope.selectedSigning.oldText; + } } }); @@ -1571,9 +1679,6 @@ ConfigurationModule.controller('ConfigurationChefGroupController', ['$scope', '$ }; }]); - - - function isLocalStorageAvailable() { var result; try { diff --git a/pom.xml b/pom.xml index 102596c..19730f9 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ <groupId>com.franciaflex</groupId> <artifactId>faxtomail</artifactId> - <version>2.1.5-SNAPSHOT</version> + <version>2.2.0-SNAPSHOT</version> <packaging>pom</packaging> <name>FaxToMail</name> @@ -600,8 +600,8 @@ <scope>runtime</scope> <exclusions> <exclusion> - <artifactId>angularjs</artifactId> <groupId>org.webjars</groupId> + <artifactId>angularjs</artifactId> </exclusion> </exclusions> </dependency> @@ -621,6 +621,32 @@ </dependency> <dependency> + <groupId>org.webjars</groupId> + <artifactId>ui-select</artifactId> + <version>0.19.6</version> + <scope>runtime</scope> + <exclusions> + <exclusion> + <groupId>org.webjars</groupId> + <artifactId>angularjs</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.webjars</groupId> + <artifactId>angular-sanitize</artifactId> + <version>1.2.16</version> + <scope>runtime</scope> + <exclusions> + <exclusion> + <groupId>org.webjars</groupId> + <artifactId>angularjs</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> <groupId>org.nuiton.js</groupId> <artifactId>nuiton-js-angularjs</artifactId> <version>1.2.25-1</version> @@ -649,6 +675,26 @@ </dependency> <dependency> + <groupId>org.webjars.bower</groupId> + <artifactId>trix</artifactId> + <version>0.9.9</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.webjars.bower</groupId> + <artifactId>angular-trix</artifactId> + <version>1.0.2</version> + <scope>runtime</scope> + <exclusions> + <exclusion> + <groupId>org.webjars.bower</groupId> + <artifactId>angularjs</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> <groupId>org.nuiton.js</groupId> <artifactId>nuiton-js-angular-ui-tree</artifactId> <version>2.1.4-1</version> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm