コード例 #1
0
ファイル: Models.php プロジェクト: jpbender/mage_virtual
 /**
  * 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))));
 }