Merge branch 'Xbird/Work' into 'main'

Fix Licences withdrawals

See merge request gamexperience/vision!30
This commit is contained in:
Xbird
2022-04-29 14:30:04 +00:00
15 changed files with 90 additions and 71 deletions

2
.env
View File

@@ -1,6 +1,6 @@
APP_ENV=prod APP_ENV=prod
DEFAULT_LOCALE=en DEFAULT_LOCALE=en
APP_SECRET=e80d9c53871bdaa0a1ff5357c695ba6d APP_SECRET=CHANGEME
TZ=America/New_York TZ=America/New_York
###> symfony/lock ### ###> symfony/lock ###
# Choose one of the stores below # Choose one of the stores below

View File

@@ -1,17 +0,0 @@
###> symfony/framework-bundle ###
APP_ENV=prod
APP_SECRET={some random chars, maybe use a random generator}
DEFAULT_LOCALE=en
TZ={Timezone, ex : Europe/Paris}
###< symfony/framework-bundle ###
###> symfony/mailer ###
MAILER_DSN=smtp://{mail}:{password}@{host}:{port}
### ex with docker maildev : MAILER_DSN=smtp://localhost:25
MAILER_SENDER={your_mail}
###< symfony/mailer ###
###> doctrine/doctrine-bundle ###
DATABASE_URL="mysql://{user}:{password}@{host}/{database}?charset=utf8"
### ex with docker mariadb : DATABASE_URL="mysql://root:password@127.0.0.1:3306/vision?sslmode=disable&charset=utf8mb4"
###< doctrine/doctrine-bundle ###

View File

@@ -0,0 +1,31 @@
<?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 Version20220428231327 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 licence_withdrawal RENAME licencewithdrawal;');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE licencewithdrawal RENAME licence_withdrawal;');
}
}

View File

@@ -1,3 +1,3 @@
{ {
"version": "0.1.5" "version": "0.2.0"
} }

View File

@@ -5,7 +5,6 @@ namespace App\Command;
use App\Entity\Group; use App\Entity\Group;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;

View File

