/** * @param Mage_Rule_Model_Rule $rule * @return string */ public function formatRuleName($rule) { $linkStyle = ''; $name = $rule->getName(); if (!$rule->getIsActive() || $rule->getToDate() < date('Y-m-d') && $rule->getToDate() !== null) { $linkStyle = 'text-decoration: none;'; $name = '<span style="text-decoration:line-through; color: #aaa;">' . $name . '</span>'; } return sprintf('<a href="%s" style="%s" title="%s">%s</a>', $this->getUrl('*/promo_quote/edit', array('id' => $rule->getId())), $linkStyle, 'ID: ' . $rule->getId(), $name); }
/** * Limit Rule entity saving * * @param Mage_Rule_Model_Rule $model * * @return void */ public function ruleSaveBefore($model) { // Deny creating new rule entity if role has no allowed website ids if (!$model->getId() && !$this->_role->getIsWebsiteLevel()) { $this->_throwSave(); } $websiteIds = (array) $model->getOrigData('website_ids'); // Deny saving rule entity if role has no exclusive access to assigned to rule entity websites // Check if original websites list is empty implemented to deny saving target rules for all GWS limited users if ($model->getId() && (!$this->_role->hasExclusiveAccess($websiteIds) || empty($websiteIds))) { $this->_throwSave(); } }
/** * Limit Rule save * * @param Mage_Rule_Model_Rule $model * @return void */ public function ruleSaveBefore($model) { $originalWebsiteIds = Mage::helper('enterprise_admingws')->explodeIds($model->getOrigData('website_ids')); $websiteIds = Mage::helper('enterprise_admingws')->explodeIds($model->getData('website_ids')); if (!$model->getId() && !$this->_role->getIsWebsiteLevel()) { $this->_throwSave(); } if ($model->getId() && !$this->_role->hasWebsiteAccess($websiteIds)) { $this->_throwSave(); } $model->setData('website_ids', implode(',', $this->_forceAssignToWebsite($this->_updateSavingWebsiteIds($websiteIds, $originalWebsiteIds)))); }