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
33e0d9ca
Commit
33e0d9ca
authored
Mar 09, 2020
by
tguillon
Browse files
Correction : visualisation d'un formulaire en nouvelle et ancienne version
parent
31d9d56c
Changes
7
Hide whitespace changes
Inline
Side-by-side
app/Controller/FormulairesController.php
View file @
33e0d9ca
...
...
@@ -594,6 +594,7 @@ class FormulairesController extends AppController {
* Ajoute les valeurs par défault défini dans le formulaire
*
* @param int $formulaire_id ID du formulaire utilisé
* @param bool $formulaireOLD TRUE si le formulaire vien d'une version antérieur à la v1.2.0
*
* @access private
*
...
...
@@ -601,7 +602,7 @@ class FormulairesController extends AppController {
* @version V1.2.0
* @author Théo GUILLON <theo.guillon@libriciel.coop>
*/
private
function
getFields
(
$formulaire_id
)
private
function
getFields
(
$formulaire_id
,
$formulaireOLD
=
false
)
{
$formulaireFields
=
$this
->
Champ
->
find
(
'all'
,
[
'conditions'
=>
[
...
...
@@ -621,41 +622,46 @@ class FormulairesController extends AppController {
]
]);
$coresponsableFields
=
$this
->
Champ
->
find
(
'all'
,
[
'conditions'
=>
[
'formulaire_id'
=>
$formulaire_id
,
'champ_coresponsable'
=>
true
,
'champ_soustraitant'
=>
false
,
],
'fields'
=>
[
'type'
,
'ligne'
,
'colonne'
,
'details'
],
'order'
=>
[
'colonne ASC'
,
'ligne ASC'
]
]);
if
(
$formulaireOLD
===
false
)
{
$coresponsableFields
=
$this
->
Champ
->
find
(
'all'
,
[
'conditions'
=>
[
'formulaire_id'
=>
$formulaire_id
,
'champ_coresponsable'
=>
true
,
'champ_soustraitant'
=>
false
,
],
'fields'
=>
[
'type'
,
'ligne'
,
'colonne'
,
'details'
],
'order'
=>
[
'colonne ASC'
,
'ligne ASC'
]
]);
$soustraitantFields
=
$this
->
Champ
->
find
(
'all'
,
[
'conditions'
=>
[
'formulaire_id'
=>
$formulaire_id
,
'champ_coresponsable'
=>
false
,
'champ_soustraitant'
=>
true
,
],
'fields'
=>
[
'type'
,
'ligne'
,
'colonne'
,
'details'
],
'order'
=>
[
'colonne ASC'
,
'ligne ASC'
]
]);
$soustraitantFields
=
$this
->
Champ
->
find
(
'all'
,
[
'conditions'
=>
[
'formulaire_id'
=>
$formulaire_id
,
'champ_coresponsable'
=>
false
,
'champ_soustraitant'
=>
true
,
],
'fields'
=>
[
'type'
,
'ligne'
,
'colonne'
,
'details'
],
'order'
=>
[
'colonne ASC'
,
'ligne ASC'
]
]);
}
else
{
$coresponsableFields
=
[];
$soustraitantFields
=
[];
}
$fields
=
[
'formulaire'
=>
$formulaireFields
,
...
...
@@ -664,27 +670,31 @@ class FormulairesController extends AppController {
];
if
(
empty
(
$this
->
request
->
data
))
{
$this
->
request
->
data
=
$this
->
Formulaire
->
find
(
'first'
,
[
'conditions'
=>
[
'id'
=>
$formulaire_id
],
'fields'
=>
[
'usesousfinalite'
,
'usebaselegale'
,
'usedecisionautomatisee'
,
'usetransferthorsue'
,
'usedonneessensible'
,
'useallextensionfiles'
]
]);
if
(
$formulaireOLD
===
false
)
{
$this
->
request
->
data
=
$this
->
Formulaire
->
find
(
'first'
,
[
'conditions'
=>
[
'id'
=>
$formulaire_id
],
'fields'
=>
[
'usesousfinalite'
,
'usebaselegale'
,
'usedecisionautomatisee'
,
'usetransferthorsue'
,
'usedonneessensible'
,
'useallextensionfiles'
]
]);
}
foreach
(
$fields
as
$field
)
{
$details
=
Hash
::
extract
(
$field
,
'{n}.Champ.details'
);
foreach
(
$details
as
$detail
)
{
$detail
=
(
array
)
json_decode
(
$detail
);
if
(
!
empty
(
$detail
[
'default'
]))
{
if
(
isset
(
$detail
[
'default'
])
===
true
)
{
$this
->
request
->
data
[
'Formulaire'
][
$detail
[
'name'
]]
=
$detail
[
'default'
];
}
else
{
$this
->
request
->
data
[
'Formulaire'
][
'default'
]
=
null
;
}
}
}
...
...
@@ -715,12 +725,19 @@ class FormulairesController extends AppController {
'id'
=>
$id
],
'fields'
=>
[
'libelle'
'libelle'
,
'oldformulaire'
,
'soustraitant'
]
]);
$this
->
set
(
'title'
,
__d
(
'formulaire'
,
'formulaire.titreShowFormulaire'
)
.
$formulaire
[
'Formulaire'
][
'libelle'
]);
$this
->
getFields
(
$id
);
$formulaireOLD
=
$formulaire
[
'Formulaire'
][
'oldformulaire'
];
$soustraitantOLD
=
$formulaire
[
'Formulaire'
][
'soustraitant'
];
$this
->
getFields
(
$id
,
$formulaireOLD
);
$this
->
set
(
compact
(
'formulaireOLD'
,
'soustraitantOLD'
));
}
}
app/View/Elements/Formulaires/champDuFormulaire.ctp
View file @
33e0d9ca
...
...
@@ -3,6 +3,10 @@ $calendrier = [];
foreach
(
$champs
as
$key
=>
$value
)
{
$details
=
json_decode
(
$value
[
'Champ'
][
'details'
],
true
);
if
(
isset
(
$details
[
'default'
])
===
false
)
{
$details
[
'default'
]
=
null
;
}
// Possitionnement du champ sur la ligne
$line
=
35
*
(
$value
[
'Champ'
][
'ligne'
]
-
1
);
...
...
app/View/Elements/Formulaires/oldOnglets/ongletShowSoustraitance.ctp
View file @
33e0d9ca
<!-- Onglet soustraitance -->
<?php
if
(
$
formulaire
[
'Formulaire'
][
'
soustraitant
'
]
===
true
)
{
if
(
$soustraitant
OLD
===
true
)
{
?>
<div
id=
"soustraitant"
class=
"tab-pane"
>
<?php
...
...
@@ -15,11 +15,11 @@ if ($formulaire['Formulaire']['soustraitant'] === true) {
<!-- Information sur le rédacteur -->
<div
class=
"col-md-12"
>
<span
class=
'labelFormulaire'
>
<?php
echo
__d
(
'fiche'
,
'fiche.textInfoSoustraitant'
);
?>
</span>
<span
class=
'labelFormulaire'
>
<?php
echo
__d
(
'fiche'
,
'fiche.textInfoSoustraitant'
);
?>
</span>
<div
class=
"row row35"
></div>
</div>
...
...
app/View/Elements/Formulaires/tabs/informationComplementaire.ctp
View file @
33e0d9ca
...
...
@@ -7,7 +7,7 @@ if ($this->request->params['action'] == 'add'){
?>
<!-- Onglet Information complémentaire -->
<div
id=
"info_complementaire"
class=
"tab-pane
active
"
>
<div
id=
"info_complementaire"
class=
"tab-pane"
>
<br>
<!-- Information concernant la sous-finalité -->
...
...
app/View/Elements/Formulaires/tabs/informationGenerale.ctp
View file @
33e0d9ca
<!-- Onglet Information concernant le traitement -->
<div
id=
"information_traitement"
class=
"tab-pane"
>
<?php
// echo $this->WebcilForm->create('informationGenerale', [
// 'autocomplete' => 'off',
// 'inputDefaults' => ['div' => false],
// 'class' => 'form-horizontal',
// 'novalidate' => 'novalidate'
// ]);
?>
<div id="information_traitement" class="tab-pane active">
<br/>
<!-- Information sur le rédacteur -->
...
...
@@ -191,8 +183,4 @@
</div>
</div>
</div>
<?php
//echo $this->WebcilForm->end();
?>
<!-- Fin onglet Information concernant le traitement-->
\ No newline at end of file
app/View/Formulaires/edit.ctp
View file @
33e0d9ca
...
...
@@ -47,7 +47,7 @@ echo $this->WebcilForm->create('Formulaire', [
<div
id=
"tabs"
class=
"container-fluid"
role=
"main"
>
<ul
class=
"nav nav-tabs nav-justified"
role=
"tablist"
>
<li>
<li
class=
"active"
>
<a
href=
"#information_traitement"
role=
"tab"
data-toggle=
"tab"
>
<i
class=
"fa fa-eye fa-fw"
>
<!---->
</i>
<?php
...
...
@@ -56,7 +56,7 @@ echo $this->WebcilForm->create('Formulaire', [
</a>
</li>
<li
id=
"onglet_info_complementaire"
class=
"active"
>
<li
id=
"onglet_info_complementaire"
>
<a
href=
"#info_complementaire"
role=
"tab"
data-toggle=
"tab"
>
<i
class=
"fa fa-pencil fa-fw"
></i>
<?php
...
...
app/View/Formulaires/show.ctp
View file @
33e0d9ca
...
...
@@ -9,7 +9,7 @@ echo $this->WebcilForm->create('Formulaire', [
<div
id=
"tabs"
class=
"container-fluid"
role=
"main"
>
<ul
class=
"nav nav-tabs nav-justified"
role=
"tablist"
>
<li>
<li
class=
"active"
>
<a
href=
"#information_traitement"
role=
"tab"
data-toggle=
"tab"
>
<i
class=
"fa fa-eye fa-fw"
>
<!---->
</i>
<?php
...
...
@@ -18,14 +18,20 @@ echo $this->WebcilForm->create('Formulaire', [
</a>
</li>
<li
class=
"active"
>
<a
href=
"#info_complementaire"
role=
"tab"
data-toggle=
"tab"
>
<i
class=
"fa fa-eye fa-fw"
></i>
<?php
echo
__d
(
'fiche'
,
'fiche.ongletInformationComplementaire'
);
?>
</a>
</li>
<?php
if
(
$formulaireOLD
===
false
)
{
?>
<li>
<a
href=
"#info_complementaire"
role=
"tab"
data-toggle=
"tab"
>
<i
class=
"fa fa-eye fa-fw"
></i>
<?php
echo
__d
(
'fiche'
,
'fiche.ongletInformationComplementaire'
);
?>
</a>
</li>
<?php
}
?>
<li>
<a
href=
"#info_formulaire"
role=
"tab"
data-toggle=
"tab"
>
...
...
@@ -36,23 +42,61 @@ echo $this->WebcilForm->create('Formulaire', [
</a>
</li>
<li>
<a
href=
"#ongletComplementaireCoresponsable"
role=
"tab"
data-toggle=
"tab"
>
<i
class=
"fa fa-eye fa-fw"
>
<!---->
</i>
<?php
echo
__d
(
'fiche'
,
'fiche.ongletCoresponsable'
);
?>
</a>
</li>
<!-- Co-responsable -->
<?php
if
(
$formulaireOLD
===
true
)
{
?>
<li>
<a
href=
"#ongletCoresponsable"
role=
"tab"
data-toggle=
"tab"
>
<i
class=
"fa fa-eye fa-fw"
>
<!---->
</i>
<?php
echo
__d
(
'fiche'
,
'fiche.ongletCoresponsable'
);
?>
</a>
</li>
<?php
}
else
{
?>
<li>
<a
href=
"#ongletComplementaireCoresponsable"
role=
"tab"
data-toggle=
"tab"
>
<i
class=
"fa fa-eye fa-fw"
>
<!---->
</i>
<?php
echo
__d
(
'fiche'
,
'fiche.ongletCoresponsable'
);
?>
</a>
</li>
<?php
}
?>
<li>
<a
href=
"#ongletComplementaireSousTraitant"
role=
"tab"
data-toggle=
"tab"
>
<i
class=
"fa fa-eye fa-fw"
>
<!---->
</i>
<?php
echo
__d
(
'fiche'
,
'fiche.ongletSousTraitant'
);
<!-- Sous-traitance -->
<?php
if
(
$formulaireOLD
===
true
)
{
if
(
$soustraitantOLD
===
true
)
{
?>
</a>
</li>
<li>
<a
href=
"#soustraitant"
role=
"tab"
data-toggle=
"tab"
>
<i
class=
"fa fa-eye fa-fw"
>
<!---->
</i>
<?php
echo
__d
(
'fiche'
,
'fiche.ongletSousTraitant'
);
?>
</a>
</li>
<?php
}
}
else
{
?>
<li>
<a
href=
"#ongletComplementaireSousTraitant"
role=
"tab"
data-toggle=
"tab"
>
<i
class=
"fa fa-eye fa-fw"
>
<!---->
</i>
<?php
echo
__d
(
'fiche'
,
'fiche.ongletSousTraitant'
);
?>
</a>
</li>
<?php
}
?>
<li>
<a
href=
"#annexe"
role=
"tab"
data-toggle=
"tab"
>
...
...
@@ -70,7 +114,9 @@ echo $this->WebcilForm->create('Formulaire', [
echo
$this
->
element
(
'Formulaires/tabs/informationGenerale'
);
// Fin de l'onglet Information générale concernant le traitement
echo
$this
->
element
(
'Formulaires/tabs/informationComplementaire'
);
if
(
$formulaireOLD
===
false
)
{
echo
$this
->
element
(
'Formulaires/tabs/informationComplementaire'
);
}
?>
<div
id=
"info_formulaire"
class=
"tab-pane"
>
...
...
@@ -84,32 +130,58 @@ echo $this->WebcilForm->create('Formulaire', [
</div>
</div>
<div
id=
"ongletComplementaireCoresponsable"
class=
"tab-pane"
>
<br/>
<div
id=
"form-container-coresponsable"
class=
"form-container col-md-12"
>
<?php
echo
$this
->
element
(
'Formulaires/champDuFormulaire'
,
[
'champs'
=>
$fields
[
'coresponsable'
]
]);
?>
<?php
// Co-responsable
if
(
$formulaireOLD
===
true
)
{
// Onglet OLD Co-responsable
echo
$this
->
element
(
'Formulaires/oldOnglets/ongletShowCoresponsable'
);
// Fin onglet OLD Co-responsable
}
else
{
?>
<div
id=
"ongletComplementaireCoresponsable"
class=
"tab-pane"
>
<br/>
<div
id=
"form-container-coresponsable"
class=
"form-container col-md-12"
>
<?php
echo
$this
->
element
(
'Formulaires/champDuFormulaire'
,
[
'champs'
=>
$fields
[
'coresponsable'
]
]);
?>
</div>
</div>
</div>
<?php
}
<div
id=
"ongletComplementaireSousTraitant"
class=
"tab-pane"
>
<br/>
<div
id=
"form-container-soustraitant"
class=
"form-container col-md-12"
>
<?php
echo
$this
->
element
(
'Formulaires/champDuFormulaire'
,
[
'champs'
=>
$fields
[
'soustraitant'
]
]);
?>
// Sous-traitance
if
(
$formulaireOLD
===
true
)
{
if
(
$soustraitantOLD
===
true
)
{
// Onglet OLD soustraitance
echo
$this
->
element
(
'Formulaires/oldOnglets/ongletShowSoustraitance'
);
// Fin onglet OLD soustraitance
}
}
else
{
?>
<div
id=
"ongletComplementaireSousTraitant"
class=
"tab-pane"
>
<br/>
<div
id=
"form-container-soustraitant"
class=
"form-container col-md-12"
>
<?php
echo
$this
->
element
(
'Formulaires/champDuFormulaire'
,
[
'champs'
=>
$fields
[
'soustraitant'
]
]);
?>
</div>
</div>
</div>
<?php
}
<?php
// Onglet Annexe
echo
$this
->
element
(
'Formulaires/tabs/annexe'
);
// Fin onglet annexe
if
(
$formulaireOLD
===
true
)
{
// Onglet OLD Annexe
echo
$this
->
element
(
'Formulaires/oldOnglets/ongletShowAnnexe'
);
// Fin onglet OLD annexe
}
else
{
// Onglet Annexe
echo
$this
->
element
(
'Formulaires/tabs/annexe'
);
// Fin onglet annexe
}
?>
</div>
...
...
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