本文整理汇总了PHP中Currency::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Currency::update方法的具体用法?PHP Currency::update怎么用?PHP Currency::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Currency
的用法示例。
在下文中一共展示了Currency::update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
public function postProcess()
{
global $currentIndex;
if (isset($_GET['delete' . $this->table])) {
if ($this->tabAccess['delete'] === '1') {
if (Validate::isLoadedObject($object = $this->loadObject())) {
if ($object->id == Configuration::get('PS_CURRENCY_DEFAULT')) {
$this->_errors[] = $this->l('You can\'t delete the default currency');
} elseif ($object->delete()) {
Tools::redirectAdmin($currentIndex . '&conf=1' . '&token=' . $this->token);
} else {
$this->_errors[] = Tools::displayError('an error occurred during deletion');
}
} else {
$this->_errors[] = Tools::displayError('an error occurred while deleting object') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)');
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
} elseif (Tools::getValue('submitOptions' . $this->table)) {
foreach ($this->_fieldsOptions as $key => $field) {
Configuration::updateValue($key, $field['cast'](Tools::getValue($key)));
if ($key == 'PS_CURRENCY_DEFAULT') {
$currency = new Currency($field['cast'](Tools::getValue($key)));
$currency->conversion_rate = 1;
$currency->update();
}
}
Tools::redirectAdmin($currentIndex . '&conf=6' . '&token=' . $this->token);
} elseif (Tools::isSubmit('submitExchangesRates')) {
if (!($this->_errors[] = Currency::refreshCurrencies())) {
Tools::redirectAdmin($currentIndex . '&conf=6' . '&token=' . $this->token);
}
} else {
parent::postProcess();
}
}
示例2: PostVar
$iCurrencyID = PostVar("iCurrencyID");
$actionfile = GetVar("file");
/** This is for Check Duplicate Record-------------------------------------------*/
$generalobj->getRequestVars();
$redirect_file = "index.php?file={$file}&view={$view}&iCurrencyID={$iCurrencyID}";
$generalobj->checkDuplicate('iCurrencyID', PRJ_DB_PREFIX . "_currency_master", array('vCode' => $Data['vCode']), $redirect_file, COUNTRY_ALREADY_EXISTS, $iCurrencyID);
if ($view == "add") {
//prints($Data);exit;
$currencyObj->setAllVar($Data);
$id = $currencyObj->insert();
if ($id) {
$var_msg = "Record Added Successfully.";
} else {
$var_msg = "Eror-in Add.";
}
} else {
if ($view == "edit") {
$arr = $currencyObj->select($iCurrencyID);
$currencyObj->setAllVar($arr);
$currencyObj->setAllVar($Data);
$where = " iCurrencyID = '" . $iCurrencyID . "'";
$id = $currencyObj->update($where);
if ($id) {
$var_msg = "Record Updated Successfully.";
} else {
$var_msg = "Eror-in Update.";
}
}
}
header("Location:index.php?file=" . $actionfile . "&view=index&AX=Yes&var_msg={$var_msg}");
exit;
示例3: storeCurrencies
/**
* Stores the Currencies as present in the POST request
*
* See {@see Currency::delete()},
* {@see Currency::add()}, and
* {@see Currency::update()}.
*/
static function storeCurrencies()
{
//DBG::log("start of storeCurrencies: ".self::$success.", changed: ".self::$changed);
$result = Currency::delete();
if (isset($result)) {
self::$changed = true;
self::$success &= $result;
}
//DBG::log("after delete: ".self::$success.", changed: ".self::$changed);
$result = Currency::add();
if (isset($result)) {
self::$changed = true;
self::$success &= $result;
}
//DBG::log("after add: ".self::$success.", changed: ".self::$changed);
$result = Currency::update();
if (isset($result)) {
self::$changed = true;
self::$success &= $result;
}
//DBG::log("after update: ".self::$success.", changed: ".self::$changed);
if (self::$changed) {
// Remember to reinit the Currencies, or the User
// won't see changes instantly
Currency::reset();
}
}
示例4: update_order_settings
public static function update_order_settings()
{
$id = Core::validate(self::getVar('id'));
$fieldName = Core::validate(self::getVar('fieldName'));
$value = Core::validate(self::getVar('value'));
$goodInput = false;
switch ($fieldName) {
case 'min_order_amount':
if ($value != null && Core::isDouble($value) && $value >= 0) {
$goodInput = true;
}
break;
default:
break;
}
if ($goodInput == true) {
$currency = new Currency();
$currency->setId($id);
$currency->update(array($fieldName => $value));
Core::printSuccessJson($fieldName . " " . $value);
} else {
Core::printErrorJson('Invalid input: ' . $value);
}
}