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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations