New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid displaying the addon modal twice, change form names/IDs to avoid collision #10684

Merged
merged 5 commits into from Oct 5, 2018

Conversation

Projects
None yet
5 participants
@jolelievre
Contributor

jolelievre commented Sep 24, 2018

Questions Answers
Branch? 1.7.5.x
Description? The javascript console displays error due to form elements having equal ids, this happens for three reasons. First addon modal is displayed twice in Symfony pages Second on pages with several forms a _token input is added for each form with the same form__token id Thus in the FormHandler class we allow to change the form_name so you can (manually) change the form name in its config Third in legacy form template the smarty countdown of forms did not work thus two forms with the same ids could occur
Type? bug fix
Category? BO
BC breaks? no
Deprecations? no
Fixed ticket? Fixes #10469
How to test? Go to a migrated page, you shouldn't have errors about id duplication any more

This change is Reviewable

@jolelievre jolelievre added this to the 1.7.5.0 milestone Sep 24, 2018

)
);
if (!empty($modal_module_list)) {

This comment has been minimized.

@PierreRambaud

PierreRambaud Sep 24, 2018

Contributor

With the ternary condition, $modal_module_list is never empty

This comment has been minimized.

@jolelievre

jolelievre Sep 24, 2018

Contributor

yes an empty string returns true, that's the point of the test

This comment has been minimized.

@PierreRambaud

PierreRambaud Sep 25, 2018

Contributor

Oh my bad, miss reading the diff and thinking the ternary was:

file_exists($module_list_dir . 'modal.tpl') ? $module_list_dir . 'modal.tpl' : 'modal.tpl';

This comment has been minimized.

@jolelievre

jolelievre Sep 25, 2018

Contributor

yes that was the previous ternary, but with the new template it no longer has the wanted behavior and instead of adding a modal for available modules (which does not exist in the new theme) it resulted in including the addon login modal in two different locations

@marionf

This comment has been minimized.

Contributor

marionf commented Sep 25, 2018

@jolelievre

I still have the error with your PR

capture d ecran_324

@jolelievre jolelievre changed the title from avoid displaying the addon modal twice, force form name to avoid collision to avoid displaying the addon modal twice, change form names to avoid collision Sep 26, 2018

@jolelievre jolelievre changed the title from avoid displaying the addon modal twice, change form names to avoid collision to avoid displaying the addon modal twice, change form IDs to avoid collision Sep 26, 2018

@jolelievre jolelievre changed the title from avoid displaying the addon modal twice, change form IDs to avoid collision to avoid displaying the addon modal twice, change form names/IDs to avoid collision Sep 26, 2018

@@ -34,7 +34,7 @@
{if isset($identifier_bk) && $identifier_bk == $identifier}{capture name='identifier_count'}{counter name='identifier_count'}{/capture}{/if}
{assign var='identifier_bk' value=$identifier scope='parent'}
{if isset($table_bk) && $table_bk == $table}{capture name='table_count'}{counter name='table_count'}{/capture}{/if}
{assign var='table_bk' value=$table scope='parent'}
{assign var='table_bk' value=$table scope='root'}

This comment has been minimized.

@Quetzacoalt91

Quetzacoalt91 Oct 4, 2018

Member

Reducing the visibility of this variable may break some compatibility.

This comment has been minimized.

@jolelievre

jolelievre Oct 4, 2018

Contributor

well it actually enhance it since it is visible by root and not only parent
without this the couting can't work because the two forms don't have the same immediate parent

@Quetzacoalt91

This comment has been minimized.

Member

Quetzacoalt91 commented Oct 5, 2018

One CS fixer to run and we should be good to go for QA review.

@jolelievre

This comment has been minimized.

Contributor

jolelievre commented Oct 5, 2018

@Quetzacoalt91 ok rebase and cs fixer done, just waiting for the travis build, then if you can approve it again please?

@marionf marionf self-assigned this Oct 5, 2018

@marionf marionf added QA ✔️ and removed waiting for QA labels Oct 5, 2018

@PierreRambaud PierreRambaud merged commit 6e9a0cb into PrestaShop:1.7.5.x Oct 5, 2018

1 of 2 checks passed

Codacy/PR Quality Review Hang in there, Codacy is reviewing your Pull request.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@PierreRambaud

This comment has been minimized.

Contributor

PierreRambaud commented Oct 5, 2018

Thanks @jolelievre

@jolelievre jolelievre changed the title from avoid displaying the addon modal twice, change form names/IDs to avoid collision to Avoid displaying the addon modal twice, change form names/IDs to avoid collision Oct 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment