Skip to content
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

MAUT-11616 : Fix operators do not refresh after selecting a different type of field in campaign event #356

Merged
merged 7 commits into from
Jul 11, 2024

Conversation

rahuld-dev
Copy link
Contributor

@rahuld-dev rahuld-dev commented Jul 2, 2024

Q A
Bug fix? (use the a.b branch) Yes
New feature/enhancement? (use the a.x branch) No
Deprecations? No
BC breaks? (use the c.x branch) No
Automated tests included? Yes
Related user documentation PR URL mautic/mautic-documentation#...
Related developer documentation PR URL mautic/developer-documentation#...
Issue(s) addressed https://acquia.atlassian.net/browse/MAUT-11616

Description:

Campaign → Condition → Custom Object field values : Operators do not refresh after selecting a different type of field.

In the custom objects, the operators related to the Top most field of Custom objects get loaded when we open this form. Upon changing the field, the operators do not refresh/update as we see in Campaign → condition → Contact Field values form.

Steps to test this PR:

  1. Open this PR for testing locally (see docs on testing PRs here)
  2. Go to Campaign builder and select Condition → Custom Object field values
  3. Verify that on change field value operator should be change as per the field type.

@rahuld-dev rahuld-dev changed the title WIP MAUT-11616 : Fix operators do not refresh after selecting a different type of field in campaign event MAUT-11616 : Fix operators do not refresh after selecting a different type of field in campaign event Jul 4, 2024
@rahuld-dev rahuld-dev requested review from a team, pagupt, aarohiprasad and avikarshasaha and removed request for a team and pagupt July 5, 2024 09:01
Copy link
Contributor

@avikarshasaha avikarshasaha left a comment

Choose a reason for hiding this comment

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

In line 51, we are looping to create choices; hence, my suggestion is to do it within so that we are not repeating the same data.

@rahuld-dev rahuld-dev requested a review from avikarshasaha July 8, 2024 14:07
Copy link
Contributor

@aarohiprasad aarohiprasad left a comment

Choose a reason for hiding this comment

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

Code looks good. Tested on local with the following fields:

  1. Number
  2. Text
  3. Date
  4. Select
    The operators are being refreshed correctly

@rahuld-dev rahuld-dev merged commit 089ab33 into staging Jul 11, 2024
3 checks passed
@rahuld-dev rahuld-dev deleted the MAUT-11616 branch July 11, 2024 12:14
@rahuld-dev rahuld-dev restored the MAUT-11616 branch July 18, 2024 13:15
escopecz added a commit that referenced this pull request Jan 13, 2025
* PHPStan fix again

* PHPStan

* PHPStan

* PHPStan

* Update README.md

* Remove PUT from the available item operations for the custom_objects endpoint.

* as PUT method is removed we are using PATCH insted

* fix segement filter issue in custom object

* fix test cases

* add code coverage

* fix phpstan issue

* fix failing test case

* fixing patch request

* skip setDefaultValuesForMissingFields for patch request

* adding comment

* updating note for implementation

* Fix warnings in test suite for PHP8.0 upgrade

* Remove unused import

Co-authored-by: Saurabh Gupta <[email protected]>

* check lead exist before link to custom item

* fixed tests

* adding tests

* removed php8 only compatibal code

* change warning type

* correct message

* changed warning type

* fix tests

* check for method exists and csfix

* Add merge filter query

* Remove const is defined check

* Fix test case by adding config param

* Add function to check if custom object filters are mergable

* Revert CustomFieldFilterQueryBuilder

* Update services

* Add CustomObjectMergedFilterQueryBuilder

* Use CustomObjectMergedFilterQueryBuilder

* Check for custom item filter

* Change merge filter logic

* Make consts

* Fix test cases

* Test with custom_object_merge_filter param

* Move test to appropriate class name

* Rename test case

* Rename test case

* Revert unnecessary code

* Remove union return type declaration in favour of PHP7.4

* Remove not exists in favour of negative filters

* Fix contact not getting added when one segment filter is used

* fix dependencies

* add parent constructor call

* remove duplicate dependencies; change deprecated methods

* fix inserting variable into string

* fix an event dispatching issue

* fix import with contact ids

* fix the allowed memory size exhausted issue

* fix the inheritance model issue

