Permalink
Browse files

set the default currency key correctly in currency_select method #129

  • Loading branch information...
1 parent 353de1b commit c47d7cb61ca2249a6ad5d1a5f1688588628a6c89 @juanramon juanramon committed Jan 25, 2012
Showing with 14 additions and 16 deletions.
  1. +14 −16 oc-includes/osclass/frm/Item.form.class.php
@@ -178,26 +178,24 @@ static public function price_input_text($item = null)
}
// OK
static public function currency_select($currencies = null, $item = null) {
- if($currencies==null) { $currencies = osc_get_currencies(); };
- if($item==null) { $item = osc_item(); }
- if( Session::newInstance()->_getForm('currency') != "" ) {
- $item['fk_c_currency_code'] = Session::newInstance()->_getForm('currency');
- }
- if(count($currencies) > 1 ) {
- $default_key = null;
- $currency = osc_get_preference('currency');
- if ( isset($item['fk_c_currency_code']) ) {
- $default_key = $item['fk_c_currency_code'];
- } elseif ( is_array($currency) ) {
- if ( isset($currency['s_value']) ) {
- $default_key = $currency['s_value'];
- }
+ if( $currencies == null ) { $currencies = osc_get_currencies() ; }
+ if( $item == null) { $item = osc_item() ; }
+ if( Session::newInstance()->_getForm('currency') != '' ) {
+ $item['fk_c_currency_code'] = Session::newInstance()->_getForm('currency') ;
+ }
+ if( count($currencies) > 1 ) {
+ $default_key = null ;
+ $currency = osc_get_preference('currency') ;
+ if( isset($item['fk_c_currency_code']) ) {
+ $default_key = $item['fk_c_currency_code'] ;
+ } elseif( isset( $currency ) ) {
+ $default_key = $currency ;
}
parent::generic_select('currency', $currencies, 'pk_c_code', 's_description', null, $default_key) ;
- } else if (count($currencies) == 1) {
+ } else if( count($currencies) == 1 ) {
parent::generic_input_hidden("currency", $currencies[0]["pk_c_code"]) ;
- echo $currencies[0]['s_description'];
+ echo $currencies[0]['s_description'] ;
}
}
// OK

0 comments on commit c47d7cb

Please sign in to comment.