Fix bug due to quote

This commit is contained in:
sparkyx 2006-08-06 13:26:06 +00:00
parent 9f4b3ce4c1
commit 9eae7051bb
8 changed files with 45 additions and 33 deletions

View file

@ -134,7 +134,7 @@ if ( isset ($_GET["change_name"] ) ) {
echo "<h2 class=\"error\"> Pas d'accès </h2>";
else
{
SaveModeleName($cn,$_GET["fd_id"],$_GET["label"]);
SaveModeleName($cn,$_GET["fd_id"],FormatString($_GET["label"]));
UpdateModele($cn,$_GET["fd_id"],$search);
}
echo '</DIV>';
@ -172,7 +172,7 @@ if ( isset ($_POST["update_fiche"]) ) {
$a=UpdateFiche($cn,$HTTP_POST_VARS);
}
$fd_id=GetFicheDef($cn,$_POST["f_id"]);
ViewFiche($cn,$fd_id);
echo '</DIV>';

View file

@ -76,7 +76,7 @@ BODY {
<script src="scripts.js" type="text/javascript"></script>
</head>
<BODY onLoad="SetFocus(\'login\',0)">
Version 2.0.0
Version 2.0.1
<div class="remark">
<p class="gras">Il est conseill&eacute; de ne PAS utiliser Internet Explorer.
</p><p>

View file

@ -29,7 +29,7 @@ include_once("debug.php");
if ( isset ($_POST["p_user"] ) ) {
echo_debug('login.php',__LINE__,"user is set");
$g_user=$_POST["p_user"];
$g_user=FormatString($_POST["p_user"]);
$g_pass=$_POST["p_pass"];
$_SESSION['g_user']=$g_user;
$_SESSION['g_pass']=$g_pass;

View file

@ -76,6 +76,7 @@ function cmpDate ($p_date,$p_date_oth) {
function isNumber($p_int) {
if ( strlen (trim($p_int)) == 0 ) return 0;
$p_int=trim($p_int);
$p_int=FormatString($p_int);
if (! ereg ("^-{0,1}[0-9]+.{0,1}[0-9]*$",$p_int) ) {
return 0;
} else {

View file

@ -75,7 +75,7 @@ function AddFiche($p_cn,$p_type,$p_array) {
break;
}
// if account already exist do nothing in tmp_pcmn otherwise add it
if (CountSql($p_cn,"select pcm_val from tmp_pcmn where pcm_val=".${"p_av_text$i"}) == 0 )
if (CountSql($p_cn,"select pcm_val from tmp_pcmn where pcm_val=".FormatString(${"p_av_text$i"})) == 0 )
{
$len=strlen(${"p_av_text$i"})-1;
// Mother account
@ -567,7 +567,7 @@ function UpdateFiche($p_cn,$p_array) {
if ( $key == 'ad_id'.ATTR_DEF_TVA ) {
// is a valid rate ?
if ( strlen(trim($element)) == 0 ) continue;
if ( CountSql($p_cn,"select * from tva_rate where tva_id='".$element."'") == 0 ) {
if ( CountSql($p_cn,"select * from tva_rate where tva_id='".FormatString($element)."'") == 0 ) {
// warning
echo_error('invalid rate') ;
echo '<script>
@ -620,17 +620,19 @@ function UpdateFiche($p_cn,$p_array) {
// Retrieve the name and the ad_id 5
$f=pg_fetch_array($Res,0);
$class_old=$f['av_text'];
// if the class changed
if ( $class != $class_old and $class != "" ) {
if ( CountSql($p_cn,"select * from jrnx where j_poste=$class") or
CountSql($p_cn,"select * from jrnx where j_poste=$class_old" ))
{
// No change if the account is already used
echo_error("Not possible to change the account, already used");
} else {
if ( CountSql($p_cn,"select * from tmp_pcmn where pcm_val=".$class) ==0)
// we have to insert
if ( isNumber($class)==1 && isNumber($class_old)==1) {
echo_debug('fiche_inc'," $class and $class_old are number");
// if the class changed
if ( $class != $class_old and $class != "" ) {
if ( CountSql($p_cn,"select * from jrnx where j_poste=$class") or
CountSql($p_cn,"select * from jrnx where j_poste=$class_old" ))
{
// No change if the account is already used
echo_error("Not possible to change the account, already used");
} else {
if ( CountSql($p_cn,"select * from tmp_pcmn where pcm_val=".$class) ==0)
// we have to insert
{
// First we must use a parent
$parent=GetParent($p_cn,$class);
@ -638,28 +640,33 @@ function UpdateFiche($p_cn,$p_array) {
"insert into tmp_pcmn (pcm_val,pcm_lib,pcm_val_parent)
values ($class,'$f_label',$parent)");
}
}
}
$class=$class_old;
} else // $class=""
{
echo_debug('fiche_inc.php',__LINE__,"new account ");
$class=$class_old;
if ( CountSql($p_cn,"select * from tmp_pcmn where pcm_val=".$class) == 0 ) {
// First we must use a parent
} else // $class=""
{
echo_debug('fiche_inc.php',__LINE__,"new account ");
$class=$class_old;
if ( CountSql($p_cn,"select * from tmp_pcmn where pcm_val=".$class) == 0 ) {
// First we must use a parent
$parent=GetParent($p_cn,$class);
$Res=ExecSql($p_cn,
"insert into tmp_pcmn (pcm_val,pcm_lib,pcm_val_parent)
values ($class,'$f_label',$parent)");
}
}
}
}
// Change the name in TMP_PCMN
// Get the new name
$f_label=FormatString($f_label);
ExecSql($p_cn,"update tmp_pcmn set pcm_lib='".$f_label."' where pcm_val=".$class);
ExecSql($p_cn,"update tmp_pcmn set pcm_lib='".$f_label."' where pcm_val=".$class);
}
}
// Update of TMP_PCMN if a class base is given (ad_id=5)

View file

@ -400,10 +400,10 @@ function save_upload_document ($cn,$seq) {
} else {
echo "<H1>Error</H1>";
Rollback($cn);
return null;
}
}
return 0;
}
/*!\brief return the value of the sql, the sql will return only one value
* with the value

View file

@ -420,6 +420,7 @@ function ListJrn($p_cn,$p_jrn,$p_where="",$p_array=null,$p_value=0,$p_paid=0)
// Quick Code
if ( $l_qcode != null )
{
$l_qcode=FormatString($l_qcode);
$sql.=$l_and." jr_grpt_id in ( select j_grpt from
jrnx where j_qcode = '$l_qcode')";
$l_and=" and ";

View file

@ -345,6 +345,7 @@ return $r;
*/
function RecordFin($p_cn,$p_array,$p_user,$p_jrn) {
$internal_code="";
$oid=0;
echo_debug('user_form_fin.php',__LINE__,"RecordFin");
foreach ( $p_array as $v => $e)
{
@ -397,6 +398,8 @@ function RecordFin($p_cn,$p_array,$p_user,$p_jrn) {
// Update comment if comment is blank
$Res=ExecSql($p_cn,"update jrn set jr_comment='".$comment."' where jr_grpt_id=".$seq);
}
if ( $i == 0 )
{
// first record we upload the files and
@ -405,7 +408,7 @@ function RecordFin($p_cn,$p_array,$p_user,$p_jrn) {
$oid=save_upload_document($p_cn,$seq);
} else {
if ( sizeof($_FILES) != 0 )
if ( $oid != 0 )
{
ExecSql($p_cn,"update jrn set jr_pj=".$oid.", jr_pj_name='".$_FILES['pj']['name']."', ".
"jr_pj_type='".$_FILES['pj']['type']."' where jr_grpt_id=$seq");