Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Giuseppe Morelli committed Dec 5, 2018
2 parents f9d137d + 112474f commit ff853c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/app/code/local/MailUp/MailUpSync/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ public function leggiUtente($observer)
*/
public function beforeSave($observer)
{
if (isset($GLOBALS['__sl_mailup_save_from_webhook'])) {
return;
}

$model = $observer->getEvent()->getDataObject();

$confirm = Mage::getStoreConfig('mailup_newsletter/mailup/require_subscription_confirmation');
Expand Down Expand Up @@ -230,6 +234,10 @@ public function beforeSave($observer)
*/
public function sendUser($observer)
{
if (isset($GLOBALS['__sl_mailup_save_from_webhook'])) {
return $this;
}

$model = $observer->getEvent()->getDataObject();

// Ensure that (if called as singleton), this will only get called once per customer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function subscribeAction()
die();
}

$GLOBALS["__sl_mailup_invia_utente"] = 1; //avoids observer
$GLOBALS['__sl_mailup_save_from_webhook'] = 1; //avoids observer
$model
->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
->save();
Expand Down Expand Up @@ -88,7 +88,7 @@ public function unsubscribeAction()
die();
}

$GLOBALS["__sl_mailup_invia_utente"] = 1; //avoids observer
$GLOBALS['__sl_mailup_save_from_webhook'] = 1; //avoids observer
$model
->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED)
->save();
Expand Down

0 comments on commit ff853c7

Please sign in to comment.