Commit 2b109c41 authored by tguillon's avatar tguillon
Browse files

Ajout : régle de validation sur les champs en rapport avec l'AIPD

Modification : de l'affichage du premier onglet en fonction de l'utilisation des questions AIPD
parent 86ddbad2
......@@ -343,5 +343,8 @@ msgstr "Champ obligatoire"
msgid "Validate::multiple"
msgstr "Champ obligatoire"
msgid "Validate::checkNotBlankIfAll"
msgid "Validate::checkBlankIf"
msgstr "Cette valeur n'est pas possible"
msgid "Validate::checkNotBlankIfCountOptionsChecked"
msgstr "Champ obligatoire"
......@@ -253,29 +253,27 @@ class AppModel extends Model
}
/**
* Exemple: 'champ' => notEmptyIf( $check, ['reference'], true, array( 'P' ) )
* Exemple: 'champ' => notEmptyIf( $check, 'reference', true, array( 'P' ) )
*
* @param array $checks
* @param array $references
* @param string $reference
* @param boolean $condition
* @param array $values
* @return boolean
*/
public function checkNotBlankIfAll($checks, array $references, $condition, $values)
public function checkBlankIf($checks, $reference, $condition, $values)
{
if (!(is_array($checks) && !empty($references))) {
if (!(is_array($checks) && !empty($reference))) {
return false;
}
$success = true;
foreach ($references as $reference) {
$referenceValue = Hash::get($this->data, "{$this->alias}.{$reference}");
$referenceValue = Hash::get($this->data, "{$this->alias}.{$reference}");
if (!empty($checks)) {
foreach ($checks as $value) {
if (in_array($referenceValue, $values, true) === $condition) {
$success = Validation::notBlank($value) && $success;
}
if (!empty($checks)) {
foreach ($checks as $value) {
if (in_array($referenceValue, $values, true) === $condition) {
$success = Validation::blank($value) && $success;
}
}
}
......
This diff is collapsed.
<?php
echo $this->Html->script('Fiches/pia');
//echo $this->Html->script('Fiches/pia');
$empty = true;
if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
......@@ -39,7 +39,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'empty' => $empty,
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">'
'between' => '<div class="col-md-2 top5">',
'default' => 'Non'
],
'WebdpoFiche.relation_fournisseurs' => [
'id' => 'relation_fournisseurs',
......@@ -58,7 +59,7 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.gestion_electoral' => [
'id' => 'gestion_electoral',
......@@ -77,7 +78,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.comites_entreprise' => [
'id' => 'comites_entreprise',
......@@ -96,7 +98,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.association' => [
'id' => 'association',
......@@ -115,7 +118,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.sante_prise_patient' => [
'id' => 'sante_prise_patient',
......@@ -134,7 +138,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.avocats' => [
'id' => 'avocats',
......@@ -153,7 +158,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.greffiers' => [
'id' => 'greffiers',
......@@ -172,7 +178,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.notaires' => [
'id' => 'notaires',
......@@ -191,7 +198,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.collectivites_affaires_scolaires' => [
'id' => 'collectivites_affaires_scolaires',
......@@ -210,7 +218,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.controles_acces' => [
'id' => 'controles_acces',
......@@ -229,7 +238,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.ethylotests' => [
'id' => 'ethylotests',
......@@ -248,7 +258,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
]
]);
?>
......@@ -288,6 +299,7 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'default' => 'Non'
],
'WebdpoFiche.donnees_genetiques' => [
'id' => 'donnees_genetiques',
......@@ -306,7 +318,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.profils_personnes_gestion_rh' => [
'id' => 'profils_personnes_gestion_rh',
......@@ -325,7 +338,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.surveiller_constante_employes' => [
'id' => 'surveiller_constante_employes',
......@@ -344,7 +358,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.gestion_alertes_sociale_sanitaire' => [
'id' => 'gestion_alertes_sociale_sanitaire',
......@@ -363,7 +378,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.gestion_alertes_professionnelle' => [
'id' => 'gestion_alertes_professionnelle',
......@@ -382,7 +398,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.donnees_sante_registre' => [
'id' => 'donnees_sante_registre',
......@@ -401,7 +418,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.profilage_rupture_contrat' => [
'id' => 'profilage_rupture_contrat',
......@@ -420,7 +438,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.mutualises_manquements_rupture_contrat' => [
'id' => 'mutualises_manquements_rupture_contrat',
......@@ -439,7 +458,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.profilage_donnees_externes' => [
'id' => 'profilage_donnees_externes',
......@@ -458,7 +478,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.biometriques' => [
'id' => 'biometriques',
......@@ -477,7 +498,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.gestion_logements_sociaux' => [
'id' => 'gestion_logements_sociaux',
......@@ -496,7 +518,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.accompagnement_social' => [
'id' => 'accompagnement_social',
......@@ -515,7 +538,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
],
'WebdpoFiche.localisation_large_echelle' => [
'id' => 'localisation_large_echelle',
......@@ -534,7 +558,8 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
'before' => '<hr>'
'before' => '<hr>',
'default' => 'Non'
]
]);
?>
......
......@@ -64,62 +64,72 @@ $(document).ready(function () {
//
displayFieldPiaListRequired($('#sante_medicosociaux').attr('id'), $('#sante_medicosociaux').val());
$('#sante_medicosociaux').change(function () {
displayFieldPiaListRequired($(this).attr('id'), $(this).val());
});
displayFieldPiaListRequired($('#donnees_genetiques').attr('id'), $('#donnees_genetiques').val());
$('#donnees_genetiques').change(function () {
displayFieldPiaListRequired($(this).attr('id'), $(this).val());
});
displayFieldPiaListRequired($('#profils_personnes_gestion_rh').attr('id'), $('#profils_personnes_gestion_rh').val());
$('#profils_personnes_gestion_rh').change(function () {
displayFieldPiaListRequired($(this).attr('id'), $(this).val());
});
displayFieldPiaListRequired($('#surveiller_constante_employes').attr('id'), $('#surveiller_constante_employes').val());
$('#surveiller_constante_employes').change(function () {
displayFieldPiaListRequired($(this).attr('id'), $(this).val());
});
displayFieldPiaListRequired($('#gestion_alertes_sociale_sanitaire').attr('id'), $('#gestion_alertes_sociale_sanitaire').val());
$('#gestion_alertes_sociale_sanitaire').change(function () {
displayFieldPiaListRequired($(this).attr('id'), $(this).val());
});
displayFieldPiaListRequired($('#gestion_alertes_professionnelle').attr('id'), $('#gestion_alertes_professionnelle').val());
$('#gestion_alertes_professionnelle').change(function () {
displayFieldPiaListRequired($(this).attr('id'), $(this).val());
});
displayFieldPiaListRequired($('#donnees_sante_registre').attr('id'), $('#donnees_sante_registre').val());
$('#donnees_sante_registre').change(function () {
displayFieldPiaListRequired($(this).attr('id'), $(this).val());
});
displayFieldPiaListRequired($('#profilage_rupture_contrat').attr('id'), $('#profilage_rupture_contrat').val());
$('#profilage_rupture_contrat').change(function () {
displayFieldPiaListRequired($(this).attr('id'), $(this).val());
});
displayFieldPiaListRequired($('#mutualises_manquements_rupture_contrat').attr('id'), $('#mutualises_manquements_rupture_contrat').val());
$('#mutualises_manquements_rupture_contrat').change(function () {
displayFieldPiaListRequired($(this).attr('id'), $(this).val());
});
displayFieldPiaListRequired($('#profilage_donnees_externes').attr('id'), $('#profilage_donnees_externes').val());
$('#profilage_donnees_externes').change(function () {
displayFieldPiaListRequired($(this).attr('id'), $(this).val());
});
displayFieldPiaListRequired($('#biometriques').attr('id'), $('#biometriques').val());
$('#biometriques').change(function () {
displayFieldPiaListRequired($(this).attr('id'), $(this).val());
});
displayFieldPiaListRequired($('#gestion_logements_sociaux').attr('id'), $('#gestion_logements_sociaux').val());
$('#gestion_logements_sociaux').change(function () {
displayFieldPiaListRequired($(this).attr('id'), $(this).val());
});
displayFieldPiaListRequired($('#accompagnement_social').attr('id'), $('#accompagnement_social').val());
$('#accompagnement_social').change(function () {
displayFieldPiaListRequired($(this).attr('id'), $(this).val());
});
$('#accompagnement_social').change(function () {
displayFieldPiaListRequired($(this).attr('id'), $(this).val());
});
displayFieldPiaListRequired($('#localisation_large_echelle').attr('id'), $('#localisation_large_echelle').val());
$('#localisation_large_echelle').change(function () {
displayFieldPiaListRequired($(this).attr('id'), $(this).val());
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment