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
2d0d9569
Commit
2d0d9569
authored
Feb 16, 2024
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
presta info set reconversion frequency
parent
288434b1
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
135 additions
and
2 deletions
+135
-2
services.yaml
config/services.yaml
+1
-0
Prestataire.php
src/Entity/Prestataire.php
+31
-0
ReconversionFrequencyEnum.php
src/Enum/ReconversionFrequencyEnum.php
+43
-0
PrestataireInfosFormType.php
src/Form/Type/PrestataireInfosFormType.php
+26
-2
Version20240216095500.php
src/Migrations/Version20240216095500.php
+31
-0
infos.html.twig
templates/themes/kohinos/presta/block/infos.html.twig
+3
-0
No files found.
config/services.yaml
View file @
2d0d9569
...
...
@@ -14,6 +14,7 @@ parameters:
sonata.media.admin.gallery.class
:
'
App\Admin\GalleryAdmin'
tav_env
:
'
%env(TAV_ENV)%'
presta_self_init_and_eval
:
'
%env(PRESTA_SELF_INIT_AND_EVAL)%'
automatisation_reconversion
:
'
%env(AUTOMATISATION_RECONVERSION)%'
# PARAMETRES DES IMPORTS POSSIBLE POUR L'APPLICATION DE GESTION DE MONNAIE LOCALE COMPLEMENTAIRE
app.import.separator
:
'
;'
...
...
src/Entity/Prestataire.php
View file @
2d0d9569
...
...
@@ -325,6 +325,15 @@ class Prestataire extends AccountableObject implements AccountableInterface
protected
$tauxreconversion
;
/**
* Fréquence de reconversion en cas d'automatisation des reconversions.
*
* @var string
* @ORM\Column(name="reconversionFrequency", type="string", length=50, nullable=true)
* @Groups({"read", "write"})
*/
protected
$reconversionFrequency
;
/**
* @var ArrayCollection|AccountPrestataire[]
* @ORM\OneToMany(targetEntity="AccountPrestataire", mappedBy="prestataire")
*/
...
...
@@ -1107,6 +1116,28 @@ class Prestataire extends AccountableObject implements AccountableInterface
}
/**
* Get reconversionFrequency.
*
* @return
*/
public
function
getReconversionFrequency
()
:
?
string
{
return
$this
->
reconversionFrequency
;
}
/**
* Set reconversionFrequency.
*
* @return $this
*/
public
function
setReconversionFrequency
(
?
string
$reconversionFrequency
)
:
self
{
$this
->
reconversionFrequency
=
$reconversionFrequency
;
return
$this
;
}
/**
* Get comments.
*
* @return string comments
...
...
src/Enum/ReconversionFrequencyEnum.php
0 → 100644
View file @
2d0d9569
<?php
namespace
App\Enum
;
abstract
class
ReconversionFrequencyEnum
{
const
MOYEN_ONCE_A_MONTH
=
'once_a_month'
;
const
MOYEN_TWICE_A_MONTH
=
'twice_a_month'
;
const
MOYEN_ONCE_TWO_MONTHS
=
'once_every_two_month'
;
/** @var array user friendly named type */
protected
static
$typeName
=
[
self
::
MOYEN_ONCE_A_MONTH
=>
'1 fois par mois'
,
self
::
MOYEN_TWICE_A_MONTH
=>
'2 fois par mois'
,
self
::
MOYEN_ONCE_TWO_MONTHS
=>
'1 fois tous les deux mois'
,
];
/**
* @param string $typeShortName
*
* @return string
*/
public
static
function
getTypeName
(
$typeShortName
)
{
if
(
!
isset
(
static
::
$typeName
[
$typeShortName
]))
{
return
"Unknown type (
$typeShortName
)"
;
}
return
static
::
$typeName
[
$typeShortName
];
}
/**
* @return array<string>
*/
public
static
function
getAvailableTypes
()
{
return
[
self
::
MOYEN_ONCE_A_MONTH
,
self
::
MOYEN_TWICE_A_MONTH
,
self
::
MOYEN_ONCE_TWO_MONTHS
,
];
}
}
src/Form/Type/PrestataireInfosFormType.php
View file @
2d0d9569
...
...
@@ -5,6 +5,7 @@ namespace App\Form\Type;
use
App\Application\Sonata\MediaBundle\Entity\Media
;
use
App\Entity\Prestataire
;
use
Doctrine\ORM\EntityManagerInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
FOS\CKEditorBundle\Form\Type\CKEditorType
;
use
Sonata\MediaBundle\Form\Type\MediaType
;
use
Symfony\Component\Form\AbstractType
;
...
...
@@ -13,16 +14,20 @@ use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use
Symfony\Component\Form\Extension\Core\Type\SubmitType
;
use
Symfony\Component\Form\Extension\Core\Type\TextType
;
use
Symfony\Component\Form\Extension\Core\Type\UrlType
;
use
Symfony\Component\Form\Extension\Core\Type\ChoiceType
;
use
Symfony\Component\Form\FormBuilderInterface
;
use
Symfony\Component\OptionsResolver\OptionsResolver
;
use
App\Enum\ReconversionFrequencyEnum
;
class
PrestataireInfosFormType
extends
AbstractType
{
protected
$em
;
protected
$container
;
public
function
__construct
(
EntityManagerInterface
$em
)
public
function
__construct
(
EntityManagerInterface
$em
,
ContainerInterface
$container
)
{
$this
->
em
=
$em
;
$this
->
container
=
$container
;
}
public
function
buildForm
(
FormBuilderInterface
$builder
,
array
$options
)
...
...
@@ -77,7 +82,26 @@ class PrestataireInfosFormType extends AbstractType
->
add
(
'web'
,
UrlType
::
class
,
[
'label'
=>
'Site web :'
,
'required'
=>
false
,
])
]);
if
(
$this
->
container
->
getParameter
(
'tav_env'
)
&&
$this
->
container
->
getParameter
(
'automatisation_reconversion'
))
{
$builder
->
add
(
'reconversionFrequency'
,
ChoiceType
::
class
,
[
'choices'
=>
ReconversionFrequencyEnum
::
getAvailableTypes
(),
'choice_label'
=>
function
(
$choice
)
{
return
ReconversionFrequencyEnum
::
getTypeName
(
$choice
);
},
'expanded'
=>
false
,
'multiple'
=>
false
,
'label'
=>
'Fréquence de reconversion :'
,
'placeholder'
=>
'Choisir une option'
,
'required'
=>
false
,
]);
}
// $this->container->getParameter('tav_env')
$builder
->
add
(
'description'
,
CKEditorType
::
class
,
[
'label'
=>
'Description :'
,
'required'
=>
false
,
...
...
src/Migrations/Version20240216095500.php
0 → 100644
View file @
2d0d9569
<?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
Version20240216095500
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
(
'ALTER TABLE prestataire ADD reconversionFrequency VARCHAR(50) DEFAULT NULL, CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\''
);
}
public
function
down
(
Schema
$schema
)
:
void
{
// this down() migration is auto-generated, please modify it to your needs
$this
->
addSql
(
'ALTER TABLE prestataire DROP reconversionFrequency, CHANGE iban iban LONGTEXT CHARACTER SET utf8mb3 DEFAULT NULL COLLATE `utf8mb3_general_ci` COMMENT \'(DC2Type:personal_data)\''
);
}
}
templates/themes/kohinos/presta/block/infos.html.twig
View file @
2d0d9569
...
...
@@ -24,6 +24,9 @@
{{
form_row
(
form.metier
)
}}
{{
form_row
(
form.horaires
)
}}
{{
form_row
(
form.web
)
}}
{%
if
form.reconversionFrequency
is
defined
%}
{{
form_row
(
form.reconversionFrequency
)
}}
{%
endif
%}
<hr/>
{{
form_row
(
form.media
)
}}
{{
form_row
(
form.description
)
}}
...
...
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