-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2366 from MTES-MCT/bugfix/2035-tag-mail-user-part…
…ner-archived [BO] Tagger les mails des comptes et partenaires archivés pour éviter les doublons
- Loading branch information
Showing
26 changed files
with
539 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DoctrineMigrations; | ||
|
||
use App\Entity\User; | ||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
final class Version20240322123431 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Add a tag to email or achived user or partner'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
$this->addSql( | ||
"UPDATE partner SET email = CONCAT(email, '".User::SUFFIXE_ARCHIVED."', DATE_FORMAT(NOW(), '%Y%m%d%H%i')) WHERE is_archive = 1" | ||
); | ||
$this->addSql( | ||
"UPDATE user SET email = CONCAT(email, '".User::SUFFIXE_ARCHIVED."', DATE_FORMAT(NOW(), '%Y%m%d%H%i')) WHERE statut = 2" | ||
); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
namespace App\Controller\Back; | ||
|
||
use App\Entity\Partner; | ||
use App\Repository\PartnerRepository; | ||
use App\Repository\TerritoryRepository; | ||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
use Symfony\Component\Security\Http\Attribute\IsGranted; | ||
|
||
#[Route('/bo/partner-archives')] | ||
class BackArchivedPartnerController extends AbstractController | ||
{ | ||
#[Route('/', name: 'back_archived_partner_index', methods: ['GET', 'POST'])] | ||
#[IsGranted('ROLE_ADMIN')] | ||
public function index( | ||
Request $request, | ||
TerritoryRepository $territoryRepository, | ||
PartnerRepository $partnerRepository | ||
): Response { | ||
$page = $request->get('page') ?? 1; | ||
|
||
$isNoneTerritory = 'none' == $request->get('territory'); | ||
$currentTerritory = $isNoneTerritory ? null : $territoryRepository->find((int) $request->get('territory')); | ||
$partnerTerms = $request->get('partnerTerms'); | ||
|
||
$paginatedArchivedPartners = $partnerRepository->findAllArchivedOrWithoutTerritory( | ||
territory: $currentTerritory, | ||
isNoneTerritory: $isNoneTerritory, | ||
filterTerms: $partnerTerms, | ||
page: (int) $page | ||
); | ||
|
||
if ($request->isMethod(Request::METHOD_POST)) { | ||
$isNoneTerritory = 'none' == $request->request->get('territory'); | ||
$currentTerritory = $territoryRepository->find((int) $request->request->get('territory')); | ||
$partnerTerms = $request->request->get('bo-filters-partnerterms'); | ||
|
||
return $this->redirect($this->generateUrl('back_archived_partner_index', [ | ||
'page' => 1, | ||
'territory' => $isNoneTerritory ? 'none' : $currentTerritory?->getId(), | ||
'partnerTerms' => $partnerTerms, | ||
])); | ||
} | ||
|
||
$totalArchivedPartners = \count($paginatedArchivedPartners); | ||
|
||
return $this->render('back/partner_archived/index.html.twig', [ | ||
'isNoneTerritory' => $isNoneTerritory, | ||
'currentTerritory' => $currentTerritory, | ||
'partnerTerms' => $partnerTerms, | ||
'territories' => $territoryRepository->findAllList(), | ||
'partners' => $paginatedArchivedPartners, | ||
'total' => $totalArchivedPartners, | ||
'page' => $page, | ||
'pages' => (int) ceil($totalArchivedPartners / Partner::MAX_LIST_PAGINATION), | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.