/** * @service country write * * @param $id * @return Gpf_Rpc_Action */ public function setDefaultCountry(Gpf_Rpc_Params $params) { $action = new Gpf_Rpc_Action($params); $action->setErrorMessage($this->_("Error changing default country")); $action->setInfoMessage($this->_("Default country changed")); try { $countryCode = $action->getParam('id'); Gpf_Settings::set(Gpf_Settings_Gpf::DEFAULT_COUNTRY, $countryCode); $country = new Gpf_Db_Country(); $country->setCountryCode($countryCode); $country->setAccountId(Gpf_Session::getAuthUser()->getAccountId()); $country->loadFromData(array(Gpf_Db_Table_Countries::COUNTRY_CODE, Gpf_Db_Table_Countries::ACCOUNTID)); if ($country->getStatus() != Gpf_Db_Country::STATUS_ENABLED) { $country->setStatus(Gpf_Db_Country::STATUS_ENABLED); $country->save(); } $action->addOk(); } catch (Exception $e) { $action->addError(); } return $action; }