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 Remove Payment Hold Document
27: */
28: public class PurchaseOrderRemoveHoldDocument extends
29: PurchaseOrderDocument {
30: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
31: .getLogger(PurchaseOrderRemoveHoldDocument.class);
32:
33: /**
34: * Default constructor.
35: */
36: public PurchaseOrderRemoveHoldDocument() {
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 Remove Payment Hold document has been Processed through Workflow, the PO status changes to "OPEN".
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 , PurapConstants.PurchaseOrderStatuses.OPEN);
70: SpringContext.getBean(PurchaseOrderService.class)
71: .saveDocumentNoValidation(this );
72: }
73: // DOCUMENT DISAPPROVED
74: else if (getDocumentHeader().getWorkflowDocument()
75: .stateIsDisapproved()) {
76: SpringContext
77: .getBean(PurchaseOrderService.class)
78: .setCurrentAndPendingIndicatorsForDisapprovedRemoveHoldPODocuments(
79: this );
80: }
81: // DOCUMENT CANCELED
82: else if (getDocumentHeader().getWorkflowDocument()
83: .stateIsCanceled()) {
84: SpringContext
85: .getBean(PurchaseOrderService.class)
86: .setCurrentAndPendingIndicatorsForCancelledRemoveHoldPODocuments(
87: this);
88: }
89: }
90:
91: }
|