Skip to content

Conversation

abhisekmazumdar
Copy link
Member

@abhisekmazumdar abhisekmazumdar commented Jul 11, 2024

Q A
Bug fix? (use the a.b branch) 🟢
New feature/enhancement? (use the a.x branch) 🔴
Deprecations? 🔴
BC breaks? (use the c.x branch) 🔴
Automated tests included? 🔴
Related user documentation PR URL mautic/user-documentation#...
Related developer documentation PR URL mautic/developer-documentation-new#...
Issue(s) addressed Fixes #13265

Description

When creating a lookup list for custom fields, it fails. I see that any custom field with an Add option, such as the Select, Multiselect Type field, is also broken.


📋 Steps to test this PR:

  1. Open this pull request (PR) on Gitpod or pull it down for local testing (see the documentation on testing PRs here).
  2. Successfully create custom fields with lookup, select, and multiselect types.
  3. Also, you will be able to edit any existing lookup, select, and multiselect type fields.

Copy link

codecov bot commented Jul 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.18%. Comparing base (c2ebb52) to head (6a23e89).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##                5.1   #13946   +/-   ##
=========================================
  Coverage     62.18%   62.18%           
  Complexity    34220    34220           
=========================================
  Files          2252     2252           
  Lines        102330   102330           
=========================================
+ Hits          63634    63635    +1     
+ Misses        38696    38695    -1     

see 1 file with indirect coverage changes

@escopecz
Copy link
Member

The problem is in the template file that generates the options. Firstly, there should be just one field per option like in M4:
Screenshot 2024-07-19 at 17 20 23
Not 2 for label and value like in M5:
Screenshot 2024-07-19 at 17 20 57
Because the lookup field doesn't have labels and values. Just the value.

The problem was most probably caused by the migration of PHP templates into Twig. This is the original template:
https://github.com/mautic/mautic/blob/4.x/app/bundles/LeadBundle/Views/Field/properties_select.html.php

And this is the Twig version:
https://github.com/mautic/mautic/blob/5.x/app/bundles/LeadBundle/Resources/views/Field/properties_select.html.twig

It doesn't behave the same. The list key is different and contains the "template" word in it. This should have been replaced in JS.

Do you think this will help to move your investigation further?

@abhisekmazumdar abhisekmazumdar force-pushed the bugfix/create-lookup-list-custom-fields branch from 13a6297 to 4687dd5 Compare July 23, 2024 08:18
@abhisekmazumdar abhisekmazumdar marked this pull request as ready for review July 23, 2024 08:20
@abhisekmazumdar
Copy link
Member Author

@escopecz Your inputs helped me look in the right direction. Thank you.

I compared M4 vs. M5 and found what's wrong with the generated selectTemplate variable.

@escopecz escopecz added bug Issues or PR's relating to bugs custom-fields Anything related to custom fields labels Jul 23, 2024
Copy link
Member

@escopecz escopecz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing! Works!
Screenshot 2024-07-23 at 17 32 17
Screenshot 2024-07-23 at 17 32 38

