diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js index f5e720150..0c68c4e2f 100644 --- a/html/js/acc_ledger.js +++ b/html/js/acc_ledger.js @@ -1328,7 +1328,7 @@ function manage_search_filter(p_obj) { function save_filter(p_div,p_dossier) { var elt=['ledger_type','nb_jrn','date_start','date_end', 'date_paid_start','date_paid_end','desc','amount_min','amount_max','qcode','accounting', - 'operation_filter','tag_option']; + 'operation_filter','tag_option','p_currency_code']; var eltValue={}; var i =0; eltValue['gDossier']=p_dossier; @@ -1397,7 +1397,8 @@ function load_filter(p_div,p_dossier,p_filter_id) { var answer=req.responseJSON; console.log(answer); var elt=['ledger_type','date_start','date_end','date_paid_start','date_paid_end', - 'desc','amount_min','amount_max','qcode','accounting','operation_filter','tag_option']; + 'desc','amount_min','amount_max','qcode','accounting','operation_filter','tag_option' + ,'p_currency_code']; for (var i=0;isetp("ledger_type", $http->post("ledger_type", 'string')); $new->setp("operation_filter", $http->post("operation_filter", 'string', NULL)); $new->setp("filter_name", h($http->post("filter_name", 'string'))); + $new->setp("uf_currency_code", h($http->post("p_currency_code", 'number',-1))); $tag=$http->post("tag","string",''); if (is_array($tag) ) @@ -118,6 +119,7 @@ if ($op=="load_filter") $record['r_jrn']=explode(",", $record['r_jrn']); $record['tag']=explode(",",$record['uf_tag']); $record['tag_option']=$record["uf_tag_option"]; + $record['p_currency_code']=$record['uf_currency_code']; $result=array_merge($answer, $record); diff --git a/include/class/acc_ledger_search.class.php b/include/class/acc_ledger_search.class.php index 81527a6a3..b59a5fe8e 100644 --- a/include/class/acc_ledger_search.class.php +++ b/include/class/acc_ledger_search.class.php @@ -229,6 +229,17 @@ class Acc_Ledger_Search if (isset($_REQUEST['single_operation'])) $r.=HtmlInput::hidden("single_operation", $http->request('single_operation')); + //------ + // Devise + ///------- + $currency_id=$http->request("p_currency_code","string",-1); + $acc_currency=new Acc_Currency($this->cn); + + $sCurrency=$acc_currency->select_currency(); + $sCurrency->id=$this->div."p_currency_code"; + $sCurrency->value[]=array("label"=>_("Toutes"),"value"=>-1); + $sCurrency->selected=$currency_id; + ob_start(); $search_filter=$this->build_search_filter(); require_once NOALYSS_TEMPLATE.'/ledger_search.php'; @@ -404,7 +415,10 @@ class Acc_Ledger_Search end as total_invoice, jr_date_paid, to_char(jr_date_paid,'DD.MM.YY') as str_jr_date_paid, - cas.jr_id as analytic_op + cas.jr_id as analytic_op, + x.currency_id, + (select cr_code_iso from currency c where c.id=x.currency_id) cr_code_iso, + x.currency_rate from jrn as X left join jrn_note using(jr_id) @@ -458,6 +472,7 @@ class Acc_Ledger_Search $fil_date_paid=''; $fil_hide_operation=''; $fil_tag=''; + $fil_currency=""; $and=''; $g_user=new User($this->cn); @@ -641,9 +656,15 @@ class Acc_Ledger_Search " from user_sec_jrn where ". " uj_login='".sql_string($_SESSION[SESSION_KEY.'g_user'])."'". " and uj_priv in ('R','W'))"; + $and=" and "; + } + if ( isset($p_currency_code) && $p_currency_code !=-1) { + $fil_currency=$and." x.currency_id = ".sql_string($p_currency_code); + $and=" and "; } $where=$fil_ledger.$fil_amount.$fil_date.$fil_desc.$fil_sec.$fil_amount. - $fil_qcode.$fil_paid.$fil_account.$fil_date_paid.$fil_hide_operation.$fil_tag; + $fil_qcode.$fil_paid.$fil_account.$fil_date_paid.$fil_hide_operation.$fil_tag.$fil_currency; + $sql.=" where ".$where; // Q?? Why do we return where if it is included in SQL ? diff --git a/include/constant.php b/include/constant.php index 1f88757f1..58197aea7 100644 --- a/include/constant.php +++ b/include/constant.php @@ -113,7 +113,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) { if ( ! defined ("SYSINFO_DISPLAY")) { define ("SYSINFO_DISPLAY",TRUE); } -define ("DBVERSION",157); +define ("DBVERSION",158); define ("MONO_DATABASE",25); define ("DBVERSIONREPO",19); define ('NOTFOUND','--not found--'); diff --git a/include/database/user_filter_sql.class.php b/include/database/user_filter_sql.class.php index 3a1557da3..d43e3c500 100644 --- a/include/database/user_filter_sql.class.php +++ b/include/database/user_filter_sql.class.php @@ -58,6 +58,7 @@ class User_filter_SQL extends Noalyss_SQL ,'filter_name'=>"filter_name" ,'uf_tag'=>'uf_tag' ,'uf_tag_option'=>'uf_tag_option' + ,'uf_currency_code'=>'uf_currency_code' ); /* @@ -83,6 +84,7 @@ class User_filter_SQL extends Noalyss_SQL ,"filter_name"=>"text" ,'uf_tag'=>'text' ,'uf_tag_option'=>'numeric' + ,'uf_currency_code'=>'numeric' ); diff --git a/include/export/export_histo_csv.php b/include/export/export_histo_csv.php index 251fe0fe8..6b80266ad 100644 --- a/include/export/export_histo_csv.php +++ b/include/export/export_histo_csv.php @@ -47,6 +47,8 @@ $title[]=_("Tiers"); $title[]=_("Description"); $title[]=_("Note"); $title[]=_("Montant opération"); +$title[]=_("Code Devise"); +$title[]=_("Taux"); $export=new Noalyss_Csv("histo"); $export->send_header(); $export->write_header($title); @@ -74,6 +76,9 @@ for ($i=0;$iadd($amount,"number"); + $export->add($res[$i]['cr_code_iso']); + $export->add($res[$i]['currency_rate'],"number"); + $export->write(); diff --git a/include/history_operation.inc.php b/include/history_operation.inc.php index 69a03599a..7874d2e91 100644 --- a/include/history_operation.inc.php +++ b/include/history_operation.inc.php @@ -175,7 +175,8 @@ echo ''; */ $r = HtmlInput::get_to_hidden(array('l', 'date_paid_start','date_paid_end', 'date_start', 'date_end', 'desc', 'amount_min', 'amount_max', 'qcode','operation_filter', - 'accounting', 'unpaid', 'gDossier', 'ledger_type', 'p_action','search_optag_option')); + 'accounting', 'unpaid', 'gDossier', 'ledger_type', + 'p_action','search_optag_option','p_currency_code')); if (isset($_GET['search_opr_jrn'])) { foreach ($a_search_opr_jrn as $k => $v) diff --git a/include/sql/patch/upgrade157.sql b/include/sql/patch/upgrade157.sql new file mode 100644 index 000000000..12d2110ae --- /dev/null +++ b/include/sql/patch/upgrade157.sql @@ -0,0 +1,7 @@ +begin; + +alter table user_filter add column uf_currency_code int; +comment on column user_filter.uf_currency_code is 'correspond to currency.id'; + +insert into version (val,v_description) values (158,'Filter Currency search'); +commit ; \ No newline at end of file