Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #134 from jolicode/fix/reminder-date-selection
Browse files Browse the repository at this point in the history
Fix forecast reminder date selection
  • Loading branch information
xavierlacot authored Jul 21, 2023
2 parents 39fef7a + 640cb49 commit 6d6c75d
Show file tree
Hide file tree
Showing 10 changed files with 290 additions and 272 deletions.
167 changes: 94 additions & 73 deletions composer.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions config/packages/bugsnag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ bugsnag:
notify_release_stages:
- production
discard_classes:
- Symfony\Component\HttpKernel\Exception\HttpException\RedirectException
- Symfony\Component\HttpKernel\Exception\NotFoundHttpException
- Symfony\Component\Security\Core\Exception\AccessDeniedException

Expand Down
2 changes: 1 addition & 1 deletion config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ services:
arguments:
$invoicingStateMachine: '@state_machine.invoicing'

Http\Client\HttpClient:
Psr\Http\Client\ClientInterface:
alias: Http\Client\Curl\Client

Http\Client\Curl\Client: ~
Expand Down
4 changes: 2 additions & 2 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
LevelSetList::UP_TO_PHP_82,
SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES,
SymfonySetList::SYMFONY_62,
SymfonySetList::SYMFONY_63,
SymfonySetList::SYMFONY_CODE_QUALITY,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
SensiolabsSetList::FRAMEWORK_EXTRA_61,
SensiolabsSetList::ANNOTATIONS_TO_ATTRIBUTES,
]);
};
4 changes: 2 additions & 2 deletions src/Controller/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
class AuthController extends AbstractController
{
#[Route(path: '/connect', name: 'connect_harvest')]
public function connectAction(ClientRegistry $clientRegistry): \Symfony\Component\HttpFoundation\Response
public function connect(ClientRegistry $clientRegistry): \Symfony\Component\HttpFoundation\Response
{
return $clientRegistry
->getClient('harvest')
->redirect(['all'], []);
}

#[Route(path: '/connect/check', name: 'connect_harvest_check')]
public function connectCheckAction(): void
public function connectCheck(): void
{
}
}
1 change: 1 addition & 0 deletions src/Controller/Organization/ReminderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function index(Request $request, ForecastAccount $forecastAccount, UserRe
if (null === $forecastReminder) {
$forecastReminder = new ForecastReminder();
$forecastReminder->setForecastAccount($forecastAccount);
$forecastAccount->setForecastReminder($forecastReminder);
}

$form = $this->createForm(ForecastReminderType::class, $forecastReminder, [
Expand Down
2 changes: 1 addition & 1 deletion src/DataSelector/HarvestDataSelector.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public function getOutdatedProjects(array $doNotCleanupClientIds): array

$lastProjectInvoices = array_filter($invoices, function (Invoice $invoice) use ($project) {
foreach ($invoice->getLineItems() as $lineItem) {
if ($lineItem->getProject() && $lineItem->getProject()->getId() === $project->getId()) {
if (null !== $lineItem->getProject() && $lineItem->getProject()->getId() === $project->getId()) {
return true;
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/Entity/ForecastReminder.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

#[ORM\Entity(repositoryClass: \App\Repository\ForecastReminderRepository::class)]
class ForecastReminder implements \Stringable
Expand All @@ -34,8 +35,11 @@ class ForecastReminder implements \Stringable
#[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')]
private ?User $updatedBy = null;

/**
* @Gedmo\Timestampable(on="update")
*/
#[ORM\Column(type: 'datetime')]
private \DateTimeInterface $updatedAt;
private ?\DateTimeInterface $updatedAt = null;

#[ORM\Column(type: 'datetime', nullable: true)]
private ?\DateTimeInterface $lastTimeSentAt = null;
Expand Down
2 changes: 1 addition & 1 deletion src/ForecastReminder/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private function extractStartDateFromtext(string $text): \DateTime
$text = str_replace(' and ', ', ' . $sign, $text);
$datetime = new \DateTime($text);

if (0 === \DateTime::getLastErrors()['warning_count'] && 0 === \DateTime::getLastErrors()['error_count']) {
if (false === \DateTime::getLastErrors()) {
return $datetime;
}

Expand Down
373 changes: 182 additions & 191 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 6d6c75d

Please sign in to comment.