Search in sources :

Example 1 with PurapService

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;
}
Also used : PurapService(org.kuali.kfs.module.purap.document.service.PurapService) CorrectionReceivingView(org.kuali.kfs.module.purap.businessobject.CorrectionReceivingView) LineItemReceivingView(org.kuali.kfs.module.purap.businessobject.LineItemReceivingView)

Example 2 with PurapService

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);
}
Also used : DateTimeServiceImpl(org.kuali.rice.core.impl.datetime.DateTimeServiceImpl) PurapService(org.kuali.kfs.module.purap.document.service.PurapService) NoteService(org.kuali.kfs.krad.service.NoteService) AccountsPayableService(org.kuali.kfs.module.purap.document.service.AccountsPayableService) DataDictionaryService(org.kuali.kfs.kns.service.DataDictionaryService) Before(org.junit.Before)

Example 3 with PurapService

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);
}
Also used : PurapService(org.kuali.kfs.module.purap.document.service.PurapService) KualiDocumentFormBase(org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase) PurchaseOrderDocument(org.kuali.kfs.module.purap.document.PurchaseOrderDocument) AuthorizationException(org.kuali.kfs.krad.exception.AuthorizationException)

Aggregations

PurapService (org.kuali.kfs.module.purap.document.service.PurapService)3 Before (org.junit.Before)1 DataDictionaryService (org.kuali.kfs.kns.service.DataDictionaryService)1 KualiDocumentFormBase (org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase)1 AuthorizationException (org.kuali.kfs.krad.exception.AuthorizationException)1 NoteService (org.kuali.kfs.krad.service.NoteService)1 CorrectionReceivingView (org.kuali.kfs.module.purap.businessobject.CorrectionReceivingView)1 LineItemReceivingView (org.kuali.kfs.module.purap.businessobject.LineItemReceivingView)1 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)1 AccountsPayableService (org.kuali.kfs.module.purap.document.service.AccountsPayableService)1 DateTimeServiceImpl (org.kuali.rice.core.impl.datetime.DateTimeServiceImpl)1