Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
open-source
OSE
Commits
b6756943
Commit
b6756943
authored
Nov 14, 2019
by
Laurent Lécluse
Browse files
Tâche #25975
Unoconv : pouvoir utiliser un serveur dédié
parent
1cc2a0b4
Changes
7
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
b6756943
...
...
@@ -3,6 +3,27 @@ title: "Changements intervenus sur OSE"
author
:
Laurent Lécluse - DSI - Unicaen
---
# OSE 10-zf2 et 10-zf3 (à venir)
## Nouveautés
*
Possibilité d'utiliser un service Unoconv présent sur un serveur dédié autre que celui de OSE
## Notes de mise à jour
Ajout de nouveaux paramètres de configuration pour pouvoir externaliser l'usage du service Unoconv.
A ajouter dans votre fichier config.local.php et à personnaliser le cas échéant :
```
php
/* Génération d'états de sortie avec Unoconv */
'etats-sortie'
=>
[
/* Serveur où se situe le service Unoconv */
'host'
=>
'127.0.0.1'
,
// par défaut sur la même machine que OSE
/* Répertoire de travail utilisé à la fois par OSE et par le service Unoconv */
'tmp-dir'
=>
getcwd
()
.
'/cache/'
,
// par défaut dans le répertoire cache de OSE
],
```
# OSE 9.0.2-zf2 et 9.0.2-zf3
## Correction de bugs
...
...
config.local.php.default
View file @
b6756943
...
...
@@ -241,4 +241,14 @@ return [
'debug'
=>
false
,
],
/* Génération d'états de sortie avec Unoconv */
'etats-sortie'
=>
[
/* Serveur où se situe le service Unoconv */
'host'
=>
'127.0.0.1'
,
// par défaut sur la même machine que OSE
/* Répertoire de travail utilisé à la fois par OSE et par le service Unoconv */
'tmp-dir'
=>
getcwd
()
.
'/cache/'
,
// par défaut dans le répertoire cache de OSE
],
];
\ No newline at end of file
config/autoload/application.global.php
View file @
b6756943
...
...
@@ -5,12 +5,12 @@ return [
'connection'
=>
[
'orm_default'
=>
[
'params'
=>
[
'host'
=>
AppConfig
::
get
(
'bdd'
,
'host'
),
'port'
=>
AppConfig
::
get
(
'bdd'
,
'port'
),
'dbname'
=>
AppConfig
::
get
(
'bdd'
,
'dbname'
),
'user'
=>
AppConfig
::
get
(
'bdd'
,
'username'
),
'password'
=>
AppConfig
::
get
(
'bdd'
,
'password'
),
'charset'
=>
'AL32UTF8'
,
'host'
=>
AppConfig
::
get
(
'bdd'
,
'host'
),
'port'
=>
AppConfig
::
get
(
'bdd'
,
'port'
),
'dbname'
=>
AppConfig
::
get
(
'bdd'
,
'dbname'
),
'user'
=>
AppConfig
::
get
(
'bdd'
,
'username'
),
'password'
=>
AppConfig
::
get
(
'bdd'
,
'password'
),
'charset'
=>
'AL32UTF8'
,
//'persistent' => true,
],
],
...
...
@@ -18,7 +18,7 @@ return [
'configuration'
=>
[
'orm_default'
=>
[
'metadata_cache'
=>
'filesystem'
,
// 'query_cache' => 'filesystem',
// 'query_cache' => 'filesystem',
'result_cache'
=>
'filesystem'
,
'hydration_cache'
=>
'array'
,
'generate_proxies'
=>
AppConfig
::
get
(
'bdd'
,
'generateProxies'
),
...
...
@@ -34,5 +34,10 @@ return [
'scheme'
=>
AppConfig
::
get
(
'global'
,
'scheme'
),
'domain'
=>
AppConfig
::
get
(
'global'
,
'domain'
),
],
'application'
=>
[
'etats-sortie'
=>
[
'host'
=>
AppConfig
::
get
(
'etats-sortie'
,
'host'
,
'127.0.0.1'
),
'tmp-dir'
=>
AppConfig
::
get
(
'etats-sortie'
,
'tmp-dir'
,
getcwd
()
.
'/cache/'
),
],
],
];
\ No newline at end of file
module/Application/src/Application/Service/EtatSortieService.php
View file @
b6756943
...
...
@@ -22,6 +22,11 @@ class EtatSortieService extends AbstractEntityService
{
use
ParametresServiceAwareTrait
;
/**
* @var array
*/
private
$config
;
/**
...
...
@@ -79,7 +84,13 @@ class EtatSortieService extends AbstractEntityService
public
function
genererPdf
(
EtatSortie
$etatSortie
,
array
$filtres
,
array
$options
=
[]):
Document
{
$document
=
new
Document
();
$document
->
setTmpDir
(
getcwd
()
.
'/cache/'
);
if
(
isset
(
$this
->
config
[
'host'
])){
$document
->
setHost
(
$this
->
config
[
'host'
]);
}
if
(
isset
(
$this
->
config
[
'tmp-dir'
])){
$document
->
setTmpDir
(
$this
->
config
[
'tmp-dir'
]);
}
$document
->
getPublisher
()
->
setAutoBreak
(
$etatSortie
->
isAutoBreak
());
$document
->
setPdfOutput
(
true
);
if
(
$etatSortie
->
hasFichier
())
{
...
...
@@ -323,4 +334,29 @@ class EtatSortieService extends AbstractEntityService
return
$connection
->
fetchAll
(
$query
,
$queryFilters
);
}
/**
* @return array
*/
public
function
getConfig
()
{
return
$this
->
config
;
}
/**
* @param array $config
*
* @return EtatSortieService
*/
public
function
setConfig
(
array
$config
):
EtatSortieService
{
$this
->
config
=
$config
;
return
$this
;
}
}
\ No newline at end of file
module/Application/src/Application/Service/Factory/EtatSortieServiceFactory.php
View file @
b6756943
...
...
@@ -28,6 +28,12 @@ class EtatSortieServiceFactory
$service
=
new
EtatSortieService
;
$service
->
setEntityManager
(
$container
->
get
(
Constants
::
BDD
));
$config
=
$container
->
get
(
'Config'
);
if
(
isset
(
$config
[
'application'
][
'etats-sortie'
])){
$service
->
setConfig
(
$config
[
'application'
][
'etats-sortie'
]);
}
return
$service
;
}
}
\ No newline at end of file
module/Application/src/Application/Service/Factory/ModeleContratServiceFactory.php
View file @
b6756943
...
...
@@ -28,6 +28,12 @@ class ModeleContratServiceFactory
$service
=
new
ModeleContratService
;
$service
->
setEntityManager
(
$container
->
get
(
Constants
::
BDD
));
$config
=
$container
->
get
(
'Config'
);
if
(
isset
(
$config
[
'application'
][
'etats-sortie'
])){
$service
->
setConfig
(
$config
[
'application'
][
'etats-sortie'
]);
}
return
$service
;
}
}
\ No newline at end of file
module/Application/src/Application/Service/ModeleContratService.php
View file @
b6756943
...
...
@@ -19,6 +19,13 @@ use Unicaen\OpenDocument\Document;
class
ModeleContratService
extends
AbstractEntityService
{
/**
* @var array
*/
private
$config
;
/**
* retourne la classe des entités
*
...
...
@@ -66,10 +73,15 @@ class ModeleContratService extends AbstractEntityService
}
$document
=
new
Document
();
$document
->
setTmpDir
(
getcwd
()
.
'/cache/'
);
if
(
isset
(
$this
->
config
[
'host'
])){
$document
->
setHost
(
$this
->
config
[
'host'
]);
}
if
(
isset
(
$this
->
config
[
'tmp-dir'
])){
$document
->
setTmpDir
(
$this
->
config
[
'tmp-dir'
]);
}
if
(
$modele
->
hasFichier
())
{
$document
->
loadFromData
(
stream_get_contents
(
$modele
->
getFichier
(),
-
1
,
0
));
$document
->
loadFromData
(
stream_get_contents
(
$modele
->
getFichier
(),
-
1
,
0
));
}
else
{
$document
->
loadFromFile
(
$this
->
getModeleGeneriqueFile
(),
true
);
}
...
...
@@ -135,12 +147,12 @@ class ModeleContratService extends AbstractEntityService
unset
(
$mainData
[
'exemplaire1'
]);
}
if
(
isset
(
$mainData
[
'exemplaire2'
])
&&
$mainData
[
'exemplaire2'
]
&&
(
'0'
!==
$mainData
[
'exemplaire2'
]))
{
$data
[
1
]
=
$data
[
0
];
$data
[
1
]
=
$data
[
0
];
$data
[
1
][
'exemplaire'
]
=
$mainData
[
'exemplaire2'
];
unset
(
$mainData
[
'exemplaire2'
]);
}
if
(
isset
(
$mainData
[
'exemplaire3'
])
&&
$mainData
[
'exemplaire3'
]
&&
(
'0'
!==
$mainData
[
'exemplaire3'
]))
{
$data
[
2
]
=
$data
[
0
];
$data
[
2
]
=
$data
[
0
];
$data
[
2
][
'exemplaire'
]
=
$mainData
[
'exemplaire3'
];
unset
(
$mainData
[
'exemplaire3'
]);
}
...
...
@@ -185,4 +197,30 @@ class ModeleContratService extends AbstractEntityService
return
'modele_contrat'
;
}
/**
* @return array
*/
public
function
getConfig
()
{
return
$this
->
config
;
}
/**
* @param array $config
*
* @return ModeleContratService
*/
public
function
setConfig
(
array
$config
):
ModeleContratService
{
$this
->
config
=
$config
;
return
$this
;
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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