Search in sources :

Example 6 with Organisation

use of org.estatio.module.party.dom.Organisation in project estatio by estatio.

the class IncomingInvoice_verifySupplier method $$.

@Action(semantics = SemanticsOf.IDEMPOTENT_ARE_YOU_SURE)
public IncomingInvoice $$(final OrganisationNameNumberViewModel organisationCheck) {
    Organisation orgToVerify = (Organisation) incomingInvoice.getSeller();
    orgToVerify.verify(organisationCheck);
    return incomingInvoice;
}
Also used : Organisation(org.estatio.module.party.dom.Organisation) Action(org.apache.isis.applib.annotation.Action)

Example 7 with Organisation

use of org.estatio.module.party.dom.Organisation in project estatio by estatio.

the class OrganisationMenu method newOrganisation.

@Action(semantics = SemanticsOf.NON_IDEMPOTENT)
@MemberOrder(sequence = "1")
public Organisation newOrganisation(@Parameter(regexPattern = ReferenceType.Meta.REGEX, regexPatternReplacement = ReferenceType.Meta.REGEX_DESCRIPTION, optionality = Optionality.OPTIONAL) final String reference, final String name, final Country country, final List<IPartyRoleType> partyRoleTypes) {
    boolean useNumerator = Strings.isNullOrEmpty(reference);
    final Organisation organisation = organisationRepository.newOrganisation(reference, useNumerator, name, country);
    for (IPartyRoleType partyRoleType : partyRoleTypes) {
        partyRoleRepository.findOrCreate(organisation, partyRoleType);
    }
    return organisation;
}
Also used : IPartyRoleType(org.estatio.module.party.dom.role.IPartyRoleType) Organisation(org.estatio.module.party.dom.Organisation) Action(org.apache.isis.applib.annotation.Action) MemberOrder(org.apache.isis.applib.annotation.MemberOrder)

Example 8 with Organisation

use of org.estatio.module.party.dom.Organisation in project estatio by estatio.

the class OrganisationImport method importData.

@Override
public List<Object> importData(final Object previousRow) {
    final ApplicationTenancy applicationTenancy = applicationTenancyRepository.findByPath(atPath);
    Organisation org = (Organisation) partyRepository.findPartyByReference(reference);
    if (org == null) {
        try {
            if (applicationTenancy == null) {
                throw new IllegalArgumentException("atPath not found");
            }
            org = organisationRepository.newOrganisation(reference, false, name, applicationTenancy);
        } catch (Exception e) {
            LOG.error("Error importing organisation : " + reference, e);
        }
    }
    org.setApplicationTenancyPath(atPath);
    org.setName(name);
    org.setFiscalCode(fiscalCode);
    org.setVatCode(vatCode);
    if (chamberOfCommerceCode != null && !chamberOfCommerceCode.matches("[ \t]+")) {
        org.setChamberOfCommerceCode(chamberOfCommerceCode.replace(" ", ""));
    }
    return Lists.newArrayList(org);
}
Also used : Organisation(org.estatio.module.party.dom.Organisation) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)

Example 9 with Organisation

use of org.estatio.module.party.dom.Organisation in project estatio by estatio.

the class EstatioApplicationTenancyRepositoryForLease_Test method partyWith.

private Party partyWith(final String hello) {
    Party pa = new Organisation();
    pa.setReference(hello);
    return pa;
}
Also used : Party(org.estatio.module.party.dom.Party) Organisation(org.estatio.module.party.dom.Organisation)

Example 10 with Organisation

use of org.estatio.module.party.dom.Organisation in project estatio by estatio.

the class IncomingDocAsInvoiceViewModel_Test method notification_BuyerBarcodeMatchValidation_works.

@Test
public void notification_BuyerBarcodeMatchValidation_works() {
    String notification;
    // given
    IncomingDocAsInvoiceViewModel viewModel = new IncomingDocAsInvoiceViewModel();
    Party buyerDerived = new Organisation();
    BuyerFinder buyerFinder = new BuyerFinder() {

        @Override
        public Party buyerDerivedFromDocumentName(final IncomingInvoice incomingInvoice) {
            return buyerDerived;
        }
    };
    IncomingInvoice invoice = new IncomingInvoice();
    Party buyerOnViewmodel = new Organisation();
    viewModel.setDomainObject(invoice);
    viewModel.buyerFinder = buyerFinder;
    viewModel.setBuyer(buyerOnViewmodel);
    // when
    notification = viewModel.getNotification();
    // then
    Assertions.assertThat(notification).isEqualTo("Buyer does not match barcode (document name); ");
    // and given (buyers matching)
    viewModel.setBuyer(buyerDerived);
    // when
    notification = viewModel.getNotification();
    // then
    Assertions.assertThat(notification).isNull();
    // and given (no buyer derived)
    BuyerFinder buyerFinderReturningNull = new BuyerFinder() {

        @Override
        public Party buyerDerivedFromDocumentName(final IncomingInvoice incomingInvoice) {
            return null;
        }
    };
    viewModel.buyerFinder = buyerFinderReturningNull;
    // when
    notification = viewModel.getNotification();
    // then
    Assertions.assertThat(notification).isNull();
}
Also used : Party(org.estatio.module.party.dom.Party) BuyerFinder(org.estatio.module.capex.dom.documents.BuyerFinder) Organisation(org.estatio.module.party.dom.Organisation) IncomingInvoice(org.estatio.module.capex.dom.invoice.IncomingInvoice) Test(org.junit.Test)

Aggregations

Organisation (org.estatio.module.party.dom.Organisation)37 Test (org.junit.Test)26 Expectations (org.jmock.Expectations)18 Party (org.estatio.module.party.dom.Party)13 IncomingInvoice (org.estatio.module.capex.dom.invoice.IncomingInvoice)9 BankAccount (org.estatio.module.financial.dom.BankAccount)7 LocalDate (org.joda.time.LocalDate)7 Action (org.apache.isis.applib.annotation.Action)6 Property (org.estatio.module.asset.dom.Property)5 BigDecimal (java.math.BigDecimal)4 ArrayList (java.util.ArrayList)4 Charge (org.estatio.module.charge.dom.Charge)4 Order (org.estatio.module.capex.dom.order.Order)3 Person (org.estatio.module.party.dom.Person)3 ActionLayout (org.apache.isis.applib.annotation.ActionLayout)2 BudgetItem (org.estatio.module.budget.dom.budgetitem.BudgetItem)2 IncomingInvoiceMenu (org.estatio.module.capex.app.IncomingInvoiceMenu)2 Project (org.estatio.module.capex.dom.project.Project)2 Country (org.incode.module.country.dom.impl.Country)2 MemberOrder (org.apache.isis.applib.annotation.MemberOrder)1