diff --git a/html/admin/sql/patch/upgrade58.sql b/html/admin/sql/patch/upgrade58.sql new file mode 100644 index 000000000..c3dc895ce --- /dev/null +++ b/html/admin/sql/patch/upgrade58.sql @@ -0,0 +1,7 @@ +begin; +INSERT INTO format_csv_banque(name, include_file) VALUES('VMS Keytrade', 'keytrade_be.inc.php'); + +update version set val=59; + +commit; + diff --git a/include/constant.php b/include/constant.php index 2266f4005..ab5fbfe4a 100644 --- a/include/constant.php +++ b/include/constant.php @@ -26,7 +26,7 @@ require_once ('config.inc.php'); require_once('constant.security.php'); -define ("DBVERSION",58); +define ("DBVERSION",59); define ("MAX_COMPTE",4); define ('MAX_BUD_DETAIL',20); diff --git a/include/keytrade_be.inc.php b/include/keytrade_be.inc.php new file mode 100644 index 000000000..9166056b6 --- /dev/null +++ b/include/keytrade_be.inc.php @@ -0,0 +1,128 @@ +"; + +//----------------------------------------------------- +// insert into import_tmp +//----------------------------------------------------- + $Sql="insert into import_tmp (code, + date_exec , + date_valeur, + montant, + devise, + num_compte, + detail, + bq_account , + jrn, + status) + values ('$code', + to_date('$date_exec','DD-MM-YYYY'), + to_date('$date_exec','DD-MM-YYYY'), + $montant, + '$devise', + '".$num_compte."', + '".addslashes($detail)." ', + '$p_bq_account', + $p_jrn, + 'n')"; + try + { + ExecSql($p_cn,$Sql,'latin1'); + } + + + catch(Exception $e) + { + echo(__FILE__.":".__LINE__." Erreur : ".$e->getCode()." msg ".$e->getMessage()); + rollback($p_cn); + break; + } + + } // for ($c=0;$c<$num;$c++) + $line++; + +} // file is read + +fclose($handle); +commit($p_cn); +?> diff --git a/sql/upgrade.sql b/sql/upgrade.sql index 8344eabb3..e69de29bb 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -1,40 +0,0 @@ -begin; -DROP FUNCTION tva_insert (text,numeric,text,text); - -CREATE FUNCTION tva_insert(text, numeric, text, text) RETURNS integer - AS $_$ -declare -l_tva_id integer; -p_tva_label alias for $1; -p_tva_rate alias for $2; -p_tva_comment alias for $3; -p_tva_poste alias for $4; -debit text; -credit text; -nCount integer; -begin -if length(trim(p_tva_label)) = 0 then - return 3; -end if; - -if length(trim(p_tva_poste)) != 0 then - if position (',' in p_tva_poste) = 0 then return 4; end if; - debit = split_part(p_tva_poste,',',1); - credit = split_part(p_tva_poste,',',2); - select count(*) into nCount from tmp_pcmn where pcm_val=debit::poste_comptable; - if nCount = 0 then return 4; end if; - select count(*) into nCount from tmp_pcmn where pcm_val=credit::poste_comptable; - if nCount = 0 then return 4; end if; - -end if; -select into l_tva_id nextval('s_tva') ; -insert into tva_rate(tva_id,tva_label,tva_rate,tva_comment,tva_poste) - values (l_tva_id,p_tva_label,p_tva_rate,p_tva_comment,p_tva_poste); -return 0; -end; -$_$ -LANGUAGE plpgsql; - - - -commit;