MIFOSX-314: merge in aviks work and fix conflicts and format code.
This commit is contained in:
+2
-2
@@ -82,11 +82,11 @@ public class GLAccountsApiResource {
|
||||
@Path("template")
|
||||
@Consumes({ 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);
|
||||
|
||||
GLAccountData glAccountData = this.glAccountReadPlatformService.retrieveNewGLAccountDetails();
|
||||
GLAccountData glAccountData = this.glAccountReadPlatformService.retrieveNewGLAccountDetails(type);
|
||||
glAccountData = handleTemplate(glAccountData);
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
|
||||
+6
-2
@@ -108,14 +108,18 @@ public class GLAccountData {
|
||||
this.allowedExpensesTagOptions = allowedExpensesTagOptions;
|
||||
}
|
||||
|
||||
public static GLAccountData sensibleDefaultsForNewGLAccountCreation() {
|
||||
public static GLAccountData sensibleDefaultsForNewGLAccountCreation(final Integer GLAccType) {
|
||||
final Long id = null;
|
||||
final String name = null;
|
||||
final Long parentId = null;
|
||||
final String glCode = null;
|
||||
final boolean disabled = false;
|
||||
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 String description = null;
|
||||
final String nameDecorated = null;
|
||||
|
||||
+3
-3
@@ -21,7 +21,7 @@ public interface GLAccountReadPlatformService {
|
||||
|
||||
List<GLAccountData> retrieveAllEnabledDetailGLAccounts(GLAccountType accountType);
|
||||
|
||||
GLAccountData retrieveNewGLAccountDetails();
|
||||
|
||||
List<GLAccountData> retrieveAllEnabledHeaderGLAccounts(GLAccountType accountType);
|
||||
}
|
||||
|
||||
GLAccountData retrieveNewGLAccountDetails(final Integer type);
|
||||
}
|
||||
+12
-10
@@ -42,7 +42,9 @@ public class GLAccountReadPlatformServiceImpl implements GLAccountReadPlatformSe
|
||||
|
||||
public String schema() {
|
||||
return " gl.id as id, name as name, parent_id as parentId, gl_code as glCode, disabled as disabled, manual_journal_entries_allowed as manualEntriesAllowed, "
|
||||
+ "classification_enum as classification, account_usage as accountUsage, description as description, "+nameDecoratedBaseOnHierarchy +"as nameDecorated, "
|
||||
+ "classification_enum as classification, account_usage as accountUsage, description as description, "
|
||||
+ nameDecoratedBaseOnHierarchy
|
||||
+ "as nameDecorated, "
|
||||
+ "cv.id as codeId, cv.code_value as codeValue from acc_gl_account gl left join m_code_value cv on tag_id=cv.id";
|
||||
}
|
||||
|
||||
@@ -64,7 +66,8 @@ public class GLAccountReadPlatformServiceImpl implements GLAccountReadPlatformSe
|
||||
final Long codeId = rs.getLong("codeId");
|
||||
final String codeValue = rs.getString("codeValue");
|
||||
CodeValueData tagId = CodeValueData.instance(codeId, codeValue);
|
||||
return new GLAccountData(id, name, parentId, glCode, disabled, manualEntriesAllowed, accountType, usage, description, nameDecorated, tagId);
|
||||
return new GLAccountData(id, name, parentId, glCode, disabled, manualEntriesAllowed, accountType, usage, description,
|
||||
nameDecorated, tagId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,13 +194,12 @@ public class GLAccountReadPlatformServiceImpl implements GLAccountReadPlatformSe
|
||||
}
|
||||
|
||||
@Override
|
||||
public GLAccountData retrieveNewGLAccountDetails() {
|
||||
return GLAccountData.sensibleDefaultsForNewGLAccountCreation();
|
||||
public GLAccountData retrieveNewGLAccountDetails(final Integer type) {
|
||||
return GLAccountData.sensibleDefaultsForNewGLAccountCreation(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GLAccountData> retrieveAllEnabledHeaderGLAccounts(GLAccountType accountType) {
|
||||
return retrieveAllGLAccounts(accountType.getValue(), null, GLAccountUsage.HEADER.getValue(), null, false);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public List<GLAccountData> retrieveAllEnabledHeaderGLAccounts(final GLAccountType accountType) {
|
||||
return retrieveAllGLAccounts(accountType.getValue(), null, GLAccountUsage.HEADER.getValue(), null, false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user