PrestaShop / PrestaShop

PrestaShop is the universal open-source software platform to build your e-commerce solution.
https://www.prestashop-project.org/
Other
8.24k stars 4.81k forks source link

SQL Manager allows saving wrong query #13930

Open zuk3975 opened 5 years ago

zuk3975 commented 5 years ago

Describe the bug In Advanced parameters > Database > Sql Manager > Add new SQL query when i add query that is not working, it lets me save it. For example I am able to write random string in query like 'my random query', which doesn't do anything. Later if i want to export it, i get an unexpected error.

To Reproduce Steps to reproduce the behavior:

  1. Go to Advanced parameters > Database > Sql Manager > Add new SQL query
  2. Fill query name for example 'test'.
  3. Fill query with any string, for example 'my invalid query test'
  4. Save and see that it lets you save the query that is invalid.
  5. Try to export that query by clicking cloud icon in list and see unexpected error (last screenshot)

Screenshots Screenshot from 2019-05-23 10-02-44 Screenshot from 2019-05-23 10-03-10 Screenshot from 2019-05-23 10-05-11

Additionnal information PrestaShop version: 1.7.6.x PHP version: N/A

zuk3975 commented 5 years ago

In addition, when trying to save wrong query, the exception message should be user-friendly, explaining what is wrong, for example 'Invalid query syntax'. As this is really expected for user to make mistakes.

khouloudbelguith commented 5 years ago

Hi @zuk3975,

I have the same issue with PS1.7.6.0beta1. PS: in the PS1.7.5.2, when we click on "Export" or "View" we don't have any exception. I’ll add this to the debug roadmap. Thanks!

zuk3975 commented 5 years ago

One important thing to one who will fix this issue. There is also one typo mistake to fix in SqlManagerController IndexAction. Check the screenshot bellow. ( need to change RequestSql:create to SqlManager:create. Screenshot from 2019-05-23 11-07-45

florine2623 commented 2 years ago

Hello @zuk3975 ,

In 8.0.0, I don't have the exception anymore. I can create a wrong query, I will be able to Export it to PDF with no exception. There's just nothing on the PDF:

https://user-images.githubusercontent.com/16019289/193793683-b2432ea6-7693-42c5-aae4-37b7f3bc7ddd.mov

Should we modify this bug or should we change it to a feature request ? Waiting for PM decision ^^

Thanks!