Release 2.36.1 (#5540)
* fix weekly hours for new entries with non-global activities * bump packages * prevent creating invoices with 0 entries
This commit is contained in:
@@ -41,12 +41,12 @@ final class InvoiceCreateCommand extends Command
|
||||
private bool $previewUniqueFile = false;
|
||||
|
||||
public function __construct(
|
||||
private ServiceInvoice $serviceInvoice,
|
||||
private CustomerRepository $customerRepository,
|
||||
private ProjectRepository $projectRepository,
|
||||
private InvoiceTemplateRepository $invoiceTemplateRepository,
|
||||
private UserRepository $userRepository,
|
||||
private EventDispatcherInterface $eventDispatcher
|
||||
private readonly ServiceInvoice $serviceInvoice,
|
||||
private readonly CustomerRepository $customerRepository,
|
||||
private readonly ProjectRepository $projectRepository,
|
||||
private readonly InvoiceTemplateRepository $invoiceTemplateRepository,
|
||||
private readonly UserRepository $userRepository,
|
||||
private readonly EventDispatcherInterface $eventDispatcher
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
@@ -256,9 +256,6 @@ final class InvoiceCreateCommand extends Command
|
||||
|
||||
/**
|
||||
* @param Project[] $projects
|
||||
* @param InvoiceQuery $defaultQuery
|
||||
* @param InputInterface $input
|
||||
* @param OutputInterface $output
|
||||
* @return Invoice[]
|
||||
* @throws \Exception
|
||||
*/
|
||||
@@ -287,10 +284,16 @@ final class InvoiceCreateCommand extends Command
|
||||
$query->setTemplate($tpl);
|
||||
|
||||
try {
|
||||
$model = $this->serviceInvoice->createModel($query);
|
||||
// this check makes sure to only fetch invoices with records
|
||||
if (\count($model->getEntries()) === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (null !== $this->previewDirectory) {
|
||||
$invoices[] = $this->saveInvoicePreview($this->serviceInvoice->renderInvoice($this->serviceInvoice->createModel($query), $this->eventDispatcher));
|
||||
$invoices[] = $this->saveInvoicePreview($this->serviceInvoice->renderInvoice($model, $this->eventDispatcher));
|
||||
} else {
|
||||
$invoices[] = $this->serviceInvoice->createInvoice($this->serviceInvoice->createModel($query), $this->eventDispatcher);
|
||||
$invoices[] = $this->serviceInvoice->createInvoice($model, $this->eventDispatcher);
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
$io->error(\sprintf('Failed to create invoice for project "%s" with: %s', $project->getName(), $ex->getMessage()));
|
||||
@@ -334,8 +337,6 @@ final class InvoiceCreateCommand extends Command
|
||||
|
||||
/**
|
||||
* @param Customer[] $customers
|
||||
* @param InvoiceQuery $defaultQuery
|
||||
* @param InputInterface $input
|
||||
* @return Invoice[]
|
||||
* @throws \Exception
|
||||
*/
|
||||
@@ -358,10 +359,16 @@ final class InvoiceCreateCommand extends Command
|
||||
$query->setTemplate($tpl);
|
||||
|
||||
try {
|
||||
$model = $this->serviceInvoice->createModel($query);
|
||||
// this check makes sure to only fetch invoices with records
|
||||
if (\count($model->getEntries()) === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (null !== $this->previewDirectory) {
|
||||
$invoices[] = $this->saveInvoicePreview($this->serviceInvoice->renderInvoice($this->serviceInvoice->createModel($query), $this->eventDispatcher));
|
||||
$invoices[] = $this->saveInvoicePreview($this->serviceInvoice->renderInvoice($model, $this->eventDispatcher));
|
||||
} else {
|
||||
$invoices[] = $this->serviceInvoice->createInvoice($this->serviceInvoice->createModel($query), $this->eventDispatcher);
|
||||
$invoices[] = $this->serviceInvoice->createInvoice($model, $this->eventDispatcher);
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
$io->error(\sprintf('Failed to create invoice for customer "%s" with: %s', $customer->getName(), $ex->getMessage()));
|
||||
@@ -372,10 +379,7 @@ final class InvoiceCreateCommand extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
* @param InputInterface $input
|
||||
* @param OutputInterface $output
|
||||
* @param Invoice[] $invoices
|
||||
* @return int
|
||||
*/
|
||||
protected function renderInvoiceResult(InputInterface $input, OutputInterface $output, array $invoices): int
|
||||
{
|
||||
@@ -449,7 +453,6 @@ final class InvoiceCreateCommand extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
* @param InvoiceQuery $invoiceQuery
|
||||
* @return Customer[]
|
||||
*/
|
||||
private function getActiveCustomers(InvoiceQuery $invoiceQuery): array
|
||||
@@ -467,7 +470,6 @@ final class InvoiceCreateCommand extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
* @param InvoiceQuery $invoiceQuery
|
||||
* @return Project[]
|
||||
*/
|
||||
private function getActiveProjects(InvoiceQuery $invoiceQuery): array
|
||||
|
||||
@@ -17,11 +17,11 @@ final class Constants
|
||||
/**
|
||||
* The current release version
|
||||
*/
|
||||
public const VERSION = '2.36.0';
|
||||
public const VERSION = '2.36.1';
|
||||
/**
|
||||
* The current release: major * 10000 + minor * 100 + patch
|
||||
*/
|
||||
public const VERSION_ID = 23600;
|
||||
public const VERSION_ID = 23601;
|
||||
/**
|
||||
* The software name
|
||||
*/
|
||||
|
||||
@@ -76,6 +76,24 @@ final class QuickEntryWeekType extends AbstractType
|
||||
};
|
||||
$builder->addEventListener(FormEvents::PRE_SET_DATA, $activityFunction);
|
||||
|
||||
// make sure to pre-fill the form, so non-global activities can be loaded for the select project
|
||||
$activityPreSubmitFunction = function (FormEvent $event) use ($activityOptions) {
|
||||
$data = $event->getData();
|
||||
|
||||
if (\is_array($data)) {
|
||||
if (!empty($data['project'])) {
|
||||
$activityOptions['projects'] = [$data['project']];
|
||||
}
|
||||
|
||||
if (!empty($data['activity'])) {
|
||||
$activityOptions['activities'] = [$data['activity']];
|
||||
}
|
||||
}
|
||||
|
||||
$event->getForm()->add('activity', ActivityType::class, $activityOptions);
|
||||
};
|
||||
$builder->addEventListener(FormEvents::PRE_SUBMIT, $activityPreSubmitFunction);
|
||||
|
||||
$builder->add('metaFields', MetaFieldsCollectionType::class);
|
||||
|
||||
$builder->add('timesheets', CollectionType::class, [
|
||||
|
||||
Reference in New Issue
Block a user