diff --git a/html/admin/sql/patch/upgrade47.sql b/html/admin/sql/patch/upgrade47.sql new file mode 100644 index 000000000..837e358ec --- /dev/null +++ b/html/admin/sql/patch/upgrade47.sql @@ -0,0 +1,58 @@ +begin; +drop function insert_jrnx(varchar,numeric,integer,integer,integer,boolean,text,integer,text); + +CREATE or replace FUNCTION insert_jrnx(p_date character varying, p_montant numeric, p_poste poste_comptable, p_grpt integer, p_jrn_def integer, p_debit boolean, p_tech_user text, p_tech_per integer, p_qcode text) RETURNS void + AS $$ +declare + sCode varchar; + nCount_qcode integer; +begin + sCode=trim(p_qcode); + + -- if p_qcode is empty try to find one + if length(sCode) = 0 or p_qcode is null then + + select count(*) into nCount_qcode + from vw_poste_qcode where j_poste=p_poste::text; + -- if we find only one q_code for a accountancy account + -- then retrieve it + if nCount_qcode = 1 then + select j_qcode into sCode + from vw_poste_qcode where j_poste=p_poste; + else + sCode=NULL; + end if; + + end if; + + insert into jrnx + ( + j_date, + j_montant, + j_poste, + j_grpt, + j_jrn_def, + j_debit, + j_tech_user, + j_tech_per, + j_qcode + ) values + ( + to_date(p_date,'DD.MM.YYYY'), + p_montant, + p_poste, + p_grpt, + p_jrn_def, + p_debit, + p_tech_user, + p_tech_per, + sCode + ); + +return; +end; +$$ +LANGUAGE plpgsql; + +update version set val=48; +commit; diff --git a/html/index.php b/html/index.php index 34af13ac7..cf26b6696 100644 --- a/html/index.php +++ b/html/index.php @@ -77,7 +77,7 @@ BODY { -version 4.0.1 +version 4.0.2

diff --git a/include/constant.php b/include/constant.php index cfceb9719..b7e2ea962 100644 --- a/include/constant.php +++ b/include/constant.php @@ -24,7 +24,7 @@ * and some parameter */ date_default_timezone_set ('Europe/Brussels'); -define ("DBVERSION",46); +define ("DBVERSION",48); $inc_path=get_include_path(); if ( strpos($inc_path,";") != 0 ) {