Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

PSCleaner module should not clean paypal data #56

Open
Daaaaad opened this issue Nov 12, 2020 · 12 comments
Open

PSCleaner module should not clean paypal data #56

Daaaaad opened this issue Nov 12, 2020 · 12 comments

Comments

@Daaaaad
Copy link

Daaaaad commented Nov 12, 2020

Hello, when I try to "delete orders & customers" with the PayPal (v5.2.1) official module installed and activated I get an exception :

Table 'database.ps_paypal_customer' doesn't exist<br /><br /><pre>TRUNCATE TABLE `ps_paypal_customer`</pre>
at line 769 in file classes/db/Db.php
  • PrestaShop version: 1.7.6.7
  • PHP version: 7.2
  • Pscleaner version: v2.1.0

EDIT

It seems PSCleaner module clean paypal data but it does not work with latest Paypal module release.

@hibatallahAouadni
Copy link

Hello @Daaaaad

It seems that your issue is not a PrestaShop core bug.
If your module is PayPal Official, please contact support team on Addons

We will close this issue.

Thanks!

@Daaaaad
Copy link
Author

Daaaaad commented Nov 12, 2020

Hi @hibatallahAouadni,

There is an existing github project ➡️ https://github.com/PrestaShop/pscleaner but issues have to be reported here, am I wrong? 🤔

Regards,

David.

@hibatallahAouadni
Copy link

Hello @Daaaaad

Have you tried to contact the Paypal module developer? what he did respond if so?

Thanks!

@Daaaaad
Copy link
Author

Daaaaad commented Nov 12, 2020

@hibatallahAouadni I don't think it's a bug coming from the PayPal module.

The pscleaner module try to clean a table that do not exists anymore in the last version of the PayPal module...

@matks
Copy link
Contributor

matks commented Nov 12, 2020

The pscleaner module attempts to clean paypal tables see https://github.com/PrestaShop/pscleaner/blob/dev/pscleaner.php#L274

case 'sales':
                $tables = self::getSalesRelatedTables();

                $modules_tables = array(
                    'sekeywords' => array('sekeyword'),
                    'pagesnotfound' => array('pagenotfound'),
                    'paypal' => array('paypal_customer', 'paypal_order')
                );

                foreach ($modules_tables as $name => $module_tables) {
                    if (Module::isInstalled($name)) {
                        $tables = array_merge($tables, $module_tables);
                    }
                }

                foreach ($tables as $table) {
                    $db->execute('TRUNCATE TABLE `'._DB_PREFIX_.bqSQL($table).'`');
                }
                $db->execute('DELETE FROM `'._DB_PREFIX_.'address` WHERE id_customer > 0');
                $db->execute('UPDATE `'._DB_PREFIX_.'employee` SET `id_last_order` = 0,`id_last_customer_message` = 0,`id_last_customer` = 0');

                break;

@Daaaaad it seems this clean only happen if the PayPal module is installed, so it seems to make sense. On your shop why do you have the Paypal module installed but no Paypal tables ?

@Daaaaad
Copy link
Author

Daaaaad commented Nov 12, 2020

Hi @matks,

Yes as I told in my first message I do have the PayPal module installed and activated 😉

But... I definitely can't find the "paypal_customer" table on a fresh install of the PayPal module (v5.2.1) 🤔

I do have other tables :

ps_paypal_capture
ps_paypal_ipn
ps_paypal_order
ps_paypal_processlogger
ps_paypal_vaulting

But no "paypal_customer" 😔

@matks
Copy link
Contributor

matks commented Nov 12, 2020

Maybe Paypal released a new version of their module and it does not have this table anymore.

Anyway I think the root issue is that pscleaner should NOT clean tables not related to PS Core.

@Daaaaad
Copy link
Author

Daaaaad commented Nov 12, 2020

@matks It could be useful to also clean customer related data stored in tables created by other modules...

But in this case we have to track every upgrades of those modules to update the data to clean 🤔 And it's a lot of work.

@matks
Copy link
Contributor

matks commented Nov 12, 2020

But in this case we have to track every upgrades of those modules to update the data to clean 🤔 And it's a lot of work.

Indeed, and it's hard to know which data can be safely deleted or not. Too risky to do it I believe 🤔 better "not modify" a data we are not sure we can clean that deleting sensible store data 😅

So I think we can modify this GitHub issue to re-scope it in "PSCleaner should not clean paypal data"

@matks matks changed the title Table 'ps_paypal_customer' doesn't exist in Pscleaner module PSCleaner module should not clean paypal data Nov 12, 2020
@matks matks reopened this Nov 12, 2020
@Daaaaad
Copy link
Author

Daaaaad commented Nov 12, 2020

@matks The question is: Will the PayPal module still work if we clean all customers and orders data? It seems to keep (or have kept al least) some references in their own database tables 🤔

@matks
Copy link
Contributor

matks commented Nov 12, 2020

@matks The question is: Will the PayPal module still work if we clean all customers and orders data? It seems to keep (or have kept al least) some references in their own database tables 🤔

PSCleaner, if I am not wrong, is supposed to be "the module you use when you setup a shop and want to clean the Demo products and data that are loaded to "populate" a little your BO". So in theory no Paypal data should be concerned 😅

@Daaaaad
Copy link
Author

Daaaaad commented Nov 12, 2020

@matks If you want to properly test your shop you also have to test payment methods 😛

@PierreRambaud PierreRambaud transferred this issue from PrestaShop/PrestaShop Feb 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants