MIFOSX-1992 Addressed review comments for 1992.
This commit is contained in:
@@ -33132,7 +33132,11 @@ Request Body:
|
|||||||
<td rowspan=2><a href="#groups">Group</a></td>
|
<td rowspan=2><a href="#groups">Group</a></td>
|
||||||
<td>Name</td>
|
<td>Name</td>
|
||||||
</td>
|
</td>
|
||||||
<tr>
|
<tr class=alt>
|
||||||
|
<td>Account Number</td>
|
||||||
|
</tr>
|
||||||
|
<tr class=alt>
|
||||||
|
<td></td>
|
||||||
<td>External Id</td>
|
<td>External Id</td>
|
||||||
</td>
|
</td>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
+1
-2
@@ -305,11 +305,10 @@ public class AccountNumberPreferencesTest {
|
|||||||
if (isAccountPreferenceSetUp) {
|
if (isAccountPreferenceSetUp) {
|
||||||
String centerPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
|
String centerPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
|
||||||
this.centerAccountNumberPreferenceId, "prefixType.value");
|
this.centerAccountNumberPreferenceId, "prefixType.value");
|
||||||
final String CENTER_URL = "/mifosng-provider/api/v1/groups/" + this.centerId + "?" + Utils.TENANT_IDENTIFIER;
|
final String CENTER_URL = "/mifosng-provider/api/v1/centers/" + this.centerId + "?" + Utils.TENANT_IDENTIFIER;
|
||||||
|
|
||||||
if (centerPrefixName.equals(this.officeName)) {
|
if (centerPrefixName.equals(this.officeName)) {
|
||||||
final String centerOfficeName = Utils.performServerGet(requestSpec, responseSpec, CENTER_URL, "officeName");
|
final String centerOfficeName = Utils.performServerGet(requestSpec, responseSpec, CENTER_URL, "officeName");
|
||||||
|
|
||||||
this.validateAccountNumberLengthAndStartsWithPrefix(center.getAccountNo(), centerOfficeName);
|
this.validateAccountNumberLengthAndStartsWithPrefix(center.getAccountNo(), centerOfficeName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+20
-16
@@ -205,22 +205,8 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group
|
|||||||
*/
|
*/
|
||||||
newGroup.generateHierarchy();
|
newGroup.generateHierarchy();
|
||||||
|
|
||||||
if (newGroup.isAccountNumberRequiresAutoGeneration()) {
|
/* Generate account number if required */
|
||||||
EntityAccountType entityAccountType = null;
|
generateAccountNumberIfRequired(newGroup);
|
||||||
AccountNumberFormat accountNumberFormat = null;
|
|
||||||
if(newGroup.isCenter()){
|
|
||||||
entityAccountType = EntityAccountType.CENTER;
|
|
||||||
accountNumberFormat = this.accountNumberFormatRepository
|
|
||||||
.findByAccountType(entityAccountType);
|
|
||||||
newGroup.updateAccountNo(this.accountNumberGenerator.generateCenterAccountNumber(newGroup, accountNumberFormat));
|
|
||||||
}else {
|
|
||||||
entityAccountType = EntityAccountType.GROUP;
|
|
||||||
accountNumberFormat = this.accountNumberFormatRepository
|
|
||||||
.findByAccountType(entityAccountType);
|
|
||||||
newGroup.updateAccountNo(this.accountNumberGenerator.generateGroupAccountNumber(newGroup, accountNumberFormat));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
this.groupRepository.saveAndFlush(newGroup);
|
this.groupRepository.saveAndFlush(newGroup);
|
||||||
newGroup.captureStaffHistoryDuringCenterCreation(staff, activationDate);
|
newGroup.captureStaffHistoryDuringCenterCreation(staff, activationDate);
|
||||||
@@ -238,6 +224,24 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void generateAccountNumberIfRequired(Group newGroup){
|
||||||
|
if (newGroup.isAccountNumberRequiresAutoGeneration()) {
|
||||||
|
EntityAccountType entityAccountType = null;
|
||||||
|
AccountNumberFormat accountNumberFormat = null;
|
||||||
|
if(newGroup.isCenter()){
|
||||||
|
entityAccountType = EntityAccountType.CENTER;
|
||||||
|
accountNumberFormat = this.accountNumberFormatRepository
|
||||||
|
.findByAccountType(entityAccountType);
|
||||||
|
newGroup.updateAccountNo(this.accountNumberGenerator.generateCenterAccountNumber(newGroup, accountNumberFormat));
|
||||||
|
}else {
|
||||||
|
entityAccountType = EntityAccountType.GROUP;
|
||||||
|
accountNumberFormat = this.accountNumberFormatRepository
|
||||||
|
.findByAccountType(entityAccountType);
|
||||||
|
newGroup.updateAccountNo(this.accountNumberGenerator.generateGroupAccountNumber(newGroup, accountNumberFormat));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult createCenter(final JsonCommand command) {
|
public CommandProcessingResult createCenter(final JsonCommand command) {
|
||||||
|
|||||||
Reference in New Issue
Block a user