diff --git a/app/Console/Command/UpdateLigneFormulaireShell.php b/app/Console/Command/UpdateLigneFormulaireShell.php new file mode 100644 index 0000000000000000000000000000000000000000..fbbe2bd89e79fd846eac3e5b4cbd24e8fdd16fd9 --- /dev/null +++ b/app/Console/Command/UpdateLigneFormulaireShell.php @@ -0,0 +1,148 @@ +<?php + +/** + * Installations Shell + * + * web-DPO : Outil de gestion de vos traitements dans le cadre de la + * réglementation relative à la protection des données personnelles (RGPD) + * + * Copyright (c) Libriciel SCOP (https://www.libriciel.fr/) + * + * Licensed under the GNU Affero General Public License version 3 License - AGPL v3 + * For full copyright and license information, please see the "LICENSE" file. + * Redistributions of files must retain the above copyright notice. + * + * @copyright Copyright (c) Libriciel SCOP (https://www.libriciel.fr/) + * @link https://www.libriciel.fr/web-dpo/ + * @since web-DPO v1.0.0 + * @license [GNU Affero General Public License version 3](http://www.gnu.org/licenses/agpl-3.0.html) - AGPL v3 + * @version v2.1.0 + * @package App.Console.Command.Shell + */ + +class UpdateLigneFormulaireShell extends Shell { + + public $uses = [ + 'Formulaire', + 'Champ' + ]; + + + public function getOptionParser(): ConsoleOptionParser + { + $parser = parent::getOptionParser(); + + $parser->description([ + 'Recalcule position champ dans la meme colonne', + '', + '', + ]); + + $options = [ + 'formulaireId' => [ + 'help' => "Id du formulaire", + 'default' => null, + 'required' => true, + ], + 'colonne' => [ + 'help' => "Numéro de colonne 1 ou 2", + 'default' => 1, + 'required' => true, + ] + ]; + $parser->addOptions($options); + + return $parser; + } + + public function updateForm() + { + $formulaire_id = Hash::get($this->params, 'formulaireId'); + $colonne = Hash::get($this->params, 'colonne'); + + $success = true; + $this->Champ->begin(); + + $formChamps = $this->Champ->find('all', [ + 'conditions' => [ + 'formulaire_id' => $formulaire_id, + 'colonne' => $colonne, + 'champ_coresponsable' => false, + 'champ_soustraitant' => false, + ], + 'fields' => [ + 'id', + 'ligne', + 'type', + ], + 'order' => 'ligne' + ]); + + foreach ($formChamps as $key => $formChamp) { + if ($key === 0) { + continue; + } + + if ($formChamps[$key-1]['Champ']['type'] === 'date' || + $formChamps[$key-1]['Champ']['type'] === 'input' || + $formChamps[$key-1]['Champ']['type'] === 'texte' || + $formChamps[$key-1]['Champ']['type'] === 'title' + ) { + if ($formChamp['Champ']['ligne'] - $formChamps[$key - 1]['Champ']['ligne'] < 2) { + $formChamps[$key]['Champ']['ligne'] = $formChamps[$key - 1]['Champ']['ligne'] + 2; + } + } + + if ($formChamps[$key-1]['Champ']['type'] === 'textarea' || + $formChamps[$key-1]['Champ']['type'] === 'checkboxes' || + $formChamps[$key-1]['Champ']['type'] === 'radios' + ) { + if ($formChamp['Champ']['ligne'] - $formChamps[$key - 1]['Champ']['ligne'] < 5) { + $formChamps[$key]['Champ']['ligne'] = $formChamps[$key - 1]['Champ']['ligne'] + 5; + } + } + } + +// foreach ($formChamps as $key => $formChamp) { +// if ($key === 0) { +// continue; +// } +// +// if ($formChamp['Champ']['type'] === 'date' || +// $formChamp['Champ']['type'] === 'input' || +// $formChamp['Champ']['type'] === 'texte' +// ) { +// //ecart de 2 +// if ($formChamp['Champ']['ligne'] - $formChamps[$key - 1]['Champ']['ligne'] < 2) { +// $formChamps[$key]['Champ']['ligne'] = $formChamps[$key - 1]['Champ']['ligne'] + 2; +// +// //update caleur de results[$key -1] +// } +// continue; +// } +// +// if ($formChamp['Champ']['type'] === 'title' || +// $formChamp['Champ']['type'] === 'radios' || +// $formChamp['Champ']['type'] === 'textarea' || +// $formChamp['Champ']['type'] === 'checkboxes' +// ) { +// //ecart de 5 +// if ($formChamp['Champ']['ligne'] - $formChamps[$key - 1]['Champ']['ligne'] < 5) { +// $formChamps[$key]['Champ']['ligne'] = $formChamps[$key - 1]['Champ']['ligne'] + 5; +// } +// } +// +// } + + foreach ($formChamps as $formChamp) { + $this->Champ->create($formChamp); + $success = false !== $this->Champ->save(null, ['atomic' => false]); + } + + if ($success === true) { + $this->Champ->commit(); + } else { + $this->Champ->rollback(); + } + } +} \ No newline at end of file diff --git a/app/Controller/RegistresController.php b/app/Controller/RegistresController.php index db1f1b15ff21241a5df2e4f4d12335589e16c8df..71640c0fb805fa793f4f826379a0a3f718483c21 100644 --- a/app/Controller/RegistresController.php +++ b/app/Controller/RegistresController.php @@ -104,6 +104,7 @@ class RegistresController extends AppController { 'EtatFiche.actif' => true, 'Fiche.organisation_id' => $this->Session->read('Organisation.id') ]; + $conditionForFormulaireFilter = $condition; $conditionValeur = []; $order = 'Fiche.created DESC'; @@ -427,6 +428,22 @@ class RegistresController extends AppController { $this->request->data['Registre']['nbAffichage'] = 20; } + $queryAllFiche = [ + 'conditions' => $conditionForFormulaireFilter, + 'contain' => [ + 'Fiche' => [ + 'id', + 'Formulaire' => [ + 'fields' => [ + 'id', + 'libelle' + ] + ], + ] + ] + ]; + $fi = $this->EtatFiche->find('all', $queryAllFiche); + $options = [ 'users' => $this->WebcilUsers->users('list', ['restrict' => true]), 'services' => $this->WebcilUsers->services('list', [ @@ -436,21 +453,7 @@ class RegistresController extends AppController { 'Service.libelle' ] ]), - 'formulaires' => $this->Formulaire->find('list', [ - 'Formulaire.id' => 'Formulaire.libelle', - 'contain' => [ - 'FormulaireOrganisation' => [ - 'Organisation' => [ - 'id', - 'raisonsociale', - 'order' => ['raisonsociale'] - ] - ], - ], - 'conditions' => [ - $this->Formulaire->getFormulaireConditionOrganisation($this->Session->read('Organisation.id')) - ], - ]), + 'formulaires' => Hash::combine($fi,'{n}.Fiche.Formulaire.id','{n}.Fiche.Formulaire.libelle'), 'all_soustraitants' => $this->Soustraitant->find('list', [ 'restrict' => true, 'fields' => [ diff --git a/app/Locale/fra/LC_MESSAGES/fiche.po b/app/Locale/fra/LC_MESSAGES/fiche.po index 8e5d46dd93ab3a347bb672aa4d242cbfa2525f42..05e9df16541c3415c75e1cc07303fb1cf2259871 100755 --- a/app/Locale/fra/LC_MESSAGES/fiche.po +++ b/app/Locale/fra/LC_MESSAGES/fiche.po @@ -640,6 +640,9 @@ msgstr "Dupliquer le traitement" msgid "fiche.champOrganisationcible" msgstr "Entité cible pour la duplication du traitement" +msgid "fiche.champDuplicationOrganisationcible" +msgstr "Entité cible pour la duplication du traitement" + msgid "fiche.champUsercible" msgstr "Utilisateur rédacteur pour la duplication du traitement" diff --git a/app/View/Elements/Fiches/modal/modalDupliquerTraitement.ctp b/app/View/Elements/Fiches/modal/modalDupliquerTraitement.ctp index cfa641c0958795649cc108ec29b7a5bfa0a028c9..b6a1f15a803da7b3fd2f1a2c4bbe345cb2bb9c72 100644 --- a/app/View/Elements/Fiches/modal/modalDupliquerTraitement.ctp +++ b/app/View/Elements/Fiches/modal/modalDupliquerTraitement.ctp @@ -4,9 +4,10 @@ $body = $this->WebcilForm->inputs([ 'id' => "FicheId", 'value' => null ], - 'Fiche.organisationcible' => [ - 'id' => 'organisationcible', + 'Fiche.duplicationOrganisationcible' => [ + 'id' => 'duplicationOrganisationcible', 'options' => $mesOrganisations, + 'class' => 'usersDeroulant transformSelect form-control', 'required' => true, 'empty' => true, 'placeholder' => false, @@ -15,6 +16,7 @@ $body = $this->WebcilForm->inputs([ 'Fiche.usercible' => [ 'id' => 'usercible', 'options' => [], + 'class' => 'usersDeroulant transformSelect form-control', 'required' => true, 'empty' => true, 'placeholder' => false, @@ -23,6 +25,7 @@ $body = $this->WebcilForm->inputs([ 'Fiche.userservicecible' => [ 'id' => 'userservicecible', 'options' => [], + 'class' => 'usersDeroulant transformSelect form-control', 'required' => true, 'empty' => true, 'placeholder' => false, @@ -70,36 +73,37 @@ echo $this->element('modal', [ $('#FicheId').val($(this).attr('value')); }); - // Lors d'action sur une menu déroulant : organisationcible - $("#organisationcible").change(function () { - let organisationcible = $(this).val(); + // Lors d'action sur une menu déroulant : duplicationOrganisationcible + $("#duplicationOrganisationcible").on('change.select2', function () { + let duplicationOrganisationcible = $(this).val(); hideAndRemoveField(); - if (organisationcible) { - updateListingUser(organisationcible); + if (duplicationOrganisationcible) { + updateListingUser(duplicationOrganisationcible); } else { hideBtnSave(); } }); - $("#usercible").change(function () { + // $("#usercible").change(function () { + $("#usercible").on('change.select2', function () { let usercible = $(this).val(); - let organisationcible = $('#organisationcible').val(); + let duplicationOrganisationcible = $('#duplicationOrganisationcible').val(); $('#userservicecible option').remove(); - if (usercible && organisationcible) { + if (usercible && duplicationOrganisationcible) { updateListingServices( usercible, - organisationcible + duplicationOrganisationcible ); } else { hideBtnSave(); } }); - $("#userservicecible").change(function () { + $("#userservicecible").on('change.select2', function () { if ($(this).val()) { $('#btnSave').removeAttr('disabled'); } else { @@ -107,6 +111,11 @@ echo $this->element('modal', [ } }); + // $('#modalDupliquerTraitement').on('hidden.bs.modal', function () { + // $('#organisationcible').val(); + // hideAndRemoveField(); + // hideBtnSave(); + // }) }); function hideAndRemoveField() @@ -123,12 +132,12 @@ echo $this->element('modal', [ $('#btnSave').attr('disabled', true); } - function updateListingUser(organisationcible) + function updateListingUser(duplicationOrganisationcible) { $.ajax({ url: '<?php echo Router::url(['controller' => 'pannel', 'action' => 'ajax_listing_users_organisation']);?>', method: 'POST', - data: {'organisation_id': organisationcible}, + data: {'organisation_id': duplicationOrganisationcible}, success: function(dataResponse) { try { let organisations = JSON.parse(dataResponse); @@ -153,14 +162,14 @@ echo $this->element('modal', [ }); } - function updateListingServices(usercible, organisationcible) + function updateListingServices(usercible, duplicationOrganisationcible) { $.ajax({ url: '<?php echo Router::url(['controller' => 'pannel', 'action' => 'ajax_listing_services_user']);?>', method: 'POST', data: { 'user_id': usercible, - 'organisation_id': organisationcible, + 'organisation_id': duplicationOrganisationcible, }, success: function(dataResponse) { try { @@ -189,4 +198,4 @@ echo $this->element('modal', [ }); } -</script> +</script> \ No newline at end of file diff --git a/app/View/Elements/Formulaires/oldOnglets/ongletShowInformationGenerale.ctp b/app/View/Elements/Formulaires/oldOnglets/ongletShowInformationGenerale.ctp index 3b20edc1345517cde9ef7b8c3e0e5eeef0a5ed41..4085c9a9fd664a92575c5b88e83c76b0886ae200 100644 --- a/app/View/Elements/Formulaires/oldOnglets/ongletShowInformationGenerale.ctp +++ b/app/View/Elements/Formulaires/oldOnglets/ongletShowInformationGenerale.ctp @@ -70,11 +70,11 @@ <!-- Information concernant le traitement --> <div class="col-md-12"> - <span class='labelFormulaire'> - <?php - echo __d('fiche', 'fiche.textInfoTraitement'); - ?> - </span> + <span class='labelFormulaire'> + <?php + echo __d('fiche', 'fiche.textInfoTraitement'); + ?> + </span> <div class="row row35"></div> </div> @@ -91,15 +91,27 @@ ], 'Fiche.transfert_hors_ue' => [ 'id' => 'transfert_hors_ue', + 'options' => [ + true => 'Oui', + false => 'Non' + ], + 'default' => false, 'required' => true, 'placeholder' => false, - 'readonly' => true + 'readonly' => true, + 'class' => 'transformSelect form-control', ], 'Fiche.donnees_sensibles' => [ 'id' => 'donnees_sensibles', + 'options' => [ + true => 'Oui', + false => 'Non' + ], + 'default' => false, 'required' => true, 'placeholder' => false, - 'readonly' => true + 'readonly' => true, + 'class' => 'transformSelect form-control', ] ]); ?> @@ -117,53 +129,59 @@ ]); ?> </div> + </div> - <!-- Co-responsabilité sur le traitement --> - <div class="col-md-12"> - <span class='labelFormulaire'> - <?php - echo __d('fiche', 'fiche.textInfoCoresponsable'); - ?> - </span> - <div class="row row35"></div> - </div> - - <div class="row"> - <!-- Colonne de gauche --> - <div class="col-md-6"> + <div class="row"> + <!-- Colonne de gauche --> + <div class="col-md-6"> + <!-- Co-responsabilité sur le traitement --> + <span class='labelFormulaire'> <?php - echo $this->WebcilForm->input('Fiche.coresponsable', [ - 'type' => 'text', - 'required' => true, - 'placeholder' => false, - 'readonly' => true - ]); + echo __d('fiche', 'fiche.textInfoCoresponsable'); ?> + </span> + + <?php + echo $this->WebcilForm->input('Fiche.coresponsable', [ + 'options' => [ + true => 'Oui', + false => 'Non' + ], + 'default' => false, + 'class' => 'transformSelect form-control', + 'placeholder' => false, + 'required' => true, + 'readonly' => true, + 'data-placeholder' => ' ' + ]); + ?> </div> - </div> + </div> - <!-- Sous-traitance sur le traitement --> - <div class="col-md-12"> + <div class="row"> + <!-- Colonne de gauche --> + <div class="col-md-6"> + <!-- Sous-traitance sur le traitement --> <span class='labelFormulaire'> <?php echo __d('fiche', 'fiche.textInfoSousTraitance'); ?> </span> - <div class="row row35"></div> - </div> - <div class="row"> - <!-- Colonne de gauche --> - <div class="col-md-6"> - <?php - echo $this->WebcilForm->input('Fiche.soustraitance', [ - 'type' => 'text', - 'required' => true, - 'placeholder' => false, - 'readonly' => true - ]); - ?> - </div> + <?php + echo $this->WebcilForm->input('Fiche.soustraitance', [ + 'options' => [ + true => 'Oui', + false => 'Non' + ], + 'default' => false, + 'class' => 'transformSelect form-control', + 'placeholder' => false, + 'required' => true, + 'readonly' => true, + 'data-placeholder' => ' ' + ]); + ?> </div> </div> </div> diff --git a/app/View/Users/edit.ctp b/app/View/Users/edit.ctp index 22ce60d7f10eead94a3787159dabc9c5eb08ca7b..bf1b81407fed5671e5b05b54cc1d46ba69f89126 100755 --- a/app/View/Users/edit.ctp +++ b/app/View/Users/edit.ctp @@ -277,27 +277,30 @@ echo $this->element('modalpassword'); <?php $selected = (array)Hash::get($this->request->data, 'User.organisation_id');?> <?php foreach(array_keys($options['organisation_id']) as $organisation_id): ?> - $("#<?php echo 'service_id'.$organisation_id;?>").select2({ - language: "fr", - placeholder: "Sélectionnez un ou plusieurs service", - allowClear: true - }); + $("#<?php echo 'service_id'.$organisation_id;?>").select2({ + language: "fr", + placeholder: "Sélectionnez un ou plusieurs service", + allowClear: true + }); - <?php if(false === in_array($organisation_id, $selected)):?> - $("#organisation-block-<?php echo $organisation_id;?>").hide(); - <?php endif;?> + <?php if(false === in_array($organisation_id, $selected)):?> + $("#organisation-block-<?php echo $organisation_id;?>").hide(); + $("#organisation-block-<?php echo $organisation_id;?>").attr('disabled', true); + <?php endif;?> <?php endforeach;?> $('#deroulant').change(function(event) { - var select = $(this), + let select = $(this), values = $.map($(select).children('option'),function(option){return option.value;}), selected = $(select).val(); $.each(values, function(index, value){ if(-1 !== $.inArray(value, selected)) { $("#organisation-block-"+value).show(); + $("#organisation-block-"+value).attr('disabled', false); } else { $("#organisation-block-"+value).hide(); + $("#organisation-block-"+value).attr('disabled', true); } }); }); diff --git a/app/webroot/js/package-lock.json b/app/webroot/js/package-lock.json index 34b2f3e3c08d0f2ada6f0bd8c326745d7a988033..b2d49fc9b2b958a249bc071562ceb28e121a3e8c 100644 --- a/app/webroot/js/package-lock.json +++ b/app/webroot/js/package-lock.json @@ -1,6 +1,6 @@ { "name": "webdpo", - "version": "2.1.0", + "version": "2.1.4", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -86,9 +86,9 @@ } }, "@popperjs/core": { - "version": "2.11.2", - "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.2.tgz", - "integrity": "sha512-92FRmppjjqz29VMJ2dn+xdyXZBrMlE42AV6Kq6BwjWV7CNUW1hs2FtxSNLQE+gJhaZ6AAmYuO9y8dshhcBl7vA==" + "version": "2.11.5", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.5.tgz", + "integrity": "sha512-9X2obfABZuDVLCgPK9aX0a/x4jaOEweTTWE2+9sr0Qqqevj2Uv5XorvusThmc9XGYpS9yI+fhh8RTafBtGposw==" }, "bootstrap": { "version": "4.6.1", @@ -119,9 +119,9 @@ } }, "jquery-ui-dist": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/jquery-ui-dist/-/jquery-ui-dist-1.13.0.tgz", - "integrity": "sha512-fgpGOW098swRvTLglH3RLyAjW/8Ecxd35fO7Z1WtBidhZgnPDvTJzZ+XFybAFzv3zZiEESI8TkK6oYXbzu/rKw==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/jquery-ui-dist/-/jquery-ui-dist-1.13.1.tgz", + "integrity": "sha512-Y711Pu4BRVrAlL58KSxX4ail74jaCJZaZcdNDLava+MgZeNwmVWmyYiK7KxyoJu1MB73eSunjJvYDbOuNrOA7w==", "requires": { "jquery": ">=1.8.0 <4.0.0" } @@ -137,9 +137,9 @@ "integrity": "sha512-1JeB87s6oN/TDxQQYCvS5EFoQyvV6eYMZZ0AeA4tdFDYWN3BAGZ8npr17UBFddU0lgAt3H0yjX3X6/ekOj1yjw==" }, "tinymce": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/tinymce/-/tinymce-5.10.2.tgz", - "integrity": "sha512-5QhnZ6c8F28fYucLLc00MM37fZoAZ4g7QCYzwIl38i5TwJR5xGqzOv6YMideyLM4tytCzLCRwJoQen2LI66p5A==" + "version": "5.10.4", + "resolved": "https://registry.npmjs.org/tinymce/-/tinymce-5.10.4.tgz", + "integrity": "sha512-L0ivAhGu7bEo6cUBrCzhtKlkIQqG2sTcL+uu7soMSxrECQIC5VwUnzp9HCEf+fRl36q6zavLV48lf8jelj+gXA==" }, "tinymce-i18n": { "version": "20.12.25", diff --git a/app/webroot/js/package.json b/app/webroot/js/package.json index b1c73ef39051cff4ee3f6383030d32212ee39dbc..255c267d813f8eb5c39e8b6a2b877351895d3170 100644 --- a/app/webroot/js/package.json +++ b/app/webroot/js/package.json @@ -1,6 +1,6 @@ { "name": "webdpo", - "version": "2.1.3", + "version": "2.1.4", "description": "Gestion de vos traitements dans le cadre de la réglementation relative à la protection des données personnelles (RGPD)", "authors": [ "Théo GUILLON <theo.guillon@libriciel.coop>" @@ -10,15 +10,15 @@ "dependencies": { "@libriciel/ls-bootstrap-4": "0.0.187552", "@libriciel/ls-composants": "10.5.0", - "@popperjs/core": "^2.11.2", + "@popperjs/core": "^2.11.5", "bootstrap": "^4.6.1", "components-font-awesome": "^5.9.0", "jquery": "^3.5.1", "jquery-mask-plugin": "^1.14.16", "jquery-ui": "^1.13.1", - "jquery-ui-dist": "^1.13.0", + "jquery-ui-dist": "^1.13.1", "select2": "^4.0.13", - "tinymce": "^5.10.2", + "tinymce": "^5.10.4", "tinymce-i18n": "^20.4.4" } } diff --git a/composer.json b/composer.json index 1238a9647555c128270eda594fd7dffe8e5f80d7..587df94f6441fd3448a123d9a00abafc22ae0bd7 100755 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "web-dpo/web-dpo", "description": "Gestion de vos traitements dans le cadre de la réglementation relative à la protection des données personnelles (RGPD)", - "version": "2.1.3", + "version": "2.1.4", "authors": [ { "name": "Théo GUILLON", @@ -20,12 +20,15 @@ "homepage": "https://www.libriciel.fr/web-dpo/", "license": "AGPL v3", "config": { - "php": "7.2", + "php": "7.4", "bin-dir": "vendors/bin", "vendor-dir" : "vendors/", - "gitlab-domains": [ - "gitlab.libriciel.fr" - ] + "gitlab-domains": [ + "gitlab.libriciel.fr" + ], + "allow-plugins": { + "composer/installers": true + } }, "repositories": [ { diff --git a/docker-compose.yml b/docker-compose.yml index 4b8ca5e5b71f7f7b084119ee3bf481d1af3d2b4e..98fe7f43b3d0068d80f878a1dd32949bbfd152f8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -51,6 +51,7 @@ services: - ./VERSION.txt:/var/www/html/web-dpo/VERSION.txt - tmp-volume:/var/www/html/web-dpo/app/tmp - ./app/tmp/out:/var/www/html/web-dpo/app/tmp/out + - ./vendors:/var/www/html/web-dpo/vendors web-dpo-cloudooo: container_name: web-dpo-cloudooo