MIFOSX-314 Make adding new accounts of a particular type easier
This commit is contained in:
+2
-2
@@ -73,11 +73,11 @@ public class GLAccountsApiResource {
|
|||||||
@Path("template")
|
@Path("template")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public String retrieveNewAccountDetails(@Context final UriInfo uriInfo) {
|
public String retrieveNewAccountDetails(@Context final UriInfo uriInfo, @QueryParam("type") final Integer type) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
||||||
|
|
||||||
GLAccountData glAccountData = this.glAccountReadPlatformService.retrieveNewGLAccountDetails();
|
GLAccountData glAccountData = this.glAccountReadPlatformService.retrieveNewGLAccountDetails(type);
|
||||||
glAccountData = handleTemplate(glAccountData);
|
glAccountData = handleTemplate(glAccountData);
|
||||||
|
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
|
|||||||
+6
-2
@@ -64,14 +64,18 @@ public class GLAccountData {
|
|||||||
this.usageOptions = usageOptions;
|
this.usageOptions = usageOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GLAccountData sensibleDefaultsForNewGLAccountCreation() {
|
public static GLAccountData sensibleDefaultsForNewGLAccountCreation(final Integer GLAccType) {
|
||||||
final Long id = null;
|
final Long id = null;
|
||||||
final String name = null;
|
final String name = null;
|
||||||
final Long parentId = null;
|
final Long parentId = null;
|
||||||
final String glCode = null;
|
final String glCode = null;
|
||||||
final boolean disabled = false;
|
final boolean disabled = false;
|
||||||
final boolean manualEntriesAllowed = true;
|
final boolean manualEntriesAllowed = true;
|
||||||
final EnumOptionData type = AccountingEnumerations.gLAccountType(GLAccountType.ASSET);
|
final EnumOptionData type;
|
||||||
|
if(GLAccType!=0)
|
||||||
|
type = AccountingEnumerations.gLAccountType(GLAccType);
|
||||||
|
else
|
||||||
|
type = AccountingEnumerations.gLAccountType(GLAccountType.ASSET);
|
||||||
final EnumOptionData usage = AccountingEnumerations.gLAccountUsage(GLAccountUsage.DETAIL);
|
final EnumOptionData usage = AccountingEnumerations.gLAccountUsage(GLAccountUsage.DETAIL);
|
||||||
final String description = null;
|
final String description = null;
|
||||||
return new GLAccountData(id, name, parentId, glCode, disabled, manualEntriesAllowed, type, usage, description);
|
return new GLAccountData(id, name, parentId, glCode, disabled, manualEntriesAllowed, type, usage, description);
|
||||||
|
|||||||
+1
-1
@@ -21,5 +21,5 @@ public interface GLAccountReadPlatformService {
|
|||||||
|
|
||||||
List<GLAccountData> retrieveAllEnabledDetailGLAccounts(GLAccountType accountType);
|
List<GLAccountData> retrieveAllEnabledDetailGLAccounts(GLAccountType accountType);
|
||||||
|
|
||||||
GLAccountData retrieveNewGLAccountDetails();
|
GLAccountData retrieveNewGLAccountDetails(final Integer type);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -186,8 +186,8 @@ public class GLAccountReadPlatformServiceImpl implements GLAccountReadPlatformSe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GLAccountData retrieveNewGLAccountDetails() {
|
public GLAccountData retrieveNewGLAccountDetails(final Integer type) {
|
||||||
return GLAccountData.sensibleDefaultsForNewGLAccountCreation();
|
return GLAccountData.sensibleDefaultsForNewGLAccountCreation(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user