Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions sources/AppBundle/MembershipFee/MembershipFeeMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use AppBundle\Email\Mailer\MailUserFactory;
use AppBundle\Email\Mailer\Message;
use AppBundle\MembershipFee\Model\Repository\MembershipFeeRepository;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Webmozart\Assert\Assert;

final readonly class MembershipFeeMailer
Expand All @@ -24,12 +25,13 @@ public function __construct(
private CompanyMemberRepository $companyMemberRepository,
private Mailer $mailer,
private MembershipFeeInvoicePdfGenerator $pdfGenerator,
#[Autowire('%kernel.project_dir%/../htdocs/cache/')]
private string $publicCacheDir,
) {}

/**
* Envoi par mail d'une facture au format PDF
*
* @param $idCotisation Identifiant de la cotisation
* @return bool Succès de l'envoi
*/
public function envoyerFacture(int $idCotisation): bool
Expand Down Expand Up @@ -63,7 +65,7 @@ public function envoyerFacture(int $idCotisation): bool
$corps .= Afup::ADRESSE . "<br />";
$corps .= Afup::CODE_POSTAL . " " . Afup::VILLE . "<br />";

$cheminFacture = AFUP_CHEMIN_RACINE . 'cache/fact' . $idCotisation . '.pdf';
$cheminFacture = $this->publicCacheDir . 'fact' . $idCotisation . '.pdf';
$numeroFacture = $this->pdfGenerator->genererFacture($idCotisation, $cheminFacture);
$pattern = str_replace(' ', '', $patternPrefix) . '_' . $numeroFacture . '_' . date('dmY', $membership->getStartDate()->getTimestamp()) . '.pdf';

Expand Down
Loading