use of org.kuali.kfs.module.purap.document.service.PurapService in project cu-kfs by CU-CommunityApps.
the class PurApRelatedViews method getGroupedRelatedReceivingViews.
/**
* Groups related LineItemReceivingView and its CorrectionReceivingViews, with more recent receiving groups in the front;
* and within each group, with more recent corrections in the front.
*
* @return A list of ReceivingCorrectionViewGroups.
*/
public List<ReceivingViewGroup> getGroupedRelatedReceivingViews() {
if (groupedRelatedReceivingViews != null) {
return groupedRelatedReceivingViews;
}
groupedRelatedReceivingViews = new ArrayList<ReceivingViewGroup>();
PurapService purapService = SpringContext.getBean(PurapService.class);
List<LineItemReceivingView> liviews = purapService.getRelatedViews(LineItemReceivingView.class, accountsPayablePurchasingDocumentLinkIdentifier);
List<CorrectionReceivingView> crviews = purapService.getRelatedViews(CorrectionReceivingView.class, accountsPayablePurchasingDocumentLinkIdentifier);
// both LineItemReceivingViews and CorrectionReceivingViews are already in order with most recent first, so no need to sort
for (LineItemReceivingView liview : liviews) {
ReceivingViewGroup group = new ReceivingViewGroup();
// could be current document
group.lineItemView = liview;
for (CorrectionReceivingView crview : crviews) {
if (StringUtils.equals(crview.getLineItemReceivingDocumentNumber(), liview.getDocumentNumber()) && !documentNumber.equals(crview.getDocumentNumber())) {
// exclude current document
group.addCorrectionView(crview);
}
}
groupedRelatedReceivingViews.add(group);
}
return groupedRelatedReceivingViews;
}
use of org.kuali.kfs.module.purap.document.service.PurapService in project cu-kfs by CU-CommunityApps.
the class CuCreditMemoServiceImplTest method setUp.
@Before
public void setUp() throws Exception {
accountsPayableService = EasyMock.createNiceMock(AccountsPayableService.class);
EasyMock.expect(accountsPayableService.getExpiredOrClosedAccountList(creditMemoDocument)).andReturn(new HashMap<>());
EasyMock.replay(accountsPayableService);
dataDictionaryService = EasyMock.createNiceMock(DataDictionaryService.class);
EasyMock.expect(dataDictionaryService.getAttributeMaxLength(DocumentHeader.class, KRADPropertyConstants.DOCUMENT_DESCRIPTION)).andReturn(200);
EasyMock.replay(dataDictionaryService);
dateTimeService = new DateTimeServiceImpl();
documentService = new MockDocumentServiceImpl();
noteService = EasyMock.createMock(NoteService.class);
purapService = EasyMock.createMock(PurapService.class);
vendorService = new MockVendorServiceImpl();
creditMemoServiceImpl = PowerMock.createPartialMock(CuCreditMemoServiceImplTest.TestCuCreditMemoServiceImpl.class, "reIndexDocument", "getCreditMemoDocumentById");
creditMemoServiceImpl.setDocumentService(documentService);
creditMemoServiceImpl.setNoteService(noteService);
creditMemoServiceImpl.setPurapService(purapService);
creditMemoServiceImpl.setAccountsPayableService(accountsPayableService);
creditMemoServiceImpl.setVendorService(vendorService);
creditMemoServiceImpl.setDataDictionaryService(dataDictionaryService);
creditMemoDocument = setupVendorCreditMemoDocument();
mo14Person = MockPersonUtil.createMockPerson(UserNameFixture.mo14);
mo14Session = MockPersonUtil.createMockUserSession(mo14Person);
GlobalVariables.setUserSession(mo14Session);
}
use of org.kuali.kfs.module.purap.document.service.PurapService in project cu-kfs by CU-CommunityApps.
the class CuPurchaseOrderAction method movePoCxer.
protected ActionForward movePoCxer(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String newStatus, String newStatusLabel) throws Exception {
KualiDocumentFormBase kualiDocumentFormBase = (KualiDocumentFormBase) form;
PurchaseOrderDocument po = (PurchaseOrderDocument) kualiDocumentFormBase.getDocument();
Object question = request.getParameter(KFSConstants.QUESTION_INST_ATTRIBUTE_NAME);
// If the user has not received the question screen yet, then perform the PO status update.
if (ObjectUtils.isNull(question)) {
// Check authorization.
checkMovePoCxerAuthorization(po);
// Use logic similar to the executeManualStatusChange() method to override the document's status.
try {
PurapService purapService = SpringContext.getBean(PurapService.class);
po.updateAndSaveAppDocStatus(newStatus);
purapService.saveDocumentNoValidation(po);
} catch (Exception e) {
throw new RuntimeException(e);
}
// Add a message to the route log.
po.getDocumentHeader().getWorkflowDocument().logAnnotation("Moved PO document from 'Error occurred sending cxml' status to '" + newStatusLabel + "' status.");
// Present a success message to the user.
String message = "PO document " + po.getDocumentNumber() + " was successfully moved to '" + newStatusLabel + "' status.";
return this.performQuestionWithoutInput(mapping, form, request, response, MOVE_CXML_ERROR_PO_SUCCESS, message, STATUS_OVERRIDE_QUESTION, MOVE_CXML_ERROR_PO_SUCCESS, "");
}
return returnToSender(request, mapping, kualiDocumentFormBase);
}
Aggregations