/** * retrieves default currency * * @return Gpf_Db_Currency */ protected function getDefaultCurrency() { try { $obj = new Gpf_Db_Currency(); return $obj->getDefaultCurrency(); } catch (Gpf_DbEngine_NoRowException $e) { throw new Pap_Tracking_Exception(" Critical error - No default currency is defined"); } }
public static function initDefaultCurrency(Gpf_Db_Currency $currency) { $currency->setId('usd00000'); $currency->setName('USD'); $currency->setSymbol('$'); $currency->setPrecision(2); $currency->setWhereDisplay(Gpf_Db_Currency::DISPLAY_LEFT); }
/** * @return Gpf_DbEngine_Row */ protected function createEmptyRow(Gpf_Rpc_Params $params) { $row = new Gpf_Db_Currency(); $row->set(Gpf_Db_Table_Accounts::ID, Gpf_Session::getAuthUser()->getAccountId()); $row->set(Gpf_Db_Table_Currencies::NAME, $this->_("NEW")); $row->set(Gpf_Db_Table_Currencies::SYMBOL, "?"); $row->set(Gpf_Db_Table_Currencies::EXCHANGERATE, "1"); return $row; }
protected function loadSetting() { parent::loadSetting(); $this->addSetting(Pap_Settings::AFF_NOTIFICATION_ON_NEW_SALE_ENABLED_SETTING_NAME); $this->addSetting(Pap_Settings::AFF_NOTIFICATION_ON_SUBAFF_SIGNUP_ENABLED_SETTING_NAME); $this->addSetting(Pap_Settings::AFF_NOTIFICATION_ON_SUBAFF_SALE_ENABLED_SETTING_NAME); $this->addSetting(Pap_Settings::SUPPORT_DIRECT_LINKING); $this->addSetting(Pap_Settings::MAIN_SITE_URL); $this->addSetting(Pap_Settings::TEXT_BANNER_FORMAT_SETTING_NAME); $this->addSetting(Pap_Settings::IMAGE_BANNER_FORMAT_SETTING_NAME); $this->addSetting(Pap_Settings::FLASH_BANNER_FORMAT_SETTING_NAME); $this->addSetting(Pap_Settings::BRANDING_TEXT_POST_AFFILIATE_PRO); $this->addSetting(Gpf_Settings_Gpf::BRANDING_QUALITY_UNIT); $this->addSetting(Pap_Settings::BRANDING_KNOWLEDGEBASE_LINK); $this->addSetting(Pap_Settings::BRANDING_POST_AFFILIATE_PRO_HELP_LINK); $this->addSetting(Pap_Settings::BRANDING_TUTORIAL_VIDEOS_ENABLED); $this->addSetting(Pap_Settings::SETTING_LINKING_METHOD); Gpf_Plugins_Engine::extensionPoint('PostAffiliate.ApplicationSettings.loadSetting', $this); $this->addValue(Pap_Settings::PARAM_NAME_USER_ID, Pap_Tracking_Request::getAffiliateClickParamName()); $this->addValue(Pap_Settings::PARAM_NAME_BANNER_ID, Pap_Tracking_Request::getBannerClickParamName()); $currentTheme = new Gpf_Desktop_Theme(); $this->addValue("desktopMode", $currentTheme->getDesktopMode()); //TODO - IIF Export Format - easy solution for adding other export button than CSV, if needed other formats need to refactor (find out if plugin is active) $this->addValue("quickBooksPluginActive", $this->isPluginActive('QuickBooks')); try { $defaultCurrency = Gpf_Db_Currency::getDefaultCurrency(); $this->addValue("currency_symbol", $defaultCurrency->getSymbol()); $this->addValue("currency_precision", $defaultCurrency->getPrecision()); $this->addValue("currency_wheredisplay", $defaultCurrency->getWhereDisplay()); } catch(Gpf_Exception $e) { $this->addValue("currency_symbol", "Unknown"); $this->addValue("currency_precision", 2); $this->addValue("currency_wheredisplay", 1); } }
private function assignPayoutVariablesToTemplate(Gpf_Templates_Template $template) { $template->assignAttributes($this->user); $template->assign('vat_number', $this->vatNumber); $template->assign('reg_number', $this->regNumber); $template->assign('amount_of_reg_capital', $this->amountOfRegCapital); $template->assign('vat_percentage', $this->vatPercentage); $template->assign('payoutcurrency', $this->currency->getName()); $template->assign('affiliate_note', $this->getAffiliateNote()); $template->assign('payment', $this->getAmount()); $template->assign('amount', str_replace('.', ',', $this->getAmount())); $template->assign('currency', $this->currency->getName()); if ($this->payoutOption != null) { $template->assign('payoutmethod', $this->_localize($this->payoutOption->getName())); } $template->assign('payment_vat_part', $this->amountVatPart); $template->assign('payment_incl_vat', $this->amountWithVat); $template->assign('payment_excl_vat', $this->amountWithoutWat); $historyItem = $this->getPayoutHistoryItem(); if ($historyItem === null) { $template->assign('date', Gpf_Common_DateUtils::getDateInLocaleFormat()); $template->assign('time', Gpf_Common_DateUtils::getTimeInLocaleFormat()); } else { $time = new Gpf_DateTime($historyItem->getDateInserted()); $template->assign('date', Gpf_Common_DateUtils::getDateInLocaleFormat($time->toTimestamp())); $template->assign('time', Gpf_Common_DateUtils::getTimeInLocaleFormat($time->toTimestamp())); } $template->assign('invoicenumber',$this->getInvoiceNumber()); if ($this->payoutOptionFields != null) { $userPayoutOptions = Pap_Db_Table_UserPayoutOptions::getInstance()->getValues( $this->payoutOption->getFormId(), $this->user->getId()); foreach ($this->payoutOptionFields as $payoutOptionField) { $code = $payoutOptionField->get('code'); if (array_key_exists($code, $userPayoutOptions)) { $template->assign($code, $userPayoutOptions[$code]->getValue()); } } } }
/** * returns default currency or an exception * * @return Gpf_Db_Currency */ public static function getDefaultCurrency() { $result = new Gpf_Data_RecordSet(); $selectBuilder = new Gpf_SqlBuilder_SelectBuilder(); $selectBuilder->select->add(Gpf_Db_Table_Currencies::ID, 'currencyid'); $selectBuilder->select->add(Gpf_Db_Table_Currencies::NAME, 'name'); $selectBuilder->select->add(Gpf_Db_Table_Currencies::SYMBOL, 'symbol'); $selectBuilder->select->add(Gpf_Db_Table_Currencies::PRECISION, 'cprecision'); $selectBuilder->select->add(Gpf_Db_Table_Currencies::IS_DEFAULT, 'isdefault'); $selectBuilder->select->add(Gpf_Db_Table_Currencies::WHEREDISPLAY, 'wheredisplay'); $selectBuilder->select->add(Gpf_Db_Table_Currencies::EXCHANGERATE, 'exchrate'); $selectBuilder->from->add(Gpf_Db_Table_Currencies::getName()); $selectBuilder->where->add('isdefault', '=', 1); $selectBuilder->limit->set(0, 1); $result->load($selectBuilder); if ($result->getSize() == 0) { throw new Gpf_DbEngine_NoRowException($selectBuilder); } foreach ($result as $record) { $currency = new Gpf_Db_Currency(); $currency->fillFromRecord($record); return $currency; } throw new Gpf_DbEngine_NoRowException($selectBuilder); }
private function setOriginalCurrencyValues(Pap_Common_Transaction $transaction, Gpf_Db_Currency $currency, $totalCost) { $transaction->setOriginalCurrencyId($currency->getId()); $transaction->setOriginalCurrencyValue($totalCost); $transaction->setOriginalCurrencyRate($currency->getExchangeRate()); }
private function migrateCurrency() { echo " Migrating currency....."; $currency = $this->getPap3Setting('Aff_system_currency'); $currencyPosition = $this->getPap3Setting('Aff_currency_left_position'); $currencyRounding = $this->getPap3Setting('Aff_round_numbers'); $obj = new Gpf_Db_Currency(); $obj->setAccountId(Pap3Compatibility_Migration_Pap3Constants::DEFAULT_ACCOUNT_ID); $obj->setExchangeRate(1); $obj->setIsDefault(1); $obj->setName($currency); $obj->setSymbol($currency); $obj->setPrecision($currencyRounding); $obj->setWhereDisplay(($currencyPosition == 1 ? Gpf_Db_Currency::DISPLAY_LEFT : Gpf_Db_Currency::DISPLAY_RIGHT)); $obj->save(); echo "DONE<br/>"; }
protected function setCurrency(Pap_Contexts_Click $context) { try { $defaultCurrency = Gpf_Db_Currency::getDefaultCurrency(); } catch(Gpf_Exception $e) { $context->debug(' ERROR, Cannot get default curency'); return false; } $context->debug(" Currency set to ".$defaultCurrency->getName()); $context->setDefaultCurrencyObject($defaultCurrency); return true; }
protected function getOriginalCurrencyName($currencyId) { if($currencyId == null || $currencyId == '') { return ''; } $obj = new Gpf_Db_Currency(); try { $obj->setId($currencyId); $obj->load(); return $obj->getName(); } catch (Gpf_Exception $e) { } return ''; }
/** * retrieves default currency * * @return Gpf_Db_Currency */ private function getDefaultCurrency() { try { return Gpf_Db_Currency::getDefaultCurrency(); } catch (Gpf_DbEngine_NoRowException $e) { throw new Pap_Tracking_Exception(" Critical error - No default currency is defined"); } }
protected function loadDefaultCurrency() { $obj = new Gpf_Db_Currency(); return $obj->getDefaultCurrency(); }
protected function initFields() { $this->addTextBox($this->_('Days of validity'), self::VALIDITY_DAYS, $this->_('Number of days that defines validity of this plugin action (in days)')); $this->addListBox($this->_('Bonus type'), self::BONUS_TYPE, array('currency_symbol' => Gpf_Db_Currency::getDefaultCurrency()->getSymbol(), '%' => '%')); $this->addTextBox($this->_('Bonus amount'), self::BONUS_AMOUNT); }