From 2324efb0c899658461071d9bc380a2e609ae17e7 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 6 Jan 2009 18:35:51 +0000 Subject: [PATCH] BUG the date was incorrect when avoiding --- html/annulation.php | 25 +++++-------------------- include/class_periode.php | 9 ++++++++- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/html/annulation.php b/html/annulation.php index e545bfd58..ec3111a9b 100644 --- a/html/annulation.php +++ b/html/annulation.php @@ -93,7 +93,6 @@ soit par son écriture inverse ? - @@ -113,17 +112,7 @@ return; // Remove is confirmed if ( isset ($_POST['p_id'])) { $p_id=$_POST['p_id']; - // Get the date - $e_op_date=$_POST['op_date']; - - // Test if date is valid - if ( isDate ($e_op_date) == null ) { - $msg=' Date non valide'; - echo ""; - // set an incorrect pid to get out from here - $p_id=-1; - } if ($p_id != -1 ) { // A // userPref contient la periode par default $userPref=$User->get_periode($cn); @@ -174,12 +163,12 @@ if ($p_id != -1 ) { // A jr_date,jr_grpt_id,jr_internal ,jr_tech_per, jr_valid ) select $seq,jr_def_id,jr_montant,'Annulation '||jr_comment, - now(),$grp_new,'$p_internal', + to_date($1,'DD.MM.YYYY'),$grp_new,'$p_internal', $userPref, true from jrn - where jr_grpt_id=".$_POST['p_id']; - $Res=ExecSql($cn,$sql); + where jr_grpt_id=$2"; + $Res=ExecSqlParam($cn,$sql,array($l_date_start,$_POST['p_id'])); // Check return code if ( $Res == false) throw (new Exception(__FILE__.__LINE__."sql a echoue [ $sql ]")); @@ -392,13 +381,10 @@ echo '
Opération '.$l_array['jr_internal'].'
'; $a=new widget("text"); -// $a=InputType("Date","text", "op_date",$e_op_date,false); -//echo 'Date : '.$e_op_date; $a->SetReadOnly(false); -echo $a->IOValue("op_date",$e_op_date,"Date"); echo '
'; -//$a=InputType("Description:","text_big","comment",$e_comment,false); + $a->size=80; echo $a->IOValue("comment",$e_comment,"Description"); echo '
'; @@ -418,8 +404,7 @@ for ( $i = 0; $i < $max_cred;$i++) { echo ${"e_class_cred$i"}." $lib "."".${"e_mont_cred$i"}.""; echo ''; } -//echo "operation concernée $e_rapt

-//"; + $a=GetConcerned($cn,$e_jr_id); if ( $a != null ) { diff --git a/include/class_periode.php b/include/class_periode.php index 51059fbfc..548f5a072 100644 --- a/include/class_periode.php +++ b/include/class_periode.php @@ -75,6 +75,8 @@ class Periode { return 0; } function is_open() { + /* if jrn_Def_id == 0 then we check the global otherwise we check + a ledger */ if ( $this->jrn_def_id != 0 ) $sql="select status from jrn_periode ". " where jrn_def_id=".$this->jrn_def_id. @@ -323,8 +325,13 @@ class Periode { return pg_fetch_array($Res,0); } + + public function first_day() { + list($p_start,$p_end)=$this->get_date_limit($this->p_id); + return $p_start; + } function get_exercice() { - $sql="select p_exercice from parm_periode where p_id=".$this->id; + $sql="select p_exercice from parm_periode where p_id=".$this->p_id; $Res=ExecSql($this->cn,$sql); if ( pg_NumRows($Res) == 0) return null; return pg_fetch_result($Res,0,0);