Source for file _currency.class.php
Documentation is available at _currency.class.php
* This file is part of the evoCore framework - {@link http://evocore.net/}
* See also {@link http://sourceforge.net/projects/evocms/}.
* @copyright (c)2009 by Francois PLANQUE - {@link http://fplanque.net/}
* Parts of this file are copyright (c)2009 by The Evo Factory - {@link http://www.evofactory.com/}.
* {@internal License choice
* - If you have received this file as part of a package, please find the license.txt file in
* the same folder or the closest folder above for complete license terms.
* - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
* then you must choose one of the following licenses before using the file:
* - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
* - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
* {@internal Open Source relicensing agreement:
* The Evo Factory grants Francois PLANQUE the right to license
* The Evo Factory's contributions to this file and the b2evolution project
* under any OSI approved OSS license (http://www.opensource.org/licenses/).
* {@internal Below is a list of authors who have contributed to design/coding of this file: }}
* @author efy-maxim: Evo Factory / Maxim.
* @author fplanque: Francois Planque.
* @version $Id: _currency.class.php,v 1.13 2010/01/17 04:14:40 fplanque Exp $
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
load_class( '_core/model/dataobjects/_dataobject.class.php', 'DataObject' );
* @param object database row
// Call parent constructor:
parent::DataObject( 'T_currency', 'curr_', 'curr_ID' );
array( 'table'=>
'T_country', 'fk'=>
'ctry_curr_ID', 'msg'=>
T_('%d related countries') ),
$this->ID =
$db_row->curr_ID;
$this->code =
$db_row->curr_code;
$this->shortcut =
$db_row->curr_shortcut;
$this->name =
$db_row->curr_name;
$this->enabled =
$db_row->curr_enabled;
* Load data from Request form fields.
* @return boolean true if loaded data seems valid.
param( 'curr_code', 'string' );
param_check_regexp( 'curr_code', '#^[A-Za-z]{3}$#', T_('Currency code must be 3 letters parameter.') );
* By default, all values will be considered strings
* @param string parameter name
* @param mixed parameter value
* @param boolean true to set to NULL if empty value
* @return boolean true, if a value has been set; false if it has not changed
function set( $parname, $parvalue, $make_null =
false )
return $this->set_param( $parname, 'string', $parvalue, $make_null );
* Check existence of specified currency code in curr_code unique field.
* @return int ID if currency code exists otherwise NULL/false
* Get currency unique name (code).
* @return string currency code
* $Log: _currency.class.php,v $
* Revision 1.13 2010/01/17 04:14:40 fplanque
* Revision 1.12 2010/01/15 17:27:28 efy-asimo
* Global Settings > Currencies - Add Enable/Disable column
* Revision 1.11 2009/09/20 20:07:18 blueyed
* - DataObject::dbexists quotes always
* Revision 1.10 2009/09/14 13:31:36 efy-arrin
* Included the ClassName in load_class() call with proper UpperCase
* Revision 1.9 2009/09/07 12:40:57 efy-maxim
* Ability to select the default currency when editing a country
* Revision 1.8 2009/09/05 14:39:48 efy-maxim
* Delete Restrictions for currency
* Revision 1.7 2009/09/04 19:00:05 efy-maxim
* currency/country codes validators have been improved using param_check_regexp() function
* Revision 1.6 2009/09/03 18:29:29 efy-maxim
* currency/country code validators
* Revision 1.5 2009/09/03 07:24:58 efy-maxim
* 1. Show edit screen again if current currency/goal exists in database.
* 2. Convert currency code to uppercase
* Revision 1.4 2009/09/02 23:29:34 fplanque