Permalink
Browse files

Don't set the default status on the admin customer page save

  • Loading branch information...
1 parent dda2746 commit 31b256b693cf2c9ae906f522ca55be7126920b3f @Vinai committed Sep 30, 2013
Showing with 20 additions and 4 deletions.
  1. +20 −4 app/code/community/Netzarbeiter/CustomerActivation/Model/Observer.php
@@ -17,7 +17,7 @@
* license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
-class Netzarbeiter_CustomerActivation_Model_Observer extends Mage_Core_Model_Abstract
+class Netzarbeiter_CustomerActivation_Model_Observer
{
const XML_PATH_MODULE_DISABLED = 'customer/customeractivation/disable_ext';
@@ -81,10 +81,13 @@ public function customerSaveBefore($observer)
}
if (!$customer->getId()) {
- $groupId = $customer->getGroupId();
- $defaultStatus = Mage::helper('customeractivation')->getDefaultActivationStatus($groupId, $storeId);
- $customer->setCustomerActivated($defaultStatus);
$customer->setCustomerActivationNewAccount(true);
+ if (! (Mage::app()->getStore()->isAdmin() && $this->_checkControllerAction('customer', 'save'))) {
+ // Do not set the default status on the customer edit save action
+ $groupId = $customer->getGroupId();
+ $defaultStatus = Mage::helper('customeractivation')->getDefaultActivationStatus($groupId, $storeId);
+ $customer->setCustomerActivated($defaultStatus);
+ }
}
}
@@ -230,6 +233,19 @@ protected function _checkRequestRoute($module, $controller, $action)
}
/**
+ * Check the current controller and action match the passed names
+ *
+ * @param string $controller
+ * @param string $action
+ * @return bool
+ */
+ protected function _checkControllerAction($controller, $action)
+ {
+ $req = Mage::app()->getRequest();
+ return $this->_checkRequestRoute($req->getModuleName(), $controller, $action);
+ }
+
+ /**
* Add customer activation option to the mass action block.
*
* This can't be done during the block abstract e

0 comments on commit 31b256b

Please sign in to comment.