Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A3CA2200C4D for ; Wed, 22 Mar 2017 07:13:57 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id A2464160B90; Wed, 22 Mar 2017 06:13:57 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C0BD2160B81 for ; Wed, 22 Mar 2017 07:13:56 +0100 (CET) Received: (qmail 91734 invoked by uid 500); 22 Mar 2017 06:13:56 -0000 Mailing-List: contact commits-help@fineract.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@fineract.incubator.apache.org Delivered-To: mailing list commits@fineract.incubator.apache.org Received: (qmail 91725 invoked by uid 99); 22 Mar 2017 06:13:55 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Mar 2017 06:13:55 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 8ABE0C091A for ; Wed, 22 Mar 2017 06:13:55 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.569 X-Spam-Level: X-Spam-Status: No, score=-3.569 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_NEUTRAL=0.652] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id vjsM1Uvckbam for ; Wed, 22 Mar 2017 06:13:50 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id D4CCE60CF9 for ; Wed, 22 Mar 2017 06:13:49 +0000 (UTC) Received: (qmail 91523 invoked by uid 99); 22 Mar 2017 06:13:49 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Mar 2017 06:13:49 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E6EA1DFE7B; Wed, 22 Mar 2017 06:13:48 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: nazeer1100126@apache.org To: commits@fineract.incubator.apache.org Date: Wed, 22 Mar 2017 06:13:48 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/2] incubator-fineract git commit: FINERACT-330 : No error message is getting displayed in productive collection sheet if meeting is not attached to center/group archived-at: Wed, 22 Mar 2017 06:13:57 -0000 Repository: incubator-fineract Updated Branches: refs/heads/develop 7f9591ce9 -> e444aca44 FINERACT-330 : No error message is getting displayed in productive collection sheet if meeting is not attached to center/group Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/d6e70134 Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/d6e70134 Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/d6e70134 Branch: refs/heads/develop Commit: d6e70134107c65d627ae27b9e59f4f0ec886850d Parents: 8cc560c Author: nazeer1100126 Authored: Fri Mar 17 15:53:39 2017 +0530 Committer: nazeer1100126 Committed: Fri Mar 17 15:53:39 2017 +0530 ---------------------------------------------------------------------- .../service/CenterReadPlatformServiceImpl.java | 28 ++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/d6e70134/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/service/CenterReadPlatformServiceImpl.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/service/CenterReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/service/CenterReadPlatformServiceImpl.java index ca8aa1b..625d1d6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/service/CenterReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/service/CenterReadPlatformServiceImpl.java @@ -40,8 +40,8 @@ import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.infrastructure.core.data.PaginationParameters; import org.apache.fineract.infrastructure.core.data.PaginationParametersDataValidator; import org.apache.fineract.infrastructure.core.domain.JdbcSupport; +import org.apache.fineract.infrastructure.core.exception.GeneralPlatformDomainRuleException; import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException; -import org.apache.fineract.infrastructure.core.service.DateUtils; import org.apache.fineract.infrastructure.core.service.Page; import org.apache.fineract.infrastructure.core.service.PaginationHelper; import org.apache.fineract.infrastructure.core.service.RoutingDataSource; @@ -549,9 +549,12 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService validateForGenerateCollectionSheet(staffId); LocalDate localDate = new LocalDate(meetingDate); final CenterCalendarDataMapper centerCalendarMapper = new CenterCalendarDataMapper(); + String passeddate = formatter.print(localDate); + if (!isCentersHavingMeetingFrequencyBasedOnOfficeIdAndMeetingDate(officeId, passeddate, staffId)) { throw new GeneralPlatformDomainRuleException( + "error.msg.collection.sheet.can.not.be.selected.meeting.date.not.attached.to.any.center", + "Collection sheet can not be generated without meeting date " + passeddate + " attached to any center ", passeddate); } String sql = centerCalendarMapper.schema(); Collection centerDataArray = null; - String passeddate = formatter.print(localDate); if (staffId != null) { sql += " and g.staff_id=? "; sql += "and lrs.duedate<='" + passeddate + "' and l.loan_type_enum=3"; @@ -600,6 +603,27 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService return staffCenterDataArray; } + @SuppressWarnings("deprecation") + private boolean isCentersHavingMeetingFrequencyBasedOnOfficeIdAndMeetingDate(final Long officeId, final String passeddate, + final Long staffId) { + final StringBuilder sb = new StringBuilder(100); + sb.append("SELECT COUNT(*) "); + sb.append("FROM m_calendar c "); + sb.append("JOIN m_calendar_instance ci ON ci.calendar_id=c.id AND ci.entity_type_enum=4 "); + sb.append("JOIN m_group ce ON ce.id = ci.entity_id "); + sb.append("JOIN m_group g ON g.parent_id = ce.id "); + sb.append("WHERE c.start_date = ? AND g.office_id= ? "); + int i = 0; + if (staffId != null) { + sb.append(" AND g.staff_id = ? "); + i = this.jdbcTemplate.queryForInt(sb.toString(), new Object[] { passeddate, officeId, staffId }); + } else { + i = this.jdbcTemplate.queryForInt(sb.toString(), new Object[] { passeddate, officeId }); + } + if (i > 0) { return true; } + return false; + } + public void validateForGenerateCollectionSheet(final Long staffId) { final List dataValidationErrors = new ArrayList<>();