Search in sources :

Example 6 with KualiDocumentFormBase

use of org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase in project cu-kfs by CU-CommunityApps.

the class PurchasingActionBase method isAttachmentReqChanged.

/*
     * check if the 'send to vendor' flag is changed.  
     */
private boolean isAttachmentReqChanged(ActionForm form) {
    boolean ischanged = false;
    KualiDocumentFormBase kualiDocumentFormBase = (KualiDocumentFormBase) form;
    List<Note> savedNotes = getPersistedBoNotesNotes(kualiDocumentFormBase.getDocument());
    List<Note> boNotes = kualiDocumentFormBase.getDocument().getNotes();
    if (!(kualiDocumentFormBase.getDocument() instanceof RequisitionDocument)) {
        restoreSendToVendorFlag(boNotes, ((CuPurchaseOrderForm) kualiDocumentFormBase).getCopiedNotes());
    }
    boolean isChanged = false;
    for (Note savedNote : savedNotes) {
        for (Note note : boNotes) {
            if (note.getNoteIdentifier().equals(savedNote.getNoteIdentifier()) && !StringUtils.equals(note.getNoteTopicText(), savedNote.getNoteTopicText()) && (StringUtils.equalsIgnoreCase(note.getNoteTopicText(), CUPurapConstants.AttachemntToVendorIndicators.SEND_TO_VENDOR) || StringUtils.equalsIgnoreCase(savedNote.getNoteTopicText(), CUPurapConstants.AttachemntToVendorIndicators.SEND_TO_VENDOR))) {
                isChanged = true;
                break;
            }
        }
    }
    return isChanged;
}
Also used : RequisitionDocument(org.kuali.kfs.module.purap.document.RequisitionDocument) KualiDocumentFormBase(org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase) Note(org.kuali.kfs.krad.bo.Note)

Example 7 with KualiDocumentFormBase

use of org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase in project cu-kfs by CU-CommunityApps.

the class CuPurchaseOrderAction method cancel.

