Search in sources :

Example 1 with Organisation

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

the class SupplierImportLine method importData.

@Override
public List<Object> importData(Object previousRow) {
    SupplierImportLine previous = (SupplierImportLine) previousRow;
    if (getSupplierName() == null && getChamberOfCommerceCode() == null) {
        setSupplierName(previous.getSupplierName());
        setChamberOfCommerceCode(previous.getChamberOfCommerceCode());
    }
    if (getCountry() == null) {
        setCountry(previous.getCountry());
    }
    final Country countryObj = countryRepository.findCountry(getCountry());
    this.message = "";
    Organisation organisation;
    organisation = findExistingOrganisation();
    if (bankAccountRepository.findByReference(getIban()).size() > 0) {
        message = message.concat(String.format("More than one iban found for %s. ", getIban()));
        // only set chamber of commerce code - do not create organisation or bank account
        setChamberOfCommerceCodeIfEmpty(organisation);
    } else {
        if (organisation == null) {
            organisation = organisationRepository.newOrganisation(null, true, getSupplierName(), countryObj);
        }
        bankAccountRepository.newBankAccount(organisation, getIban(), getBic());
        setChamberOfCommerceCodeIfEmpty(organisation);
    }
    if (message != "") {
        messageService.warnUser(message);
    }
    return Lists.newArrayList(message);
}
Also used : Organisation(org.estatio.module.party.dom.Organisation) Country(org.incode.module.country.dom.impl.Country)

Example 2 with Organisation

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

the class DocumentTypeAndTemplatesFSForInvoicesUsingSsrs_Test method setUp.

@Before
public void setUp() throws Exception {
    stubDocumentType = DocumentTypeData.PRELIM_LETTER.create();
    stubInvoice = new InvoiceForLease();
    stubInvoice.setDueDate(new LocalDate(2016, 11, 1));
    stubBuyer = new Organisation();
    stubBuyer.setName("Buyer-1");
    stubInvoice.setBuyer(stubBuyer);
    stubInvoice.setLease(mockLease);
    stubProperty = new Property();
    stubProperty.setReference("XXX");
    stubUnit = new Unit();
    stubUnit.setName("XXX-123");
    stubBrand = new Brand();
    stubBrand.setName("Brandino");
    // expect
    context.checking(new Expectations() {

        {
            allowing(mockPaperclipRepository).paperclipAttaches(mockDocument, InvoiceForLease.class);
            will(returnValue(stubInvoice));
            allowing(mockLease).getProperty();
            will(returnValue(stubProperty));
            allowing(mockLease).getReference();
            will(returnValue("XXX-ABC-789"));
            allowing(mockDocument).getType();
            will(returnValue(stubDocumentType));
        }
    });
    // expecting
    context.checking(new Expectations() {

        {
            allowing(mockConfigurationService).getProperty("isis.deploymentType");
            will(returnValue("prototyping"));
        }
    });
    rendererModelFactory = new FreemarkerModelOfPrelimLetterOrInvoiceDocForEmailCover();
    inject(rendererModelFactory, "paperclipRepository", mockPaperclipRepository);
}
Also used : Brand(org.estatio.module.lease.dom.occupancy.tags.Brand) Expectations(org.jmock.Expectations) InvoiceForLease(org.estatio.module.lease.dom.invoicing.InvoiceForLease) Organisation(org.estatio.module.party.dom.Organisation) Unit(org.estatio.module.asset.dom.Unit) LocalDate(org.joda.time.LocalDate) Property(org.estatio.module.asset.dom.Property) FreemarkerModelOfPrelimLetterOrInvoiceDocForEmailCover(org.estatio.module.lease.spiimpl.document.binders.FreemarkerModelOfPrelimLetterOrInvoiceDocForEmailCover) Before(org.junit.Before)

Example 3 with Organisation

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

the class Order method createSeller.

@Action(semantics = SemanticsOf.IDEMPOTENT)
@ActionLayout(named = "Create Supplier")
public Order createSeller(final OrganisationNameNumberViewModel candidate, final Country country, @Nullable final String ibanNumber) {
    Organisation organisation = organisationRepository.newOrganisation(null, true, candidate.getOrganisationName(), country);
    if (candidate.getChamberOfCommerceCode() != null)
        organisation.setChamberOfCommerceCode(candidate.getChamberOfCommerceCode());
    setSeller(organisation);
    if (ibanNumber != null) {
        bankAccountRepository.newBankAccount(organisation, ibanNumber, null);
    }
    partyRoleRepository.findOrCreate(organisation, IncomingInvoiceRoleTypeEnum.SUPPLIER);
    return this;
}
Also used : Organisation(org.estatio.module.party.dom.Organisation) Action(org.apache.isis.applib.annotation.Action) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Example 4 with Organisation

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

the class IncomingDocViewModel_verifySupplier method $$.

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

Example 5 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)

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