Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos-tav
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
agplv3
kohinos-tav
Commits
1273aa15
Commit
1273aa15
authored
Jun 13, 2023
by
Yvon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mail rappel cotisation
parent
7c35e29b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
148 additions
and
0 deletions
+148
-0
SendMailRappelCotisationCommand.php
src/Command/SendMailRappelCotisationCommand.php
+124
-0
rappel_cotisation.html.twig
...ates/themes/kohinos/email/tav/rappel_cotisation.html.twig
+24
-0
No files found.
src/Command/SendMailRappelCotisationCommand.php
0 → 100644
View file @
1273aa15
<?php
declare
(
strict_types
=
1
);
namespace
App\Command
;
use
App\Entity\Adherent
;
use
App\Entity\Flux
;
use
App\Entity\GlobalParameter
;
use
App\Entity\Prestataire
;
use
App\Entity\SolidoumeItem
;
use
App\Entity\SolidoumeParameter
;
use
App\Entity\TransactionAdherentPrestataire
;
use
App\Entity\TransactionPrestataireAdherent
;
use
App\Entity\User
;
use
App\Enum\CurrencyEnum
;
use
App\Enum\MoyenEnum
;
use
App\Utils\CustomEntityManager
;
use
App\Utils\OperationUtils
;
use
Psr\Log\LoggerInterface
;
use
Symfony\Component\Console\Command\Command
;
use
Symfony\Component\Console\Input\InputInterface
;
use
Symfony\Component\Console\Input\InputOption
;
use
Symfony\Component\Console\Output\OutputInterface
;
use
Symfony\Component\Console\Style\SymfonyStyle
;
use
Twig\Environment
;
/**
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
class
SendMailRappelCotisationCommand
extends
Command
{
protected
static
$defaultName
=
'kohinos:tav:mail-rappel-cotisation'
;
protected
$em
;
protected
$mailer
;
protected
$templating
;
protected
$io
;
protected
$param
;
protected
$operationUtils
;
public
function
__construct
(
CustomEntityManager
$em
,
\Swift_Mailer
$mailer
,
Environment
$templating
,
OperationUtils
$operationUtils
)
{
$this
->
em
=
$em
;
$this
->
mailer
=
$mailer
;
$this
->
templating
=
$templating
;
$this
->
operationUtils
=
$operationUtils
;
parent
::
__construct
();
}
protected
function
configure
()
{
$this
->
setDescription
(
'TAV : envoyer les mails de rappel des cotisations'
);
}
/**
*
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int
*/
protected
function
execute
(
InputInterface
$input
,
OutputInterface
$output
)
:
int
{
$this
->
io
=
new
SymfonyStyle
(
$input
,
$output
);
$this
->
io
->
title
(
'Start'
);
$this
->
executeReminders
();
$this
->
io
->
success
(
'End'
);
$memoryUsage
=
memory_get_usage
(
true
)
/
1024
/
1024
;
$this
->
io
->
text
(
"Batch finished with memory: ${memoryUsage}M"
);
return
0
;
}
private
function
executeReminders
()
{
$this
->
io
->
title
(
'START : Rappel par email'
);
$today
=
new
\DateTime
();
$jour
=
$today
->
format
(
'd'
);
$adherents
=
$this
->
em
->
getRepository
(
Adherent
::
class
)
->
findBy
(
array
(
'mailRappelCotisation'
=>
true
,
'jourMailRappelCotisation'
=>
$jour
));
foreach
(
$adherents
as
$adherent
)
{
$this
->
sendReminder
(
$adherent
);
}
}
/**
* Send email reminder.
*
* @param Adherent $adherent
*/
private
function
sendReminder
(
Adherent
$adherent
)
{
$this
->
io
->
success
(
"Envoi de l'email de rappel à l'adhérent : "
.
$adherent
->
__toString
());
$subject
=
'[MONNAIE ALIMENTAIRE COMMUNE] – Rappel automatique cotisation'
;
$mail
=
(
new
\Swift_Message
(
$subject
))
->
setFrom
(
$this
->
em
->
getRepository
(
GlobalParameter
::
class
)
->
val
(
GlobalParameter
::
MLC_NOTIF_EMAIL
))
->
setTo
(
$adherent
->
getUser
()
->
getEmail
())
->
setBody
(
$this
->
templating
->
render
(
'@kohinos/email/tav/rappel_cotisation.html.twig'
,
[
'subject'
=>
$subject
]
),
'text/html'
);
$this
->
mailer
->
send
(
$mail
);
}
}
\ No newline at end of file
templates/themes/kohinos/email/tav/rappel_cotisation.html.twig
0 → 100644
View file @
1273aa15
{%
extends
'@kohinos/email/email_layout.html.twig'
%}
{%
set
title
%}{%
spaceless
%}
{{
subject
}}
{%
endspaceless
%}
{%
endset
%}
{%
block
content
%}
<p>
{{
'Cher-e Participant-e à la Caisse Alimentaire Commune,'
|
trans
}}
</p>
<p>
{{
'Si vous avez déjà payé votre cotisation pour ce mois-ci, merci de ne pas tenir compte de ce mail.'
|
trans
}}
</p>
<p>
{{
'Ceci est un mail automatique pour vous rappeler de payer votre cotisation mensuelle.'
|
trans
}}
</p>
<p>
{{
'Cordialement,'
|
trans
}}
<br/>
{{
'La Caisse Alimentaire Commune.'
|
trans
}}
</p>
{%
endblock
%}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment