@@ -177,7 +177,7 @@ |
||
| 177 | 177 | */ |
| 178 | 178 | public function confirmation(?PaymentOrder $paymentOrder, Request $request, EntityManagerInterface $em): Response |
| 179 | 179 | { |
| 180 | - if($paymentOrder === null) { |
|
| 180 | + if ($paymentOrder === null) { |
|
| 181 | 181 | $this->addFlash('error', 'payment_order.can_not_be_found'); |
| 182 | 182 | return $this->redirectToRoute('homepage'); |
| 183 | 183 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | if ($payment_order->getDepartment() !== null && $payment_order->getDepartment()->getBankAccount() !== null) { |
| 121 | 121 | //First folder for each bank account |
| 122 | - $prefix = $payment_order->getDepartment()->getBankAccount()->getName() . ' [' . $payment_order->getDepartment()->getBankAccount()->getIban() .']' . '/'; |
|
| 122 | + $prefix = $payment_order->getDepartment()->getBankAccount()->getName() . ' [' . $payment_order->getDepartment()->getBankAccount()->getIban() . ']' . '/'; |
|
| 123 | 123 | |
| 124 | 124 | //A sub folder for each department |
| 125 | 125 | $prefix .= $payment_order->getDepartment()->getName() . '/'; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $project_name = mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $project_name); |
| 132 | 132 | $project_name = mb_ereg_replace("([\.]{2,})", '', $project_name); |
| 133 | 133 | //Format: "ZA000001 Project Name.pdf" |
| 134 | - $filename = $prefix.$payment_order->getIDString().' '.$project_name.'.'.$extension; |
|
| 134 | + $filename = $prefix . $payment_order->getIDString() . ' ' . $project_name . '.' . $extension; |
|
| 135 | 135 | |
| 136 | 136 | $data[$filename] = $path; |
| 137 | 137 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | return ZIPBinaryFileResponseFacade::createZIPResponseFromFiles( |
| 150 | 150 | $data, |
| 151 | - 'Belege_'.date('Y-m-d_H-i-s').'.zip'); |
|
| 151 | + 'Belege_' . date('Y-m-d_H-i-s') . '.zip'); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | public function configureCrud(Crud $crud): Crud |
@@ -317,32 +317,32 @@ discard block |
||
| 317 | 317 | ]); |
| 318 | 318 | |
| 319 | 319 | $emailAction = Action::new('sendEmail', 'payment_order.action.email', 'fas fa-envelope') |
| 320 | - ->linkToUrl(function (PaymentOrder $paymentOrder) { |
|
| 320 | + ->linkToUrl(function(PaymentOrder $paymentOrder) { |
|
| 321 | 321 | return $this->mailToGenerator->generateContactMailLink($paymentOrder); |
| 322 | 322 | }) |
| 323 | 323 | ->setCssClass('btn btn-secondary text-dark'); |
| 324 | 324 | |
| 325 | 325 | //Hide action if no contact emails are associated with department |
| 326 | - $emailAction->displayIf(function (PaymentOrder $paymentOrder) { |
|
| 326 | + $emailAction->displayIf(function(PaymentOrder $paymentOrder) { |
|
| 327 | 327 | return null !== $this->mailToGenerator->generateContactMailLink($paymentOrder); |
| 328 | 328 | }); |
| 329 | 329 | |
| 330 | 330 | $hhv_action = Action::new('contactHHV', 'payment_order.action.contact_hhv', 'fas fa-comment-dots') |
| 331 | - ->linkToUrl(function (PaymentOrder $paymentOrder) { |
|
| 331 | + ->linkToUrl(function(PaymentOrder $paymentOrder) { |
|
| 332 | 332 | return $this->mailToGenerator->getHHVMailLink($paymentOrder); |
| 333 | 333 | }) |
| 334 | 334 | ->setCssClass('btn btn-secondary text-dark'); |
| 335 | 335 | |
| 336 | 336 | $resend_confirmation_action = Action::new('resendConfirmation', 'payment_order.action.resend_confirmation', 'fas fa-redo') |
| 337 | 337 | ->linkToCrudAction('resendConfirmationEmail') |
| 338 | - ->displayIf(function (PaymentOrder $paymentOrder) { |
|
| 338 | + ->displayIf(function(PaymentOrder $paymentOrder) { |
|
| 339 | 339 | return $this->isGranted('ROLE_EDIT_PAYMENT_ORDERS') && !$paymentOrder->isConfirmed(); |
| 340 | 340 | }) |
| 341 | 341 | ->setCssClass('btn btn-secondary text-dark'); |
| 342 | 342 | |
| 343 | 343 | $mathematically_correct_action = Action::new('mathematicallyCorrect', 'payment_order.action.mathematically_correct', 'fas fa-check') |
| 344 | 344 | ->linkToCrudAction('checkMathematicallyCorrect') |
| 345 | - ->displayIf(function (PaymentOrder $paymentOrder) { |
|
| 345 | + ->displayIf(function(PaymentOrder $paymentOrder) { |
|
| 346 | 346 | return $this->isGranted('ROLE_PO_MATHEMATICALLY') |
| 347 | 347 | && $paymentOrder->isConfirmed() |
| 348 | 348 | && !$paymentOrder->isMathematicallyCorrect(); |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | |
| 352 | 352 | $factually_correct_action = Action::new('factuallyCorrect', 'payment_order.action.factually_correct', 'fas fa-check') |
| 353 | 353 | ->linkToCrudAction('checkFactuallyCorrect') |
| 354 | - ->displayIf(function (PaymentOrder $paymentOrder) { |
|
| 354 | + ->displayIf(function(PaymentOrder $paymentOrder) { |
|
| 355 | 355 | return $this->isGranted('ROLE_PO_FACTUALLY') |
| 356 | 356 | && $paymentOrder->isConfirmed() |
| 357 | 357 | && !$paymentOrder->isFactuallyCorrect() |
@@ -361,12 +361,12 @@ discard block |
||
| 361 | 361 | |
| 362 | 362 | $manual_confirmation = Action::new('manual_confirmation', 'payment_order.action.manual_confirmation', 'fas fa-exclamation-triangle') |
| 363 | 363 | ->setCssClass('btn btn-secondary') |
| 364 | - ->linkToRoute('payment_order_manual_confirm', function (PaymentOrder $paymentOrder) { |
|
| 364 | + ->linkToRoute('payment_order_manual_confirm', function(PaymentOrder $paymentOrder) { |
|
| 365 | 365 | return [ |
| 366 | 366 | 'id' => $paymentOrder->getId(), |
| 367 | 367 | ]; |
| 368 | 368 | }) |
| 369 | - ->displayIf(function (PaymentOrder $paymentOrder) { |
|
| 369 | + ->displayIf(function(PaymentOrder $paymentOrder) { |
|
| 370 | 370 | return $this->isGranted('ROLE_MANUAL_CONFIRMATION') |
| 371 | 371 | && !$paymentOrder->isConfirmed(); |
| 372 | 372 | }); |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | |
| 380 | 380 | $actions->disable(Crud::PAGE_NEW); |
| 381 | 381 | |
| 382 | - if(!$this->isGranted('ROLE_EDIT_PAYMENT_ORDERS')) { |
|
| 382 | + if (!$this->isGranted('ROLE_EDIT_PAYMENT_ORDERS')) { |
|
| 383 | 383 | $actions->disable('batchDelete'); |
| 384 | 384 | } |
| 385 | 385 | |
@@ -58,12 +58,12 @@ |
||
| 58 | 58 | //TODO: Improve this |
| 59 | 59 | $filename = sprintf("XML%06d", $object->getId()); |
| 60 | 60 | |
| 61 | - $filename .= '_'.date('ymd-His'); |
|
| 61 | + $filename .= '_' . date('ymd-His'); |
|
| 62 | 62 | |
| 63 | - $filename .= '_'.bin2hex(random_bytes(5)); |
|
| 63 | + $filename .= '_' . bin2hex(random_bytes(5)); |
|
| 64 | 64 | |
| 65 | 65 | //Add original extension |
| 66 | - $filename .= '.'.$originalExtension; |
|
| 66 | + $filename .= '.' . $originalExtension; |
|
| 67 | 67 | |
| 68 | 68 | return $filename; |
| 69 | 69 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | return [ |
| 36 | 36 | 'msg_id' => (string) ($group_header->MsgId), |
| 37 | 37 | 'number_of_payments' => (int) ($group_header->NbOfTxs), |
| 38 | - 'total_sum' => (int) str_replace('.','',$group_header->CtrlSum), |
|
| 38 | + 'total_sum' => (int) str_replace('.', '', $group_header->CtrlSum), |
|
| 39 | 39 | 'initiator_iban' => (string) $payment_info->DbtrAcct->Id->IBAN, |
| 40 | 40 | 'initiator_bic' => (string) $payment_info->DbtrAgt->FinInstnId->BIC, |
| 41 | 41 | ]; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | //Perform some checks on the sepa exports |
| 47 | - foreach($sepa_exports as $sepa_export) { |
|
| 47 | + foreach ($sepa_exports as $sepa_export) { |
|
| 48 | 48 | if (!$sepa_export instanceof SEPAExport) { |
| 49 | 49 | throw new \InvalidArgumentException('$sepa_exports must all be of type SEPAExport!'); |
| 50 | 50 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | public function persistSEPAExports(EntityManagerInterface $entityManager): void |
| 153 | 153 | { |
| 154 | - foreach($this->sepa_exports as $sepa_export) { |
|
| 154 | + foreach ($this->sepa_exports as $sepa_export) { |
|
| 155 | 155 | $entityManager->persist($sepa_export); |
| 156 | 156 | } |
| 157 | 157 | } |
@@ -277,7 +277,7 @@ |
||
| 277 | 277 | public function setXmlFile(\Symfony\Component\HttpFoundation\File\File $xml_file): SEPAExport |
| 278 | 278 | { |
| 279 | 279 | //Check if $xml_file was changed |
| 280 | - if($this->xml_file === null || $xml_file->getPathname() !== $this->xml_file->getPathname()) { |
|
| 280 | + if ($this->xml_file === null || $xml_file->getPathname() !== $this->xml_file->getPathname()) { |
|
| 281 | 281 | $this->xml_file = $xml_file; |
| 282 | 282 | $this->updateFromFile(); |
| 283 | 283 | } else { |
@@ -184,7 +184,7 @@ |
||
| 184 | 184 | public function sortPaymentOrderArrayByAmount(array $payment_orders, bool $ascending = true): array |
| 185 | 185 | { |
| 186 | 186 | usort($payment_orders, function (PaymentOrder $a, PaymentOrder $b) { |
| 187 | - return $a->getAmount() <=> $b->getAmount(); |
|
| 187 | + return $a->getAmount() <=> $b->getAmount(); |
|
| 188 | 188 | }); |
| 189 | 189 | |
| 190 | 190 | if (!$ascending) { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | //If no array object is existing yet, create the array |
| 86 | - if(!isset($grouped[$bank_account])) { |
|
| 86 | + if (!isset($grouped[$bank_account])) { |
|
| 87 | 87 | $grouped[$bank_account] = []; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | //Limit the sum amount of each group |
| 129 | 129 | $groups_exceeding_limit = $tmp; |
| 130 | 130 | $output = []; |
| 131 | - while(!empty($groups_exceeding_limit)) { |
|
| 131 | + while (!empty($groups_exceeding_limit)) { |
|
| 132 | 132 | foreach ($groups_exceeding_limit as $key => $group) { |
| 133 | 133 | /** @var PaymentOrder[] $group */ |
| 134 | 134 | //If the group does not exceed the limit, then remove it from the bad list and put it to output array |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $part = array_slice($group, 0, $n + 1); |
| 147 | 147 | if ($this->calculateSumAmountOfPaymentOrders($part) > $limit_max_amount) { |
| 148 | 148 | //If our group contains just a single element which exceed the limit, then throw an exception, as we can not split it further. |
| 149 | - if(count($part) === 1) { |
|
| 149 | + if (count($part) === 1) { |
|
| 150 | 150 | throw new SinglePaymentOrderExceedsLimit($part[0], $limit_max_amount); |
| 151 | 151 | } |
| 152 | 152 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | //Split group into our two subgroups of which at least one is below the limit |
| 159 | - $a = array_slice($group, 0 , $split_index); |
|
| 159 | + $a = array_slice($group, 0, $split_index); |
|
| 160 | 160 | $b = array_slice($group, $split_index); |
| 161 | 161 | |
| 162 | 162 | //Remove the old group from list and add the new split groups |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | public function sortPaymentOrderArrayByAmount(array $payment_orders, bool $ascending = true): array |
| 195 | 195 | { |
| 196 | - usort($payment_orders, function (PaymentOrder $a, PaymentOrder $b) { |
|
| 196 | + usort($payment_orders, function(PaymentOrder $a, PaymentOrder $b) { |
|
| 197 | 197 | return $a->getAmount() <=> $b->getAmount(); |
| 198 | 198 | }); |
| 199 | 199 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | try { |
| 86 | 86 | //Call function depending on the selected mode |
| 87 | - switch($data['mode']) { |
|
| 87 | + switch ($data['mode']) { |
|
| 88 | 88 | case 'auto': |
| 89 | 89 | $result = $this->sepaExporter->exportAuto($payment_orders); |
| 90 | 90 | break; |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | $this->entityManager->flush(); |
| 114 | 114 | |
| 115 | 115 | //Return the download |
| 116 | - return $result->getDownloadResponse('export_'.date('Y-m-d_H-i-s')); |
|
| 116 | + return $result->getDownloadResponse('export_' . date('Y-m-d_H-i-s')); |
|
| 117 | 117 | |
| 118 | 118 | } catch (SEPAExportAutoModeNotPossible $exception) { |
| 119 | 119 | //Show error if auto mode is not possible |
| 120 | 120 | $this->addFlash('danger', |
| 121 | 121 | $this->translator->trans('sepa_export.error.department_missing_account') |
| 122 | - .': '.$exception->getWrongDepartment()->getName()); |
|
| 122 | + .': ' . $exception->getWrongDepartment()->getName()); |
|
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |