Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppression de la question sur le handicap (et de la donnée dans la BDD) #936

Merged
merged 3 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions migrations/Version20230221141300.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20230221141300 extends AbstractMigration
{
public function getDescription(): string
{
return 'Drop is_situation_handicap column from signalement';
}

public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE signalement DROP is_situation_handicap');
}

public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE signalement ADD is_situation_handicap TINYINT(1) DEFAULT NULL');
}
}
1 change: 0 additions & 1 deletion src/DataFixtures/Loader/LoadSignalementData.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ private function loadSignalements(ObjectManager $manager, array $row)
->setSuperficie($row['superficie'])
->setLoyer($row['loyer'])
->setDetails($row['details'])
->setIsSituationHandicap(false)
->setIsProprioAverti($row['is_proprio_averti'])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

est-ce qu'il ne faudrait pas supprimer l'information des fixtures également pour avoir des fixtures "propres" ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cette info n'est pas remplie dans les fixtures (sauf erreur de ma part)

->setModeContactProprio(json_decode($row['mode_contact_proprio'], true))
->setNomProprio($faker->company())
Expand Down
15 changes: 0 additions & 15 deletions src/Entity/Signalement.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,6 @@ class Signalement
#[ORM\Column(type: 'float', nullable: true)]
private $montantAllocation;

#[ORM\Column(type: 'boolean', nullable: true)]
private $isSituationHandicap;

#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'signalementsModified')]
private $modifiedBy;

Expand Down Expand Up @@ -1033,18 +1030,6 @@ public function setMontantAllocation(?float $montantAllocation): self
return $this;
}

public function getIsSituationHandicap()
{
return $this->isSituationHandicap;
}

public function setIsSituationHandicap($isSituationHandicap)
{
$this->isSituationHandicap = $isSituationHandicap;

return $this;
}