* Handling custom item links when merging contacts

* Adding GH Actions config

* Adding PHPSTAN Baseline for existing issues

* Remove dead code flagged by Rector

* Fixing PHPUNIT config

* Debugging tests

* PHPSTAN baseline for each PHP version

* Fixing tests

* Some tests require theofidry/alice-data-fixtures

* Test gh-actions

* tests.yaml update

* PHPSTAN baseline (debug) update

* Comment PHPUNIT TESTS

* Comment Coverage Report step

* skip test

* skip test

* revert

* print commit id

* Push commit to mc-cs

* Push commit to mc-cs

* Push commit to mc-cs

* Push commit to mc-cs

* Push commit to mc-cs

* Push commit to mc-cs

* static analysis add

* Moving Install composer up and comment phpstan baseline

* Upgrade php and mysql version

* Uncoomment PHPSTAN step

* comment phpstan

* Debug: regenerating PHPSTAN baseline

* Updating PHPSTAN baseline, enabling PHPSTAN check

* Clearing up the baseline files to generate them from scratch

* Running PHPSTAN with fresh baselines

* Updating action versions to avoid NodeJS warnings

* Removing the pull_request settings hoping the CI will run on the commit without merging to staging

* Disabling composer cache as theofidry/alice-data-fixtures doesn't seem to be present

* Would it help to run the commands separately?

* Or lock the version?

* The dependency must be also set in kernel. Let's skip the tests that need it for now

* The coverage report contains whole Mautic. Testing something different

* Fixing kernel class

* Another attempt to resolve the kernel class issue

* Do we need to set KERNEL_CLASS?

* Check API request by the controller name

* fix customobject fetch from typeoparatorprovider

* split into 2 line

* var name change

* empty and neq operator fixed

* pass true for $filterAlreadyNegated only from CustomFieldFilterQueryBuilder

* CustomItemRelationQueryBuilderTestCase was not included within the test suite as its name didn't end with "Test"

* Added functional tests for "not equal" and "empty" operators

* adding KERNEL_CLASS

* fixing test

* fixing tests

* Update Tests/Functional/Segment/Query/Filter/NegativeOperatorFilterQueryBuilderTest.php

Co-authored-by: Avikarsha Saha <[email protected]>

* enabling phpstan and fixed issues

* I think composer install should run after install mautic

* removed dependacy install after mautic installation

* removed vendor from scanDirectories from neon file

* added between/not between operator for date type field

* fix sonar issue

* add functional test case

* fix syntax

* fix issue for development branch failing

* Adding inTheLast and inTheNext operator for dat and datetime type fields

* Fixed CampaignConditionTest

* phpstan-ignore

* phpstan-ignore

* Comments for workarounds

* CS fixes

* NegativeOperatorFilterQueryBuilderTest fixed

* NegativeOperatorFilterQueryBuilderTest fixed

* Update Helper/QueryFilterHelper.php

Co-authored-by: Aarohi Prasad <[email protected]>

* fixc s

* fix date issue if empty/not empty filter is used

* fixed UI for between op, test case WIP

* fix phpstan

* Functioning code and test case for custom item between query for numbers

* better handling of types

* php7.4 syntax

* removed php 8 only syntax

* added test case for where assertion

* fix failing test case

* removed extra parameter

* syntax changes

* Env variable MAUTIC_PROJECT_VERSION introduced

* TypeError : str_starts_with() fixed

* fix same for merged filter too

* change variable names

* fixed failing test

* fix not beetween issue

* skip for 4.4

* skip for 4.4 csfix

* skip for 4.4 csfix

* skip for 4.4 csfix

* 7.4 syntax

* stan fix

* stan fix

* stan fix

* fixes phpstan

* skip phpstan

* removing ingnore comment

* removing unnecessary array filter

* Hide the new operators from campaign condition, leave them for segment fitlers

* Fixing operators also for int field types

* cast string

* test

