Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Libriciel
web-DPO
Commits
33296dc0
Commit
33296dc0
authored
Dec 16, 2019
by
tguillon
Browse files
Ajout : Mise en place de la duplication d'un traitement au sein de une ou plusieurs collectivités.
parent
0bb1b87e
Changes
7
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
33296dc0
...
...
@@ -24,6 +24,7 @@ Le format est basé sur le modèle [Keep a Changelog](http://keepachangelog.com/
-
Mise en place de nouveau droits en rapport avec le FAQ.
-
Mise en place de l'initialisation d'un traitement par le DPO
-
Ajout pour le DPO de visualiser tous les traitements au sein de sa collectivité.
-
Mise en place de la duplication d'un traitement dans une ou plusieurs collectivité(s) en tant que DPO.
### Evolutions
-
Affichage de l'onglet "Information de l'entité" lors de la visualisation d'un traitement au registre
...
...
app/Controller/FichesController.php
View file @
33296dc0
...
...
@@ -1588,4 +1588,115 @@ class FichesController extends AppController
exit
();
}
/**
* Dupliquer un traitement dans une ou plisieurs entité en tant que DPO
* dans une entité ou on a les droits.
*
* @access public
* @created 13/12/2019
* @version V1.2.0
* @author Théo GUILLON <theo.guillon@libriciel.coop>
*/
public
function
dupliquerTraitementInOrganisations
()
{
if
(
true
!==
$this
->
Droits
->
authorized
(
$this
->
Droits
->
isDpo
()))
{
throw
new
ForbiddenException
(
__d
(
'default'
,
'default.flasherrorPasDroitPage'
));
}
if
(
$this
->
request
->
is
(
'post'
)
||
$this
->
request
->
is
(
'put'
))
{
$success
=
true
;
$this
->
Fiche
->
begin
();
$fiche_id
=
$this
->
request
->
data
[
'Fiche'
][
'fiche_id'
];
$user_id
=
$this
->
Auth
->
user
(
'id'
);
$fiche
=
$this
->
Fiche
->
find
(
'first'
,
[
'conditions'
=>
[
'id'
=>
$fiche_id
]
]);
$champs
=
$this
->
Valeur
->
find
(
'all'
,
[
'conditions'
=>
[
'fiche_id'
=>
$fiche_id
]
]);
foreach
(
$this
->
request
->
data
[
'Fiche'
][
'organisations'
]
as
$organisation_id
)
{
if
(
$success
===
true
)
{
if
(
$fiche
[
'Fiche'
][
'coresponsable'
]
===
false
)
{
$fiche
[
'Fiche'
][
'coresponsable'
]
=
'0'
;
}
else
{
$fiche
[
'Fiche'
][
'coresponsable'
]
=
'1'
;
}
$this
->
Fiche
->
create
([
'Fiche'
=>
[
'user_id'
=>
$user_id
,
'form_id'
=>
$fiche
[
'Fiche'
][
'form_id'
],
'organisation_id'
=>
$organisation_id
,
'norme_id'
=>
$fiche
[
'Fiche'
][
'norme_id'
],
'numero'
=>
$fiche
[
'Fiche'
][
'numero'
],
'soustraitantid'
=>
$fiche
[
'Fiche'
][
'soustraitantid'
],
'coresponsable'
=>
$fiche
[
'Fiche'
][
'coresponsable'
],
'coresponsableid'
=>
$fiche
[
'Fiche'
][
'coresponsableid'
]
]
]);
$success
=
$success
&&
false
!==
$this
->
Fiche
->
save
(
null
,
[
'atomic'
=>
false
]);
if
(
$success
===
true
)
{
$idNewFiche
=
$this
->
Fiche
->
getLastInsertId
();
foreach
(
$champs
as
$champ
)
{
if
(
$success
===
true
)
{
$this
->
Valeur
->
create
([
'Valeur'
=>
[
'fiche_id'
=>
$idNewFiche
,
'valeur'
=>
$champ
[
'Valeur'
][
'valeur'
],
'champ_name'
=>
$champ
[
'Valeur'
][
'champ_name'
]
]
]);
$success
=
$success
&&
false
!==
$this
->
Valeur
->
save
(
null
,
[
'atomic'
=>
false
]);
}
}
if
(
$success
===
true
)
{
$commentaireHistorique
=
__d
(
'historique'
,
'historique.initialisationTraitement'
);
$this
->
Historique
->
create
([
'Historique'
=>
[
'content'
=>
$commentaireHistorique
.
' '
.
$this
->
Auth
->
user
(
'prenom'
)
.
' '
.
$this
->
Auth
->
user
(
'nom'
),
'fiche_id'
=>
$idNewFiche
]
]);
$success
=
$success
&&
false
!==
$this
->
Historique
->
save
(
null
,
[
'atomic'
=>
false
]);
if
(
$success
===
true
)
{
$this
->
EtatFiche
->
create
([
'EtatFiche'
=>
[
'fiche_id'
=>
$idNewFiche
,
'etat_id'
=>
EtatFiche
::
INITIALISATION_TRAITEMENT
,
'previous_user_id'
=>
$user_id
,
'user_id'
=>
$user_id
]
]);
$success
=
$success
&&
false
!==
$this
->
EtatFiche
->
save
(
null
,
[
'atomic'
=>
false
]);
}
}
}
}
}
if
(
$success
===
true
)
{
$this
->
Fiche
->
commit
();
$this
->
Session
->
setFlash
(
__d
(
'formulaire'
,
'formulaire.flashsuccessFormulaireDupliquer'
),
'flashsuccess'
);
}
else
{
$this
->
Fiche
->
rollback
();
$this
->
Session
->
setFlash
(
__d
(
'default'
,
'default.flasherrorEnregistrementErreur'
),
'flasherror'
);
}
$this
->
redirect
(
$this
->
Referers
->
get
());
}
}
}
app/Controller/PannelController.php
View file @
33296dc0
...
...
@@ -903,12 +903,6 @@ class PannelController extends AppController {
$query
[
'conditions'
]
+=
$conditions
;
}
$banettes
[
'allTraitements'
]
=
[
'results'
=>
$this
->
Fiche
->
find
(
'all'
,
$query
+
[
'limit'
=>
0
]),
'count'
=>
$this
->
Fiche
->
find
(
'count'
,
$query
),
'enumsNormes'
=>
$this
->
_enumsNorme
()
];
$options
=
[
'etatTraitement'
=>
[
EtatFiche
::
ENCOURS_REDACTION
=>
__d
(
'pannel'
,
'pannel.textEtatEnCoursRedaction'
),
...
...
@@ -922,7 +916,25 @@ class PannelController extends AppController {
]
];
$mesOrganisations
=
$this
->
WebcilUsers
->
organisations
(
'list'
,
[
'conditions'
=>
[
'OrganisationUser.organisation_id !='
=>
$this
->
Session
->
read
(
'Organisation.id'
)
],
'droits'
=>
'add'
===
$this
->
request
->
params
[
'action'
]
?
ListeDroit
::
INSERER_TRAITEMENT_REGISTRE
:
ListeDroit
::
MODIFIER_TRAITEMENT_REGISTRE
]
);
$banettes
[
'allTraitements'
]
=
[
'results'
=>
$this
->
Fiche
->
find
(
'all'
,
$query
+
[
'limit'
=>
0
]),
'count'
=>
$this
->
Fiche
->
find
(
'count'
,
$query
),
'enumsNormes'
=>
$this
->
_enumsNorme
(),
'duplicationOrganisation'
=>
count
(
$mesOrganisations
)
];
$this
->
set
(
compact
(
'banettes'
,
'options'
));
$this
->
set
(
compact
(
'banettes'
,
'options'
,
'mesOrganisations'
));
}
}
app/Locale/fra/LC_MESSAGES/pannel.po
View file @
33296dc0
...
...
@@ -281,6 +281,18 @@ msgstr "Filtrer en fonction de l'état du traitement"
msgid "pannel.placeholderSelectionnerEtatTraitement"
msgstr "Sélectionner un ou plusieurs état de traitement"
msgid "pannel.commentaireDupliquerTraitement"
msgstr "Dupliquer le traitement dans une autre entité"
msgid "pannel.popupDuplicationTraitementOrganisations"
msgstr "Duplication du traitement dans une ou plusieurs entitée(s)"
msgid "pannel.champDupliquerTraitementEntites"
msgstr "Sélectionner une ou plusieurs entités"
msgid "pannel.placeholderSelectionnerDupliquerTraitementEntites"
msgstr "Sélectionner une ou plusieurs entités"
###############################################################################
########################## View/Pannel/test.ctp ###########################
...
...
app/View/Helper/BanettesHelper.php
View file @
33296dc0
...
...
@@ -1144,8 +1144,6 @@ class BanettesHelper extends AppHelper {
),
[
'class'
=>
'row bottom10'
]
),
'nbUserValideur'
=>
$banette
[
'nbUserValideur'
],
'nbUserConsultant'
=>
$banette
[
'nbUserConsultant'
],
'enumsNormes'
=>
$banette
[
'enumsNormes'
]
];
...
...
@@ -1217,7 +1215,8 @@ class BanettesHelper extends AppHelper {
$params
+=
[
'action'
=>
'allTraitements'
,
'count'
=>
$banette
[
'count'
],
'enumsNormes'
=>
$banette
[
'enumsNormes'
]
'enumsNormes'
=>
$banette
[
'enumsNormes'
],
'duplicationOrganisation'
=>
$banette
[
'duplicationOrganisation'
]
];
return
$this
->
_banette
(
$banette
[
'results'
],
$params
);
...
...
@@ -1239,6 +1238,31 @@ class BanettesHelper extends AppHelper {
$fiche_id
=
Hash
::
get
(
$result
,
'Fiche.id'
);
return
$this
->
_button
(
'/fiches/show/#Fiche.id#'
,
$result
)
.
$this
->
_button
(
'/fiches/historique/#Fiche.id#'
,
$result
,
[
'onclick'
=>
"$('#listeValidation
{
$fiche_id
}
').toggle(); return false;"
]);
.
$this
->
_button
(
'/fiches/historique/#Fiche.id#'
,
$result
,
[
'onclick'
=>
"$('#listeValidation
{
$fiche_id
}
').toggle(); return false;"
])
.
$this
->
_buttonDupliquerTraitement
(
$result
,
$params
);
}
/**
* @access protected
* @created 12/12/2019
* @version V1.2.0
* @author Théo GUILLON <theo.guillon@libriciel.coop>
*/
protected
function
_buttonDupliquerTraitement
(
array
$result
,
array
$params
=
[])
{
if
(
$this
->
Autorisation
->
isDpo
()
&&
!
empty
(
$params
[
'duplicationOrganisation'
]))
{
$fiche_id
=
Hash
::
get
(
$result
,
'Fiche.id'
);
return
$this
->
Html
->
link
(
'<span class="fa fa-clipboard fa-lg"><!----></span>'
,
[
'#'
=>
'#'
],
[
'data-id'
=>
$fiche_id
,
'escape'
=>
false
,
'data-toggle'
=>
'modal'
,
'data-target'
=>
'#modalDupliquerTraitementOrganisations'
,
'class'
=>
'btn btn-default-primary btn_DuplicationTraitementOrganisations btn-sm my-tooltip'
,
'title'
=>
__d
(
'pannel'
,
'pannel.commentaireDupliquerTraitement'
)
]);
}
}
}
app/View/Pannel/all_traitements.ctp
View file @
33296dc0
...
...
@@ -81,4 +81,49 @@ $filters = $this->request->data;
$params
=
[
'limit'
=>
false
];
// Banette mes déclarations en cours d'initialisation
echo
$this
->
Banettes
->
allTraitement
(
$banettes
[
'allTraitements'
],
$params
);
\ No newline at end of file
echo
$this
->
Banettes
->
allTraitement
(
$banettes
[
'allTraitements'
],
$params
);
// Pop-up de duplication d'un traitement dans une autre entité
echo
$this
->
element
(
'modal'
,
[
'modalId'
=>
'modalDupliquerTraitementOrganisations'
,
'content'
=>
[
'title'
=>
__d
(
'pannel'
,
'pannel.popupDuplicationTraitementOrganisations'
),
'body'
=>
$this
->
Html
->
tag
(
'div'
,
$this
->
Form
->
create
(
'Fiche'
,
[
'url'
=>
[
'controller'
=>
'fiches'
,
'action'
=>
'dupliquerTraitementInOrganisations'
]
])
.
$this
->
Form
->
input
(
'organisations'
,
[
'options'
=>
$mesOrganisations
,
'class'
=>
'usersDeroulant transformSelect form-control'
,
'empty'
=>
true
,
'label'
=>
__d
(
'pannel'
,
'pannel.champDupliquerTraitementEntites'
),
'data-placeholder'
=>
__d
(
'pannel'
,
'pannel.placeholderSelectionnerDupliquerTraitementEntites'
),
'multiple'
=>
true
,
])
.
$this
->
Form
->
hidden
(
'fiche_id'
,
[
'id'
=>
'fiche_id'
]),
[
'class'
=>
'form-group'
]
),
'footer'
=>
$this
->
Html
->
tag
(
'div'
,
$this
->
Form
->
button
(
'<i class="fa fa-times-circle fa-lg"> </i>'
.
__d
(
'default'
,
'default.btnAnnuler'
),
[
'class'
=>
'btn btn-default-default'
,
'data-dismiss'
=>
'modal'
]
)
.
$this
->
Form
->
button
(
"<i class='fa fa-send fa-lg'><!----></i>"
.
__d
(
'default'
,
'default.btnEnvoyer'
),
[
'type'
=>
'submit'
,
'class'
=>
'btn btn-default-success'
,
'escape'
=>
false
]),
[
'class'
=>
'btn-group'
]
)
.
$this
->
Form
->
end
()
]
]
);
\ No newline at end of file
app/webroot/js/main.js
View file @
33296dc0
...
...
@@ -103,6 +103,11 @@ $(document).ready(function () {
$
(
'
#idUploadModele
'
).
val
(
id
);
});
$
(
'
.btn_DuplicationTraitementOrganisations
'
).
click
(
function
()
{
var
id
=
$
(
this
).
attr
(
'
data-id
'
);
$
(
'
#fiche_id
'
).
val
(
id
);
});
// Défauts pour le plugin jQuery filestyle
$
.
fn
.
filestyle
.
defaults
[
'
buttonText
'
]
=
'
Parcourir
'
;
$
.
fn
.
filestyle
.
defaults
[
'
iconName
'
]
=
'
fa fa-folder-open fa-lg
'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment