Skip to content

Commit

Permalink
fix: Route parameters incorrect for new routes (dvsa/olcs-internal#108)
Browse files Browse the repository at this point in the history
* fix: Route parameters incorrect for two of the disable/enable routes

* fix: More route errors

* fix: Bus close route error

* fix: Close route going back to the correct section

* fix: busRegId in close redirect
  • Loading branch information
wadedvsa authored Mar 8, 2024
1 parent 28dcb39 commit 6dec2fd
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 18 deletions.
2 changes: 1 addition & 1 deletion app/internal/module/Olcs/config/routes.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -1339,7 +1339,7 @@
'route' => 'popup[/]',
'verb' => 'POST',
'defaults' => [
'controller' => Olcs\Controller\Messages\CaseEnableDisableMessagingController::class,
'controller' => Olcs\Controller\Messages\IrhpApplicationEnableDisableMessagingController::class,
'action' => 'popup',
'type' => 'enable',
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,8 @@ public function indexAction()
$action = strtolower($this->params()->fromPost('action'));
switch ($action) {
case 'end and archive conversation':
$params = [
'application' => $this->params()->fromRoute('application'),
'licence' => $this->params()->fromRoute('licence'),
'conversation' => $this->params()->fromRoute('conversation'),
'action' => $this->params()->fromRoute('confirm'),
];
$route = $this->topNavigationId === 'application' ? 'lva-application' : 'licence';
return $this->redirect()->toRoute($route . '/conversation/close', $params);
$route = str_replace('/view', '/close', $this->getConversationViewRoute());
return $this->redirect()->toRoute($route, [], [], true);
case 'reply':
return $this->parseReply($replyForm);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class BusCloseConversationController extends AbstractCloseConversationController
protected function getRedirect(): Response
{
$params = [
'bus' => $this->params()->fromRoute('bus'),
'busRegId' => $this->params()->fromRoute('busRegId'),
'licence' => $this->params()->fromRoute('licence'),
'action' => 'close',

];
return $this->redirect()->toRouteAjax('bus_conversation', $params);
return $this->redirect()->toRouteAjax('licence/bus_conversation', $params);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function getLeftView(): ?ViewModel

protected function getRoutePrefix(): string
{
return 'bus_conversation';
return 'licence/bus_conversation';
}

protected function getOrganisationId(): int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Olcs\Controller\Messages;

use Dvsa\Olcs\Transfer\Query\Cases\Cases;
use Dvsa\Olcs\Transfer\Query\Licence\Licence;
use Exception;
use Laminas\View\Model\ViewModel;
Expand Down Expand Up @@ -32,7 +33,7 @@ protected function getRoutePrefix(): string

protected function getOrganisationId(): int
{
$queryResponse = $this->handleQuery(Licence::create(['id' => $this->params()->fromRoute('licence')]));
$queryResponse = $this->handleQuery(Cases::create(['id' => $this->params()->fromRoute('case')]));
if (!$queryResponse->isOk()) {
throw new Exception(
sprintf(
Expand All @@ -44,6 +45,6 @@ protected function getOrganisationId(): int
}
$queryResult = $queryResponse->getResult();

return $queryResult['organisation']['id'];
return $queryResult['licence']['organisation']['id'];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ class IrhpApplicationCloseConversationController extends AbstractCloseConversati
protected function getRedirect(): Response
{
$params = [
'licence' => $this->params()->fromRoute('licence'),
'action' => 'close',
'licence' => $this->params()->fromRoute('licence'),
'irhpAppId' => $this->params()->fromRoute('irhpAppId'),
'action' => 'close',

];
return $this->redirect()->toRouteAjax('licence/irhp_conversations', $params);
return $this->redirect()->toRouteAjax('licence/irhp-application-conversation', $params);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function getLeftView(): ?ViewModel

protected function getRoutePrefix(): string
{
return 'licence/irhp_conversations';
return 'licence/irhp-application-conversation';
}

protected function getOrganisationId(): int
Expand Down

0 comments on commit 6dec2fd

Please sign in to comment.