@@ -76,7 +76,7 @@ class DirectoryController extends AbstractController
$DocumentList = [ $DocumentList = [
'Certificate', 'Certificate',
'Complaint', 'Complaint',
'LicenceWithdrawal', 'Licencewithdrawal',
'Infringement', 'Infringement',
'Jail', 'Jail',
'Bracelet', 'Bracelet',

View File

@@ -356,10 +356,10 @@ class Directory
private $complaints; private $complaints;
/** /**
* @ORM\OneToMany(targetEntity=LicenceWithdrawal::class, mappedBy="directory", orphanRemoval=true) * @ORM\OneToMany(targetEntity=Licencewithdrawal::class, mappedBy="directory", orphanRemoval=true)
* @ORM\OrderBy({"createdAt" = "DESC"}) * @ORM\OrderBy({"createdAt" = "DESC"})
*/ */
private $licenceWithdrawals; private $licencewithdrawals;
/** /**
* @ORM\Column(type="text", nullable=true) * @ORM\Column(type="text", nullable=true)
@@ -477,7 +477,7 @@ class Directory
$this->bracelets = new ArrayCollection(); $this->bracelets = new ArrayCollection();
$this->criminals = new ArrayCollection(); $this->criminals = new ArrayCollection();
$this->complaints = new ArrayCollection(); $this->complaints = new ArrayCollection();
$this->licenceWithdrawals = new ArrayCollection(); $this->licencewithdrawals = new ArrayCollection();
$this->infringements = new ArrayCollection(); $this->infringements = new ArrayCollection();
$this->folders = new ArrayCollection(); $this->folders = new ArrayCollection();
} }
@@ -1183,29 +1183,29 @@ class Directory
} }
/** /**
* @return Collection|LicenceWithdrawal[] * @return Collection|Licencewithdrawal[]
*/ */
public function getLicenceWithdrawals(): Collection public function getLicencewithdrawals(): Collection
{ {
return $this->licenceWithdrawals; return $this->licencewithdrawals;
} }
public function addLicenceWithdrawal(LicenceWithdrawal $licenceWithdrawal): self public function addLicencewithdrawal(Licencewithdrawal $licencewithdrawal): self
{ {
if (!$this->licenceWithdrawals->contains($licenceWithdrawal)) { if (!$this->licencewithdrawals->contains($licencewithdrawal)) {
$this->licenceWithdrawals[] = $licenceWithdrawal; $this->licencewithdrawals[] = $licencewithdrawal;
$licenceWithdrawal->setDirectory($this); $licencewithdrawal->setDirectory($this);
} }
return $this; return $this;
} }
public function removeLicenceWithdrawal(LicenceWithdrawal $licenceWithdrawal): self public function removeLicencewithdrawal(Licencewithdrawal $licencewithdrawal): self
{ {
if ($this->licenceWithdrawals->removeElement($licenceWithdrawal)) { if ($this->licencewithdrawals->removeElement($licencewithdrawal)) {
// set the owning side to null (unless already changed) // set the owning side to null (unless already changed)
if ($licenceWithdrawal->getDirectory() === $this) { if ($licencewithdrawal->getDirectory() === $this) {
$licenceWithdrawal->setDirectory(null); $licencewithdrawal->setDirectory(null);
} }
} }

View File

@@ -2,16 +2,18 @@
namespace App\Entity; namespace App\Entity;
use App\Entity\User;
use DateTimeImmutable; use DateTimeImmutable;
use App\Entity\Document; use App\Entity\Document;
use App\Entity\Directory;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo; use Gedmo\Mapping\Annotation as Gedmo;
use App\Repository\LicenceWithdrawalRepository; use App\Repository\LicencewithdrawalRepository;
/** /**
* @ORM\Entity(repositoryClass=LicenceWithdrawalRepository::class) * @ORM\Entity(repositoryClass=LicencewithdrawalRepository::class)
*/ */
class LicenceWithdrawal extends Document class Licencewithdrawal extends Document
{ {
/** /**
* @ORM\Column(type="string", length=255) * @ORM\Column(type="string", length=255)
@@ -26,7 +28,7 @@ class LicenceWithdrawal extends Document
private $until; private $until;
/** /**
* @ORM\ManyToOne(targetEntity=Directory::class, inversedBy="licenceWithdrawals") * @ORM\ManyToOne(targetEntity=Directory::class, inversedBy="licencewithdrawals")
* @ORM\JoinColumn(nullable=false) * @ORM\JoinColumn(nullable=false)
*/ */
private $directory; private $directory;

View File

@@ -4,7 +4,7 @@ namespace App\Form;
use App\Form\DocumentType; use App\Form\DocumentType;
use App\Form\Type\VehicleType; use App\Form\Type\VehicleType;
use App\Entity\LicenceWithdrawal; use App\Entity\Licencewithdrawal;
use App\Form\Type\DateTimeVisionType; use App\Form\Type\DateTimeVisionType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -30,7 +30,7 @@ class LicencewithdrawalType extends DocumentType
public function configureOptions(OptionsResolver $resolver): void public function configureOptions(OptionsResolver $resolver): void
{ {
$resolver->setDefaults([ $resolver->setDefaults([
'data_class' => LicenceWithdrawal::class, 'data_class' => Licencewithdrawal::class,
]); ]);
} }
} }

View File

@@ -1,22 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\LicenceWithdrawal;
use Doctrine\Persistence\ManagerRegistry;
use App\Repository\Tools\DocumentRepositoriesExtension;
/**
* @method LicenceWithdrawal|null find($id, $lockMode = null, $lockVersion = null)
* @method LicenceWithdrawal|null findOneBy(array $criteria, array $orderBy = null)
* @method LicenceWithdrawal[] findAll()
* @method LicenceWithdrawal[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class LicenceWithdrawalRepository extends DocumentRepositoriesExtension
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, LicenceWithdrawal::class);
$this->fields = ['type']; //with title, list fields we can search in
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Repository;
use App\Entity\Licencewithdrawal;
use Doctrine\Persistence\ManagerRegistry;
use App\Repository\Tools\DocumentRepositoriesExtension;
/**
* @method Licencewithdrawal|null find($id, $lockMode = null, $lockVersion = null)
* @method Licencewithdrawal|null findOneBy(array $criteria, array $orderBy = null)
* @method Licencewithdrawal[] findAll()
* @method Licencewithdrawal[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class LicencewithdrawalRepository extends DocumentRepositoriesExtension
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Licencewithdrawal::class);
$this->fields = ['type']; //with title, list fields we can search in
}
}

View File

@@ -14,8 +14,8 @@
{% include '_cells/documentTable.html.twig' with {'documents': Complaint, notype: true, limit: 3, nodirectoryinfo: true} %} {% include '_cells/documentTable.html.twig' with {'documents': Complaint, notype: true, limit: 3, nodirectoryinfo: true} %}
<hr class="my-3"> <hr class="my-3">
<h4>{% trans %}title_licencewithdrawals{% endtrans %} {% if is_granted('create', classMetadataToEntity(directory.licenceWithdrawals.typeClass, app.user)) %} <a href="{{ path('document_create_directory', {type: 'licenceWithdrawal', directory: directory.id}) }}"><span class="badge rounded-pill bg-success"><i class="fa fa-plus"></i> {% trans %}button_create{% endtrans %}</span></a> {% endif %}</h4> <h4>{% trans %}title_licencewithdrawals{% endtrans %} {% if is_granted('create', classMetadataToEntity(directory.licencewithdrawals.typeClass, app.user)) %} <a href="{{ path('document_create_directory', {type: 'licencewithdrawal', directory: directory.id}) }}"><span class="badge rounded-pill bg-success"><i class="fa fa-plus"></i> {% trans %}button_create{% endtrans %}</span></a> {% endif %}</h4>
{% include '_cells/documentTable.html.twig' with {'documents': LicenceWithdrawal, notype: true, limit: 3, nodirectoryinfo: true} %} {% include '_cells/documentTable.html.twig' with {'documents': Licencewithdrawal, notype: true, limit: 3, nodirectoryinfo: true} %}
<hr class="my-3"> <hr class="my-3">
<h4>{% trans %}title_infringements{% endtrans %} {% if is_granted('create', classMetadataToEntity(directory.infringements.typeClass, app.user)) %} <a href="{{ path('document_create_directory', {type: 'infringement', directory: directory.id}) }}"><span class="badge rounded-pill bg-success"><i class="fa fa-plus"></i> {% trans %}button_create{% endtrans %}</span></a> {% endif %}</h4> <h4>{% trans %}title_infringements{% endtrans %} {% if is_granted('create', classMetadataToEntity(directory.infringements.typeClass, app.user)) %} <a href="{{ path('document_create_directory', {type: 'infringement', directory: directory.id}) }}"><span class="badge rounded-pill bg-success"><i class="fa fa-plus"></i> {% trans %}button_create{% endtrans %}</span></a> {% endif %}</h4>

View File

@@ -118,8 +118,8 @@ breadcrumb_Infringement: Infringement
breadcrumb_Infringements: Infringements breadcrumb_Infringements: Infringements
breadcrumb_Jail: Jail breadcrumb_Jail: Jail
breadcrumb_Jails: Jails breadcrumb_Jails: Jails
breadcrumb_LicenceWithdrawal: Licence Withdrawal breadcrumb_Licencewithdrawal: Licence Withdrawal
breadcrumb_LicenceWithdrawals: Licence Withdrawals breadcrumb_Licencewithdrawals: Licence Withdrawals
breadcrumb_list: List breadcrumb_list: List
breadcrumb_listDirectories: Directories breadcrumb_listDirectories: Directories
breadcrumb_listDocuments: Documents breadcrumb_listDocuments: Documents
@@ -186,7 +186,7 @@ documentType_Folder: Folder
documentType_Gang: Gang documentType_Gang: Gang
documentType_Infringement: Infringement documentType_Infringement: Infringement
documentType_Jail: Jail documentType_Jail: Jail
documentType_LicenceWithdrawal: Licence Withdrawal documentType_Licencewithdrawal: Licence Withdrawal
documentType_Medical: Medical Visit documentType_Medical: Medical Visit
documentType_Report: Report documentType_Report: Report
documentType_Sanction: Sanction documentType_Sanction: Sanction
@@ -278,6 +278,7 @@ form_label_allowedgroups: Authorized groups
form_label_allowedsubgroups: Allowed subgroups form_label_allowedsubgroups: Allowed subgroups
form_label_allowShare: Check this box to allow public sharing form_label_allowShare: Check this box to allow public sharing
form_label_amount: Total Amount form_label_amount: Total Amount
form_label_archive: Archives
form_label_arrested_at: Arrest form_label_arrested_at: Arrest
form_label_asked_for_lawyer: Request for a lawyer form_label_asked_for_lawyer: Request for a lawyer
form_label_asked_for_medic: Request for a doctor form_label_asked_for_medic: Request for a doctor
@@ -333,6 +334,7 @@ form_label_status: Status
form_label_subgroups: Speciality form_label_subgroups: Speciality
form_label_time: Total Duration form_label_time: Total Duration
form_label_title: Title form_label_title: Title
form_label_type: Type
form_label_until: until form_label_until: until
form_label_upload_backpicture: Back picture form_label_upload_backpicture: Back picture
form_label_upload_boatlicence: Maritime Permit form_label_upload_boatlicence: Maritime Permit

View File

@@ -118,8 +118,8 @@ breadcrumb_Infringement: Infraction
breadcrumb_Infringements: Infractions breadcrumb_Infringements: Infractions
breadcrumb_Jail: PV de GAV breadcrumb_Jail: PV de GAV
breadcrumb_Jails: PVs de GAV breadcrumb_Jails: PVs de GAV
breadcrumb_LicenceWithdrawal: Retrait de permis breadcrumb_Licencewithdrawal: Retrait de permis
breadcrumb_LicenceWithdrawals: Retraits de permis breadcrumb_Licencewithdrawals: Retraits de permis
breadcrumb_list: Liste breadcrumb_list: Liste
breadcrumb_listDirectories: Fiches breadcrumb_listDirectories: Fiches
breadcrumb_listDocuments: Documents breadcrumb_listDocuments: Documents
@@ -186,7 +186,7 @@ documentType_Folder: Dossier
documentType_Gang: Gang documentType_Gang: Gang
documentType_Infringement: Infraction documentType_Infringement: Infraction
documentType_Jail: PV de GAV documentType_Jail: PV de GAV
documentType_LicenceWithdrawal: Retrait de permis documentType_Licencewithdrawal: Retrait de permis
documentType_Medical: Visite Médicale documentType_Medical: Visite Médicale
documentType_Report: Rapport documentType_Report: Rapport
documentType_Sanction: Sanction documentType_Sanction: Sanction
@@ -278,6 +278,7 @@ form_label_allowedgroups: Groupes autorisés
form_label_allowedsubgroups: Specialitées autorisées en acces form_label_allowedsubgroups: Specialitées autorisées en acces
form_label_allowShare: Cochez cette case pour autoriser le partage public form_label_allowShare: Cochez cette case pour autoriser le partage public
form_label_amount: Montant total form_label_amount: Montant total
form_label_archive: Archives
form_label_arrested_at: Arrestation form_label_arrested_at: Arrestation
form_label_asked_for_lawyer: Demande d'un avocat form_label_asked_for_lawyer: Demande d'un avocat
form_label_asked_for_medic: Demande d'un médecin form_label_asked_for_medic: Demande d'un médecin
@@ -333,6 +334,7 @@ form_label_status: Statut
form_label_subgroups: Spécialités form_label_subgroups: Spécialités
form_label_time: Durée totale form_label_time: Durée totale
form_label_title: Titre form_label_title: Titre
form_label_type: Type
form_label_until: Jusqu'à form_label_until: Jusqu'à
form_label_upload_backpicture: Photo de Dos form_label_upload_backpicture: Photo de Dos
form_label_upload_boatlicence: Permis Maritime form_label_upload_boatlicence: Permis Maritime