Prestashop: Creating a once deleted currency causes duplicate rows in database

Created on 14 Oct 2019  路  8Comments  路  Source: PrestaShop/PrestaShop

Describe the bug
When a currency is added in PrestaShop it is impossible to add it a second time, thus it prevent having duplicate
However if you delete a currency and then add it again a new row is inserted and the former one is still present with its deleted column set to 1 (soft delete)
This means the database has duplicated rows, and that different orders with the same currency do not use the same one in database

To Reproduce

  1. Go to Internationalisation > Localization > Currencies
  2. Add a new currency (for example AUD)
  3. Go back to the currencies list and delete the newly created currency
  4. In your database you will see that the row is still present but the deleted column is now equal to 1
  5. Recreate this same currency (AUD)
  6. Now if you check you database will see two rows for the same AUD currency (one is deleted, not the other)

Expected behaviour
Rather than adding a new row in database, the previously deleted one should be updated (use the data from the creation form to update its content) AND most importantly its deleted value should be revert back to 0 thus avoiding creating duplicate rows

Additional information
PrestaShop version: N/A
PHP version: N/A

1.7.5.2 1.7.6.1 Bug Currencies Fixed Minor

All 8 comments

Hi @jolelievre,

Same issue with PS1.7.5.2 & PS1.7.6.1.
image

Thanks!

@matthieu-rolland @jolelievre what's the status of this issue ?

It's done, but it needs to be rebased I'm on it

Fixed by #16287

ping @matthieu-rolland
This PR : #16287 seems to have corrected the described bug in this issue but another scenario reproduces the error.

Step to reproduce :

  • Go to Internationalisation > Localization > Currencies
  • Add a new currency (for example USD)
  • Go back to the currencies list and delete the newly created currency
  • Download the "added and deleted" curreny localisation pack
  • A second row in database is created

#ISSUE #15934 Creating a once deleted currency causes duplicate rows in database

Nice catch @SD1982 !!
But since it's another scenario I suggest creating a new issue, something like "Importing a currency from a localization pack duplicates a currency in database when previously deleted"

Indeed this is another feature related to localisation pack so it doesn't use the new handlers used in the dedicated form

ping @khouloudbelguith

Was this page helpful?
0 / 5 - 0 ratings