@escopecz escopecz added code-review-passed PRs which have passed code review user-testing-passed PRs which have been successfully tested by the required number of people. labels Jul 23, 2024
@escopecz escopecz added this to the 5.1.1 milestone Jul 23, 2024
@escopecz escopecz merged commit de330c4 into mautic:5.1 Jul 23, 2024
16 checks passed
escopecz added a commit that referenced this pull request Jul 26, 2024
* Improve grammar for unhide (#13835)

* Improve grammar for unhide

* Fix test

* fix: LeadBundle template errors (#13862)

Co-authored-by: Ruth Cheesley <ruth@ruthcheesley.co.uk>

* [UI] fix CSS flexbox broken in campaign insert clone view (#13878)

* [UI] Replaces table action button `arrow-down` with `more-2` icon (#13841)

* [UI] Replaces table action button `arrow-down` with `more-2` icon

This replaces the icon for the action toggle button in tables (e.g. contact list table or segment list table) with a 3 dot icon.

The previous arrow down icon indicates that an collapsed element would get unfolded/shown. This is not the case in these tables. The button shows more actions. In any UI that I know a 3 dot icon is used for that.

The arrow down icon would be more suitable if it would show more details on click. Hence, this PR.

* TASK: Reverts change for `page_actions.html.twig`

Co-authored-by: Anderson, from Dropsolid <116097999+andersonjeccel@users.noreply.github.com>

---------

Co-authored-by: Anderson, from Dropsolid <116097999+andersonjeccel@users.noreply.github.com>

* add js code to hide profile pic if missing (#13838)

* Segment membership as a new filter for dynamic email content (#13528)

* Merge pull request #1088 from mautic-inc/MAUT-4688

Maut 4688 - Use segment membership as a filter for dynamic content in email

* Changes needed after rebase to M5

* Merge pull request #1407 from acquia/MAUT-5729

MAUT-5729 Dynamic Content Error - Segment Membership filter not showing correct content

* Fixing STAN

* CS fixes

* Test fix

* test fix part 2

* Adding back JS methods removed in a bad conflict resolution

---------

Co-authored-by: Lukáš Drahý <lukas@drahy.net>
Co-authored-by: Rohit Pavaskar <66303837+rohitp19@users.noreply.github.com>
Co-authored-by: Ruth Cheesley <ruth@ruthcheesley.co.uk>

* [UI] Increased icon size (#13825)

* increased icon size

* decrease by 1px

* Make the search regular expression match both "&" and "&amp;" for link replacement within an email body (#13858)

* Guide users to build optimized segments (#13860)

* Merge pull request #2172 from acquia/MAUT-11343

MAUT-11343 : Guide users to build optimized segments

* fix twig file issue

* Apply suggestions from code review

Co-authored-by: John Linhart <admin@escope.cz>

* push suggested changes

---------

Co-authored-by: John Linhart <admin@escope.cz>

* fix CSS flexbox broken in campaign insert clone view

* Revert "[UI] Replaces table action button `arrow-down` with `more-2` icon (#13841)"

This reverts commit fadcf26.

* Revert "Segment membership as a new filter for dynamic email content (#13528)"

This reverts commit 71031b7.

* Revert "[UI] Increased icon size (#13825)"

This reverts commit c00df3c.

* Revert "Make the search regular expression match both "&" and "&amp;" for link replacement within an email body (#13858)"

This reverts commit d3e6ceb.

* Revert "Guide users to build optimized segments (#13860)"

This reverts commit bdabc26.

* Revert "add js code to hide profile pic if missing (#13838)"

This reverts commit 76dd7d6.

---------

Co-authored-by: putzwasser <26040044+putzwasser@users.noreply.github.com>
Co-authored-by: John Linhart <admin@escope.cz>
Co-authored-by: Lukáš Drahý <lukas@drahy.net>
Co-authored-by: Rohit Pavaskar <66303837+rohitp19@users.noreply.github.com>
Co-authored-by: Ruth Cheesley <ruth@ruthcheesley.co.uk>
Co-authored-by: Miroslav Fedeleš <miroslav.fedeles@gmail.com>
Co-authored-by: Saurabh Gupta <48244990+dadarya0@users.noreply.github.com>

* DPMMA-1020 Fix search email with special characters in campaign action (#10306)

* fix: [DPMMA-1020] fix getLookupChoiceListAction for search with special characters

* fix: [DPMMA-1020] phpstan

* fix: focus item published (#13944)

* Update .gitpod.Dockerfile 5.1 branch (#13955)

* fix [DPMMA-2661] mapped field form 5.1 (#13938)

* fix: [DPMMA-2661] Correct form mapper Mautic 5

* feat: [DPMMA-2661] Correct CSFixer

* FIX: Removes onConfigSave which invokes htmlspecialchars and escapes tracking script (#13859)

This fixes #13355

This removes the HTML escaping logic in the onConfigSave method of `ConfigSubscriber`. This change prevents the UI from displaying escaped HTML in the custom tracking JS field after saving the form.

Previously, the form erroneously escaped HTML entities. By removing this code, users will now see the original HTML as expected when they revisit the form.

The main issue, however, was that re-saving  meant saving escaped HTML which would break inserting the tracking HTML code.

**Before**
1. Add custom HTML in `Configuration > Landing Page Settings > Analytics script (i.e. Google Analytics) `
2. Save
3. Open this view again → see escaped HTML
4. Save again
5. Open a landing page and see escaped HTML tracking code injected.

**After**
1. Add custom HTML in `Configuration > Landing Page Settings > Analytics script (i.e. Google Analytics) `
2. Save
3. Open this view again → see unescaped HTML
4. Save again
5. Open a landing page and see correct HTML tracking code injected.

* rename from tweet to tweets (#13967)

* Fix: Create custom fields for lookup list. (#13946)

* FIX: Makes `anniversary` date filter compatible with datetime (#13871)

* FIX: Makes `anniversary` date filter compatible with datetime

* TASK: Fix unit test

* FIX: $expectedResult docstring

---------

Co-authored-by: Ruth Cheesley <ruth@ruthcheesley.co.uk>
Co-authored-by: Frettyl <173093231+Frettyl@users.noreply.github.com>
Co-authored-by: Anderson, from Dropsolid <116097999+andersonjeccel@users.noreply.github.com>
Co-authored-by: putzwasser <26040044+putzwasser@users.noreply.github.com>
Co-authored-by: Lukáš Drahý <lukas@drahy.net>
Co-authored-by: Rohit Pavaskar <66303837+rohitp19@users.noreply.github.com>
Co-authored-by: Miroslav Fedeleš <miroslav.fedeles@gmail.com>
Co-authored-by: Saurabh Gupta <48244990+dadarya0@users.noreply.github.com>
Co-authored-by: Patryk Gruszka <patryk.gruszka@comarch.pl>
Co-authored-by: Tomasz Kowalczyk <39382654+tomekkowalczyk@users.noreply.github.com>
Co-authored-by: Martin Vooremäe <martin.vooremae@gmail.com>
Co-authored-by: Abhisek Mazumdar <abhisekmazumdar@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues or PR's relating to bugs code-review-passed PRs which have passed code review custom-fields Anything related to custom fields user-testing-passed PRs which have been successfully tested by the required number of people.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants