@@ -149,7 +149,7 @@ |
||
149 | 149 | foreach ($parts as $part) { |
150 | 150 | //Determine the picture to show: |
151 | 151 | $preview_attachment = $previewGenerator->getTablePreviewAttachment($part); |
152 | - if($preview_attachment !== null) { |
|
152 | + if ($preview_attachment !== null) { |
|
153 | 153 | $preview_url = $attachmentURLGenerator->getThumbnailURL($preview_attachment, 'thumbnail_sm'); |
154 | 154 | } else { |
155 | 155 | $preview_url = ''; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @throws Exception |
85 | 85 | */ |
86 | - public function edit(User $entity, Request $request, EntityManagerInterface $em, PermissionPresetsHelper $permissionPresetsHelper, PermissionSchemaUpdater $permissionSchemaUpdater, ?string $timestamp = null): Response |
|
86 | + public function edit(User $entity, Request $request, EntityManagerInterface $em, PermissionPresetsHelper $permissionPresetsHelper, PermissionSchemaUpdater $permissionSchemaUpdater, ?string $timestamp = null): Response |
|
87 | 87 | { |
88 | 88 | //Do an upgrade of the permission schema if needed (so the user can see the permissions a user get on next request (even if it was not done yet) |
89 | 89 | $permissionSchemaUpdater->userUpgradeSchemaRecursively($entity); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @Route("/{id}/clone", name="user_clone") |
156 | 156 | * @Route("/") |
157 | 157 | */ |
158 | - public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?User $entity = null): Response |
|
158 | + public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?User $entity = null) : Response |
|
159 | 159 | { |
160 | 160 | return $this->_new($request, $em, $importer, $entity); |
161 | 161 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function new(Request $request, EntityManagerInterface $em, TranslatorInterface $translator, |
217 | 217 | AttachmentSubmitHandler $attachmentSubmitHandler, ProjectBuildPartHelper $projectBuildPartHelper, |
218 | - ?Part $part = null, ?Project $project = null): Response |
|
218 | + ?Part $part = null, ?Project $project = null) : Response |
|
219 | 219 | { |
220 | 220 | |
221 | 221 | if ($part) { //Clone part |
@@ -328,14 +328,14 @@ discard block |
||
328 | 328 | */ |
329 | 329 | public function withdrawAddHandler(Part $part, Request $request, EntityManagerInterface $em, PartLotWithdrawAddHelper $withdrawAddHelper): Response |
330 | 330 | { |
331 | - if ($this->isCsrfTokenValid('part_withraw' . $part->getID(), $request->request->get('_csfr'))) { |
|
331 | + if ($this->isCsrfTokenValid('part_withraw'.$part->getID(), $request->request->get('_csfr'))) { |
|
332 | 332 | //Retrieve partlot from the request |
333 | 333 | $partLot = $em->find(PartLot::class, $request->request->get('lot_id')); |
334 | - if($partLot === null) { |
|
334 | + if ($partLot === null) { |
|
335 | 335 | throw new \RuntimeException('Part lot not found!'); |
336 | 336 | } |
337 | 337 | //Ensure that the partlot belongs to the part |
338 | - if($partLot->getPart() !== $part) { |
|
338 | + if ($partLot->getPart() !== $part) { |
|
339 | 339 | throw new \RuntimeException("The origin partlot does not belong to the part!"); |
340 | 340 | } |
341 | 341 | //Try to determine the target lot (used for move actions) |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | } |
379 | 379 | |
380 | 380 | //If an redirect was passed, then redirect there |
381 | - if($request->request->get('_redirect')) { |
|
381 | + if ($request->request->get('_redirect')) { |
|
382 | 382 | return $this->redirect($request->request->get('_redirect')); |
383 | 383 | } |
384 | 384 | //Otherwise just redirect to the part page |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function addPart(Request $request, EntityManagerInterface $entityManager, ?Project $project): Response |
79 | 79 | { |
80 | - if($project) { |
|
80 | + if ($project) { |
|
81 | 81 | $this->denyAccessUnlessGranted('edit', $project); |
82 | 82 | } else { |
83 | 83 | $this->denyAccessUnlessGranted('@projects.edit'); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | $data = $form->getData(); |
130 | 130 | $bom_entries = $data['bom_entries']; |
131 | - foreach ($bom_entries as $bom_entry){ |
|
131 | + foreach ($bom_entries as $bom_entry) { |
|
132 | 132 | $target_project->addBOMEntry($bom_entry); |
133 | 133 | } |
134 | 134 | $entityManager->flush(); |
@@ -46,7 +46,7 @@ |
||
46 | 46 | //Retrieve other data from the form, that you want to store with the key |
47 | 47 | $keyName = $request->request->get('keyName'); |
48 | 48 | if (empty($keyName)) { |
49 | - $keyName = 'Key ' . date('Y-m-d H:i:s'); |
|
49 | + $keyName = 'Key '.date('Y-m-d H:i:s'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | //Check the response |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | $formRequest = clone $request; |
130 | 130 | $formRequest->setMethod('GET'); |
131 | 131 | $filter = new PartFilter($this->nodesListBuilder); |
132 | - if($filter_changer !== null){ |
|
132 | + if ($filter_changer !== null) { |
|
133 | 133 | $filter_changer($filter); |
134 | 134 | } |
135 | 135 | |
136 | 136 | $filterForm = $this->createForm(PartFilterType::class, $filter, ['method' => 'GET']); |
137 | - if($form_changer !== null) { |
|
137 | + if ($form_changer !== null) { |
|
138 | 138 | $form_changer($filterForm); |
139 | 139 | } |
140 | 140 | |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | |
165 | 165 | return $this->showListWithFilter($request, |
166 | 166 | 'Parts/lists/category_list.html.twig', |
167 | - function (PartFilter $filter) use ($category) { |
|
167 | + function(PartFilter $filter) use ($category) { |
|
168 | 168 | $filter->getCategory()->setOperator('INCLUDING_CHILDREN')->setValue($category); |
169 | - }, function (FormInterface $filterForm) { |
|
169 | + }, function(FormInterface $filterForm) { |
|
170 | 170 | $this->disableFormFieldAfterCreation($filterForm->get('category')->get('value')); |
171 | 171 | }, [ |
172 | 172 | 'entity' => $category, |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | |
187 | 187 | return $this->showListWithFilter($request, |
188 | 188 | 'Parts/lists/footprint_list.html.twig', |
189 | - function (PartFilter $filter) use ($footprint) { |
|
189 | + function(PartFilter $filter) use ($footprint) { |
|
190 | 190 | $filter->getFootprint()->setOperator('INCLUDING_CHILDREN')->setValue($footprint); |
191 | - }, function (FormInterface $filterForm) { |
|
191 | + }, function(FormInterface $filterForm) { |
|
192 | 192 | $this->disableFormFieldAfterCreation($filterForm->get('footprint')->get('value')); |
193 | 193 | }, [ |
194 | 194 | 'entity' => $footprint, |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | |
209 | 209 | return $this->showListWithFilter($request, |
210 | 210 | 'Parts/lists/manufacturer_list.html.twig', |
211 | - function (PartFilter $filter) use ($manufacturer) { |
|
211 | + function(PartFilter $filter) use ($manufacturer) { |
|
212 | 212 | $filter->getManufacturer()->setOperator('INCLUDING_CHILDREN')->setValue($manufacturer); |
213 | - }, function (FormInterface $filterForm) { |
|
213 | + }, function(FormInterface $filterForm) { |
|
214 | 214 | $this->disableFormFieldAfterCreation($filterForm->get('manufacturer')->get('value')); |
215 | 215 | }, [ |
216 | 216 | 'entity' => $manufacturer, |
@@ -230,9 +230,9 @@ discard block |
||
230 | 230 | |
231 | 231 | return $this->showListWithFilter($request, |
232 | 232 | 'Parts/lists/store_location_list.html.twig', |
233 | - function (PartFilter $filter) use ($storelocation) { |
|
233 | + function(PartFilter $filter) use ($storelocation) { |
|
234 | 234 | $filter->getStorelocation()->setOperator('INCLUDING_CHILDREN')->setValue($storelocation); |
235 | - }, function (FormInterface $filterForm) { |
|
235 | + }, function(FormInterface $filterForm) { |
|
236 | 236 | $this->disableFormFieldAfterCreation($filterForm->get('storelocation')->get('value')); |
237 | 237 | }, [ |
238 | 238 | 'entity' => $storelocation, |
@@ -252,9 +252,9 @@ discard block |
||
252 | 252 | |
253 | 253 | return $this->showListWithFilter($request, |
254 | 254 | 'Parts/lists/supplier_list.html.twig', |
255 | - function (PartFilter $filter) use ($supplier) { |
|
255 | + function(PartFilter $filter) use ($supplier) { |
|
256 | 256 | $filter->getSupplier()->setOperator('INCLUDING_CHILDREN')->setValue($supplier); |
257 | - }, function (FormInterface $filterForm) { |
|
257 | + }, function(FormInterface $filterForm) { |
|
258 | 258 | $this->disableFormFieldAfterCreation($filterForm->get('supplier')->get('value')); |
259 | 259 | }, [ |
260 | 260 | 'entity' => $supplier, |
@@ -274,9 +274,9 @@ discard block |
||
274 | 274 | |
275 | 275 | return $this->showListWithFilter($request, |
276 | 276 | 'Parts/lists/tags_list.html.twig', |
277 | - function (PartFilter $filter) use ($tag) { |
|
277 | + function(PartFilter $filter) use ($tag) { |
|
278 | 278 | $filter->getTags()->setOperator('ANY')->setValue($tag); |
279 | - }, function (FormInterface $filterForm) { |
|
279 | + }, function(FormInterface $filterForm) { |
|
280 | 280 | $this->disableFormFieldAfterCreation($filterForm->get('tags')->get('value')); |
281 | 281 | }, [ |
282 | 282 | 'tag' => $tag, |
@@ -334,6 +334,6 @@ discard block |
||
334 | 334 | */ |
335 | 335 | public function showAll(Request $request, DataTableFactory $dataTable) |
336 | 336 | { |
337 | - return $this->showListWithFilter($request,'Parts/lists/all_list.html.twig'); |
|
337 | + return $this->showListWithFilter($request, 'Parts/lists/all_list.html.twig'); |
|
338 | 338 | } |
339 | 339 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | public function dontInherit(HasPermissionsInterface $user, string $permission, string $operation): ?bool |
79 | 79 | { |
80 | 80 | //Check that the permission/operation combination is valid |
81 | - if (! $this->isValidOperation($permission, $operation)) { |
|
81 | + if (!$this->isValidOperation($permission, $operation)) { |
|
82 | 82 | throw new InvalidArgumentException('The permission/operation combination "'.$permission.'/'.$operation.'" is not valid!'); |
83 | 83 | } |
84 | 84 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $perm_list = $user->getPermissions(); |
141 | 141 | |
142 | 142 | //Check if the permission/operation combination is valid |
143 | - if (! $this->isValidOperation($permission, $operation)) { |
|
143 | + if (!$this->isValidOperation($permission, $operation)) { |
|
144 | 144 | throw new InvalidArgumentException(sprintf('The permission/operation combination "%s.%s" is not valid!', $permission, $operation)); |
145 | 145 | } |
146 | 146 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | } |
234 | 234 | } |
235 | 235 | } |
236 | - } while($anything_changed); |
|
236 | + } while ($anything_changed); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | //We need to reset the permission data first (afterwards all values are inherit) |
52 | 52 | $perm_holder->getPermissions()->resetPermissions(); |
53 | 53 | |
54 | - switch($preset_name) { |
|
54 | + switch ($preset_name) { |
|
55 | 55 | case self::PRESET_ALL_INHERIT: |
56 | 56 | //Do nothing, all values are inherit after reset |
57 | 57 | break; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | //Labels permissions (allow all except use twig) |
120 | 120 | $this->permissionResolver->setAllOperationsOfPermission($permHolder, 'labels', PermissionData::ALLOW); |
121 | - $this->permissionResolver->setPermission($permHolder,'labels', 'use_twig', PermissionData::INHERIT); |
|
121 | + $this->permissionResolver->setPermission($permHolder, 'labels', 'use_twig', PermissionData::INHERIT); |
|
122 | 122 | |
123 | 123 | //Self permissions |
124 | 124 | $this->permissionResolver->setPermission($permHolder, 'self', 'edit_infos', PermissionData::ALLOW); |
@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | public function canAdd(PartLot $partLot): bool |
29 | 29 | { |
30 | 30 | //We cannot add or withdraw parts from lots with unknown instock value. |
31 | - if($partLot->isInstockUnknown()) { |
|
31 | + if ($partLot->isInstockUnknown()) { |
|
32 | 32 | return false; |
33 | 33 | } |
34 | 34 | |
35 | 35 | //So far all other restrictions are defined at the storelocation level |
36 | - if($partLot->getStorageLocation() === null) { |
|
36 | + if ($partLot->getStorageLocation() === null) { |
|
37 | 37 | return true; |
38 | 38 | } |
39 | 39 | |
40 | 40 | //We can not add parts if the storage location of the lot is marked as full |
41 | - if($partLot->getStorageLocation()->isFull()) { |
|
41 | + if ($partLot->getStorageLocation()->isFull()) { |
|
42 | 42 | return false; |
43 | 43 | } |
44 | 44 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $oldAmount = $partLot->getAmount(); |
97 | 97 | $partLot->setAmount($oldAmount - $amount); |
98 | 98 | |
99 | - $event = PartStockChangedLogEntry::withdraw($partLot, $oldAmount, $partLot->getAmount(), $part->getAmountSum() , $comment); |
|
99 | + $event = PartStockChangedLogEntry::withdraw($partLot, $oldAmount, $partLot->getAmount(), $part->getAmountSum(), $comment); |
|
100 | 100 | $this->eventLogger->log($event); |
101 | 101 | |
102 | 102 | //Apply the comment also to global events, so it gets associated with the elementChanged log entry |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $oldAmount = $partLot->getAmount(); |
137 | 137 | $partLot->setAmount($oldAmount + $amount); |
138 | 138 | |
139 | - $event = PartStockChangedLogEntry::add($partLot, $oldAmount, $partLot->getAmount(), $part->getAmountSum() , $comment); |
|
139 | + $event = PartStockChangedLogEntry::add($partLot, $oldAmount, $partLot->getAmount(), $part->getAmountSum(), $comment); |
|
140 | 140 | $this->eventLogger->log($event); |
141 | 141 | |
142 | 142 | //Apply the comment also to global events, so it gets associated with the elementChanged log entry |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $part = $origin->getPart(); |
166 | 166 | |
167 | 167 | //Ensure that both part lots belong to the same part |
168 | - if($origin->getPart() !== $target->getPart()) { |
|
168 | + if ($origin->getPart() !== $target->getPart()) { |
|
169 | 169 | throw new \RuntimeException("Cannot move instock between different parts!"); |
170 | 170 | } |
171 | 171 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | //And add it to the target |
192 | 192 | $target->setAmount($target->getAmount() + $amount); |
193 | 193 | |
194 | - $event = PartStockChangedLogEntry::move($origin, $oldOriginAmount, $origin->getAmount(), $part->getAmountSum() , $comment, $target); |
|
194 | + $event = PartStockChangedLogEntry::move($origin, $oldOriginAmount, $origin->getAmount(), $part->getAmountSum(), $comment, $target); |
|
195 | 195 | $this->eventLogger->log($event); |
196 | 196 | |
197 | 197 | //Apply the comment also to global events, so it gets associated with the elementChanged log entry |