Skip to content

Add date_add, date_upd, soft delete and notification send time - #120

Open
lmeyer1 wants to merge 10 commits into
PrestaShop:devfrom
lmeyer1:feat-db
Open

lmeyer1 wants to merge 10 commits into
PrestaShop:devfrom
lmeyer1:feat-db

Conversation

@lmeyer1

@lmeyer1 lmeyer1 commented Nov 4, 2022

Copy link
Copy Markdown
Contributor
Questions Answers
Description? Add fields to the table ps_mailalert_customer_oos, in order for merchant to be able to analyze customer needs and behavior.
Type? improvement
BC breaks? no
Deprecations? no
Fixed ticket? Fixes PrestaShop/PrestaShop#30186. Prerequisite for #28233.
How to test? Email alerts for customers should just work the same way as before.

There are these improvements in the db:

  • when a customer subscribes to an alert, the time is saved to date_add
  • when a notification is sent out, the time is saved to notification_sent and the line is soft-deleted.
  • the notification is soft deleted on customer request or when a product is deleted
  • if the customer requests deletion of his data through gdpr, the email address is anonymized.

@lmeyer1 lmeyer1 closed this Nov 4, 2022
@lmeyer1 lmeyer1 reopened this Nov 4, 2022
@marsaldev marsaldev added this to the 2.4.1 milestone Nov 18, 2022
Comment thread ps_emailalerts.php
Comment thread upgrade/upgrade-2.3.4.php Outdated
Comment thread MailAlert.php Outdated
@marsaldev

Copy link
Copy Markdown
Contributor

The soft delete is very interesting 👍, let's understand how to manage on legal side tho

@lmeyer1

lmeyer1 commented Nov 18, 2022

Copy link
Copy Markdown
Contributor Author

The soft delete is very interesting 👍, let's understand how to manage on legal side tho

I missed to delete all customer data. But once this is fixed, there should not remain any legal problem. Don't you think ?

Comment thread upgrade/upgrade-2.3.4.php Outdated
Comment thread MailAlert.php Outdated
@marsaldev

Copy link
Copy Markdown
Contributor

Waiting for you @lmeyer1 😉

@Hlavtox Hlavtox modified the milestones: 2.4.1, 2.4.2 Mar 23, 2023
@MatShir MatShir removed the waiting for author Waiting for author label Jun 15, 2023
@jf-viguier

Copy link
Copy Markdown
Contributor

This PR is blocking 2.4.2 release.

LouisAUTHIE
LouisAUTHIE previously approved these changes Aug 4, 2023

@LouisAUTHIE LouisAUTHIE left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@LouisAUTHIE

Copy link
Copy Markdown

@lmeyer1 can you rebase maybe on the latest version of the dev branch to avoid merge worries ?

@souvrard

souvrard commented Aug 9, 2023

Copy link
Copy Markdown

For information, the install function has a bug preventing database creation: missing coma at the end of line 139

	`deleted` TINYINT NOT NULL DEFAULT 0,
	`notification_sent` DATETIME NULL DEFAULT NULL <===== MISSING COMA
	PRIMARY KEY  (`id_customer`,`customer_email`,`id_product`,`id_product_attribute`,`id_shop`),
`̀`

@lmeyer1

lmeyer1 commented Aug 11, 2023

Copy link
Copy Markdown
Contributor Author

@LouisAUTHIE I hope the rebase was successful.
@souvrard Thanks for pointing this out.

@matks matks removed this from the 2.4.2 milestone Sep 27, 2023
@Touxten Touxten closed this Jan 15, 2026
@github-project-automation github-project-automation Bot moved this from Ready for review to Closed in PR Dashboard Jan 15, 2026
@Touxten Touxten reopened this Jan 15, 2026
@github-project-automation github-project-automation Bot moved this from Closed to Reopened in PR Dashboard Jan 15, 2026
@Touxten Touxten added this to the 3.0.2 milestone Jan 15, 2026
jf-viguier
jf-viguier previously approved these changes Jan 20, 2026
Comment thread MailAlert.php

/** @var string Object last modification date */
public $date_upd;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notification_sent and deleted are missing I guess

Comment thread MailAlert.php
'id_shop' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true],
'id_lang' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true],
'date_add' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'],
'date_upd' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notification_sent and deleted are missing I guess

Comment thread upgrade/upgrade-2.3.4.php
function upgrade_module_2_3_4()
{
$result = Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'mailalert_customer_oos` ADD `date_add` DATETIME NOT NULL, ADD `date_upd` DATETIME NOT NULL;');
$result = $result && Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'mailalert_customer_oos` ADD `deleted` TINYINT NOT NULL DEFAULT 0, ADD `notification_sent` DATETIME NULL DEFAULT NULL, ADD INDEX (`deleted`)');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this two lines could be in one

Comment thread upgrade/upgrade-2.4.2.php Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Reopened

Development

Successfully merging this pull request may close these issues.

ps_emailalerts does not save creation time of request for notification

9 participants