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
9877fe06
Commit
9877fe06
authored
May 28, 2020
by
THEO GUILLON
Browse files
Merge branch '338-typage-des-annexes' into '1.2.0'
Resolve "Typage des annexes" See merge request libriciel/pole-citoyens/web-DPO/web-DPO!314
parents
664c549a
d04eccc9
Changes
15
Hide whitespace changes
Inline
Side-by-side
app/Controller/ArticlesController.php
View file @
9877fe06
...
...
@@ -111,9 +111,6 @@ class ArticlesController extends AppController {
// Filtre sur l'entité à l'origine de l'article
if
(
!
empty
(
$this
->
request
->
data
[
'Filtre'
][
'createdbyorganisation_id'
]))
{
debug
(
$condition
);
$condition
=
[
'Organisation.id'
=>
$this
->
request
->
data
[
'Filtre'
][
'createdbyorganisation_id'
]
];
...
...
app/Controller/FichesController.php
View file @
9877fe06
...
...
@@ -131,7 +131,7 @@ class FichesController extends AppController
$selectType
=
''
;
if
(
!
empty
(
$typages
))
{
$selectType
=
'<div class="form-group"><label for="typage_'
.
$last_key_file
.
'" class="col-md-4 control-label"></label><div class="col-md-8"><select name="data[Fichier][typage_'
.
$last_key_file
.
']" id="typage_'
.
$last_key_file
.
'" class="form-control">'
$selectType
=
'<div class="form-group"><label for="typage_
tmp_
'
.
$last_key_file
.
'" class="col-md-4 control-label"></label><div class="col-md-8"><select name="data[Fichier][typage_
tmp_
'
.
$last_key_file
.
']" id="typage_
tmp_
'
.
$last_key_file
.
'" class="form-control">'
.
'<option value="">Séléctionnez un type pour le fichier</option>'
;
foreach
(
$typages
as
$val
=>
$typage
)
{
$selectType
=
$selectType
.
'<option value="'
.
$val
.
'">'
.
$typage
.
'</option>'
;
...
...
@@ -638,6 +638,9 @@ class FichesController extends AppController
$this
->
redirect
(
$this
->
Referers
->
get
());
}
// debug($this->request->data);
// die;
$success
=
true
;
$this
->
Fiche
->
begin
();
...
...
@@ -698,6 +701,77 @@ class FichesController extends AppController
$success
=
$this
->
WebdpoFiche
->
saveWithVirtualFields
(
$data
,
$formulaireFields
,
$formulaireOptions
,
$formulaireOLD
[
'Formulaire'
][
'oldformulaire'
]);
if
(
$success
==
true
)
{
$etatTraitement
=
$this
->
EtatFiche
->
find
(
'first'
,
[
'conditions'
=>
[
'fiche_id'
=>
$id
,
'actif'
=>
true
],
'fields'
=>
[
'etat_id'
]
]);
if
(
$etatTraitement
[
'EtatFiche'
][
'etat_id'
]
===
EtatFiche
::
MODIFICATION_TRAITEMENT_REGISTRE
)
{
$texteHistorique
=
__d
(
'historique'
,
'historique.modifierTraitementRegistre'
);
}
else
{
$texteHistorique
=
__d
(
'historique'
,
'historique.modifierTraitement'
);
}
$this
->
Historique
->
create
([
'Historique'
=>
[
'content'
=>
$this
->
Auth
->
user
(
'nom_complet'
)
.
' '
.
$texteHistorique
,
'fiche_id'
=>
$id
]
]);
$success
=
false
!==
$this
->
Historique
->
save
(
null
,
[
'atomic'
=>
false
])
&&
$success
;
if
(
isset
(
$this
->
request
->
data
[
'delfiles'
])
&&
!
empty
(
$this
->
request
->
data
[
'delfiles'
]))
{
debug
(
"lalal"
);
die
;
foreach
(
array_unique
(
$this
->
request
->
data
[
'delfiles'
])
as
$val
)
{
$success
=
$success
&&
$this
->
Fichier
->
deleteFichier
(
$val
);
}
}
if
(
!
empty
(
$this
->
Session
->
read
(
'Auth.User.uuid'
)))
{
if
(
$success
==
true
)
{
$useAllExtensionFiles
=
$this
->
Formulaire
->
find
(
'first'
,
[
'condititons'
=>
[
'id'
=>
$form_id
[
'Fiche'
][
'form_id'
]
],
'fields'
=>
[
'useallextensionfiles'
]
]);
$success
=
$success
&&
false
!==
$this
->
Fichier
->
transfereSave
(
$id
,
$useAllExtensionFiles
[
'Formulaire'
][
'useallextensionfiles'
],
$this
->
Session
->
read
(
'Auth.User.uuid'
),
$this
->
Session
->
read
(
'Auth.User.id'
),
$data
[
'Fichier'
]
);
}
}
$filesBDD
=
$this
->
Fichier
->
find
(
'all'
,
[
'conditions'
=>
[
'fiche_id'
=>
$id
]
]);
if
(
!
empty
(
$filesBDD
))
{
foreach
(
$filesBDD
as
$key
=>
$file
)
{
if
(
isset
(
$data
[
'Fichier'
][
'typage_'
.
$key
])
&&
!
empty
(
$data
[
'Fichier'
][
'typage_'
.
$key
])
&&
$success
===
true
)
{
if
(
$file
[
'Fichier'
][
'typage_id'
]
!==
$data
[
'Fichier'
][
'typage_'
.
$key
])
{
$file
[
'Fichier'
][
'typage_id'
]
=
$data
[
'Fichier'
][
'typage_'
.
$key
];
$success
=
$success
&&
$this
->
Fichier
->
save
(
$file
,
[
'atomic'
=>
false
]);
}
}
}
}
}
if
(
$success
==
true
&&
empty
(
$this
->
Fiche
->
validationErrors
)
&&
empty
(
$this
->
WebdpoFiche
->
validationErrors
)
&&
...
...
@@ -857,6 +931,7 @@ class FichesController extends AppController
// On récupère les fichiers en annexe
$this
->
getFilesSave
(
$id
);
$typages
=
$this
->
_typages
();
$formulaireOLD
=
$this
->
Formulaire
->
find
(
'first'
,
[
'conditions'
=>
[
...
...
@@ -906,7 +981,7 @@ class FichesController extends AppController
$this
->
_soustraitances
(
$id
);
$this
->
set
(
'formulaire_id'
,
$fiche
[
'Fiche'
][
'form_id'
]);
//@TODO
$this
->
set
(
compact
(
'showRegistre'
,
'formulaireOLD'
));
$this
->
set
(
compact
(
'showRegistre'
,
'formulaireOLD'
,
'typages'
));
}
/**
...
...
@@ -1999,6 +2074,14 @@ class FichesController extends AppController
]
]);
if
(
!
empty
(
$filesSave
))
{
$typageFiles
=
Hash
::
extract
(
$filesSave
,
'{n}.Fichier.typage_id'
);
foreach
(
$typageFiles
as
$key
=>
$typageFile
)
{
$this
->
request
->
data
[
'Fichier'
][
'typage_'
.
$key
]
=
$typageFile
;
}
}
$this
->
set
(
compact
(
'filesSave'
));
}
...
...
app/Controller/TypagesController.php
View file @
9877fe06
...
...
@@ -26,8 +26,7 @@ class TypagesController extends AppController {
public
$uses
=
[
'Typage'
,
'TypageOrganisation'
,
'Organisation'
'TypageOrganisation'
];
/**
...
...
@@ -49,6 +48,7 @@ class TypagesController extends AppController {
$query
=
[
'contain'
=>
[
'Organisation'
=>
[
'id'
,
'raisonsociale'
,
'order'
=>
[
'raisonsociale'
]
]
...
...
@@ -65,13 +65,13 @@ class TypagesController extends AppController {
}
$success
=
true
;
$this
->
TypageOrganisation
->
begin
();
$this
->
Typage
->
TypageOrganisation
->
begin
();
$organisations_ids
=
Hash
::
extract
(
$this
->
request
->
data
,
'TypageOrganisation.organisation_id'
);
$typage_ids
=
Hash
::
extract
(
$this
->
request
->
data
,
'TypageOrganisation.typage_id'
);
foreach
(
$organisations_ids
as
$organisation_id
)
{
$typageEntite
=
$this
->
TypageOrganisation
->
find
(
'list'
,
[
$typageEntite
=
$this
->
Typage
->
TypageOrganisation
->
find
(
'list'
,
[
'conditions'
=>
[
'organisation_id'
=>
$organisation_id
],
...
...
@@ -91,19 +91,19 @@ class TypagesController extends AppController {
]
];
$this
->
TypageOrganisation
->
create
(
$data
);
$success
=
$success
&&
false
!==
$this
->
TypageOrganisation
->
save
(
null
,
[
'atomic'
=>
false
]);
$this
->
Typage
->
TypageOrganisation
->
create
(
$data
);
$success
=
$success
&&
false
!==
$this
->
Typage
->
TypageOrganisation
->
save
(
null
,
[
'atomic'
=>
false
]);
}
}
if
(
$success
==
true
)
{
$this
->
Organisation
->
commit
();
$this
->
Session
->
setFlash
(
__d
(
'
responsable'
,
'responsabl
e.flashsuccess
SousTraitant
AffecterEnregistrer'
),
'flashsuccess'
);
$this
->
Typage
->
commit
();
$this
->
Session
->
setFlash
(
__d
(
'
typage'
,
'typag
e.flashsuccess
Typage
AffecterEnregistrer'
),
'flashsuccess'
);
$this
->
redirect
([
'action'
=>
'index'
]);
}
else
{
$this
->
Organisation
->
rollback
();
$this
->
Session
->
setFlash
(
__d
(
'
responsable'
,
'responsabl
e.flasherrorErreurEnregistrement
SousTraitant
Affecter'
),
'flasherror'
);
$this
->
Typage
->
rollback
();
$this
->
Session
->
setFlash
(
__d
(
'
typage'
,
'typag
e.flasherrorErreurEnregistrement
Typage
Affecter'
),
'flasherror'
);
}
}
...
...
@@ -121,6 +121,51 @@ class TypagesController extends AppController {
$this
->
set
(
compact
(
'typages'
,
'mesOrganisations'
));
}
/**
* @author Théo GUILLON <theo.guillon@libriciel.coop>
* @access public
* @created 28/04/2020
* @version V1.2.0
*/
public
function
entite
()
{
if
(
true
!==
$this
->
Droits
->
authorized
(
ListeDroit
::
GESTION_TYPAGE
))
{
throw
new
ForbiddenException
(
__d
(
'default'
,
'default.flasherrorPasDroitPage'
));
}
$this
->
set
(
'title'
,
__d
(
'typage'
,
'typage.titreGestionTypageEntitee'
));
$organisation_id
=
$this
->
Session
->
read
(
'Organisation.id'
);
$condition
=
[];
$query
=
[
'conditions'
=>
$condition
,
'fields'
=>
[
'Typage.id'
,
'Typage.libelle'
],
'order'
=>
[
'Typage.libelle ASC'
]
];
$subQuery
=
[
'alias'
=>
'typages_organisations'
,
'fields'
=>
[
'typages_organisations.typage_id'
],
'conditions'
=>
[
'typages_organisations.organisation_id'
=>
$organisation_id
]
];
$sql
=
$this
->
TypageOrganisation
->
sql
(
$subQuery
);
$query
[
'conditions'
][]
=
"Typage.id IN (
{
$sql
}
)"
;
$this
->
paginate
=
$query
;
$typages
=
$this
->
paginate
(
$this
->
Typage
);
$this
->
set
(
compact
(
'typages'
));
}
/**
* Fonction qui permet l'ajout d'une nouvelle norme
...
...
@@ -136,6 +181,47 @@ class TypagesController extends AppController {
{
return
$this
->
edit
();
}
/**
* Récupère et renvoie un type d'annexe en fonction de l'utilisateur connecté (SU ou utilisateur appartenant l'ayant
* créé) et vérifie que celui-ci n'est associé à aucun entité.
*
* Utilisé pour vérification avant modification ou suppression d'un type d'annexe.
*
* @throws NotFoundException
* @throws ForbiddenException
*
* @param int $id L'id du type d'annexe
* @return array
*/
protected
function
_getAndCheckTypageAccessAndUsage
(
$id
)
{
$query
=
[
'fields'
=>
array_merge
(
$this
->
Typage
->
fields
(),
[
$this
->
Typage
->
vfLinkedOrganisationsCount
()]
),
'conditions'
=>
[
'Typage.id'
=>
$id
]
];
$typage
=
$this
->
Typage
->
find
(
'first'
,
$query
);
if
(
empty
(
$typage
)
===
true
)
{
throw
new
NotFoundException
();
}
if
(
$typage
[
'Typage'
][
'organisations_count'
]
>
0
)
{
throw
new
ForbiddenException
(
__d
(
'default'
,
'default.flasherrorPasDroitPage'
));
}
// A-t-on les droits sur l'enregistrement ?
if
(
$this
->
Droits
->
isSu
()
===
false
&&
$typage
[
'Typage'
][
'createdbyorganisation'
]
!==
null
&&
$typage
[
'Typage'
][
'createdbyorganisation'
]
!==
$this
->
Session
->
read
(
'Organisation.id'
))
{
throw
new
ForbiddenException
(
__d
(
'default'
,
'default.flasherrorPasDroitPage'
));
}
return
$typage
;
}
/**
* Fonction qui permet la modification d'une norme
...
...
@@ -157,11 +243,7 @@ class TypagesController extends AppController {
if
(
$this
->
request
->
params
[
'action'
]
===
'add'
)
{
$this
->
set
(
'title'
,
__d
(
'typage'
,
'typage.titreAddType'
));
}
else
{
if
(
empty
(
$id
))
{
$this
->
Session
->
setFlash
(
__d
(
'typage'
,
'typage.flasherrorEditTypage'
),
'flasherror'
);
$this
->
redirect
([
'action'
=>
'index'
]);
}
$typage
=
$this
->
_getAndCheckTypageAccessAndUsage
(
$id
);
$this
->
set
(
'title'
,
__d
(
'typage'
,
'typage.titreeditType'
));
}
...
...
@@ -170,38 +252,31 @@ class TypagesController extends AppController {
$this
->
redirect
(
$this
->
Referers
->
get
());
}
$success
=
true
;
$this
->
Typage
->
begin
();
$data
=
$this
->
request
->
data
;
if
(
$this
->
request
->
params
[
'action'
]
===
'edit'
)
{
$data
[
'Typage'
][
'id'
]
=
$id
;
}
if
(
$this
->
request
->
params
[
'action'
]
===
'add'
)
{
$data
=
$this
->
request
->
data
;
$data
[
'Typage'
][
'createdbyorganisation'
]
=
$this
->
Session
->
read
(
'Organisation.id'
);
}
else
{
$data
=
$typage
;
$data
[
'Typage'
][
'libelle'
]
=
Hash
::
get
(
$this
->
request
->
data
,
'Typage.libelle'
);
unset
(
$data
[
'Typage'
][
'created'
],
$data
[
'Typage'
][
'modified'
]);
}
$this
->
Typage
->
create
(
$data
);
$success
=
$success
&&
false
!==
$this
->
Typage
->
save
();
if
(
$success
==
true
)
{
$this
->
Typage
->
commit
();
if
(
false
!==
$this
->
Typage
->
save
(
null
,
[
'atomic'
=>
true
]))
{
$this
->
Session
->
setFlash
(
__d
(
'typage'
,
'typage.flashsuccesSaveTypage'
),
'flashsuccess'
);
$this
->
redirect
(
$this
->
Referers
->
get
());
}
else
{
$this
->
Typage
->
rollback
();
$this
->
Session
->
setFlash
(
__d
(
'typage'
,
'typage.flasherrorSaveTypage'
),
'flasherror'
);
}
}
elseif
(
$this
->
request
->
params
[
'action'
]
===
'edit'
)
{
$this
->
request
->
data
=
$typage
;
}
$this
->
view
=
'edit'
;
}
/**
* Fonction qui permet de supprimer un
responsabl
e liée à l'entité
* Fonction qui permet de supprimer un
type d'annex
e liée à l'entité
*
* @param int $type_id
* @throws ForbiddenException
...
...
@@ -212,23 +287,22 @@ class TypagesController extends AppController {
* @version V1.2.0
*/
public
function
dissocier
(
$type_id
)
{
if
(
true
!==
$this
->
Droits
->
authorized
(
ListeDroit
::
GESTION_
CORESPONSABL
E
))
{
if
(
true
!==
$this
->
Droits
->
authorized
(
ListeDroit
::
GESTION_
TYPAG
E
))
{
throw
new
ForbiddenException
(
__d
(
'default'
,
'default.flasherrorPasDroitPage'
));
}
$success
=
true
;
$this
->
TypageOrganisation
->
begin
();
$this
->
Typage
->
TypageOrganisation
->
begin
();
$success
=
$success
&&
false
!==
$this
->
TypageOrganisation
->
deleteAll
([
$success
=
false
!==
$this
->
Typage
->
TypageOrganisation
->
deleteAll
([
'TypageOrganisation.organisation_id'
=>
$this
->
Session
->
read
(
'Organisation.id'
),
'TypageOrganisation.typage_id'
=>
$type_id
]);
if
(
$success
==
true
)
{
$this
->
TypageOrganisation
->
commit
();
$this
->
Typage
->
TypageOrganisation
->
commit
();
$this
->
Session
->
setFlash
(
__d
(
'typage'
,
'typage.flashsuccessDissocier'
),
'flashsuccess'
);
}
else
{
$this
->
TypageOrganisation
->
rollback
();
$this
->
Typage
->
TypageOrganisation
->
rollback
();
$this
->
Session
->
setFlash
(
__d
(
'typage'
,
'typage.flasherrorErreurDissocier'
),
'flasherror'
);
}
...
...
@@ -236,9 +310,9 @@ class TypagesController extends AppController {
}
/**
* Permet de supprimer un
responsabl
e
* Permet de supprimer un
type d'annex
e
*
* @param
type
$id | Id du
responsabl
e
* @param
int
$id | Id du
type d'annex
e
*
* @author Théo GUILLON <theo.guillon@libriciel.coop>
* @access public
...
...
@@ -246,33 +320,19 @@ class TypagesController extends AppController {
* @version V1.2.0
*/
public
function
delete
(
$id
)
{
if
(
true
!==
$this
->
Droits
->
authorized
(
ListeDroit
::
GESTION_
CORESPONSABL
E
))
{
if
(
true
!==
$this
->
Droits
->
authorized
(
ListeDroit
::
GESTION_
TYPAG
E
))
{
throw
new
ForbiddenException
(
__d
(
'default'
,
'default.flasherrorPasDroitPage'
));
}
$associationTypage
=
$this
->
TypageOrganisation
->
find
(
'all'
,
[
'conditions'
=>
[
'typage_id'
=>
$id
]
]);
if
(
empty
(
$associationTypage
))
{
$success
=
true
;
$this
->
Typage
->
begin
();
$this
->
_getAndCheckTypageAccessAndUsage
(
$id
);
$success
=
$success
&&
false
!==
$this
->
Typage
->
deleteAll
([
'id'
=>
$id
]);
if
(
$success
==
true
)
{
$this
->
Typage
->
commit
();
$this
->
Session
->
setFlash
(
__d
(
'responsable'
,
'responsable.flashsuccessSuppressionResponsableEntite'
),
'flashsuccess'
);
}
else
{
$this
->
Typage
->
rollback
();
$this
->
Session
->
setFlash
(
__d
(
'responsable'
,
'responsable.flasherrorErreurSuppressionResponsableEntite'
),
'flasherror'
);
}
$this
->
Typage
->
begin
();
if
(
$this
->
Typage
->
delete
(
$id
)
===
true
)
{
$this
->
Typage
->
commit
();
$this
->
Session
->
setFlash
(
__d
(
'typage'
,
'typage.flashsuccessSuppressionTypage'
),
'flashsuccess'
);
}
else
{
$this
->
Session
->
setFlash
(
__d
(
'responsable'
,
'responsable.flasherrorErreurAssociationExistanteResponsableEntite'
),
'flasherror'
);
$this
->
Typage
->
rollback
();
$this
->
Session
->
setFlash
(
__d
(
'typage'
,
'typage.flasherrorErreurSuppressionTypage'
),
'flasherror'
);
}
$this
->
redirect
([
'action'
=>
'index'
]);
...
...
app/Locale/fra/LC_MESSAGES/default.po
View file @
9877fe06
...
...
@@ -148,6 +148,15 @@ msgstr "Toute la FAQ"
msgid "default.sousTitreMaFAQ"
msgstr "Ma FAQ"
msgid "default.titreTypages"
msgstr "Typages"
msgid "default.sousTitreTypagesAnnexes"
msgstr "Typages des annexes"
msgid "default.sousTitreMesTypesAnnexes"
msgstr "Mes types d'annexes"
msgid "default.titreNormes"
msgstr "Normes"
...
...
app/Locale/fra/LC_MESSAGES/typage.po
View file @
9877fe06
...
...
@@ -24,14 +24,23 @@ msgstr "Ajout d'un type d'annexe"
msgid "typage.titreeditType"
msgstr "Modification d'un type d'annexe"
msgid "typage.titreGestionTypageEntitee"
msgstr "Liste des types d'annexe associés à mon l'entité"
###############################################################################
############################## Session->setFlash ##############################
#### SUCCESS ####
msgid "typage.flashsuccessTypageAffecterEnregistrer"
msgstr "L'association du type d'annexe a été enregistrée"
msgid "typage.flashsuccesSaveTypage"
msgstr "Le type d'annexe a bien été enregistée"
msgstr "Le type d'annexe a bien été enregisté"
msgid "typage.flashsuccessSuppressionTypage"
msgstr "La suppression du type d'annexe a été enregistée"
msgid "typage.flashsuccessDissocier"
msgstr "La dissociation du type d'annexe a été enregistée"
...
...
@@ -40,14 +49,20 @@ msgstr "La dissociation du type d'annexe a été enregistée"
#### ERREUR ####
msgid "typage.flasherrorErreurEnregistrementTypageAffecter"
msgstr "Une erreur est survenue lors de l'association du type d'annexe"
msgid "typage.flasherrorSaveTypage"
msgstr "Une erreur est survenue lors de l'enregistrement du type d'annexe"
msgid "typage.flasherrorEditTypage"
msgstr "Une erreur est survenue lors de la modification du type d'annexe"
msgid "typage.flasherrorSuppressionTypage"
msgstr "Une erreur est survenue lors de la suppression du type d'annexe"
msgid "typage.flasherrorErreurDissocier"
msgstr "Une erreur est survenue lors de la dissociation du
responsable de l'entité
"
msgstr "Une erreur est survenue lors de la dissociation du
type d'annexe
"
################
...
...
@@ -70,6 +85,9 @@ msgstr "Actions"
msgid "typage.btnAddType"
msgstr "Ajouter un type"
msgid "typage.commentaireBtnModifierType"
msgstr "Modifier le type d'annexe"
msgid "typage.commentaireBtnDeleteType"
msgstr "Supprimer le type d'annexe"
...
...
@@ -101,4 +119,4 @@ msgstr "Libelle"
msgid "typage.placeholderChampLibelle"
msgstr "Nom du type d'annexe"
###############################################################################
\ No newline at end of file
###############################################################################
app/Model/Fiche.php
View file @
9877fe06
...
...
@@ -539,7 +539,8 @@ class Fiche extends AppModel {
$donnees
=
$this
->
_preparationGenerationHistorique
(
$id
,
$donnees
);
}
// debug(array_keys(Hash::flatten($donnees)));
// var_dump($donnees);
// die;
...
...
@@ -1057,12 +1058,6 @@ class Fiche extends AppModel {
private
function
_preparationAnnexe
(
$id
,
$donnees
)
{
// On chercher si le traitement comporte des annexe(s)
// $fileAnnexes = $this->Fichier->find('all', [
// 'conditions' => [
// 'fiche_id' => $id
// ]
// ]);
$fileAnnexes
=
$this
->
Fichier
->
find
(
'all'
,
[
'contain'
=>
[
'Typage'
...
...
@@ -1109,17 +1104,17 @@ class Fiche extends AppModel {
'type'
=>
'file'
];
$donnees
[
'fichiers'
][
$key
][
'valeur_nom'
]
=
[
$donnees
[
'
info_
fichiers'
][
$key
][
'valeur_nom
_fichier
'
]
=
[
'value'
=>
$fileAnnexe
[
'Fichier'
][
'nom'
],
'type'
=>
'text'
];
$donnees
[
'fichiers'
][
$key
][
'valeur_depot'
]
=
[
$donnees
[
'
info_
fichiers'
][
$key
][
'valeur_
date_
depot'
]
=
[
'value'
=>
$fileAnnexe
[
'Fichier'
][
'created'
],
'type'
=>
'text'
];
$donnees
[
'fichiers'
][
$key
][
'valeur_type'
]
=
[
$donnees
[
'
info_
fichiers'
][
$key
][
'valeur_type
_fichier
'
]
=
[
'value'
=>
$fileAnnexe
[
'Typage'
][
'libelle'
],
'type'
=>
'text'
];
...
...
app/Model/Fichier.php
View file @
9877fe06
...
...
@@ -139,11 +139,12 @@ class Fichier extends AppModel {
}
/**
*
*
* @param int $idFiche
* @param boolean $useAllExtensionFiles
* @param
type
$uuidDossier
* @param
string
$uuidDossier
* @param int $idUser
* @param array $typages
* @param boolean $transaction La méthode doit-elle gérer elle-même une
* transaction (par défaut: false) ?
* @return boolean
...
...
@@ -187,9 +188,11 @@ class Fichier extends AppModel {
$typeFile
=
null
;
if
(
!
empty
(
$typages
))
{
$keyFind
=
'typage_'
.
$key
;
if
(
array_key_exists
(
$keyFind
,
$typages
))
{
$typeFile
=
$typages
[
$keyFind
];
if
(
array_key_exists
(
'typage_tmp_'
.
$key
,
$typages
)
===
true
)
{
$typeFile
=
$typages
[
'typage_tmp_'
.
$key
];
}
elseif
(
array_key_exists
(
'typage_'
.
$key
,
$typages
)
===
true
)
{
debug
(
"SOS"
);
die
;
$typeFile
=
$typages
[
'typage_'
.
$key
];
}
}
...
...
@@ -223,7 +226,7 @@ class Fichier extends AppModel {
}
return
true
;
}
return
false
;
}
...
...
app/Model/Typage.php
View file @
9877fe06
...
...
@@ -70,4 +70,24 @@ class Typage extends AppModel {
'with'
=>
'TypageOrganisation'
]
];
/**
* Retourne un champ virtuel contenant le nombre d'entités liées au @fixme.
*
* @param string $primaryKeyField | 'Typage.id' --> Champ représentant le Typage.id
* @param string $fieldName | 'organisations_count' --> Nom du champ virtuel
* @return string
*/