You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by avikganguly01 <gi...@git.apache.org> on 2017/10/10 17:47:46 UTC
[GitHub] fineract pull request #170: commit for FINERACT-46 (Throw an exception if st...
Github user avikganguly01 commented on a diff in the pull request:
https://github.com/apache/fineract/pull/170#discussion_r143803020
--- Diff: fineract-provider/src/main/java/org/apache/fineract/organisation/staff/domain/StaffRepository.java ---
@@ -27,10 +27,36 @@
public final static String FIND_BY_OFFICE_QUERY = "select s from Staff s where s.id = :id AND s.office.id = :officeId";
+ public final static String IS_ANY_ACTIVE_ENTITY_ASSOCIATED_WITH_STAFF_QUERY = "select " +
+ "case when (sum(total) > 0) then true else false end " +
+ "from (" +
+ "(select count(mg.id) as total " +
+ "from m_staff ms " +
+ "join m_group mg on mg.staff_id = ms.id " +
+ "where ms.id = :staffId " +
+ "and mg.status_enum in (100,300)) " +
+ "union all " +
+ "(select count(ml.id) as total " +
+ "from m_loan ml " +
+ "join m_staff ms on ml.loan_officer_id = ms.id " +
+ "where ms.id = :staffId " +
+ "and ml.loan_status_id in (100,200,300,700)) " +
+ "union all " +
+ "(select count(msa.id) as total " +
+ "from m_savings_account msa " +
+ "join m_staff ms on msa.field_officer_id = ms.id " +
+ "where ms.id = :staffId and " +
+ "msa.status_enum in (100,300))) as t1 ";
+
--- End diff --
Client and share accounts not checked.
---