Skip to content

Commit

Permalink
Keep date_upd consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
lmeyer1 committed Nov 11, 2022
1 parent 6d62f91 commit 0cbc6d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions MailAlert.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ public static function customerHasNotification($id_customer, $id_product, $id_pr

public static function deleteAlert($id_customer, $customer_email, $id_product, $id_product_attribute, $id_shop, $notification_sent)
{
$sql = '
UPDATE `' . _DB_PREFIX_ . self::$definition['table'] . '` set `deleted` = 1 ' .
$sql = 'UPDATE `' . _DB_PREFIX_ . self::$definition['table'] . '` set `deleted` = 1, date_upd = NOW()' .
($notification_sent ? ', `notification_sent` = NOW()' : '') .
' WHERE ' . (($id_customer > 0) ? '(`customer_email` = \'' . pSQL($customer_email) . '\' OR `id_customer` = ' . (int) $id_customer . ')' :
'`customer_email` = \'' . pSQL($customer_email) . '\'') .
Expand Down
8 changes: 4 additions & 4 deletions ps_emailalerts.php
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ public function hookActionProductDelete($params)
{
$sql = '
UPDATE `' . _DB_PREFIX_ . MailAlert::$definition['table'] . '`
SET `deleted` = 1
SET `deleted` = 1, date_upd = NOW()
WHERE `id_product` = ' . (int) $params['product']->id;

Db::getInstance()->execute($sql);
Expand All @@ -705,12 +705,12 @@ public function hookActionProductAttributeDelete($params)
if ($params['deleteAllAttributes']) {
$sql = '
UPDATE `' . _DB_PREFIX_ . MailAlert::$definition['table'] . '`
SET `deleted` = 1
SET `deleted` = 1, date_upd = NOW()
WHERE `id_product` = ' . (int) $params['id_product'];
} else {
$sql = '
UPDATE `' . _DB_PREFIX_ . MailAlert::$definition['table'] . '`
SET `deleted` = 1
SET `deleted` = 1, date_upd = NOW()
WHERE `id_product_attribute` = ' . (int) $params['id_product_attribute'] . '
AND `id_product` = ' . (int) $params['id_product'];
}
Expand Down Expand Up @@ -1209,7 +1209,7 @@ public function renderForm()
public function hookActionDeleteGDPRCustomer($customer)
{
if (!empty($customer['email']) && Validate::isEmail($customer['email'])) {
$sql = 'UPDATE ' . _DB_PREFIX_ . "mailalert_customer_oos SET deleted = 1, customer_email = 'deleted' WHERE customer_email = '" . pSQL($customer['email']) . "'";
$sql = 'UPDATE ' . _DB_PREFIX_ . "mailalert_customer_oos SET deleted = 1, customer_email = 'deleted', date_upd = NOW() WHERE customer_email = '" . pSQL($customer['email']) . "'";
if (Db::getInstance()->execute($sql)) {
return json_encode(true);
}
Expand Down

0 comments on commit 0cbc6d8

Please sign in to comment.