Unverified Commit 982ccfde authored by Progi1984's avatar Progi1984 Committed by GitHub
Browse files

Merge pull request #25874 from matthieu-rolland/rebase-fix-change-context

Apply PR #25833 into 1.7.8.0-build
parents 8eace600 1b5a1ad5
......@@ -314,7 +314,7 @@ class WebserviceController extends FrameworkBundleAdminController
* @param Request $request
* @param WebserviceKeyFilters $filters
*
* @return Response
* @return Response|RedirectResponse
*/
public function saveSettingsAction(Request $request, WebserviceKeyFilters $filters)
{
......@@ -328,13 +328,13 @@ class WebserviceController extends FrameworkBundleAdminController
if (0 === count($saveErrors)) {
$this->addFlash('success', $this->trans('Update successful', 'Admin.Notifications.Success'));
return $this->redirectToRoute('admin_webservice_keys_index');
} else {
$this->flashErrors($saveErrors);
}
}
$form = $this->getFormHandler()->getForm();
return $this->renderPage($request, $filters, $form);
}
......
......@@ -239,15 +239,20 @@ class MetaController extends FrameworkBundleAdminController
* @param MetaFilters $filters
* @param Request $request
*
* @return Response
* @return Response|RedirectResponse
*/
public function processSetUpUrlsFormAction(MetaFilters $filters, Request $request)
{
$setUpUrlsForm = $this->processForm(
$formProcessResult = $this->processForm(
$request,
$this->getSetUpUrlsFormHandler(),
'SetUpUrls'
);
if ($formProcessResult instanceof RedirectResponse) {
return $formProcessResult;
}
$shopUrlsForm = $this->getShopUrlsFormHandler()->getForm();
$seoOptionsForm = $this->getSeoOptionsFormHandler()->getForm();
$isRewriteSettingEnabled = $this->get('prestashop.adapter.legacy.configuration')->getBoolean('PS_REWRITING_SETTINGS');
......@@ -257,7 +262,7 @@ class MetaController extends FrameworkBundleAdminController
$urlSchemaForm = $this->getUrlSchemaFormHandler()->getForm();
}
return $this->renderForm($request, $filters, $setUpUrlsForm, $shopUrlsForm, $seoOptionsForm, $urlSchemaForm);
return $this->renderForm($request, $filters, $formProcessResult, $shopUrlsForm, $seoOptionsForm, $urlSchemaForm);
}
/**
......@@ -267,16 +272,21 @@ class MetaController extends FrameworkBundleAdminController
* @param MetaFilters $filters
* @param Request $request
*
* @return Response
* @return Response|RedirectResponse
*/
public function processShopUrlsFormAction(MetaFilters $filters, Request $request)
{
$setUpUrlsForm = $this->getSetUpUrlsFormHandler()->getForm();
$shopUrlsForm = $this->processForm(
$formProcessResult = $this->processForm(
$request,
$this->getShopUrlsFormHandler(),
'ShopUrls'
);
if ($formProcessResult instanceof RedirectResponse) {
return $formProcessResult;
}
$setUpUrlsForm = $this->getSetUpUrlsFormHandler()->getForm();
$seoOptionsForm = $this->getSeoOptionsFormHandler()->getForm();
$isRewriteSettingEnabled = $this->get('prestashop.adapter.legacy.configuration')->getBoolean('PS_REWRITING_SETTINGS');
......@@ -285,7 +295,7 @@ class MetaController extends FrameworkBundleAdminController
$urlSchemaForm = $this->getUrlSchemaFormHandler()->getForm();
}
return $this->renderForm($request, $filters, $setUpUrlsForm, $shopUrlsForm, $seoOptionsForm, $urlSchemaForm);
return $this->renderForm($request, $filters, $setUpUrlsForm, $formProcessResult, $seoOptionsForm, $urlSchemaForm);
}
/**
......@@ -295,21 +305,25 @@ class MetaController extends FrameworkBundleAdminController
* @param MetaFilters $filters
* @param Request $request
*
* @return Response
* @return Response|RedirectResponse
*/
public function processUrlSchemaFormAction(MetaFilters $filters, Request $request)
{
$setUpUrlsForm = $this->getSetUpUrlsFormHandler()->getForm();
$shopUrlsForm = $this->getShopUrlsFormHandler()->getForm();
$seoOptionsForm = $this->getSeoOptionsFormHandler()->getForm();
$urlSchemaForm = $this->processForm(
$formProcessResult = $this->processForm(
$request,
$this->getUrlSchemaFormHandler(),
'UrlSchema'
);
return $this->renderForm($request, $filters, $setUpUrlsForm, $shopUrlsForm, $seoOptionsForm, $urlSchemaForm);
if ($formProcessResult instanceof RedirectResponse) {
return $formProcessResult;
}
$setUpUrlsForm = $this->getSetUpUrlsFormHandler()->getForm();
$shopUrlsForm = $this->getShopUrlsFormHandler()->getForm();
$seoOptionsForm = $this->getSeoOptionsFormHandler()->getForm();
return $this->renderForm($request, $filters, $setUpUrlsForm, $shopUrlsForm, $seoOptionsForm, $formProcessResult);
}
/**
......@@ -319,17 +333,22 @@ class MetaController extends FrameworkBundleAdminController
* @param MetaFilters $filters
* @param Request $request
*
* @return Response
* @return Response|RedirectResponse
*/
public function processSeoOptionsFormAction(MetaFilters $filters, Request $request)
{
$setUpUrlsForm = $this->getSetUpUrlsFormHandler()->getForm();
$shopUrlsForm = $this->getShopUrlsFormHandler()->getForm();
$seoOptionsForm = $this->processForm(
$formProcessResult = $this->processForm(
$request,
$this->getSeoOptionsFormHandler(),
'SeoOptions'
);
if ($formProcessResult instanceof RedirectResponse) {
return $formProcessResult;
}
$setUpUrlsForm = $this->getSetUpUrlsFormHandler()->getForm();
$shopUrlsForm = $this->getShopUrlsFormHandler()->getForm();
$isRewriteSettingEnabled = $this->get('prestashop.adapter.legacy.configuration')->getBoolean('PS_REWRITING_SETTINGS');
$urlSchemaForm = null;
......@@ -337,7 +356,7 @@ class MetaController extends FrameworkBundleAdminController
$urlSchemaForm = $this->getUrlSchemaFormHandler()->getForm();
}
return $this->renderForm($request, $filters, $setUpUrlsForm, $shopUrlsForm, $seoOptionsForm, $urlSchemaForm);
return $this->renderForm($request, $filters, $setUpUrlsForm, $shopUrlsForm, $formProcessResult, $urlSchemaForm);
}
/**
......@@ -467,7 +486,7 @@ class MetaController extends FrameworkBundleAdminController
* @param FormHandlerInterface $formHandler
* @param string $hookName
*
* @return FormInterface
* @return FormInterface|RedirectResponse
*/
protected function processForm(Request $request, FormHandlerInterface $formHandler, string $hookName)
{
......@@ -487,6 +506,8 @@ class MetaController extends FrameworkBundleAdminController
if (0 === count($saveErrors)) {
$this->addFlash('success', $this->trans('Update successful', 'Admin.Notifications.Success'));
return $this->redirectToRoute('admin_metas_index');
} else {
$this->flashErrors($saveErrors);
}
......
......@@ -30,6 +30,7 @@ use PrestaShop\PrestaShop\Core\Form\FormHandlerInterface;
use PrestaShop\PrestaShop\Core\Search\Filters\MerchandiseReturnFilters;
use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController;
use PrestaShopBundle\Security\Annotation\AdminSecurity;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
......@@ -49,7 +50,7 @@ class MerchandiseReturnController extends FrameworkBundleAdminController
* @param Request $request
* @param MerchandiseReturnFilters $filters
*
* @return Response
* @return Response|RedirectResponse
*/
public function indexAction(Request $request, MerchandiseReturnFilters $filters): Response
{
......@@ -64,6 +65,8 @@ class MerchandiseReturnController extends FrameworkBundleAdminController
if (empty($errors)) {
$this->addFlash('success', $this->trans('Update successful', 'Admin.Notifications.Success'));
return $this->redirectToRoute('admin_merchandise_returns_index');
} else {
$this->flashErrors($errors);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment