Просмотр исходного кода

Ticket #4090 - Payments: Add support for multi-currency.

AntonLV 4 лет назад
Родитель
Сommit
1f9b96fd2b

+ 14 - 2
modules/boonex/ads/classes/BxAdsFormEntry.php

@@ -159,8 +159,20 @@ class BxAdsFormEntry extends BxBaseModTextFormEntry
 
     public function genInputPrice(&$aInput)
     {
-        if(!isset($aInput['value_currency']))
-            $aInput['value_currency'] = BxDolPayments::getInstance()->getCurrencyCode(bx_get_logged_profile_id());
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        if(!isset($aInput['value_currency'])) {
+            $iAuthorId = 0;
+            if(!empty($this->_iContentId)) {
+                $aContentInfo = $this->_oModule->_oDb->getContentInfoById($this->_iContentId);
+                if(!empty($aContentInfo) || is_array($aContentInfo))
+                    $iAuthorId = $aContentInfo[$CNF['FIELD_AUTHOR']];
+            }
+            else
+                $iAuthorId = bx_get_logged_profile_id();
+
+            $aInput['value_currency'] = BxDolPayments::getInstance()->getCurrencyCode($iAuthorId);
+        }
 
         return parent::genInputPrice($aInput);
     }

+ 14 - 2
modules/boonex/market/classes/BxMarketFormEntry.php

@@ -289,8 +289,20 @@ class BxMarketFormEntry extends BxBaseModTextFormEntry
 
     function genInputPrice(&$aInput)
     {
-        if(!isset($aInput['value_currency']))
-            $aInput['value_currency'] = BxDolPayments::getInstance()->getCurrencyCode(bx_get_logged_profile_id());
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        if(!isset($aInput['value_currency'])) {
+            $iAuthorId = 0;
+            if(!empty($this->_iContentId)) {
+                $aContentInfo = $this->_oModule->_oDb->getContentInfoById($this->_iContentId);
+                if(!empty($aContentInfo) || is_array($aContentInfo))
+                    $iAuthorId = $aContentInfo[$CNF['FIELD_AUTHOR']];
+            }
+            else
+                $iAuthorId = bx_get_logged_profile_id();
+
+            $aInput['value_currency'] = BxDolPayments::getInstance()->getCurrencyCode($iAuthorId);
+        }
 
         return parent::genInputPrice($aInput);
     }