01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.kuali.module.purap.document;
18:
19: import org.kuali.core.rule.event.KualiDocumentEvent;
20: import org.kuali.kfs.context.SpringContext;
21: import org.kuali.module.purap.PurapConstants;
22: import org.kuali.module.purap.service.PurapService;
23: import org.kuali.module.purap.service.PurchaseOrderService;
24:
25: /**
26: * Purchase Order Payment Hold Document
27: */
28: public class PurchaseOrderPaymentHoldDocument extends
29: PurchaseOrderDocument {
30: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
31: .getLogger(PurchaseOrderPaymentHoldDocument.class);
32:
33: /**
34: * Default constructor.
35: */
36: public PurchaseOrderPaymentHoldDocument() {
37: super ();
38: }
39:
40: /**
41: * General Ledger pending entries are not created for this document. Overriding this method so that entries are not created.
42: *
43: * @see org.kuali.module.purap.document.PurchaseOrderDocument#customPrepareForSave(org.kuali.core.rule.event.KualiDocumentEvent)
44: */
45: @Override
46: public void customPrepareForSave(KualiDocumentEvent event) {
47: // do not set the accounts in sourceAccountingLines; this document should not create GL entries
48: }
49:
50: /**
51: * When Purchase Order Payment Hold document has been Processed through Workflow, the PO status changes to "Payment Hold".
52: *
53: * @see org.kuali.module.purap.document.PurchaseOrderDocument#handleRouteStatusChange()
54: */
55: @Override
56: public void handleRouteStatusChange() {
57: super .handleRouteStatusChange();
58:
59: // DOCUMENT PROCESSED
60: if (getDocumentHeader().getWorkflowDocument()
61: .stateIsProcessed()) {
62: SpringContext
63: .getBean(PurchaseOrderService.class)
64: .setCurrentAndPendingIndicatorsForApprovedPODocuments(
65: this );
66:
67: // set purap status
68: SpringContext.getBean(PurapService.class).updateStatus(
69: this ,
70: PurapConstants.PurchaseOrderStatuses.PAYMENT_HOLD);
71: SpringContext.getBean(PurchaseOrderService.class)
72: .saveDocumentNoValidation(this );
73: }
74: // DOCUMENT DISAPPROVED
75: else if (getDocumentHeader().getWorkflowDocument()
76: .stateIsDisapproved()) {
77: SpringContext
78: .getBean(PurchaseOrderService.class)
79: .setCurrentAndPendingIndicatorsForDisapprovedChangePODocuments(
80: this );
81: }
82: // DOCUMENT CANCELED
83: else if (getDocumentHeader().getWorkflowDocument()
84: .stateIsCanceled()) {
85: SpringContext
86: .getBean(PurchaseOrderService.class)
87: .setCurrentAndPendingIndicatorsForCancelledChangePODocuments(
88: this);
89: }
90: }
91:
92: }
|