PrestaShop icon indicating copy to clipboard operation
PrestaShop copied to clipboard

Fix: BO - Import/Export - Can't import Store contact

Open Codencode opened this issue 1 year ago • 9 comments

The problem depends on the fact that when importing store contacts, the

PrestaShopLogger->object_type property

is set with "Store contacts" which does not pass the validation of the Validate::isValidObjectClassName() method. So in this case I thought of valorising the $import_type variable with StoreContacts which passes the validation and the error no longer occurs.

Questions Answers
Branch? 8.1.x
Type? bug fix
Category? FO
BC breaks? no
Deprecations? no
UI https://github.com/florine2623/testing_pr/actions/runs/8049269672 ✅
Fixed issue or discussion? Fixes #35009

Codencode avatar Jan 11 '24 08:01 Codencode

Hi, thanks for this contribution!

I found some issues with the Pull Request description:

  • The description shouldn't be empty.
  • Your pull request does not seem to fix any issue, consider creating one (see note below) and linking it by writing Fixes #1234.

Would you mind having a look at it? This will help us understand how interesting your contribution is, thank you very much!

About linked issues

Please consider opening an issue before submitting a Pull Request:

  • If it's a bug fix, it helps maintainers verify that the bug is effectively due to a defect in the code, and that it hasn't been fixed already.
  • It can help trigger a discussion about the best implementation path before a single line of code is written.
  • It may lead the Core Product team to mark that issue as a priority, further attracting the maintainers' attention.

(Note: this is an automated message, but answering it will reach a real human)

prestonBot avatar Jan 11 '24 08:01 prestonBot

This is weird, how come the translated string works for all other types?

Oh, so isValidObjectClassName doesn't accept spaces? And all the other types that are translated work by accident? What if some language translates it with some nonsupporter character, then it also won't work.

Snímek obrazovky 2024-01-11 114555

Hlavtox avatar Jan 11 '24 10:01 Hlavtox

This is weird, how come the translated string works for all other types?

I tried in PS 8.1.2 where the strings are all single words, except 'Store contacts' which is the only one that generates the error, because there is a space between the 2 words.

Screenshot

What version of PS does your screenshot refer to? I understand to check 'Supply Orders' and 'Supply Order Details' you need to activate 'PS_ADVANCED_STOCK_MANAGEMENT'.

Yes, you are right, in case of translation with spaces it would give an error. Perhaps it would be better to set the "$import_type" variable manually.

Codencode avatar Jan 11 '24 10:01 Codencode

When I try to import it a second time, I have the initial error :

Hi @florine2623, when you import the file check if the URL in the "image" field exists, otherwise you must skip that field because this generates an error as the URL does not exist. However, now I make a change to avoid this error too.

Codencode avatar Feb 27 '24 09:02 Codencode

I uploaded a new edit to check if the store image to import actually exists.

@florine2623 can you check if you still have the error?

Codencode avatar Feb 27 '24 09:02 Codencode

QA approved, well done! Message to the maintainers: do not forget to milestone it before the merge.

prestonBot avatar Feb 27 '24 15:02 prestonBot

Hello @Codencode ,

Thanks for the update ^^

For the issue #35009 , it is fixed ✅ Tested with/without images.

Screen.Recording.2024-02-27.at.16.18.04.mov 2nd attempt, OK :

Screen.Recording.2024-02-27.at.16.23.46.mov But for the issue #34974 , there's still an error and it can be tested entirely :

Screen.Recording.2024-02-27.at.16.19.52.mov For me it is QA ✅ But the PR #34974 will need another PR to test/fix the issue.

Ok, I removed the reference to the ISSUE in the description.

Thanks!

Codencode avatar Feb 27 '24 16:02 Codencode

Hi @Codencode, can you fix the CI before we can merge the PR ?

mflasquin avatar Feb 28 '24 08:02 mflasquin

Hi @mflasquin, I fixed.

Thanks!

Codencode avatar Feb 28 '24 09:02 Codencode

thanks @Codencode

mflasquin avatar Feb 29 '24 13:02 mflasquin