diff --git a/html/admin/setup.php b/html/admin/setup.php
index d9f4841ea..af7033cf1 100644
--- a/html/admin/setup.php
+++ b/html/admin/setup.php
@@ -166,7 +166,7 @@ echo_debug('setup.php',__LINE__,"Execute sql $sql");
*/
function apply_patch($p_cn,$p_name)
{
- $MaxVersion=42;
+ $MaxVersion=44;
echo '
';
for ( $i = 4;$i <= $MaxVersion;$i++)
{
diff --git a/html/admin/sql/patch/upgrade44.sql b/html/admin/sql/patch/upgrade44.sql
new file mode 100644
index 000000000..552931729
--- /dev/null
+++ b/html/admin/sql/patch/upgrade44.sql
@@ -0,0 +1,57 @@
+begin;
+CREATE OR REPLACE FUNCTION insert_jrnx(p_date "varchar", p_montant "numeric", p_poste int4, p_grpt int4, p_jrn_def int4, p_debit bool, p_tech_user text, p_tech_per int4, p_qcode text)
+ RETURNS void AS
+$BODY$
+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;
+ -- 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;
+$BODY$
+ LANGUAGE 'plpgsql' VOLATILE;
+
+update version set val=45;
+
diff --git a/include/user_common.php b/include/user_common.php
index bbae4ad21..70b5e3a81 100644
--- a/include/user_common.php
+++ b/include/user_common.php
@@ -118,7 +118,7 @@ echo_debug('user_common.php',__LINE__,"ComputeTotalVat $a_fiche $a_quant $a_pric
if ( $a_vat_amount != null &&
$a_vat_amount[$idx] != 0 )
{
- $vat_amount= $a_vat_amount[$idx] ;
+ $vat_amount= $a_vat_amount[$idx] ;
echo_debug(__FILE__.':'.__LINE__.'- VAT_AMOUNT IS GIVEN '.$vat_amount);
}
@@ -301,7 +301,7 @@ function InsertJrnx($p_cn,$p_type,$p_user,$p_jrn,$p_poste,$p_date,$p_amount,$p_g
p_date $p_date p_poste $p_poste
p_amount $p_amount p_grpt = $p_grpt p_periode = $p_periode");
- if ( $p_amount == 0) return true;
+ //if ( $p_amount == 0) return true;
$debit=($p_type=='c')?'false':'true';
@@ -408,7 +408,7 @@ function ListJrn($p_cn,$p_jrn,$p_where="",$p_array=null,$p_value=0,$p_paid=0)
$sort_date="| $image_ascDate $image_desc | ";
$sort_description=" $image_ascDescription $image_desc | ";
$sort_amount=" $image_ascMontant $image_desc | ";
-$sort_echeance=" $image_ascEchéance $image_desc | ";
+$sort_echeance=" $image_ascEch�ance $image_desc | ";
// if an order is asked
if ( isset ($_GET['o']) )
{
@@ -611,7 +611,7 @@ $sort_echeance=" $image_ascEch
$Max=pg_NumRows($Res);
//TODO: correct this message.
- if ($Max==0) return array(0,"Aucun enregistrement trouvé");
+ if ($Max==0) return array(0,"Aucun enregistrement trouvé");
$r.='';
$l_sessid=$_REQUEST['PHPSESSID'];
@@ -627,7 +627,7 @@ $sort_echeance="| $image_ascEch
{
$r.=" | Payé | ";
}
- $r.="Op. Concernée | ";
+ $r.="Op. Concernée | ";
$r.="Document | ";
$r.="";
// Total Amount
@@ -725,7 +725,6 @@ $sort_echeance=" $image_ascEch
$a=GetConcerned($p_cn,$row['jr_id']);
$r.=" | ";
if ( $a != null ) {
- // $r.="operation concernée ";
foreach ($a as $key => $element)
{
@@ -739,7 +738,7 @@ $sort_echeance=" | $image_ascEch
$r.="";
if ( $row['jr_valid'] == 'f' ) {
- $r.=" | Opération annulée | ";
+ $r.=" Opération annulée | ";
} else {
// all operations can be removed either by setting to 0 the amount
// or by writing the opposite operation if the period is closed
@@ -880,7 +879,7 @@ function VerifyOperationDate($p_cn,$p_periode,$p_date) {
list ($l_date_start,$l_date_end)=get_periode($p_cn,$p_periode);
// Date dans la periode active
- echo_debug ("date start periode $l_date_start date fin periode $l_date_end date demandée $p_date");
+ echo_debug ("date start periode $l_date_start date fin periode $l_date_end date demandee $p_date");
if ( cmpDate($p_date,$l_date_start)<0 ||
cmpDate($p_date,$l_date_end)>0 )
{
@@ -1185,7 +1184,7 @@ function CheckPoste($p_cn,$qcode)
if ( CountSql($p_cn,
"select * from tmp_pcmn where pcm_val=$poste") == 0 )
{
- $msg=" Le poste comptable $poste de la fiche ".$qcode." n\'existe pas, il faudra le créer manuellement dans le module comptabilité, menu : avancé->plan comptable";
+ $msg=" Le poste comptable $poste de la fiche ".$qcode." n\'existe pas, il faudra le creer manuellement dans le module comptabilite, menu : avance->plan comptable";
echo_error($msg); echo_debug('poste.php',__LINE__,$msg);
echo "";
return null;
|