* MAUT-11616 : Fix operators do not refresh after selecting a different type of field in campaign event (#356)

* fix Operators do not refresh after selecting a different type of field

* csfix

* adding test which verify the data-operators attr is available

* fix phpstan

* fix tests

* suggessions

* MAUT-11617 : Campaign -> Condition -> Custom Object Field values : Date picker unavailable for Date type fields (#357)

* fix Operators do not refresh after selecting a different type of field

* csfix

* adding test which verify the data-operators attr is available

* fix phpstan

* fix tests

* datepicker for date and datetime fields

* using const type for fieldType

Co-authored-by: Miroslav Fedeleš <[email protected]>

* suggessions

* ifx value should not be empty after change operator

---------

Co-authored-by: Miroslav Fedeleš <[email protected]>

* Replaced logger with monolog.logger.mautic (#355)

* MAUT-11515 : Custom object date segment filters should have have same operators than date custom field filters (#358)

* added all date/datetime filters to custom oject date fields

* check if getcontext is exist

* Added new function instead changing old one

* change if condition sequence

* increase code coverage

* skip test case if mrunning on mautic 4.4

* Maut 11460: Dynamic content in email builder filtered on custom object values (#352)

* on replacement

* fix test

* test

* test

* test

* fix

* skiped for 4.4

* WIP

* refining

* test case

* test refine

* fix test case

* fix test case

* split lines

* CR

* unnecessary query remove

* check isset

* local cache

* key with id

* test cases

* Update EventListener/TokenSubscriber.php

Co-authored-by: John Linhart <[email protected]>

* Update EventListener/TokenSubscriber.php

Co-authored-by: John Linhart <[email protected]>

* WIP

* string concat

* match logic for CO

* test case

* test case csfix

* test case csfix

* const

* var in config

* fix null case for datetime

* cs fix

* fix for select and multi select

* for noraml lead field

* test case

* split line

* test case

* fix for like and select

---------

Co-authored-by: Avikarsha Saha <[email protected]>
Co-authored-by: John Linhart <[email protected]>

* Update Entity/CustomFieldOption.php

Co-authored-by: GuzmanBellon <[email protected]>

* Fix EventDispatcher calling

* Fix deprecated fetchColumn call

* Use appropriate service to run a command in the test

* Add #[AllowDynamicProperties] attribute to allow using dynamic properies

* Fix tests of controllers

* Fix test of controllers

* Fix controller tests

* Fix controller tests

* Fix model tests

* Fix listener tests

* Fix Form tests

* Fix controller tests

* Fix repository tests

* Fix functional tests

* Fix functional tests

* Add a required field to fixtures

* Fix created objects for testing

* Fix pagination

* Remove commented code

* MAUT-11383 : incorrect date value being calculating when the segment filter value is "yesterday" and operator is "gt" for date field (#359)

* Fix custom parameter date issue

* add more test case

* Fix config after merging

* Fix a variable name

* Fix tests after merging

* Update dependencies

* Get the export directory using the config

* CS fixing

* Remove unnesessary constant definition

* Fix tests

* Use master request instead of deprecated

* Change phpunit configuration

* CS fixing

* PHPstan fixes

* PHPStan fixes some ORM deprecations

* Add phpstan baseline

* Fix rector issues

* Update phpstan baseline

* Fix rector issues

* Fix tests after fixing rector failures

* Fix rector failures

* Temporary set a parameter to allow the pipeline to continue even if Rector fails

* Remove the CI Rector's temporary setting

* Fix rector issues

* Add a CI setting to crate a writable directory

---------

Co-authored-by: Don Gilbert <[email protected]>
Co-authored-by: Donald Gilbert <[email protected]>
Co-authored-by: Tejas Navghane <[email protected]>
Co-authored-by: Rohit Pavaskar <[email protected]>
Co-authored-by: rahuld-dev <[email protected]>
Co-authored-by: Saurabh Gupta <[email protected]>
Co-authored-by: Saurabh Gupta <[email protected]>
Co-authored-by: Rahul Dhande <[email protected]>
Co-authored-by: Himanshu Prajapati <[email protected]>
Co-authored-by: John Linhart <[email protected]>
Co-authored-by: John Linhart <[email protected]>
Co-authored-by: aadarshjain-dev <[email protected]>
Co-authored-by: fedys <[email protected]>
Co-authored-by: Avikarsha Saha <[email protected]>
Co-authored-by: Avikarsha Saha <[email protected]>
Co-authored-by: Aarohi Prasad <[email protected]>
Co-authored-by: GuzmanBellon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants