Protected Member Functions | |
_afterSave () |
Definition at line 35 of file Locale.php.
_afterSave | ( | ) | [protected] |
Enter description here...
Reimplemented from Mage_Core_Model_Abstract.
Definition at line 43 of file Locale.php.
00044 { 00045 $collection = Mage::getModel('core/config_data') 00046 ->getCollection() 00047 ->addPathFilter('currency/options'); 00048 00049 $values = split(',', $this->getValue()); 00050 $exceptions = array(); 00051 foreach ($collection as $data) { 00052 $match = false; 00053 if (preg_match('/(base|default)$/', $data->getPath(), $match)) { 00054 if (!in_array($data->getValue(), $values)) { 00055 $currencyName = Mage::app()->getLocale()->currency($data->getValue())->getName(); 00056 if ($match[1] == 'base') { 00057 $fieldName = Mage::helper('adminhtml')->__('Base currency'); 00058 } 00059 else { 00060 $fieldName = Mage::helper('adminhtml')->__('Display default currency'); 00061 } 00062 00063 switch ($data->getScope()) { 00064 case 'default': 00065 $scopeName = Mage::helper('adminhtml')->__('Default scope'); 00066 break; 00067 00068 case 'website': 00069 $websiteName = Mage::getModel('core/website')->load($data->getScopeId())->getName(); 00070 $scopeName = Mage::helper('adminhtml')->__('website(%s) scope', $websiteName); 00071 break; 00072 00073 case 'store': 00074 $storeName = Mage::getModel('core/store')->load($data->getScopeId())->getName(); 00075 $scopeName = Mage::helper('adminhtml')->__('store(%s) scope', $storeName); 00076 break; 00077 } 00078 00079 $exceptions[] = Mage::helper('adminhtml')->__('Currency "%s" is used as %s in %s', 00080 $currencyName, 00081 $fieldName, 00082 $scopeName 00083 ); 00084 } 00085 } 00086 } 00087 if ($exceptions) { 00088 Mage::throwException(join("\n", $exceptions)); 00089 } 00090 00091 return $this; 00092 }