Skip to content

Commit

Permalink
1635: Cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
rimi-itk committed Jul 5, 2024
1 parent 95a43d4 commit e50011a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
1 change: 0 additions & 1 deletion config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ services:
$options:
accounts: '%env(json:INVOICE_ENTRY_ACCOUNTS)%'
one_invoice_per_issue: '%env(bool:INVOICE_ONE_INVOICE_PER_ISSUE)%'
set_invoice_description_from_entries: '%env(bool:SET_INVOICE_DESCRIPTION_FROM_ENTRIES)%'
set_invoice_description_from_issue_description: '%env(bool:SET_INVOICE_DESCRIPTION_FROM_ISSUE_DESCRIPTION)%'
invoice_description_issue_heading: '%env(INVOICE_DESCRIPTION_ISSUE_HEADING)%'
invoice_description_element_replacements: '%env(json:INVOICE_DESCRIPTION_ELEMENT_REPLACEMENTS)%'
Expand Down
1 change: 0 additions & 1 deletion src/Controller/InvoiceEntryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use App\Service\BillingService;
use App\Service\ClientHelper;
use App\Service\InvoiceHelper;
use App\Service\ViewService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand Down
2 changes: 1 addition & 1 deletion src/Service/InvoiceHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private function resolveOptions(array $options): array
->setAllowedTypes('invoice_issue_far_past_cutoff_date', ['null', 'string'])
->setAllowedValues('invoice_issue_far_past_cutoff_date', static function (?string $value) {
try {
new \DateTimeImmutable($value);
new \DateTimeImmutable($value ?: '0000-00-00');

return true;
} catch (Exception) {
Expand Down
14 changes: 9 additions & 5 deletions src/Service/ProjectBillingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,19 @@ public function __construct(

public function getIssuesNotIncludedInProjectBillingFromTheFarPast(ProjectBilling $projectBilling): array
{
$cutoffDate = $this->invoiceHelper->getIssueFarPastCutoffDate();
$issues = null;

$projectBilling = clone $projectBilling;
$projectBilling->setPeriodStart(new \DateTimeImmutable('0001-01-01'));
$projectBilling->setPeriodEnd($cutoffDate);
if ($cutoffDate = $this->invoiceHelper->getIssueFarPastCutoffDate()) {
$projectBilling = clone $projectBilling;
$projectBilling->setPeriodStart(new \DateTimeImmutable('0001-01-01'));
$projectBilling->setPeriodEnd($cutoffDate);

$issues = $this->getIssuesNotIncludedInProjectBilling($projectBilling);
}

return [
'cutoff_date' => $cutoffDate,
'issues' => $this->getIssuesNotIncludedInProjectBilling($projectBilling),
'issues' => $issues,
];
}

Expand Down

0 comments on commit e50011a

Please sign in to comment.