Skip to content

Commit

Permalink
Mage_CurrencySymbol - DOC block update (#708)
Browse files Browse the repository at this point in the history
* Mage CurrencySymbol - DOC block update

- add missing properties

* Mini update

- fixed camelcase class name

* Reverted added property
  • Loading branch information
sreichel authored May 14, 2020
1 parent d3f64bf commit d61686a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@
* @category Mage
* @package Mage_CurrencySymbol
* @author Magento Core Team <core@magentocommerce.com>
*
* @property string $_blockGroup
*/
class Mage_Currencysymbol_Block_Adminhtml_System_Currencysymbol extends Mage_Adminhtml_Block_Widget_Form
class Mage_CurrencySymbol_Block_Adminhtml_System_Currencysymbol extends Mage_Adminhtml_Block_Widget_Form
{
/**
* @var string
*/
private $_controller;

/**
* Constructor. Initialization required variables for class instance.
*/
Expand Down Expand Up @@ -77,7 +84,7 @@ public function getHeader()
*/
public function getSaveButtonHtml()
{
/** @var $block Mage_Core_Block_Abstract */
/** @var Mage_Core_Block_Abstract $block */
$block = $this->getLayout()->createBlock('adminhtml/widget_button');
$block->setData(array(
'label' => Mage::helper('currencysymbol')->__('Save Currency Symbols'),
Expand Down Expand Up @@ -125,7 +132,7 @@ public function getStoreId()
*/
public function getCurrencySymbolsData()
{
if(!$this->_symbolsData) {
if (!$this->_symbolsData) {
$this->_symbolsData = Mage::getModel('currencysymbol/system_currencysymbol')
->getCurrencySymbolsData();
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/CurrencySymbol/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function getCurrencyOptions($baseCode)
{
$currencyOptions = array();
$currencySymbol = Mage::getModel('currencysymbol/system_currencysymbol');
if($currencySymbol) {
if ($currencySymbol) {
$customCurrencySymbol = $currencySymbol->getCurrencySymbol($baseCode);

if ($customCurrencySymbol) {
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/CurrencySymbol/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Mage_CurrencySymbol_Model_Observer
* Generate options for currency displaying with custom currency symbol
*
* @param Varien_Event_Observer $observer
* @return Mage_CurrencySymbol_Model__Observer
* @return $this
*/
public function currencyDisplayOptions(Varien_Event_Observer $observer)
{
Expand Down
34 changes: 19 additions & 15 deletions app/code/core/Mage/CurrencySymbol/Model/System/Currencysymbol.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
* @category Mage
* @package Mage_CurrencySymbol
* @author Magento Core Team <core@magentocommerce.com>
*
* @method $this resetValues()
*/
class Mage_CurrencySymbol_Model_System_Currencysymbol
{
Expand Down Expand Up @@ -83,10 +85,10 @@ class Mage_CurrencySymbol_Model_System_Currencysymbol
/**
* Sets store Id
*
* @param $storeId
* @param int $storeId
* @return $this
*/
public function setStoreId($storeId=null)
public function setStoreId($storeId = null)
{
$this->_storeId = $storeId;
$this->_symbolsData = array();
Expand All @@ -97,10 +99,10 @@ public function setStoreId($storeId=null)
/**
* Sets website Id
*
* @param $websiteId
* @param int $websiteId
* @return $this
*/
public function setWebsiteId($websiteId=null)
public function setWebsiteId($websiteId = null)
{
$this->_websiteId = $websiteId;
$this->_symbolsData = array();
Expand All @@ -126,7 +128,6 @@ public function getCurrencySymbolsData()
Mage::getStoreConfig(self::XML_PATH_ALLOWED_CURRENCIES, null)
);

/* @var $storeModel Mage_Adminhtml_Model_System_Store */
$storeModel = Mage::getSingleton('adminhtml/system_store');
foreach ($storeModel->getWebsiteCollection() as $website) {
$websiteShow = false;
Expand Down Expand Up @@ -158,7 +159,7 @@ public function getCurrencySymbolsData()

$currentSymbols = $this->_unserializeStoreConfig(self::XML_PATH_CUSTOM_CURRENCY_SYMBOL);

/** @var $locale Mage_Core_Model_Locale */
/** @var Mage_Core_Model_Locale $locale */
$locale = Mage::app()->getLocale();
foreach ($allowedCurrencies as $code) {
if (!$symbol = $locale->getTranslation($code, 'currencysymbol')) {
Expand Down Expand Up @@ -191,15 +192,16 @@ public function getCurrencySymbolsData()
/**
* Saves currency symbol to config
*
* @param $symbols array
* @param array $symbols
* @return $this
*/
public function setCurrencySymbolsData($symbols=array())
public function setCurrencySymbolsData($symbols = array())
{
foreach ($this->getCurrencySymbolsData() as $code => $values) {
if (isset($symbols[$code])) {
if ($symbols[$code] == $values['parentSymbol'] || empty($symbols[$code]))
unset($symbols[$code]);
if ($symbols[$code] == $values['parentSymbol'] || empty($symbols[$code])) {
unset($symbols[$code]);
}
}
}
if ($symbols) {
Expand All @@ -215,7 +217,8 @@ public function setCurrencySymbolsData($symbols=array())
->setGroups($value)
->save();

Mage::dispatchEvent('admin_system_config_changed_section_currency_before_reinit',
Mage::dispatchEvent(
'admin_system_config_changed_section_currency_before_reinit',
array('website' => $this->_websiteId, 'store' => $this->_storeId)
);

Expand All @@ -225,7 +228,8 @@ public function setCurrencySymbolsData($symbols=array())

$this->clearCache();

Mage::dispatchEvent('admin_system_config_changed_section_currency',
Mage::dispatchEvent(
'admin_system_config_changed_section_currency',
array('website' => $this->_websiteId, 'store' => $this->_storeId)
);

Expand All @@ -235,8 +239,8 @@ public function setCurrencySymbolsData($symbols=array())
/**
* Returns custom currency symbol by currency code
*
* @param $code
* @return bool|string
* @param string $code
* @return false|string
*/
public function getCurrencySymbol($code)
{
Expand All @@ -251,7 +255,7 @@ public function getCurrencySymbol($code)
/**
* Clear translate cache
*
* @return Saas_Translate_Helper_Data
* @return $this
*/
public function clearCache()
{
Expand Down

0 comments on commit d61686a

Please sign in to comment.