// ==== End CU Customization ====
public ActionForward cancel(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    Object question = request.getParameter(KFSConstants.QUESTION_INST_ATTRIBUTE_NAME);
    ActionForward forward = super.cancel(mapping, form, request, response);
    if (question == null) {
        return forward;
    } else {
        Object buttonClicked = request.getParameter(KFSConstants.QUESTION_CLICKED_BUTTON);
        if ((KFSConstants.DOCUMENT_CANCEL_QUESTION.equals(question)) && ConfirmationQuestion.NO.equals(buttonClicked)) {
            // if no button clicked just reload the doc
            return forward;
        }
    // else go to cancel logic below
    }
    // TODO : need to check note length ?
    KualiDocumentFormBase kualiDocumentFormBase = (KualiDocumentFormBase) form;
    String reason = request.getParameter(KFSConstants.QUESTION_REASON_ATTRIBUTE_NAME);
    if (StringUtils.isNotBlank(reason)) {
        String noteText = "Reason for cancelling PO : " + reason;
        Note newNote = new Note();
        newNote.setNoteText(noteText);
        newNote.setNoteTypeCode(KFSConstants.NoteTypeEnum.BUSINESS_OBJECT_NOTE_TYPE.getCode());
        kualiDocumentFormBase.setNewNote(newNote);
        try {
            insertBONote(mapping, kualiDocumentFormBase, request, response);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
    return forward;
}
Also used : KualiDocumentFormBase(org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase) Note(org.kuali.kfs.krad.bo.Note) ActionForward(org.apache.struts.action.ActionForward) AuthorizationException(org.kuali.kfs.krad.exception.AuthorizationException)

Example 8 with KualiDocumentFormBase

use of org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase in project cu-kfs by CU-CommunityApps.

the class CuRequisitionAction method insertBONote.

@Override
public ActionForward insertBONote(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    KualiDocumentFormBase kualiDocumentFormBase = (KualiDocumentFormBase) form;
    Note newNote = kualiDocumentFormBase.getNewNote();
    NoteExtendedAttribute extendedAttribute = (NoteExtendedAttribute) newNote.getExtension();
    ActionForward forward = super.insertBONote(mapping, form, request, response);
    if (newNote != kualiDocumentFormBase.getNewNote()) {
        Note addedNote = kualiDocumentFormBase.getDocument().getNotes().get(kualiDocumentFormBase.getDocument().getNotes().size() - 1);
        extendedAttribute.setNoteIdentifier(addedNote.getNoteIdentifier());
        addedNote.setExtension(extendedAttribute);
        SpringContext.getBean(BusinessObjectService.class).save(extendedAttribute);
        addedNote.refreshReferenceObject("extension");
    }
    return forward;
}
Also used : NoteExtendedAttribute(edu.cornell.kfs.sys.businessobject.NoteExtendedAttribute) KualiDocumentFormBase(org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase) Note(org.kuali.kfs.krad.bo.Note) ActionForward(org.apache.struts.action.ActionForward) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Example 9 with KualiDocumentFormBase

use of org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase in project cu-kfs by CU-CommunityApps.

the class CuRequisitionAction method copy.

/**
 * Overridden to guarantee that form of copied document is set to whatever the entry mode of the document is
 * @see org.kuali.kfs.kns.web.struts.action.KualiTransactionalDocumentActionBase#copy
 * (org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm,
 * javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 */
@Override
public ActionForward copy(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    ActionForward forward = null;
    String docID = "docId";
    if (request.getParameter(docID) == null) {
        forward = super.copy(mapping, form, request, response);
    } else {
        // this is copy document from Procurement Gateway:
        // use this url to call: http://localhost:8080/kfs-dev/purapRequisition.do?methodToCall=copy&docId=xxxx
        String docId = request.getParameter(docID);
        KualiDocumentFormBase kualiDocumentFormBase = (KualiDocumentFormBase) form;
        CuRequisitionDocument document = null;
        document = (CuRequisitionDocument) getDocumentService().getByDocumentHeaderId(docId);
        document.toCopyFromGateway();
        kualiDocumentFormBase.setDocument(document);
        WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
        kualiDocumentFormBase.setDocTypeName(workflowDocument.getDocumentTypeName());
        SpringContext.getBean(SessionDocumentService.class).addDocumentToUserSession(GlobalVariables.getUserSession(), workflowDocument);
        forward = mapping.findForward(RiceConstants.MAPPING_BASIC);
    }
    return forward;
}
Also used : CuRequisitionDocument(edu.cornell.kfs.module.purap.document.CuRequisitionDocument) SessionDocumentService(org.kuali.kfs.krad.service.SessionDocumentService) WorkflowDocument(org.kuali.rice.kew.api.WorkflowDocument) KualiDocumentFormBase(org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase) ActionForward(org.apache.struts.action.ActionForward)

Example 10 with KualiDocumentFormBase

use of org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase in project cu-kfs by CU-CommunityApps.

the class CapitalAssetInformationActionBase method copy.

/**
 * Overridden to guarantee that form of copied document is set to whatever the entry mode of the document is
 *
 * @see org.kuali.rice.kns.web.struts.action.KualiTransactionalDocumentActionBase#copy(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 */
@Override
public ActionForward copy(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    CapitalAccountingLinesFormBase capitalAccountingLinesFormBase = (CapitalAccountingLinesFormBase) form;
    ;
    CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) capitalAccountingLinesFormBase.getFinancialDocument();
    List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
    List<CapitalAccountingLines> copiedCapitalAccountingLines = new ArrayList<>();
    for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
        copiedCapitalAccountingLines.add(capitalAccountingLine);
    }
    capitalAccountingLines.clear();
    ActionForward forward = super.copy(mapping, form, request, response);
    caldb.setCapitalAccountingLines(copiedCapitalAccountingLines);
    // if the copied document has capital asset collection, remove the collection
    KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
    AccountingDocument document = kualiAccountingDocumentFormBase.getFinancialDocument();
    if (document instanceof CapitalAssetEditable) {
        CapitalAssetEditable capitalAssetEditable = (CapitalAssetEditable) document;
        List<CapitalAssetInformation> capitalAssets = capitalAssetEditable.getCapitalAssetInformation();
        for (CapitalAssetInformation capitalAsset : capitalAssets) {
            Long capitalAssetNumber = capitalAsset.getCapitalAssetNumber();
            resetCapitalAssetInfo(capitalAsset);
            // because resetCapitalAssetInfo cleared the value.
            if (KFSConstants.CapitalAssets.CAPITAL_ASSET_MODIFY_ACTION_INDICATOR.equalsIgnoreCase(capitalAsset.getCapitalAssetActionIndicator())) {
                capitalAsset.setCapitalAssetNumber(capitalAssetNumber);
            }
            capitalAsset.setCapitalAssetProcessedIndicator(false);
        }
    }
    // setup the initial next sequence number column..
    KualiDocumentFormBase kualiDocumentFormBase = (KualiDocumentFormBase) form;
    setupIntialNextCapitalAssetLineNumber(kualiDocumentFormBase);
    checkCapitalAccountingLinesSelected(capitalAccountingLinesFormBase);
    return forward;
}
Also used : CapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) ArrayList(java.util.ArrayList) CapitalAccountingLinesDocumentBase(org.kuali.kfs.fp.document.CapitalAccountingLinesDocumentBase) ActionForward(org.apache.struts.action.ActionForward) CapitalAssetEditable(org.kuali.kfs.fp.document.CapitalAssetEditable) CapitalAccountingLines(org.kuali.kfs.fp.businessobject.CapitalAccountingLines) KualiDocumentFormBase(org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase) AccountingDocument(org.kuali.kfs.sys.document.AccountingDocument) KualiAccountingDocumentFormBase(org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase)

Aggregations

KualiDocumentFormBase (org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase)17 ActionForward (org.apache.struts.action.ActionForward)8 Note (org.kuali.kfs.krad.bo.Note)7 Document (org.kuali.kfs.krad.document.Document)3 WorkflowDocument (org.kuali.rice.kew.api.WorkflowDocument)3 IWantDocument (edu.cornell.kfs.module.purap.document.IWantDocument)2 PurApFavoriteAccountLineBuilderForIWantDocument (edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument)2 FormFile (org.apache.struts.upload.FormFile)2 MaintenanceDocument (org.kuali.kfs.kns.document.MaintenanceDocument)2 Attachment (org.kuali.kfs.krad.bo.Attachment)2 AuthorizationException (org.kuali.kfs.krad.exception.AuthorizationException)2 ItemParserException (org.kuali.kfs.module.purap.exception.ItemParserException)2 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)2 IWantAccount (edu.cornell.kfs.module.purap.businessobject.IWantAccount)1 IWantItem (edu.cornell.kfs.module.purap.businessobject.IWantItem)1 CuRequisitionDocument (edu.cornell.kfs.module.purap.document.CuRequisitionDocument)1 IWantDocumentService (edu.cornell.kfs.module.purap.document.service.IWantDocumentService)1 NoteExtendedAttribute (edu.cornell.kfs.sys.businessobject.NoteExtendedAttribute)1 ArrayList (java.util.ArrayList)1 CapitalAccountingLines (org.kuali.kfs.fp.businessobject.CapitalAccountingLines)1