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
1
Merge Requests
1
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
bd02beeb
Commit
bd02beeb
authored
Mar 17, 2025
by
Yvon Kerdoncuff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add param to decide fixed allocation amount and use it in recalculations
parent
c73e439b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
1 deletions
+66
-1
AdherentAdminController.php
src/Controller/AdherentAdminController.php
+9
-1
GlobalParameter.php
src/Entity/GlobalParameter.php
+1
-0
Version20250317150730.php
src/Migrations/Version20250317150730.php
+40
-0
TAVCotisationUtils.php
src/Utils/TAVCotisationUtils.php
+16
-0
No files found.
src/Controller/AdherentAdminController.php
View file @
bd02beeb
...
...
@@ -2,6 +2,7 @@
namespace
App\Controller
;
use
App\Entity\GlobalParameter
;
use
App\Utils\CustomEntityManager
;
use
App\Utils\TAVCotisationUtils
;
use
Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted
;
...
...
@@ -69,7 +70,14 @@ class AdherentAdminController extends CRUDController
$qb
=
$this
->
em
->
getRepository
(
Adherent
::
class
)
->
createQueryBuilder
(
'a'
);
if
(
$this
->
getParameter
(
'simplified_household_based_allowance'
))
{
$forcedAmount
=
(
int
)
$this
->
em
->
getRepository
(
GlobalParameter
::
class
)
->
val
(
GlobalParameter
::
SSA_FORCE_ALLOCATION_AMOUNT
);
if
(
is_int
(
$forcedAmount
))
{
$adherents
=
$qb
->
getQuery
()
->
getResult
();
foreach
(
$adherents
as
$adherent
)
{
$adherent
->
setAllocationAmount
(
$forcedAmount
);
}
}
else
if
(
$this
->
getParameter
(
'simplified_household_based_allowance'
))
{
$adherents
=
$qb
->
where
(
$qb
->
expr
()
->
isNotNull
(
"a.householdCount"
))
->
andWhere
(
$qb
->
expr
()
->
isNotNull
(
"a.cotisationAmount"
))
->
getQuery
()
...
...
src/Entity/GlobalParameter.php
View file @
bd02beeb
...
...
@@ -60,6 +60,7 @@ class GlobalParameter
const
ACTIVATE_ADHERENTS_BALANCE_CEILING
=
'ACTIVATE_ADHERENTS_BALANCE_CEILING'
;
const
SSA_SIMPL_HOUSEHOLD_ADMIN_TEXT_INFO_ADHERENT_FALLBACKS_TO_PROFILECOTIS
=
'SSA_SIMPL_HOUSEHOLD_ADMIN_TEXT_INFO_ADHERENT_FALLBACKS_TO_PROFILECOTIS'
;
const
SSA_DISABLE_COTISATION
=
'SSA_DISABLE_COTISATION'
;
const
SSA_FORCE_ALLOCATION_AMOUNT
=
'SSA_FORCE_ALLOCATION_AMOUNT'
;
/**
* @var \Ramsey\Uuid\UuidInterface
*
...
...
src/Migrations/Version20250317150730.php
0 → 100644
View file @
bd02beeb
<?php
declare
(
strict_types
=
1
);
namespace
DoctrineMigrations
;
use
Doctrine\DBAL\Schema\Schema
;
use
Doctrine\Migrations\AbstractMigration
;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final
class
Version20250317150730
extends
AbstractMigration
{
public
function
getDescription
()
:
string
{
return
''
;
}
public
function
up
(
Schema
$schema
)
:
void
{
// this up() migration is auto-generated, please modify it to your needs
$this
->
addSql
(
"
INSERT INTO global_parameter (id, name, description, value, mandatory)
VALUES (
UUID(),
'SSA_FORCE_ALLOCATION_AMOUNT',
'Le montant d\'allocation est forcé égal au nombre entier saisi. Effacer pour désactiver.',
'',
'0'
)
"
);
}
public
function
down
(
Schema
$schema
)
:
void
{
$this
->
addSql
(
"DELETE FROM global_parameter where name='SSA_FORCE_ALLOCATION_AMOUNT'"
);
// this down() migration is auto-generated, please modify it to your needs
}
}
src/Utils/TAVCotisationUtils.php
View file @
bd02beeb
...
...
@@ -6,6 +6,7 @@ use App\Entity\Adherent;
use
App\Entity\CotisationTavPrelevementCorrectionSolde
;
use
App\Entity\CotisationTavPrelevementDepassementPlafond
;
use
App\Entity\CotisationTavReversementCorrectionSolde
;
use
App\Entity\GlobalParameter
;
use
App\Entity\Payment
;
use
App\Entity\Siege
;
use
App\Entity\Flux
;
...
...
@@ -187,6 +188,13 @@ class TAVCotisationUtils
public
function
calculateAllowanceAccordingToHousehold
(
&
$adherent
)
{
// TODO base amounts to param in .env, or in global params ?
$forcedAmount
=
(
int
)
$this
->
em
->
getRepository
(
GlobalParameter
::
class
)
->
val
(
GlobalParameter
::
SSA_FORCE_ALLOCATION_AMOUNT
);
if
(
is_int
(
$forcedAmount
))
{
$adherent
->
setAllocationAmount
(
$forcedAmount
);
return
;
}
// base allowance, for one adult
$mlcAllowanceAmount
=
150
;
...
...
@@ -224,6 +232,14 @@ class TAVCotisationUtils
* 4+ person: 220 emlc
*/
public
function
calculateAllowanceAccordingToHouseholdSimplified
(
&
$adherent
)
{
$forcedAmount
=
(
int
)
$this
->
em
->
getRepository
(
GlobalParameter
::
class
)
->
val
(
GlobalParameter
::
SSA_FORCE_ALLOCATION_AMOUNT
);
if
(
is_int
(
$forcedAmount
))
{
$adherent
->
setAllocationAmount
(
$forcedAmount
);
return
;
}
$householdCount
=
$adherent
->
getHouseholdCount
();
if
(
is_null
(
$householdCount
)
||
$householdCount
==
0
)
{
...
...
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