BUG the date was incorrect when avoiding

This commit is contained in:
Dany De Bontridder 2009-01-06 18:35:51 +00:00
parent 001c3a242f
commit 2324efb0c8
2 changed files with 13 additions and 21 deletions

View file

@ -93,7 +93,6 @@ soit par son écriture inverse ?
<?php echo dossier::hidden(); ?>
<INPUT TYPE="HIDDEN" NAME="annul">
<INPUT TYPE="HIDDEN" NAME="p_id" value="<?php echo $_POST['p_id']; ?>">
<INPUT TYPE="HIDDEN" NAME="op_date" value="<?php echo $_POST['op_date']; ?>">
<INPUT TYPE="SUBMIT" NAME="confirm" value="Oui">
</FORM>
@ -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 "<script> alert('$msg');</script>";
// 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 '<div align="center"> Op&eacute;ration '.$l_array['jr_internal'].'</div>
<form action="'.$_SERVER['REQUEST_URI'].'" method="post" >';
$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 '<div style="border-style:solid;border-width:1pt;">';
//$a=InputType("Description:","text_big","comment",$e_comment,false);
$a->size=80;
echo $a->IOValue("comment",$e_comment,"Description");
echo '</DIV>';
@ -418,8 +404,7 @@ for ( $i = 0; $i < $max_cred;$i++) {
echo ${"e_class_cred$i"}." $lib "."<B>".${"e_mont_cred$i"}."</B>";
echo '</div>';
}
//echo "operation concern&eacute;e $e_rapt<br><br>
//";
$a=GetConcerned($cn,$e_jr_id);
if ( $a != null ) {

View file

@ -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);