001 /*
002 * Copyright 2011 The Kuali Foundation.
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.kfs.module.ar.document.authorization;
017
018 import java.util.Set;
019
020 import org.kuali.kfs.module.ar.ArConstants;
021 import org.kuali.kfs.module.ar.document.CustomerInvoiceDocument;
022 import org.kuali.kfs.module.ar.document.CustomerInvoiceWriteoffDocument;
023 import org.kuali.kfs.sys.context.SpringContext;
024 import org.kuali.kfs.sys.document.authorization.FinancialSystemMaintenanceDocumentPresentationControllerBase;
025 import org.kuali.rice.kns.bo.BusinessObject;
026 import org.kuali.rice.kns.service.ParameterService;
027
028 /**
029 *
030 * This class may be the longest class name evar.
031 */
032 public class OrganizationAccountingDefaultMaintenanceDocumentPresentationController extends FinancialSystemMaintenanceDocumentPresentationControllerBase {
033
034 @Override
035 public Set<String> getConditionallyHiddenSectionIds(BusinessObject businessObject) {
036 Set<String> hiddenSectionIds = super.getConditionallyHiddenSectionIds(businessObject);
037
038 // consult the system param on whether to hide the receivable tab
039 if (!showReceivableTab()) {
040 hiddenSectionIds.add("OrganizationAccountingDefaultMaintenanceDocument-EditOrganizationAccountingPaymentDefaults");
041 }
042
043 // consult the system param on whether to hide the writeoff tab
044 if (showWriteoffTab()) {
045 hiddenSectionIds.add("OrganizationAccountingDefaultMaintenanceDocument-EditOrganizationWriteoffAccountDefaults");
046 }
047
048 return hiddenSectionIds;
049 }
050
051 protected boolean showReceivableTab(){
052 return ArConstants.GLPE_RECEIVABLE_OFFSET_GENERATION_METHOD_FAU.equals(SpringContext.getBean(ParameterService.class).getParameterValue(CustomerInvoiceDocument.class, ArConstants.GLPE_RECEIVABLE_OFFSET_GENERATION_METHOD));
053 }
054
055 protected boolean showWriteoffTab(){
056 return ArConstants.GLPE_WRITEOFF_GENERATION_METHOD_ORG_ACCT_DEFAULT.equals(SpringContext.getBean(ParameterService.class).getParameterValue(CustomerInvoiceWriteoffDocument.class, ArConstants.GLPE_WRITEOFF_GENERATION_METHOD));
057 }
058
059 }