|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* InstallController controller d'installation de l'application GLSR. |
|
4
|
|
|
* |
|
5
|
|
|
* PHP Version 5 |
|
6
|
|
|
* |
|
7
|
|
|
* @author Quétier Laurent <[email protected]> |
|
8
|
|
|
* @copyright 2014 Dev-Int GLSR |
|
9
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License |
|
10
|
|
|
* |
|
11
|
|
|
* @version since 1.0.0 |
|
12
|
|
|
* |
|
13
|
|
|
* @link https://github.com/Dev-Int/glsr |
|
14
|
|
|
*/ |
|
15
|
|
|
namespace AppBundle\Controller\Install; |
|
16
|
|
|
|
|
17
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; |
|
18
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
|
19
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; |
|
20
|
|
|
use Symfony\Component\HttpFoundation\Request; |
|
21
|
|
|
use AppBundle\Entity\FamilyLog; |
|
22
|
|
|
use AppBundle\Form\Type\FamilyLogType; |
|
23
|
|
|
use AppBundle\Entity\ZoneStorage; |
|
24
|
|
|
use AppBundle\Form\Type\ZoneStorageType; |
|
25
|
|
|
use AppBundle\Entity\UnitStorage; |
|
26
|
|
|
use AppBundle\Form\Type\UnitStorageType; |
|
27
|
|
|
use AppBundle\Entity\Tva; |
|
28
|
|
|
use AppBundle\Form\Type\TvaType; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* class InstallController |
|
32
|
|
|
* |
|
33
|
|
|
* @category Controller |
|
34
|
|
|
* |
|
35
|
|
|
* @Route("/install/step4") |
|
36
|
|
|
*/ |
|
37
|
|
|
class Install4Controller extends InstallController |
|
38
|
|
|
{ |
|
39
|
|
|
/** |
|
40
|
|
|
* Etape 4.1 de l'installation. |
|
41
|
|
|
* Cronfiguration de l'application (Famille logistique). |
|
42
|
|
|
* |
|
43
|
|
|
* @Route("/1", name="gs_install_st4_1") |
|
44
|
|
|
* @Method({"POST","GET"}) |
|
45
|
|
|
* @Template("AppBundle:install:step4.html.twig") |
|
46
|
|
|
* |
|
47
|
|
|
* @param Symfony\Component\HttpFoundation\Request $request Requète du formulaire |
|
|
|
|
|
|
48
|
|
|
* |
|
49
|
|
|
* @return Symfony\Component\HttpFoundation\Response Rendue de la page |
|
|
|
|
|
|
50
|
|
|
*/ |
|
51
|
|
View Code Duplication |
public function step41Action(Request $request) |
|
|
|
|
|
|
52
|
|
|
{ |
|
53
|
|
|
$familylog = new FamilyLog(); |
|
54
|
|
|
$form = $this->createForm(new FamilyLogType(), $familylog, array( |
|
55
|
|
|
'action' => $this->generateUrl('gs_install_st4_1') |
|
56
|
|
|
)); |
|
57
|
|
|
|
|
58
|
|
|
if ($form->handleRequest($request)->isValid()) { |
|
59
|
|
|
$em = $this->getDoctrine()->getManager(); |
|
60
|
|
|
$em->persist($familylog); |
|
61
|
|
|
$em->flush(); |
|
62
|
|
|
|
|
63
|
|
|
if ($form->get('save')->isSubmitted()) { |
|
64
|
|
|
$url = $this->redirect($this->generateUrl('gs_install_st4')); |
|
|
|
|
|
|
65
|
|
|
} elseif ($form->get('addmore')->isSubmitted()) { |
|
66
|
|
|
$url = $this->redirect($this->generateUrl('gs_install_st4_1')); |
|
|
|
|
|
|
67
|
|
|
} |
|
68
|
|
|
$this->addFlash('info', 'gestock.settings.add_ok'); |
|
69
|
|
|
|
|
70
|
|
|
return $this->redirect($this->generateUrl('gs_install_st4_1')); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
return array( |
|
74
|
|
|
'familylog' => $familylog, |
|
75
|
|
|
'form' => $form->createView(), |
|
76
|
|
|
); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* Etape 4.2 de l'installation. |
|
81
|
|
|
* Cronfiguration de l'application (Zone de stockage). |
|
82
|
|
|
* |
|
83
|
|
|
* @Route("/2", name="gs_install_st4_2") |
|
84
|
|
|
* @Method({"POST","GET"}) |
|
85
|
|
|
* @Template("AppBundle:install:step4.html.twig") |
|
86
|
|
|
* |
|
87
|
|
|
* @param Symfony\Component\HttpFoundation\Request $request Requète du formulaire |
|
|
|
|
|
|
88
|
|
|
* |
|
89
|
|
|
* @return Symfony\Component\HttpFoundation\Response Rendue de la page |
|
|
|
|
|
|
90
|
|
|
*/ |
|
91
|
|
View Code Duplication |
public function step42Action(Request $request) |
|
|
|
|
|
|
92
|
|
|
{ |
|
93
|
|
|
$zoneStorage = new ZoneStorage(); |
|
94
|
|
|
$form = $this->createForm(new ZoneStorageType(), $zoneStorage, array( |
|
95
|
|
|
'action' => $this->generateUrl('gs_install_st4_2') |
|
96
|
|
|
)); |
|
97
|
|
|
|
|
98
|
|
|
if ($form->handleRequest($request)->isValid()) { |
|
99
|
|
|
$em = $this->getDoctrine()->getManager(); |
|
100
|
|
|
$em->persist($zoneStorage); |
|
101
|
|
|
$em->flush(); |
|
102
|
|
|
$this->addFlash('info', 'gestock.settings.add_ok'); |
|
103
|
|
|
|
|
104
|
|
|
if ($form->get('save')->isSubmitted()) { |
|
105
|
|
|
$url = $this->redirect($this->generateUrl('gs_install_st4')); |
|
|
|
|
|
|
106
|
|
|
} elseif ($form->get('addmore')->isSubmitted()) { |
|
107
|
|
|
$url = $this->redirect($this->generateUrl('gs_install_st4_2')); |
|
|
|
|
|
|
108
|
|
|
} |
|
109
|
|
|
return $this->redirect($this->generateUrl('gs_install_st4_2')); |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
return array('zonestorage' => $zoneStorage, 'form' => $form->createView()); |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* Etape 4.3 de l'installation. |
|
117
|
|
|
* Cronfiguration de l'application (Unité de stockage). |
|
118
|
|
|
* |
|
119
|
|
|
* @Route("/3", name="gs_install_st4_3") |
|
120
|
|
|
* @Method({"POST","GET"}) |
|
121
|
|
|
* @Template("AppBundle:install:step4.html.twig") |
|
122
|
|
|
* |
|
123
|
|
|
* @param Symfony\Component\HttpFoundation\Request $request Requète du formulaire |
|
|
|
|
|
|
124
|
|
|
* |
|
125
|
|
|
* @return Symfony\Component\HttpFoundation\Response Rendue de la page |
|
|
|
|
|
|
126
|
|
|
*/ |
|
127
|
|
View Code Duplication |
public function step43Action(Request $request) |
|
|
|
|
|
|
128
|
|
|
{ |
|
129
|
|
|
$unitStorage = new UnitStorage(); |
|
130
|
|
|
$form = $this->createForm(new UnitStorageType(), $unitStorage, array( |
|
131
|
|
|
'action' => $this->generateUrl('gs_install_st4_3') |
|
132
|
|
|
)); |
|
133
|
|
|
|
|
134
|
|
|
if ($form->handleRequest($request)->isValid()) { |
|
135
|
|
|
$em = $this->getDoctrine()->getManager(); |
|
136
|
|
|
$em->persist($unitStorage); |
|
137
|
|
|
$em->flush(); |
|
138
|
|
|
$this->addFlash('info', 'gestock.settings.add_ok'); |
|
139
|
|
|
|
|
140
|
|
|
if ($form->get('save')->isSubmitted()) { |
|
141
|
|
|
$url = $this->redirect($this->generateUrl('gs_install_st4')); |
|
|
|
|
|
|
142
|
|
|
} elseif ($form->get('addmore')->isSubmitted()) { |
|
143
|
|
|
$url = $this->redirect($this->generateUrl('gs_install_st4_3')); |
|
|
|
|
|
|
144
|
|
|
} |
|
145
|
|
|
return $this->redirect($this->generateUrl('gs_install_st4_3')); |
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
return array('unitstorage' => $unitStorage, 'form' => $form->createView()); |
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
/** |
|
152
|
|
|
* Etape 4.4 de l'installation. |
|
153
|
|
|
* Cronfiguration de l'application (Taux de T.V.A.). |
|
154
|
|
|
* |
|
155
|
|
|
* @Route("/4", name="gs_install_st4_4") |
|
156
|
|
|
* @Method({"POST","GET"}) |
|
157
|
|
|
* @Template("AppBundle:install:step4.html.twig") |
|
158
|
|
|
* |
|
159
|
|
|
* @param Symfony\Component\HttpFoundation\Request $request Requète du formulaire |
|
|
|
|
|
|
160
|
|
|
* |
|
161
|
|
|
* @return Symfony\Component\HttpFoundation\Response Rendue de la page |
|
|
|
|
|
|
162
|
|
|
*/ |
|
163
|
|
View Code Duplication |
public function step44Action(Request $request) |
|
|
|
|
|
|
164
|
|
|
{ |
|
165
|
|
|
$tva = new Tva(); |
|
166
|
|
|
$form = $this->createForm(new TvaType(), $tva, array( |
|
167
|
|
|
'action' => $this->generateUrl('gs_install_st4_4') |
|
168
|
|
|
)); |
|
169
|
|
|
|
|
170
|
|
|
if ($form->handleRequest($request)->isValid()) { |
|
171
|
|
|
$em = $this->getDoctrine()->getManager(); |
|
172
|
|
|
$em->persist($tva); |
|
173
|
|
|
$em->flush(); |
|
174
|
|
|
$this->addFlash('info', 'gestock.settings.add_ok'); |
|
175
|
|
|
|
|
176
|
|
|
if ($form->get('save')->isSubmitted()) { |
|
177
|
|
|
$url = $this->redirect($this->generateUrl('gs_install_st4')); |
|
|
|
|
|
|
178
|
|
|
} elseif ($form->get('addmore')->isSubmitted()) { |
|
179
|
|
|
$url = $this->redirect($this->generateUrl('gs_install_st4_4')); |
|
|
|
|
|
|
180
|
|
|
} |
|
181
|
|
|
return $this->redirect($this->generateUrl('gs_install_st4_4')); |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
return array('tva' => $tva, 'form' => $form->createView()); |
|
185
|
|
|
} |
|
186
|
|
|
} |
|
187
|
|
|
|
This check looks for
@paramannotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.