You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hugo-fasone opened this issue
May 17, 2024
· 1 comment
· May be fixed by #36186
Labels
8.1.xBranchBOCategory: Back OfficeBugType: BugHookNMIStatus: issue needs more informationWaiting for authorStatus: action required, waiting for author feedback
But actually, the value of $name_controller is an empty string, so the executed hook is "displayForm" and not "displayAdminReturnForm". This behaviour is caused by these two code snippets:
On the AdminController.php file, we see that $name_controller takes the value only if it doesn't equal null. But in the HelperForm.php file we see that $name_controller is not equal to null, it's an empty string, thus the bug : $name_controller is equal to an empty string and never takes the Tools::getValue('controller') as a value
Thank you for your report and sorry for the time we spend to answer you, to try to reproduce your issue, can you provide us a exemple module to test it ?
8.1.xBranchBOCategory: Back OfficeBugType: BugHookNMIStatus: issue needs more informationWaiting for authorStatus: action required, waiting for author feedback
Prerequisites
Describe the bug and add attachments
Admin hooks of format "display#controller_name#Form" on legacy admin forms such as "displayAdminReturnForm" are not executed.
The hook is supposed to be called here : https://github.com/PrestaShop/PrestaShop/blob/8.1.6/admin-dev/themes/default/template/helpers/form/form.tpl#L663
Here
$name_controller
is supposed to be the name of the controller, so for exemple "AdminReturn" in the case of the "AdminReturn" controller when we try to view a single order return. The hook should be called at the end of the formBut actually, the value of
$name_controller
is an empty string, so the executed hook is "displayForm" and not "displayAdminReturnForm". This behaviour is caused by these two code snippets:https://github.com/PrestaShop/PrestaShop/blob/develop/classes/controller/AdminController.php#L2621C1-L2623C10
https://github.com/PrestaShop/PrestaShop/blob/8.1.6/classes/helper/HelperForm.php#L40
On the
AdminController.php
file, we see that$name_controller
takes the value only if it doesn't equal null. But in theHelperForm.php
file we see that$name_controller
is not equal to null, it's an empty string, thus the bug :$name_controller
is equal to an empty string and never takes theTools::getValue('controller')
as a valueWe see in this file the smarty affectation of the "name_controller" variable used in the
form.tpl
filehttps://github.com/PrestaShop/PrestaShop/blob/8.1.6/classes/helper/HelperForm.php#L291
This PR introduced this bug : #31514
Expected behavior
The hook "displayAdminReturnForm" should be executed at the end of a return form in backoffice (in the red rectangle on the screenshot above)
Steps to reproduce
PrestaShop version(s) where the bug happened
Tested on 8.1.4, but was presumably introduced in 8.0.2
PHP version(s) where the bug happened
N/A
If your bug is related to a module, specify its name and its version
N/A
Your company or customer's name goes here (if applicable).
PliciWeb
The text was updated successfully, but these errors were encountered: