Skip to content

#31764: Improve check on field prefix #31765

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

Closed
wants to merge 2 commits into from
Closed

#31764: Improve check on field prefix #31765

wants to merge 2 commits into from

Conversation

DavaGordon
Copy link

Description (*)

This change prevents magento throwing exception when filtering customer admin grids due to a column not having a the prefix of main_table.

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes main_table prefix on exception company_name #31764

Manual testing scenarios (*)

  1. Login to admin panel
  2. Customer > All Customers
  3. Show company name column
  4. Filter by company name

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Jan 19, 2021

Hi @DavaGordon. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@DavaGordon
Copy link
Author

@magento run all tests

@m2-community-project m2-community-project bot added Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Severity: S1 Affects critical data or functionality and forces users to employ a workaround. labels Jan 19, 2021
@DavaGordon
Copy link
Author

@magento run all tests

@danielrussob
Copy link

@magento give me test instance

@magento-deployment-service
Copy link

Hi @danielrussob. Thank you for your request. I'm working on Magento instance for you.

@danielrussob
Copy link

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @danielrussob. Thank you for your request. I'm working on Magento instance for you.

@danielrussob
Copy link

danielrussob commented Jan 20, 2021

As linked from @gabrieldagama

List of tests failing:
AdminAddRemoveDefaultVideoGiftCardProductTest
AdminAddRemoveDefaultVideoVirtualProductTest
AdminAddRemoveDefaultVideoBundleProductTest
StorefrontGalleryConfigurableProductWithVisualSwatchAttributePrependMediaTest
StorefrontGalleryConfigurableProductWithSeveralAttributesPrependMediaTest

@magento-deployment-service
Copy link

@magento-deployment-service
Copy link

@danielrussob
Copy link

@magento give me new instance with edition b2b

@magento-deployment-service
Copy link

Hi @danielrussob. Thank you for your request. I'm working on Magento instance for you.

@danielrussob
Copy link

@magento give me test instance with edition b2b

@magento-deployment-service
Copy link

Hi @danielrussob. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

Hi @danielrussob, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

@magento-deployment-service
Copy link

@danielrussob
Copy link

Hello @DavaGordon DavaGordon, Thank you for your contribution
on the instance of b2b based on your PR, there is no problem but
on the instance of Community Edition based on your PR (give me test instance) there's a problem on Customer CRUD grid

the edit button under "Action" column (in the grid) is missing

and accessing directly to INSTANCEURL/customer/index/edit/id/1/

just tab Customer View is present and other tabs are missing

this instance go to 503 rhythmically, I don't know if it was a problem with Magento Cloud (error on s:d:c or similar) or with your PR

I will test it again later

@danielrussob
Copy link

@magento give me test instance

@magento-deployment-service
Copy link

Hi @danielrussob. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@DavaGordon
Copy link
Author

Hello @DavaGordon DavaGordon, Thank you for your contribution
on the instance of b2b based on your PR, there is no problem but
on the instance of Community Edition based on your PR (give me test instance) there's a problem on Customer CRUD grid

the edit button under "Action" column (in the grid) is missing

and accessing directly to INSTANCEURL/customer/index/edit/id/1/

just tab Customer View is present and other tabs are missing

this instance go to 503 rhythmically, I don't know if it was a problem with Magento Cloud (error on s:d:c or similar) or with your PR

I will test it again later

@danielrussob the issues you raised i have tested locally and was unable to replicate on a magento-cloud docker instance.
As part of my testing I set this up on a community based version and ee edition and can confirm that this fix raises no issues as the fix specifically relates to the customer grid functionality all other pages extend from the base method.

If you have any questions please feel free to drop me a message.

@danielrussob
Copy link

@magento give me test instance

@magento-deployment-service
Copy link

Hi @danielrussob. Thank you for your request. I'm working on Magento instance for you.

@danielrussob
Copy link

@magento give me 2.4-develop instance with edition b2b

@magento-deployment-service
Copy link

Hi @danielrussob. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@magento-deployment-service
Copy link

@danielrussob
Copy link

We (@DavaGordon and Me) have tested the issue on Magento 2.4-develop vanilla with b2b and we are not able to reproduce the issue

@sdzhepa We are chatting about the option to replace in any case app/code/Magento/Customer/Model/ResourceModel/Grid/Collection.php:84 , beacuse this new change could be a better solution in long term, can we discuss about quality?

@DavaGordon
Copy link
Author

As per our conversation in regards to the code quality at this moment in time to code has no checks in place to see if the field exists within the main_table (customer_grid_flat).

My recommendation is to check the index to see if the column exists if it does prepend main_table. on the front of it as the records exists.

$this->getFulltextIndexColumns()

Result

Array
(
    [0] => name
    [1] => email
    [2] => created_in
    [3] => taxvat
    [4] => shipping_full
    [5] => billing_full
    [6] => billing_firstname
    [7] => billing_lastname
    [8] => billing_telephone
    [9] => billing_postcode
    [10] => billing_region
    [11] => billing_city
    [12] => billing_fax
    [13] => billing_company
)

Prior to this fix we were getting the following error

Unknown column 'main_table.company_name'

After implementation it was able to check that the column was not present in customer_grid_flat and was able to get the data date from the correct source in this case the company table previously left joined

Tested
Magneto EE/CE
Version: 2.3.6 / 2.4.0

@gabrieldagama
Copy link
Contributor

@magento give me 2.4-develop instance with edition b2b

@magento-deployment-service
Copy link

Hi @gabrieldagama. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@DavaGordon
Copy link
Author

After further investigation and collaboration with @gabrieldagama we found the cause for the issue could possibly be when a new collection with an add a join from a field from the custom table to the customer grid collection, and try to filter the collection with that field.

@gabrieldagama gabrieldagama added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. and removed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. labels Feb 18, 2021
@aleron75
Copy link
Contributor

@magento run Functional Tests CE

@danielrussob
Copy link

@magento run Functional Tests B2B

@danielrussob
Copy link

@magento run Functional Tests CE

@aleron75 aleron75 added Cleanup and removed Cleanup labels Apr 13, 2021
@ishakhsuvarov
Copy link
Contributor

Closing this for now as tests had been red for a long time with no updates.

Please feel free to reopen if you still want to continue working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Award: bug fix Component: Customer Partner: Maginus Partner Maginus contribution partners-contribution Pull Request is created by Magento Partner Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Release Line: 2.4 Severity: S1 Affects critical data or functionality and forces users to employ a workaround.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

main_table prefix on exception company_name
6 participants