Commit 19695905 authored by Christian BUFFIN's avatar Christian BUFFIN
Browse files

Merge branch '1.2.0' into 372-ajout-d-une-page-destinee-a-la-recette-corrections-mineures

parents b0595c7b 231fce46
......@@ -53,6 +53,8 @@ class RegistresController extends AppController {
$action = Inflector::underscore($this->request->params['action']);
$this->Droits->assertNotSu();
if ($action === 'add') {
$this->Droits->assertDpo();
} elseif ($action === 'edit') {
......@@ -284,7 +286,15 @@ class RegistresController extends AppController {
]
],
'Fichier' => [],
'Norme' => [],
'Norme' => [
'fields' => [
'id',
'norme',
'numero',
'libelle',
'description',
],
],
'Formulaire' => [
'fields' => [
'soustraitant'
......@@ -299,7 +309,12 @@ class RegistresController extends AppController {
$this->paginate = $query;
$fichesValid = $this->paginate('EtatFiche');
foreach ($fichesValid as $idx => $fiche) {
$list = Hash::combine($fiche, 'Fiche.Valeur.{n}.champ_name', 'Fiche.Valeur.{n}.valeur');
$fichesValid[$idx]['Fiche']['Valeur'] = $list;
}
$enumsNormes = $this->Norme->enums();
$this->set(compact('enumsNormes'));
......
......@@ -280,15 +280,21 @@ class WebdpoFiche extends AppModel {
]
],
// ---------------------------------------------------------------------
'criteres' => [
'checkNotBlankIfMultiple' => [
'rule' => ['checkMultipleIf', 'localisation_large_echelle', true, ['Non'], ['min' => 1]]
],
'checkBlankIf' => [
'rule' => ['checkBlankIf', 'localisation_large_echelle', true, ['Oui']]
]
],
// 'criteres' => [
// 'checkNotBlankIfMultiple' => [
// 'rule' => ['checkMultipleIf', 'localisation_large_echelle', true, ['Non'], ['min' => 1]]
// ],
// 'checkNotBlankIf' => [
// 'rule' => ['checkNotBlankIf', 'localisation_large_echelle', true, ['Non']]
// ],
// 'checkBlankIf' => [
// 'rule' => ['checkBlankIf', 'localisation_large_echelle', true, ['Oui']]
// ]
// ],
'traitement_considere_risque' => [
'checkBlankIfCountOptionsChecked' => [
'rule' => ['checkBlankIfCountOptionsChecked', 'criteres', 0]
],
'checkNotBlankIfCountOptionsChecked' => [
'rule' => ['checkNotBlankIfCountOptionsChecked', 'criteres', 1]
],
......
......@@ -24,9 +24,11 @@ class RegistresControllerTest extends ControllerTestCase
'app.Norme',
'app.Organisation',
'app.OrganisationUser',
'app.Responsable',
'app.Role',
'app.RoleDroit',
'app.Service',
'app.Soustraitant',
'app.TraitementRegistre',
'app.User',
'app.Valeur',
......@@ -142,7 +144,7 @@ class RegistresControllerTest extends ControllerTestCase
public function dataAccessIndex() {
return [
// Tous les utilisateurs peuvent accéder à la fonctionnalité
[200, 'Superadministrateur.superadmin', '/registres/index'],
[403, 'Superadministrateur.superadmin', '/registres/index'],
[200, 'Administrateur.ibleu', '/registres/index'],
[200, 'DPO.nroux', '/registres/index'],
[200, 'Rédacteur.rjaune', '/registres/index'],
......
......@@ -123,7 +123,7 @@ echo $this->Html->script('Fiches/pia');
'text' => __d('fiche', 'fiche.champCriteres')
],
'multiple' => 'checkbox',
'required' => true,
// 'required' => true,
'class' => 'checkbox',
'options' => Fiche::LISTE_CRITERES,
'div' => "input select"
......
......@@ -582,7 +582,6 @@ if ($this->request->params['action'] == 'add'){
'text' => __d('fiche', 'fiche.champCriteres')
],
'multiple' => 'checkbox',
'required' => true,
'class' => 'checkbox',
'options' => Fiche::LISTE_CRITERES,
'div' => "input select"
......
<!-- Pop-up de modification de la position d'un traitement pour la génération -->
<div class="modal fade" id="modalChangerPosition" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel">
<?php
echo __d('registre', 'registre.popupPositionnement');
?>
</h4>
</div>
<div class="modal-body">
<table class="table" id="render">
<!-- Titre tableau -->
<thead>
<tr>
<!-- Positionnement -->
<th class="col-md-1">
<?php
echo __d('registre', 'registre.textTableauPositionTraitement');
?>
</th>
<!-- Numéro d'enregistrement -->
<th class="col-md-1">
<?php
echo __d('registre', 'registre.textTableauNumeroEnregistrement');
?>
</th>
<!-- Nom du traitement -->
<th class="col-md-3">
<?php
echo __d('registre', 'registre.titreTableauNomTraitement');
?>
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="modal-footer">
<div class="btn-group">
<button type="button" class="btn btn-default-default" data-dismiss="modal">
<i class="fa fa-times-circle fa-lg"><!----></i>
<?php echo __d('default', 'default.btnAnnuler'); ?>
</button>
<?php
echo $this->Form->button('<span class="fa fa-cogs fa-lg">&nbsp;</span>' . __d('registre', 'registre.btnGenerer'), [
'onclick' => "sendDataExtrait()",
'class' => 'btn btn-default-primary pull-left btn_popupGenerer'
]);
echo $this->Form->button('<span class="fa fa-download fa-lg">&nbsp;</span>' . __d('registre', 'registre.btnTélécharger'), [
'onclick' => "sendData()",
'class' => 'btn btn-default-primary pull-left btn_popupTelecharger'
]);
echo $this->Form->button('<span class="fa fa-cogs fa-lg">&nbsp;</span>' . __d('registre', 'registre.btnGenerer'), [
'onclick' => "sendDataDeclaration()",
'class' => 'btn btn-default-primary pull-left btn_popupGenererNonVerrouiller'
]);
echo $this->Form->button('<span class="fa fa-download fa-lg">&nbsp;</span>' . __d('registre', 'registre.btnExport'), [
'onclick' => "sendDataExport()",
'class' => 'btn btn-default-primary pull-left btn_popupExportCsv'
]);
?>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
<!-- Pop-up modification du traitement enregistré au registre -->
<div class="modal fade" id="modalEditRegistre" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel">
<?php echo __d('registre', 'registre.popupTitreEditionTraitementRegistre'); ?>
</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12 text-warning">
<div class="col-md-12 text-center">
<i class="fa fa-exclamation-triangle fa-lg"><!----></i>
</div>
<div class="col-md-12">
<?php echo __d('registre', 'registre.popupText'); ?>
</div>
</div>
</div>
<div class="row top17">
<div class="col-md-12">
<?php
echo $this->Form->create('Registre', [
'url' => ['action' => 'edit'],
'class' => 'form-horizontal'
]);
echo $this->Form->input('motif', [
'label' => [
'text' => __d('registre', 'registre.popupChampMotif') . '<span class="obligatoire"> *</span>',
'class' => 'col-md-2 control-label'
],
'between' => '<div class="col-md-10">',
'after' => '</div>',
'class' => 'form-control',
'div' => 'form-group',
'required' => 'required'
]);
echo $this->Form->hidden('idEditRegistre', [
'value' => '',
'id' => "toModif"
]);
?>
</div>
</div>
</div>
<div class="modal-footer">
<div class="btn-group">
<button type="button" class="btn btn-default-default" data-dismiss="modal">
<i class="fa fa-times-circle fa-lg"><!----></i>
<?php echo __d('default', 'default.btnAnnuler'); ?>
</button>
<?php
echo $this->Form->button("<i class='fa fa-floppy-o fa-lg'><!----></i>" . __d('default', 'default.btnEnregistrer'), [
'type' => 'submit',
'class' => 'btn btn-default-success',
'escape' => false
]);
?>
</div>
<?php
echo $this->Form->end();
?>
</div>
</div>
</div>
</div>
\ No newline at end of file
......@@ -21,7 +21,7 @@
$filters = $this->request->data;
unset($filters['sort'], $filters['direction'], $filters['page'], $filters['Registre']['nbAffichage']);
if(empty($filters['Registre'])) {
if (empty($filters['Registre'])) {
unset($filters['Registre']);
}
......@@ -162,8 +162,6 @@
<?php
$idExtrait = [];
foreach ($fichesValid as $key => $value) {
$numeroRegistre = $value['Fiche']['numero'];
if ($value['EtatFiche']['etat_id'] != EtatFiche::ARCHIVER || $organisationActuelle['Organisation']['verrouiller'] == false) {
$iconBtn = $this->Html->tag('i','<!---->',['class' => 'fa fa-cog fa-lg']);
$titleBtn = __d('registre', 'registre.commentaireGenererRegistrePDF');
......@@ -173,21 +171,6 @@
}
if ($value['Fiche']['Valeur'] != null) {
$valeursTraitement = Hash::extract($value['Fiche'],'Valeur.{n}');
foreach ($valeursTraitement as $valeurTraitement) {
if ($valeurTraitement['champ_name'] === 'outilnom') {
$nomTraitement = $valeurTraitement['valeur'];
}
if ($valeurTraitement['champ_name'] === 'finaliteprincipale') {
$finalitePrincipaleTraitement = $valeurTraitement['valeur'];
}
if ($valeurTraitement['champ_name'] === 'declarantservice') {
$declarantServiceTraitement = $valeurTraitement['valeur'];
}
}
?>
<tr>
<?php
......@@ -208,14 +191,14 @@
<!-- Nom du traitement -->
<td class="tdleft">
<?php
echo $nomTraitement;
echo $value['Fiche']['Valeur']['outilnom'];
?>
</td>
<!-- Finalité principale -->
<td class="tdleft">
<?php
echo nl2br($finalitePrincipaleTraitement);
echo nl2br($value['Fiche']['Valeur']['finaliteprincipale']);
?>
</td>
......@@ -224,9 +207,13 @@
<div class="row">
<div class="col-md-12">
<strong>
<?php echo __d('registre', 'registre.textTableauNumeroEnregistrement'); ?>
<?php
echo __d('registre', 'registre.textTableauNumeroEnregistrement');
?>
</strong>
<?php echo $numeroRegistre; ?>
<?php
echo $value['Fiche']['numero'];
?>
</div>
</div>
......@@ -234,9 +221,13 @@
<div class="row">
<div class="col-md-12">
<strong>
<?php echo __d('registre', 'registre.textTableauDateCreation'); ?>
<?php
echo __d('registre', 'registre.textTableauDateCreation');
?>
</strong>
<?php echo $this->Time->format($value['Fiche']['created'], FORMAT_DATE); ?>
<?php
echo $this->Time->format($value['Fiche']['created'], FORMAT_DATE);
?>
</div>
</div>
......@@ -249,7 +240,7 @@
?>
</strong>
<?php
echo $declarantServiceTraitement;
echo $value['Fiche']['Valeur']['declarantservice'];
?>
</div>
</div>
......@@ -477,171 +468,13 @@
</div>
<?php
}
?>
<!-- Pop-up modification du traitement enregistré au registre -->
<div class="modal fade" id="modalEditRegistre" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel">
<?php echo __d('registre', 'registre.popupTitreEditionTraitementRegistre'); ?>
</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12 text-warning">
<div class="col-md-12 text-center">
<i class="fa fa-exclamation-triangle fa-lg"><!----></i>
</div>
<div class="col-md-12">
<?php echo __d('registre', 'registre.popupText'); ?>
</div>
</div>
</div>
<div class="row top17">
<div class="col-md-12">
<?php
echo $this->Form->create('Registre', [
'url' => ['action' => 'edit'],
'class' => 'form-horizontal'
]);
echo $this->Form->input('motif', [
'label' => [
'text' => __d('registre', 'registre.popupChampMotif') . '<span class="obligatoire"> *</span>',
'class' => 'col-md-2 control-label'
],
'between' => '<div class="col-md-10">',
'after' => '</div>',
'class' => 'form-control',
'div' => 'form-group',
'required' => 'required'
]);
echo $this->Form->hidden('idEditRegistre', [
'value' => '',
'id' => "toModif"
]);
?>
</div>
</div>
</div>
<div class="modal-footer">
<div class="btn-group">
<button type="button" class="btn btn-default-default" data-dismiss="modal">
<i class="fa fa-times-circle fa-lg"><!----></i>
<?php echo __d('default', 'default.btnAnnuler'); ?>
</button>
<?php
echo $this->Form->button("<i class='fa fa-floppy-o fa-lg'><!----></i>" . __d('default', 'default.btnEnregistrer'), [
'type' => 'submit',
'class' => 'btn btn-default-success',
'escape' => false
]);
?>
</div>
<?php
echo $this->Form->end();
?>
</div>
</div>
</div>
</div>
echo $this->element('Registres/modal/modalEditRegistre');
<?php
echo $pagination;
?>
<!-- Pop-up de modification de la position d'un traitement pour la génération -->
<div class="modal fade" id="modalChangerPosition" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel">
<?php
echo __d('registre', 'registre.popupPositionnement');
?>
</h4>
</div>
<div class="modal-body">
<table class="table" id="render">
<!-- Titre tableau -->
<thead>
<tr>
<!-- Positionnement -->
<th class="col-md-1">
<?php
echo __d('registre', 'registre.textTableauPositionTraitement');
?>
</th>
<!-- Numéro d'enregistrement -->
<th class="col-md-1">
<?php
echo __d('registre', 'registre.textTableauNumeroEnregistrement');
?>
</th>
<!-- Nom du traitement -->
<th class="col-md-3">
<?php
echo __d('registre', 'registre.titreTableauNomTraitement');
?>
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="modal-footer">
<div class="btn-group">
<button type="button" class="btn btn-default-default" data-dismiss="modal">
<i class="fa fa-times-circle fa-lg"><!----></i>
<?php echo __d('default', 'default.btnAnnuler'); ?>
</button>
<?php
echo $this->Form->button('<span class="fa fa-cogs fa-lg">&nbsp;</span>' . __d('registre', 'registre.btnGenerer'), [
'onclick' => "sendDataExtrait()",
'class' => 'btn btn-default-primary pull-left btn_popupGenerer'
]);
echo $this->Form->button('<span class="fa fa-download fa-lg">&nbsp;</span>' . __d('registre', 'registre.btnTélécharger'), [
'onclick' => "sendData()",
'class' => 'btn btn-default-primary pull-left btn_popupTelecharger'
]);
echo $this->Form->button('<span class="fa fa-cogs fa-lg">&nbsp;</span>' . __d('registre', 'registre.btnGenerer'), [
'onclick' => "sendDataDeclaration()",
'class' => 'btn btn-default-primary pull-left btn_popupGenererNonVerrouiller'
]);
echo $this->Form->button('<span class="fa fa-download fa-lg">&nbsp;</span>' . __d('registre', 'registre.btnExport'), [
'onclick' => "sendDataExport()",
'class' => 'btn btn-default-primary pull-left btn_popupExportCsv'
]);
?>
</div>
</div>
</div>
</div>
</div>
echo $this->element('Registres/modal/modalChangerPosition');
?>
<script type="text/javascript">
//<![CDATA[
......@@ -829,7 +662,7 @@
var tr = $('<tr id="'+selectedList[key]+'"><\/tr>')
.append('<td class="col-md-1"><select class="form-control optionSelected" required="required">' + createOption(nbTraitement, key+1) + '<\/select><\/td>')
.append('<td class="col-md-1 tdleft">'+traitement[key]['Fiche']['numero']+'<\/td>')
.append('<td class="col-md-3 tdleft">'+traitement[key]['Fiche']['Valeur'][1]['valeur']+'<\/td>')
.append('<td class="col-md-3 tdleft">'+traitement[key]['Fiche']['Valeur']['outilnom']+'<\/td>')
$('#render').find('tbody').append(tr);
}
......
......@@ -5,61 +5,73 @@ $(document).ready(function () {
displayFieldPiaListNotRequired(($('#ressources_humaines').attr('id')), ($('#ressources_humaines').val()));
$('#ressources_humaines').change(function () {
displayFieldPiaListNotRequired($(this).attr('id'), $(this).val());
scrollEnd();
});
displayFieldPiaListNotRequired($('#relation_fournisseurs').attr('id'), $('#relation_fournisseurs').val());
$('#relation_fournisseurs').change(function () {
displayFieldPiaListNotRequired($(this).attr('id'), $(this).val());
scrollEnd();
});
displayFieldPiaListNotRequired($('#gestion_electoral').attr('id'), $('#gestion_electoral').val());
$('#gestion_electoral').change(function () {
displayFieldPiaListNotRequired($(this).attr('id'), $(this).val());
scrollEnd();
});
displayFieldPiaListNotRequired($('#comites_entreprise').attr('id'), $('#comites_entreprise').val());
$('#comites_entreprise').change(function () {
displayFieldPiaListNotRequired($(this).attr('id'), $(this).val());
scrollEnd();
});
displayFieldPiaListNotRequired($('#association').attr('id'), $('#association').val());
$('#association').change(function () {
displayFieldPiaListNotRequired($(this).attr('id'), $(this).val());
scrollEnd();
});
displayFieldPiaListNotRequired($('#sante_prise_patient').attr('id'), $('#sante_prise_patient').val());
$('#sante_prise_patient').change(function () {
displayFieldPiaListNotRequired($(this).attr('id'), $(this).val());
scrollEnd();
});
displayFieldPiaListNotRequired($('#avocats').attr('id'), $('#avocats').val());
$('#avocats').change(function () {
displayFieldPiaListNotRequired($(this).attr('id'), $(this).val());
scrollEnd();
});
displayFieldPiaListNotRequired(($('#greffiers').attr('id')), ($('#greffiers').val()));
$('#greffiers').change(function () {
displayFieldPiaListNotRequired($(this).attr('id'), $(this).val());
scrollEnd();
});
displayFieldPiaListNotRequired($('#notaires').attr('id'), $('#notaires').val());
$('#notaires').change(function () {
displayFieldPiaListNotRequired($(this).attr('id'), $(this).val());
scrollEnd();
});
displayFieldPiaListNotRequired($('#collectivites_affaires_scolaires').attr('id'), $('#collectivites_affaires_scolaires').val());
$('#collectivites_affaires_scolaires').change(function () {
displayFieldPiaListNotRequ