Compare commits

...
500 Commits
Author SHA1 Message Date
Vishwas Babu AJ 5240d308b8 accounting wip:cash basedJournal entries for disbursal and repayments 2013-01-16 14:02:05 +05:30
Keith Woodlock 38ee2d98ac use display name for groups. 2013-01-15 23:42:45 +00:00
Keith Woodlock 9ac6dad1d2 update patches after server upgrade. change order of client search results to use display name. 2013-01-15 13:44:33 +00:00
Keith Woodlock 9231d177e0 MIFOSX-37: support ability to update account no for loan accounts, also support ability to update external id (MIFOSX-46). 2013-01-13 13:56:10 +00:00
Vishwas Babu AJ 0f5c3cb506 adding support for JRebel 2013-01-13 04:11:04 +05:30
John Woodlock 0049d07cac datatables: handle input containing just space(s) 2013-01-11 13:01:25 +00:00
Keith Woodlock fe7667b9ec MIFOSX-37: api docs update and support partial response on new client fields. 2013-01-10 17:29:32 +00:00
Keith Woodlock 4cac334d71 MIFOSX-37: support ability to use different account number generation strategies for client account numbers (programatically for now, from ui,configuration later) 2013-01-10 17:01:53 +00:00
John Woodlock 7db9d409eb tiny, tiny change to ddl, hardly matters 2013-01-10 11:47:59 +00:00
Keith Woodlock 1cd21b9f49 MIFOSX-141: move accountingType out of embedded class which is for fields common to both loan product and loan and move back into loan product only. 2013-01-10 11:44:06 +00:00
Vishwas Babu AJ 4d81b78d5d accounting posting wip (only loan product mapping) 2013-01-10 01:04:12 +05:30
John Woodlock 29af2d5999 ensure datatables update/delete has the url put into the audit table 2013-01-09 18:15:06 +00:00
John Woodlock 029846bda2 remove super_user permission checks as they have been deleted (except for reporting_super_user) 2013-01-09 15:19:30 +00:00
John Woodlock 898aa44db0 update patch to not have id for permission 2013-01-09 14:34:22 +00:00
Keith Woodlock 986a3c5f91 MIFOSX-97: update urls for getting data when viewing changes against existing data for maker-checker. 2013-01-09 00:09:45 +00:00
Keith Woodlock a0388e34d1 MIFOSX-97: check on read permission for configuration. 2013-01-08 19:27:14 +00:00
Keith Woodlock 444707b60b update patch. 2013-01-08 19:13:44 +00:00
Keith Woodlock a0effe9e7a MIFOSX-97: add configuration option for enabling,disabling maker checker at global level. 2013-01-08 18:32:49 +00:00
Keith Woodlock 239d60bc02 MIFOSX-97: initial integration of changes into roles and permissions for maker checker purposes. 2013-01-07 17:18:50 +00:00
Keith Woodlock ff6eae40d3 MIFOSX-97: tidy up of maker checker based on audit work so far. 2013-01-07 16:23:06 +00:00
Keith Woodlock 32f4bc1d30 fix sql issue with checker inbox.2 2013-01-07 15:02:06 +00:00
John Woodlock f2b40dbbe2 minor patch update 2013-01-07 12:41:21 +00:00
Keith Woodlock e6de05f690 remove warnings. 2013-01-06 17:45:03 +00:00
Keith Woodlock 690f0d4abc MIFOSX-9: Audit related work 2013-01-06 17:36:05 +00:00
Michal Dudzinski 06f6ad2dff Extended Groups API to return individual loans created from group. 2013-01-05 16:24:18 +01:00
Michal Dudzinski 556f75fcc1 Workaround for permissions independent of repayment schedule. 2013-01-05 16:18:07 +01:00
John Woodlock 6177e41e70 pass only changes for logging datatables updates 2013-01-04 16:26:25 +00:00
Keith Woodlock b61ab594e4 datatables formatting and first bit of flexible account number generation for clients. 2013-01-04 14:28:09 +00:00
John Woodlock 6d2151f4db add get api for single entry of a 'many' datatable 2013-01-03 18:01:07 +00:00
Keith Woodlock 48c40b5170 small change to michals create individual loan application from group context work. 2013-01-03 14:35:54 +00:00
Michal Dudzinski dde7c9980d Track group on member loan. 2013-01-03 15:02:00 +01:00
Keith Woodlock 8b666d3eea update dependency versions 2013-01-02 23:03:00 +00:00
Keith Woodlock 127a5efbc3 tidy up datatables api and ensure principal is paid off before interest in advance and partial payment cases. 2013-01-02 13:40:16 +00:00
John Woodlock 578bbc2954 wip add audit for datatables 2012-12-30 18:36:26 +00:00
Keith Woodlock fbfcc32f78 Update README.md
update roadmap text.
2012-12-28 22:14:29 +00:00
Keith Woodlock 8dc8dcad52 update api-docs around client and client account summary. 2012-12-24 13:57:30 +00:00
Keith Woodlock c99053d2a4 update loan creation and retrieval. 2012-12-21 15:28:39 +00:00
John Woodlock e4ee41174d audit indexes/indices :) 2012-12-21 13:15:25 +00:00
Keith Woodlock 46c315815d clean up remainder of serialization code for reports, datatables and groups.2 2012-12-21 11:45:37 +00:00
Keith Woodlock 4e589cfeb8 break apart loan application concepts from loan contract concepts. ensure submit new loan application returns all validation errors. 2012-12-20 20:00:17 +00:00
Keith Woodlock a50983d9df MIFOSX-97: initial support of maker checker and audit support around transfer of loan officer and bulk transfer. 2012-12-20 14:32:21 +00:00
Keith Woodlock 3224836989 handle loan creation with no charges after refactoring. 2012-12-20 12:36:46 +00:00
Keith Woodlock 94459fe2a5 update core DDL and reference data to latest. 2012-12-20 11:42:42 +00:00
Keith Woodlock 2ee2cf1b1f rename to file as in documentation. 2012-12-20 11:02:19 +00:00
Keith Woodlock a8f4ff4bb6 update demo backup. 2012-12-20 11:01:35 +00:00
Keith Woodlock bd09ecc967 mark patches folder as applied to server. 2012-12-20 10:58:15 +00:00
Keith Woodlock a43490102d MIFOSX-97: inital pass at support for maker-checker and audit around loancharges. 2012-12-20 00:28:39 +00:00
Keith Woodlock e694355f8c MIFOSX-97: further support for maker-checker and audit around loans. 2012-12-19 13:34:42 +00:00
Keith Woodlock 281931e19b temp check for null charges 2012-12-19 01:48:43 +00:00
Keith Woodlock 1fb04811d5 add validation for client notes. 2012-12-18 20:52:29 +00:00
Keith Woodlock 013276d9e4 MIFOSX-97: support audit for loan application creation, loan application modification, approval, undo approval, disbursal and undo of disbursal. 2012-12-18 20:41:12 +00:00
John Woodlock 43b1cdd3ef remove portfolio, org and user super user special permissions 2012-12-18 13:44:09 +00:00
Keith Woodlock 49357f13a7 remove client specific sql. 2012-12-18 13:13:36 +00:00
Keith Woodlock 9bb3f4e51f renumber patches, remove getters from data object for savings account data. add fixes for madhukar around spelling mistakes and unused parameters. 2012-12-18 09:55:07 +00:00
Madhukar 2e050d397f Adding Saving account & product creation from UI
Adding missing db patch for m_product_savings

repopulating the existed values on view product
2012-12-18 12:38:51 +05:30
John Woodlock 021aa14f90 wip audit api docs 2012-12-16 18:07:07 +00:00
Keith Woodlock e0dc9b22ee CEDA specific ddl. 2012-12-16 13:30:39 +00:00
Keith Woodlock 08a8b8cff0 fix issue with updating root office details. 2012-12-15 22:15:39 +00:00
John Woodlock e52b66d562 Add processingResult to Audit 2012-12-15 20:35:50 +00:00
John Woodlock 7b4f078cda wip audit services 2012-12-15 00:41:25 +00:00
Vishwas Babu AJ b2639fea2c minor bug fixes for accounting infrastructure
adding sql files
2012-12-15 00:22:36 +05:30
John Woodlock adca69b0a0 wip audit api 2012-12-14 17:38:07 +00:00
Keith Woodlock 7a7654e75f MIFOSX-97: add status for processing result of commands. 2012-12-14 13:46:24 +00:00
John Woodlock 8424d52325 wip audit view search 2012-12-13 00:33:33 +00:00
John Woodlock e21a8266d1 minor changes (not functional) 2012-12-12 22:33:41 +00:00
Vishwas Babu AJ 26fd03ae38 deleting temporary file created during merge 2012-12-13 02:31:54 +05:30
Vishwas Babu AJ fa9f2129dd accounting wip 2012-12-13 02:30:48 +05:30
Keith Woodlock 892afd409d MIFOSX-97: move maker checker to cleaner implementatin on handlers with change detection on updates. 2012-12-12 14:00:05 +00:00
John Woodlock 3a73d9aacd new audit read permission 2012-12-11 22:53:28 +00:00
John Woodlock 08846d7b1f WIP audit view 2012-12-11 22:31:55 +00:00
John Woodlock 401770c696 WIP audit views 2012-12-11 21:31:22 +00:00
John Woodlock 6f3fcf31b6 WIP Audit views 2012-12-10 13:12:21 +00:00
John Woodlock d95a190efb WIP Audit views 2012-12-10 12:26:48 +00:00
John Woodlock cc0e02696b WIP Audit services 2012-12-09 21:27:38 +00:00
John Woodlock 3cc91463c0 WIP Audit services 2012-12-09 20:57:28 +00:00
Keith Woodlock 0717d02a38 reenable note against deposit account. 2012-12-08 01:12:08 +00:00
MadhukarandKeith Woodlock ba24d205f9 Merge remote-tracking branch 'madhukar/MIFOSX-43-Final' 2012-12-08 01:04:57 +00:00
Keith Woodlock 3901a06ad8 MIFOSX-9: ensure @Components are picked up in audit package. fix sql for retrieve of audit data. 2012-12-08 01:02:22 +00:00
John Woodlock 3b27bcc4d1 WIP Audit 2012-12-07 23:29:40 +00:00
Madhukar 2ec422f89d Add Interest posting functionality for fd
Basic for rd schedule creation-1

Schedule creation for RD

PrintPdf For FD

Print RRMacs Demo

FD Certificate Generation
2012-12-08 03:20:47 +05:30
Keith Woodlock 13d3221262 fix small error. 2012-12-07 20:56:52 +00:00
John Woodlock 68e094dd2f WIP stub for audit service 2012-12-07 16:42:43 +00:00
Keith Woodlock fb4dfe7996 MIFOSX-97: change detection on user admin areas. 2012-12-07 13:54:43 +00:00
Keith Woodlock f5c1225dfa MIFOSX-97: detect changes on update of role. split out image part of clients api into its own resource class. 2012-12-07 00:10:46 +00:00
Keith Woodlock c966892b37 MIFOSX-97: redo permissions for maker-checker and roles. api expects json map of permissions labelled by parameter name 'permissions' 2012-12-06 23:30:36 +00:00
Keith Woodlock 5ca0604aa2 update ddl and reference mistakes. 2012-12-06 20:10:46 +00:00
Keith Woodlock 669503b34b MIFOSX-97: update way of handling updates for client and codes. 2012-12-06 15:31:54 +00:00
Keith Woodlock cb6ea0ae63 MIFOSX-97: about turn on implementation of command pattern to support audit. 2012-12-06 14:20:44 +00:00
Keith Woodlock add6708ab0 MIFOSX-97: breakout client notes subresource into its own class. 2012-12-05 14:28:31 +00:00
John Woodlock b680e50942 logging change 2012-12-05 12:49:19 +00:00
Keith Woodlock 075efe2712 restore pretty printing support, fix client update due to detect changes error. 2012-12-05 12:16:40 +00:00
John Woodlock 184ec07487 minor changes for reducing console logging 2012-12-05 11:44:57 +00:00
Keith Woodlock 6a012858d2 fix issues with codes and office update, abstract some serialization functions. 2012-12-05 10:56:48 +00:00
Keith Woodlock 311477a87b MIFOSX-97: tidy up serialization of commands for clients and client identifiers. 2012-12-05 01:08:59 +00:00
Keith Woodlock 26470d026d MIFOSX-97: continue tidy up of serialization. 2012-12-04 18:02:31 +00:00
Keith Woodlock bb6ef42b41 MIFOSX-97: tidy up serialization approach for currencies, offices, staff. 2012-12-04 15:32:09 +00:00
Keith Woodlock 37ae6dae9e formatting changes for savings related code. 2012-12-04 15:29:11 +00:00
MadhukarandKeith Woodlock d1a1ed60ab Madhukars interest posting for fixed deposit and recurrint deposit work. 2012-12-04 15:10:44 +00:00
Keith Woodlock 2dd5c5a7cd MIFOSX-97: iterate for serialization parts of platform infrastructure and for codes resource. 2012-12-03 17:11:46 +00:00
Keith Woodlock fe77584320 Fix issue with application not picking up on some api resources components through annotation scanning. 2012-12-03 13:58:36 +00:00
Keith Woodlock 73c7be839d restructure into accounting, portfolio, organisation, user administration and infrastructure related packages. 2012-12-03 02:01:11 +00:00
Keith Woodlock 388aebd781 package tidy up. 2012-12-03 00:41:39 +00:00
Keith Woodlock f73d42857e MIFOSX-97: repackage remaining savings related code. 2012-12-03 00:20:43 +00:00
Keith Woodlock 082d77f5b6 MIFOSX-97: organise classes into new package structure. 2012-12-02 21:10:23 +00:00
John Woodlock c395d96517 script to update some permissions settings 2012-12-02 11:10:07 +00:00
Keith Woodlock 93fef53974 another test commit. 2012-12-02 10:30:00 +00:00
Keith Woodlock 1a5e36f9e1 test commit. 2012-12-02 10:15:08 +00:00
Keith Woodlock 5a492e03db MIFOSX-97: move gaurantor under loan account for now. 2012-12-01 17:09:49 +00:00
Keith Woodlock 6fe8b41ca9 MIFOSX-97: repackage document management code. 2012-12-01 16:56:55 +00:00
Keith Woodlock 9e4cc15441 MIFOSX-97: package restructuring between loan and loan schedule. 2012-12-01 15:59:56 +00:00
Keith Woodlock 017cc717e5 MIFOSX-97: move loan packaging. 2012-12-01 15:38:59 +00:00
Keith Woodlock df283eb533 MIFOSX-97: move validation login to where the data exists - the command. 2012-12-01 14:44:14 +00:00
Keith Woodlock 9f65ff3cbd MIFOSX-97: move package structure movement and support for command approach. 2012-12-01 14:12:40 +00:00
John Woodlock 38ee5d130d add/update a couple of permissions 2012-12-01 13:38:23 +00:00
Keith Woodlock 7ac55812d6 MIFOSX-97: move loan products to command handler support. 2012-11-30 16:35:01 +00:00
Keith Woodlock a3970af6c2 MIFOSX-97: continue move towards command handling structure to support maker-checker style processes. 2012-11-30 15:34:05 +00:00
Keith Woodlock f58f211664 MIFOSX-97: global configuration to enable disable maker checker support on tasks. hardcoded to disabled by default for now. 2012-11-30 13:12:57 +00:00
Keith Woodlock d2c751f2eb format changes 2012-11-30 12:58:51 +00:00
kiran 48b3693944 Generate Pdf option for reports 2012-11-30 17:08:20 -08:00
Keith Woodlock 879ffdaa7e MIFOSX-132: tidy up of code and code values implementation so far. 2012-11-29 20:41:33 +00:00
Keith Woodlock 41536b1beb MIFOSX-132: tidy up system defined implementation. 2012-11-29 20:11:38 +00:00
ismail b001e3f999 add system defined checks to codes 2012-11-29 18:33:46 +01:00
Keith Woodlock edae10ed4b MIFOSX-97: restructuring of api resources, data, commands and the services and domain concepts they use. The api is not responsible for logging the command which is then in turn processed. When maker checker is enabled no changes are persisted through until a checker approves them. 2012-11-29 11:54:40 +00:00
Keith Woodlock bd678bd2b2 ensure spring data jpa repositories in accounting package are picked up correctly for spring wiring. keep ordering on patches. 2012-11-27 13:54:53 +00:00
Vishwas Babu AJ 5c38e151e8 wip accounting service
moving accounting wip code to new package
2012-11-27 18:55:21 +05:30
Keith Woodlock d997add560 move commands and validators into their own package for useradmin area. 2012-11-27 01:27:59 +00:00
Keith Woodlock 72881c740b restructure packagin again. move user admin related code under infrastructure. 2012-11-27 01:16:41 +00:00
Keith Woodlock 71d573cae0 fix permissions small repackaging on command related classes into future package structure of org.mifosplatform 2012-11-27 00:48:12 +00:00
Keith Woodlock 65206daf30 code formatting police. 2012-11-26 21:38:54 +00:00
Keith Woodlock 0549858dea MIFOSX-97: move permissions checking to api and cater for _CHECKER permissions needed. 2012-11-26 21:32:53 +00:00
John Woodlock 02617ce7f6 add service to update can_maker_checker field on permissions 2012-11-26 21:19:30 +00:00
Keith Woodlock 19fea3ed00 MIFOSX-97: initial integration of maker-checker capability on permissions with actual api services. 2012-11-26 18:17:53 +00:00
John Woodlock 092eabc0a0 update permissions work to reflect checker permissions (for maker-checker) 2012-11-26 14:31:25 +00:00
Keith Woodlock e4e285d943 resetme 2012-11-26 13:09:42 +00:00
Keith Woodlock 8f74873408 update backup of demo database after server upgrade. 2012-11-26 11:42:09 +00:00
Keith Woodlock a5096aad88 fix up some issues with updating client details. needs to go onto upgrade server straightaway. 2012-11-26 00:33:32 +00:00
Keith Woodlock fbf54d3c64 update base DDL and reference data after server upgrade. 2012-11-25 02:48:55 +00:00
John Woodlock 8859c44765 fix error in inserting datatable permissions 2012-11-24 15:40:17 +00:00
Keith Woodlock 1daf8edac5 tidy up patches. 2012-11-24 12:20:23 +00:00
Keith Woodlock d0ec329115 some formatting changes. sorry. 2012-11-23 17:53:06 +00:00
Keith Woodlock c36370ae83 update patch 2012-11-23 17:37:23 +00:00
John Woodlock 10c343373c remove remaining old permissions code and update api docs for roles and permissions 2012-11-23 14:22:33 +00:00
Keith Woodlock f7c7bfdd5f MIFOSX-97: enable maker checker flow for update of role permissions. 2012-11-23 13:02:28 +00:00
John Woodlock e8676832ee remove additional fields functionality from app and api docs 2012-11-22 18:08:57 +00:00
Keith Woodlock 79ff5a7511 MIFOSX-97: process role commands through command_source table. 2012-11-22 14:51:53 +00:00
Keith Woodlock 85de5e92c2 MIFOSX-97: some tidy up around users,roles and permissions in prep for command work. 2012-11-22 12:22:41 +00:00
John Woodlock baba0b809e remove permission maintenance from add/edit role 2012-11-21 21:30:17 +00:00
John Woodlock 43fb5c3294 MIFOSX-126 - Objective 1 Complete - new permission regime implemented plus a more intuitive UI 2012-11-21 20:51:16 +00:00
Keith Woodlock 447b180790 example of roles api for john. 2012-11-21 17:07:50 +00:00
Keith Woodlock 4101cfbcf5 MIFOSX-109: some formatting changes and removal of unused items. 2012-11-21 17:06:50 +00:00
Vishwas Babu AJandKeith Woodlock e874efc3ac MIFOSX-109: vishwas work on gaurantor squashed into one commit. 2012-11-21 16:40:01 +00:00
Keith Woodlock 9aa9b870f0 MIFOSX-97: refactor into command handling logic, prepare for sql based approach for change detection. 2012-11-21 14:23:16 +00:00
John Woodlock b8961d7914 add is_system_defined flag to m_code 2012-11-21 13:48:44 +00:00
John Woodlock dc718d33c9 correct authorisation check for UPDATE_CODE (missing quote) 2012-11-21 12:28:04 +00:00
John Woodlock d03705f51c wip role permissions update api 2012-11-21 11:53:45 +00:00
John Woodlock b085f1872d wip permissions - script improvement 2012-11-19 22:30:42 +00:00
Keith Woodlock b48763a104 move class into data package. 2012-11-19 21:46:04 +00:00
Keith Woodlock f79da8144b MIFOSX-97: wip on supporting maker checker approach in platform starting with clients flow. 2012-11-19 21:13:28 +00:00
John Woodlock 30d4ca7681 wip permissions 2012-11-19 16:57:19 +00:00
Keith Woodlock f326187794 update latest permissions work for reference data. 2012-11-17 16:01:35 +00:00
Keith Woodlock 739dc31f29 Merge remote-tracking branch 'mdudzinski/MIFOSX-73' 2012-11-17 15:10:18 +00:00
Michal Dudzinski 7031ed40b4 MIFOSX-73: track loan officer reassignment history only when loan is approved. 2012-11-17 15:55:12 +01:00
Keith Woodlock f73ef79add use hasAnyRole instead of hasRole expression when checking against multiple permissions. 2012-11-17 14:25:22 +00:00
Michal Dudzinski 015400b08e MIFOSX-73: new API for loan officer reassignment. 2012-11-17 14:18:54 +01:00
John Woodlock 35a331debd WIP permissions - add new api to get role permissions 2012-11-16 22:42:25 +00:00
John Woodlock bf847dc352 WIP permission - with permissions overhaul script 2012-11-16 19:37:43 +00:00
John Woodlock 16c395719c wip permissions 2012-11-16 14:38:26 +00:00
Keith Woodlock ce188814ec ensure resource idenity is stored with a CREATE command source when command is processed by platform. Allows ability to see all state changing commands accepted to date by platform for a given resource. 2012-11-16 13:26:25 +00:00
Keith Woodlock e61454792f refactor ApplicationConstants usage, refactor usage of code and code values for customer identifiers. 2012-11-16 10:13:06 +00:00
Keith Woodlock d7ea5d8169 MIFOSX-97: ability to support maker checker on create, update, delete of client. 2012-11-15 21:58:19 +00:00
John Woodlock e046d86e06 wip permissions 2012-11-15 16:36:49 +00:00
John Woodlock 81a549ae01 wip permissions 2012-11-15 14:48:26 +00:00
Keith Woodlock 74fa071603 remove unused imports. 2012-11-15 14:14:10 +00:00
Keith Woodlock 84db0f9794 mifosx-45: removed usused imports. 2012-11-15 14:00:59 +00:00
John Woodlock ac353ec28e wip permissions 2012-11-15 13:26:36 +00:00
ismail 51f661de17 changes for crud on code table 2012-11-15 14:07:51 +01:00
John Woodlock 0f2b5fd05d WIP permissions 2012-11-15 11:59:14 +00:00
John Woodlock dfb0710674 wip permissions redo 2012-11-14 21:37:27 +00:00
John Woodlock 211f8b7d46 WIP permissions redo - only use mifos user until finished - also some changes that were pulled but show as changed 2012-11-14 21:24:13 +00:00
Keith Woodlock 716b1fb11a MIFOSX-97: WIP moving towards demo of maker checker of client create functionality. 2012-11-13 18:18:49 +00:00
Keith Woodlock 3f55301be2 MIFOSX-97: WIP on maker checker for clients area. 2012-11-12 17:30:50 +00:00
Keith Woodlock 3e16891cfb MIFOSX-97: some changes around loan officer reassingment capability for loans. 2012-11-12 17:16:30 +00:00
Keith Woodlock 4cba5ea719 Merge remote-tracking branch 'mdudzinski/MIFOSX-73' 2012-11-12 16:11:02 +00:00
Michal Dudzinski 6e12e9e62a support for MIFOSX-73: Loan Officer reassignment History. 2012-11-12 16:53:46 +01:00
Keith Woodlock cd2e71ed75 clean up REST API parameters usage around roles and permissions. 2012-11-12 12:12:42 +00:00
John Woodlock 2c92635ced wip new permissions api 2012-11-10 02:30:39 +00:00
Keith Woodlock 0cedba8ae1 remove unused code around permissions from older prototype. 2012-11-10 00:46:22 +00:00
Keith Woodlock a0f6fd0a32 remove warnings, fix issue with creating loan with no charges even if loan product has default charges against it. 2012-11-09 16:23:10 +00:00
Vishwas Babu AJ 0d33fcf118 Adding new image upload services for Data URLs (Webcam integration) 2012-11-09 19:25:03 +05:30
John Woodlock e0a7231f13 just give mifosx-126 scripts a running order 2012-11-08 15:56:39 +00:00
Keith Woodlock 152a70477d MIFOSX-90: support modification of loan charge, fix issue with repayments paying off loan charges in wrong order. 2012-11-08 14:35:41 +00:00
John Woodlock f90802a292 WIP mifosx-126 remove group-enum from m_permission and add grouping and order_in_grouping columns 2012-11-08 13:01:14 +00:00
Keith Woodlock 7af4b12d24 MIFOSX-90: disallow ability to remove loan charge if it is waived (or partially waived). 2012-11-08 11:26:51 +00:00
Keith Woodlock 027be9df4f Ability to waive loan charge in full (integrated into repayment schedule) even if loan charge is marked as paid or due for payment in past or future. 2012-11-08 10:26:08 +00:00
John Woodlock b7a951b01a wip mifosx-126 update reporting parameter query to correctly get reports of users with specific report permissions 2012-11-07 21:06:03 +00:00
John Woodlock d685c36410 WIP mifosx-126 - rename report and data table permissions and add upgrade script 2012-11-07 13:53:51 +00:00
Keith Woodlock 89b2a15e4c MIFOSX-124: get shell of accounting ready for development. 2012-11-06 17:31:36 +00:00
Keith Woodlock b185bc5f5b mifosx-90: validation of loan and loan charges state when adding and removing loan charges and when creating, modifying loan applications. 2012-11-06 15:12:16 +00:00
Keith Woodlock 81f7b614b4 show breakdown of monetary amount applied to portions for each transacton. 2012-11-06 14:10:24 +00:00
Michal Dudzinski d8da3e49b6 Update .gitignore for intelij project files. 2012-11-06 12:12:58 +01:00
Keith Woodlock db3f0401d9 MIFOSX-90: cater for some validation and edge cases around loan charges and loans. 2012-11-02 15:17:46 +00:00
Keith Woodlock ee63559abd remove unused warnings from savings code. 2012-11-01 16:30:57 +00:00
Keith Woodlock 75b8a0801d rename patch files for savings. 2012-11-01 14:53:29 +00:00
Madhukar 3b4c1171e8 Display deposit transactions in UI
Adding saving product

SavingProduct Definition

basic saving account creation

patch-2 reccuring deposit account

Saving account creation final patch
2012-11-01 19:04:23 +05:30
Keith Woodlock 46c82b1f67 MIFOSX-90: ability to add a defined loan charge (fee or penalty) to a loan and accomodate correctly into the loan schedule given the due date of the charge. 2012-11-01 13:15:05 +00:00
Keith Woodlock 46970adb2b make write service method transactional along with minor style changes. 2012-10-31 17:20:27 +00:00
Michal Dudzinski 390964f361 MIFOSX-75: Bulk loan reassignment. 2012-10-31 15:45:49 +01:00
Keith Woodlock a3200a8bc7 MIFOSX-90: work in progress on charges (fees and penalties) for loans suitable for gk-maarg. Split out charges on repayment schedule into fee charges and penalty charges. work outstanding on integrating payment processing to auto pay off charges (or auto penalise). 2012-10-31 11:08:54 +00:00
John Woodlock a946e207da recommiting to give clean git status after pull 2012-10-29 01:05:54 +00:00
Vishwas Babu AJandKeith Woodlock 2325878e4e initials files for client image management. 2012-10-28 14:43:33 +00:00
Keith Woodlock 3d5c0d88c0 Inital support for adding loan charge due on specified date for demo to gk. 2012-10-28 11:29:57 +00:00
John Woodlock f4a9d183d7 add proposed_loan_amount field to gk risk analysis ddl 2012-10-27 11:23:14 +01:00
Keith Woodlock ba42641d03 removed unused code for now. 2012-10-27 11:10:50 +01:00
Vishwas Babu AJ 82a23d7413 Add new entities for document management validation 2012-10-26 17:53:07 +05:30
Keith Woodlock eefd55f7af remove unused warnings 2012-10-26 10:46:08 +01:00
Natu LauchandeandKeith Woodlock e5480dca8d MIFOSX-47: natus commits around code values. 2012-10-25 23:36:12 +01:00
Keith Woodlock 675cebbbc7 MIFOSX-67: update patch to drop recreate client identifier tables with UTF-8 charset and changes to field sizes. duplicate key scenario did not work correctly due to refetch of client data in same session which is closed due to excpetion. Little bit of removal of unused code from earlier solution. 2012-10-24 16:20:40 +01:00
Vishwas Babu AJ 59858e2bd3 database patch for enforcing unique identifiers 2012-10-24 18:10:09 +05:30
Vishwas Babu AJ 4f44cb28d1 addres review comments for Client Identifiers 2012-10-24 17:24:26 +05:30
John Woodlock 36e7117e46 add sql gk risk analysis table 2012-10-23 17:38:19 +01:00
Keith Woodlock 1e3047c29c MIFOSX-90: tidy up of implementation around add,delete,update loan charges. 2012-10-23 13:38:38 +01:00
Keith Woodlock ccdda4287b MIFOSX-90: detect in active charges on product during loan creation. 2012-10-23 11:52:45 +01:00
Vishwas Babu AJ 585f591709 Minor fixes to detect empty file updates 2012-10-22 21:21:51 +05:30
Keith Woodlock bdd2774de9 MIFOSX-90: in prep for this work, fix some existing issues with charges, product charges and loan charges functionality. 2012-10-22 15:38:27 +01:00
Keith Woodlock 947f50fc31 remove unused import in groups service 2012-10-22 13:40:28 +01:00
Michal Dudzinski 6dfdc458ae MIFOSX-108 minor issues fixes. 2012-10-22 13:53:45 +02:00
Keith Woodlock dd95e0ad49 Update README.md
update demo server.
2012-10-21 17:21:04 +02:00
Keith Woodlock e8bd6ccdbd update docs to handle demo and production servers as well as localhost dev. 2012-10-21 12:02:23 +01:00
Keith Woodlock 0b55ef9149 update tomcat plugin, handle change of disbursement date when modifying loan application for now. 2012-10-20 14:11:55 +01:00
Keith Woodlock 09165cbb04 allow undo disbursal if only disbursement transactions. refactor loanTransactionData object. 2012-10-18 17:48:26 +01:00
Udai Gupta 3e40a0dac4 fixing test failure 2012-10-17 21:25:52 +05:30
Keith Woodlock c32a14e537 upgrade sql files after demo server upgrade. 2012-10-16 00:47:30 +01:00
Keith Woodlock 3c78d8f64e remove deprecate MoneyData class usage forcing tidy up of LoanTransaction usage. 2012-10-12 09:55:22 +01:00
Keith Woodlock b56ecc8387 allow adjusted transactions to be zeroed, ensure inArrearsTolerance is nullable and does not need to be provided. 2012-10-12 00:41:05 +01:00
Vishwas Babu AJ 3ce1ee7ded address review comments for client search and minor updates to document search api 2012-10-12 01:56:45 +05:30
Keith Woodlock ab9497c985 mifosx-92: tidy up loan product in prep for tranche loans. 2012-10-11 17:59:13 +01:00
Michal Dudzinski 90f78597d9 MIFOSX-108: Extend group search functionality. 2012-10-11 17:26:51 +02:00
Keith Woodlock b79f0495f3 remove legacy code and fetaures from earlier prototype version that are no longer used and will be implemented differently in future. 2012-10-10 17:00:05 +01:00
Keith Woodlock c4578672fa mifosx-61: provide ability to close loans as reschedule or obligations met if loan is within defined tolerance. 2012-10-10 15:02:41 +01:00
Vishwas Babu AJ e60f1798aa Adding insert script for new table and rolling back changes to cotext.xml 2012-10-10 05:20:01 +05:30
Vishwas Babu AJ 2e83169b99 Intermediate checking for file upload functionality 2012-10-10 05:19:59 +05:30
Keith Woodlock 9c75498ebe remove unused import warnings and unused fields and parameter warnings for now. 2012-10-09 19:40:12 +01:00
Keith Woodlock 1553918558 bump up patch number. 2012-10-09 19:29:03 +01:00
Keith Woodlock 79d036d5c9 squash madhukars pull request into one commit. 2012-10-09 19:16:48 +01:00
Keith Woodlock b97f02ef8e mifosx-61: support waive of interest along with loan write off capability. refactor loanRepayments as transactions on api. 2012-10-09 14:53:34 +01:00
Keith Woodlock a6a72541eb remove warnings about unused imports and make CodeValueData immutable. 2012-10-08 10:16:11 +01:00
Keith Woodlock 27263af350 remove collation on sql, defult to utf-8 charset for table. 2012-10-07 20:22:48 +01:00
Vishwas Babu AJ 721039f637 Adding services for client identifiers and some service methods for code and code value 2012-10-06 19:11:46 +05:30
John Woodlock 19f6485a41 data tables api docs and remove fiedls option from data tables api 2012-10-05 14:52:00 +10:00
John Woodlock 47ed3e7165 WIP api docs update data tables 2012-10-05 12:23:48 +10:00
Keith Woodlock 0a22ab3e41 creocore: change waive functionality to support waive of interest only. 2012-10-04 16:08:31 +01:00
Michal Dudzinski cf865a28d9 MIFOSX-26 group template API returns only clients from specified office. 2012-10-04 14:58:10 +02:00
John Woodlock 82aebe4200 apidocs update WIP 2012-10-04 18:26:12 +10:00
Keith Woodlock 976ea6be21 Tidy up programming style bad smells around GETTING data from objects rather than putting behaviour on object that owns the data and using that behaviour. 2012-10-03 17:00:04 +01:00
Madhukar fd20f72814 Add edit option for deposit account 2013-04-17 20:55:47 +05:30
John Woodlock f3c63671a0 recommiting change after pull that still showed as modified 2012-10-03 15:46:50 +10:00
Keith Woodlock b86966caf9 remove usused warnings, make group data immutable. 2012-10-02 12:24:36 +01:00
Michal Dudzinski 1bae87e447 MIFOSX-26 added group and client office validation. 2012-10-02 12:31:20 +02:00
Madhukar 6f8e94b949 actual maturity amount fix 2012-10-01 22:05:07 +05:30
Madhukar e68db3551e validation fix for renewing account
validations for renew Account

populate interest for preclosure deposit account

get available interest for withdrawal for UI

seperated renewing deposit functionality

