diff --git a/html/ajax_misc.php b/html/ajax_misc.php index bd9f124e8..7f5218f7f 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -627,7 +627,12 @@ EOF; } exit(); break; - + case 'currencyCode': + $ledger_id=$http->request('ledger',"number"); + $code=$cn->get_value("select cr_code_iso from public.currency join jrn_def on (currency.id=jrn_def.currency_id) where jrn_def.jrn_def_id=$1", + [$ledger_id]); + echo $code; + break; default: var_dump($_REQUEST); } diff --git a/html/do.php b/html/do.php index 0278416f6..fc04b284f 100644 --- a/html/do.php +++ b/html/do.php @@ -33,9 +33,7 @@ require_once NOALYSS_INCLUDE.'/lib/html_input.class.php'; require_once NOALYSS_INCLUDE.'/lib/http_input.class.php'; require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php'; $http=new HttpInput(); - mb_internal_encoding("UTF-8"); - // if gDossier is not set redirect to form to choose a folder if ( ! isset($_REQUEST['gDossier'])) { diff --git a/html/js/scripts.js b/html/js/scripts.js index 05f0bdfa8..a1e4fe149 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -3514,3 +3514,18 @@ function updatePeriode(p_dossier,p_exercice,p_periode_from,p_periode_to,p_last) new Ajax.Updater(p_periode_to,"ajax_misc.php",{method:"get",parameters:{op:"periode_change","gDossier":p_dossier,"exercice":exercice,field:p_periode_to,"type":"to","last":p_last}}); remove_waiting_box(); } +/** + * + * @returns {undefined} + */ +function show_ledger_fin_currency() +{ + var ledger=$('p_jrn').value; + var dossier=$('gDossier').value; + // $('ledger_currency'). + var a=new Ajax.Updater("ledger_currency", + "ajax_misc.php", + { + parameters: {"op":"currencyCode","gDossier":dossier,"ledger":ledger} + }); +} \ No newline at end of file diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php index 51adc9853..35380e928 100644 --- a/include/class/acc_ledger.class.php +++ b/include/class/acc_ledger.class.php @@ -2933,7 +2933,14 @@ class Acc_Ledger extends jrn_def_sql Dossier::id(),$select->name,$p_currency_code,$p_currency_rate,$p_eur_amount); return $select; } - + /** + * @brief returns the code iso of the default currency for this ledger + */ + function get_currency() + { + $cr_iso_code=$this->db->get_value("select cr_code_iso from public.currency where id=$1",[$this->currency_id]); + return $cr_iso_code; + } } ?> diff --git a/include/class/acc_ledger_fin.class.php b/include/class/acc_ledger_fin.class.php index c9ef7d967..e12008c84 100644 --- a/include/class/acc_ledger_fin.class.php +++ b/include/class/acc_ledger_fin.class.php @@ -301,7 +301,7 @@ class Acc_Ledger_Fin extends Acc_Ledger // Ledger (p_jrn) //-- - $onchange="update_bank();ajax_saldo('first_sold');update_name();update_row('fin_item');"; + $onchange="update_bank();ajax_saldo('first_sold');update_name();update_row('fin_item');show_ledger_fin_currency();"; if ($g_parameter->MY_DATE_SUGGEST == 'Y') $onchange .= 'get_last_date();'; diff --git a/include/template/form_ledger_fin.php b/include/template/form_ledger_fin.php index ef12d1846..2e3460780 100644 --- a/include/template/form_ledger_fin.php +++ b/include/template/form_ledger_fin.php @@ -13,7 +13,7 @@ array('value'=>2,'label'=>_("Avec date opérations")) ); $wchdate->selected=(isset($chdate))?$chdate:1; - $wchdate->javascript='onchange="show_fin_chdate(\'chdate\')"'; + $wchdate->javascript='onchange="show_fin_chdate(\'chdate\');"'; ?> input();?> @@ -22,8 +22,11 @@

- - +   +   + + get_currency();?> +