diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm
index a36cab86c..5a3735fc1 100644
--- a/api-docs/apiLive.htm
+++ b/api-docs/apiLive.htm
@@ -427,7 +427,7 @@
|
- savingsaccounts/{accountId}?command=assignFieldOfficer |
+ savingsaccounts/{accountId}?command=assignSavingsOfficer |
Assign Savings Officer |
|
|
@@ -435,7 +435,7 @@
|
- savingsaccounts/{accountId}?command=unassignFieldOfficer |
+ savingsaccounts/{accountId}?command=unassignSavingsOfficer |
Unassign Savings Officer |
|
|
@@ -19167,20 +19167,24 @@ Request Body:
Allows you to assign Savings Officer for existing Savings Account.
- POST https://Domain Name/api/v1/savingsaccounts/{savingsId}?command=assignFieldOfficer
- POST savingsaccounts/1?command=assignFieldOfficer
+ POST https://Domain Name/api/v1/savingsaccounts/{savingsId}?command=assignSavingsOfficer
+ POST savingsaccounts/1?command=assignSavingsOfficer
Content-Type: application/json
Request Body:
{
- "staffId":1
+ assignmentDate : "04 September 2014"
+ dateFormat : "dd MMMM yyyy"
+ fromSavingsOfficerId : ""
+ locale : "en"
+ toSavingsOfficerId : 2
}
{
"officeId":2,
- "clientId":8,
+ "savingsId":8,
"resourceId":8,
- "changes":{"staffId":1}
+ "changes":{"savingsOfficerId":2}
}
@@ -19193,12 +19197,14 @@ Request Body:
Allows you to unassign the Savings Officer.
- POST https://Domain Name/api/v1/savingsaccounts/{savingsId}?command=unassignFieldOfficer
- POST savingsaccounts/1?command=unassignFieldOfficer
+ POST https://Domain Name/api/v1/savingsaccounts/{savingsId}?command=unassignSavingsOfficer
+ POST savingsaccounts/1?command=unassignSavingsOfficer
Content-Type: application/json
Request Body:
{
- "staffId":1
+ dateFormat : "dd MMMM yyyy"
+ locale : "en"
+ unassignedDate : "05 September 2014"
}
@@ -19206,7 +19212,7 @@ Request Body:
"officeId":2,
"clientId":8,
"resourceId":8,
- "changes":{"staffId":1}
+ "changes":{}
}
@@ -33777,7 +33783,7 @@ No Request Body:
|
- savingsaccounts/{accountId}?command=assignFieldOfficer |
+ savingsaccounts/{accountId}?command=assignSavingsOfficer |
Assign Savings Officer |
|
|
@@ -33785,7 +33791,7 @@ No Request Body:
|
- savingsaccounts/{accountId}?command=unassignFieldOfficer |
+ savingsaccounts/{accountId}?command=unassignSavingsOfficer |
Unassign Savings Officer |
|
|
diff --git a/mifosng-db/migrations/core_db/V202__savings_officer_history_table.sql b/mifosng-db/migrations/core_db/V202__savings_officer_history_table.sql
new file mode 100644
index 000000000..0ffcb82d4
--- /dev/null
+++ b/mifosng-db/migrations/core_db/V202__savings_officer_history_table.sql
@@ -0,0 +1,20 @@
+CREATE TABLE `m_savings_officer_assignment_history` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `account_id` bigint(20) NOT NULL,
+ `savings_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_savings_officer_assignment_history_0001` (`account_id`),
+ KEY `fk_m_savings_officer_assignment_history_0002` (`savings_officer_id`),
+ CONSTRAINT `fk_m_savings_officer_assignment_history_0001` FOREIGN KEY (`account_id`) REFERENCES `m_savings_account` (`id`),
+ CONSTRAINT `fk_m_savings_officer_assignment_history_0002` FOREIGN KEY (`savings_officer_id`) REFERENCES `m_staff` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+insert into m_permission (grouping,code,entity_name,action_name) values ('portfolio','REMOVESAVINGSOFFICER_SAVINGSACCOUNT','SAVINGSACCOUNT','REMOVESAVINGSOFFICER');
+insert into m_permission (grouping,code,entity_name,action_name) values ('portfolio','UPDATESAVINGSOFFICER_SAVINGSACCOUNT','SAVINGSACCOUNT','UPDATESAVINGSOFFICER');
+
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java
index dd201c989..6c2f3aa4b 100755
--- a/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java
@@ -589,12 +589,12 @@ public class CommandWrapper {
return this.actionName.equalsIgnoreCase("ADJUSTTRANSACTION") && this.entityName.equalsIgnoreCase("SAVINGSACCOUNT");
}
- public boolean isAssignStaffSavingsAccount(){
- return this.actionName.equalsIgnoreCase("ASSIGNFIELDOFFICER") && this.entityName.equalsIgnoreCase("SAVINGSACCOUNT");
+ public boolean isUpdateSavingsOfficer(){
+ return this.actionName.equalsIgnoreCase("UPDATESAVINGSOFFICER") && this.entityName.equalsIgnoreCase("SAVINGSACCOUNT");
}
- public boolean isUnAssignStaffSavingsAccount(){
- return this.actionName.equalsIgnoreCase("UNASSIGNFIELDOFFICER") && this.entityName.equalsIgnoreCase("SAVINGSACCOUNT");
+ public boolean isRemoveSavingsOfficer(){
+ return this.actionName.equalsIgnoreCase("REMOVESAVINGSOFFICER") && this.entityName.equalsIgnoreCase("SAVINGSACCOUNT");
}
public boolean isSavingsAccountChargeResource() {
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java
index c63e1219c..9f15a214e 100755
--- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java
@@ -2073,19 +2073,19 @@ public class CommandWrapperBuilder {
this.entityId = entityId;
return this;
}
- public CommandWrapperBuilder assignFieldOfficer(final Long accountId) {
- this.actionName = "ASSIGNFIELDOFFICER";
+ public CommandWrapperBuilder assignSavingsOfficer(final Long accountId) {
+ this.actionName = "UPDATESAVINGSOFFICER";
this.entityName = "SAVINGSACCOUNT";
this.entityId = accountId;
- this.href = "/savingsaccounts/" + accountId + "?command=assignFieldOfficer";
+ this.href = "/savingsaccounts/" + accountId + "?command=assignSavingsOfficer";
return this;
}
- public CommandWrapperBuilder unassignFieldOfficer(final Long accountId) {
- this.actionName = "UNASSIGNFIELDOFFICER";
+ public CommandWrapperBuilder unassignSavingsOfficer(final Long accountId) {
+ this.actionName = "REMOVESAVINGSOFFICER";
this.entityName = "SAVINGSACCOUNT";
this.entityId = accountId;
- this.href = "/savingsaccounts/" + accountId + "?command=unassignFieldOfficer";
+ this.href = "/savingsaccounts/" + accountId + "?commad=unassignSavingsOfficer";
return this;
}
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java
index 2e7e942ba..bb146845e 100755
--- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java
@@ -512,10 +512,10 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
handler = this.applicationContext.getBean("savingsTransactionAdjustmentCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.isSavingsAccountClose()) {
handler = this.applicationContext.getBean("closeSavingsAccountCommandHandler", NewCommandSourceHandler.class);
- }else if(wrapper.isAssignStaffSavingsAccount()) {
- handler = this.applicationContext.getBean("assignFieldOfficerSavingsAccountCommandHandler", NewCommandSourceHandler.class);
- }else if(wrapper.isUnAssignStaffSavingsAccount()) {
- handler = this.applicationContext.getBean("unassignFieldOfficerSavingsAccountCommandHandler", NewCommandSourceHandler.class);
+ }else if(wrapper.isUpdateSavingsOfficer()) {
+ handler = this.applicationContext.getBean("updateSavingsOfficerCommandHandler", NewCommandSourceHandler.class);
+ }else if(wrapper.isRemoveSavingsOfficer()) {
+ handler = this.applicationContext.getBean("removeSavingsOfficerCommandHandler", NewCommandSourceHandler.class);
}
else {
throw new UnsupportedCommandException(wrapper.commandName());
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/exception/StaffRoleException.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/exception/StaffRoleException.java
index 1ea7ddfa6..6d585d2cc 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/exception/StaffRoleException.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/exception/StaffRoleException.java
@@ -13,7 +13,7 @@ import org.mifosplatform.infrastructure.core.exception.AbstractPlatformResourceN
public class StaffRoleException extends AbstractPlatformResourceNotFoundException {
public static enum STAFF_ROLE {
- LOAN_OFFICER, BRANCH_MANAGER;
+ LOAN_OFFICER, BRANCH_MANAGER,SAVINGS_OFFICER;
@Override
public String toString() {
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsApiConstants.java
index 070149964..9cf393ff7 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsApiConstants.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsApiConstants.java
@@ -48,7 +48,7 @@ public class SavingsApiConstants {
public static final String localeParamName = "locale";
public static final String dateFormatParamName = "dateFormat";
public static final String monthDayFormatParamName = "monthDayFormat";
- public static final String staffIdParamName = "staffId";
+ public static final String staffIdParamName = "savingsOfficerId";
// savings product and account parameters
public static final String idParamName = "id";
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsAccountsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsAccountsApiResource.java
index 176b6363b..b8a1d1bcc 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsAccountsApiResource.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsAccountsApiResource.java
@@ -248,12 +248,12 @@ public class SavingsAccountsApiResource {
} else if (is(commandParam, "close")) {
final CommandWrapper commandRequest = builder.closeSavingsAccountApplication(accountId).build();
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
- } else if (is(commandParam, "assignFieldOfficer")) {
- final CommandWrapper commandRequest = builder.assignFieldOfficer(accountId).build();
+ } else if (is(commandParam, "assignSavingsOfficer")) {
+ final CommandWrapper commandRequest = builder.assignSavingsOfficer(accountId).build();
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result);
- } else if (is(commandParam, "unassignFieldOfficer")) {
- final CommandWrapper commandRequest = builder.unassignFieldOfficer(accountId).build();
+ } else if (is(commandParam, "unassignSavingsOfficer")) {
+ final CommandWrapper commandRequest = builder.unassignSavingsOfficer(accountId).build();
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result);
}
@@ -262,7 +262,7 @@ public class SavingsAccountsApiResource {
//
throw new UnrecognizedQueryParamException("command", commandParam,
new Object[] { "reject", "withdrawnByApplicant", "approve", "undoapproval", "activate", "calculateInterest",
- "postInterest", "close", "assignFieldOfficer", "unassignFieldOfficer" });
+ "postInterest", "close", "assignSavingsOfficer", "unassignSavingsOfficer" });
}
return this.toApiJsonSerializer.serialize(result);
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountDataValidator.java
index 5ef646bda..e65f1ea36 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountDataValidator.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountDataValidator.java
@@ -391,50 +391,56 @@ public class SavingsAccountDataValidator {
}
- public void validateForAssignFieldOfficer(final String json) {
+ public void validateForAssignSavingsOfficer(final String json) {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
+
+ final Set supportedParameters = new HashSet<>(Arrays.asList("fromSavingsOfficerId","toSavingsOfficerId","assignmentDate","locale","dateFormat"));
final Type typeOfMap = new TypeToken