diff --git a/db/seeds/Users.php b/db/seeds/Users.php index c5ff5f31a..40ed8561c 100644 --- a/db/seeds/Users.php +++ b/db/seeds/Users.php @@ -2,6 +2,7 @@ declare(strict_types=1); +use AppBundle\Association\MemberType; use AppBundle\Association\Model\User; use Phinx\Seed\AbstractSeed; @@ -179,14 +180,14 @@ public function run(): void $data = [ [ 'date_debut' => $now - $oneMonthInSeconds, - 'type_personne' => AFUP_PERSONNES_PHYSIQUES, + 'type_personne' => MemberType::MemberPhysical->value, 'id_personne' => self::ID_USER_ADMIN, 'montant' => 25, 'date_fin' => $now + $oneMonthInSeconds * 12, ], [ 'date_debut' => $dateDebutUserExpire, - 'type_personne' => AFUP_PERSONNES_PHYSIQUES, + 'type_personne' => MemberType::MemberPhysical->value, 'id_personne' => self::ID_USER_EXPIRIE, 'montant' => 25, 'date_fin' => $dateDebutUserExpire + $oneMonthInSeconds * 12, @@ -194,7 +195,7 @@ public function run(): void ], [ 'date_debut' => $dateDebutUserExpire, - 'type_personne' => AFUP_PERSONNES_MORALES, + 'type_personne' => MemberType::MemberCompany->value, 'id_personne' => self::ID_PERSONNE_MORALE_MY_CORP, 'montant' => 150, 'date_fin' => $now + $oneMonthInSeconds * 12, @@ -202,7 +203,7 @@ public function run(): void ], [ 'date_debut' => $dateDebutUserExpire, - 'type_personne' => AFUP_PERSONNES_PHYSIQUES, + 'type_personne' => MemberType::MemberPhysical->value, 'id_personne' => self::ID_USER_PERSONNE_PHYSIQUE, 'montant' => 25, 'date_fin' => $now + $oneMonthInSeconds * 12, @@ -210,7 +211,7 @@ public function run(): void ], [ 'date_debut' => mktime(16, 10, 10, 1, 1, 2023), - 'type_personne' => AFUP_PERSONNES_PHYSIQUES, + 'type_personne' => MemberType::MemberPhysical->value, 'id_personne' => self::ID_USER_PERSONNE_PHYSIQUE_FIXED_COTISATIONS, 'montant' => 30, 'date_fin' => mktime(16, 10, 10, 1, 1, 2024), @@ -218,7 +219,7 @@ public function run(): void ], [ 'date_debut' => mktime(16, 10, 10, 1, 1, 2024), - 'type_personne' => AFUP_PERSONNES_PHYSIQUES, + 'type_personne' => MemberType::MemberPhysical->value, 'id_personne' => self::ID_USER_PERSONNE_PHYSIQUE_FIXED_COTISATIONS, 'montant' => 30, 'date_fin' => mktime(16, 10, 10, 1, 1, 2025), @@ -226,7 +227,7 @@ public function run(): void ], [ 'date_debut' => mktime(16, 10, 10, 1, 1, $year), - 'type_personne' => AFUP_PERSONNES_PHYSIQUES, + 'type_personne' => MemberType::MemberPhysical->value, 'id_personne' => self::ID_USER_PERSONNE_PHYSIQUE_FIXED_COTISATIONS, 'montant' => 30, 'date_fin' => mktime(16, 10, 10, 1, 1, $year + 1), @@ -234,7 +235,7 @@ public function run(): void ], [ 'date_debut' => mktime(16, 10, 10, 1, 2, 2023), - 'type_personne' => AFUP_PERSONNES_MORALES, + 'type_personne' => MemberType::MemberCompany->value, 'id_personne' => self::ID_PERSONNE_MORALE_HELIOS_AEROSPACE, 'montant' => 150, 'date_fin' => mktime(16, 10, 10, 1, 2, 2024), @@ -242,7 +243,7 @@ public function run(): void ], [ 'date_debut' => mktime(16, 10, 10, 1, 2, 2024), - 'type_personne' => AFUP_PERSONNES_MORALES, + 'type_personne' => MemberType::MemberCompany->value, 'id_personne' => self::ID_PERSONNE_MORALE_HELIOS_AEROSPACE, 'montant' => 180, 'date_fin' => mktime(16, 10, 10, 1, 2, 2025), @@ -250,7 +251,7 @@ public function run(): void ], [ 'date_debut' => mktime(16, 10, 10, 1, 2, $year), - 'type_personne' => AFUP_PERSONNES_MORALES, + 'type_personne' => MemberType::MemberCompany->value, 'id_personne' => self::ID_PERSONNE_MORALE_HELIOS_AEROSPACE, 'montant' => 180, 'date_fin' => mktime(16, 10, 10, 1, 2, $year + 1), diff --git a/sources/Afup/Association/Cotisations.php b/sources/Afup/Association/Cotisations.php index 74c2497a6..623af14be 100644 --- a/sources/Afup/Association/Cotisations.php +++ b/sources/Afup/Association/Cotisations.php @@ -50,21 +50,20 @@ public function __construct( /** * Renvoit la liste des cotisations concernant une personne * - * @param int $type_personne Type de la personne (morale ou physique) * @param int $id_personne Identifiant de la personne * @param string $champs Champs à renvoyer * @param string $ordre Tri des enregistrements * @param bool $associatif Renvoyer un tableau associatif ? * @return array|false */ - public function obtenirListe($type_personne, $id_personne, string $champs = '*', string $ordre = 'date_fin DESC', bool $associatif = false) + public function obtenirListe(MemberType $type_personne, $id_personne, string $champs = '*', string $ordre = 'date_fin DESC', bool $associatif = false) { $requete = 'SELECT'; $requete .= ' ' . $champs . ' '; $requete .= 'FROM'; $requete .= ' afup_cotisations '; $requete .= 'WHERE'; - $requete .= ' type_personne=' . $type_personne; + $requete .= ' type_personne=' . $type_personne->value; $requete .= ' AND id_personne=' . $id_personne . ' '; $requete .= 'ORDER BY ' . $ordre; if ($associatif) { @@ -112,7 +111,6 @@ public function _genererNumeroFacture(): string /** * Ajoute une cotisation * - * @param int $type_personne Type de la personne (morale ou physique) * @param int $id_personne Identifiant de la personne * @param float $montant Adresse de la personne * @param int $type_reglement Type de règlement (espèces, chèque, virement) @@ -124,14 +122,14 @@ public function _genererNumeroFacture(): string * @param string $referenceClient Reference client à mentionner sur la facture * @return bool Succès de l'ajout */ - public function ajouter($type_personne, $id_personne, $montant, $type_reglement, + public function ajouter(MemberType $type_personne, $id_personne, $montant, $type_reglement, $informations_reglement, $date_debut, $date_fin, $commentaires, $referenceClient = null): bool { $requete = 'INSERT INTO '; $requete .= ' afup_cotisations (type_personne, id_personne, montant, type_reglement , informations_reglement,'; $requete .= ' date_debut, date_fin, numero_facture, token, commentaires, reference_client) '; $requete .= 'VALUES ('; - $requete .= $type_personne . ','; + $requete .= $type_personne->value . ','; $requete .= $id_personne . ','; $requete .= $montant . ','; $requete .= $this->_bdd->echapper($type_reglement) . ','; @@ -214,7 +212,7 @@ public function notifierReglementEnLigneAuTresorier(string $cmd, float $total, s 'email' => 'N.C.', ]; - if ($type_personne == AFUP_PERSONNES_MORALES) { + if ($type_personne == MemberType::MemberCompany->value) { if ($company = $this->companyMemberRepository?->get($id_personne)) { $infos['nom'] = $company->getLastName(); $infos['prenom'] = $company->getFirstName(); @@ -268,7 +266,7 @@ public function validerReglementEnLigne($cmd, $total, string $autorisation, stri [$ref, $date, $type_personne, $id_personne, $reste] = explode('-', (string) $cmd, 5); $date_debut = mktime(0, 0, 0, (int) substr($date, 2, 2), (int) substr($date, 0, 2), (int) substr($date, 4, 4)); - $cotisation = $this->obtenirDerniere($type_personne, $id_personne); + $cotisation = $this->obtenirDerniere(MemberType::from((int) $type_personne), $id_personne); $date_fin_precedente = $cotisation === false ? 0 : $cotisation['date_fin']; if ($date_fin_precedente > 0) { @@ -276,7 +274,8 @@ public function validerReglementEnLigne($cmd, $total, string $autorisation, stri } $date_fin = $this->finProchaineCotisation($cotisation)->format('U'); - $result = $this->ajouter($type_personne, + $result = $this->ajouter( + MemberType::from((int) $type_personne), $id_personne, $total, AFUP_COTISATIONS_REGLEMENT_ENLIGNE, @@ -330,7 +329,7 @@ public function genererFacture($id_cotisation, $chemin = null) $requete = 'SELECT * FROM afup_cotisations WHERE id=' . $id_cotisation; $cotisation = $this->_bdd->obtenirEnregistrement($requete); - $table = $cotisation['type_personne'] == AFUP_PERSONNES_MORALES ? 'afup_personnes_morales' : 'afup_personnes_physiques'; + $table = $cotisation['type_personne'] == MemberType::MemberCompany->value ? 'afup_personnes_morales' : 'afup_personnes_physiques'; $requete = 'SELECT * FROM ' . $table . ' WHERE id=' . $cotisation['id_personne']; $personne = $this->_bdd->obtenirEnregistrement($requete); @@ -353,7 +352,7 @@ public function genererFacture($id_cotisation, $chemin = null) $pdf->Cell(130, 5, 'Objet : Facture n°' . $cotisation['numero_facture']); $pdf->SetFont('Arial', '', 10); - if ($cotisation['type_personne'] == AFUP_PERSONNES_MORALES) { + if ($cotisation['type_personne'] == MemberType::MemberCompany->value) { $nom = $personne['raison_sociale']; $patternPrefix = $personne['raison_sociale']; } else { @@ -394,7 +393,7 @@ public function genererFacture($id_cotisation, $chemin = null) } else { // On stocke le montant de la cotisation TTC, pour les personnes physiques c'est le même, par contre pour les personnes morales // ce n'est pas le même, afin d'éviter d'appliquer deux fois la TVA, on applique ce hotfix - if ($cotisation['type_personne'] == AFUP_PERSONNES_MORALES) { + if ($cotisation['type_personne'] == MemberType::MemberCompany->value) { $cotisation['montant'] = Vat::getRoundedWithoutVatPriceFromPriceWithVat($cotisation['montant'], Utils::MEMBERSHIP_FEE_VAT_RATE); } @@ -408,7 +407,7 @@ public function genererFacture($id_cotisation, $chemin = null) $pdf->Cell(25, 5, 'Taux TVA', 1, 0, 'R', 1); $pdf->Cell(25, 5, 'Prix TTC', 1, 0, 'R', 1); - if ($cotisation['type_personne'] == AFUP_PERSONNES_MORALES) { + if ($cotisation['type_personne'] == MemberType::MemberCompany->value) { [$totalHt, $total] = $this->buildDetailsPersonneMorale($pdf, $cotisation['montant'], $cotisation['date_fin']); } else { [$totalHt, $total] = $this->buildDetailsPersonnePhysique($pdf, $cotisation['montant'], $cotisation['date_fin']); @@ -503,7 +502,7 @@ public function envoyerFacture($id_cotisation, Mailer $mailer, UserRepository $u { $personne = $this->obtenir($id_cotisation, 'type_personne, id_personne'); - if ($personne['type_personne'] == AFUP_PERSONNES_MORALES) { + if ($personne['type_personne'] == MemberType::MemberCompany->value) { $company = $this->companyMemberRepository ? $this->companyMemberRepository->get($personne['id_personne']) : null; Assertion::notNull($company); $contactPhysique = [ @@ -532,7 +531,7 @@ public function envoyerFacture($id_cotisation, Mailer $mailer, UserRepository $u $cheminFacture = AFUP_CHEMIN_RACINE . 'cache/fact' . $id_cotisation . '.pdf'; $numeroFacture = $this->genererFacture($id_cotisation, $cheminFacture); - $cotisation = $this->obtenirDerniere($personne['type_personne'], $personne['id_personne']); + $cotisation = $this->obtenirDerniere(MemberType::from((int) $personne['type_personne']), $personne['id_personne']); $pattern = str_replace(' ', '', $patternPrefix) . '_' . $numeroFacture . '_' . date('dmY', (int) $cotisation['date_debut']) . '.pdf'; $message = new Message('Facture AFUP', null, new MailUser( @@ -553,18 +552,17 @@ public function envoyerFacture($id_cotisation, Mailer $mailer, UserRepository $u /** * Retourne la dernière cotisation d'une personne morale - * @param int|string $type_personne * @param int $id_personne Identifiant de la personne * @return array|false */ - public function obtenirDerniere($type_personne, $id_personne) + public function obtenirDerniere(MemberType $type_personne, $id_personne) { $requete = 'SELECT'; $requete .= ' * '; $requete .= 'FROM'; $requete .= ' afup_cotisations '; $requete .= 'WHERE'; - $requete .= ' type_personne=' . $type_personne . ' '; + $requete .= ' type_personne=' . $type_personne->value . ' '; $requete .= ' AND id_personne=' . $id_personne . ' '; $requete .= 'ORDER BY'; $requete .= ' date_fin DESC '; @@ -688,7 +686,7 @@ public function isCurrentUserAllowedToReadInvoice(string $invoiceId) * si type_personne = 1, alors personne morale: id_personne doit être égale à compagnyId de l'utilisateur connecté * qui doit aussi avoir le droit "ROLE_COMPAGNY_MANAGER" */ - if ($result['type_personne'] == AFUP_PERSONNES_MORALES) { + if ($result['type_personne'] == MemberType::MemberCompany->value) { return $this->_droits->verifierDroitManagerPersonneMorale($result['id_personne']); } diff --git a/sources/Afup/Bootstrap/_Common.php b/sources/Afup/Bootstrap/_Common.php index 5b911dd04..26f4f4ff2 100644 --- a/sources/Afup/Bootstrap/_Common.php +++ b/sources/Afup/Bootstrap/_Common.php @@ -30,10 +30,6 @@ // définitions des constantes if (!defined('AFUP_CHEMIN_RACINE')) { define('AFUP_CHEMIN_RACINE', $root . '/htdocs/'); - - // Voir la classe Afup\Site\Association\Personnes_Morales - define('AFUP_PERSONNES_PHYSIQUES', 0); - define('AFUP_COTISATION_PERSONNE_PHYSIQUE', 30); } date_default_timezone_set('Europe/Paris'); diff --git a/sources/Afup/Bootstrap/commonStart.php b/sources/Afup/Bootstrap/commonStart.php index 8420b6eaa..060a41c31 100644 --- a/sources/Afup/Bootstrap/commonStart.php +++ b/sources/Afup/Bootstrap/commonStart.php @@ -84,8 +84,7 @@ define('AFUP_FORUM_REGLEMENT_AUCUN', 3); define('AFUP_FORUM_REGLEMENT_A_POSTERIORI', 4); - -define('AFUP_PERSONNES_MORALES', 1); +define('AFUP_COTISATION_PERSONNE_PHYSIQUE', 30); define('AFUP_COTISATION_PERSONNE_MORALE', 150); define('AFUP_PERSONNE_MORALE_SEUIL', 3); diff --git a/sources/AppBundle/Association/CompanyMembership/SubscriptionManagement.php b/sources/AppBundle/Association/CompanyMembership/SubscriptionManagement.php index b682ef96c..1c27c35c4 100644 --- a/sources/AppBundle/Association/CompanyMembership/SubscriptionManagement.php +++ b/sources/AppBundle/Association/CompanyMembership/SubscriptionManagement.php @@ -6,6 +6,7 @@ use Afup\Site\Association\Cotisations; use Afup\Site\Utils\Utils; +use AppBundle\Association\MemberType; use AppBundle\Association\Model\CompanyMember; final readonly class SubscriptionManagement @@ -18,7 +19,7 @@ public function createInvoiceForInscription(CompanyMember $company, $numberOfMem // Create the invoice $this->cotisations->ajouter( - AFUP_PERSONNES_MORALES, + MemberType::MemberCompany, $company->getId(), ceil($numberOfMembers / AFUP_PERSONNE_MORALE_SEUIL) * AFUP_COTISATION_PERSONNE_MORALE * (1 + Utils::MEMBERSHIP_FEE_VAT_RATE), null, @@ -27,7 +28,7 @@ public function createInvoiceForInscription(CompanyMember $company, $numberOfMem $endSubscription->format('U'), '', ); - $subscriptionArray = $this->cotisations->obtenirDerniere(AFUP_PERSONNES_MORALES, $company->getId()); + $subscriptionArray = $this->cotisations->obtenirDerniere(MemberType::MemberCompany, $company->getId()); if ($subscriptionArray === false) { throw new \RuntimeException('An error occured'); diff --git a/sources/AppBundle/Association/MembershipFeeReferenceGenerator.php b/sources/AppBundle/Association/MembershipFeeReferenceGenerator.php index bc635865f..a4eda0a46 100644 --- a/sources/AppBundle/Association/MembershipFeeReferenceGenerator.php +++ b/sources/AppBundle/Association/MembershipFeeReferenceGenerator.php @@ -9,15 +9,14 @@ class MembershipFeeReferenceGenerator { /** - * @param string|int $typePersonne * @param string|int $idPersonne * @param string $nomPersonne * * @return mixed|string */ - public function generate(\DateTimeImmutable $currentDate, $typePersonne, $idPersonne, $nomPersonne) + public function generate(\DateTimeImmutable $currentDate, MemberType $typePersonne, $idPersonne, $nomPersonne) { - $reference = strtoupper('C' . $currentDate->format('Y') . '-' . $currentDate->format('dmYHi') . '-' . $typePersonne . '-' . $idPersonne . '-' . substr((string) supprimerAccents($nomPersonne), 0, 5)); + $reference = strtoupper('C' . $currentDate->format('Y') . '-' . $currentDate->format('dmYHi') . '-' . $typePersonne->value . '-' . $idPersonne . '-' . substr((string) supprimerAccents($nomPersonne), 0, 5)); $reference = supprimerAccents($reference); $reference = preg_replace('/[^A-Z0-9_\-\:\.;]/', '', (string) $reference); diff --git a/sources/AppBundle/Association/Model/Repository/CompanyMemberRepository.php b/sources/AppBundle/Association/Model/Repository/CompanyMemberRepository.php index 82b7ad8b2..68f0c9b91 100644 --- a/sources/AppBundle/Association/Model/Repository/CompanyMemberRepository.php +++ b/sources/AppBundle/Association/Model/Repository/CompanyMemberRepository.php @@ -4,6 +4,7 @@ namespace AppBundle\Association\Model\Repository; +use AppBundle\Association\MemberType; use AppBundle\Association\Model\CompanyMember; use Assert\Assertion; use Aura\SqlQuery\Common\SelectInterface; @@ -121,7 +122,7 @@ public function countActiveByCompany(): array public function remove(CompanyMember $companyMember): void { $nbCotisations = (int) $this->getQuery('SELECT COUNT(*) nb FROM afup_cotisations WHERE type_personne = :memberType AND id_personne = :id') - ->setParams(['memberType' => AFUP_PERSONNES_MORALES, 'id' => $companyMember->getId()]) + ->setParams(['memberType' => MemberType::MemberCompany->value, 'id' => $companyMember->getId()]) ->query()->first()[0]->nb; if (0 < $nbCotisations) { throw new InvalidArgumentException('Impossible de supprimer une personne morale qui a des cotisations'); diff --git a/sources/AppBundle/Association/UserMembership/SeniorityComputer.php b/sources/AppBundle/Association/UserMembership/SeniorityComputer.php index 5dd1e1ddd..371211a5d 100644 --- a/sources/AppBundle/Association/UserMembership/SeniorityComputer.php +++ b/sources/AppBundle/Association/UserMembership/SeniorityComputer.php @@ -5,6 +5,7 @@ namespace AppBundle\Association\UserMembership; use Afup\Site\Association\Cotisations; +use AppBundle\Association\MemberType; use AppBundle\Association\Model\CompanyMember; use AppBundle\Association\Model\User; @@ -14,7 +15,7 @@ public function __construct(private readonly Cotisations $cotisations) {} public function computeCompany(CompanyMember $companyMember) { - $cotis = $this->cotisations->obtenirListe(AFUP_PERSONNES_MORALES, $companyMember->getId()); + $cotis = $this->cotisations->obtenirListe(MemberType::MemberCompany, $companyMember->getId()); $infos = $this->computeFromCotisationsAndReturnInfos($cotis); @@ -23,7 +24,7 @@ public function computeCompany(CompanyMember $companyMember) public function computeCompanyAndReturnInfos(CompanyMember $companyMember): array { - $cotis = $this->cotisations->obtenirListe(AFUP_PERSONNES_MORALES, $companyMember->getId()); + $cotis = $this->cotisations->obtenirListe(MemberType::MemberCompany, $companyMember->getId()); return $this->computeFromCotisationsAndReturnInfos($cotis); } @@ -37,7 +38,7 @@ public function compute(User $user) public function computeAndReturnInfos(User $user): array { - $cotis = $this->cotisations->obtenirListe(AFUP_PERSONNES_PHYSIQUES, $user->getId()); + $cotis = $this->cotisations->obtenirListe(MemberType::MemberPhysical, $user->getId()); return $this->computeFromCotisationsAndReturnInfos($cotis); } diff --git a/sources/AppBundle/Association/UserMembership/UserService.php b/sources/AppBundle/Association/UserMembership/UserService.php index 12beb62a7..4942becde 100644 --- a/sources/AppBundle/Association/UserMembership/UserService.php +++ b/sources/AppBundle/Association/UserMembership/UserService.php @@ -5,6 +5,7 @@ namespace AppBundle\Association\UserMembership; use Afup\Site\Association\Cotisations; +use AppBundle\Association\MemberType; use AppBundle\Association\Model\Repository\UserRepository; use AppBundle\Association\Model\User; use AppBundle\Email\Mailer\Mailer; @@ -91,10 +92,10 @@ public function getLastSubscription(User $user) { if ($user->getCompanyId()) { $id = $user->getCompanyId(); - $personType = AFUP_PERSONNES_MORALES; + $personType = MemberType::MemberCompany; } else { $id = $user->getId(); - $personType = AFUP_PERSONNES_PHYSIQUES; + $personType = MemberType::MemberPhysical; } return $this->cotisations->obtenirDerniere($personType, $id); diff --git a/sources/AppBundle/Controller/Website/Membership/Fee/DownloadAction.php b/sources/AppBundle/Controller/Website/Membership/Fee/DownloadAction.php index ece00277b..98c945198 100644 --- a/sources/AppBundle/Controller/Website/Membership/Fee/DownloadAction.php +++ b/sources/AppBundle/Controller/Website/Membership/Fee/DownloadAction.php @@ -6,6 +6,7 @@ use Afup\Site\Association\Cotisations; use Afup\Site\Droits; +use AppBundle\Association\MemberType; use AppBundle\Association\Model\CompanyMember; use AppBundle\Association\Model\Repository\CompanyMemberRepository; use AppBundle\Association\Model\Repository\UserRepository; @@ -41,7 +42,7 @@ public function __invoke(Request $request): BinaryFileResponse $numeroFacture = $this->cotisations->genererFacture($id, $tempfile); $cotisation = $this->cotisations->obtenir($id); - if ($cotisation['type_personne'] == AFUP_PERSONNES_MORALES) { + if ($cotisation['type_personne'] == MemberType::MemberCompany->value) { $company = $this->companyMemberRepository->get($cotisation['id_personne']); Assertion::isInstanceOf($company, CompanyMember::class); $patternPrefix = $company->getCompanyName(); diff --git a/sources/AppBundle/Controller/Website/Membership/Fee/IndexAction.php b/sources/AppBundle/Controller/Website/Membership/Fee/IndexAction.php index 9afaf5362..8b7738cad 100644 --- a/sources/AppBundle/Controller/Website/Membership/Fee/IndexAction.php +++ b/sources/AppBundle/Controller/Website/Membership/Fee/IndexAction.php @@ -9,6 +9,7 @@ use Afup\Site\Utils\Utils; use Afup\Site\Utils\Vat; use AppBundle\Association\MembershipFeeReferenceGenerator; +use AppBundle\Association\MemberType; use AppBundle\Association\Model\Repository\CompanyMemberRepository; use AppBundle\Association\Model\Repository\UserRepository; use AppBundle\Association\UserMembership\UserService; @@ -55,8 +56,8 @@ public function __invoke(): Response ); } - $cotisations_physique = $this->cotisations->obtenirListe(0, $user->getId()); - $cotisations_morale = $this->cotisations->obtenirListe(1, $user->getCompanyId()); + $cotisations_physique = $this->cotisations->obtenirListe(MemberType::MemberPhysical, $user->getId()); + $cotisations_morale = $this->cotisations->obtenirListe(MemberType::MemberCompany, $user->getCompanyId()); if (is_array($cotisations_morale) && is_array($cotisations_physique)) { $liste_cotisations = array_merge($cotisations_physique, $cotisations_morale); @@ -74,7 +75,7 @@ public function __invoke(): Response if ($user->getCompanyId() > 0) { $id_personne = $user->getCompanyId(); - $type_personne = AFUP_PERSONNES_MORALES; + $type_personne = MemberType::MemberCompany; $prefixe = 'Personne morale'; if (!$company = $this->companyMemberRepository->findById($id_personne)) { @@ -86,7 +87,7 @@ public function __invoke(): Response } } else { $id_personne = $identifiant; - $type_personne = AFUP_PERSONNES_PHYSIQUES; + $type_personne = MemberType::MemberPhysical; $prefixe = 'Personne physique'; $montant = AFUP_COTISATION_PERSONNE_PHYSIQUE; } diff --git a/sources/AppBundle/Controller/Website/Membership/PayboxCallbackAction.php b/sources/AppBundle/Controller/Website/Membership/PayboxCallbackAction.php index 8165c0673..aef8d5b27 100644 --- a/sources/AppBundle/Controller/Website/Membership/PayboxCallbackAction.php +++ b/sources/AppBundle/Controller/Website/Membership/PayboxCallbackAction.php @@ -46,7 +46,7 @@ public function __invoke(Request $request): Response if ($etat == AFUP_COTISATIONS_PAIEMENT_REGLE) { $account = $this->cotisations->getAccountFromCmd($payboxResponse->getCmd()); - $lastCotisation = $this->cotisations->obtenirDerniere($account['type'], $account['id']); + $lastCotisation = $this->cotisations->obtenirDerniere(MemberType::from($account['type']), $account['id']); if ($lastCotisation === false && $account['type'] == MemberType::MemberPhysical->value) { $user = $this->userRepository->get($account['id']); diff --git a/templates/admin/members/company/edit.html.twig b/templates/admin/members/company/edit.html.twig index 950bc9df1..731d616a5 100644 --- a/templates/admin/members/company/edit.html.twig +++ b/templates/admin/members/company/edit.html.twig @@ -6,7 +6,7 @@