public interface InvoiceRepository extends JpaRepository<Invoice, Long>, InvoiceRepositorySearch {
- List<Invoice> findByHumanId(String humanId);
+ List<Invoice> findByHumanIdAndPlanned(String humanId, boolean planned);
- Optional<Invoice> findByHumanIdAndPartner(String humanId, Partner partner);
+ Optional<Invoice> findByHumanIdAndPartnerAndPlanned(String humanId, Partner partner, boolean planned);
}
}
hideEditor();
if (Objects.isNull(filterPartner)) {
- List<Invoice> invoices = invoiceRepository.findByHumanId(invoiceNumber);
+ List<Invoice> invoices = invoiceRepository.findByHumanIdAndPlanned(invoiceNumber, false);
if (invoices.isEmpty()) {
setPartnerRequired(false);
Notification.show("Nem található számla: " + invoiceNumber, null, null, null, 3000, true);
}
}
} else {
- Optional<Invoice> opInvoice = invoiceRepository.findByHumanIdAndPartner(invoiceNumber, filterPartner);
+ Optional<Invoice> opInvoice = invoiceRepository.findByHumanIdAndPartnerAndPlanned(invoiceNumber, filterPartner, false);
opInvoice.ifPresent(this::showEditor);
}
}
onClick="@command('onChangeProject')" disabled="@load(empty vm.selectedEntity)"/>
<toolbarbutton label="Számla kiegyenlítés" iconSclass="z-icon-credit-card"
onClick="@command('onInvoicePayment')"
- disabled="@load(empty vm.selectedEntity)"/>
+ disabled="@load(empty vm.selectedEntity || vm.selectedEntity.planned)"/>
<!-- <toolbarbutton label="Hozzáadás" iconSclass="z-icon-plus" onClick="@command('onAdd')"/>-->
<!-- <toolbarbutton label="Törlés" iconSclass="z-icon-remove" onClick="@command('onDelete')"-->
}
private boolean isInvoiceImported(String humanId, Partner partner) {
- return invoiceRepository.findByHumanIdAndPartner(humanId, partner).isPresent();
+ return invoiceRepository.findByHumanIdAndPartnerAndPlanned(humanId, partner, false).isPresent();
}
}