use of edu.cornell.kfs.coa.businessobject.SubAccountGlobal in project cu-kfs by CU-CommunityApps.
the class SubAccountGlobalRule method checkForPartiallyEnteredReportingFields.
/**
* Checks that the reporting fields are entered altogether or none at all
*
* @return false if only one reporting field filled out and not all of them, true otherwise
*/
protected boolean checkForPartiallyEnteredReportingFields() {
boolean success = true;
boolean allReportingFieldsEntered = false;
boolean anyReportingFieldsEntered = false;
SubAccountGlobal newSubAccountGlobal = (SubAccountGlobal) super.getNewBo();
// set a flag if all three reporting fields are filled (this is separated just for readability)
if (StringUtils.isNotEmpty(newSubAccountGlobal.getFinancialReportChartCode()) && StringUtils.isNotEmpty(newSubAccountGlobal.getFinReportOrganizationCode()) && StringUtils.isNotEmpty(newSubAccountGlobal.getFinancialReportingCode())) {
allReportingFieldsEntered = true;
}
// set a flag if any of the three reporting fields are filled (this is separated just for readability)
if (StringUtils.isNotEmpty(newSubAccountGlobal.getFinancialReportChartCode()) || StringUtils.isNotEmpty(newSubAccountGlobal.getFinReportOrganizationCode()) || StringUtils.isNotEmpty(newSubAccountGlobal.getFinancialReportingCode())) {
anyReportingFieldsEntered = true;
}
// if any of the three reporting code fields are filled out, all three must be, or none
if (anyReportingFieldsEntered && !allReportingFieldsEntered) {
putGlobalError(KFSKeyConstants.ERROR_DOCUMENT_SUBACCTMAINT_RPTCODE_ALL_FIELDS_IF_ANY_FIELDS);
success &= false;
}
return success;
}
use of edu.cornell.kfs.coa.businessobject.SubAccountGlobal in project cu-kfs by CU-CommunityApps.
the class SubAccountGlobalMaintainableImpl method generateMaintenanceLocks.
/**
* This creates the particular locking representation for this global document.
*
* @see org.kuali.kfs.kns.maintenance.Maintainable#generateMaintenanceLocks()
*/
@Override
public List<MaintenanceLock> generateMaintenanceLocks() {
SubAccountGlobal subAccountGlobal = (SubAccountGlobal) getBusinessObject();
List<MaintenanceLock> maintenanceLocks = new ArrayList();
for (SubAccountGlobalDetail detail : subAccountGlobal.getSubAccountGlobalDetails()) {
MaintenanceLock maintenanceLock = new MaintenanceLock();
StringBuffer lockrep = new StringBuffer();
lockrep.append(Account.class.getName() + KFSConstants.Maintenance.AFTER_CLASS_DELIM);
lockrep.append(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
lockrep.append(detail.getChartOfAccountsCode() + KFSConstants.Maintenance.AFTER_VALUE_DELIM);
lockrep.append(KFSPropertyConstants.ACCOUNT_NUMBER + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
lockrep.append(detail.getAccountNumber());
lockrep.append(KFSPropertyConstants.SUB_ACCOUNT_NUMBER + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
lockrep.append(detail.getSubAccountNumber());
maintenanceLock.setDocumentNumber(subAccountGlobal.getDocumentNumber());
maintenanceLock.setLockingRepresentation(lockrep.toString());
maintenanceLocks.add(maintenanceLock);
}
return maintenanceLocks;
}
use of edu.cornell.kfs.coa.businessobject.SubAccountGlobal in project cu-kfs by CU-CommunityApps.
the class SubAccountGlobalMaintainableImpl method isSubAccountTypeCodeCostShare.
/**
* @return true when code is CS; otherwise return false
*/
private boolean isSubAccountTypeCodeCostShare() {
boolean retval = false;
SubAccountGlobal subAccountGlobal = (SubAccountGlobal) getBusinessObject();
for (SubAccountGlobalDetail detail : subAccountGlobal.getSubAccountGlobalDetails()) {
detail.refreshReferenceObject(KFSPropertyConstants.SUB_ACCOUNT);
SubAccount subAccount = detail.getSubAccount();
if (subAccount.getA21SubAccount().getSubAccountTypeCode().equals(KFSConstants.SubAccountType.COST_SHARE)) {
retval = true;
subAccount.refreshReferenceObject(KFSPropertyConstants.ACCOUNT);
break;
}
}
return retval;
}
use of edu.cornell.kfs.coa.businessobject.SubAccountGlobal in project cu-kfs by CU-CommunityApps.
the class SubAccountGlobalPreRules method checkOffCampus.
/**
* Checks if off campus is set and prompts user question.
*
* @param maintenanceDocument
* @return true if continue, false otherwise
*/
protected boolean checkOffCampus(MaintenanceDocument maintenanceDocument) {
boolean continueRules = true;
SubAccountGlobal subAccountGlobal = (SubAccountGlobal) maintenanceDocument.getNewMaintainableObject().getBusinessObject();
boolean saccOffCampus = subAccountGlobal.getA21SubAccount().isOffCampusCode();
if (saccOffCampus) {
String questionText = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(CUKFSKeyConstants.QUESTION_A21SUBACCOUNT_OFF_CAMPUS_INDICATOR);
boolean leaveAsIs = super.askOrAnalyzeYesNoQuestion(CUKFSConstants.A21SubAccountDocumentConstants.OFF_CAMPUS_INDICATOR_QUESTION_ID, questionText);
if (!leaveAsIs) {
// return to document if the user doesn't want to clear the indicator
super.event.setActionForwardName(KFSConstants.MAPPING_BASIC);
continueRules = false;
}
}
return continueRules;
}
use of edu.cornell.kfs.coa.businessobject.SubAccountGlobal in project cu-kfs by CU-CommunityApps.
the class SubAccountGlobalRule method checkCgCostSharingIsEmpty.
/**
* This method tests if all fields in the Cost Sharing section are empty.
*
* @return true if the cost sharing values passed in are empty, otherwise false.
*/
protected boolean checkCgCostSharingIsEmpty(SubAccountGlobalDetail subAccountGlobalDetail) {
boolean success = true;
SubAccountGlobal newSubAccountGlobal = (SubAccountGlobal) super.getNewBo();
A21SubAccountChange newA21SubAccount = newSubAccountGlobal.getA21SubAccount();
boolean cgCostSharingEmptyOnGlobal = true;
if (ObjectUtils.isNotNull(newA21SubAccount)) {
cgCostSharingEmptyOnGlobal &= StringUtils.isEmpty(newA21SubAccount.getCostShareChartOfAccountCode());
cgCostSharingEmptyOnGlobal &= StringUtils.isEmpty(newA21SubAccount.getCostShareSourceAccountNumber());
cgCostSharingEmptyOnGlobal &= StringUtils.isEmpty(newA21SubAccount.getCostShareSourceSubAccountNumber());
}
success &= cgCostSharingEmptyOnGlobal;
return success;
}
Aggregations