public function getSuivis(): Collection
{
return $this->suivis;
Expand Down
1 change: 0 additions & 1 deletion src/Factory/SignalementFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public function createInstanceFrom(Territory $territory, array $data, bool $isIm
->setDateVisite($data['dateVisite'])
->setIsOccupantPresentVisite((bool) $data['isOccupantPresentVisite'])
->setMontantAllocation((float) $data['montantAllocation'])
->setIsSituationHandicap($data['isSituationHandicap'])
->setCodeProcedure($data['codeProcedure'])
->setEtageOccupant($data['etageOccupant'])
->setEscalierOccupant($data['escalierOccupant'])
Expand Down
15 changes: 0 additions & 15 deletions src/Form/SignalementType.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'label' => 'Quelle est la superficie du logement (en m²) ?',
'required' => false,
])
->add('isSituationHandicap', ChoiceType::class, [
'choice_attr' => [
'class' => 'fr-radio',
],
'choices' => [
'Oui' => 1,
'Non' => 0,
'Ne sais pas' => '',
],
'expanded' => true,
'label_attr' => [
'class' => 'fr-label',
],
'label' => 'Il y a-t-il des personnes en situation de handicap dans le logement ?',
])
->add('isAllocataire', ChoiceType::class, [
'choices' => [
'CAF' => 'CAF',
Expand Down
1 change: 0 additions & 1 deletion src/Manager/SignalementManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ public function update(Signalement $signalement, array $data): Signalement
->setDateVisite($data['dateVisite'])
->setIsOccupantPresentVisite((bool) $data['isOccupantPresentVisite'])
->setMontantAllocation((float) $data['montantAllocation'])
->setIsSituationHandicap($data['isSituationHandicap'])
->setCodeProcedure($data['codeProcedure'])
->setEtageOccupant($data['etageOccupant'])
->setEscalierOccupant($data['escalierOccupant'])
Expand Down
2 changes: 0 additions & 2 deletions src/Service/Import/Signalement/SignalementImportMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public function getMapping(): array
'code insee occupant' => 'inseeOccupant',
'date visite' => 'dateVisite',
'Occupant présent lors de la visite ?' => 'isOccupantPresentVisite',
'Occupant en situation handicap' => 'isSituationHandicap',
'etage occupant' => 'etageOccupant',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il faudra penser à modifier le template modèle qu'on fournit aux territoires pour les imports (qui a la main là-dessus ?)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c'est fait
image

'escalier occupant' => 'escalierOccupant',
'numéro appartement occupant' => 'numAppartOccupant',
Expand Down Expand Up @@ -161,7 +160,6 @@ public function map(array $columns, array $data): array
case 'isLogementCollectif':
case 'isConsentementTiers':
case 'isOccupantPresentVisite':
case 'isSituationHandicap':
case 'isLogementSocial':
case 'isPreavisDepart':
case 'isRelogement':
Expand Down
5 changes: 0 additions & 5 deletions src/Service/SearchFilterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public function setFilters(): self
'interventions' => $request->get('bo-filters-interventions') ?? null,
'avant1949' => $request->get('bo-filters-avant1949') ?? null,
'enfantsM6' => $request->get('bo-filters-enfantsM6') ?? null,
'handicaps' => $request->get('bo-filters-handicaps') ?? null,
'affectations' => $request->get('bo-filters-affectations') ?? null,
'visites' => $request->get('bo-filters-visites') ?? null,
'delays' => $request->get('bo-filters-delays') ?? null,
Expand Down Expand Up @@ -167,10 +166,6 @@ public function applyFilters(QueryBuilder $qb, array $filters): QueryBuilder
$qb->andWhere('s.isConstructionAvant1949 IN (:avant1949)')
->setParameter('avant1949', $filters['avant1949']);
}
if (!empty($filters['handicaps'])) {
$qb->andWhere('s.isSituationHandicap IN (:handicaps)')
->setParameter('handicaps', $filters['handicaps']);
}
if (!empty($filters['dates'])) {
$field = 's.createdAt';
if (!empty($filters['visites'])) {
Expand Down
51 changes: 1 addition & 50 deletions templates/_partials/_search_filter_form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -342,61 +342,12 @@
<span class="fr-badge fr-badge--info fr-m-1v {{ visible ?? '' }}">TOUS</span>
</div>
</div>
<div class="fr-col-6">
<label class="fr-label" for="bo-filters-handicaps"><strong>Situation handicap</strong></label>
<select id="bo-filters-handicaps" class="fr-select" onchange="setBadge(this)">
<option value="">TOUS</option>
<option value="0" class="{% if 0 in filters.handicaps %}fr-hidden{% endif %}">NON</option>
<option value="1" class="{% if 1 in filters.handicaps %}fr-hidden{% endif %}">OUI</option>
</select>
<div class="selected__value">
<div class="fr-pb-1v fr-border--bottom--orange"></div>
{% set visible = 'fr-hidden' %}
{% for handicap in filters.handicaps %}
<input type="hidden" name="bo-filters-handicaps[]" value="{{ handicap }}">
<span class="fr-badge fr-badge--success fr-m-1v"
data-value="{{ handicap }}" data-removable="true"
data-value="{{ handicap }}">{{ handicap ? 'OUI':'NON' }}</span>
{% else %}
{% set visible = 0 %}
{% endfor %}
<span class="fr-badge fr-badge--info fr-m-1v {{ visible ?? '' }}">TOUS</span>
</div>
</div>
</div>
</div>


<div class="fr-col-12 fr-col-md-6">
<div class="fr-grid-row fr-grid-row--gutters">{#
<div class="fr-col-6">
<label class="fr-label" for="bo-filters-affectations"><strong>Affectations</strong></label>
<select id="bo-filters-affectations" class="fr-select" onchange="setBadge(this)">
<option value="">TOUS</option>
<option value="1" class="{% if 0 in filters.affectations %}fr-hidden{% endif %}">EN
ATTENTE
</option>
<option value="1" class="{% if 1 in filters.affectations %}fr-hidden{% endif %}">ACCEPTEE
</option>
<option value="2" class="{% if 1 in filters.affectations %}fr-hidden{% endif %}">REFUSEE
</option>
<option value="3" class="{% if 1 in filters.affectations %}fr-hidden{% endif %}">CLOTUREE
</option>
</select>
<div class="selected__value">
<div class="fr-pb-1v fr-border--bottom--orange"></div>
{% set visible = 'fr-hidden' %}
{% for affectation in filters.affectations %}
<input type="hidden" name="bo-filters-affectations[]" value="{{ affectation }}">
<span class="fr-badge fr-badge--success fr-m-1v"
data-value="{{ affectation }}" data-removable="true"
data-value="{{ affectation }}">{{ statuts_affectation[affectation] }}</span>
{% else %}
{% set visible = 0 %}
{% endfor %}
<span class="fr-badge fr-badge--info fr-m-1v {{ visible ?? '' }}">TOUS</span>
</div>
</div>#}
<div class="fr-grid-row fr-grid-row--gutters">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ce code commenté correspond à du code non-commenté dans le SearchFilterService (je ne sais pas pourquoi), à mon avis, soit on supprime tout, soit on laisse

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attendons encore un peu avant le supprimer dans le service, on n'a pas encore de test sur ce service, ok pour la suppression du twig (c'est commenté depuis la création du projet sur github)

<div class="fr-col-6">
<label class="fr-label" for="bo-filters-delays"><strong>Dernier suivi </strong>
<small>(jours)</small></label>
Expand Down
19 changes: 0 additions & 19 deletions templates/_partials/_signalement_steps_tabs.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -550,25 +550,6 @@
</div>
</div>
</div>
<div class="fr-form-group">
<fieldset class="fr-fieldset fr-fieldset--inline">
<legend class="fr-fieldset__legend fr-text--regular" id='signalement-situation-handicap'>
{{ form_label(form.isSituationHandicap) }}
{{ form_help(form.isSituationHandicap) }}
</legend>
<div class="fr-fieldset__content">
{% for key, choice in form.isSituationHandicap.children %}
<div class="fr-radio-group">
{{ form_widget(choice) }}
{{ form_label(choice) }}
</div>
{% endfor %}
</div>
<p class="fr-error-text fr-hidden">
Veuillez préciser une ou plusieur personnes présentent une situation de handicap
</p>
</fieldset>
</div>
<div class="fr-form-group">
<fieldset class="fr-fieldset fr-fieldset--inline">
<legend class="fr-fieldset__legend fr-text--regular" id='signalement-logement-social'>
Expand Down
9 changes: 0 additions & 9 deletions templates/back/signalement/view.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -311,15 +311,6 @@
<strong>Montant allocation: </strong> {{ signalement.montantAllocation ?? 'N/R' }} €/mois
</li>
{% endif %}
<li>
<strong>Situation de handicap: </strong>
{% if signalement.isSituationHandicap %}
{{ picto_yes|format('IsSituationHandicap')|raw }}
{% else %}
{{ picto_no|format('IsSituationHandicap')|raw }}
{% endif %}

</li>
<li>
<div class="fr-responsive-img fr-grid-row fr-grid-row--gutters fr-p-4v">
<div id="map-signalement-view" class="fr-rounded fr-mt-5v fr-col-12"
Expand Down
9 changes: 0 additions & 9 deletions templates/pdf/signalement.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,6 @@
€/mois
</li>
{% endif %}
<li>
<b>Situation de handicap: </b>
{% if signalement.isSituationHandicap %}
{{ picto_yes|raw }}
{% else %}
{{ picto_no|raw }}
{% endif %}

</li>
</ul>
</td>
{% if signalement.isNotOccupant %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ private function getCommonPayload()
'superficie' => '1000',
'isAllocataire' => '0',
'numAllocataire' => '0',
'isSituationHandicap' => '0',
'isLogementSocial' => '0',
'isPreavisDepart' => '0',
'isRelogement' => '0',
Expand Down
1 change: 0 additions & 1 deletion tests/Functional/Manager/SignalementManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ private function getSignalementData(string $reference = null): array
'inseeOccupant' => $faker->postcode(),
'dateVisite' => new \DateTimeImmutable(),
'isOccupantPresentVisite' => true,
'isSituationHandicap' => false,
'etageOccupant' => $faker->randomDigit(),
'escalierOccupant' => $faker->randomDigit(),
'numAppartOccupant' => $faker->randomDigit(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ public function getData(): array
'code insee occupant' => '13001',
'date visite' => null,
'Occupant présent lors de la visite ?' => null,
'Occupant en situation handicap' => false,
'etage occupant' => '2',
'escalier occupant' => null,
'numéro appartement occupant' => null,
Expand Down
4 changes: 1 addition & 3 deletions tests/Unit/Factory/SignalementFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public function testCreateSignalementIsValid()
'inseeOccupant' => $faker->postcode(),
'dateVisite' => new \DateTimeImmutable(),
'isOccupantPresentVisite' => true,
'isSituationHandicap' => false,
'etageOccupant' => $faker->randomDigit(),
'escalierOccupant' => $faker->randomDigit(),
'numAppartOccupant' => $faker->randomDigit(),
Expand Down Expand Up @@ -161,7 +160,6 @@ public function testCreateSignalementIsValid()
$this->assertEquals($data['numAllocataire'], $signalement->getNumAllocataire());
$this->assertEquals($data['montantAllocation'], $signalement->getMontantAllocation());

$this->assertEquals($data['isSituationHandicap'], $signalement->getIsSituationHandicap());
$this->assertEquals($data['isLogementSocial'], $signalement->getIsLogementSocial());
$this->assertEquals($data['isRelogement'], $signalement->getIsRelogement());

Expand Down Expand Up @@ -218,6 +216,6 @@ public function testCreateSignalementIsValid()
$this->assertEmpty($signalement->getModifiedBy());
$this->assertEmpty($signalement->getAffectationStatusByPartner());

$this->assertCount(84, $data, 'Array $data should have 84 keys');
$this->assertCount(83, $data, 'Array $data should have 83 keys');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

signalement c'est tellement touchy que t'ai obligé d'avoir ce genre de test :-D

}
}