Renew for FD & validation fix
2012-10-01 20:09:41 +05:30
Michal Dudzinski 98ca889938 MIFOSX 26 Solidarity group loan 2012-10-01 15:00:48 +02:00
Keith Woodlock 2855e56e0f update files after server upgrade. 2012-10-01 10:17:40 +01:00
Keith Woodlock 4fc43ced64 mifosx-58: cater for modification of loan charges during loan modify process. ensure existing loan charges are used and updated rather than removed and new ones added each time. 2012-09-28 16:53:00 +01:00
John Woodlock 3860d2af56 data tables errors change 2012-09-28 16:14:55 +10:00
John Woodlock 344ed0ebab data tables - prevent multiple update attempt 2012-09-28 14:57:21 +10:00
John Woodlock 7d57edd8e8 data table query param correction 2012-09-28 14:35:03 +10:00
John Woodlock 7d8ec61e02 wip data tables api docs 2012-09-28 12:03:15 +10:00
Keith Woodlock f737336dc3 mifosx-58: handle charges at disbursement for loan creation. 2012-09-27 11:24:30 +01:00
John Woodlock d5f697962c wip update data tables and docs 2012-09-27 16:58:41 +10:00
John Woodlock 471bfe2566 updating data tables api docs WIP 2012-09-27 15:45:01 +10:00
Michal Dudzinski f53e662b6d MIFOSX-26 Added Office to Group. 2012-09-26 15:24:45 +02:00
Keith Woodlock 3617197f5f remove warnings 2012-09-26 10:18:41 +01:00
Madhukar c08a76dd94 add account count 2012-09-26 12:57:02 +05:30
Madhukar 11e7f64cad getAvailableInterest for withdrawal 2012-09-25 21:57:04 +05:30
Madhukar 115aede1fa For UI 2012-09-25 21:57:03 +05:30
Keith Woodlock 4830b85493 ensure payment of charges due at disbursement are captured on a transaction that is automaticatly entered when disbursement of loan occurs. 2012-09-25 16:09:05 +01:00
John Woodlock 7656bccb21 wip data tables registration resources 2012-09-25 19:00:38 +10:00
Keith Woodlock 59e19e005e mifosx-58: add interest repayment and total repayment details correctly to new loan schedule been returned. 2012-09-25 09:48:12 +01:00
John Woodlock 1b24a99124 wip data tables registration 2012-09-25 11:40:46 +10:00
John Woodlock afd22ea826 wip data tables 2012-09-25 02:45:38 +10:00
John Woodlock 30cadb4d0d wip data tables 2012-09-24 23:24:47 +10:00
John Woodlock 2d2ff222fc wip data tables 2012-09-23 23:10:24 +10:00
John Woodlock 5dd2bd8859 wip data tables 2012-09-23 20:50:44 +10:00
John Woodlock 4ef70d0d78 wip data tables 2012-09-23 17:38:56 +10:00
John Woodlock 1a83d07c1c break out additional fields functionlity (deprecated) for easier removal later 2012-09-23 13:39:56 +10:00
Keith Woodlock 4c9450a257 remove warnings, format sections. 2012-09-21 20:26:48 +01:00
Keith Woodlock 91bcde66bf keep running tab on overdue amount for each period of repayment schedule, determine arrears from this based on loans arrears tolerance setting, ensure repaymentSchedule from retrieve loan has charges correctly included for disbursement period. 2012-09-21 20:14:49 +01:00
Michal DudzinskiandKeith Woodlock 9e25b070fb MIFOSX-60 API template method for loan charges 2012-09-21 20:07:38 +01:00
Madhukar 1f8b325258 interest payouts patch3 2012-09-21 20:53:48 +05:30
Madhukar 4ac094fc78 interestpayouts patch2 2012-09-21 20:53:47 +05:30
Madhukar 691e836c68 Interest Payouts 2012-09-21 20:53:47 +05:30
Michal Dudzinski 3a89d10454 MIFOSX-60 added loan charges api methods. 2012-09-21 11:05:29 +02:00
Keith Woodlock 4f98144896 mifosx-58: wip - integrate charges at time of disbursement into loan create and modify flows. suppress non-relevant warnings for unused parameters in overiding classes. 2012-09-20 15:11:48 +01:00
Keith Woodlock ba8b24ac3b update file name of loan schedule data class. 2012-09-19 17:25:31 +01:00
Keith Woodlock a6a74a401b mifosx-58: final piece of aligning loan schedule area in prep for integration with charges. Loan schedule presented during loan creation and modify flows are same as one viewed when click loan link on client view. 2012-09-19 17:13:26 +01:00
John Woodlock 08fc9ff4d6 wIP data tables 2012-09-19 11:17:35 +10:00
Keith Woodlock 360ae5a444 mifosx-58: remove deprecated code and tests around it 2012-09-18 15:15:43 +01:00
Keith Woodlock 4084c194a0 mifosx-58: wip - refactoring api for loan schedule data - introduced new schedule in prep for supporting charges. 2012-09-18 15:15:41 +01:00
Keith Woodlock c6317acfae mifosx-58: wip on data to reprsesent loan schedule. 2012-09-18 15:15:37 +01:00
Keith Woodlock 3e5b47f562 wip loan charges and loan schedule 2012-09-18 15:15:35 +01:00
Keith Woodlock 3adfd9c073 WIP on support loan charges on loan schedule. 2012-09-18 15:15:33 +01:00
Keith Woodlock 6bd2d078a3 WIP on support loan charges on loan schedule. 2012-09-18 15:15:30 +01:00
Keith Woodlock 56c8ce43cd removed unneeded supression of warning. 2012-09-18 15:11:13 +01:00
Michal Dudzinski 055e6cde70 MIFOSX-57 reorganization of loan charges design. 2012-09-18 15:31:40 +02:00
John Woodlock 725011c1ae WIP data tables 2012-09-18 20:10:56 +10:00
John Woodlock ad6fb806ff WIP data tables 2012-09-18 13:31:30 +10:00
Keith Woodlock c17fa073ec remove unneeded supressings. 2012-09-17 20:09:31 +01:00
Madhukar 5934ae42ad Merge branch 'MIFOSX-43-home' of https://github.com/madhukar547/mifosx into MIFOSX-43-home 2012-09-17 23:32:26 +05:30
Madhukar 82ebfea45f Withdraw for deposit account 2012-09-17 23:14:03 +05:30
Madhukar 3293183279 Withdraw of deposit amount 2012-09-17 23:14:02 +05:30
Madhukar c387c6155a withdraw_renew_of deposit application on maturity 2012-09-17 23:11:11 +05:30
Madhukar 899f9a3d46 adding maturity for deposit account 2012-09-17 23:06:25 +05:30
John Woodlock 0e66005147 WIP data tables 2012-09-17 20:07:53 +10:00
John Woodlock b5e1ec051f WIP data tables 2012-09-17 17:59:56 +10:00
Madhukar 9df1c76500 applying conflict changes 2012-09-15 12:14:58 +05:30
Keith Woodlock 4e35791618 ensure charges data is returned in json for loan GETs. 2012-09-14 17:27:16 +01:00
Keith Woodlock 712ba4d69e tidy up typical response parameters for loan GET requests. 2012-09-14 17:09:25 +01:00
Keith Woodlock 63e0f8e64b fix sql grammar error with trailing comma. 2012-09-14 16:33:12 +01:00
Keith Woodlock a75a8d5d22 remove join to get currency data for repayment schedule periods. 2012-09-14 16:19:01 +01:00
Keith Woodlock e4f8eb6b12 mifosx-58: restructure loan schedule to contain summary plus detail of schedule. As part of this work I removed the use of MoneyData in data objects and instead return currency and decimal for each monetary amount aligning with rest of application. 2012-09-14 16:10:16 +01:00
Keith Woodlock 4717393816 some tidy up is all. 2012-09-13 22:00:45 +01:00
Vishwas Babu AJ 2d8ae7ae9e Return clients based on Office Hierarchy 2012-09-14 01:12:46 +05:30
Keith Woodlock c1c92fef3c fix conflicts with recent commits. 2012-09-13 17:43:27 +01:00
Keith Woodlock b438747608 update data parameter repaymentStrategyOptions 2012-09-13 17:21:51 +01:00
Keith Woodlock 384928670d mifosx-58: loan charges at time of disbursement 2012-09-13 17:20:49 +01:00
Keith Woodlock 16da04f089 small bit of tidy up. 2012-09-13 17:10:25 +01:00
MadhukarandKeith Woodlock 45200343be withdraw_renew_of deposit application on maturity 2012-09-13 15:36:26 +01:00
MadhukarandKeith Woodlock bacb5bfe64 adding maturity for deposit account 2012-09-13 15:36:24 +01:00
Madhukar 41c35afa87 withdraw_renew_of deposit application on maturity 2012-09-13 19:19:49 +05:30
Michal Dudzinski 6a7647e177 MIFOSX-57 Add possibility to modify loan application charges. 2012-09-13 15:31:01 +02:00
Madhukar 1957dba4ac adding maturity for deposit account 2012-09-13 10:07:47 +05:30
Keith Woodlock 1fe9856eb2 some supressing of warnings and retaining loanAccountData as immutable (of sorts). 2012-09-13 01:05:56 +01:00
Vishwas Babu AJ c90b98c12e Clearing out TODO's and fetching available loan officers for modify loan template 2012-09-13 01:07:03 +05:30
Keith Woodlock bd80d01821 dont return loanRepayments if none exist. 2012-09-12 14:17:19 +01:00
John Woodlock 303da8dc61 redoing last commit 2012-09-12 21:51:14 +10:00
John Woodlock 4c752d7f23 change client query to link to m_office rather than match a list of offices 2012-09-12 21:40:29 +10:00
Keith Woodlock 99b53995ea add validation for repayment strategy for loan application flows, add data update patch for heavensfamily data. 2012-09-12 11:40:56 +01:00
Madhukar ae2279fce0 db field add for m_note 2012-09-12 15:44:07 +05:30
Madhukar 3e7724a8c3 add notes for deposit events 2012-09-12 15:25:24 +05:30
Madhukar 79d2e8bea8 isActive added for depositPermissiondata 2012-09-12 10:09:39 +05:30
Keith Woodlock da6c2ea818 Update README.md 2012-09-12 02:25:16 +02:00
Keith Woodlock 3684e72486 Update README.md
Update roadmap of items being worked on
2012-09-12 02:23:30 +02:00
Keith Woodlock 32e4a2ce64 add note about query for transactions data in deposit account cases. 2012-09-11 21:12:16 +01:00
Keith Woodlock 5154e87b23 Fix deposit account data object, make it immutable again. 2012-09-11 21:08:26 +01:00
Keith Woodlock 0bfabbe99a Merge remote-tracking branch 'madhukar/MIFOSX-43-home' 2012-09-11 18:16:36 +01:00
Michal Dudzinski 14ecbcbb7e MIFOSX-53 Extended loans template api. 2012-09-11 14:23:40 +02:00
Keith Woodlock 587cb496b4 update for recent demo server upgrade. 2012-09-11 12:29:20 +01:00
Madhukar dc9c17ad08 Add permissions for retrieveing 2012-09-10 07:47:35 +05:30
Keith Woodlock 940a665255 update validation around staff 2012-09-09 15:28:05 +01:00
John Woodlock 1877562ea8 commit to tidy up staff changes showing as modified 2012-09-10 00:10:29 +10:00
Keith Woodlock 06ac7a46e2 update patch in case table doesnt exist. 2012-09-09 14:50:50 +01:00
Vishwas Babu AJandKeith Woodlock fa6370d31a Mifosx 54, associating relations to staff entity 2012-09-09 14:34:37 +01:00
John Woodlock 1585b33f42 WIP update script for additional data table 2012-09-09 23:20:55 +10:00
John Woodlock 1f2bdedcd2 WIP data tables 2012-09-09 14:22:12 +10:00
John Woodlock d85696b7d9 recommit after a push as git status says file is modified 2012-09-09 13:25:27 +10:00
John Woodlock 880c671d03 WIP data tables 2012-09-09 13:24:07 +10:00
Keith Woodlock f08bd15b1f add support for charges when create new or modifying loan aplication on the GET of data. 2012-09-07 16:14:13 +01:00
Keith Woodlock 61b49d0b4c fix update loan product transaction strategy field and align new loan application with implementation of modify loan application work from mifosx-32. 2012-09-07 15:32:17 +01:00
Madhukar c686d0d628 preClosureInterestRate For DepositAccount 2012-09-07 15:53:00 +05:30
John Woodlock e3223536a2 WIP data tables 2012-09-07 16:15:47 +10:00
John Woodlock 9649f0aba4 commit item identified as uncommitted after git pull --rebase 2012-09-07 13:31:57 +10:00
Keith Woodlock 5bc6b5f664 support change of dates when modify loan application. 2012-09-06 23:12:45 +01:00
Keith Woodlock a3eed0fdc2 MIFOSX-32: support ability to modify loan application (or loan contract). 2012-09-06 16:57:05 +01:00
Keith Woodlock 756729ae8e fix for change of database column name. 2012-09-06 16:50:21 +01:00
Keith Woodlock 0306ee866a rename matured_on column and rename status and types associated with deposit accounts. 2012-09-06 16:39:14 +01:00
Madhukar e64efb0536 add matured_on field for m_deposit_account 2012-09-06 19:30:53 +05:30
Madhukar a06ed0d33b fixed bugs from pull #32 2012-09-06 19:22:14 +05:30
John Woodlock 1e8d4b8c9d WIP extra data 2012-09-06 22:02:59 +10:00
Madhukar 492a8547a9 Get the transactions for DepositAccounts 2012-09-06 08:22:03 +05:30
John Woodlock 04fc9357eb test commit 2012-09-06 09:16:19 +10:00
Keith Woodlock 29e36a0797 MIFOSX-32: continue WIP on abilit to modify loan application. 2012-09-05 23:19:08 +01:00
Keith Woodlock 6b2ec54a31 MIFOSX-32: start with modifing loan account data returned from get for use in the submit loan application and modify loan application flows. 2012-09-05 19:16:26 +01:00
Michal Dudzinski 20234a8d6c MIFOSX-53 updated GET method. Fixed minor problems. 2012-09-05 19:21:01 +02:00
Keith Woodlock b331a29bf8 fix up some old validation issues on loans. 2012-09-05 15:46:53 +01:00
Michal Dudzinski 99d50b248a MIFOSX-53 added post and template methods. WIP. 2012-09-05 15:46:06 +02:00
Keith Woodlock ca3d666578 remove redundant update case from deposit account for now. 2012-09-05 14:41:36 +01:00
Madhukar 4a90cb091a Transactions for DepositAccounts 2012-09-05 18:29:04 +05:30
Keith Woodlock 464f146a7c remove annotations suppressing warnings that are no longer needed. 2012-09-04 22:02:46 +01:00
Vishwas Babu A J a22d5d10aa updating Client crud service & Db schema for MifosX-35 2012-09-05 01:27:54 +05:30
Keith Woodlock b9c8f63441 Update README.md
udpate public ami
2012-09-04 15:05:39 +02:00
Keith Woodlock 2529ea8a4f move patch into patches folder. 2012-09-03 16:35:26 +01:00
Vishwas Babu A JandKeith Woodlock 48d88de462 Staff CRUD Services: adding columns to m_staff table
Adding audit columns to m_staff tables (as all other entities seem to be
having audit columns and extending AbstractAuditableCustom)
2012-09-03 16:19:29 +01:00
Vishwas Babu A JandKeith Woodlock 85df179c9b Staff CRUD services : MIFOSX-52 2012-09-03 16:19:28 +01:00
John Woodlock d56c86c9af add some special permissions (wip) 2012-09-03 17:58:25 +10:00
John Woodlock a337b6574c update install ddl with changes 2012-09-03 14:27:50 +10:00
John Woodlock 8d0806b723 update demo default backup 2012-09-03 10:43:36 +10:00
John Woodlock b97353975a update default backup and patches after demo server update 2012-09-02 22:19:41 +10:00
John Woodlock db7c961587 check allowed code values on insert/update 2012-09-01 16:16:33 +10:00
John Woodlock a13d725ec4 move additional fields functionality to look at m_code/m_code_value 2012-09-01 13:57:15 +10:00
John Woodlock 9939987a65 new table ddl m_loan_charge 2012-08-31 18:51:22 +10:00
Keith Woodlock a925f5e12d remove unused annotations. 2012-08-31 00:44:28 +01:00
Michal Dudzinski f9d41aa500 MIFOSX-42 Attach charges to loan products. 2012-08-30 17:12:25 +02:00
Keith Woodlock 57b38e463a MIFOSX-43: tidy up approval code so exception isnt thrown and no need for new data object to pass details around. 2012-08-30 10:31:49 +01:00
John Woodlock 508a46e537 refactoring additional fields for data scope 2012-08-30 19:05:49 +10:00
Keith Woodlock f09d781005 some formatting changes and cleanup of status for deposit accounts. 2012-08-30 10:01:08 +01:00
MadhukarandKeith Woodlock 2132a5dccb Mifosx-43 fixed bugs from pull #21 2012-08-30 10:01:07 +01:00
John Woodlock 3cc06530da refactoring additional fields for data scope 2012-08-30 18:14:30 +10:00
John Woodlock e0b3edff8a refactoring additional fields for data scope 2012-08-30 17:53:34 +10:00
Keith Woodlock b100fd16a1 return status with deposit account data. 2012-08-30 08:43:50 +01:00
John Woodlock 9da34579a0 refactoring additional fields for data scope 2012-08-30 14:16:18 +10:00
John Woodlock f4dd25b521 refactoring additional fields for data scope 2012-08-30 13:44:11 +10:00
John Woodlock 2cda93f754 refactoring additional fields for data scope 2012-08-30 13:15:50 +10:00
John Woodlock 6ae1e98eb1 refactoring into GenericDataService 2012-08-30 12:06:08 +10:00
John Woodlock ccbf38f44f used cached resultset for reporting in places (wip) 2012-08-29 18:30:59 +10:00
John Woodlock 7547f93c18 used cached resultset for reporting in places (wip) 2012-08-29 18:08:21 +10:00
John Woodlock 64f55de032 used cached resultset for reporting in places (wip) 2012-08-29 17:29:17 +10:00
John Woodlock 4e78e7e401 Merge pull request #25 from mdudzinski/ChargeCalculationType_clean_up
Changed ChargeCalculationMethod to ChargeCalculationType.
2012-08-28 19:13:58 -07:00
Michal Dudzinski a47586deed Changed ChargeCalculationMethod to ChargeCalculationType. 2012-08-28 16:42:37 +02:00
John Woodlock 1e558cd5c8 Merge pull request #24 from mdudzinski/MIFOSX-41
Charges API template fixes. Charge currency data extended.
2012-08-28 06:50:16 -07:00
John Woodlock c292acff29 used cached resultset for additional data in places (wip) 2012-08-28 23:47:46 +10:00
John Woodlock dca9063a07 used cached resultset for additional data in places (wip) 2012-08-28 23:16:02 +10:00
Michal Dudzinski 7042ffcd0d Charges API template fixes. Charge currency data extended. 2012-08-28 15:00:31 +02:00
John Woodlock 47fe49da8c used cached resultset for additional data in places (wip) 2012-08-28 22:52:54 +10:00
John Woodlock 74fd297487 used cached resultset for additional data in places (wip) 2012-08-28 18:50:29 +10:00
John Woodlock 0474b5df0c refactor noncore reporting and additional data services 2012-08-28 16:06:00 +10:00
John Woodlock 72d854b0cd cosmetic office Txn changes to java 2012-08-28 13:54:45 +10:00
John Woodlock c4b5359ef9 Merge pull request #23 from mdudzinski/MIFOSX-41
MIFOSX-41: API fix.
2012-08-27 18:24:26 -07:00
John Woodlock 8310f6cab6 data scoping for additional fields (WIP) 2012-08-28 01:38:09 +10:00
Michal Dudzinski 61ccefb5d7 MIFOSX-41: API fix. 2012-08-27 16:43:29 +02:00
John Woodlock e80119ca71 user can only list permitted addit. field data 2012-08-27 17:32:04 +10:00
John Woodlock fbbede83f3 permissions on additional fields (WIP) 2012-08-27 17:14:00 +10:00
John Woodlock b33b70cb38 had to put id in office transaction template typical field list to get id in Allowed Offices 2012-08-27 16:10:10 +10:00
John Woodlock cd351ab723 view office transactions api 2012-08-27 14:56:31 +10:00
John Woodlock 0720cee40d only return permitted reports 2012-08-27 12:37:31 +10:00
John Woodlock 03f8a0fcc0 add facility for restricting data scope for reports 2012-08-27 11:00:04 +10:00
John Woodlock 58a6568efc add report permission checking 2012-08-26 16:57:58 +10:00
John Woodlock 345d9f3712 put links in new tab (mostly) 2012-08-25 14:51:41 +10:00
John Woodlock 2270350085 api docs simplify links 2012-08-25 14:22:45 +10:00
Keith Woodlock 2ee5dedf9c support bringing back pending approval and approved deposit accounts first of with client account summary. 2012-08-24 18:16:27 +01:00
Keith Woodlock 91890ff204 add support for soft delete of users and changing users passwords. 2012-08-24 12:32:18 +01:00
John Woodlock 5f60266921 simplify api docs (WIP) 2012-08-24 21:23:34 +10:00
Keith Woodlock 39d5884bb9 whitespace changes. 2012-08-23 13:20:40 +01:00
Madhukar dc11ca018e Mifosx-43-requried_db_changes_patch 2012-08-23 17:03:24 +05:30
Madhukar bbe525d8a8 Mifosx-43 DepositAccount Approval 2012-08-23 17:03:24 +05:30
Keith Woodlock 47a215ec4f MIFOSX-29: allow user to add or edit external id for client. 2012-08-23 12:01:36 +01:00
Keith Woodlock bf4490feb9 add error indicating no authorization for action. 2012-08-23 11:18:26 +01:00
Keith Woodlock 17ba21d302 update default error message for fund data integrity constraints. 2012-08-23 10:49:14 +01:00
John Woodlock 3cd3b487f3 add pentaho report examples to api docs (were also put on demo server) 2012-08-23 18:00:48 +10:00
John Woodlock ff5967e377 update apidocs to default (for live examples) to host it is running on 2012-08-23 17:21:54 +10:00
Keith Woodlock 030887ad6f tidy up enum usuage and api problems around charges during review and testing. 2012-08-22 18:02:52 +01:00
Michal Dudzinski e4f95923eb MIFOSX-41: Update Infrastructure for fees, charges and penalties. 2012-08-22 17:19:46 +02:00
Keith Woodlock 12a16a07cf break out currency information on its own, using use values for loan product amount and inArrearsTolerance. 2012-08-22 16:12:34 +01:00
Keith Woodlock 9459db944b support clientOrBusinessName data parameter for clients. 2012-08-22 13:44:13 +01:00
John Woodlock ed82fdae52 make apidocs easier to change WIP 2012-08-22 22:38:44 +10:00
Keith Woodlock 1aafc0b09d ensure retrieval of head office returns no allowedParents. 2012-08-22 13:15:51 +01:00
Keith Woodlock 9a3ab88996 from MIFOSX-38, tidy up serialization of charges data. 2012-08-22 12:16:24 +01:00
Keith Woodlock 3b341b29af from MIFOSX-38, tidy up serialisation around loan accounts and transactions. 2012-08-22 11:17:18 +01:00
John Woodlock b4dc4b16bc retrieve currencies in name order 2012-08-22 15:01:46 +10:00
Keith Woodlock 4a11cb3290 from MIFOSX-38, tidy up serialization around notes. 2012-08-22 01:09:33 +01:00
Keith Woodlock f2ca1746a4 from MIFOSX-38, tidy up serialization for client and group areas. 2012-08-22 00:37:44 +01:00
Keith Woodlock b691792de8 Update README.md
add link to mifos.org wiki
2012-08-22 00:39:02 +02:00
Keith Woodlock 75ba809761 from MIFOSX-38, tidy up serialization of deposit accounts. 2012-08-21 21:47:07 +01:00
Keith Woodlock bd37a66247 from MIFOSX-38, tidy up serialization around financial products. 2012-08-21 21:20:07 +01:00
Keith Woodlock b44e53c3b7 from MIFOSX-38, tidy up serialisation around additional data and reports.2 2012-08-21 20:45:44 +01:00
Keith Woodlock c7c5198206 from MIFOSX-38 - tidy up serialisation around funds. 2012-08-21 17:56:35 +01:00
Keith Woodlock f48e4de309 from MIFOSX-38 - update serialization of offices and office transactions. 2012-08-21 16:17:41 +01:00
Keith Woodlock 00c4d5399a MIFOSX-43: add database patch. 2012-08-21 14:37:15 +01:00
Keith Woodlock 95bdafa4bb from MIFOX-38 - need to tidy up serialization of java objects into json across the board - this is for user admin related areas. 2012-08-21 13:04:58 +01:00
Keith Woodlock 432332c88e FIXED: MIFOSX-38 - retrieving client notes does not return as an array when only one client note exists. 2012-08-21 10:42:04 +01:00
John Woodlock 28cee2ab07 add basic m_staff table for Vishwas familiarisation 2012-08-21 15:20:20 +10:00
John Woodlock 592b5378dc update after upgrading demo server 2012-08-20 15:28:38 +10:00
John Woodlock 4bbd878ca5 add uptodate backup of demo server data 2012-08-20 13:03:08 +10:00
John Woodlock c1b52199a3 changes to charges 2012-08-20 12:25:58 +10:00
Keith Woodlock ccfd8a09e0 fix issues around loan. 2012-08-18 11:21:18 +01:00
John Woodlock e21e0e9a2f update new ddl for deposit functionality and base data for default reports (due to core rename tables) 2012-08-18 15:17:30 +10:00
John Woodlock 1e24527487 update patches, base data (reports to come later) 2012-08-18 13:03:26 +10:00
Keith Woodlock 9108cebf67 update java code due to table renames. 2012-08-18 02:36:54 +01:00
John Woodlock bc1b9d89c9 update new schema and demo data ddl with rename to m prefix 2012-08-18 11:19:53 +10:00
John Woodlock 13b09ad4a1 rename core tables with prefix m (for mifos) 2012-08-18 11:01:41 +10:00
Keith Woodlock d7dba9a515 fixed mifosx-38 2012-08-17 16:39:28 +01:00
Keith Woodlock 068620c810 test amortisation for declining balance and support irregular first repayment on flat loans. 2012-08-17 15:11:37 +01:00
Keith Woodlock af5e2c0e84 work on fixing interest calculation for declining balance loans. 2012-08-17 15:11:35 +01:00
Keith Woodlock d855129fea keep DepositAccountData as an immutable object. opt against used selectedProduct approach like in loans. drop currencyOptions as the product should define the currency. add productOptions (options for consistency) when retrieving template. 2012-08-17 15:02:36 +01:00
madhukar 88e4c4ec00 Changes made for populating client name, available products 2012-08-17 18:14:40 +05:30
Keith Woodlock 440205fdfa ensure updates allow for changing any one attribute e.g. i want to change name only. 2012-08-17 12:42:36 +01:00
Michal Dudzinski 9ad9070a86 MIFOSX-33 Add Infrastructure for fees, charges and penalties. 2012-08-17 12:59:54 +02:00
Keith Woodlock ac6589e9aa rename enum to LoanStatus 2012-08-16 19:49:13 +01:00
Keith Woodlock abb4ec17dc drop loan status table in favour of enum for now. 2012-08-16 19:40:03 +01:00
John Woodlock 9fe9a091c9 allow field list for datatables (WIP) 2012-08-16 20:21:11 +10:00
John Woodlock 99fbab83b7 just adding simple search and ordering to datatable api (WIP) 2012-08-16 17:10:35 +10:00
John Woodlock 32668987d0 code and enum tables WIP 2012-08-16 15:23:27 +10:00
John Woodlock 25d1ff3dac update ddl to remove charge relationship on loan product 2012-08-16 13:14:54 +10:00
John Woodlock 2c6782ca25 add delete flag to o_charge 2012-08-16 13:05:09 +10:00
John Woodlock 12b6795188 add basic charge table 2012-08-16 12:52:15 +10:00
Keith Woodlock 392be3745c calculate future value of fixed term deposit on opening or creation of deposit account.2 2012-08-15 14:17:00 +01:00
Keith Woodlock 10c6f9c509 restructure deposit related files under saving packages. 2012-08-15 12:11:02 +01:00
Keith Woodlock 349e3f4a4e ensure deposit account inherits details of product but allows for user to overriden core details where possible. 2012-08-15 11:35:25 +01:00
Keith Woodlock 9420d4fd14 fix up deposit account fields to be consistent with product. 2012-08-15 02:41:12 +01:00
Keith Woodlock f30e8645a3 add interest compounding frequency to deposit product along with externalId and unique constraints for name and externalId on product. 2012-08-14 23:54:33 +01:00
Michal Dudzinski 6642aacff5 MIFOSX-25: minor api changes. 2012-08-14 16:50:23 +02:00
Keith Woodlock ee9656c5a6 fix error 2012-08-14 15:18:34 +01:00
Keith Woodlock c2e563bf6f make parameter names consistent between product and account for deposits. 2012-08-14 15:14:56 +01:00
Keith Woodlock 2a1bb14c9f tidy up deposit product usuage with deposit account. 2012-08-14 15:14:55 +01:00
John Woodlock 53030285de add interest_waived_derived to portfolio_loan_transaction 2012-08-14 18:24:33 +10:00
Keith Woodlock 42a52cc70a take care of most of open new deposit account use case - interest calculation is remaining. 2012-08-14 00:41:26 +01:00
Keith Woodlock 33afb23f12 add patch for updating south african rand currency symbol. 2012-08-14 00:41:24 +01:00
Keith Woodlock 52aa27efea add patch for deposit account table. 2012-08-14 00:41:24 +01:00
Keith Woodlock fc7380f22d avoid use of Boolean object type. allow ability to update renewal and preClosure settings of product definition. 2012-08-13 17:44:05 +01:00
madhukar aa762b8a24 Validation Fixes for deposit product 2012-08-13 20:29:18 +05:30
John Woodlock 3d136095a4 wip data table api 2012-08-14 00:38:43 +10:00
1100 changed files with 62045 additions and 29289 deletions
+6
View File
@@ -5,8 +5,14 @@ repos
.project
.settings
.gradle
.idea
*.log
*.class
*.jar
*.war
*.ear
*.bak
*.iml
*.ipr
*.iws
rebel.xml
+15 -13
View File
@@ -11,39 +11,41 @@ http://www.youtube.com/watch?v=zN5Dn1Lc_js
Online Client Application Demos
=============================
<a target="_blank" href="https://ec2-46-137-62-163.eu-west-1.compute.amazonaws.com:8443/IndividualLendingGeneralJavaScript/IndivLendHome.html?tenantIdentifier=default" title="Client apps: Individual Lending">Individual Lending App</a>
<a target="_blank" href="https://demo.openmf.org" title="Client apps: Individual Lending">Individual Lending App</a>
Mifos Platform API
=====================
<a target="_blank" href="https://ec2-46-137-62-163.eu-west-1.compute.amazonaws.com:8443/api-docs/apiLive.htm" title="mifos platform api beta 1">API Documentation (Demo Server)</a>
<a target="_blank" href="https://demo.openmf.org/api-docs/apiLive.htm" title="mifos platform api beta 1">API Documentation (Demo Server)</a>
Developers
==========
see https://github.com/keithwoodlock/mifosx/wiki for getting started.
see https://mifosforge.jira.com/wiki/display/MIFOSX/MifosX+Technical
see https://github.com/keithwoodlock/mifosx/wiki/Screen-Based-Reporting for info around reporting
see https://github.com/keithwoodlock/mifosx/wiki/Git-Usuage for info around using git
see https://www.ohloh.net/p/mifosx for activity overview and basic code analysis.
see https://github.com/keithwoodlock/mifosx/wiki/Developer-deep-dive-into-Http-API for info around resource-oriented API work
Amazon Public AMI (currently out-of-date and will be updated - so don't use
Amazon Public AMI
=================
Launch instance <a target="_blank" href="https://console.aws.amazon.com/ec2/home?region=eu-west-1#launchAmi=ami-7b0e0a0f" title="mifos platform api beta 2">ami-7b0e0a0f</a>
Launch instance <a target="_blank" href="https://console.aws.amazon.com/ec2/home?region=eu-west-1#launchAmi=ami-65e6e011" title="Mifos X Public AMI 1">ami-65e6e011</a>
- mifos-platform-api-beta-2
- Mifos X Public AMI 1
- Ubuntu11.10, tomcat7.0.21 (with SSL),MySql 5.1.62, Java 1.6_30, Mifos X Platform
Roadmap
==============
- Savings (Through collaboration with Hugo and Conflux)
- Group Lending (Through collaboration with Soldevho)
- Round out **Individual Lending** platform and application cababilities through working with (ENDA, Al Majmoua, GK-maarg http://www.gfspl.in/maarg)
- API improvements from feedback
- paging support
- Ability to refine retrieval of single/list resources
- Round out Individual Lending platform and application cababilities:
- GK-maarg http://www.gfspl.in/maarg) - see see https://mifosforge.jira.com/browse/MIFOSX-31
- Elevate Africa, Heavens Family, CEDA Microfinance
- Solidatory Groups (Joint Liability Groups) & Linking loan functionality to these groups (@michal-At-soldevho - see https://mifosforge.jira.com/browse/MIFOSX-127, https://mifosforge.jira.com/browse/MIFOSX-5)
- Add spine of Fixed-Term Deposit Accounts and Savings Accounts (@madhukar-At-hugo - see https://mifosforge.jira.com/browse/MIFOSX-1)
+6
View File
@@ -0,0 +1,6 @@
my api notes
- loan products api should return currencyCode and digitsAfterDecimal
2) "officeId": 1, comes back for clients/template ... seems to suggest a new client defaults to head office rather than select one?
+786 -584
View File
File diff suppressed because it is too large Load Diff
+15
View File
@@ -1,3 +1,18 @@
.apiClick {
text-decoration: underline;
cursor: hand;
cursor: pointer;
color: blue;
}
#jpw {
text-decoration: underline;
cursor: hand;
cursor: pointer;
color: blue;
}
.tocMatrix {
font-size: 85%;
}
-48
View File
@@ -1,48 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="jquery-1.7.min.js"></script>
<title>Demo use of Mifos X platform</title>
</head>
<body>
<script type = "text/javascript">
function setBasicAuthKey(username, password)
{
basicAuthKey = "";
var jqxhr = $.ajax({
url : "https://localhost:8443/mifosng-provider/api/v1/authentication?username=" + username + "&password=" + password,
type : 'POST',
contentType : "application/json; charset=utf-8",
dataType : 'json',
data : "{}",
cache : false,
success : function(data, textStatus, jqXHR) {
basicAuthKey = data.base64EncodedAuthenticationKey;
window.location = "http://www.google.com";
return false;
},
error : function(jqXHR, textStatus, errorThrown) {
alert("Invalid Username/Password");
return true;
}
});
}
</script>
<form name = "logonform">
<table>
<tr><td>User Name:</td><td><input type="text" name="username"></td></tr>
<tr><td>Password: </td><td><input type="password" name="password"></td></tr>
<tr><td><input type="button" value="Logon to Rough Approval" name="Submit" onclick= "setBasicAuthKey(document.logonform.username.value, document.logonform.password.value )"></td><td></td></tr>
</table>
</form>
</body>
@@ -1,583 +0,0 @@
-- This script is the core DDL for mifos platform
-- Its includes tables related to lookup/reference data, user adminsitration, organisation modeling, client and loans
-- and infrastructure tables needed for 'additional data' and 'screen based reporting' functionality.
-- It does not include DDL customisations needed for specific 'tenants' for 'additional data' functionality around clients/loans.
-- This script drops all tables and re-creates from scratch.
-- drop tables in base-schema
-- portfolio related tables
DROP TABLE IF EXISTS `portfolio_note`;
DROP TABLE IF EXISTS `portfolio_loan_transaction`;
DROP TABLE IF EXISTS `portfolio_loan_repayment_schedule`;
DROP TABLE IF EXISTS `portfolio_loan`;
DROP TABLE IF EXISTS `portfolio_client`;
DROP TABLE IF EXISTS `portfolio_group`;
DROP TABLE IF EXISTS `portfolio_product_loan`;
DROP TABLE IF EXISTS `portfolio_product_savings`;
DROP TABLE IF EXISTS `portfolio_product_deposit`;
-- organisation related tables
DROP TABLE IF EXISTS `org_organisation_currency`;
DROP TABLE IF EXISTS `org_fund`;
DROP TABLE IF EXISTS `portfolio_office_transaction`;
SET foreign_key_checks = 0;
DROP TABLE IF EXISTS `org_office`;
SET foreign_key_checks = 1;
-- admin tables
DROP TABLE IF EXISTS `admin_role_permission`;
DROP TABLE IF EXISTS `admin_appuser_role`;
DROP TABLE IF EXISTS `admin_appuser`;
DROP TABLE IF EXISTS `admin_permission`;
DROP TABLE IF EXISTS `admin_role`;
-- drop reference/lookup tables
DROP TABLE IF EXISTS `ref_currency`;
DROP TABLE IF EXISTS `ref_loan_status`;
DROP TABLE IF EXISTS `ref_loan_transaction_processing_strategy`;
-- additional data and report tables
DROP TABLE IF EXISTS `stretchydata_dataset_fields`;
DROP TABLE IF EXISTS `stretchydata_dataset`;
DROP TABLE IF EXISTS `stretchydata_allowed_value`;
DROP TABLE IF EXISTS `stretchydata_allowed_list`;
DROP TABLE IF EXISTS `stretchydata_datasettype`;
DROP TABLE IF EXISTS `stretchy_parameter`;
DROP TABLE IF EXISTS `stretchy_report_parameter`;
DROP TABLE IF EXISTS `stretchy_report`;
DROP TABLE IF EXISTS `rpt_sequence`;
-- DDL for reference/lookup tables
CREATE TABLE `ref_currency` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`code` varchar(3) NOT NULL,
`decimal_places` smallint(5) NOT NULL,
`display_symbol` varchar(10) DEFAULT NULL,
`name` varchar(50) NOT NULL,
`internationalized_name_code` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `code` (`code`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `ref_loan_status` (
`id` smallint(5) NOT NULL,
`display_name` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `ref_loan_transaction_processing_strategy` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`code` varchar(100) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ltp_strategy_code` (`code`)
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8;
-- DDL for organisation wide related concepts
CREATE TABLE `org_fund` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`external_id` varchar(100) DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `fund_name_org` (`name`),
UNIQUE KEY `fund_externalid_org` (`external_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `org_office` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`parent_id` bigint(20) DEFAULT NULL,
`hierarchy` varchar(100) DEFAULT NULL,
`external_id` varchar(100) DEFAULT NULL,
`name` varchar(50) NOT NULL,
`opening_date` date NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_org` (`name`),
UNIQUE KEY `externalid_org` (`external_id`),
KEY `FK2291C477E2551DCC` (`parent_id`),
CONSTRAINT `FK2291C477E2551DCC` FOREIGN KEY (`parent_id`) REFERENCES `org_office` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `portfolio_office_transaction` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`from_office_id` bigint(20) DEFAULT NULL,
`to_office_id` bigint(20) DEFAULT NULL,
`currency_code` varchar(3) NOT NULL,
`currency_digits` int(11) NOT NULL,
`transaction_amount` decimal(19,6) NOT NULL,
`transaction_date` date NOT NULL,
`description` varchar(100) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK1E37728B93C6C1B6` (`to_office_id`),
KEY `FK1E37728B783C5C25` (`from_office_id`),
CONSTRAINT `FK1E37728B783C5C25` FOREIGN KEY (`from_office_id`) REFERENCES `org_office` (`id`),
CONSTRAINT `FK1E37728B93C6C1B6` FOREIGN KEY (`to_office_id`) REFERENCES `org_office` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `org_organisation_currency` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`code` varchar(3) NOT NULL,
`decimal_places` smallint(5) NOT NULL,
`name` varchar(50) NOT NULL,
`display_symbol` varchar(10) DEFAULT NULL,
`internationalized_name_code` varchar(50) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
-- DDL for admin tables
CREATE TABLE `admin_permission` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`group_enum` smallint(5) NOT NULL,
`code` varchar(100) NOT NULL,
`default_description` varchar(500) NOT NULL,
`default_name` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `admin_role` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`description` varchar(500) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `admin_appuser` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`office_id` bigint(20) DEFAULT NULL,
`username` varchar(100) NOT NULL,
`firstname` varchar(100) NOT NULL,
`lastname` varchar(100) NOT NULL,
`password` varchar(255) NOT NULL,
`email` varchar(100) NOT NULL,
`firsttime_login_remaining` bit(1) NOT NULL,
`nonexpired` bit(1) NOT NULL,
`nonlocked` bit(1) NOT NULL,
`nonexpired_credentials` bit(1) NOT NULL,
`enabled` bit(1) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username_org` (`username`),
KEY `FKB3D587CE0DD567A` (`office_id`),
CONSTRAINT `FKB3D587CE0DD567A` FOREIGN KEY (`office_id`) REFERENCES `org_office` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `admin_role_permission` (
`role_id` bigint(20) NOT NULL,
`permission_id` bigint(20) NOT NULL,
PRIMARY KEY (`role_id`,`permission_id`),
KEY `FK8DEDB04815CEC7AB` (`role_id`),
KEY `FK8DEDB048103B544B` (`permission_id`),
CONSTRAINT `FK8DEDB048103B544B` FOREIGN KEY (`permission_id`) REFERENCES `admin_permission` (`id`),
CONSTRAINT `FK8DEDB04815CEC7AB` FOREIGN KEY (`role_id`) REFERENCES `admin_role` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `admin_appuser_role` (
`appuser_id` bigint(20) NOT NULL,
`role_id` bigint(20) NOT NULL,
PRIMARY KEY (`appuser_id`,`role_id`),
KEY `FK7662CE59B4100309` (`appuser_id`),
KEY `FK7662CE5915CEC7AB` (`role_id`),
CONSTRAINT `FK7662CE5915CEC7AB` FOREIGN KEY (`role_id`) REFERENCES `admin_role` (`id`),
CONSTRAINT `FK7662CE59B4100309` FOREIGN KEY (`appuser_id`) REFERENCES `admin_appuser` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- DDL for portfolio tables
CREATE TABLE `portfolio_group` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(100) DEFAULT NULL,
`external_id` varchar(100) DEFAULT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
UNIQUE KEY `external_id` (`external_id`),
KEY `FKJPWG000000000003` (`createdby_id`),
KEY `FKJPWG000000000004` (`lastmodifiedby_id`),
CONSTRAINT `FKJPWG000000000003` FOREIGN KEY (`createdby_id`) REFERENCES `admin_appuser` (`id`),
CONSTRAINT `FKJPWG000000000004` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `admin_appuser` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `portfolio_group_client` (
`group_id` bigint(20) NOT NULL,
`client_id` bigint(20) NOT NULL,
PRIMARY KEY (`group_id`,`client_id`),
KEY `client_id` (`client_id`),
CONSTRAINT `portfolio_group_client_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `portfolio_group` (`id`),
CONSTRAINT `portfolio_group_client_ibfk_2` FOREIGN KEY (`client_id`) REFERENCES `portfolio_client` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `portfolio_client` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`is_deleted` tinyint(1) NOT NULL DEFAULT 0,
`office_id` bigint(20) NOT NULL,
`external_id` varchar(100) DEFAULT NULL,
`firstname` varchar(50) DEFAULT NULL,
`lastname` varchar(50) DEFAULT NULL,
`joining_date` date DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `external_id` (`external_id`),
KEY `FKCE00CAB3E0DD567A` (`office_id`),
KEY `FKAUD0000000000001` (`createdby_id`),
KEY `FKAUD0000000000002` (`lastmodifiedby_id`),
CONSTRAINT `FKAUD0000000000001` FOREIGN KEY (`createdby_id`) REFERENCES `admin_appuser` (`id`),
CONSTRAINT `FKAUD0000000000002` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `admin_appuser` (`id`),
CONSTRAINT `FKCE00CAB3E0DD567A` FOREIGN KEY (`office_id`) REFERENCES `org_office` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `portfolio_product_loan` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`currency_code` varchar(3) NOT NULL,
`currency_digits` smallint(5) NOT NULL,
`principal_amount` decimal(19,6) NOT NULL,
`arrearstolerance_amount` decimal(19,6) NOT NULL,
`name` varchar(100) NOT NULL,
`description` varchar(500) DEFAULT NULL,
`fund_id` bigint(20) DEFAULT NULL,
`loan_transaction_strategy_id` bigint(20) DEFAULT NULL,
`nominal_interest_rate_per_period` decimal(19,6) NOT NULL,
`interest_period_frequency_enum` smallint(5) NOT NULL,
`annual_nominal_interest_rate` decimal(19,6) NOT NULL,
`interest_method_enum` smallint(5) NOT NULL,
`interest_calculated_in_period_enum` smallint(5) NOT NULL DEFAULT '1',
`repay_every` smallint(5) NOT NULL,
`repayment_period_frequency_enum` smallint(5) NOT NULL,
`number_of_repayments` smallint(5) NOT NULL,
`amortization_method_enum` smallint(5) NOT NULL,
`flexible_repayment_schedule` bit(1) NOT NULL,
`interest_rebate` bit(1) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKAUD0000000000003` (`createdby_id`),
KEY `FKAUD0000000000004` (`lastmodifiedby_id`),
KEY `FKA6A8A7D77240145` (`fund_id`),
KEY `FK_ltp_strategy` (`loan_transaction_strategy_id`),
CONSTRAINT `FK_ltp_strategy` FOREIGN KEY (`loan_transaction_strategy_id`) REFERENCES `ref_loan_transaction_processing_strategy` (`id`),
CONSTRAINT `FKA6A8A7D77240145` FOREIGN KEY (`fund_id`) REFERENCES `org_fund` (`id`),
CONSTRAINT `FKAUD0000000000003` FOREIGN KEY (`createdby_id`) REFERENCES `admin_appuser` (`id`),
CONSTRAINT `FKAUD0000000000004` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `admin_appuser` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `portfolio_loan` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`external_id` varchar(100) DEFAULT NULL,
`client_id` bigint(20) NOT NULL,
`product_id` bigint(20) DEFAULT NULL,
`fund_id` bigint(20) DEFAULT NULL,
`loan_transaction_strategy_id` bigint(20) DEFAULT NULL,
`loan_status_id` smallint(5) NOT NULL,
`currency_code` varchar(3) NOT NULL,
`currency_digits` smallint(5) NOT NULL,
`principal_amount` decimal(19,6) NOT NULL,
`arrearstolerance_amount` decimal(19,6) NOT NULL,
`nominal_interest_rate_per_period` decimal(19,6) NOT NULL,
`interest_period_frequency_enum` smallint(5) NOT NULL,
`annual_nominal_interest_rate` decimal(19,6) NOT NULL,
`interest_method_enum` smallint(5) NOT NULL,
`interest_calculated_in_period_enum` smallint(5) NOT NULL DEFAULT '1',
`term_frequency` smallint(5) NOT NULL,
`term_period_frequency_enum` smallint(5) NOT NULL,
`repay_every` smallint(5) NOT NULL,
`repayment_period_frequency_enum` smallint(5) NOT NULL,
`number_of_repayments` smallint(5) NOT NULL,
`amortization_method_enum` smallint(5) NOT NULL,
`flexible_repayment_schedule` bit(1) NOT NULL,
`interest_rebate` bit(1) NOT NULL,
`interest_rebate_amount` decimal(19,6) DEFAULT NULL,
`submittedon_date` datetime DEFAULT NULL,
`approvedon_date` datetime DEFAULT NULL,
`expected_disbursedon_date` date DEFAULT NULL,
`expected_firstrepaymenton_date` date DEFAULT NULL,
`interest_calculated_from_date` date DEFAULT NULL,
`disbursedon_date` date DEFAULT NULL,
`expected_maturedon_date` date DEFAULT NULL,
`maturedon_date` date DEFAULT NULL,
`closedon_date` datetime DEFAULT NULL,
`rejectedon_date` datetime DEFAULT NULL,
`rescheduledon_date` datetime DEFAULT NULL,
`withdrawnon_date` datetime DEFAULT NULL,
`writtenoffon_date` datetime DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `org_id` (`external_id`),
KEY `FKB6F935D87179A0CB` (`client_id`),
KEY `FKB6F935D8C8D4B434` (`product_id`),
KEY `FK7C885878B1147D1` (`loan_status_id`),
KEY `FK7C885877240145` (`fund_id`),
KEY `FK_loan_ltp_strategy` (`loan_transaction_strategy_id`),
CONSTRAINT `FK_loan_ltp_strategy` FOREIGN KEY (`loan_transaction_strategy_id`) REFERENCES `ref_loan_transaction_processing_strategy` (`id`),
CONSTRAINT `FK7C885877240145` FOREIGN KEY (`fund_id`) REFERENCES `org_fund` (`id`),
CONSTRAINT `FK7C885878B1147D1` FOREIGN KEY (`loan_status_id`) REFERENCES `ref_loan_status` (`id`),
CONSTRAINT `FKB6F935D87179A0CB` FOREIGN KEY (`client_id`) REFERENCES `portfolio_client` (`id`),
CONSTRAINT `FKB6F935D8C8D4B434` FOREIGN KEY (`product_id`) REFERENCES `portfolio_product_loan` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `portfolio_loan_repayment_schedule` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`loan_id` bigint(20) NOT NULL,
`duedate` date DEFAULT NULL,
`installment` smallint(5) DEFAULT NULL,
`principal_amount` decimal(19,6) DEFAULT NULL,
`principal_completed_derived` decimal(19,6) DEFAULT NULL,
`interest_amount` decimal(19,6) DEFAULT NULL,
`interest_completed_derived` decimal(19,6) DEFAULT NULL,
`interest_waived_derived` decimal(19,6) DEFAULT NULL,
`completed_derived` bit(1) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK488B92AA40BE0710` (`loan_id`),
CONSTRAINT `FK488B92AA40BE0710` FOREIGN KEY (`loan_id`) REFERENCES `portfolio_loan` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `portfolio_loan_transaction` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`loan_id` bigint(20) NOT NULL,
`transaction_type_enum` smallint(5) NOT NULL,
`contra_id` bigint(20) DEFAULT NULL,
`transaction_date` date NOT NULL,
`amount` decimal(19,6) NOT NULL,
`principal_portion_derived` decimal(19,6) NOT NULL,
`interest_portion_derived` decimal(19,6) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKCFCEA42640BE0710` (`loan_id`),
KEY `FKCFCEA426FC69F3F1` (`contra_id`),
CONSTRAINT `FKCFCEA42640BE0710` FOREIGN KEY (`loan_id`) REFERENCES `portfolio_loan` (`id`),
CONSTRAINT `FKCFCEA426FC69F3F1` FOREIGN KEY (`contra_id`) REFERENCES `portfolio_loan_transaction` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `portfolio_product_savings` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`description` varchar(500) DEFAULT NULL,
`currency_code` varchar(3) DEFAULT NULL,
`currency_digits` smallint(5) DEFAULT NULL,
`interest_rate` decimal(19,6) DEFAULT NULL,
`minimum_balance` decimal(19,6) DEFAULT NULL,
`maximum_balance` decimal(19,6) DEFAULT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKJPW0000000000003` (`createdby_id`),
KEY `FKJPW0000000000004` (`lastmodifiedby_id`),
CONSTRAINT `FKJPW0000000000003` FOREIGN KEY (`createdby_id`) REFERENCES `admin_appuser` (`id`),
CONSTRAINT `FKJPW0000000000004` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `admin_appuser` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `portfolio_product_deposit` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`description` varchar(500) DEFAULT NULL,
`currency_code` varchar(3) NOT NULL,
`currency_digits` smallint(5) NOT NULL,
`minimum_balance` decimal(19,6) DEFAULT NULL,
`maximum_balance` decimal(19,6) DEFAULT NULL,
`tenure_months` int(11) NOT NULL,
`maturity_default_interest_rate` decimal(19,6) NOT NULL,
`maturity_min_interest_rate` decimal(19,6) NOT NULL,
`maturity_max_interest_rate` decimal(19,6) NOT NULL,
`can_renew` tinyint(1) NOT NULL DEFAULT '0',
`can_pre_close` tinyint(1) NOT NULL DEFAULT '0',
`pre_closure_interest_rate` decimal(19,6) NOT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKJPW0000000000003` (`createdby_id`),
KEY `FKJPW0000000000004` (`lastmodifiedby_id`),
CONSTRAINT `FKJPX0000000000003` FOREIGN KEY (`createdby_id`) REFERENCES `admin_appuser` (`id`),
CONSTRAINT `FKJPX0000000000004` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `admin_appuser` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `portfolio_deposit_account` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`external_id` varchar(100) DEFAULT NULL,
`client_id` bigint(20) NOT NULL,
`product_id` bigint(20) NOT NULL,
`currency_code` varchar(3) NOT NULL,
`currency_digits` smallint(5) NOT NULL,
`deposit_amount` decimal(19,6) DEFAULT NULL,
`maturity_interest_rate` decimal(19,6) NOT NULL,
`tenure_months` int(11) NOT NULL,
`can_renew` tinyint(1) NOT NULL DEFAULT '0',
`can_pre_close` tinyint(1) NOT NULL DEFAULT '0',
`pre_closure_interest_rate` decimal(19,6) NOT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `deposit_acc_external_id` (`external_id`),
KEY `FKKW0000000000001` (`client_id`),
KEY `FKKW0000000000002` (`product_id`),
CONSTRAINT `FKKW0000000000001` FOREIGN KEY (`client_id`) REFERENCES `portfolio_client` (`id`),
CONSTRAINT `FKKW0000000000002` FOREIGN KEY (`product_id`) REFERENCES `portfolio_product_deposit` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `portfolio_note` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`client_id` bigint(20) NOT NULL,
`loan_id` bigint(20) DEFAULT NULL,
`loan_transaction_id` bigint(20) DEFAULT NULL,
`note_type_enum` smallint(5) NOT NULL,
`note` varchar(1000) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK7C9708924D26803` (`loan_transaction_id`),
KEY `FK7C97089541F0A56` (`createdby_id`),
KEY `FK7C970897179A0CB` (`client_id`),
KEY `FK7C970898F889C3F` (`lastmodifiedby_id`),
KEY `FK7C9708940BE0710` (`loan_id`),
CONSTRAINT `FK7C9708924D26803` FOREIGN KEY (`loan_transaction_id`) REFERENCES `portfolio_loan_transaction` (`id`),
CONSTRAINT `FK7C9708940BE0710` FOREIGN KEY (`loan_id`) REFERENCES `portfolio_loan` (`id`),
CONSTRAINT `FK7C97089541F0A56` FOREIGN KEY (`createdby_id`) REFERENCES `admin_appuser` (`id`),
CONSTRAINT `FK7C970897179A0CB` FOREIGN KEY (`client_id`) REFERENCES `portfolio_client` (`id`),
CONSTRAINT `FK7C970898F889C3F` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `admin_appuser` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
-- DDL for additional data (aka stretchy data) tables
CREATE TABLE `rpt_sequence` (
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `stretchydata_datasettype` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `stretchy_parameter` (
`parameter_id` int(11) NOT NULL AUTO_INCREMENT,
`parameter_name` varchar(45) NOT NULL,
`parameter_variable` varchar(45) DEFAULT NULL,
`parameter_label` varchar(45) NOT NULL,
`parameter_displayType` varchar(45) NOT NULL,
`parameter_FormatType` varchar(10) NOT NULL,
`parameter_default` varchar(45) NOT NULL,
`special` varchar(1) DEFAULT NULL,
`selectOne` varchar(1) DEFAULT NULL,
`selectAll` varchar(1) DEFAULT NULL,
`parameter_sql` text,
PRIMARY KEY (`parameter_id`),
UNIQUE KEY `name_UNIQUE` (`parameter_name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `stretchydata_allowed_list` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `stretchydata_allowed_value` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
`allowed_list_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `stretchydata_allowed_value_fk1` (`allowed_list_id`,`name`),
CONSTRAINT `stretchydata_allowed_value_fk1` FOREIGN KEY (`allowed_list_id`) REFERENCES `stretchydata_allowed_list` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `stretchydata_dataset` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
`datasettype_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `stretchydata_dataset_fk1` (`datasettype_id`,`name`),
CONSTRAINT `stretchydata_dataset` FOREIGN KEY (`datasettype_id`) REFERENCES `stretchydata_datasettype` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `stretchydata_dataset_fields` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
`data_type` varchar(15) NOT NULL,
`data_length` int(11) DEFAULT NULL,
`display_type` varchar(45) DEFAULT NULL,
`dataset_id` int(11) NOT NULL,
`allowed_list_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `stretchydata_dataset_fields_fk1` (`dataset_id`,`name`),
KEY `stretchydata_dataset_fields_fk2` (`allowed_list_id`),
CONSTRAINT `stretchydata_dataset_fields_fk1` FOREIGN KEY (`dataset_id`) REFERENCES `stretchydata_dataset` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `stretchydata_dataset_fields_fk2` FOREIGN KEY (`allowed_list_id`) REFERENCES `stretchydata_allowed_list` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `stretchy_report` (
`report_id` int(11) NOT NULL AUTO_INCREMENT,
`report_name` varchar(100) NOT NULL,
`report_type` varchar(20) NOT NULL,
`report_subtype` varchar(20) DEFAULT NULL,
`report_category` varchar(45) DEFAULT NULL,
`report_sql` text,
`description` text,
`core_report` tinyint(1) DEFAULT '0',
`use_report` tinyint(1) DEFAULT '0',
PRIMARY KEY (`report_id`),
UNIQUE KEY `report_name_UNIQUE` (`report_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `stretchy_report_parameter` (
`report_id` int(11) NOT NULL,
`parameter_id` int(11) NOT NULL,
`report_parameter_name` varchar(45) DEFAULT NULL,
PRIMARY KEY (`report_id`,`parameter_id`),
UNIQUE KEY `report_id_name_UNIQUE` (`report_id`,`report_parameter_name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
@@ -0,0 +1,978 @@
-- drop tables in base-schema
SET foreign_key_checks = 0;
-- drop accounting subsystem
DROP TABLE IF EXISTS `acc_gl_account`;
DROP TABLE IF EXISTS `acc_gl_closure`;
DROP TABLE IF EXISTS `acc_gl_journal_entry`;
-- drop portfolio subsystem
DROP TABLE IF EXISTS `m_appuser`;
DROP TABLE IF EXISTS `m_appuser_role`;
DROP TABLE IF EXISTS `m_charge`;
DROP TABLE IF EXISTS `m_client`;
DROP TABLE IF EXISTS `m_client_identifier`;
DROP TABLE IF EXISTS `m_code`;
DROP TABLE IF EXISTS `m_code_value`;
DROP TABLE IF EXISTS `m_currency`;
DROP TABLE IF EXISTS `m_deposit_account`;
DROP TABLE IF EXISTS `m_deposit_account_transaction`;
DROP TABLE IF EXISTS `m_document`;
DROP TABLE IF EXISTS `m_fund`;
DROP TABLE IF EXISTS `m_group`;
DROP TABLE IF EXISTS `m_group_client`;
DROP TABLE IF EXISTS `m_loan`;
DROP TABLE IF EXISTS `m_loan_charge`;
DROP TABLE IF EXISTS `m_loan_officer_assignment_history`;
DROP TABLE IF EXISTS `m_loan_repayment_schedule`;
DROP TABLE IF EXISTS `m_loan_transaction`;
DROP TABLE IF EXISTS `m_note`;
DROP TABLE IF EXISTS `m_office`;
DROP TABLE IF EXISTS `m_office_transaction`;
DROP TABLE IF EXISTS `m_organisation_currency`;
DROP TABLE IF EXISTS `m_permission`;
DROP TABLE IF EXISTS `m_portfolio_command_source`;
DROP TABLE IF EXISTS `m_product_deposit`;
DROP TABLE IF EXISTS `m_product_loan`;
DROP TABLE IF EXISTS `m_product_loan_charge`;
DROP TABLE IF EXISTS `m_product_savings`;
DROP TABLE IF EXISTS `m_role`;
DROP TABLE IF EXISTS `m_role_permission`;
DROP TABLE IF EXISTS `m_saving_account`;
DROP TABLE IF EXISTS `m_saving_schedule`;
DROP TABLE IF EXISTS `m_staff`;
DROP TABLE IF EXISTS `ref_loan_transaction_processing_strategy`;
DROP TABLE IF EXISTS `x_registered_table`;
-- drop reporting related tables
DROP TABLE IF EXISTS `r_enum_value`;
DROP TABLE IF EXISTS `rpt_sequence`;
DROP TABLE IF EXISTS `stretchy_parameter`;
DROP TABLE IF EXISTS `stretchy_report`;
DROP TABLE IF EXISTS `stretchy_report_parameter`;
-- drop deprecated 'stretchydata tables' which were used previously for 'additional data'
DROP TABLE IF EXISTS `stretchydata_dataset`;
DROP TABLE IF EXISTS `stretchydata_dataset_fields`;
DROP TABLE IF EXISTS `stretchydata_datasettype`;
-- drop deprecated a 'additional data' tables
drop table IF EXISTS `m_client_xadditional information`;
drop table IF EXISTS `m_client_xhighly improbable info`;
drop table IF EXISTS `m_loan_xadditional information`;
-- drop deprecated a 'accounting' tables
DROP TABLE IF EXISTS `m_acc_coa`;
SET foreign_key_checks = 1;
-- DDL for reference/lookup tables
CREATE TABLE `m_currency` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`code` varchar(3) NOT NULL,
`decimal_places` smallint(5) NOT NULL,
`display_symbol` varchar(10) DEFAULT NULL,
`name` varchar(50) NOT NULL,
`internationalized_name_code` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_organisation_currency` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`code` varchar(3) NOT NULL,
`decimal_places` smallint(5) NOT NULL,
`name` varchar(50) NOT NULL,
`display_symbol` varchar(10) DEFAULT NULL,
`internationalized_name_code` varchar(50) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `ref_loan_transaction_processing_strategy` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`code` varchar(100) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ltp_strategy_code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_code` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code_name` varchar(100) DEFAULT NULL,
`is_system_defined` TINYINT(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `code_name` (`code_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_code_value` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code_id` int(11) NOT NULL,
`code_value` varchar(100) DEFAULT NULL,
`order_position` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `code_value` (`code_id`,`code_value`),
KEY `FKCFCEA42640BE071Z` (`code_id`),
CONSTRAINT `FKCFCEA42640BE071Z` FOREIGN KEY (`code_id`) REFERENCES `m_code` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_document` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`parent_entity_type` varchar(50) NOT NULL,
`parent_entity_id` int(20) NOT NULL DEFAULT '0',
`name` varchar(250) NOT NULL,
`file_name` varchar(250) NOT NULL,
`size` int(20) DEFAULT '0',
`type` varchar(50) DEFAULT NULL,
`description` varchar(1000) DEFAULT NULL,
`location` varchar(500) NOT NULL DEFAULT '0',
`createdby_id` int(20) NOT NULL,
`lastmodifiedby_id` int(20) NOT NULL,
`created_date` datetime NOT NULL,
`lastmodified_date` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*not a major table - just intended for database reporting use for enums and values that would be hidden in java*/
CREATE TABLE `r_enum_value` (
`enum_name` varchar(100) NOT NULL,
`enum_id` int(11) NOT NULL,
`enum_message_property` varchar(100) NOT NULL,
`enum_value` varchar(100) NOT NULL,
PRIMARY KEY (`enum_name`,`enum_id`),
UNIQUE KEY `enum_message_property` (`enum_name`,`enum_message_property`),
UNIQUE KEY `enum_value` (`enum_name`,`enum_value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/* used to link MySql tables to Mifos X application tables for additional data needs */
CREATE TABLE `x_registered_table` (
`registered_table_name` varchar(50) NOT NULL,
`application_table_name` varchar(50) NOT NULL,
PRIMARY KEY (`registered_table_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ================= end of reference/lookup tables =============
-- DDL for office related tables
CREATE TABLE `m_office` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`parent_id` bigint(20) DEFAULT NULL,
`hierarchy` varchar(100) DEFAULT NULL,
`external_id` varchar(100) DEFAULT NULL,
`name` varchar(50) NOT NULL,
`opening_date` date NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_org` (`name`),
UNIQUE KEY `externalid_org` (`external_id`),
KEY `FK2291C477E2551DCC` (`parent_id`),
CONSTRAINT `FK2291C477E2551DCC` FOREIGN KEY (`parent_id`) REFERENCES `m_office` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_office_transaction` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`from_office_id` bigint(20) DEFAULT NULL,
`to_office_id` bigint(20) DEFAULT NULL,
`currency_code` varchar(3) NOT NULL,
`currency_digits` int(11) NOT NULL,
`transaction_amount` decimal(19,6) NOT NULL,
`transaction_date` date NOT NULL,
`description` varchar(100) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK1E37728B93C6C1B6` (`to_office_id`),
KEY `FK1E37728B783C5C25` (`from_office_id`),
CONSTRAINT `FK1E37728B783C5C25` FOREIGN KEY (`from_office_id`) REFERENCES `m_office` (`id`),
CONSTRAINT `FK1E37728B93C6C1B6` FOREIGN KEY (`to_office_id`) REFERENCES `m_office` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ============ end of office related tables ==========
-- DDL for admin tables
CREATE TABLE `m_permission` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`grouping` varchar(45) DEFAULT NULL,
`code` varchar(100) NOT NULL,
`entity_name` varchar(100) DEFAULT NULL,
`action_name` varchar(100) DEFAULT NULL,
`can_maker_checker` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
UNIQUE KEY `code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_role` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`description` varchar(500) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_role_permission` (
`role_id` bigint(20) NOT NULL,
`permission_id` bigint(20) NOT NULL,
PRIMARY KEY (`role_id`,`permission_id`),
KEY `FK8DEDB04815CEC7AB` (`role_id`),
KEY `FK8DEDB048103B544B` (`permission_id`),
CONSTRAINT `FK8DEDB048103B544B` FOREIGN KEY (`permission_id`) REFERENCES `m_permission` (`id`),
CONSTRAINT `FK8DEDB04815CEC7AB` FOREIGN KEY (`role_id`) REFERENCES `m_role` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_appuser` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`office_id` bigint(20) DEFAULT NULL,
`username` varchar(100) NOT NULL,
`firstname` varchar(100) NOT NULL,
`lastname` varchar(100) NOT NULL,
`password` varchar(255) NOT NULL,
`email` varchar(100) NOT NULL,
`firsttime_login_remaining` bit(1) NOT NULL,
`nonexpired` bit(1) NOT NULL,
`nonlocked` bit(1) NOT NULL,
`nonexpired_credentials` bit(1) NOT NULL,
`enabled` bit(1) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username_org` (`username`),
KEY `FKB3D587CE0DD567A` (`office_id`),
CONSTRAINT `FKB3D587CE0DD567A` FOREIGN KEY (`office_id`) REFERENCES `m_office` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_appuser_role` (
`appuser_id` bigint(20) NOT NULL,
`role_id` bigint(20) NOT NULL,
PRIMARY KEY (`appuser_id`,`role_id`),
KEY `FK7662CE59B4100309` (`appuser_id`),
KEY `FK7662CE5915CEC7AB` (`role_id`),
CONSTRAINT `FK7662CE5915CEC7AB` FOREIGN KEY (`role_id`) REFERENCES `m_role` (`id`),
CONSTRAINT `FK7662CE59B4100309` FOREIGN KEY (`appuser_id`) REFERENCES `m_appuser` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ================ end of user admin tables ===============
-- DDL for organisation wide related concepts
CREATE TABLE `m_portfolio_command_source` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`action_name` varchar(50) NOT NULL,
`entity_name` varchar(50) NOT NULL,
`api_operation` varchar(30) NOT NULL,
`api_resource` varchar(100) NOT NULL,
`resource_id` bigint(20) DEFAULT NULL,
`api_subresource` varchar(100) DEFAULT NULL,
`subresource_id` bigint(20) DEFAULT NULL,
`command_as_json` text NOT NULL,
`maker_id` bigint(20) NOT NULL,
`made_on_date` datetime NOT NULL,
`checker_id` bigint(20) DEFAULT NULL,
`checked_on_date` datetime DEFAULT NULL,
`processing_result_enum` smallint(5) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_m_maker_m_appuser` (`maker_id`),
KEY `FK_m_checker_m_appuser` (`checker_id`),
CONSTRAINT `FK_m_checker_m_appuser` FOREIGN KEY (`checker_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_m_maker_m_appuser` FOREIGN KEY (`maker_id`) REFERENCES `m_appuser` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_charge` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(100) DEFAULT NULL,
`currency_code` varchar(3) NOT NULL,
`charge_applies_to_enum` smallint(5) NOT NULL,
`charge_time_enum` smallint(5) NOT NULL,
`charge_calculation_enum` smallint(5) NOT NULL,
`amount` decimal(19,6) NOT NULL,
`is_penalty` tinyint(1) NOT NULL DEFAULT '0',
`is_active` tinyint(1) NOT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_fund` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`external_id` varchar(100) DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `fund_name_org` (`name`),
UNIQUE KEY `fund_externalid_org` (`external_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_staff` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`is_loan_officer` tinyint(1) NOT NULL DEFAULT '0',
`office_id` bigint(20) DEFAULT NULL,
`firstname` varchar(50) DEFAULT NULL,
`lastname` varchar(50) DEFAULT NULL,
`display_name` varchar(100) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `display_name` (`display_name`),
KEY `FK_m_staff_m_office` (`office_id`),
CONSTRAINT `FK_m_staff_m_office` FOREIGN KEY (`office_id`) REFERENCES `m_office` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ============ end of organisation wide related tables ===========
-- DDL client/group related tables
CREATE TABLE `m_group` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`office_id` bigint(20) NOT NULL,
`name` varchar(100) DEFAULT NULL,
`external_id` varchar(100) DEFAULT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
UNIQUE KEY `external_id` (`external_id`),
KEY `FKJPWG000000000003` (`createdby_id`),
KEY `FKJPWG000000000004` (`lastmodifiedby_id`),
KEY `office_id` (`office_id`),
CONSTRAINT `FKJPWG000000000003` FOREIGN KEY (`createdby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FKJPWG000000000004` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `m_group_ibfk_1` FOREIGN KEY (`office_id`) REFERENCES `m_office` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_client` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`office_id` bigint(20) NOT NULL,
`external_id` varchar(100) DEFAULT NULL,
`firstname` varchar(50) DEFAULT NULL,
`lastname` varchar(50) DEFAULT NULL,
`display_name` varchar(100) NOT NULL,
`image_key` varchar(500) DEFAULT NULL,
`joined_date` date DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `external_id` (`external_id`),
KEY `FKCE00CAB3E0DD567A` (`office_id`),
KEY `FKAUD0000000000001` (`createdby_id`),
KEY `FKAUD0000000000002` (`lastmodifiedby_id`),
CONSTRAINT `FKAUD0000000000001` FOREIGN KEY (`createdby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FKAUD0000000000002` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FKCE00CAB3E0DD567A` FOREIGN KEY (`office_id`) REFERENCES `m_office` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_client_identifier` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`client_id` bigint(20) NOT NULL,
`document_type_id` int(11) NOT NULL,
`document_key` varchar(50) NOT NULL,
`description` varchar(500) DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `unique_identifier_key` (`document_type_id`,`document_key`),
UNIQUE KEY `unique_client_identifier` (`client_id`,`document_type_id`),
KEY `FK_m_client_document_m_client` (`client_id`),
KEY `FK_m_client_document_m_code_value` (`document_type_id`),
CONSTRAINT `FK_m_client_document_m_client` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`),
CONSTRAINT `FK_m_client_document_m_code_value` FOREIGN KEY (`document_type_id`) REFERENCES `m_code_value` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_group_client` (
`group_id` bigint(20) NOT NULL,
`client_id` bigint(20) NOT NULL,
PRIMARY KEY (`group_id`,`client_id`),
KEY `client_id` (`client_id`),
CONSTRAINT `m_group_client_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `m_group` (`id`),
CONSTRAINT `m_group_client_ibfk_2` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ==== end of client/group related tables ==========
-- DDL for financial products and related tables
CREATE TABLE `m_product_deposit` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`external_id` varchar(100) DEFAULT NULL,
`description` varchar(500) DEFAULT NULL,
`currency_code` varchar(3) NOT NULL,
`currency_digits` smallint(5) NOT NULL,
`minimum_balance` decimal(19,6) DEFAULT NULL,
`maximum_balance` decimal(19,6) DEFAULT NULL,
`tenure_months` int(11) NOT NULL,
`interest_compounded_every` smallint(5) NOT NULL DEFAULT '1',
`interest_compounded_every_period_enum` smallint(5) NOT NULL DEFAULT '2',
`maturity_default_interest_rate` decimal(19,6) NOT NULL,
`maturity_min_interest_rate` decimal(19,6) NOT NULL,
`maturity_max_interest_rate` decimal(19,6) NOT NULL,
`is_compounding_interest_allowed` tinyint(1) NOT NULL DEFAULT '0',
`is_renewal_allowed` tinyint(1) NOT NULL DEFAULT '0',
`is_preclosure_allowed` tinyint(1) NOT NULL DEFAULT '0',
`pre_closure_interest_rate` decimal(19,6) NOT NULL,
`is_lock_in_period_allowed` tinyint(1) NOT NULL DEFAULT '0',
`lock_in_period` bigint(20) DEFAULT NULL,
`lock_in_period_type` smallint(5) NOT NULL DEFAULT '2',
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_deposit_product` (`name`),
UNIQUE KEY `externalid_deposit_product` (`external_id`),
KEY `FKJPW0000000000003` (`createdby_id`),
KEY `FKJPW0000000000004` (`lastmodifiedby_id`),
CONSTRAINT `FKJPX0000000000003` FOREIGN KEY (`createdby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FKJPX0000000000004` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `m_appuser` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_product_savings` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`description` varchar(500) DEFAULT NULL,
`currency_code` varchar(3) DEFAULT NULL,
`currency_digits` smallint(5) DEFAULT NULL,
`interest_rate` decimal(19,6) DEFAULT NULL,
`min_interest_rate` decimal(19,6) DEFAULT NULL,
`max_interest_rate` decimal(19,6) DEFAULT NULL,
`savings_deposit_amount` decimal(19,6) NOT NULL,
`savings_product_type` smallint(5) DEFAULT NULL,
`tenure_type` smallint(5) DEFAULT NULL,
`deposit_every` bigint(20) DEFAULT NULL,
`tenure` int(11) DEFAULT NULL,
`frequency` int(11) DEFAULT NULL,
`interest_type` smallint(5) DEFAULT NULL,
`interest_calculation_method` smallint(5) DEFAULT NULL,
`min_bal_for_withdrawal` decimal(19,6) NOT NULL,
`is_partial_deposit_allowed` tinyint(1) NOT NULL DEFAULT '0',
`is_lock_in_period_allowed` tinyint(1) NOT NULL DEFAULT '0',
`lock_in_period` bigint(20) DEFAULT NULL,
`lock_in_period_type` smallint(5) NOT NULL DEFAULT '1',
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKJPW0000000000003` (`createdby_id`),
KEY `FKJPW0000000000004` (`lastmodifiedby_id`),
CONSTRAINT `FKJPW0000000000003` FOREIGN KEY (`createdby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FKJPW0000000000004` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `m_appuser` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_product_loan` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`currency_code` varchar(3) NOT NULL,
`currency_digits` smallint(5) NOT NULL,
`principal_amount` decimal(19,6) NOT NULL,
`arrearstolerance_amount` decimal(19,6) DEFAULT NULL,
`name` varchar(100) NOT NULL,
`description` varchar(500) DEFAULT NULL,
`fund_id` bigint(20) DEFAULT NULL,
`nominal_interest_rate_per_period` decimal(19,6) NOT NULL,
`interest_period_frequency_enum` smallint(5) NOT NULL,
`annual_nominal_interest_rate` decimal(19,6) NOT NULL,
`interest_method_enum` smallint(5) NOT NULL,
`interest_calculated_in_period_enum` smallint(5) NOT NULL DEFAULT '1',
`repay_every` smallint(5) NOT NULL,
`repayment_period_frequency_enum` smallint(5) NOT NULL,
`number_of_repayments` smallint(5) NOT NULL,
`amortization_method_enum` smallint(5) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
`loan_transaction_strategy_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKAUD0000000000003` (`createdby_id`),
KEY `FKAUD0000000000004` (`lastmodifiedby_id`),
KEY `FKA6A8A7D77240145` (`fund_id`),
KEY `FK_ltp_strategy` (`loan_transaction_strategy_id`),
CONSTRAINT `FKA6A8A7D77240145` FOREIGN KEY (`fund_id`) REFERENCES `m_fund` (`id`),
CONSTRAINT `FKAUD0000000000003` FOREIGN KEY (`createdby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FKAUD0000000000004` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_ltp_strategy` FOREIGN KEY (`loan_transaction_strategy_id`) REFERENCES `ref_loan_transaction_processing_strategy` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_product_loan_charge` (
`product_loan_id` bigint(20) NOT NULL,
`charge_id` bigint(20) NOT NULL,
PRIMARY KEY (`product_loan_id`,`charge_id`),
KEY `charge_id` (`charge_id`),
CONSTRAINT `m_product_loan_charge_ibfk_1` FOREIGN KEY (`charge_id`) REFERENCES `m_charge` (`id`),
CONSTRAINT `m_product_loan_charge_ibfk_2` FOREIGN KEY (`product_loan_id`) REFERENCES `m_product_loan` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ============ end of financial product related tables ===========
-- DDL for loan and loan related tables
CREATE TABLE `m_loan` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`external_id` varchar(100) DEFAULT NULL,
`client_id` bigint(20) DEFAULT NULL,
`group_id` bigint(20) DEFAULT NULL,
`product_id` bigint(20) DEFAULT NULL,
`fund_id` bigint(20) DEFAULT NULL,
`loan_officer_id` bigint(20) DEFAULT NULL,
`guarantor_id` bigint(20) DEFAULT NULL,
`loan_status_id` smallint(5) NOT NULL,
`currency_code` varchar(3) NOT NULL,
`currency_digits` smallint(5) NOT NULL,
`principal_amount` decimal(19,6) NOT NULL,
`arrearstolerance_amount` decimal(19,6) DEFAULT NULL,
`nominal_interest_rate_per_period` decimal(19,6) NOT NULL,
`interest_period_frequency_enum` smallint(5) NOT NULL,
`annual_nominal_interest_rate` decimal(19,6) NOT NULL,
`interest_method_enum` smallint(5) NOT NULL,
`interest_calculated_in_period_enum` smallint(5) NOT NULL DEFAULT '1',
`term_frequency` smallint(5) NOT NULL DEFAULT '0',
`term_period_frequency_enum` smallint(5) NOT NULL DEFAULT '2',
`repay_every` smallint(5) NOT NULL,
`repayment_period_frequency_enum` smallint(5) NOT NULL,
`number_of_repayments` smallint(5) NOT NULL,
`amortization_method_enum` smallint(5) NOT NULL,
`total_charges_due_at_disbursement_derived` decimal(19,6) DEFAULT NULL,
`submittedon_date` datetime DEFAULT NULL,
`approvedon_date` datetime DEFAULT NULL,
`expected_disbursedon_date` date DEFAULT NULL,
`expected_firstrepaymenton_date` date DEFAULT NULL,
`interest_calculated_from_date` date DEFAULT NULL,
`disbursedon_date` date DEFAULT NULL,
`expected_maturedon_date` date DEFAULT NULL,
`maturedon_date` date DEFAULT NULL,
`closedon_date` datetime DEFAULT NULL,
`rejectedon_date` datetime DEFAULT NULL,
`rescheduledon_date` datetime DEFAULT NULL,
`withdrawnon_date` datetime DEFAULT NULL,
`writtenoffon_date` datetime DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
`loan_transaction_strategy_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `org_id` (`external_id`),
KEY `FKB6F935D87179A0CB` (`client_id`),
KEY `FKB6F935D8C8D4B434` (`product_id`),
KEY `FK7C885877240145` (`fund_id`),
KEY `FK_loan_ltp_strategy` (`loan_transaction_strategy_id`),
KEY `FK_m_loan_m_staff` (`loan_officer_id`),
KEY `group_id` (`group_id`),
KEY `FK_m_loan_guarantor` (`guarantor_id`),
CONSTRAINT `FK7C885877240145` FOREIGN KEY (`fund_id`) REFERENCES `m_fund` (`id`),
CONSTRAINT `FKB6F935D87179A0CB` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`),
CONSTRAINT `FKB6F935D8C8D4B434` FOREIGN KEY (`product_id`) REFERENCES `m_product_loan` (`id`),
CONSTRAINT `FK_loan_ltp_strategy` FOREIGN KEY (`loan_transaction_strategy_id`) REFERENCES `ref_loan_transaction_processing_strategy` (`id`),
CONSTRAINT `FK_m_loan_guarantor` FOREIGN KEY (`guarantor_id`) REFERENCES `m_client` (`id`),
CONSTRAINT `FK_m_loan_m_staff` FOREIGN KEY (`loan_officer_id`) REFERENCES `m_staff` (`id`),
CONSTRAINT `m_loan_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `m_group` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_loan_charge` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`loan_id` bigint(20) NOT NULL,
`charge_id` bigint(20) NOT NULL,
`is_penalty` tinyint(1) NOT NULL DEFAULT '0',
`charge_time_enum` smallint(5) NOT NULL,
`due_for_collection_as_of_date` date DEFAULT NULL,
`charge_calculation_enum` smallint(5) NOT NULL,
`calculation_percentage` decimal(19,6) DEFAULT NULL,
`calculation_on_amount` decimal(19,6) DEFAULT NULL,
`amount` decimal(19,6) NOT NULL,
`amount_paid_derived` decimal(19,6) DEFAULT NULL,
`amount_waived_derived` decimal(19,6) DEFAULT NULL,
`amount_writtenoff_derived` decimal(19,6) DEFAULT NULL,
`amount_outstanding_derived` decimal(19,6) NOT NULL DEFAULT '0.000000',
`is_paid_derived` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `charge_id` (`charge_id`),
KEY `m_loan_charge_ibfk_2` (`loan_id`),
CONSTRAINT `m_loan_charge_ibfk_1` FOREIGN KEY (`charge_id`) REFERENCES `m_charge` (`id`),
CONSTRAINT `m_loan_charge_ibfk_2` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_loan_officer_assignment_history` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`loan_id` bigint(20) NOT NULL,
`loan_officer_id` bigint(20) DEFAULT NULL,
`start_date` date NOT NULL,
`end_date` date DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_m_loan_officer_assignment_history_0001` (`loan_id`),
KEY `fk_m_loan_officer_assignment_history_0002` (`loan_officer_id`),
CONSTRAINT `fk_m_loan_officer_assignment_history_0001` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`),
CONSTRAINT `fk_m_loan_officer_assignment_history_0002` FOREIGN KEY (`loan_officer_id`) REFERENCES `m_staff` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_loan_repayment_schedule` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`loan_id` bigint(20) NOT NULL,
`fromdate` date DEFAULT NULL,
`duedate` date NOT NULL,
`installment` smallint(5) NOT NULL,
`principal_amount` decimal(19,6) DEFAULT NULL,
`principal_completed_derived` decimal(19,6) DEFAULT NULL,
`principal_writtenoff_derived` decimal(19,6) DEFAULT NULL,
`interest_amount` decimal(19,6) DEFAULT NULL,
`interest_completed_derived` decimal(19,6) DEFAULT NULL,
`interest_writtenoff_derived` decimal(19,6) DEFAULT NULL,
`fee_charges_amount` decimal(19,6) DEFAULT NULL,
`fee_charges_completed_derived` decimal(19,6) DEFAULT NULL,
`fee_charges_writtenoff_derived` decimal(19,6) DEFAULT NULL,
`fee_charges_waived_derived` decimal(19,6) DEFAULT NULL,
`penalty_charges_amount` decimal(19,6) DEFAULT NULL,
`penalty_charges_completed_derived` decimal(19,6) DEFAULT NULL,
`penalty_charges_writtenoff_derived` decimal(19,6) DEFAULT NULL,
`penalty_charges_waived_derived` decimal(19,6) DEFAULT NULL,
`completed_derived` bit(1) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
`interest_waived_derived` decimal(19,6) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK488B92AA40BE0710` (`loan_id`),
CONSTRAINT `FK488B92AA40BE0710` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_loan_transaction` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`loan_id` bigint(20) NOT NULL,
`transaction_type_enum` smallint(5) NOT NULL,
`contra_id` bigint(20) DEFAULT NULL,
`transaction_date` date NOT NULL,
`amount` decimal(19,6) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
`principal_portion_derived` decimal(19,6) DEFAULT NULL,
`interest_portion_derived` decimal(19,6) DEFAULT NULL,
`fee_charges_portion_derived` decimal(19,6) DEFAULT NULL,
`penalty_charges_portion_derived` decimal(19,6) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKCFCEA42640BE0710` (`loan_id`),
KEY `FKCFCEA426FC69F3F1` (`contra_id`),
CONSTRAINT `FKCFCEA42640BE0710` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`),
CONSTRAINT `FKCFCEA426FC69F3F1` FOREIGN KEY (`contra_id`) REFERENCES `m_loan_transaction` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ======== end of loan related tables ==========
-- DDL for deposit account related tables
CREATE TABLE `m_deposit_account` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`status_enum` smallint(5) NOT NULL DEFAULT '0',
`external_id` varchar(100) DEFAULT NULL,
`client_id` bigint(20) NOT NULL,
`product_id` bigint(20) NOT NULL,
`currency_code` varchar(3) NOT NULL,
`currency_digits` smallint(5) NOT NULL,
`deposit_amount` decimal(19,6) DEFAULT NULL,
`maturity_nominal_interest_rate` decimal(19,6) NOT NULL,
`tenure_months` int(11) NOT NULL,
`interest_compounded_every` smallint(5) NOT NULL DEFAULT '1',
`interest_compounded_every_period_enum` smallint(5) NOT NULL DEFAULT '2',
`projected_commencement_date` date NOT NULL,
`actual_commencement_date` date DEFAULT NULL,
`matures_on_date` datetime DEFAULT NULL,
`projected_interest_accrued_on_maturity` decimal(19,6) NOT NULL,
`actual_interest_accrued` decimal(19,6) DEFAULT NULL,
`projected_total_maturity_amount` decimal(19,6) NOT NULL,
`actual_total_amount` decimal(19,6) DEFAULT NULL,
`is_compounding_interest_allowed` tinyint(1) NOT NULL DEFAULT '0',
`interest_paid` decimal(19,6) NOT NULL DEFAULT '0.000000',
`is_interest_withdrawable` tinyint(1) NOT NULL DEFAULT '0',
`available_interest` decimal(19,6) DEFAULT '0.000000',
`interest_posted_amount` decimal(19,6) DEFAULT '0.000000',
`last_interest_posted_date` date DEFAULT NULL,
`next_interest_posting_date` date DEFAULT NULL,
`is_renewal_allowed` tinyint(1) NOT NULL DEFAULT '0',
`renewed_account_id` bigint(20) DEFAULT NULL,
`is_preclosure_allowed` tinyint(1) NOT NULL DEFAULT '0',
`pre_closure_interest_rate` decimal(19,6) NOT NULL,
`is_lock_in_period_allowed` tinyint(1) NOT NULL DEFAULT '0',
`lock_in_period` bigint(20) DEFAULT NULL,
`lock_in_period_type` smallint(5) NOT NULL DEFAULT '2',
`withdrawnon_date` datetime DEFAULT NULL,
`rejectedon_date` datetime DEFAULT NULL,
`closedon_date` datetime DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `deposit_acc_external_id` (`external_id`),
KEY `FKKW0000000000001` (`client_id`),
KEY `FKKW0000000000002` (`product_id`),
KEY `FKKW0000000000003` (`renewed_account_id`),
CONSTRAINT `FKKW0000000000001` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`),
CONSTRAINT `FKKW0000000000002` FOREIGN KEY (`product_id`) REFERENCES `m_product_deposit` (`id`),
CONSTRAINT `FKKW0000000000003` FOREIGN KEY (`renewed_account_id`) REFERENCES `m_deposit_account` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_deposit_account_transaction` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`deposit_account_id` bigint(20) NOT NULL,
`transaction_type_enum` smallint(5) NOT NULL,
`contra_id` bigint(20) DEFAULT NULL,
`transaction_date` date NOT NULL,
`amount` decimal(19,6) NOT NULL,
`interest` decimal(19,6) NOT NULL,
`total` decimal(19,6) NOT NULL,
PRIMARY KEY (`id`),
KEY `FKKW00000000000005` (`deposit_account_id`),
KEY `FKKW00000000000006` (`contra_id`),
CONSTRAINT `FKKW00000000000005` FOREIGN KEY (`deposit_account_id`) REFERENCES `m_deposit_account` (`id`),
CONSTRAINT `FKKW00000000000006` FOREIGN KEY (`contra_id`) REFERENCES `m_deposit_account_transaction` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ======= end of deposit account related tables
-- DDL for savings account related tables
CREATE TABLE `m_saving_account` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`status_enum` smallint(5) NOT NULL DEFAULT '0',
`external_id` varchar(100) DEFAULT NULL,
`client_id` bigint(20) NOT NULL,
`product_id` bigint(20) NOT NULL,
`deposit_amount_per_period` decimal(19,6) NOT NULL,
`savings_product_type` smallint(5) DEFAULT NULL,
`currency_code` varchar(3) NOT NULL,
`currency_digits` smallint(5) NOT NULL,
`total_deposit_amount` decimal(19,6) NOT NULL,
`reccuring_nominal_interest_rate` decimal(19,6) NOT NULL,
`regular_saving_nominal_interest_rate` decimal(19,6) NOT NULL,
`tenure` int(11) NOT NULL,
`tenure_type` smallint(5) DEFAULT NULL,
`deposit_every` bigint(20) DEFAULT NULL,
`frequency` int(11) DEFAULT NULL,
`interest_type` smallint(5) DEFAULT NULL,
`interest_calculation_method` smallint(5) DEFAULT NULL,
`projected_commencement_date` date NOT NULL,
`actual_commencement_date` date DEFAULT NULL,
`matures_on_date` datetime DEFAULT NULL,
`projected_interest_accrued_on_maturity` decimal(19,6) NOT NULL,
`actual_interest_accrued` decimal(19,6) DEFAULT NULL,
`projected_total_maturity_amount` decimal(19,6) NOT NULL,
`actual_total_amount` decimal(19,6) DEFAULT NULL,
`is_preclosure_allowed` tinyint(1) NOT NULL DEFAULT '0',
`pre_closure_interest_rate` decimal(19,6) NOT NULL,
`is_lock_in_period_allowed` tinyint(1) NOT NULL DEFAULT '0',
`lock_in_period` bigint(20) DEFAULT NULL,
`lock_in_period_type` smallint(5) NOT NULL DEFAULT '1',
`withdrawnon_date` datetime DEFAULT NULL,
`rejectedon_date` datetime DEFAULT NULL,
`closedon_date` datetime DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `deposit_acc_external_id` (`external_id`),
KEY `FKSA0000000000001` (`client_id`),
KEY `FKSA0000000000002` (`product_id`),
CONSTRAINT `FKSA0000000000001` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`),
CONSTRAINT `FKSA0000000000002` FOREIGN KEY (`product_id`) REFERENCES `m_product_savings` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_saving_schedule` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`saving_account_id` bigint(20) NOT NULL,
`duedate` date NOT NULL,
`installment` smallint(5) NOT NULL,
`deposit` decimal(21,4) NOT NULL,
`payment_date` date DEFAULT NULL,
`deposit_paid` decimal(21,4) DEFAULT NULL,
`completed_derived` bit(1) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKSS00000000001` (`saving_account_id`),
CONSTRAINT `FKSS00000000001` FOREIGN KEY (`saving_account_id`) REFERENCES `m_saving_account` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- end of savings account related tables
-- DDL for notes associated with all client/group and financial accounts
CREATE TABLE `m_note` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`client_id` bigint(20) NOT NULL,
`loan_id` bigint(20) DEFAULT NULL,
`loan_transaction_id` bigint(20) DEFAULT NULL,
`deposit_account_id` bigint(20) DEFAULT NULL,
`note_type_enum` smallint(5) NOT NULL,
`note` varchar(1000) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK7C9708924D26803` (`loan_transaction_id`),
KEY `FK7C97089541F0A56` (`createdby_id`),
KEY `FK7C970897179A0CB` (`client_id`),
KEY `FK7C970898F889C3F` (`lastmodifiedby_id`),
KEY `FK7C9708940BE0710` (`loan_id`),
KEY `FK_m_note_m_deposit_account` (`deposit_account_id`),
CONSTRAINT `FK7C9708924D26803` FOREIGN KEY (`loan_transaction_id`) REFERENCES `m_loan_transaction` (`id`),
CONSTRAINT `FK7C9708940BE0710` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`),
CONSTRAINT `FK7C97089541F0A56` FOREIGN KEY (`createdby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK7C970897179A0CB` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`),
CONSTRAINT `FK7C970898F889C3F` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_m_note_m_deposit_account` FOREIGN KEY (`deposit_account_id`) REFERENCES `m_deposit_account` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- DDL for accounting sub system related tables
CREATE TABLE `acc_gl_account` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
`parent_id` bigint(20) DEFAULT NULL,
`gl_code` varchar(45) NOT NULL,
`disabled` tinyint(1) NOT NULL DEFAULT '0',
`manual_journal_entries_allowed` tinyint(1) NOT NULL DEFAULT '1',
`header_account` tinyint(1) NOT NULL DEFAULT '0',
`classification` varchar(45) NOT NULL,
`description` varchar(500) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `acc_gl_code` (`gl_code`),
KEY `FK_ACC_0000000001` (`parent_id`),
CONSTRAINT `FK_ACC_0000000001` FOREIGN KEY (`parent_id`) REFERENCES `acc_gl_account` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `acc_gl_closure` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`office_id` bigint(20) NOT NULL,
`closing_date` date NOT NULL,
`is_deleted` int(20) NOT NULL DEFAULT '0',
`createdby_id` bigint(20) DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`comments` varchar(500) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `office_id_closing_date` (`office_id`,`closing_date`),
KEY `FK_acc_gl_closure_m_office` (`office_id`),
KEY `FK_acc_gl_closure_m_appuser` (`createdby_id`),
KEY `FK_acc_gl_closure_m_appuser_2` (`lastmodifiedby_id`),
CONSTRAINT `FK_acc_gl_closure_m_appuser` FOREIGN KEY (`createdby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_acc_gl_closure_m_appuser_2` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_acc_gl_closure_m_office` FOREIGN KEY (`office_id`) REFERENCES `m_office` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `acc_gl_journal_entry` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`account_id` bigint(20) NOT NULL,
`office_id` bigint(20) NOT NULL,
`reversal_id` bigint(20) DEFAULT NULL,
`transaction_id` varchar(50) NOT NULL,
`reversed` tinyint(1) NOT NULL DEFAULT '0',
`portfolio_generated` tinyint(1) NOT NULL DEFAULT '0',
`entry_date` date NOT NULL,
`type` varchar(50) NOT NULL,
`amount` decimal(19,6) NOT NULL,
`description` varchar(500) DEFAULT NULL,
`entity_type` varchar(50) DEFAULT NULL,
`entity_id` bigint(20) DEFAULT NULL,
`createdby_id` bigint(20) NOT NULL,
`lastmodifiedby_id` bigint(20) NOT NULL,
`created_date` datetime NOT NULL,
`lastmodified_date` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_acc_gl_journal_entry_m_office` (`office_id`),
KEY `FK_acc_gl_journal_entry_m_appuser` (`createdby_id`),
KEY `FK_acc_gl_journal_entry_m_appuser_2` (`lastmodifiedby_id`),
KEY `FK_acc_gl_journal_entry_acc_gl_journal_entry` (`reversal_id`),
KEY `FK_acc_gl_journal_entry_acc_gl_account` (`account_id`),
CONSTRAINT `FK_acc_gl_journal_entry_acc_gl_account` FOREIGN KEY (`account_id`) REFERENCES `acc_gl_account` (`id`),
CONSTRAINT `FK_acc_gl_journal_entry_acc_gl_journal_entry` FOREIGN KEY (`reversal_id`) REFERENCES `acc_gl_journal_entry` (`id`),
CONSTRAINT `FK_acc_gl_journal_entry_m_appuser` FOREIGN KEY (`createdby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_acc_gl_journal_entry_m_appuser_2` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_acc_gl_journal_entry_m_office` FOREIGN KEY (`office_id`) REFERENCES `m_office` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- =========== end of accounting related tables ==========
-- DDL for reporting related tables
CREATE TABLE `rpt_sequence` (
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `stretchy_parameter` (
`parameter_id` int(11) NOT NULL AUTO_INCREMENT,
`parameter_name` varchar(45) NOT NULL,
`parameter_variable` varchar(45) DEFAULT NULL,
`parameter_label` varchar(45) NOT NULL,
`parameter_displayType` varchar(45) NOT NULL,
`parameter_FormatType` varchar(10) NOT NULL,
`parameter_default` varchar(45) NOT NULL,
`special` varchar(1) DEFAULT NULL,
`selectOne` varchar(1) DEFAULT NULL,
`selectAll` varchar(1) DEFAULT NULL,
`parameter_sql` text,
PRIMARY KEY (`parameter_id`),
UNIQUE KEY `name_UNIQUE` (`parameter_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `stretchy_report` (
`report_id` int(11) NOT NULL AUTO_INCREMENT,
`report_name` varchar(100) NOT NULL,
`report_type` varchar(20) NOT NULL,
`report_subtype` varchar(20) DEFAULT NULL,
`report_category` varchar(45) DEFAULT NULL,
`report_sql` text,
`description` text,
`core_report` tinyint(1) DEFAULT '0',
`use_report` tinyint(1) DEFAULT '0',
PRIMARY KEY (`report_id`),
UNIQUE KEY `report_name_UNIQUE` (`report_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `stretchy_report_parameter` (
`report_id` int(11) NOT NULL,
`parameter_id` int(11) NOT NULL,
`report_parameter_name` varchar(45) DEFAULT NULL,
PRIMARY KEY (`report_id`,`parameter_id`),
UNIQUE KEY `report_id_name_UNIQUE` (`report_id`,`report_parameter_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- =========== end of reporting related tables ============
@@ -1,47 +1,42 @@
-- example of a DDL script to support customised 'additional data' for clients and loans.
DROP TABLE IF EXISTS `additional client fields data`;
DROP TABLE IF EXISTS `extra family details data`;
DROP TABLE IF EXISTS `additional loan fields data`;
DROP TABLE IF EXISTS `portfolio_client_extra_additional information`;
DROP TABLE IF EXISTS `portfolio_client_extra_highly improbable info`;
DROP TABLE IF EXISTS `portfolio_loan_extra_additional information`;
CREATE TABLE `additional client fields data` (
`client_id` bigint(20) NOT NULL,
`Business Description` varchar(100) DEFAULT NULL,
`Years in Business` int(11) DEFAULT NULL,
`Gender_cd` int(11) DEFAULT NULL,
`Education_cv` varchar(60) DEFAULT NULL,
`Next Visit` date DEFAULT NULL,
`Highest Rate Paid` decimal(19,6) DEFAULT NULL,
`Comment` text,
PRIMARY KEY (`client_id`),
CONSTRAINT `FK_Additional Client Fields Data_1` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `portfolio_client_extra_Additional Information` (
CREATE TABLE `extra family details data` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`Ethnic Group` varchar(50) DEFAULT NULL,
`Ethnic Group Other` varchar(50) DEFAULT NULL,
`Household Location` varchar(50) DEFAULT NULL,
`Household Location Other` varchar(50) DEFAULT NULL,
`Religion` varchar(50) DEFAULT NULL,
`Religion Other` varchar(50) DEFAULT NULL,
`Knowledge of Person` varchar(50) DEFAULT NULL,
`Gender` varchar(10) DEFAULT NULL,
`Whois` mediumtext,
`client_id` bigint(20) NOT NULL,
`Name` varchar(40) DEFAULT NULL,
`Date of Birth` date DEFAULT NULL,
`Points Score` int(11) DEFAULT NULL,
`Education_cdHighest` int(11) DEFAULT NULL,
`Other Notes` text,
PRIMARY KEY (`id`),
CONSTRAINT `portfolio_client_extra_Additional Information_fk1` FOREIGN KEY (`id`) REFERENCES `portfolio_client` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
KEY `FK_Extra Family Details Data_1` (`client_id`),
CONSTRAINT `FK_Extra Family Details Data_1` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
CREATE TABLE `portfolio_client_extra_Highly Improbable Info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`Fathers Favourite Team` varchar(50) DEFAULT NULL,
`Mothers Favourite Team` varchar(50) DEFAULT NULL,
`Fathers DOB` date DEFAULT NULL,
`Mothers DOB` date DEFAULT NULL,
`Fathers Education` varchar(50) DEFAULT NULL,
`Mothers Education` varchar(50) DEFAULT NULL,
`Number of Children` int(11) DEFAULT NULL,
`Favourite Town` varchar(30) DEFAULT NULL,
`Closing Comments` mediumtext,
`Annual Family Income` decimal(19,6) DEFAULT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `portfolio_client_extra_Highly Improbable Info_fk1` FOREIGN KEY (`id`) REFERENCES `portfolio_client` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `portfolio_loan_extra_Additional Information` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`Business Location` varchar(50) DEFAULT NULL,
`Business Location Other` varchar(50) DEFAULT NULL,
`Business` varchar(10) DEFAULT NULL,
`Business Description` mediumtext,
`Business Title` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `portfolio_loan_extra_Additional Information_fk1` FOREIGN KEY (`id`) REFERENCES `portfolio_loan` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `additional loan fields data` (
`loan_id` bigint(20) NOT NULL,
`Business Description` varchar(100) DEFAULT NULL,
`Years in Business` int(11) DEFAULT NULL,
`Gender_cd` int(11) DEFAULT NULL,
`Education_cv` varchar(60) DEFAULT NULL,
`Next Visit` date DEFAULT NULL,
`Highest Rate Paid` decimal(19,6) DEFAULT NULL,
`Comment` text,
PRIMARY KEY (`loan_id`),
CONSTRAINT `FK_Additional Loan Fields Data_1` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+39
View File
@@ -0,0 +1,39 @@
DROP TABLE IF EXISTS `risk_analysis`;
CREATE TABLE `risk_analysis` (
`client_id` bigint(20) NOT NULL,
`proposed_loan_amount` decimal(19,6) DEFAULT NULL,
`assets_cash` decimal(19,6) DEFAULT NULL,
`assets_bank_accounts` decimal(19,6) DEFAULT NULL,
`assets_accounts_receivable` decimal(19,6) DEFAULT NULL,
`assets_inventory` decimal(19,6) DEFAULT NULL,
`assets_total_fixed_business` decimal(19,6) DEFAULT NULL,
`assets_total_business` decimal(19,6) DEFAULT NULL,
`assets_total_household` decimal(19,6) DEFAULT NULL,
`liabilities_accounts_payable` decimal(19,6) DEFAULT NULL,
`liabilities_business_debts` decimal(19,6) DEFAULT NULL,
`liabilities_total_business` decimal(19,6) DEFAULT NULL,
`liabilities_equity_working_capital` decimal(19,6) DEFAULT NULL,
`liabilities_total_household` decimal(19,6) DEFAULT NULL,
`liabilities_household_equity` decimal(19,6) DEFAULT NULL,
`cashflow_cash_sales` decimal(19,6) DEFAULT NULL,
`cashflow_cash_sales2` decimal(19,6) DEFAULT NULL,
`cashflow_cost_goods_sold` decimal(19,6) DEFAULT NULL,
`cashflow_cost_goods_sold2` decimal(19,6) DEFAULT NULL,
`cashflow_gross_profit` decimal(19,6) DEFAULT NULL,
`cashflow_other_income1` decimal(19,6) DEFAULT NULL,
`cashflow_total_income2` decimal(19,6) DEFAULT NULL,
`cashflow_household_expense` decimal(19,6) DEFAULT NULL,
`cashflow_payments_to_savings` decimal(19,6) DEFAULT NULL,
`cashflow_operational_expenses` decimal(19,6) DEFAULT NULL,
`cashflow_disposable_income` decimal(19,6) DEFAULT NULL,
`cashflow_amount_loan_installment` decimal(19,6) DEFAULT NULL,
`cashflow_available_surplus` decimal(19,6) DEFAULT NULL,
`fi_inventory_turnover` decimal(19,6) DEFAULT NULL,
`fi_gross_margin` decimal(19,6) DEFAULT NULL,
`fi_indebtedness` decimal(19,6) DEFAULT NULL,
`fi_loan_recommendation` decimal(19,6) DEFAULT NULL,
`fi_roe` decimal(19,6) DEFAULT NULL,
`fi_repayment_capacity` decimal(19,6) DEFAULT NULL,
PRIMARY KEY (`client_id`),
CONSTRAINT `FK_risk_analysis_1` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+58
View File
@@ -0,0 +1,58 @@
drop table if exists `Loan Additional Data`;
CREATE TABLE `Loan Additional Data` (
`loan_id` bigint(20) NOT NULL,
`PurposeOfLoan_cd` int(11) NOT NULL,
`CollateralType_cd` int(11) NOT NULL,
`Collateral notes` text NOT NULL,
`YesNo_cd_Guarantor` int(11) NOT NULL,
`Guarantor name` varchar(100) DEFAULT NULL,
`Guarantor relation` varchar(100) DEFAULT NULL,
`Guarantor address` varchar(100) DEFAULT NULL,
`Guarantor telepone number` varchar(20) DEFAULT NULL,
PRIMARY KEY (`loan_id`),
CONSTRAINT `FK_loan_additional_data` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
drop table if exists `Client Additional Data`;
CREATE TABLE `Client Additional Data` (
`client_id` bigint(20) NOT NULL,
`Gender_cd` int(11) NOT NULL,
`Date of Birth` date NOT NULL,
`Home address` text NOT NULL,
`Telepone number` varchar(20) NOT NULL,
`Telepone number (2nd)` varchar(20) NOT NULL,
`Email address` varchar(50) NOT NULL,
`EducationLevel_cd` int(11) NOT NULL,
`MaritalStatus_cd` int(11) NOT NULL,
`Number of children` int(11) NOT NULL,
`Citizenship` varchar(50) NOT NULL,
`PovertyStatus_cd` int(11) NOT NULL,
`YesNo_cd_Employed` int(11) NOT NULL,
`FieldOfEmployment_cd_Field of employment` int(11) DEFAULT NULL,
`Employer name` varchar(50) DEFAULT NULL,
`Number of years` int(11) DEFAULT NULL,
`Monthly salary` decimal(19,6) DEFAULT NULL,
`YesNo_cd_Self employed` int(11) NOT NULL,
`FieldOfEmployment_cd_Field of self-employment` int(11) DEFAULT NULL,
`Business address` text DEFAULT NULL,
`Number of employees` int(11) DEFAULT NULL,
`Monthly salaries paid` decimal(19,6) DEFAULT NULL,
`Monthly net income (of business activity)` decimal(19,6) DEFAULT NULL,
`Monthly rent` decimal(19,6) DEFAULT NULL,
`Other income generating activities` varchar(100) DEFAULT NULL,
`YesNo_cd_Bookeeping` int(11) NOT NULL,
`YesNo_cd_Loans with other institutions` int(11) NOT NULL,
`From whom` varchar(100) DEFAULT NULL,
`Amount` decimal(19,6) DEFAULT NULL,
`Interest rate p.a` decimal(19,6) DEFAULT NULL,
`Number of people depending on overal income` int(11) NOT NULL,
`YesNo_cd_Bank account` int(11) NOT NULL,
`YesNo_cd_Business plan provided` int(11) NOT NULL,
`YesNo_cd_Access to internet` int(11) DEFAULT NULL,
`Introduced by` varchar(100) DEFAULT NULL,
`Known to introducer since` date NOT NULL,
`Last visited by` varchar(100) DEFAULT NULL,
`Last visited on` date NOT NULL,
PRIMARY KEY (`client_id`),
CONSTRAINT `FK_client_additional_data` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
File diff suppressed because one or more lines are too long
-53
View File
@@ -1,53 +0,0 @@
-- create roles and associate with permissions
INSERT INTO `admin_role` (`id`, `name`, `description`, `createdby_id`, `created_date`, `lastmodified_date`, `lastmodifiedby_id`)
VALUES
(2,'Field officer','A field officer role allows the user to add client and loans and view reports but nothing else.',1,'2012-04-12 15:59:48','2012-04-12 15:59:48',1),
(3,'Data Entry (Portfolio only)','This role allows a user full permissions around client and loan functionality but nothing else.',1,'2012-04-12 16:01:25','2012-04-12 16:01:25',1),
(4,'Credit Committe Member','This role allows a user to approve reject or withdraw loans (with reporting).',1,'2012-04-12 16:11:25','2012-04-12 16:11:25',1),
(5,'Manager','This role allows a manager to do anything related to portfolio management and also view all reports.',1,'2012-04-12 17:02:11','2012-04-12 17:02:11',1);
INSERT INTO `admin_role_permission` (`role_id`, `permission_id`)
VALUES
(2,4),(2,5),(2,6),(2,13),(2,20),(3,3),(4,4),(4,7),(4,8),(4,9),(4,10),(4,11),(4,12),(5,3),(5,4);
-- insert office data required by appuser table/data
INSERT INTO `org_office` (`id`, `parent_id`, `hierarchy`, `external_id`, `name`, `opening_date`, `createdby_id`, `created_date`, `lastmodified_date`, `lastmodifiedby_id`)
VALUES
(2,1,'.2.','2','sub branch 1','2012-01-02',1,'2012-04-14 05:42:40','2012-04-16 11:47:05',1),
(3,1,'.3.','3','sub branch 2','2012-03-01',1,'2012-04-16 04:12:02','2012-04-16 11:47:14',1),
(4,1,'.4.',NULL,'sub branch 3','2012-04-17',1,'2012-04-17 06:01:10','2012-04-17 06:01:10',1);
-- insert remaining fund/currencies/product data
INSERT INTO `org_organisation_currency` (`id`, `code`, `decimal_places`, `name`, `display_symbol`, `internationalized_name_code`, `createdby_id`, `created_date`, `lastmodified_date`, `lastmodifiedby_id`)
VALUES
(17,'KES',2,'Kenyan Shilling','KSh','currency.KES',1,'2012-05-01 22:43:02','2012-05-01 22:43:02',1),
(18,'BND',2,'Brunei Dollar','BND','currency.BND',1,'2012-05-01 22:43:02','2012-05-01 22:43:02',1),
(19,'LBP',2,'Lebanese Pound','L','currency.LBP',1,'2012-05-01 22:43:02','2012-05-01 22:43:02',1),
(20,'GHC',2,'Ghana Cedi','GHC','currency.GHC',1,'2012-05-01 22:43:02','2012-05-01 22:43:02',1),
(22,'XOF',0,'CFA Franc BCEAO','CFA','currency.XOF',1,'2012-05-01 22:43:02','2012-05-01 22:43:02',1);
INSERT INTO `portfolio_product_loan` (`id`, `currency_code`, `currency_digits`, `principal_amount`, `arrearstolerance_amount`, `name`, `description`, `nominal_interest_rate_per_period`, `interest_period_frequency_enum`, `annual_nominal_interest_rate`, `interest_method_enum`, `repay_every`, `repayment_period_frequency_enum`, `number_of_repayments`, `amortization_method_enum`, `flexible_repayment_schedule`, `interest_rebate`, `createdby_id`, `created_date`, `lastmodified_date`, `lastmodifiedby_id`, `interest_calculated_in_period_enum`, `fund_id`)
VALUES
(1,'XOF',0,'100000.000000','1000.000000','Agricultural Loan','An agricultural loan given to farmers to help buy crop, stock and machinery. With an arrears tolerance setting of 1,000 CFA, loans are not marked as \'in arrears\' or \'in bad standing\' if the amount outstanding is less than this. Interest rate is described using monthly percentage rate (MPR) even though the loan typically lasts a year and requires one repayment (typically at time when farmer sells crop)','1.750000',2,'21.000000',0,12,2,1,1,'\0','\0',1,'2012-04-12 22:14:34','2012-04-12 22:14:34',1,1,NULL);
-- inserting client
INSERT INTO `portfolio_client` (`id`, `office_id`, `external_id`, `firstname`, `lastname`, `joining_date`, `createdby_id`, `created_date`, `lastmodified_date`, `lastmodifiedby_id`)
VALUES
(1,1,NULL,'Willie','O\'Meara','2009-01-04',1,'2012-04-12 22:07:44','2012-04-12 22:07:44',1),
(2,1,NULL,'Declan','Browne','2009-01-04',1,'2012-04-12 22:15:39','2012-04-12 22:15:39',1),
(3,1,NULL,'Ja','Fallon','2009-01-11',1,'2012-04-12 22:16:30','2012-04-12 22:16:30',1),
(4,1,NULL,'Peter','Lambert','2009-01-11',1,'2012-04-12 22:17:01','2012-04-12 22:17:01',1),
(5,1,NULL,NULL,'Sunnyville vegetable growers Ltd','2009-01-24',1,'2012-04-12 22:19:18','2012-04-12 22:19:18',1),
(6,2,NULL,'Jacques','Lee','2012-04-03',1,'2012-04-14 06:09:22','2012-04-14 06:09:22',1),
(7,1,NULL,'Kalilou','Traor','2009-02-04',1,'2012-04-14 09:38:11','2012-04-14 09:38:11',1),
(8,1,NULL,'Sidi','Kon','2009-02-11',1,'2012-04-14 09:45:43','2012-04-14 09:45:43',1),
(9,1,NULL,'Moustapha','Yattabar','2009-02-18',1,'2012-04-14 10:24:20','2012-04-14 10:24:20',1),
(10,1,NULL,NULL,'Mali fruit sales ltd.','2009-02-18',1,'2012-04-14 10:25:37','2012-04-14 10:25:37',1),
(11,1,NULL,NULL,'Djenne co-op group','2009-02-25',1,'2012-04-14 10:31:03','2012-04-14 10:31:03',1);
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,8 +0,0 @@
CREATE TABLE `portfolio_group_client` (
`group_id` bigint(20) NOT NULL,
`client_id` bigint(20) NOT NULL,
PRIMARY KEY (`group_id`,`client_id`),
FOREIGN KEY (`group_id`) REFERENCES `portfolio_group` (`id`),
FOREIGN KEY (`client_id`) REFERENCES `portfolio_client` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -1 +0,0 @@
ALTER TABLE portfolio_group ADD UNIQUE (name);
@@ -1,2 +0,0 @@
DROP INDEX external_id ON portfolio_group;
ALTER TABLE portfolio_group ADD UNIQUE (external_id);
@@ -1,37 +0,0 @@
ALTER TABLE `portfolio_product_savings`
DROP COLUMN `ft_pre_closure_interest_rate` ,
DROP COLUMN `ft_can_pre_close` ,
DROP COLUMN `ft_can_renew` ,
DROP COLUMN `ft_maturity_max_interest_rate` ,
DROP COLUMN `ft_maturity_min_interest_rate` ,
DROP COLUMN `ft_maturity_default_interest_rate` ,
DROP COLUMN `ft_tenure_months` ,
DROP COLUMN `savings_type_enum` ;
CREATE TABLE `portfolio_product_deposit` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`description` varchar(500) DEFAULT NULL,
`currency_code` varchar(3) NOT NULL,
`currency_digits` smallint(5) NOT NULL,
`minimum_balance` decimal(19,6) DEFAULT NULL,
`maximum_balance` decimal(19,6) DEFAULT NULL,
`tenure_months` int(11) NOT NULL,
`maturity_default_interest_rate` decimal(19,6) NOT NULL,
`maturity_min_interest_rate` decimal(19,6) NOT NULL,
`maturity_max_interest_rate` decimal(19,6) NOT NULL,
`can_renew` tinyint(1) NOT NULL DEFAULT '0',
`can_pre_close` tinyint(1) NOT NULL DEFAULT '0',
`pre_closure_interest_rate` decimal(19,6) NOT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKJPW0000000000003` (`createdby_id`),
KEY `FKJPW0000000000004` (`lastmodifiedby_id`),
CONSTRAINT `FKJPX0000000000003` FOREIGN KEY (`createdby_id`) REFERENCES `admin_appuser` (`id`),
CONSTRAINT `FKJPX0000000000004` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `admin_appuser` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -1,27 +0,0 @@
DROP TABLE if exists `portfolio_deposit_account`;
CREATE TABLE `portfolio_deposit_account` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`external_id` varchar(100) DEFAULT NULL,
`client_id` bigint(20) NOT NULL,
`product_id` bigint(20) NOT NULL,
`currency_code` varchar(3) NOT NULL,
`currency_digits` smallint(5) NOT NULL,
`deposit_amount` decimal(19,6) DEFAULT NULL,
`maturity_interest_rate` decimal(19,6) NOT NULL,
`tenure_months` int(11) NOT NULL,
`can_renew` tinyint(1) NOT NULL DEFAULT '0',
`can_pre_close` tinyint(1) NOT NULL DEFAULT '0',
`pre_closure_interest_rate` decimal(19,6) NOT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `deposit_acc_external_id` (`external_id`),
KEY `FKKW0000000000001` (`client_id`),
KEY `FKKW0000000000002` (`product_id`),
CONSTRAINT `FKKW0000000000001` FOREIGN KEY (`client_id`) REFERENCES `portfolio_client` (`id`),
CONSTRAINT `FKKW0000000000002` FOREIGN KEY (`product_id`) REFERENCES `portfolio_product_deposit` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -1,4 +0,0 @@
ALTER TABLE `stretchy_report`
ADD COLUMN `description` TEXT NULL DEFAULT NULL AFTER `report_sql` ,
ADD COLUMN `core_report` TINYINT(1) NULL DEFAULT '0' AFTER `description` ,
ADD COLUMN `use_report` TINYINT(1) NULL DEFAULT '0' AFTER `core_report` ;
@@ -0,0 +1,3 @@
alter table m_loan add column group_id bigint(20) after client_id;
alter table m_loan modify client_id bigint(20);
alter table m_loan add constraint foreign key (`group_id`) references `m_group` (`id`);
@@ -0,0 +1,24 @@
CREATE TABLE `m_client_identifier` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`client_id` BIGINT(20) NOT NULL,
`document_type_id` INT(11) NOT NULL,
`document_key` VARCHAR(500) NOT NULL,
`description` VARCHAR(1000) NULL DEFAULT NULL,
`createdby_id` BIGINT(20) NULL DEFAULT NULL,
`lastmodifiedby_id` BIGINT(20) NULL DEFAULT NULL,
`created_date` DATETIME NULL DEFAULT NULL,
`lastmodified_date` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`id`),
INDEX `FK_m_client_document_m_client` (`client_id`),
INDEX `FK_m_client_document_m_code_value` (`document_type_id`),
CONSTRAINT `FK_m_client_document_m_client` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`),
CONSTRAINT `FK_m_client_document_m_code_value` FOREIGN KEY (`document_type_id`) REFERENCES `m_code_value` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into m_code values(9,'Customer Identifier');
insert into m_code_value values (null,'9','Driving Licence','1');
insert into m_code_value values (null,'9','Passport','2');
insert into m_code_value values (null,'9','PAN Card','3');
insert into m_code_value values (null,'9','Ration Card','4');
insert into m_code_value values (null,'9','Other','5');
@@ -0,0 +1,3 @@
alter table m_loan_repayment_schedule add column principal_writtenoff_derived decimal(19,6) DEFAULT NULL after principal_completed_derived;
alter table m_loan_repayment_schedule add column interest_writtenoff_derived decimal(19,6) DEFAULT NULL after interest_completed_derived;
@@ -0,0 +1,9 @@
ALTER TABLE `m_product_deposit`
ADD COLUMN `is_lock_in_period_allowed` tinyint(1) NOT NULL DEFAULT '0' AFTER `pre_closure_interest_rate`,
ADD COLUMN `lock_in_period` bigint(20) DEFAULT NULL AFTER `is_lock_in_period_allowed`,
ADD COLUMN `lock_in_period_type` smallint(5) NOT NULL DEFAULT '2' AFTER `lock_in_period`;
ALTER TABLE `m_deposit_account`
ADD COLUMN `is_lock_in_period_allowed` tinyint(1) NOT NULL DEFAULT '0' AFTER `pre_closure_interest_rate`,
ADD COLUMN `lock_in_period` bigint(20) DEFAULT NULL AFTER `is_lock_in_period_allowed`,
ADD COLUMN `lock_in_period_type` smallint(5) NOT NULL DEFAULT '2' AFTER `lock_in_period`;
@@ -0,0 +1,17 @@
CREATE TABLE `m_document` (
`id` INT(20) NOT NULL AUTO_INCREMENT,
`parent_entity_type` VARCHAR(50) NOT NULL,
`parent_entity_id` INT(20) NOT NULL DEFAULT '0',
`name` VARCHAR(250) NOT NULL,
`file_name` VARCHAR(250) NOT NULL,
`size` INT(20) NULL DEFAULT '0',
`type` VARCHAR(50) NULL DEFAULT NULL,
`description` VARCHAR(1000) NULL DEFAULT NULL,
`location` VARCHAR(500) NOT NULL DEFAULT '0',
`createdby_id` INT(20) NOT NULL,
`lastmodifiedby_id` INT(20) NOT NULL,
`created_date` DATETIME NOT NULL,
`lastmodified_date` DATETIME NOT NULL,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB;
@@ -0,0 +1 @@
alter table m_loan_transaction drop column interest_waived_derived;
@@ -0,0 +1,6 @@
alter table m_product_loan drop column flexible_repayment_schedule;
alter table m_product_loan drop column interest_rebate;
alter table m_loan drop column flexible_repayment_schedule;
alter table m_loan drop column interest_rebate;
alter table m_loan drop column interest_rebate_amount;
@@ -0,0 +1,8 @@
alter table m_loan_transaction modify column principal_portion_derived decimal(19,6);
alter table m_loan_transaction modify column interest_portion_derived decimal(19,6);
alter table m_loan_transaction modify column charges_portion_derived decimal(19,6);
alter table m_product_loan modify column arrearstolerance_amount decimal(19,6);
@@ -0,0 +1,20 @@
drop table `m_client_identifier`;
CREATE TABLE `m_client_identifier` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`client_id` bigint(20) NOT NULL,
`document_type_id` int(11) NOT NULL,
`document_key` varchar(50) NOT NULL,
`description` varchar(500) DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `unique_identifier_key` (`document_type_id`, `document_key`),
UNIQUE KEY `unique_client_identifier` (`client_id`,`document_type_id`),
KEY `FK_m_client_document_m_client` (`client_id`),
KEY `FK_m_client_document_m_code_value` (`document_type_id`),
CONSTRAINT `FK_m_client_document_m_client` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`),
CONSTRAINT `FK_m_client_document_m_code_value` FOREIGN KEY (`document_type_id`) REFERENCES `m_code_value` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
@@ -0,0 +1,49 @@
/* table used as an additional table for GK risk analysis
Also putting in default database as well for demos but not used for other tenants*/
DROP TABLE IF EXISTS `risk_analysis`;
CREATE TABLE `risk_analysis` (
`client_id` bigint(20) NOT NULL,
`proposed_loan_amount` decimal(19,6) DEFAULT NULL,
`assets_cash` decimal(19,6) DEFAULT NULL,
`assets_bank_accounts` decimal(19,6) DEFAULT NULL,
`assets_accounts_receivable` decimal(19,6) DEFAULT NULL,
`assets_inventory` decimal(19,6) DEFAULT NULL,
`assets_total_fixed_business` decimal(19,6) DEFAULT NULL,
`assets_total_business` decimal(19,6) DEFAULT NULL,
`assets_total_household` decimal(19,6) DEFAULT NULL,
`liabilities_accounts_payable` decimal(19,6) DEFAULT NULL,
`liabilities_business_debts` decimal(19,6) DEFAULT NULL,
`liabilities_total_business` decimal(19,6) DEFAULT NULL,
`liabilities_equity_working_capital` decimal(19,6) DEFAULT NULL,
`liabilities_total_household` decimal(19,6) DEFAULT NULL,
`liabilities_household_equity` decimal(19,6) DEFAULT NULL,
`cashflow_cash_sales` decimal(19,6) DEFAULT NULL,
`cashflow_cash_sales2` decimal(19,6) DEFAULT NULL,
`cashflow_cost_goods_sold` decimal(19,6) DEFAULT NULL,
`cashflow_cost_goods_sold2` decimal(19,6) DEFAULT NULL,
`cashflow_gross_profit` decimal(19,6) DEFAULT NULL,
`cashflow_other_income1` decimal(19,6) DEFAULT NULL,
`cashflow_total_income2` decimal(19,6) DEFAULT NULL,
`cashflow_household_expense` decimal(19,6) DEFAULT NULL,
`cashflow_payments_to_savings` decimal(19,6) DEFAULT NULL,
`cashflow_operational_expenses` decimal(19,6) DEFAULT NULL,
`cashflow_disposable_income` decimal(19,6) DEFAULT NULL,
`cashflow_amount_loan_installment` decimal(19,6) DEFAULT NULL,
`cashflow_available_surplus` decimal(19,6) DEFAULT NULL,
`fi_inventory_turnover` decimal(19,6) DEFAULT NULL,
`fi_gross_margin` decimal(19,6) DEFAULT NULL,
`fi_indebtedness` decimal(19,6) DEFAULT NULL,
`fi_loan_recommendation` decimal(19,6) DEFAULT NULL,
`fi_roe` decimal(19,6) DEFAULT NULL,
`fi_repayment_capacity` decimal(19,6) DEFAULT NULL,
PRIMARY KEY (`client_id`),
CONSTRAINT `FK_risk_analysis_1` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -0,0 +1,2 @@
ALTER TABLE `m_client`
ADD COLUMN `image_key` VARCHAR(500) NULL DEFAULT NULL AFTER `display_name`;
@@ -0,0 +1,34 @@
alter table m_loan_charge
add column due_for_collection_as_of_date date DEFAULT NULL after charge_time_enum;
alter table m_loan_repayment_schedule
add column fee_charges_amount decimal(19,6) DEFAULT NULL after interest_writtenoff_derived;
alter table m_loan_repayment_schedule
add column fee_charges_completed_derived decimal(19,6) DEFAULT NULL after fee_charges_amount;
alter table m_loan_repayment_schedule
add column fee_charges_writtenoff_derived decimal(19,6) DEFAULT NULL after fee_charges_completed_derived;
alter table m_loan_repayment_schedule
add column fee_charges_waived_derived decimal(19,6) DEFAULT NULL after fee_charges_writtenoff_derived;
alter table m_loan_repayment_schedule
add column penalty_charges_amount decimal(19,6) DEFAULT NULL after fee_charges_waived_derived;
alter table m_loan_repayment_schedule
add column penalty_charges_completed_derived decimal(19,6) DEFAULT NULL after penalty_charges_amount;
alter table m_loan_repayment_schedule
add column penalty_charges_writtenoff_derived decimal(19,6) DEFAULT NULL after penalty_charges_completed_derived;
alter table m_loan_repayment_schedule
add column penalty_charges_waived_derived decimal(19,6) DEFAULT NULL after penalty_charges_writtenoff_derived;
/**
modify existing columns
*/
alter table `m_loan_repayment_schedule` MODIFY `duedate` date NOT NULL;
alter table `m_loan_repayment_schedule` MODIFY `installment` smallint(5) NOT NULL;
alter table `m_loan_repayment_schedule` MODIFY `interest_waived_derived` decimal(19,6) DEFAULT NULL;
@@ -0,0 +1,8 @@
alter table m_loan_repayment_schedule
add column `fromdate` date DEFAULT NULL after `loan_id`;
alter table m_charge
add column `is_penalty` tinyint(1) NOT NULL DEFAULT '0' after `amount`;
alter table m_loan_charge
add column `is_penalty` tinyint(1) NOT NULL DEFAULT '0' after `charge_id`;
@@ -0,0 +1,8 @@
alter table m_loan_transaction
drop column `charges_portion_derived`;
alter table m_loan_transaction
add column `fee_charges_portion_derived` decimal(19,6) DEFAULT NULL after `interest_portion_derived`;
alter table m_loan_transaction
add column `penalty_charges_portion_derived` decimal(19,6) DEFAULT NULL after `fee_charges_portion_derived`;
@@ -0,0 +1,33 @@
DROP TABLE IF EXISTS `m_product_savings`;
CREATE TABLE `m_product_savings` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`description` varchar(500) DEFAULT NULL,
`currency_code` varchar(3) DEFAULT NULL,
`currency_digits` smallint(5) DEFAULT NULL,
`interest_rate` decimal(19,6) DEFAULT NULL,
`min_interest_rate` decimal(19,6) DEFAULT NULL,
`max_interest_rate` decimal(19,6) DEFAULT NULL,
`savings_deposit_amount` decimal(19,6) NOT NULL,
`savings_product_type` smallint(5) DEFAULT NULL,
`tenure_type` smallint(5) DEFAULT NULL,
`tenure` int(11) DEFAULT NULL,
`frequency` int(11) DEFAULT NULL,
`interest_type` smallint(5) DEFAULT NULL,
`interest_calculation_method` smallint(5) DEFAULT NULL,
`min_bal_for_withdrawal` decimal(19,6) NOT NULL,
`is_partial_deposit_allowed` tinyint(1) NOT NULL DEFAULT '0',
`is_lock_in_period_allowed` tinyint(1) NOT NULL DEFAULT '0',
`lock_in_period` bigint(20) DEFAULT NULL,
`lock_in_period_type` smallint(5) NOT NULL DEFAULT '1',
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKJPW0000000000003` (`createdby_id`),
KEY `FKJPW0000000000004` (`lastmodifiedby_id`),
CONSTRAINT `FKJPW0000000000003` FOREIGN KEY (`createdby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FKJPW0000000000004` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `m_appuser` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
@@ -0,0 +1,47 @@
DROP TABLE if exists `m_saving_account`;
CREATE TABLE `m_saving_account` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`status_enum` smallint(5) NOT NULL DEFAULT '0',
`external_id` varchar(100) DEFAULT NULL,
`client_id` bigint(20) NOT NULL,
`product_id` bigint(20) NOT NULL,
`deposit_amount_per_period` decimal(19,6) NOT NULL,
`savings_product_type` smallint(5) DEFAULT NULL,
`currency_code` varchar(3) NOT NULL,
`currency_digits` smallint(5) NOT NULL,
`total_deposit_amount` decimal(19,6) NOT NULL,
`reccuring_nominal_interest_rate` decimal(19,6) NOT NULL,
`regular_saving_nominal_interest_rate` decimal(19,6) NOT NULL,
`tenure` int(11) NOT NULL,
`tenure_type` smallint(5) DEFAULT NULL,
`frequency` int(11) DEFAULT NULL,
`interest_type` smallint(5) DEFAULT NULL,
`interest_calculation_method` smallint(5) DEFAULT NULL,
`projected_commencement_date` date NOT NULL,
`actual_commencement_date` date DEFAULT NULL,
`matures_on_date` datetime DEFAULT NULL,
`projected_interest_accrued_on_maturity` decimal(19,6) NOT NULL,
`actual_interest_accrued` decimal(19,6) DEFAULT NULL,
`projected_total_maturity_amount` decimal(19,6) NOT NULL,
`actual_total_amount` decimal(19,6) DEFAULT NULL,
`is_preclosure_allowed` tinyint(1) NOT NULL DEFAULT '0',
`pre_closure_interest_rate` decimal(19,6) NOT NULL,
`is_lock_in_period_allowed` tinyint(1) NOT NULL DEFAULT '0',
`lock_in_period` bigint(20) DEFAULT NULL,
`lock_in_period_type` smallint(5) NOT NULL DEFAULT '1',
`withdrawnon_date` datetime DEFAULT NULL,
`rejectedon_date` datetime DEFAULT NULL,
`closedon_date` datetime DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `deposit_acc_external_id` (`external_id`),
KEY `FKSA0000000000001` (`client_id`),
KEY `FKSA0000000000002` (`product_id`),
CONSTRAINT `FKSA0000000000001` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`),
CONSTRAINT `FKSA0000000000002` FOREIGN KEY (`product_id`) REFERENCES `m_product_savings` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
@@ -0,0 +1,17 @@
DROP TABLE if exists `m_acc_coa`;
CREATE TABLE `m_acc_coa` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
`parent_id` bigint(20) DEFAULT NULL,
`gl_code` varchar(45) NOT NULL,
`is_disabled` tinyint(1) NOT NULL DEFAULT '0',
`manual_entries_allowed` tinyint(1) NOT NULL DEFAULT '0',
`category` varchar(45) NOT NULL,
`ledger_type` varchar(45) NOT NULL,
`description` varchar(500) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `acc_gl_code` (`gl_code`),
KEY `FK_ACC_0000000001` (`parent_id`),
CONSTRAINT `FK_ACC_0000000001` FOREIGN KEY (`parent_id`) REFERENCES `m_acc_coa` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
@@ -0,0 +1,6 @@
alter table m_loan_charge
add column `amount_waived_derived` decimal(19,6) DEFAULT NULL after `amount_paid_derived`;
alter table m_loan_charge
add column `amount_writtenoff_derived` decimal(19,6) DEFAULT NULL after `amount_waived_derived`;
@@ -0,0 +1,14 @@
CREATE TABLE `m_loan_officer_assignment_history` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`loan_id` bigint(20) NOT NULL ,
`loan_officer_id` bigint(20) DEFAULT NULL,
`start_date` date NOT NULL,
`end_date` date DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `fk_m_loan_officer_assignment_history_0001` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`),
CONSTRAINT `fk_m_loan_officer_assignment_history_0002` FOREIGN KEY (`loan_officer_id`) REFERENCES `m_staff` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -0,0 +1,25 @@
CREATE TABLE `m_guarantor_external` (
`loan_id` BIGINT(20) NOT NULL,
`firstname` VARCHAR(50) NOT NULL,
`lastname` VARCHAR(50) NOT NULL,
`dob` DATE NULL,
`address_line_1` VARCHAR(500) NULL,
`address_line_2` VARCHAR(500) NULL,
`city` VARCHAR(50) NULL,
`state` VARCHAR(50) NULL,
`country` VARCHAR(50) NULL,
`zip` VARCHAR(20) NULL,
`house_phone_number` VARCHAR(20) NULL,
`mobile_number` VARCHAR(20) NULL,
`comment` VARCHAR(20) NULL,
PRIMARY KEY (`loan_id`),
CONSTRAINT `FK_m_guarantor_m_loan` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `m_loan`
ADD COLUMN `guarantor_id` BIGINT(20) NULL DEFAULT NULL AFTER `loan_officer_id`,
ADD CONSTRAINT `FK_m_loan_guarantor` FOREIGN KEY (`guarantor_id`) REFERENCES `m_client` (`id`);
insert into x_registered_table values ('m_guarantor_external','m_loan');
@@ -0,0 +1,14 @@
CREATE TABLE `m_maker_checker` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`task_name` varchar(100) NOT NULL,
`task_json` varchar(1000) NOT NULL,
`maker_id` bigint(20) NOT NULL,
`made_on_date` date NOT NULL,
`checker_id` bigint(20) DEFAULT NULL,
`checked_on_date` date DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK_m_maker_m_appuser` (`maker_id`),
KEY `FK_m_checker_m_appuser` (`checker_id`),
CONSTRAINT `FK_m_maker_m_appuser` FOREIGN KEY (`maker_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_m_checker_m_appuser` FOREIGN KEY (`checker_id`) REFERENCES `m_appuser` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
@@ -0,0 +1,17 @@
drop table `m_maker_checker`;
CREATE TABLE `m_portfolio_command_source` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`api_operation` varchar(20) NOT NULL,
`api_resource` varchar(20) NOT NULL,
`resource_id` bigint(20) DEFAULT NULL,
`command_as_json` varchar(1000) NOT NULL,
`maker_id` bigint(20) NOT NULL,
`made_on_date` date NOT NULL,
`checker_id` bigint(20) DEFAULT NULL,
`checked_on_date` date DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK_m_maker_m_appuser` (`maker_id`),
KEY `FK_m_checker_m_appuser` (`checker_id`),
CONSTRAINT `FK_m_maker_m_appuser` FOREIGN KEY (`maker_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_m_checker_m_appuser` FOREIGN KEY (`checker_id`) REFERENCES `m_appuser` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
@@ -0,0 +1,31 @@
update m_permission p
join stretchy_report sr on p.code = concat('CAN_RUN_', sr.report_name)
set p.`code` = concat('READ_', sr.report_name),
p.default_description = concat('READ_', sr.report_name),
p.default_name = concat('READ_', sr.report_name);
update m_permission p
join x_registered_table r on p.code = concat('CAN_READ_', r.registered_table_name)
set p.`code` = concat('READ_', r.registered_table_name),
p.default_description = concat('READ_', r.registered_table_name),
p.default_name = concat('READ_', r.registered_table_name);
update m_permission p
join x_registered_table r on p.code = concat('CAN_UPDATE_', r.registered_table_name)
set p.`code` = concat('UPDATE_', r.registered_table_name),
p.default_description = concat('UPDATE_', r.registered_table_name),
p.default_name = concat('UPDATE_', r.registered_table_name);
update m_permission p
join x_registered_table r on p.code = concat('CAN_CREATE_', r.registered_table_name)
set p.`code` = concat('CREATE_', r.registered_table_name),
p.default_description = concat('CREATE_', r.registered_table_name),
p.default_name = concat('CREATE_', r.registered_table_name);
update m_permission p
join x_registered_table r on p.code = concat('CAN_DELETE_', r.registered_table_name)
set p.`code` = concat('DELETE_', r.registered_table_name),
p.default_description = concat('DELETE_', r.registered_table_name),
p.default_name = concat('DELETE_', r.registered_table_name);
@@ -0,0 +1,10 @@
UPDATE stretchy_parameter
SET `parameter_sql` = 'select r.report_id, r.report_name, r.report_type, r.report_subtype, r.report_category,\r rp.parameter_id, rp.report_parameter_name, p.parameter_name\r from stretchy_report r\r left join stretchy_report_parameter rp on rp.report_id = r.report_id\r left join stretchy_parameter p on p.parameter_id = rp.parameter_id\r where r.use_report is true\r and exists\r (\r select \'f\'\r from m_appuser_role ur \r join m_role r on r.id = ur.role_id\r join m_role_permission rp on rp.role_id = r.id\r join m_permission p on p.id = rp.permission_id\r where ur.appuser_id = ${currentUserId}\r and (p.code in (\'ALL_FUNCTIONS_READ\', \'ALL_FUNCTIONS\') or p.code = concat(\"READ_\", r.report_name))\r )\r order by r.report_name, rp.parameter_id'
WHERE parameter_name = 'FullReportList';
UPDATE stretchy_parameter
SET `parameter_sql` = 'select r.report_id, r.report_name, r.report_type, r.report_subtype, r.report_category,\r rp.parameter_id, rp.report_parameter_name, p.parameter_name\r from stretchy_report r\r left join stretchy_report_parameter rp on rp.report_id = r.report_id\r left join stretchy_parameter p on p.parameter_id = rp.parameter_id\r where r.report_category = \'${reportCategory}\'\r and r.use_report is true\r and exists\r (\r select \'f\'\r from m_appuser_role ur \r join m_role r on r.id = ur.role_id\r join m_role_permission rp on rp.role_id = r.id\r join m_permission p on p.id = rp.permission_id\r where ur.appuser_id = ${currentUserId}\r and (p.code in (\'ALL_FUNCTIONS_READ\', \'ALL_FUNCTIONS\') or p.code = concat(\"READ_\", r.report_name))\r )\r order by r.report_name, rp.parameter_id'
WHERE parameter_name = 'reportCategoryList';
@@ -0,0 +1,5 @@
ALTER TABLE m_permission
DROP COLUMN `group_enum` ,
ADD COLUMN `grouping` VARCHAR(45) NULL AFTER `id` ,
ADD COLUMN `order_in_grouping` INT NULL AFTER `grouping` ,
ADD UNIQUE INDEX `code` (`code` ASC) ;
@@ -0,0 +1,55 @@
ALTER TABLE m_permission
DROP COLUMN `order_in_grouping` ,
ADD COLUMN `entity_name` VARCHAR(100) NULL AFTER `default_name` ,
ADD COLUMN `action_name` VARCHAR(100) NULL AFTER `entity_name` ;
/*
this scripts removes all current m_role_permission and m_permission entries
and then inserts new m_permission entries and just one m_role_permission entry
which gives the role (id 1 - super user) an ALL_FUNCTIONS permission
If you had other roles set up with specific permissions you will have to set up their permissions again.
*/
delete from m_role_permission;
delete from m_permission;
/* System Supplied Permissons */
INSERT INTO `m_permission` VALUES (1,'special','USER_ADMINISTRATION_SUPER_USER','An application user will have permission to execute all tasks related to user administration.','User administration ALL',NULL,NULL),(2,'special','ORGANISATION_ADMINISTRATION_SUPER_USER','An application user will have permission to execute all tasks related to organisation administration.','Organisation adminsitration ALL',NULL,NULL),(3,'special','PORTFOLIO_MANAGEMENT_SUPER_USER','An application user will have permission to execute all tasks related to portfolio management.','Portfolio management ALL',NULL,NULL),(4,'special','REPORTING_SUPER_USER','An application user will have permission to execute and view all reports.','Reporting ALL',NULL,NULL),(5,'portfolio','CREATE_LOAN','Allows an application user to sumit new loan application.','Can submit new loan application','LOAN','CREATE'),(6,'portfolio','CREATEHISTORIC_LOAN','Allows an application user to sumit new loan application where the submitted on date is in the past.','Can submit historic loan application','LOAN','CREATEHISTORIC'),(7,'transaction_loan','APPROVE_LOAN','Allows an application user to approve a loan application.','Can approve loan application','LOAN','APPROVE'),(8,'transaction_loan','APPROVEINPAST_LOAN','Allows an application user to approve a loan application where the approval date is in the past.','Can approve loan application in the past','LOAN','APPROVEINPAST'),(9,'transaction_loan','REJECT_LOAN','Allows an application user to reject a loan application.','Can reject loan application','LOAN','REJECT'),(10,'transaction_loan','REJECTINPAST_LOAN','Allows an application user to reject a loan application where the rejected date is in the past.','Can reject loan application in the past','LOAN','REJECTINPAST'),
(11,'transaction_loan','WITHDRAW_LOAN','Allows an application user to mark loan application as withdrawn by client.','Can withdraw loan application','LOAN','WITHDRAW'),(12,'transaction_loan','WITHDRAWINPAST_LOAN','Allows an application user to mark loan application as withdrawn by client where the withdran on date is in the past.','Can withdraw loan application in the past','LOAN','WITHDRAWINPAST'),(13,'portfolio','DELETE_LOAN','Allows an application user to complete delete the loan application if it is submitted but not approved.','Can delete submitted loan application','LOAN','DELETE'),(14,'transaction_loan','APPROVALUNDO_LOAN','Allows an application user to undo a loan approval.','Can undo loan approval','LOAN','APPROVALUNDO'),(15,'transaction_loan','DISBURSE_LOAN','Allows an application user to disburse a loan application.','Can disburse loan','LOAN','DISBURSE'),(16,'transaction_loan','DISBURSEINPAST_LOAN','Allows an application user to disburse a loan where the disbursement date is in the past.','Can disburse loan in the past','LOAN','DISBURSEINPAST'),(17,'transaction_loan','DISBURSALUNDO_LOAN','Allows an application user to undo a loan disbursal if not payments already made.','Can undo loan disbursal','LOAN','DISBURSALUNDO'),(18,'transaction_loan','REPAYMENT_LOAN','Allows an application user to enter a repayment on the loan.','Can enter a repayment against a loan','LOAN','REPAYMENT'),(19,'transaction_loan','REPAYMENTINPAST_LOAN','Allows an application user to enter a repayment on the loan where the repayment date is in the past.','Can enter a repayment against a loan in the past','LOAN','REPAYMENTINPAST'),(20,'portfolio','CREATE_CLIENT','Allows an application user to add a new client.','Can add a new client.','CLIENT','CREATE'),
(42,'special','ALL_FUNCTIONS','An application user will have permission to execute all tasks.','ALL',NULL,NULL),(43,'special','ALL_FUNCTIONS_READ','An application user will have permission to execute all read tasks.','ALL READ',NULL,NULL),(112,'organisation','CREATE_CHARGE','Create a Charge','Create a Charge','CHARGE','CREATE'),(113,'organisation','READ_CHARGE','Read Charges','Read Charges','CHARGE','READ'),(114,'organisation','UPDATE_CHARGE','Update a Charge','Update a Charge','CHARGE','UPDATE'),(115,'organisation','DELETE_CHARGE','Delete a Charge','Delete a Charge','CHARGE','DELETE'),(120,'portfolio','READ_CLIENT','Read Clients','Read Clients','CLIENT','READ'),(121,'portfolio','UPDATE_CLIENT','Update a Client','Update a Client','CLIENT','UPDATE'),(122,'portfolio','DELETE_CLIENT','Delete a Client','Delete a Client','CLIENT','DELETE'),(123,'portfolio','CREATE_CLIENTIMAGE','Create/Update Client Image','Create/Update Client Image','CLIENTIMAGE','CREATE'),(124,'portfolio','READ_CLIENTIMAGE','Read Client Images','Read Client Images','CLIENTIMAGE','READ'),(126,'portfolio','DELETE_CLIENTIMAGE','Delete Client Image','Delete Client Image','CLIENTIMAGE','DELETE'),(127,'portfolio','CREATE_CLIENTNOTE','Create a Client Note','Create a Client Note','CLIENTNOTE','CREATE'),(128,'portfolio','READ_CLIENTNOTE','Read Client Notes','Read Client Notes','CLIENTNOTE','READ'),(129,'portfolio','UPDATE_CLIENTNOTE','Update a Client Note','Update a Client Note','CLIENTNOTE','UPDATE'),(130,'portfolio','DELETE_CLIENTNOTE','Delete a Client Note','Delete a Client Note','CLIENTNOTE','DELETE'),(131,'portfolio','CREATE_CLIENTIDENTIFIER','Create a Client Identifier','Create a Client Identifier','CLIENTIDENTIFIER','CREATE'),
(132,'portfolio','READ_CLIENTIDENTIFIER','Read Client Identifiers','Read Client Identifiers','CLIENTIDENTIFIER','READ'),(133,'portfolio','UPDATE_CLIENTIDENTIFIER','Update a Client Identifier','Update a Client Identifier','CLIENTIDENTIFIER','UPDATE'),(134,'portfolio','DELETE_CLIENTIDENTIFIER','Delete a Client Identifier','Delete a Client Identifier','CLIENTIDENTIFIER','DELETE'),(135,'configuration','CREATE_CODE','Create a Code','Create a Code','CODE','CREATE'),(136,'configuration','READ_CODE','Read Codes','Read Codes','CODE','READ'),(137,'configuration','UPDATE_CODE','Update a Code','Update a Code','CODE','UPDATE'),(138,'configuration','DELETE_CODE','Delete a Code','Delete a Code','CODE','DELETE'),(139,'configuration','READ_CURRENCY','Read Currencies','Read Currencies','CURRENCY','READ'),(140,'configuration','UPDATE_CURRENCY','Update Currencies','Update Currencies','CURRENCY','UPDATE'),(141,'portfolio','CREATE_DOCUMENT','Create and Upload a Document','Create and Upload a Document','DOCUMENT','CREATE'),(142,'portfolio','READ_DOCUMENT','Read Documents','Read Documents','DOCUMENT','READ'),(143,'portfolio','UPDATE_DOCUMENT','Update and Upload a Document','Update and Upload a Document','DOCUMENT','UPDATE'),(144,'portfolio','DELETE_DOCUMENT','Delete a Document','Delete a Document','DOCUMENT','DELETE'),(145,'organisation','CREATE_FUND','Create a Fund','Create a Fund','FUND','CREATE'),(146,'organisation','READ_FUND','Read Funds','Read Funds','FUND','READ'),(147,'organisation','UPDATE_FUND','Update a Fund','Update a Fund','FUND','UPDATE'),(148,'organisation','DELETE_FUND','Delete Fund','Delete Fund','FUND','DELETE'),(149,'portfolio','CREATE_GROUP','Create a Group','Create a Group','GROUP','CREATE'),
(150,'portfolio','READ_GROUP','Read Groups','Read Groups','GROUP','READ'),(151,'portfolio','UPDATE_GROUP','Update a Group','Update a Group','GROUP','UPDATE'),(152,'portfolio','DELETE_GROUP','Delete a Group','Delete a Group','GROUP','DELETE'),(153,'organisation','CREATE_LOANPRODUCT','Create a Loan Product','Create a Loan Product','LOANPRODUCT','CREATE'),(154,'organisation','READ_LOANPRODUCT','Read Loan Products','Read Loan Products','LOANPRODUCT','READ'),(155,'organisation','UPDATE_LOANPRODUCT','Update a Loan Product','Update a Loan Product','LOANPRODUCT','UPDATE'),(156,'organisation','DELETE_LOANPRODUCT','Delete a Loan Product','Delete a Loan Product','LOANPRODUCT','DELETE'),(157,'portfolio','READ_LOAN','Read Loans','Read Loans','LOAN','READ'),(158,'portfolio','UPDATE_LOAN','Update a Loan','Update a Loan','LOAN','UPDATE'),(159,'portfolio','UPDATEHISTORIC_LOAN','Update a Loan that was Created Historically','Update a Loan that was Created Historically','LOAN','UPDATEHISTORIC'),(160,'portfolio','CREATE_LOANCHARGE','Create a Loan Charge','Create a Loan Charge','LOANCHARGE','CREATE'),(161,'portfolio','UPDATE_LOANCHARGE','Update a Loan Charge','Update a Loan Charge','LOANCHARGE','UPDATE'),(162,'portfolio','DELETE_LOANCHARGE','Delete a Loan Charge','Delete a Loan Charge','LOANCHARGE','DELETE'),(163,'portfolio','WAIVE_LOANCHARGE','Waive a Loan Charge','Waive a Loan Charge','LOANCHARGE','WAIVE'),(164,'transaction_loan','BULKREASSIGN_LOAN','Bulk Reassign Loans','Bulk Reassign Loans','LOAN','BULKREASSIGN'),(165,'transaction_loan','ADJUST_LOAN','Adjust a Loan Transaction','Adjust a Loan Transaction','LOAN','ADJUST'),(166,'transaction_loan','WAIVEINTERESTPORTION_LOAN','Waive Portion of Loan Interest','Waive Portion of Loan Interest','LOAN','WAIVEINTERESTPORTION'),
(167,'transaction_loan','WRITEOFF_LOAN','Write-Off a Loan','Write-Off a Loan','LOAN','WRITEOFF'),(168,'transaction_loan','CLOSE_LOAN','Close a Loan','Close a Loan','LOAN','CLOSE'),(169,'transaction_loan','CLOSEASRESCHEDULED_LOAN','Close a Loan (having been Rescheduled (Mifos Legacy Need)','Close a Loan (having been Rescheduled (Mifos Legacy Need)','LOAN','CLOSEASRESCHEDULED'),(170,'organisation','READ_MAKERCHECKER','Read Maker-Checker Entries','Read Maker-Checker Entries','MAKERCHECKER','READ'),(171,'organisation','CREATE_OFFICE','Create an Office','Create an Office','OFFICE','CREATE'),(172,'organisation','READ_OFFICE','Read Offices','Read Offices','OFFICE','READ'),(173,'organisation','UPDATE_OFFICE','Update an Office','Update an Office','OFFICE','UPDATE'),(174,'organisation','DELETE_OFFICE','Delete an Office','Delete an Office','OFFICE','DELETE'),(175,'organisation','READ_OFFICETRANSACTION','Read Office Transactions','Read Office Transactions','OFFICETRANSACTION','READ'),(176,'organisation','CREATE_OFFICETRANSACTION','Create an Office Transaction','Create an Office Transaction','OFFICETRANSACTION','CREATE'),(177,'authorisation','READ_PERMISSION','Read Permissions','Read Permissions','PERMISSION','READ'),(178,'authorisation','CREATE_ROLE','Create a Role','Create a Role','ROLE','CREATE'),(179,'authorisation','READ_ROLE','Read Roles','Read Roles','ROLE','READ'),(180,'authorisation','UPDATE_ROLE','Update a Role','Update a Role','ROLE','UPDATE'),(181,'authorisation','DELETE_ROLE','Delete a Role','Delete a Role','ROLE','DELETE'),(182,'authorisation','CREATE_USER','Create a User','Create a User','USER','CREATE'),(183,'authorisation','READ_USER','Read Users','Read Users','USER','READ'),(184,'authorisation','UPDATE_USER','Update a User','Update a User','USER','UPDATE'),
(185,'authorisation','DELETE_USER','Create a User','Create a User','USER','DELETE'),(186,'organisation','CREATE_STAFF','Create a Staff Member','Create a Staff Member','STAFF','CREATE'),(187,'organisation','READ_STAFF','Read Staff','Read Staff','STAFF','READ'),(188,'organisation','UPDATE_STAFF','Update a Staff Member','Update a Staff Member','STAFF','UPDATE'),(189,'organisation','DELETE_STAFF','Delete a Staff Member','Delete a Staff Member','STAFF','DELETE'),(190,'organisation','CREATE_SAVINGSPRODUCT','Create a Savings Product','Create a Savings Product','SAVINGSPRODUCT','CREATE'),(191,'organisation','READ_SAVINGSPRODUCT','Read Savings Products','Read Savings Products','SAVINGSPRODUCT','READ'),(192,'organisation','UPDATE_SAVINGSPRODUCT','Update a Savings Product','Update a Savings Product','SAVINGSPRODUCT','UPDATE'),(193,'organisation','DELETE_SAVINGSPRODUCT','Delete a Savings Product','Delete a Savings Product','SAVINGSPRODUCT','DELETE'),(194,'organisation','CREATE_DEPOSITPRODUCT','Create a Deposit Product','Create a Deposit Product','DEPOSITPRODUCT','CREATE'),(195,'organisation','READ_DEPOSITPRODUCT','Read Deposit Products','Read Deposit Products','DEPOSITPRODUCT','READ'),(196,'organisation','UPDATE_DEPOSITPRODUCT','Update a Deposit Product','Update a Deposit Product','DEPOSITPRODUCT','UPDATE'),(197,'organisation','DELETE_DEPOSITPRODUCT','Delete a Deposit Product','Delete a Deposit Product','DEPOSITPRODUCT','DELETE'),(198,'portfolio','CREATE_DEPOSITACCOUNT','Create a Deposit Account','Create a Deposit Account','DEPOSITACCOUNT','CREATE'),(199,'portfolio','READ_DEPOSITACCOUNT','Read Deposit Accounts','Read Deposit Accounts','DEPOSITACCOUNT','READ'),(200,'portfolio','UPDATE_DEPOSITACCOUNT','Update a Deposit Account','Update a Deposit Account','DEPOSITACCOUNT','UPDATE'),
(201,'portfolio','DELETE_DEPOSITACCOUNT','Delete a Deposit Account','Delete a Deposit Account','DEPOSITACCOUNT','DELETE'),(202,'transaction_deposit','APPROVE_DEPOSITACCOUNT','Approve a Deposit Account','Approve a Deposit Account','DEPOSITACCOUNT','APPROVE'),(203,'transaction_deposit','REJECT_DEPOSITACCOUNT','Reject Deposit Account','Reject Deposit Account','DEPOSITACCOUNT','REJECT'),(204,'transaction_deposit','WITHDRAW_DEPOSITACCOUNT','Withdraw Deposit Account','Withdraw Deposit Account','DEPOSITACCOUNT','WITHDRAW'),(205,'transaction_deposit','APPROVALUNDO_DEPOSITACCOUNT','Undo Approval of Deposit Account','Undo Approval of Deposit Account','DEPOSITACCOUNT','APPROVALUNDO'),(206,'transaction_deposit','WITHDRAWAL_DEPOSITACCOUNT','Make a Withdrawal From Deposit Account','Make a Withdrawal From Deposit Account','DEPOSITACCOUNT','WITHDRAWAL'),(207,'transaction_deposit','INTEREST_DEPOSITACCOUNT','Apply Interest to Deposit Accounts','Apply Interest to Deposit Accounts','DEPOSITACCOUNT','INTEREST'),(208,'transaction_deposit','RENEW_DEPOSITACCOUNT','Renew Deposit Account','Renew Deposit Account','DEPOSITACCOUNT','RENEW'),(209,'portfolio','CREATE_SAVINGSACCOUNT','Create a Savings Account','Create a Savings Account','SAVINGSACCOUNT','CREATE'),(210,'portfolio','READ_SAVINGSACCOUNT','Read Savings Accounts','Read Savings Accounts','SAVINGSACCOUNT','READ'),(211,'portfolio','UPDATE_SAVINGSACCOUNT','Update a Savings Account','Update a Savings Account','SAVINGSACCOUNT','UPDATE'),(212,'portfolio','DELETE_SAVINGSACCOUNT','Delete a Savings Account','Delete a Savings Account','SAVINGSACCOUNT','DELETE'),(213,'authorisation','PERMISSIONS_ROLE','Manage Permissions for a Role','Manage Permissions for a Role','ROLE','PERMISSIONS');
/* role 1 is super user, give it ALL_FUNCTIONS */
INSERT INTO m_role_permission(role_id, permission_id)
select 1, id
from m_permission
where code = 'ALL_FUNCTIONS';
/* add a read permission for each defined report */
insert into m_permission(grouping, `code`, default_description, default_name, entity_name, action_name)
select 'report', concat('READ_', sr.report_name), concat('READ_', sr.report_name), concat('READ_', sr.report_name), sr.report_name, 'READ'
from stretchy_report sr;
/* add a create, read, update and delete permission for each registered datatable */
insert into m_permission(grouping, `code`, default_description, default_name, entity_name, action_name)
select 'datatable', concat('CREATE_', r.registered_table_name), concat('CREATE_', r.registered_table_name), concat('CREATE_', r.registered_table_name), r.registered_table_name, 'CREATE'
from x_registered_table r;
insert into m_permission(grouping, `code`, default_description, default_name, entity_name, action_name)
select 'datatable', concat('READ_', r.registered_table_name), concat('READ_', r.registered_table_name), concat('READ_', r.registered_table_name), r.registered_table_name, 'READ'
from x_registered_table r;
insert into m_permission(grouping, `code`, default_description, default_name, entity_name, action_name)
select 'datatable', concat('UPDATE_', r.registered_table_name), concat('UPDATE_', r.registered_table_name), concat('UPDATE_', r.registered_table_name), r.registered_table_name, 'UPDATE'
from x_registered_table r;
insert into m_permission(grouping, `code`, default_description, default_name, entity_name, action_name)
select 'datatable', concat('DELETE_', r.registered_table_name), concat('DELETE_', r.registered_table_name), concat('DELETE_', r.registered_table_name), r.registered_table_name, 'DELETE'
from x_registered_table r;
@@ -0,0 +1,6 @@
ALTER TABLE m_code
ADD COLUMN `is_system_defined` TINYINT(1) NOT NULL DEFAULT '0' AFTER `code_name` ;
update m_code
set is_system_defined = true
where code_name = 'Customer Identifier';
@@ -0,0 +1 @@
ALTER TABLE `m_portfolio_command_source` CHANGE COLUMN `command_as_json` `command_as_json` VARCHAR(5000) NOT NULL;
@@ -0,0 +1,13 @@
ALTER TABLE `m_permission`
DROP COLUMN `default_name` ,
DROP COLUMN `default_description` ,
ADD COLUMN `is_maker_checker` TINYINT(1) NOT NULL AFTER `action_name` ;
update m_permission
set is_maker_checker = false;
update m_permission
set is_maker_checker = true
where grouping not in ('special', 'report')
and action_name != 'READ';
@@ -0,0 +1 @@
ALTER TABLE `m_loan` CHANGE COLUMN `arrearstolerance_amount` `arrearstolerance_amount` DECIMAL(19,6) NULL;
@@ -0,0 +1,9 @@
SET foreign_key_checks = 0;
drop table IF EXISTS `stretchydata_dataset_fields`;
drop table IF EXISTS `stretchydata_datasettype`;
drop table IF EXISTS `stretchydata_dataset`;
drop table IF EXISTS `m_client_xadditional information`;
drop table IF EXISTS `m_client_xhighly improbable info`;
drop table IF EXISTS `m_loan_xadditional information`;
SET foreign_key_checks = 1;
@@ -0,0 +1,19 @@
ALTER TABLE m_permission
CHANGE COLUMN `is_maker_checker` `can_maker_checker` TINYINT(1) NOT NULL DEFAULT '1' ;
/*
add all checker permissions
*/
insert into m_permission(grouping, code, entity_name, action_name, can_maker_checker)
select grouping, concat(code, '_CHECKER'), entity_name, action_name, false
from m_permission
where code not like 'READ_%'
and grouping != 'special';
/* 5k not enough for command json */
ALTER TABLE m_portfolio_command_source
CHANGE COLUMN `command_as_json` `command_as_json` TEXT NOT NULL ;
@@ -0,0 +1,43 @@
DROP TABLE IF EXISTS `m_acc_coa`;
DROP TABLE IF EXISTS `acc_gl_account`;
CREATE TABLE `acc_gl_account` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(45) NOT NULL,
`parent_id` BIGINT(20) NULL DEFAULT NULL,
`gl_code` VARCHAR(45) NOT NULL,
`disabled` TINYINT(1) NOT NULL DEFAULT '0',
`manual_journal_entries_allowed` TINYINT(1) NOT NULL DEFAULT '1',
`header_account` TINYINT(1) NOT NULL DEFAULT '0',
`classification` VARCHAR(45) NOT NULL,
`description` VARCHAR(500) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `acc_gl_code` (`gl_code`),
INDEX `FK_ACC_0000000001` (`parent_id`),
CONSTRAINT `FK_ACC_0000000001` FOREIGN KEY (`parent_id`) REFERENCES `acc_gl_account` (`id`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `acc_gl_closure`;
CREATE TABLE `acc_gl_closure` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`office_id` BIGINT(20) NOT NULL,
`closing_date` DATE NOT NULL,
`is_deleted` INT(20) NOT NULL DEFAULT '0',
`createdby_id` BIGINT(20) NULL DEFAULT NULL,
`lastmodifiedby_id` BIGINT(20) NULL DEFAULT NULL,
`created_date` DATETIME NULL DEFAULT NULL,
`lastmodified_date` DATETIME NULL DEFAULT NULL,
`comments` VARCHAR(500) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
INDEX `FK_acc_gl_closure_m_office` (`office_id`),
INDEX `FK_acc_gl_closure_m_appuser` (`createdby_id`),
INDEX `FK_acc_gl_closure_m_appuser_2` (`lastmodifiedby_id`),
UNIQUE INDEX `office_id_closing_date` (`office_id`, `closing_date`),
CONSTRAINT `FK_acc_gl_closure_m_appuser` FOREIGN KEY (`createdby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_acc_gl_closure_m_appuser_2` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_acc_gl_closure_m_office` FOREIGN KEY (`office_id`) REFERENCES `m_office` (`id`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -0,0 +1,19 @@
DROP TABLE IF EXISTS `m_saving_schedule`;
CREATE TABLE `m_saving_schedule` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`saving_account_id` bigint(20) NOT NULL,
`duedate` date NOT NULL,
`installment` smallint(5) NOT NULL,
`deposit` decimal(21,4) NOT NULL,
`payment_date` date DEFAULT NULL,
`deposit_paid` decimal(21,4) DEFAULT NULL,
`completed_derived` bit(1) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKSS00000000001` (`saving_account_id`),
CONSTRAINT `FKSS00000000001` FOREIGN KEY (`saving_account_id`) REFERENCES `m_saving_account` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -0,0 +1,30 @@
/* some addition permissions and alterations */
INSERT INTO m_permission (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`)
VALUES ('configuration', 'UPDATE_PERMISSION', 'PERMISSION', 'UPDATE', '0');
INSERT INTO m_permission (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`)
VALUES ('configuration', 'UPDATE_PERMISSION_CHECKER', 'PERMISSION', 'UPDATE', '0');
INSERT INTO m_permission (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`)
VALUES ('configuration', 'READ_DATATABLE', 'DATATABLE', 'READ', '0');
INSERT INTO m_permission (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`)
VALUES ('configuration', 'REGISTER_DATATABLE', 'DATATABLE', 'REGISTER', '0');
INSERT INTO m_permission (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`)
VALUES ('configuration', 'REGISTER_DATATABLE_CHECKER', 'DATATABLE', 'REGISTER', '0');
INSERT INTO m_permission (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`)
VALUES ('configuration', 'DEREGISTER_DATATABLE', 'DATATABLE', 'DEREGISTER', '0');
INSERT INTO m_permission (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`)
VALUES ('configuration', 'DEREGISTER_DATATABLE_CHECKER', 'DATATABLE', 'DEREGISTER', '0');
INSERT INTO m_permission (`grouping`, `code`, `can_maker_checker`)
VALUES ('special', 'CHECKER_SUPER_USER', '0');
update m_permission
set grouping = 'configuration'
where code like '%permission%';
@@ -0,0 +1,5 @@
update m_permission
set grouping = "authorisation"
where code like 'PERMISSIONS_ROLE%';
@@ -0,0 +1 @@
ALTER TABLE `m_portfolio_command_source` CHANGE COLUMN `api_resource` `api_resource` VARCHAR(100) NOT NULL;
@@ -0,0 +1,5 @@
ALTER TABLE `m_deposit_account`
ADD COLUMN `available_interest` decimal(19,6) DEFAULT '0.000000' AFTER `is_interest_withdrawable`,
ADD COLUMN `interest_posted_amount` decimal(19,6) DEFAULT '0.000000' AFTER `available_interest`,
ADD COLUMN `last_interest_posted_date` date DEFAULT NULL AFTER `interest_posted_amount`,
ADD COLUMN `next_interest_posting_date` date DEFAULT NULL AFTER `last_interest_posted_date`;
@@ -0,0 +1,2 @@
ALTER TABLE `m_client`
CHANGE COLUMN `joining_date` `joined_date` DATE NULL DEFAULT NULL;
@@ -0,0 +1,19 @@
drop table if exists extra_client_details;
CREATE TABLE `extra_client_details` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`client_id` bigint(20) NOT NULL,
`client_dob` date DEFAULT NULL,
`client_address` varchar(60) DEFAULT NULL,
`father_name` varchar(40) DEFAULT NULL,
`nominee` varchar(40) DEFAULT NULL,
`nominee_relationship` varchar(40) DEFAULT NULL,
`nominee_address` varchar(60) DEFAULT NULL,
`crime_no` varchar(40) DEFAULT NULL,
`police_station` varchar(40) DEFAULT NULL,
`other_notes` text,
PRIMARY KEY (`id`),
UNIQUE KEY `client_id` (`client_id`),
KEY `FK_extra_client_details_1` (`client_id`),
CONSTRAINT `FK_extra_client_details` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -0,0 +1,3 @@
INSERT INTO m_permission (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`)
VALUES ('configuration', 'READ_AUDIT', 'AUDIT', 'READ', '0');
@@ -0,0 +1,21 @@
drop table if exists `m_portfolio_command_source`;
CREATE TABLE `m_portfolio_command_source` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`permission_code` varchar(50) NOT NULL,
`api_operation` varchar(30) NOT NULL,
`api_resource` varchar(100) NOT NULL,
`resource_id` bigint(20) DEFAULT NULL,
`api_subresource` varchar(100) DEFAULT NULL,
`subresource_id` bigint(20) DEFAULT NULL,
`command_as_json` text NOT NULL,
`maker_id` bigint(20) NOT NULL,
`made_on_date` datetime NOT NULL,
`checker_id` bigint(20) DEFAULT NULL,
`checked_on_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK_m_maker_m_appuser` (`maker_id`),
KEY `FK_m_checker_m_appuser` (`checker_id`),
CONSTRAINT `FK_m_checker_m_appuser` FOREIGN KEY (`checker_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_m_maker_m_appuser` FOREIGN KEY (`maker_id`) REFERENCES `m_appuser` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -0,0 +1,22 @@
drop table if exists `m_portfolio_command_source`;
CREATE TABLE `m_portfolio_command_source` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`action_name` varchar(50) NOT NULL,
`entity_name` varchar(50) NOT NULL,
`api_operation` varchar(30) NOT NULL,
`api_resource` varchar(100) NOT NULL,
`resource_id` bigint(20) DEFAULT NULL,
`api_subresource` varchar(100) DEFAULT NULL,
`subresource_id` bigint(20) DEFAULT NULL,
`command_as_json` text NOT NULL,
`maker_id` bigint(20) NOT NULL,
`made_on_date` datetime NOT NULL,
`checker_id` bigint(20) DEFAULT NULL,
`checked_on_date` datetime DEFAULT NULL,
`processing_result_enum` smallint(5) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_m_maker_m_appuser` (`maker_id`),
KEY `FK_m_checker_m_appuser` (`checker_id`),
CONSTRAINT `FK_m_checker_m_appuser` FOREIGN KEY (`checker_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_m_maker_m_appuser` FOREIGN KEY (`maker_id`) REFERENCES `m_appuser` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -0,0 +1,40 @@
DROP TABLE IF EXISTS `acc_gl_journal_entry`;
CREATE TABLE `acc_gl_journal_entry` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`account_id` BIGINT(20) NOT NULL,
`office_id` BIGINT(20) NOT NULL,
`reversal_id` BIGINT(20) NULL DEFAULT NULL,
`transaction_id` VARCHAR(50) NOT NULL,
`reversed` TINYINT(1) NOT NULL DEFAULT '0',
`portfolio_generated` TINYINT(1) NOT NULL DEFAULT '0',
`entry_date` DATE NOT NULL,
`type` VARCHAR(50) NOT NULL,
`amount` DECIMAL(19,6) NOT NULL,
`description` VARCHAR(500) NULL DEFAULT NULL,
`entity_type` VARCHAR(50) NULL DEFAULT NULL,
`entity_id` BIGINT(20) NULL DEFAULT NULL,
`createdby_id` BIGINT(20) NOT NULL,
`lastmodifiedby_id` BIGINT(20) NOT NULL,
`created_date` DATETIME NOT NULL,
`lastmodified_date` DATETIME NOT NULL,
PRIMARY KEY (`id`),
INDEX `FK_acc_gl_journal_entry_m_office` (`office_id`),
INDEX `FK_acc_gl_journal_entry_m_appuser` (`createdby_id`),
INDEX `FK_acc_gl_journal_entry_m_appuser_2` (`lastmodifiedby_id`),
INDEX `FK_acc_gl_journal_entry_acc_gl_journal_entry` (`reversal_id`),
INDEX `FK_acc_gl_journal_entry_acc_gl_account` (`account_id`),
CONSTRAINT `FK_acc_gl_journal_entry_acc_gl_account` FOREIGN KEY (`account_id`) REFERENCES `acc_gl_account` (`id`),
CONSTRAINT `FK_acc_gl_journal_entry_acc_gl_journal_entry` FOREIGN KEY (`reversal_id`) REFERENCES `acc_gl_journal_entry` (`id`),
CONSTRAINT `FK_acc_gl_journal_entry_m_appuser` FOREIGN KEY (`createdby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_acc_gl_journal_entry_m_appuser_2` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_acc_gl_journal_entry_m_office` FOREIGN KEY (`office_id`) REFERENCES `m_office` (`id`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `acc_gl_account`
ALTER `description` DROP DEFAULT;
ALTER TABLE `acc_gl_account`
CHANGE COLUMN `description` `description` VARCHAR(500) NULL AFTER `classification`;
@@ -0,0 +1,19 @@
/**Balance sheet report**/
INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_subtype`, `report_category`, `report_sql`, `description`, `core_report`, `use_report`) VALUES ('Balance Sheet', 'Pentaho', NULL, 'Accounting', NULL, 'Balance Sheet', 1, 1);
INSERT INTO `stretchy_report_parameter` (`report_id`, `parameter_id`, `report_parameter_name`) VALUES ((select max(report_id) from stretchy_report), 5, 'branch');
INSERT INTO `stretchy_report_parameter` (`report_id`, `parameter_id`, `report_parameter_name`) VALUES ((select max(report_id) from stretchy_report), 81, 'date');
/**Income statement report**/
INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_subtype`, `report_category`, `report_sql`, `description`, `core_report`, `use_report`) VALUES ('Income Statement', 'Pentaho', NULL, 'Accounting', NULL, 'Profilt and Loss Statement', 1, 1);
INSERT INTO `stretchy_report_parameter` (`report_id`, `parameter_id`, `report_parameter_name`) VALUES ((select max(report_id) from stretchy_report), 5, 'branch');
INSERT INTO `stretchy_report_parameter` (`report_id`, `parameter_id`, `report_parameter_name`) VALUES ((select max(report_id) from stretchy_report), 80, 'fromDate');
INSERT INTO `stretchy_report_parameter` (`report_id`, `parameter_id`, `report_parameter_name`) VALUES ((select max(report_id) from stretchy_report), 81, 'toDate');
/**Trial Balance report**/
INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_subtype`, `report_category`, `report_sql`, `description`, `core_report`, `use_report`) VALUES ('Trial Balance', 'Pentaho', NULL, 'Accounting', NULL, 'Trial Balance Report', 1, 1);
INSERT INTO `stretchy_report_parameter` (`report_id`, `parameter_id`, `report_parameter_name`) VALUES ((select max(report_id) from stretchy_report), 5, 'branch');
INSERT INTO `stretchy_report_parameter` (`report_id`, `parameter_id`, `report_parameter_name`) VALUES ((select max(report_id) from stretchy_report), 80, 'fromDate');
INSERT INTO `stretchy_report_parameter` (`report_id`, `parameter_id`, `report_parameter_name`) VALUES ((select max(report_id) from stretchy_report), 81, 'toDate');
@@ -0,0 +1,4 @@
INSERT INTO r_enum_value(`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) VALUES ('processing_result_enum', '0', 'invalid', 'Invalid');
INSERT INTO r_enum_value(`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) VALUES ('processing_result_enum', '1', 'processed', 'Processed');
INSERT INTO r_enum_value(`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) VALUES ('processing_result_enum', '2', 'awaiting.approval', 'Awaiting Approval');
INSERT INTO r_enum_value(`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) VALUES ('processing_result_enum', '3', 'rejected', 'Rejected');
@@ -0,0 +1,2 @@
ALTER TABLE m_product_savings
ADD COLUMN `deposit_every` bigint(20) DEFAULT NULL AFTER `tenure_type`;
@@ -0,0 +1,2 @@
ALTER TABLE m_saving_account
ADD COLUMN `deposit_every` bigint(20) DEFAULT NULL AFTER `tenure_type`;
@@ -0,0 +1,11 @@
DELETE FROM m_role_permission
where exists
(select 'f' from m_permission p
where p.id = m_role_permission.permission_id
and p.code in ("ORGANISATION_ADMINISTRATION_SUPER_USER", "PORTFOLIO_MANAGEMENT_SUPER_USER", "USER_ADMINISTRATION_SUPER_USER"));
DELETE from m_permission
where code in ("ORGANISATION_ADMINISTRATION_SUPER_USER", "PORTFOLIO_MANAGEMENT_SUPER_USER", "USER_ADMINISTRATION_SUPER_USER");
@@ -0,0 +1,9 @@
INSERT INTO `m_permission`
(`grouping`,
`code`,
`entity_name`,
`action_name`,
`can_maker_checker`)
VALUES
('transaction_loan', 'UPDATELOANOFFICER_LOAN', 'LOAN', 'UPDATELOANOFFICER', 1),
('transaction_loan', 'UPDATELOANOFFICER_LOAN_CHECKER', 'LOAN', 'UPDATELOANOFFICER', 0);
@@ -0,0 +1,9 @@
ALTER TABLE m_portfolio_command_source
ADD INDEX `action_name` (`action_name` ASC)
, ADD INDEX `entity_name` (`entity_name` ASC, `resource_id` ASC)
, ADD INDEX `made_on_date` (`made_on_date` ASC)
, ADD INDEX `checked_on_date` (`checked_on_date` ASC)
, ADD INDEX `processing_result_enum` (`processing_result_enum` ASC)
, ADD INDEX `api_operation` (`api_operation` ASC)
, ADD INDEX `api_resource` (`api_resource` ASC, `resource_id` ASC) ;
@@ -0,0 +1,5 @@
INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`)
VALUES ('loan_status_id', '601', 'Closed - Written Off', 'Closed - Written Off');
INSERT INTO `mifostenant-creocore`.`r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`)
VALUES ('loan_status_id', '602', 'Closed - Reschedule Outstanding Amount', 'Closed - Reschedule Outstanding Amount');
@@ -0,0 +1,12 @@
ALTER TABLE `m_client`
ADD COLUMN `account_no` VARCHAR(20) NOT NULL AFTER `id`;
UPDATE `m_client`
SET
`account_no` = `id`
WHERE `id` > 0;
ALTER TABLE `m_client` ADD UNIQUE INDEX `account_no_UNIQUE` (`account_no` ASC);
@@ -0,0 +1,32 @@
DROP TABLE IF EXISTS `m_portfolio_command_source`;
CREATE TABLE `m_portfolio_command_source` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`action_name` varchar(50) NOT NULL,
`entity_name` varchar(50) NOT NULL,
`office_id` bigint(20) DEFAULT NULL,
`group_id` bigint(20) DEFAULT NULL,
`client_id` bigint(20) DEFAULT NULL,
`loan_id` bigint(20) DEFAULT NULL,
`api_get_url` varchar(100) NOT NULL,
`resource_id` bigint(20) DEFAULT NULL,
`command_as_json` text NOT NULL,
`maker_id` bigint(20) NOT NULL,
`made_on_date` datetime NOT NULL,
`checker_id` bigint(20) DEFAULT NULL,
`checked_on_date` datetime DEFAULT NULL,
`processing_result_enum` smallint(5) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_m_maker_m_appuser` (`maker_id`),
KEY `FK_m_checker_m_appuser` (`checker_id`),
KEY `action_name` (`action_name`),
KEY `entity_name` (`entity_name`,`resource_id`),
KEY `made_on_date` (`made_on_date`),
KEY `checked_on_date` (`checked_on_date`),
KEY `processing_result_enum` (`processing_result_enum`),
KEY `office_id` (`office_id`),
KEY `group_id` (`office_id`),
KEY `client_id` (`office_id`),
KEY `loan_id` (`office_id`),
CONSTRAINT `FK_m_checker_m_appuser` FOREIGN KEY (`checker_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_m_maker_m_appuser` FOREIGN KEY (`maker_id`) REFERENCES `m_appuser` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -0,0 +1,25 @@
DROP TABLE IF EXISTS `c_configuration`;
CREATE TABLE `c_configuration` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`enabled` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `c_configuration`
(`name`, `enabled`)
VALUES
('maker-checker', 0);
INSERT INTO `m_permission`
(
`grouping`,
`code`,
`entity_name`,
`action_name`,
`can_maker_checker`)
VALUES
('configuration','UPDATE_CONFIGURATION',
'CONFIGURATION','UPDATE',1),
('configuration','READ_CONFIGURATION',
'CONFIGURATION','READ',1);
@@ -0,0 +1,20 @@
ALTER TABLE `m_product_loan`
ADD COLUMN `accounting_type` SMALLINT(5) NOT NULL AFTER `amortization_method_enum`;
update m_product_loan set accounting_type=1;
DROP TABLE if exists `acc_product_mapping`;
CREATE TABLE `acc_product_mapping` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`gl_account_id` BIGINT(20) NULL DEFAULT NULL,
`product_id` BIGINT(20) NULL DEFAULT NULL,
`product_type` SMALLINT(5) NULL DEFAULT NULL,
`financial_account_type` SMALLINT(5) NULL DEFAULT NULL,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -0,0 +1,15 @@
ALTER TABLE `m_client`
ADD COLUMN `middlename` VARCHAR(50) DEFAULT NULL AFTER `firstname`;
ALTER TABLE `m_client`
ADD COLUMN `fullname` VARCHAR(100) DEFAULT NULL AFTER `lastname`;
UPDATE `m_client`
SET
`fullname` = `lastname`
WHERE `firstname` is NULL;
UPDATE `m_client`
SET
`lastname` = null
WHERE `fullname` is not NULL;
@@ -0,0 +1,13 @@
ALTER TABLE `m_loan`
ADD COLUMN `account_no` VARCHAR(20) NOT NULL AFTER `id`;
UPDATE `m_loan`
SET
`account_no` = `id`
WHERE `id` > 0;
ALTER TABLE `m_loan` ADD UNIQUE INDEX `loan_account_no_UNIQUE` (`account_no` ASC);
ALTER TABLE `m_loan` DROP INDEX `org_id`;
ALTER TABLE `m_loan` ADD UNIQUE INDEX `loan_externalid_UNIQUE` (`external_id` ASC);
+36 -24
View File
@@ -1,3 +1,18 @@
apply plugin: 'rebel'
buildscript {
repositories {
mavenLocal()
mavenCentral()
mavenRepo(name: 'zt-public-snapshots',
url: 'http://repos.zeroturnaround.com/nexus/content/groups/zt-public/')
}
dependencies {
classpath group: 'org.zeroturnaround', name: 'gradle-jrebel-plugin', version: '1.0.2-SNAPSHOT'
}
}
buildscript {
repositories {
add(new org.apache.ivy.plugins.resolver.URLResolver()) {
@@ -7,43 +22,40 @@ buildscript {
}
dependencies {
classpath 'bmuschko:gradle-tomcat-plugin:0.9.3'
classpath 'bmuschko:gradle-tomcat-plugin:0.9.5'
}
}
apply plugin: 'war'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'tomcat'
apply plugin: 'project-report'
project.ext.springVersion = '3.1.1.RELEASE'
project.ext.springSecurityVersion = '3.1.0.RELEASE'
project.ext.hibernateValidatorVersion = '4.3.0.Final'
project.ext.hibernateCoreVersion = '4.1.3.Final'
project.ext.jerseyVersion = '1.13'
project.ext.springDataJpaVersion = '1.0.3.RELEASE'
/* define the valid syntax level for source files */
sourceCompatibility = JavaVersion.VERSION_1_6
/* define binary compatiblity version */
targetCompatibility = JavaVersion.VERSION_1_6
project.ext.springVersion = '3.2.0.RELEASE'
project.ext.springSecurityVersion = '3.1.3.RELEASE'
project.ext.hibernateValidatorVersion = '4.3.1.Final'
project.ext.hibernateCoreVersion = '4.1.8.Final'
project.ext.jerseyVersion = '1.16'
project.ext.springDataJpaVersion = '1.1.2.RELEASE'
repositories {
mavenCentral()
mavenLocal()
maven {
url "http://maven.springframework.org/milestone"
}
maven {
url "http://maven.springframework.org/release"
}
maven {
url "http://maven.springframework.org/snapshot"
}
maven {
url "http://download.java.net/maven/2"
}
maven {
url "http://repository.pentaho.org/artifactory/pentaho/"
}
flatDir {
dirs '../repos'
}
}
configurations {
@@ -54,7 +66,7 @@ configurations {
}
dependencies {
def tomcatVersion = '7.0.29'
def tomcatVersion = '7.0.34'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}"
tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
@@ -73,7 +85,7 @@ dependencies {
[group: 'org.springframework.security', name: 'spring-security-core', version: springSecurityVersion],
[group: 'org.springframework.security', name: 'spring-security-web', version: springSecurityVersion],
[group: 'org.springframework.security', name: 'spring-security-config', version: springSecurityVersion],
[group: 'org.aspectj', name: 'aspectjrt', version: '1.6.12.RELEASE'],
[group: 'org.aspectj', name: 'aspectjrt', version: '1.7.0.RELEASE'],
[group: 'org.hibernate', name: 'hibernate-core', version: hibernateCoreVersion],
[group: 'org.hibernate', name: 'hibernate-entitymanager', version: hibernateCoreVersion],
@@ -96,14 +108,14 @@ dependencies {
[group: 'org.apache.commons', name: 'commons-email', version: '1.2'],
[group: 'commons-lang', name: 'commons-lang', version: '2.4'],
[group: 'org.slf4j', name: 'slf4j-api', version: '1.6.6'],
[group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.6.6'],
[group: 'org.slf4j', name: 'slf4j-api', version: '1.7.2'],
[group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.2'],
[group: 'ch.qos.logback', name: 'logback-core', version: '1.0.6'],
[group: 'ch.qos.logback', name: 'logback-classic', version: '1.0.6'],
[group: 'ch.qos.logback', name: 'logback-core', version: '1.0.9'],
[group: 'ch.qos.logback', name: 'logback-classic', version: '1.0.9'],
[group: 'mysql', name: 'mysql-connector-java', version: '5.1.21'],
[group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: '7.0.29'],
[group: 'mysql', name: 'mysql-connector-java', version: '5.1.22'],
[group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: '7.0.34'],
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-classic-core', version: '3.8.3-GA'],
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-classic-extensions', version: '3.8.3-GA'],
@@ -1,279 +0,0 @@
package org.mifosng.platform;
import java.math.BigDecimal;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.mifosng.platform.api.data.ApiParameterError;
import org.springframework.util.ObjectUtils;
public class DataValidatorBuilder {
private final List<ApiParameterError> dataValidationErrors;
private String resource;
private String parameter;
private Object value;
private boolean ignoreNullValue = false;
public DataValidatorBuilder(List<ApiParameterError> dataValidationErrors) {
this.dataValidationErrors = dataValidationErrors;
}
public DataValidatorBuilder reset() {
return new DataValidatorBuilder(dataValidationErrors).resource(resource);
}
public DataValidatorBuilder resource(final String resource) {
this.resource = resource;
return this;
}
public DataValidatorBuilder parameter(final String parameter) {
this.parameter = parameter;
return this;
}
public DataValidatorBuilder value(Object value) {
this.value = value;
return this;
}
public DataValidatorBuilder ignoreIfNull() {
this.ignoreNullValue = true;
return this;
}
public DataValidatorBuilder andNotBlank(String linkedParameterName, String linkedValue) {
if (value == null && linkedValue == null && ignoreNullValue) {
return this;
}
if (StringUtils.isBlank(linkedValue)) {
StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(resource).append(".").append(linkedParameterName).append(".cannot.be.empty.when.").append(parameter).append(".is.populated");
StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(linkedParameterName).append(" cannot be empty when ").append(parameter).append(" is populated.");
ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), defaultEnglishMessage.toString(), linkedParameterName, linkedValue, value);
dataValidationErrors.add(error);
}
return this;
}
public DataValidatorBuilder equalToParameter(String linkedParameterName, Object linkedValue) {
if (value == null && linkedValue == null && ignoreNullValue) {
return this;
}
if (value != null && !value.equals(linkedValue)) {
StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(resource).append(".").append(linkedParameterName).append(".not.equal.to.").append(parameter);
StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(linkedParameterName).append(" is not equal to ").append(parameter).append(".");
ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), defaultEnglishMessage.toString(), linkedParameterName, linkedValue, value);
dataValidationErrors.add(error);
}
return this;
}
public DataValidatorBuilder notSameAsParameter(String linkedParameterName, Object linkedValue) {
if (value == null && linkedValue == null && ignoreNullValue) {
return this;
}
if (value != null && value.equals(linkedValue)) {
StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(resource).append(".").append(linkedParameterName).append(".same.as.").append(parameter);
StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(linkedParameterName).append(" is same as ").append(parameter).append(".");
ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), defaultEnglishMessage.toString(), linkedParameterName, linkedValue, value);
dataValidationErrors.add(error);
}
return this;
}
public DataValidatorBuilder notNull() {
if (value == null && !ignoreNullValue) {
StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(resource).append(".").append(parameter).append(".cannot.be.blank");
StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(parameter).append(" cannot be blank.");
ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), defaultEnglishMessage.toString(), parameter);
dataValidationErrors.add(error);
}
return this;
}
public DataValidatorBuilder notBlank() {
if (value == null && ignoreNullValue) {
return this;
}
if (value == null || StringUtils.isBlank(value.toString())) {
StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(resource).append(".").append(parameter).append(".cannot.be.blank");
StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(parameter).append(" cannot be blank.");
ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), defaultEnglishMessage.toString(), parameter);
dataValidationErrors.add(error);
}
return this;
}
public DataValidatorBuilder notExceedingLengthOf(Integer maxLength) {
if (value == null && ignoreNullValue) {
return this;
}
if (value != null && value.toString().trim().length() > maxLength) {
StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(resource).append(".").append(parameter).append(".exceeds.max.length");
StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(parameter).append(" exceeds max length of ").append(maxLength).append(".");
ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), defaultEnglishMessage.toString(), parameter, maxLength, value.toString());
dataValidationErrors.add(error);
}
return this;
}
public DataValidatorBuilder inMinMaxRange(Integer min, Integer max) {
if (value == null && ignoreNullValue) {
return this;
}
if (value != null) {
Integer number = Integer.valueOf(value.toString());
if (number < min || number > max) {
StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(resource).append(".").append(parameter).append(".is.not.within.expected.range");
StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(parameter).append(" must be between ").append(min).append(" and ").append(max).append(".");
ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), defaultEnglishMessage.toString(), parameter, number, min, max);
dataValidationErrors.add(error);
}
}
return this;
}
public DataValidatorBuilder positiveAmount() {
if (value == null && ignoreNullValue) {
return this;
}
if (value != null) {
BigDecimal number = BigDecimal.valueOf(Double.valueOf(value.toString()));
if (number.compareTo(BigDecimal.ZERO) <= 0) {
StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(resource).append(".").append(parameter).append(".not.greater.than.zero");
StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(parameter).append(" must be greater than 0.");
ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), defaultEnglishMessage.toString(), parameter, number, 0);
dataValidationErrors.add(error);
}
}
return this;
}
public DataValidatorBuilder zeroOrPositiveAmount() {
if (value == null && ignoreNullValue) {
return this;
}
if (value != null) {
BigDecimal number = BigDecimal.valueOf(Double.valueOf(value.toString()));
if (number.compareTo(BigDecimal.ZERO) < 0) {
StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(resource).append(".").append(parameter).append(".not.zero.or.greater");
StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(parameter).append(" must be greater than or equal to 0.");
ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), defaultEnglishMessage.toString(), parameter, number, 0);
dataValidationErrors.add(error);
}
}
return this;
}
public DataValidatorBuilder integerGreaterThanZero() {
if (value == null && ignoreNullValue) {
return this;
}
if (value != null) {
Integer number = Integer.valueOf(value.toString());
if (number < 1) {
StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(resource).append(".").append(parameter).append(".not.greater.than.zero");
StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(parameter).append(" must be greater than 0.");
ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), defaultEnglishMessage.toString(), parameter, number, 0);
dataValidationErrors.add(error);
}
}
return this;
}
public DataValidatorBuilder arrayNotEmpty() {
if (value == null && ignoreNullValue) {
return this;
}
Object[] array = (Object[]) value;
if (ObjectUtils.isEmpty(array)) {
StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(resource).append(".").append(parameter).append(".cannot.be.empty");
StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(parameter).append(" cannot be empty. You must select at least one.");
ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), defaultEnglishMessage.toString(), parameter);
dataValidationErrors.add(error);
}
return this;
}
public DataValidatorBuilder anyOfNotNull(Object... object) {
boolean hasData = false;
for (Object obj : object) {
if (obj != null) {
hasData = true;
break;
}
}
if (!hasData) {
StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(resource).append(".no.parameters.for.update");
StringBuilder defaultEnglishMessage = new StringBuilder("No parameters passed for update.");
ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), defaultEnglishMessage.toString(), "id");
dataValidationErrors.add(error);
}
return this;
}
public DataValidatorBuilder inValidValue(String parameterValueCode, Object invalidValue) {
StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(resource).append(".").append(parameter).append(".invalid.").append(parameterValueCode);
StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(parameter).append(" has an invalid value.");
ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), defaultEnglishMessage.toString(), parameter, invalidValue);
dataValidationErrors.add(error);
return this;
}
public DataValidatorBuilder mustBeBlankWhenParameterProvided(String parameterName, Object parameterValue) {
if (value == null && ignoreNullValue) {
return this;
}
if (value == null && parameterValue != null) {
return this;
}
if (value != null && StringUtils.isBlank(value.toString()) && parameterValue != null && StringUtils.isNotBlank(parameterValue.toString())) {
return this;
}
StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(resource).append(".").append(parameter).append(".cannot.also.be.provided.when.").append(parameterName).append(".is.populated");
StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(parameter).append(" cannot also be provided when ").append(parameterName).append(" is populated.");
ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), defaultEnglishMessage.toString(), parameter, value, parameterName, parameterValue);
dataValidationErrors.add(error);
return this;
}
public DataValidatorBuilder comapareMinimumAndMaximumAmounts(BigDecimal minimumBalance,BigDecimal maximumBalance){
if(minimumBalance!=null&&maximumBalance!=null)
if(maximumBalance.compareTo(minimumBalance)==-1){
StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(resource).append(".minimum.amount.should.lessthan.maximun.amount");
StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(" minimum amount ").append(minimumBalance).append(" should less than maximum amount ").append(maximumBalance).append(".");
ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), defaultEnglishMessage.toString(), parameter, minimumBalance, maximumBalance);
dataValidationErrors.add(error);
return this;
}
return this;
}
public DataValidatorBuilder comapareMinAndMaxOfTwoBigDecmimalNos(BigDecimal min,BigDecimal max){
if(min!=null&&max!=null)
if(max.compareTo(min)==-1){
StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(resource).append(".min.number.should.lessthan.max.number");
StringBuilder defaultEnglishMessage = new StringBuilder("The ").append(" min number ").append(min).append(" should less than max number ").append(max).append(".");
ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(), defaultEnglishMessage.toString(), parameter, min, max);
dataValidationErrors.add(error);
return this;
}
return this;
}
}
@@ -1,17 +0,0 @@
package org.mifosng.platform;
import java.sql.SQLException;
public class InvalidSqlException extends RuntimeException {
private final String sql;
public InvalidSqlException(SQLException e, String sql) {
super(e);
this.sql = sql;
}
public String getSql() {
return sql;
}
}
@@ -1,32 +0,0 @@
package org.mifosng.platform;
import java.util.List;
import java.util.Map;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.StreamingOutput;
import org.mifosng.platform.api.data.AdditionalFieldsSetData;
import org.mifosng.platform.api.data.GenericResultsetData;
public interface ReadExtraDataAndReportingService {
StreamingOutput retrieveReportCSV(String name, String type,
Map<String, String> extractedQueryParams);
// @PreAuthorize(value = "hasAnyRole('REPORTING_SUPER_USER_ROLE')")
GenericResultsetData retrieveGenericResultset(String name, String type,
Map<String, String> extractedQueryParams);
List<AdditionalFieldsSetData> retrieveExtraDatasetNames(String type);
GenericResultsetData retrieveExtraData(String type, String set, Long id);
void updateExtraData(String type, String set, Long id,
Map<String, String> queryParams);
Response processPentahoRequest(String reportName, String outputType,
Map<String, String> queryParams);
String getReportType(String reportName);
}
@@ -1,845 +0,0 @@
package org.mifosng.platform;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.Connection;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.sql.DataSource;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.StreamingOutput;
import org.apache.commons.lang.StringUtils;
import org.mifosng.platform.api.data.AdditionalFieldsSetData;
import org.mifosng.platform.api.data.GenericResultsetData;
import org.mifosng.platform.api.data.ResultsetColumnHeader;
import org.mifosng.platform.api.data.ResultsetDataRow;
import org.mifosng.platform.exceptions.AdditionalFieldsNotFoundException;
import org.mifosng.platform.exceptions.PlatformDataIntegrityException;
import org.mifosng.platform.exceptions.ReportNotFoundException;
import org.mifosng.platform.infrastructure.TenantAwareRoutingDataSource;
import org.pentaho.reporting.engine.classic.core.ClassicEngineBoot;
import org.pentaho.reporting.engine.classic.core.MasterReport;
import org.pentaho.reporting.engine.classic.core.ReportProcessingException;
import org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PdfReportUtil;
import org.pentaho.reporting.engine.classic.core.modules.output.table.csv.CSVReportUtil;
import org.pentaho.reporting.engine.classic.core.modules.output.table.html.HtmlReportUtil;
import org.pentaho.reporting.engine.classic.core.modules.output.table.xls.ExcelReportUtil;
import org.pentaho.reporting.engine.classic.core.parameters.ParameterDefinitionEntry;
import org.pentaho.reporting.engine.classic.core.parameters.ReportParameterDefinition;
import org.pentaho.reporting.engine.classic.core.util.ReportParameterValues;
import org.pentaho.reporting.libraries.resourceloader.Resource;
import org.pentaho.reporting.libraries.resourceloader.ResourceException;
import org.pentaho.reporting.libraries.resourceloader.ResourceManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ReadExtraDataAndReportingServiceImpl implements
ReadExtraDataAndReportingService {
private final static Logger logger = LoggerFactory
.getLogger(ReadExtraDataAndReportingServiceImpl.class);
private final DataSource dataSource;
private Boolean noPentaho = false;
@Autowired
public ReadExtraDataAndReportingServiceImpl(
final TenantAwareRoutingDataSource dataSource) {
// kick off pentaho reports server
ClassicEngineBoot.getInstance().start();
noPentaho = false;
this.dataSource = dataSource;
}
@Override
public StreamingOutput retrieveReportCSV(final String name,
final String type, final Map<String, String> queryParams) {
return new StreamingOutput() {
@Override
public void write(OutputStream out) {
try {
GenericResultsetData result = retrieveGenericResultset(
name, type, queryParams);
StringBuffer sb = generateCsvFileBuffer(result);
InputStream in = new ByteArrayInputStream(sb.toString()
.getBytes("UTF-8"));
byte[] outputByte = new byte[4096];
Integer readLen = in.read(outputByte, 0, 4096);
while (readLen != -1) {
out.write(outputByte, 0, readLen);
readLen = in.read(outputByte, 0, 4096);
}
// in.close();
// out.flush();
// out.close();
} catch (Exception e) {
throw new PlatformDataIntegrityException(
"error.msg.exception.error", e.getMessage());
}
}
};
}
private static StringBuffer generateCsvFileBuffer(
GenericResultsetData result) {
StringBuffer writer = new StringBuffer();
List<ResultsetColumnHeader> columnHeaders = result.getColumnHeaders();
logger.info("NO. of Columns: " + columnHeaders.size());
Integer chSize = columnHeaders.size();
for (int i = 0; i < chSize; i++) {
writer.append('"' + columnHeaders.get(i).getColumnName() + '"');
if (i < (chSize - 1))
writer.append(",");
}
writer.append('\n');
List<ResultsetDataRow> data = result.getData();
List<String> row;
Integer rSize;
// String currCol;
String currColType;
String currVal;
logger.info("NO. of Rows: " + data.size());
for (int i = 0; i < data.size(); i++) {
row = data.get(i).getRow();
rSize = row.size();
for (int j = 0; j < rSize; j++) {
// currCol = columnHeaders.get(j).getColumnName();
currColType = columnHeaders.get(j).getColumnType();
currVal = row.get(j);
if (currVal != null) {
if (currColType.equals("DECIMAL")
|| currColType.equals("DOUBLE")
|| currColType.equals("BIGINT")
|| currColType.equals("SMALLINT")
|| currColType.equals("INT"))
writer.append(currVal);
else
writer.append('"' + currVal + '"');
}
if (j < (rSize - 1))
writer.append(",");
}
writer.append('\n');
}
return writer;
}
@Override
public GenericResultsetData retrieveGenericResultset(final String name,
final String type, final Map<String, String> queryParams) {
long startTime = System.currentTimeMillis();
logger.info("STARTING REPORT: " + name + " Type: " + type);
// AppUser currentUser = extractAuthenticatedUser();
// Collection<GrantedAuthority> permissions =
// currentUser.getAuthorities();
/*
* AppUser currentUser = extractAuthenticatedUser(); Boolean validUser =
* verifyUserDetails(currentUser);
*
* if (!validUser) { return null; }
*
* String orgId = currentUser.getOrganisation().getId().toString(); put
* back in later
*/
String sql;
if (name.equals(".")) {
sql = "select r.report_id, r.report_name, r.report_type, r.report_subtype, r.report_category,"
+ " rp.parameter_id, rp.report_parameter_name, p.parameter_name"
+ " from stretchy_report r"
+ " left join stretchy_report_parameter rp on rp.report_id = r.report_id"
+ " left join stretchy_parameter p on p.parameter_id = rp.parameter_id"
+ " order by r.report_name, rp.parameter_id";
} else {
sql = getSQLtoRun(name, type, queryParams);
}
GenericResultsetData result = fillReportingGenericResultSet(sql);
long elapsed = System.currentTimeMillis() - startTime;
logger.info("FINISHING Report/Request Name: " + name + " - " + type
+ " Elapsed Time: " + elapsed);
return result;
}
private GenericResultsetData fillReportingGenericResultSet(final String sql) {
GenericResultsetData result = new GenericResultsetData();
Connection db_connection = null;
Statement db_statement = null;
try {
db_connection = dataSource.getConnection();
db_statement = db_connection.createStatement();
ResultSet rs = db_statement.executeQuery(sql);
ResultSetMetaData rsmd = rs.getMetaData();
String columnName = null;
String columnValue = null;
List<ResultsetColumnHeader> columnHeaders = new ArrayList<ResultsetColumnHeader>();
for (int i = 0; i < rsmd.getColumnCount(); i++) {
ResultsetColumnHeader rsch = new ResultsetColumnHeader();
rsch.setColumnName(rsmd.getColumnName(i + 1));
rsch.setColumnType(rsmd.getColumnTypeName(i + 1));
columnHeaders.add(rsch);
}
result.setColumnHeaders(columnHeaders);
List<ResultsetDataRow> resultsetDataRows = new ArrayList<ResultsetDataRow>();
ResultsetDataRow resultsetDataRow;
while (rs.next()) {
resultsetDataRow = new ResultsetDataRow();
List<String> columnValues = new ArrayList<String>();
for (int i = 0; i < rsmd.getColumnCount(); i++) {
columnName = rsmd.getColumnName(i + 1);
columnValue = rs.getString(columnName);
columnValues.add(columnValue);
}
resultsetDataRow.setRow(columnValues);
resultsetDataRows.add(resultsetDataRow);
}
result.setData(resultsetDataRows);
} catch (SQLException e) {
throw new PlatformDataIntegrityException("error.msg.sql.error",
e.getMessage(), "Sql: " + sql);
} finally {
dbClose(db_statement, db_connection);
}
return result;
}
private String getSQLtoRun(final String name, final String type,
final Map<String, String> queryParams) {
String sql = null;
if (type.equals("report")) {
sql = getReportSql(name);
} else {
sql = getParameterSql(name);
}
Set<String> keys = queryParams.keySet();
for (String key : keys) {
String pValue = queryParams.get(key);
// logger.info("(" + key + " : " + pValue + ")");
sql = replace(sql, key, pValue);
}
// wrap sql to prevent JDBC sql errors and also prevent malicious sql
sql = "select x.* from (" + sql + ") x";
return sql;
}
// private Boolean verifyUserDetails(AppUser usr) {
//
// // some logs to be taken out after testing
// String idDetails = usr.getId() + ", " + usr.getLastname() + ", "
// + usr.getFirstname();
// logger.info("Id: " + idDetails + " Organisation: "
// + usr.getOrganisation().getId() + " Office: "
// + usr.getOffice().getId() + " Role Names: "
// + usr.getRoleNames());
// String otherDetails = "Head Officer User? " + usr.isHeadOfficeUser()
// + " Enabled: " + usr.isEnabled();
// logger.info(otherDetails);
// if (usr.getAuthorities() != null) {
// // for (GrantedAuthority grantedAuthority : usr.getAuthorities()) {
// // logger.info("Granted Authority: " +
// // grantedAuthority.getAuthority());
// // }
// }
// logger.info("");
//
// // some checks
// if (usr.getOrganisation().getId() == null) {
// logger.info("Organisation ID not Found");
// return false;
// }
//
// return true;
// }
private String getReportSql(String reportName) {
String sql = "select report_sql as the_sql from stretchy_report where report_name = '"
+ reportName + "'";
return getSql(sql);
}
private String getParameterSql(String parameterName) {
String sql = "select parameter_sql as the_sql from stretchy_parameter where parameter_name = '"
+ parameterName + "'";
return getSql(sql);
}
private String getSql(String inputSql) {
String sql = null;
Connection db_connection = null;
Statement db_statement = null;
try {
db_connection = dataSource.getConnection();
db_statement = db_connection.createStatement();
ResultSet rs = db_statement.executeQuery(inputSql);
if (rs.next()) {
sql = rs.getString("the_sql");
} else {
throw new ReportNotFoundException(inputSql);
}
} catch (SQLException e) {
throw new PlatformDataIntegrityException("error.msg.sql.error",
e.getMessage(), "Input Sql: " + inputSql);
} finally {
dbClose(db_statement, db_connection);
}
return sql;
}
@Override
public List<AdditionalFieldsSetData> retrieveExtraDatasetNames(String type) {
List<AdditionalFieldsSetData> additionalFieldsSets = new ArrayList<AdditionalFieldsSetData>();
Connection db_connection = null;
Statement db_statement = null;
try {
db_connection = dataSource.getConnection();
db_statement = db_connection.createStatement();
String whereClause;
if (type == null) {
whereClause = "";
} else {
whereClause = "where t.`name` = '" + type + "'";
}
String sql = "select d.id, d.`name` as 'set', t.`name` as 'type' from stretchydata_dataset d join stretchydata_datasettype t on t.id = d.datasettype_id "
+ whereClause + " order by d.`name`";
ResultSet rs = db_statement.executeQuery(sql);
while (rs.next()) {
additionalFieldsSets.add(new AdditionalFieldsSetData(rs
.getInt("id"), rs.getString("set"), rs
.getString("type")));
}
} catch (SQLException e) {
throw new PlatformDataIntegrityException("error.msg.sql.error",
e.getMessage(), "Additional Fields Type: " + type);
} finally {
dbClose(db_statement, db_connection);
}
return additionalFieldsSets;
}
@Override
public GenericResultsetData retrieveExtraData(String type, String set,
Long id) {
long startTime = System.currentTimeMillis();
GenericResultsetData result = fillExtraDataGenericResultSet(type, set,
id);
long elapsed = System.currentTimeMillis() - startTime;
logger.info("FINISHING SET: " + set + " Elapsed Time: " + elapsed);
return result;
}
private GenericResultsetData fillExtraDataGenericResultSet(String type,
String set, Long id) {
GenericResultsetData result = new GenericResultsetData();
Connection db_connection = null;
Statement db_statement1 = null;
Statement db_statement2 = null;
Statement db_statement3 = null;
try {
db_connection = dataSource.getConnection();
db_statement1 = db_connection.createStatement();
String sql = "select f.`name`, f.data_type, f.data_length, f.display_type, f.allowed_list_id from stretchydata_datasettype t join stretchydata_dataset d on d.datasettype_id = t.id join stretchydata_dataset_fields f on f.dataset_id = d.id where d.`name` = '"
+ set + "' and t.`name` = '" + type + "' order by f.id";
ResultSet rsmd = db_statement1.executeQuery(sql);
if (rsmd.next()) {
String fullDatasetName = getFullDatasetName(type, set);
db_statement2 = db_connection.createStatement();
List<ResultsetColumnHeader> columnHeaders = new ArrayList<ResultsetColumnHeader>();
Boolean firstColumn = true;
Integer allowedListId;
String selectFieldList = "";
String selectFieldSeparator = "";
do {
ResultsetColumnHeader rsch = new ResultsetColumnHeader();
rsch.setColumnName(rsmd.getString("name"));
if (firstColumn) {
selectFieldSeparator = " ";
firstColumn = false;
} else {
selectFieldSeparator = ", ";
}
selectFieldList += selectFieldSeparator + "s.`"
+ rsch.getColumnName() + "`";
rsch.setColumnType(rsmd.getString("data_type"));
if (rsmd.getInt("data_length") > 0)
rsch.setColumnLength(rsmd.getInt("data_length"));
rsch.setColumnDisplayType(rsmd.getString("display_type"));
allowedListId = rsmd.getInt("allowed_list_id");
if (allowedListId > 0) {
// logger.info("allowedListId != null: Column: " +
// rsch.getColumnName());
sql = "select v.`name` from stretchydata_allowed_value v where allowed_list_id = "
+ allowedListId + " order by id";
ResultSet rsValues = db_statement2.executeQuery(sql);
while (rsValues.next()) {
rsch.getColumnValues().add(
rsValues.getString("name"));
}
}
columnHeaders.add(rsch);
} while (rsmd.next());
result.setColumnHeaders(columnHeaders);
sql = "select " + selectFieldList + " from `" + type
+ "` t left join `" + fullDatasetName
+ "` s on s.id = t.id " + " where t.id = " + id;
db_statement3 = db_connection.createStatement();
ResultSet rs = db_statement3.executeQuery(sql);
if (rs.next()) {
String columnName = null;
String columnValue = null;
List<ResultsetDataRow> resultsetDataRows = new ArrayList<ResultsetDataRow>();
ResultsetDataRow resultsetDataRow;
do {
resultsetDataRow = new ResultsetDataRow();
List<String> columnValues = new ArrayList<String>();
for (int i = 0; i < columnHeaders.size(); i++) {
columnName = columnHeaders.get(i).getColumnName();
columnValue = rs.getString(columnName);
columnValues.add(columnValue);
}
resultsetDataRow.setRow(columnValues);
resultsetDataRows.add(resultsetDataRow);
} while (rs.next());
result.setData(resultsetDataRows);
} else {
throw new AdditionalFieldsNotFoundException(type, id);
}
} else {
throw new AdditionalFieldsNotFoundException(type, set);
}
} catch (SQLException e) {
throw new PlatformDataIntegrityException("error.msg.sql.error",
e.getMessage(), "Additional Fields Type: " + type
+ " Set: " + set + " Id: " + id);
} finally {
dbClose(db_statement2, null);
dbClose(db_statement3, null);
dbClose(db_statement1, db_connection);
}
return result;
}
private String getFullDatasetName(final String type, final String set) {
return type + "_extra_" + set;
}
private static String replace(String str, String pattern, String replace) {
int s = 0;
int e = 0;
StringBuffer result = new StringBuffer();
while ((e = str.indexOf(pattern, s)) >= 0) {
result.append(str.substring(s, e));
result.append(replace);
s = e + pattern.length();
}
result.append(str.substring(s));
return result.toString();
}
@Override
public void updateExtraData(String type, String set, Long id,
Map<String, String> queryParams) {
logger.info("updateExtraData - type: " + type + " set: " + set
+ " id: " + id);
checkResourceTypeThere(type, set);
String fullDatasetName = getFullDatasetName(type, set);
String transType = getTransType(type, fullDatasetName, id);
String saveSql = getSaveSql(fullDatasetName, id, transType, queryParams);
logger.info("saveSQL: " + saveSql);
Connection db_connection = null;
Statement db_statement = null;
try {
db_connection = dataSource.getConnection();
db_statement = db_connection.createStatement();
db_statement.executeUpdate(saveSql);
} catch (SQLException e) {
throw new PlatformDataIntegrityException("error.msg.sql.error",
e.getMessage(), "Additional Fields Type: " + type
+ " Set: " + set + " Id: " + id);
} finally {
dbClose(db_statement, db_connection);
}
}
private void checkResourceTypeThere(String type, String set) {
String sql = "select 'f' from stretchydata_datasettype t join stretchydata_dataset d on d.datasettype_id = t.id where d.`name` = '"
+ set + "' and t.`name` = '" + type + "'";
Connection db_connection = null;
Statement db_statement = null;
try {
db_connection = dataSource.getConnection();
db_statement = db_connection.createStatement();
ResultSet rs = db_statement.executeQuery(sql);
if (!(rs.next())) {
throw new AdditionalFieldsNotFoundException(type, set);
}
} catch (SQLException e) {
throw new PlatformDataIntegrityException("error.msg.sql.error",
e.getMessage(), "Additional Fields Type: " + type
+ " Set: " + set + " Sql: " + sql);
} finally {
dbClose(db_statement, db_connection);
}
}
private String getTransType(String type, String fullDatasetName, Long id) {
String transType = null;
String sql = "select s.id from `" + type + "` t left join `"
+ fullDatasetName + "` s on s.id = t.id where t.id = " + id;
Connection db_connection = null;
Statement db_statement = null;
try {
db_connection = dataSource.getConnection();
db_statement = db_connection.createStatement();
ResultSet rs = db_statement.executeQuery(sql);
if (rs.next()) {
String idValue = rs.getString("id");
if (idValue != null) {
transType = "E";
} else {
transType = "A";
}
} else {
throw new AdditionalFieldsNotFoundException(type, id);
}
} catch (SQLException e) {
throw new PlatformDataIntegrityException("error.msg.sql.error",
e.getMessage(), "Additional Fields Type: " + type
+ " Full Set Name: " + fullDatasetName
+ " Sql: " + sql);
} finally {
dbClose(db_statement, db_connection);
}
return transType;
}
private String getSaveSql(String fullSetName, Long id, String transType,
Map<String, String> queryParams) {
String pValue = "";
String pValueWrite = "";
String saveSql = "";
String singleQuote = "'";
String underscore = "_";
String space = " ";
Set<String> keys = queryParams.keySet();
if (transType.equals("E")) {
boolean firstColumn = true;
saveSql = "update `" + fullSetName + "` ";
for (String key : keys) {
if (!(key.equalsIgnoreCase("id"))) {
if (firstColumn) {
saveSql += " set ";
firstColumn = false;
} else {
saveSql += ", ";
}
pValue = queryParams.get(key);
if (pValue == null || pValue.equals("")) {
pValueWrite = "null";
} else {
pValueWrite = singleQuote
+ replace(pValue, singleQuote, singleQuote
+ singleQuote) + singleQuote;
}
saveSql += "`" + replace(key, underscore, space) + "` = "
+ pValueWrite;
}
}
saveSql += " where id = " + id;
} else {
String insertColumns = "";
String selectColumns = "";
String columnName = "";
for (String key : keys) {
pValue = queryParams.get(key);
if (!(key.equalsIgnoreCase("id"))) {
pValue = queryParams.get(key);
if (pValue == null || pValue.equals("")) {
pValueWrite = "null";
} else {
pValueWrite = singleQuote
+ replace(pValue, singleQuote, singleQuote
+ singleQuote) + singleQuote;
}
columnName = "`" + replace(key, underscore, space) + "`";
insertColumns += ", " + columnName;
selectColumns += "," + pValueWrite + " as " + columnName;
}
}
saveSql = "insert into `" + fullSetName + "` (id" + insertColumns
+ ")" + " select " + id + " as id" + selectColumns;
}
return saveSql;
}
@Override
public String getReportType(String reportName) {
String sql = "SELECT ifnull(report_type,'') as report_type FROM `stretchy_report` where report_name = '"
+ reportName + "'";
String reportType = "";
logger.info("get reportType: " + sql);
Connection db_connection = null;
Statement db_statement = null;
ResultSet rs = null;
try {
db_connection = dataSource.getConnection();
db_statement = db_connection.createStatement();
rs = db_statement.executeQuery(sql);
if (rs.next()) {
reportType = rs.getString("report_type");
} else {
throw new ReportNotFoundException(sql);
}
} catch (SQLException e) {
throw new PlatformDataIntegrityException("error.msg.sql.error",
e.getMessage(), "Report Name: " + reportName + " Sql: "
+ sql);
} finally {
dbClose(db_statement, db_connection);
}
return reportType;
}
private void dbClose(Statement db_statement, Connection db_connection) {
logger.info("dbClose");
try {
if (db_statement != null) {
db_statement.close();
db_statement = null;
}
if (db_connection != null) {
db_connection.close();
db_connection = null;
}
} catch (SQLException e) {
throw new PlatformDataIntegrityException("error.msg.sql.error",
e.getMessage(), "Error closing database connection");
}
}
@Override
public Response processPentahoRequest(String reportName,
String outputTypeParam, Map<String, String> queryParams) {
String outputType = "HTML";
if (StringUtils.isNotBlank(outputTypeParam))
outputType = outputTypeParam;
if (!(outputType.equalsIgnoreCase("HTML")
|| outputType.equalsIgnoreCase("PDF")
|| outputType.equalsIgnoreCase("XLS") || outputType
.equalsIgnoreCase("CSV")))
throw new PlatformDataIntegrityException(
"error.msg.invalid.outputType", "No matching Output Type: "
+ outputType);
if (noPentaho)
throw new PlatformDataIntegrityException("error.msg.no.pentaho",
"Pentaho is not enabled", "Pentaho is not enabled");
// TODO - use pentaho location finder like Pawel does in Mifos
// String reportPath =
// "C:\\dev\\apache-tomcat-7.0.25\\webapps\\ROOT\\PentahoReports\\"
// + reportName + ".prpt";
String reportPath = "/var/lib/tomcat7/webapps/ROOT/PentahoReports/"
+ reportName + ".prpt";
logger.info("Report path: " + reportPath);
// load report definition
ResourceManager manager = new ResourceManager();
manager.registerDefaults();
Resource res;
logger.info("outputType: " + outputType);
try {
res = manager.createDirectly(reportPath, MasterReport.class);
MasterReport masterReport = (MasterReport) res.getResource();
addParametersToReport(masterReport, queryParams);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
if ("PDF".equalsIgnoreCase(outputType)) {
PdfReportUtil.createPDF(masterReport, baos);
return Response.ok().entity(baos.toByteArray())
.type("application/pdf").build();
}
if ("XLS".equalsIgnoreCase(outputType)) {
ExcelReportUtil.createXLS(masterReport, baos);
return Response
.ok()
.entity(baos.toByteArray())
.type("application/vnd.ms-excel")
.header("Content-Disposition",
"attachment;filename="
+ reportName.replaceAll(" ", "")
+ ".xls").build();
}
if ("CSV".equalsIgnoreCase(outputType)) {
CSVReportUtil.createCSV(masterReport, baos, "UTF-8");
return Response
.ok()
.entity(baos.toByteArray())
.type("application/x-msdownload")
.header("Content-Disposition",
"attachment;filename="
+ reportName.replaceAll(" ", "")
+ ".csv").build();
}
if ("HTML".equalsIgnoreCase(outputType)) {
HtmlReportUtil.createStreamHTML(masterReport, baos);
return Response.ok().entity(baos.toByteArray())
.type("text/html").build();
}
} catch (ResourceException e) {
throw new PlatformDataIntegrityException(
"error.msg.reporting.error", e.getMessage());
} catch (ReportProcessingException e) {
throw new PlatformDataIntegrityException(
"error.msg.reporting.error", e.getMessage());
} catch (IOException e) {
throw new PlatformDataIntegrityException(
"error.msg.reporting.error", e.getMessage());
}
throw new PlatformDataIntegrityException(
"error.msg.invalid.outputType", "No matching Output Type: "
+ outputType);
}
private void addParametersToReport(MasterReport report,
Map<String, String> queryParams) {
try {
ReportParameterValues rptParamValues = report.getParameterValues();
ReportParameterDefinition paramsDefinition = report
.getParameterDefinition();
/*
* only allow integer and string parameter types and assume all
* mandatory - could go more detailed like Pawel did in Mifos later
* and could match incoming and pentaho parameters better...
* currently assuming they come in ok... and if not an error
*/
for (ParameterDefinitionEntry paramDefEntry : paramsDefinition
.getParameterDefinitions()) {
String paramName = paramDefEntry.getName();
String pValue = queryParams.get(paramName);
if (StringUtils.isBlank(pValue))
throw new PlatformDataIntegrityException(
"error.msg.reporting.error", "Pentaho Parameter: "
+ paramName + " - not Provided");
Class<?> clazz = paramDefEntry.getValueType();
logger.info("addParametersToReport(" + paramName + " : "
+ pValue + " : " + clazz.getCanonicalName() + ")");
if (clazz.getCanonicalName().equalsIgnoreCase(
"java.lang.Integer"))
rptParamValues.put(paramName, Integer.parseInt(pValue));
else if (clazz.getCanonicalName().equalsIgnoreCase(
"java.sql.Date"))
rptParamValues.put(paramName, Date.valueOf(pValue));
else
rptParamValues.put(paramName, pValue);
}
} catch (Exception e) {
throw new PlatformDataIntegrityException(
"error.msg.reporting.error", e.getMessage());
}
}
}
@@ -1,23 +0,0 @@
package org.mifosng.platform;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import org.mifosng.platform.client.domain.Client;
import org.mifosng.platform.loan.domain.Loan;
import org.springframework.data.jpa.domain.Specification;
public final class Specifications {
public static Specification<Loan> loansThatMatch(final Client client) {
return new Specification<Loan>() {
@Override
public Predicate toPredicate(final Root<Loan> root, final CriteriaQuery<?> query, final CriteriaBuilder cb) {
return cb.equal(root.get("client"), client);
}
};
}
}
@@ -1,142 +0,0 @@
package org.mifosng.platform.api;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriInfo;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import org.mifosng.platform.InvalidSqlException;
import org.mifosng.platform.ReadExtraDataAndReportingService;
import org.mifosng.platform.api.data.AdditionalFieldsSetData;
import org.mifosng.platform.api.data.ApiParameterError;
import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.GenericResultsetData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.exceptions.PlatformApiDataValidationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/additionalfields")
@Component
@Scope("singleton")
public class AdditionalFieldsApiResource {
private final static Logger logger = LoggerFactory.getLogger(AdditionalFieldsApiResource.class);
@Autowired
private ReadExtraDataAndReportingService readExtraDataAndReportingService;
@Autowired
private ApiDataConversionService apiDataConversionService;
@GET
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String datasets(@QueryParam("type") final String type, @Context final UriInfo uriInfo) {
List<AdditionalFieldsSetData> result = this.readExtraDataAndReportingService.retrieveExtraDatasetNames(type);
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
return this.apiDataConversionService.convertAdditionalFieldsSetDataToJson(prettyPrint, result.toArray(new AdditionalFieldsSetData[result.size()]));
}
@GET
@Path("{type}/{set}/{id}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String extraData(@PathParam("type") final String type,
@PathParam("set") final String set, @PathParam("id") final Long id,
@Context final UriInfo uriInfo) {
try {
GenericResultsetData result = this.readExtraDataAndReportingService.retrieveExtraData(type, set, id);
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
return this.apiDataConversionService.convertGenericResultsetDataToJson(prettyPrint, result);
} catch (InvalidSqlException e) {
List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
ApiParameterError error = ApiParameterError.parameterError(
"extradata.invalid.sql", "The sql is invalid.", "sql",
e.getSql());
dataValidationErrors.add(error);
throw new PlatformApiDataValidationException(
"validation.msg.validation.errors.exist",
"Validation errors exist.", dataValidationErrors);
}
}
@POST
@Path("{type}/{set}/{id}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response saveExtraData(@PathParam("type") final String type,
@PathParam("set") final String set, @PathParam("id") final Long id,
final String jsonRequestBody) {
try {
Map<String, String> queryParams = new HashMap<String, String>();
String pValue = "";
String pName;
try {
JSONObject jsonObj = new JSONObject(jsonRequestBody);
JSONArray jsonArr = jsonObj.names();
if (jsonArr != null) {
for (int i = 0; i < jsonArr.length(); i++) {
pName = (String) jsonArr.get(i);
pValue = jsonObj.getString(pName);
logger.info(pName + " - " + pValue);
queryParams.put(pName, pValue);
}
} else {
throw new WebApplicationException(Response
.status(Status.BAD_REQUEST)
.entity("JSON body empty").build());
}
} catch (JSONException e) {
throw new WebApplicationException(Response
.status(Status.BAD_REQUEST)
.entity("JSON body is wrong").build());
}
this.readExtraDataAndReportingService.updateExtraData(type, set,
id, queryParams);
EntityIdentifier entityIdentifier = new EntityIdentifier(
Long.valueOf(id));
return Response.ok().entity(entityIdentifier).build();
} catch (InvalidSqlException e) {
List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
ApiParameterError error = ApiParameterError.parameterError(
"extradata.invalid.sql", "The sql is invalid.", "sql",
e.getSql());
dataValidationErrors.add(error);
throw new PlatformApiDataValidationException(
"validation.msg.validation.errors.exist",
"Validation errors exist.", dataValidationErrors);
}
}
}
@@ -1,66 +0,0 @@
package org.mifosng.platform.api;
import java.util.ArrayList;
import java.util.Collection;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.mifosng.platform.api.data.AuthenticatedUserData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
import org.mifosng.platform.user.domain.AppUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.stereotype.Component;
import com.sun.jersey.core.util.Base64;
@Path("/authentication")
@Component
@Scope("singleton")
public class AuthenticationApiResource {
@Qualifier("customAuthenticationProvider")
@Autowired
private DaoAuthenticationProvider customAuthenticationProvider;
@Autowired
private ApiDataConversionService apiDataConversionService;
@POST
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String authenticate(@QueryParam("username") final String username, @QueryParam("password") final String password) {
Authentication authentication = new UsernamePasswordAuthenticationToken(username, password);
Authentication authenticationCheck = customAuthenticationProvider.authenticate(authentication);
Collection<String> permissions = new ArrayList<String>();
AuthenticatedUserData authenticatedUserData = new AuthenticatedUserData(permissions);
authenticatedUserData.setUsername(username);
if (authenticationCheck.isAuthenticated()) {
Collection<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>(authenticationCheck.getAuthorities());
for (GrantedAuthority grantedAuthority : authorities) {
permissions.add(grantedAuthority.getAuthority());
}
authenticatedUserData.setPermissions(permissions);
authenticatedUserData.setAuthenticated(true);
AppUser principal = (AppUser) authenticationCheck.getPrincipal();
authenticatedUserData.setUserId(principal.getId());
byte[] base64EncodedAuthenticationKey = Base64.encode(username + ":" + password);
authenticatedUserData.setBase64EncodedAuthenticationKey(new String(base64EncodedAuthenticationKey));
}
return this.apiDataConversionService.convertAuthenticatedUserDataToJson(false, authenticatedUserData);
}
}
@@ -1,310 +0,0 @@
package org.mifosng.platform.api;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.apache.commons.lang.StringUtils;
import org.mifosng.platform.api.commands.ClientCommand;
import org.mifosng.platform.api.commands.NoteCommand;
import org.mifosng.platform.api.data.ClientData;
import org.mifosng.platform.api.data.ClientLoanAccountSummaryCollectionData;
import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.NoteData;
import org.mifosng.platform.api.data.OfficeLookup;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.client.service.ClientReadPlatformService;
import org.mifosng.platform.client.service.ClientWritePlatformService;
import org.mifosng.platform.organisation.service.OfficeReadPlatformService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/clients")
@Component
@Scope("singleton")
public class ClientsApiResource {
private final static Logger logger = LoggerFactory.getLogger(ClientsApiResource.class);
@Autowired
private ClientReadPlatformService clientReadPlatformService;
@Autowired
private ClientWritePlatformService clientWritePlatformService;
@Autowired
private ApiDataConversionService apiDataConversionService;
@Autowired
private OfficeReadPlatformService officeReadPlatformService;
@GET
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveAllIndividualClients(@Context final UriInfo uriInfo,
@QueryParam("sqlSearch") final String sqlSearch,
@QueryParam("officeId") final Integer officeId,
@QueryParam("externalId") final String externalId,
@QueryParam("displayName") final String displayName,
@QueryParam("firstName") final String firstName,
@QueryParam("lastName") final String lastName) {
final String extraCriteria = getClientCriteria(sqlSearch, officeId, externalId, displayName, firstName, lastName);
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "officeId", "officeName", "externalId", "firstname", "lastname", "joinedDate", "displayName")
);
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
Collection<ClientData> clients = this.clientReadPlatformService.retrieveAllIndividualClients(extraCriteria);
return this.apiDataConversionService.convertClientDataToJson(prettyPrint, responseParameters, clients.toArray(new ClientData[clients.size()]));
}
private String getClientCriteria(String sqlSearch, Integer officeId,
String externalId, String displayName, String firstName,
String lastName) {
String extraCriteria = "";
if (sqlSearch != null)
extraCriteria = " and (" + sqlSearch + ")";
if (officeId != null)
extraCriteria += " and office_id = " + officeId;
if (externalId != null)
extraCriteria += " and external_id like "
+ sqlEncodeString(externalId);
if (displayName != null)
extraCriteria += " and concat(ifnull(firstname, ''), if(firstname > '',' ', '') , ifnull(lastname, '')) like "
+ sqlEncodeString(displayName);
if (firstName != null)
extraCriteria += " and firstname like "
+ sqlEncodeString(firstName);
if (lastName != null)
extraCriteria += " and lastname like " + sqlEncodeString(lastName);
if (StringUtils.isNotBlank(extraCriteria))
extraCriteria = extraCriteria.substring(4);
logger.info("extraCriteria; " + extraCriteria);
return extraCriteria;
}
private String sqlEncodeString(String str) {
String singleQuote = "'";
String twoSingleQuotes = "''";
return singleQuote
+ StringUtils.replace(str, singleQuote, twoSingleQuotes, -1)
+ singleQuote;
}
@GET
@Path("{clientId}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveClientData(
@PathParam("clientId") final Long clientId,
@Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "officeId", "officeName", "externalId", "firstname", "lastname", "joinedDate", "displayName")
);
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters());
ClientData clientData = this.clientReadPlatformService.retrieveIndividualClient(clientId);
if (template) {
clientData.setAllowedOffices(new ArrayList<OfficeLookup>(officeReadPlatformService.retrieveAllOfficesForLookup()));
responseParameters.add("allowedOffices");
}
return this.apiDataConversionService.convertClientDataToJson(prettyPrint, responseParameters, clientData);
}
@GET
@Path("template")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String newClientDetails(@Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "officeId", "officeName", "externalId", "firstname", "lastname", "joinedDate", "displayName", "allowedOffices")
);
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
ClientData clientData = this.clientReadPlatformService.retrieveNewClientDetails();
return this.apiDataConversionService.convertClientDataToJson(prettyPrint, responseParameters, clientData);
}
@POST
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response enrollClient(final String jsonRequestBody) {
ClientCommand command = this.apiDataConversionService.convertJsonToClientCommand(null, jsonRequestBody);
Long clientId = this.clientWritePlatformService.enrollClient(command);
return Response.ok().entity(new EntityIdentifier(clientId)).build();
}
@PUT
@Path("{clientId}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response updateClient(@PathParam("clientId") final Long clientId, final String jsonRequestBody) {
ClientCommand command = this.apiDataConversionService.convertJsonToClientCommand(clientId, jsonRequestBody);
EntityIdentifier identifier = this.clientWritePlatformService.updateClientDetails(command);
return Response.ok().entity(identifier).build();
}
@DELETE
@Path("{clientId}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response deleteClient(@PathParam("clientId") final Long clientId) {
this.clientWritePlatformService.deleteClient(clientId);
return Response.ok(new EntityIdentifier(clientId)).build();
}
@GET
@Path("{clientId}/loans")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveClientAccount(@PathParam("clientId") final Long clientId,
@Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("pendingApprovalLoans", "awaitingDisbursalLoans", "openLoans", "closedLoans",
"anyLoanCount", "pendingApprovalLoanCount", "awaitingDisbursalLoanCount", "activeLoanCount", "closedLoanCount")
);
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
ClientLoanAccountSummaryCollectionData clientAccount = this.clientReadPlatformService.retrieveClientAccountDetails(clientId);
return this.apiDataConversionService.convertClientLoanAccountSummaryCollectionDataToJson(prettyPrint, responseParameters, clientAccount);
}
@GET
@Path("{clientId}/notes")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveAllClientNotes(@PathParam("clientId") final Long clientId, @Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "clientId", "loanId", "loanTransactionId", "noteType", "note", "createdById", "createdByUsername",
"createdOn", "updatedById", "updatedByUsername", "updatedOn")
);
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
Collection<NoteData> notes = this.clientReadPlatformService.retrieveAllClientNotes(clientId);
return this.apiDataConversionService.convertNoteDataToJson(prettyPrint, responseParameters, notes.toArray(new NoteData[notes.size()]));
}
@POST
@Path("{clientId}/notes")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response addNewClientNote(@PathParam("clientId") final Long clientId, final String jsonRequestBody) {
NoteCommand command = this.apiDataConversionService.convertJsonToNoteCommand(null, clientId, jsonRequestBody);
EntityIdentifier identifier = this.clientWritePlatformService.addClientNote(command);
return Response.ok().entity(identifier).build();
}
@GET
@Path("{clientId}/notes/{noteId}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveClientNote(
@PathParam("clientId") final Long clientId,
@PathParam("noteId") final Long noteId,
@Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "clientId", "loanId", "loanTransactionId", "noteType", "note", "createdById", "createdByUsername",
"createdOn", "updatedById", "updatedByUsername", "updatedOn")
);
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
NoteData note = this.clientReadPlatformService.retrieveClientNote(clientId, noteId);
return this.apiDataConversionService.convertNoteDataToJson(prettyPrint, responseParameters, note);
}
@PUT
@Path("{clientId}/notes/{noteId}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response updateClientNote(
@PathParam("clientId") final Long clientId,
@PathParam("noteId") final Long noteId, final String jsonRequestBody) {
NoteCommand command = this.apiDataConversionService.convertJsonToNoteCommand(noteId, clientId, jsonRequestBody);
EntityIdentifier identifier = this.clientWritePlatformService.updateNote(command);
return Response.ok().entity(identifier).build();
}
}
@@ -1,73 +0,0 @@
package org.mifosng.platform.api;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.commands.OrganisationCurrencyCommand;
import org.mifosng.platform.api.data.ConfigurationData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.configuration.service.ConfigurationReadPlatformService;
import org.mifosng.platform.configuration.service.ConfigurationWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/configurations")
@Component
@Scope("singleton")
public class ConfigurationApiResource {
@Autowired
private ConfigurationReadPlatformService configurationReadPlatformService;
@Autowired
private ConfigurationWritePlatformService configurationWritePlatformService;
@Autowired
private ApiDataConversionService apiDataConversionService;
@GET
@Path("currency")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveCurrencyDataForConfiguration(@Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("selectedCurrencyOptions", "currencyOptions"));
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
ConfigurationData configurationData = this.configurationReadPlatformService.retrieveCurrencyConfiguration();
return this.apiDataConversionService.convertConfigurationDataToJson(prettyPrint, responseParameters, configurationData);
}
@PUT
@Path("currency")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response updateAllowedCurrenciesForOrganisation(final String jsonRequestBody) {
OrganisationCurrencyCommand command = this.apiDataConversionService.convertJsonToOrganisationCurrencyCommand(jsonRequestBody);
this.configurationWritePlatformService.updateOrganisationCurrencies(command);
return Response.ok().entity(command).build();
}
}
@@ -1,164 +0,0 @@
package org.mifosng.platform.api;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.commands.DepositAccountCommand;
import org.mifosng.platform.api.data.CurrencyData;
import org.mifosng.platform.api.data.DepositAccountData;
import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.currency.service.CurrencyReadPlatformService;
import org.mifosng.platform.savingproduct.service.DepositAccountReadPlatformService;
import org.mifosng.platform.savingproduct.service.DepositAccountWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/depositaccounts")
@Component
@Scope("singleton")
public class DepositAccountsApiResource {
@Autowired
private DepositAccountReadPlatformService depositAccountReadPlatformService;
@Autowired
private CurrencyReadPlatformService currencyReadPlatformService;
@Autowired
private DepositAccountWritePlatformService depositAccountWritePlatformService;
@Autowired
private ApiDataConversionService apiDataConversionService;
@POST
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response createDepositAccount(final String jsonRequestBody){
final DepositAccountCommand command = this.apiDataConversionService.convertJsonToDepositAccountCommand(null, jsonRequestBody);
EntityIdentifier entityIdentifier = this.depositAccountWritePlatformService.createDepositAccount(command);
return Response.ok().entity(entityIdentifier).build();
}
@PUT
@Path("{accountId}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response updateSavingProduct(@PathParam("accountId") final Long accountId, final String jsonRequestBody){
final DepositAccountCommand command = this.apiDataConversionService.convertJsonToDepositAccountCommand(accountId, jsonRequestBody);
EntityIdentifier entityIdentifier = this.depositAccountWritePlatformService.updateDepositAccount(command);
return Response.ok().entity(entityIdentifier).build();
}
@GET
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveAllDepositAccounts(@Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("createdOn", "lastModifedOn",
"id", "clientId", "clientName", "productId", "productName",
"currency", "deposit", "maturityInterestRate")
);
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
Collection<DepositAccountData> accounts = this.depositAccountReadPlatformService.retrieveAllDepositAccounts();
return this.apiDataConversionService.convertDepositAccountDataToJson(prettyPrint, responseParameters, accounts.toArray(new DepositAccountData[accounts.size()]));
}
@GET
@Path("{accountId}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveDepositAccount(@PathParam("accountId") final Long accountId, @Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("createdOn", "lastModifedOn",
"id", "clientId", "clientName", "productId", "productName",
"currency", "deposit", "maturityInterestRate")
);
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
DepositAccountData account = this.depositAccountReadPlatformService.retrieveDepositAccount(accountId);
boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters());
if (template) {
responseParameters.addAll(Arrays.asList("currencyOptions"));
List<CurrencyData> allowedCurrencies = this.currencyReadPlatformService.retrieveAllowedCurrencies();
account = new DepositAccountData(account, allowedCurrencies);
}
return this.apiDataConversionService.convertDepositAccountDataToJson(prettyPrint, responseParameters, account);
}
@GET
@Path("template")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveNewDepositAccountDetails(@Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("createdOn", "lastModifedOn",
"id", "clientId", "clientName", "productId", "productName",
"currency", "deposit", "maturityInterestRate", "currencyOptions")
);
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
DepositAccountData account = this.depositAccountReadPlatformService.retrieveNewDepositAccountDetails();
List<CurrencyData> allowedCurrencies = this.currencyReadPlatformService.retrieveAllowedCurrencies();
account = new DepositAccountData(account, allowedCurrencies);
return this.apiDataConversionService.convertDepositAccountDataToJson(prettyPrint, responseParameters, account);
}
@DELETE
@Path("{accountId}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response deleteProduct(@PathParam("accountId") final Long accountId) {
this.depositAccountWritePlatformService.deleteDepositAccount(accountId);
return Response.ok(new EntityIdentifier(accountId)).build();
}
}
@@ -1,142 +0,0 @@
package org.mifosng.platform.api;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.commands.DepositProductCommand;
import org.mifosng.platform.api.data.DepositProductData;
import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.depositproduct.service.DepositProductReadPlatformService;
import org.mifosng.platform.depositproduct.service.DepositProductWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/depositproducts")
@Component
@Scope("singleton")
public class DepositProductsApiResource {
@Autowired
private DepositProductReadPlatformService depositProductReadPlatformService;
@Autowired
private DepositProductWritePlatformService depositProductWritePlatformService;
@Autowired
private ApiDataConversionService apiDataConversionService;
@POST
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response createDepositProduct(final String jsonRequestBody){
final DepositProductCommand command=this.apiDataConversionService.convertJsonToDepositProductCommand(null, jsonRequestBody);
EntityIdentifier entityIdentifier=this.depositProductWritePlatformService.createDepositProduct(command);
return Response.ok().entity(entityIdentifier).build();
}
@PUT
@Path("{productId}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response updateDepositProduct(@PathParam("productId") final Long productId, final String jsonRequestBody){
final DepositProductCommand command=this.apiDataConversionService.convertJsonToDepositProductCommand(productId, jsonRequestBody);
EntityIdentifier entityIdentifier=this.depositProductWritePlatformService.updateDepositProduct(command);
return Response.ok().entity(entityIdentifier).build();
}
@DELETE
@Path("{productId}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response deleteDepositProduct(@PathParam("productId") final Long productId) {
this.depositProductWritePlatformService.deleteDepositProduct(productId);
return Response.ok(new EntityIdentifier(productId)).build();
}
@GET
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveAllDepositProducts(@Context final UriInfo uriInfo){
Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("id", "name", "description", "createdOn", "lastModifedOn",
"currencyCode","digitsAfterDecimal","minimumBalance","maximumBalance","tenureMonths","maturityDefaultInterestRate","maturityMinInterestRate",
"maturityMaxInterestRate","canRenew","canPreClose","preClosureInterestRate"));
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
Collection<DepositProductData> products=this.depositProductReadPlatformService.retrieveAllDepositProducts();
return this.apiDataConversionService.convertDepositProductDataToJson(prettyPrint, responseParameters, products.toArray(new DepositProductData[products.size()]));
}
@GET
@Path("{productId}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveDepositProductDetails(@PathParam("productId") final Long productId, @Context final UriInfo uriInfo){
Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("id", "name", "description", "createdOn", "lastModifedOn",
"currencyCode","digitsAfterDecimal","minimumBalance","maximumBalance","tenureMonths","maturityDefaultInterestRate","maturityMinInterestRate",
"maturityMaxInterestRate","canRenew","canPreClose","preClosureInterestRate"));
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters());
if (template) {
responseParameters.addAll(Arrays.asList("currencyOptions"));
}
DepositProductData productData = this.depositProductReadPlatformService.retrieveDepositProductData(productId);
return this.apiDataConversionService.convertDepositProductDataToJson(prettyPrint, responseParameters, productData);
}
@GET
@Path("template")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveNewDepositProductDetails(@Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "name", "description", "createdOn", "lastModifedOn","currencyCode","digitsAfterDecimal", "currencyOptions","minimumBalance","maximumBalance","tenureMonths","maturityDefaultInterestRate","maturityMinInterestRate",
"maturityMaxInterestRate","canRenew","canPreClose","preClosureInterestRate"));
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
DepositProductData depositProduct = this.depositProductReadPlatformService.retrieveNewDepositProductDetails();
return this.apiDataConversionService.convertDepositProductDataToJson(prettyPrint, responseParameters, depositProduct);
}
}
@@ -1,94 +0,0 @@
package org.mifosng.platform.api;
import java.util.Collection;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.commands.FundCommand;
import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.FundData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.fund.service.FundReadPlatformService;
import org.mifosng.platform.fund.service.FundWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/funds")
@Component
@Scope("singleton")
public class FundsApiResource {
@Autowired
private FundReadPlatformService readPlatformService;
@Autowired
private FundWritePlatformService writePlatformService;
@Autowired
private ApiDataConversionService apiDataConversionService;
@GET
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveFunds(@Context final UriInfo uriInfo) {
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
Collection<FundData> funds = this.readPlatformService.retrieveAllFunds();
return this.apiDataConversionService.convertFundDataToJson(prettyPrint, responseParameters, funds.toArray(new FundData[funds.size()]));
}
@POST
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response createFund(final String jsonRequestBody) {
FundCommand command = this.apiDataConversionService.convertJsonToFundCommand(null, jsonRequestBody);
Long fundId = this.writePlatformService.createFund(command);
return Response.ok().entity(new EntityIdentifier(fundId)).build();
}
@GET
@Path("{fundId}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retreiveOffice(@PathParam("fundId") final Long fundId, @Context final UriInfo uriInfo) {
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
FundData fund = this.readPlatformService.retrieveFund(fundId);
return this.apiDataConversionService.convertFundDataToJson(prettyPrint, responseParameters, fund);
}
@PUT
@Path("{fundId}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response updateFund(@PathParam("fundId") final Long fundId, final String jsonRequestBody) {
FundCommand command = this.apiDataConversionService.convertJsonToFundCommand(fundId, jsonRequestBody);
Long entityId = this.writePlatformService.updateFund(command);
return Response.ok().entity(new EntityIdentifier(entityId)).build();
}
}
@@ -1,132 +0,0 @@
package org.mifosng.platform.api;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.commands.GroupCommand;
import org.mifosng.platform.api.data.ClientMemberData;
import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.GroupData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.group.service.GroupReadPlatformService;
import org.mifosng.platform.group.service.GroupWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/groups")
@Component
@Scope("singleton")
public class GroupsApiResource {
@Autowired
private GroupReadPlatformService groupReadPlatformService;
@Autowired
private GroupWritePlatformService groupWritePlatformService;
@Autowired
private ApiDataConversionService apiDataConversionService;
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String retrieveAllGroups(@Context final UriInfo uriInfo){
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "name", "externalId", "clientMembers")
);
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
Collection<GroupData> groups = this.groupReadPlatformService.retrieveAllGroups();
for (GroupData group : groups){
group.setClientMembers(this.groupReadPlatformService.retrieveClientMembers(group.getId()));
}
return this.apiDataConversionService.convertGroupDataToJson(prettyPrint, responseParameters, groups.toArray(new GroupData[groups.size()]));
}
@GET
@Path("{groupId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String retrieveGroupData(@PathParam("groupId") final Long groupId, @Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("id", "name", "externalId", "clientMembers"));
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo
.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
GroupData group = this.groupReadPlatformService.retrieveGroup(groupId);
Collection<ClientMemberData> clientMembers = this.groupReadPlatformService.retrieveClientMembers(groupId);
group.setClientMembers(clientMembers);
return this.apiDataConversionService.convertGroupDataToJson(prettyPrint, responseParameters, group);
}
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response createGroup(final String jsonRequestBody) {
final GroupCommand command = this.apiDataConversionService.convertJsonToGroupCommand(null, jsonRequestBody);
EntityIdentifier entityIdentifier = this.groupWritePlatformService.createGroup(command);
return Response.ok().entity(entityIdentifier).build();
}
@PUT
@Path("{groupId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response updateGroup(@PathParam("groupId") final Long groupId, final String jsonRequestBody) {
final GroupCommand command = this.apiDataConversionService.convertJsonToGroupCommand(groupId, jsonRequestBody);
EntityIdentifier entityIdentifier = this.groupWritePlatformService.updateGroup(command);
return Response.ok().entity(entityIdentifier).build();
}
@DELETE
@Path("{groupId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response deleteGroup(@PathParam("groupId") final Long groupId){
EntityIdentifier entityIdentifier = this.groupWritePlatformService.deleteGroup(groupId);
return Response.ok().entity(entityIdentifier).build();
}
}
@@ -1,155 +0,0 @@
package org.mifosng.platform.api;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.commands.LoanProductCommand;
import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.LoanProductData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.loanproduct.service.LoanProductReadPlatformService;
import org.mifosng.platform.loanproduct.service.LoanProductWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/loanproducts")
@Component
@Scope("singleton")
public class LoanProductsApiResource {
@Autowired
private LoanProductReadPlatformService loanProductReadPlatformService;
@Autowired
private LoanProductWritePlatformService loanProductWritePlatformService;
@Autowired
private ApiDataConversionService apiDataConversionService;
@POST
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response createLoanProduct(final String jsonRequestBody) {
final LoanProductCommand command = this.apiDataConversionService.convertJsonToLoanProductCommand(null, jsonRequestBody);
EntityIdentifier entityIdentifier = this.loanProductWritePlatformService.createLoanProduct(command);
return Response.ok().entity(entityIdentifier).build();
}
@GET
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveAllLoanProducts(@Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "name", "description", "fundId", "fundName", "principal", "inArrearsTolerance", "numberOfRepayments",
"repaymentEvery", "interestRatePerPeriod", "annualInterestRate",
"repaymentFrequencyType", "interestRateFrequencyType", "amortizationType", "interestType", "interestCalculationPeriodType",
"createdOn", "lastModifedOn")
);
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
Collection<LoanProductData> products = this.loanProductReadPlatformService.retrieveAllLoanProducts();
return this.apiDataConversionService.convertLoanProductDataToJson(prettyPrint, responseParameters, products.toArray(new LoanProductData[products.size()]));
}
/*
* see
* http://stackoverflow.com/questions/5250074/what-uri-can-be-used-to-request
* -a-default-resource
*/
@GET
@Path("template")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveNewLoanProductDetails(@Context final UriInfo uriInfo) {
// TODO - KW - every addition of a parameter here requires same additon in supported params used in 'apiDataConversionService' method.
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "name", "description", "fundId", "fundName", "transactionProcessingStrategyId", "transactionProcessingStrategyName",
"principal", "inArrearsTolerance", "numberOfRepayments",
"repaymentEvery", "interestRatePerPeriod", "annualInterestRate",
"repaymentFrequencyType", "interestRateFrequencyType", "amortizationType", "interestType", "interestCalculationPeriodType",
"createdOn", "lastModifedOn","currencyOptions", "amortizationTypeOptions", "interestTypeOptions", "interestCalculationPeriodTypeOptions",
"repaymentFrequencyTypeOptions", "interestRateFrequencyTypeOptions", "fundOptions", "transactionProcessingStrategyOptions")
);
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
LoanProductData loanProduct = this.loanProductReadPlatformService.retrieveNewLoanProductDetails();
return this.apiDataConversionService.convertLoanProductDataToJson(prettyPrint, responseParameters, loanProduct);
}
@GET
@Path("{productId}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveLoanProductDetails(@PathParam("productId") final Long productId, @Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "name", "description", "fundId", "fundName",
"transactionProcessingStrategyId", "transactionProcessingStrategyName",
"principal", "inArrearsTolerance", "numberOfRepayments",
"repaymentEvery", "interestRatePerPeriod", "annualInterestRate",
"repaymentFrequencyType", "interestRateFrequencyType", "amortizationType", "interestType", "interestCalculationPeriodType",
"createdOn", "lastModifedOn")
);
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters());
LoanProductData loanProduct = this.loanProductReadPlatformService.retrieveLoanProduct(productId);
if (template) {
responseParameters.addAll(Arrays.asList("currencyOptions", "amortizationTypeOptions", "interestTypeOptions", "interestCalculationPeriodTypeOptions",
"repaymentFrequencyTypeOptions", "interestRateFrequencyTypeOptions", "fundOptions", "transactionProcessingStrategyOptions"));
}
return this.apiDataConversionService.convertLoanProductDataToJson(prettyPrint, responseParameters, loanProduct);
}
@PUT
@Path("{productId}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response updateLoanProduct(@PathParam("productId") final Long productId, final String jsonRequestBody) {
LoanProductCommand command = this.apiDataConversionService.convertJsonToLoanProductCommand(productId, jsonRequestBody);
EntityIdentifier entityIdentifier = this.loanProductWritePlatformService.updateLoanProduct(command);
return Response.ok().entity(entityIdentifier).build();
}
}
@@ -1,338 +0,0 @@
package org.mifosng.platform.api;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.apache.commons.lang.StringUtils;
import org.mifosng.platform.api.commands.AdjustLoanTransactionCommand;
import org.mifosng.platform.api.commands.CalculateLoanScheduleCommand;
import org.mifosng.platform.api.commands.LoanStateTransitionCommand;
import org.mifosng.platform.api.commands.LoanTransactionCommand;
import org.mifosng.platform.api.commands.SubmitLoanApplicationCommand;
import org.mifosng.platform.api.commands.UndoStateTransitionCommand;
import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.LoanAccountData;
import org.mifosng.platform.api.data.LoanAccountSummaryData;
import org.mifosng.platform.api.data.LoanBasicDetailsData;
import org.mifosng.platform.api.data.LoanPermissionData;
import org.mifosng.platform.api.data.LoanRepaymentPeriodData;
import org.mifosng.platform.api.data.LoanRepaymentTransactionData;
import org.mifosng.platform.api.data.LoanSchedule;
import org.mifosng.platform.api.data.LoanTransactionData;
import org.mifosng.platform.api.data.NewLoanData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.exceptions.UnrecognizedQueryParamException;
import org.mifosng.platform.loan.service.CalculationPlatformService;
import org.mifosng.platform.loan.service.LoanReadPlatformService;
import org.mifosng.platform.loan.service.LoanWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/loans")
@Component
@Scope("singleton")
public class LoansApiResource {
@Autowired
private LoanReadPlatformService loanReadPlatformService;
@Autowired
private LoanWritePlatformService loanWritePlatformService;
@Autowired
private CalculationPlatformService calculationPlatformService;
@Autowired
private ApiDataConversionService apiDataConversionService;
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String retrieveDetailsForNewLoanApplicationStepOne(
@QueryParam("clientId") final Long clientId,
@QueryParam("productId") final Long productId,
@Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("clientId", "clientName", "productId", "productName",
"selectedProduct", "expectedDisbursementDate", "allowedProducts"));
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
NewLoanData workflowData = this.loanReadPlatformService.retrieveClientAndProductDetails(clientId, productId);
return this.apiDataConversionService.convertNewLoanDataToJson(prettyPrint, responseParameters, workflowData);
}
@GET
@Path("{loanId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String retrieveLoanAccountDetails(
@PathParam("loanId") final Long loanId,
@Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "externalId", "fundId", "fundName", "loanProductId", "loanProductName", "principal", "inArrearsTolerance", "numberOfRepayments",
"repaymentEvery", "interestRatePerPeriod", "annualInterestRate",
"repaymentFrequencyType", "interestRateFrequencyType", "amortizationType", "interestType", "interestCalculationPeriodType",
"submittedOnDate", "approvedOnDate", "expectedDisbursementDate", "actualDisbursementDate",
"expectedFirstRepaymentOnDate", "interestChargedFromDate", "closedOnDate", "expectedMaturityDate",
"lifeCycleStatusId", "lifeCycleStatusText", "lifeCycleStatusDate")
);
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
LoanBasicDetailsData loanBasicDetails = this.loanReadPlatformService.retrieveLoanAccountDetails(loanId);
Collection<LoanRepaymentTransactionData> loanRepayments = null;
Collection<LoanRepaymentPeriodData> repaymentSchedule = null;
LoanAccountSummaryData summary = null;
LoanPermissionData permissions = null;
Set<String> associationParameters = ApiParameterHelper.extractAssociationsForResponseIfProvided(uriInfo.getQueryParameters());
if (!associationParameters.isEmpty()) {
if (associationParameters.contains("all")) {
responseParameters.addAll(Arrays.asList("summary", "repaymentSchedule", "loanRepayments", "permissions", "convenienceData"));
} else {
responseParameters.addAll(associationParameters);
}
loanRepayments = this.loanReadPlatformService.retrieveLoanPayments(loanId);
repaymentSchedule = this.loanReadPlatformService.retrieveRepaymentSchedule(loanId);
summary = this.loanReadPlatformService.retrieveSummary(loanBasicDetails.getPrincipal(), repaymentSchedule, loanRepayments);
boolean isWaiveAllowed = summary.isWaiveAllowed(loanBasicDetails.getInArrearsTolerance());
permissions = this.loanReadPlatformService.retrieveLoanPermissions(loanBasicDetails, isWaiveAllowed, loanRepayments.size());
}
LoanAccountData loanAccount = new LoanAccountData(loanBasicDetails, summary, repaymentSchedule, loanRepayments, permissions);
return this.apiDataConversionService.convertLoanAccountDataToJson(prettyPrint, responseParameters, loanAccount);
}
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response calculateLoanScheduleOrSubmitLoanApplication(
@QueryParam("command") final String commandParam,
final String jsonRequestBody) {
SubmitLoanApplicationCommand command = this.apiDataConversionService
.convertJsonToSubmitLoanApplicationCommand(jsonRequestBody);
CalculateLoanScheduleCommand calculateLoanScheduleCommand = command.toCalculateLoanScheduleCommand();
LoanSchedule loanSchedule = this.calculationPlatformService.calculateLoanSchedule(calculateLoanScheduleCommand);
// for now just auto generating the loan schedule and setting support
// for 'manual' loan schedule creation later.
command.setLoanSchedule(loanSchedule);
if (is(commandParam, "calculateLoanSchedule")) {
return Response.ok().entity(loanSchedule).build();
}
EntityIdentifier identifier = this.loanWritePlatformService.submitLoanApplication(command);
return Response.ok().entity(identifier).build();
}
@DELETE
@Path("{loanId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response deleteLoanApplication(@PathParam("loanId") final Long loanId) {
EntityIdentifier identifier = this.loanWritePlatformService
.deleteLoan(loanId);
return Response.ok().entity(identifier).build();
}
@POST
@Path("{loanId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response stateTransitions(@PathParam("loanId") final Long loanId,
@QueryParam("command") final String commandParam,
final String jsonRequestBody) {
LoanStateTransitionCommand command = this.apiDataConversionService
.convertJsonToLoanStateTransitionCommand(loanId,
jsonRequestBody);
Response response = null;
if (is(commandParam, "reject")) {
EntityIdentifier identifier = this.loanWritePlatformService
.rejectLoan(command);
response = Response.ok().entity(identifier).build();
} else if (is(commandParam, "withdrewbyclient")) {
EntityIdentifier identifier = this.loanWritePlatformService
.withdrawLoan(command);
response = Response.ok().entity(identifier).build();
} else if (is(commandParam, "approve")) {
EntityIdentifier identifier = this.loanWritePlatformService
.approveLoanApplication(command);
response = Response.ok().entity(identifier).build();
} else if (is(commandParam, "disburse")) {
EntityIdentifier identifier = this.loanWritePlatformService
.disburseLoan(command);
response = Response.ok().entity(identifier).build();
}
UndoStateTransitionCommand undoCommand = new UndoStateTransitionCommand(
loanId, command.getNote());
if (is(commandParam, "undoapproval")) {
EntityIdentifier identifier = this.loanWritePlatformService
.undoLoanApproval(undoCommand);
response = Response.ok().entity(identifier).build();
} else if (is(commandParam, "undodisbursal")) {
EntityIdentifier identifier = this.loanWritePlatformService
.undoLoanDisbursal(undoCommand);
response = Response.ok().entity(identifier).build();
}
if (response == null) {
throw new UnrecognizedQueryParamException("command", commandParam);
}
return response;
}
private boolean is(final String commandParam, final String commandValue) {
return StringUtils.isNotBlank(commandParam)
&& commandParam.trim().equalsIgnoreCase(commandValue);
}
@POST
@Path("{loanId}/transactions")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response executeLoanTransaction(
@PathParam("loanId") final Long loanId,
@QueryParam("command") final String commandParam,
final String jsonRequestBody) {
final LoanTransactionCommand command = this.apiDataConversionService
.convertJsonToLoanTransactionCommand(loanId, jsonRequestBody);
Response response = null;
if (is(commandParam, "repayment")) {
EntityIdentifier identifier = this.loanWritePlatformService
.makeLoanRepayment(command);
response = Response.ok().entity(identifier).build();
} else if (is(commandParam, "waiver")) {
EntityIdentifier identifier = this.loanWritePlatformService
.waiveLoanAmount(command);
response = Response.ok().entity(identifier).build();
}
if (response == null) {
throw new UnrecognizedQueryParamException("command", commandParam);
}
return response;
}
@GET
@Path("{loanId}/transactions/template")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String retrieveNewRepaymentDetails(
@PathParam("loanId") final Long loanId,
@QueryParam("command") final String commandParam,
@Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "transactionType", "date", "principal", "interest", "total", "totalWaived", "overpaid")
);
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
LoanTransactionData transactionData = null;
if (is(commandParam, "repayment")) {
transactionData = this.loanReadPlatformService.retrieveNewLoanRepaymentDetails(loanId);
} else if (is(commandParam, "waiver")) {
transactionData = this.loanReadPlatformService.retrieveNewLoanWaiverDetails(loanId);
} else {
throw new UnrecognizedQueryParamException("command", commandParam);
}
return this.apiDataConversionService.convertLoanTransactionDataToJson(prettyPrint, responseParameters, transactionData);
}
@GET
@Path("{loanId}/transactions/{transactionId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String retrieveTransaction(@PathParam("loanId") final Long loanId,
@PathParam("transactionId") final Long transactionId,
@Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "transactionType", "date", "principal", "interest", "total", "totalWaived", "overpaid")
);
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
LoanTransactionData transactionData = this.loanReadPlatformService.retrieveLoanTransactionDetails(loanId, transactionId);
return this.apiDataConversionService.convertLoanTransactionDataToJson(prettyPrint, responseParameters, transactionData);
}
@POST
@Path("{loanId}/transactions/{transactionId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response adjustLoanTransaction(
@PathParam("loanId") final Long loanId,
@PathParam("transactionId") final Long transactionId,
final String jsonRequestBody) {
final AdjustLoanTransactionCommand command = this.apiDataConversionService
.convertJsonToAdjustLoanTransactionCommand(loanId,
transactionId, jsonRequestBody);
EntityIdentifier identifier = this.loanWritePlatformService
.adjustLoanTransaction(command);
return Response.ok().entity(identifier).build();
}
}
@@ -1,71 +0,0 @@
package org.mifosng.platform.api;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.commands.BranchMoneyTransferCommand;
import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.OfficeTransactionData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.organisation.service.OfficeReadPlatformService;
import org.mifosng.platform.organisation.service.OfficeWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/officetransactions")
@Component
@Scope("singleton")
public class OfficeTransactionsApiResource {
@Autowired
private OfficeWritePlatformService writePlatformService;
@Autowired
private OfficeReadPlatformService readPlatformService;
@Autowired
private ApiDataConversionService apiDataConversionService;
@GET
@Path("template")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String newOfficeTransactionDetails(@Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("transactionDate", "allowedOffices", "currencyOptions"));
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
OfficeTransactionData officeTransactionData = this.readPlatformService.retrieveNewOfficeTransactionDetails();
return this.apiDataConversionService.convertOfficeTransactionDataToJson(prettyPrint, responseParameters, officeTransactionData);
}
@POST
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response transferMoneyFrom(final String jsonRequestBody) {
BranchMoneyTransferCommand command = this.apiDataConversionService.convertJsonToBranchMoneyTransferCommand(jsonRequestBody);
Long id = this.writePlatformService.externalBranchMoneyTransfer(command);
return Response.ok().entity(new EntityIdentifier(id)).build();
}
}
@@ -1,132 +0,0 @@
package org.mifosng.platform.api;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.commands.OfficeCommand;
import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.OfficeData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.organisation.service.OfficeReadPlatformService;
import org.mifosng.platform.organisation.service.OfficeWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/offices")
@Component
@Scope("singleton")
public class OfficesApiResource {
@Autowired
private OfficeReadPlatformService readPlatformService;
@Autowired
private OfficeWritePlatformService writePlatformService;
@Autowired
private ApiDataConversionService apiDataConversionService;
@GET
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveOffices(@Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "name", "nameDecorated", "externalId", "openingDate",
"hierarchy", "parentId", "parentName"));
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
Collection<OfficeData> offices = this.readPlatformService.retrieveAllOffices();
return this.apiDataConversionService.convertOfficeDataToJson(prettyPrint, responseParameters, offices.toArray(new OfficeData[offices.size()]));
}
@GET
@Path("template")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveOfficeTemplate(@Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "name", "nameDecorated", "externalId", "openingDate",
"hierarchy", "parentId", "parentName", "allowedParents"));
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
OfficeData officeData = this.readPlatformService.retrieveNewOfficeTemplate();
return this.apiDataConversionService.convertOfficeDataToJson(prettyPrint, typicalResponseParameters, officeData);
}
@POST
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response createOffice(final String jsonRequestBody) {
OfficeCommand command = this.apiDataConversionService.convertJsonToOfficeCommand(null, jsonRequestBody);
Long officeId = this.writePlatformService.createOffice(command);
return Response.ok().entity(new EntityIdentifier(officeId)).build();
}
@GET
@Path("{officeId}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retreiveOffice(@PathParam("officeId") final Long officeId, @Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "name", "nameDecorated", "externalId", "openingDate",
"hierarchy", "parentId", "parentName"));
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters());
OfficeData office = this.readPlatformService.retrieveOffice(officeId);
if (template) {
office.setAllowedParents(this.readPlatformService.retrieveAllowedParents(officeId));
responseParameters.add("allowedParents");
}
return this.apiDataConversionService.convertOfficeDataToJson(prettyPrint, responseParameters, office);
}
@PUT
@Path("{officeId}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response updateOffice(@PathParam("officeId") final Long officeId, final String jsonRequestBody) {
OfficeCommand command = this.apiDataConversionService.convertJsonToOfficeCommand(officeId, jsonRequestBody);
Long entityId = this.writePlatformService.updateOffice(command);
return Response.ok().entity(new EntityIdentifier(entityId)).build();
}
}
@@ -1,45 +0,0 @@
package org.mifosng.platform.api;
import java.util.Collection;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.data.PermissionData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.user.service.PermissionReadPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/permissions")
@Component
@Scope("singleton")
public class PermissionsApiResource {
@Autowired
private PermissionReadPlatformService permissionReadPlatformService;
@Autowired
private ApiDataConversionService apiDataConversionService;
@GET
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public String retrieveAllPermissions(@Context final UriInfo uriInfo) {
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
Collection<PermissionData> permissions = this.permissionReadPlatformService.retrieveAllPermissions();
return this.apiDataConversionService.convertPermissionDataToJson(prettyPrint, responseParameters, permissions.toArray(new PermissionData[permissions.size()]));
}
}
@@ -1,133 +0,0 @@
package org.mifosng.platform.api;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.StreamingOutput;
import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.ReadExtraDataAndReportingService;
import org.mifosng.platform.api.data.GenericResultsetData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/reports")
@Component
@Scope("singleton")
public class ReportsApiResource {
@Autowired
private ReadExtraDataAndReportingService readExtraDataAndReportingService;
@Autowired
private ApiDataConversionService apiDataConversionService;
@GET
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON, "application/x-msdownload" })
public Response retrieveReportList(@Context final UriInfo uriInfo) {
Map<String, String> extractedQueryParams = new HashMap<String, String>();
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
boolean exportCsv = ApiParameterHelper.exportCsv(uriInfo.getQueryParameters());
if (!exportCsv) {
GenericResultsetData result = this.readExtraDataAndReportingService.retrieveGenericResultset(".", ".", extractedQueryParams);
final String json = this.apiDataConversionService.convertGenericResultsetDataToJson(prettyPrint, result);
return Response.ok().entity(json).build();
}
StreamingOutput result = this.readExtraDataAndReportingService.retrieveReportCSV(".", ".", extractedQueryParams);
return Response
.ok()
.entity(result)
.header("Content-Disposition",
"attachment;filename=ReportList.csv").build();
}
@GET
@Path("{reportName}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON, "application/x-msdownload","application/vnd.ms-excel", "application/pdf", "text/html" })
public Response retrieveReport(
@PathParam("reportName") final String reportName,
@Context final UriInfo uriInfo) {
MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
boolean exportCsv = ApiParameterHelper.exportCsv(uriInfo.getQueryParameters());
boolean parameterType = ApiParameterHelper.parameterType(uriInfo.getQueryParameters());
String parameterTypeValue = null;
if (!parameterType) {
parameterTypeValue = "report";
if (this.readExtraDataAndReportingService.getReportType(reportName).equalsIgnoreCase("Pentaho")) {
Map<String, String> reportParams = getReportParams(queryParams, true);
return this.readExtraDataAndReportingService.processPentahoRequest(reportName, queryParams.getFirst("output-type"), reportParams);
}
} else {
parameterTypeValue = "parameter";
}
if (!exportCsv) {
Map<String, String> reportParams = getReportParams(queryParams, false);
GenericResultsetData result = this.readExtraDataAndReportingService.retrieveGenericResultset(reportName, parameterTypeValue, reportParams);
final String json = this.apiDataConversionService.convertGenericResultsetDataToJson(prettyPrint, result);
return Response.ok().entity(json).type(MediaType.APPLICATION_JSON).build();
}
// CSV Export
Map<String, String> reportParams = getReportParams(queryParams, false);
StreamingOutput result = this.readExtraDataAndReportingService.retrieveReportCSV(reportName, parameterTypeValue, reportParams);
return Response
.ok()
.entity(result)
.type("application/x-msdownload")
.header("Content-Disposition",
"attachment;filename=" + reportName.replaceAll(" ", "")
+ ".csv").build();
}
private Map<String, String> getReportParams(final MultivaluedMap<String, String> queryParams, final Boolean isPentaho) {
Map<String, String> reportParams = new HashMap<String, String>();
Set<String> keys = queryParams.keySet();
String pKey;
String pValue;
for (String k : keys) {
if (k.startsWith("R_")) {
if (isPentaho) pKey = k.substring(2);
else pKey = "${" + k.substring(2) + "}";
pValue = queryParams.get(k).get(0);
reportParams.put(pKey, pValue);
}
}
return reportParams;
}
}

Some files were not shown because too many files have changed in this diff Show More