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