@@ -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 |
@@ -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 |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | } else { |
| 86 | 86 | // We have to sort the pricedetails manually |
| 87 | 87 | $array = $pricedetails->map( |
| 88 | - static function (Pricedetail $pricedetail) { |
|
| 88 | + static function(Pricedetail $pricedetail) { |
|
| 89 | 89 | return $pricedetail->getMinDiscountQuantity(); |
| 90 | 90 | } |
| 91 | 91 | )->toArray(); |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | $secure_class_name = str_replace('\\', '_', $class_name); |
| 62 | 62 | $key = 'list_'.$this->keyGenerator->generateKey().'_'.$secure_class_name.$parent_id; |
| 63 | 63 | |
| 64 | - return $this->cache->get($key, function (ItemInterface $item) use ($class_name, $parent, $secure_class_name) { |
|
| 64 | + return $this->cache->get($key, function(ItemInterface $item) use ($class_name, $parent, $secure_class_name) { |
|
| 65 | 65 | // Invalidate when groups, a element with the class or the user changes |
| 66 | 66 | $item->tag(['groups', 'tree_list', $this->keyGenerator->generateKey(), $secure_class_name]); |
| 67 | 67 | /** @var StructuralDBElementRepository $repo */ |