Reformat the code with
- astyle --style=ansi Broke : the <<<<EOF .
This commit is contained in:
parent
6c1a597fdf
commit
0e5fcddfc1
246 changed files with 42452 additions and 36227 deletions
141
html/fid.php
141
html/fid.php
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
||||
|
||||
/*!\file
|
||||
/*!\file
|
||||
* \brief Fid for the ajax request for cards
|
||||
* \see fiche_search.php
|
||||
* Valid parameter GET are
|
||||
|
|
@ -56,82 +56,91 @@ $fPrice_purchase=(isset($_REQUEST['b']))?$_REQUEST['b']:'none';
|
|||
|
||||
|
||||
if ( isset($_SESSION['isValid']) && $_SESSION['isValid'] == 1)
|
||||
{
|
||||
$jrn=FormatString($_GET['j']);
|
||||
$d=FormatString($_GET['d']);
|
||||
{
|
||||
$jrn=FormatString($_GET['j']);
|
||||
$d=FormatString($_GET['d']);
|
||||
|
||||
if ( $jrn == -1 )
|
||||
$d='all';
|
||||
if ( strpos($d,'sql') == false ) {
|
||||
if ( $jrn == -1 )
|
||||
$d='all';
|
||||
if ( strpos($d,'sql') == false )
|
||||
{
|
||||
|
||||
switch ($d) {
|
||||
case 'cred':
|
||||
$filter_jrn=$cn->make_list("select jrn_def_fiche_cred from jrn_def where jrn_def_id=$1",array($jrn));
|
||||
$filter_card=($filter_jrn != "")?" and fd_id in ($filter_jrn)":' and false ';
|
||||
|
||||
break;
|
||||
case 'deb':
|
||||
$filter_jrn=$cn->make_list("select jrn_def_fiche_deb from jrn_def where jrn_def_id=$1",array($jrn));
|
||||
$filter_card=($filter_jrn != "")?" and fd_id in ($filter_jrn)":' and false ';
|
||||
break;
|
||||
case 'all':
|
||||
$filter_card="";
|
||||
break;
|
||||
case 'filter':
|
||||
$get_cred='jrn_def_fiche_cred';
|
||||
$get_deb='jrn_def_fiche_deb';
|
||||
$filter_jrn=$cn->make_list("select $get_cred||','||$get_deb as fiche from jrn_def where jrn_def_id=$1",array($jrn));
|
||||
$filter_card=($filter_jrn != "")?" and fd_id in ($filter_jrn)":' and false ';
|
||||
switch ($d)
|
||||
{
|
||||
case 'cred':
|
||||
$filter_jrn=$cn->make_list("select jrn_def_fiche_cred from jrn_def where jrn_def_id=$1",array($jrn));
|
||||
$filter_card=($filter_jrn != "")?" and fd_id in ($filter_jrn)":' and false ';
|
||||
|
||||
break;
|
||||
case 'all':
|
||||
$filter_card='';
|
||||
break;
|
||||
break;
|
||||
case 'deb':
|
||||
$filter_jrn=$cn->make_list("select jrn_def_fiche_deb from jrn_def where jrn_def_id=$1",array($jrn));
|
||||
$filter_card=($filter_jrn != "")?" and fd_id in ($filter_jrn)":' and false ';
|
||||
break;
|
||||
case 'all':
|
||||
$filter_card="";
|
||||
break;
|
||||
case 'filter':
|
||||
$get_cred='jrn_def_fiche_cred';
|
||||
$get_deb='jrn_def_fiche_deb';
|
||||
$filter_jrn=$cn->make_list("select $get_cred||','||$get_deb as fiche from jrn_def where jrn_def_id=$1",array($jrn));
|
||||
$filter_card=($filter_jrn != "")?" and fd_id in ($filter_jrn)":' and false ';
|
||||
|
||||
default:
|
||||
$filter_card="and fd_id in ($d)";
|
||||
break;
|
||||
case 'all':
|
||||
$filter_card='';
|
||||
break;
|
||||
|
||||
default:
|
||||
$filter_card="and fd_id in ($d)";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$filter_card=$d;
|
||||
$filter_card=str_replace('[sql]','',$d);
|
||||
}
|
||||
$sql="select vw_name,vw_addr,vw_cp,vw_buy,vw_sell,tva_id
|
||||
from vw_fiche_attr
|
||||
where quick_code=upper($1)". $filter_card;
|
||||
else
|
||||
{
|
||||
$filter_card=$d;
|
||||
$filter_card=str_replace('[sql]','',$d);
|
||||
}
|
||||
$sql="select vw_name,vw_addr,vw_cp,vw_buy,vw_sell,tva_id
|
||||
from vw_fiche_attr
|
||||
where quick_code=upper($1)". $filter_card;
|
||||
|
||||
$array=$cn->get_array($sql, array($_REQUEST['FID']));
|
||||
$array=$cn->get_array($sql, array($_REQUEST['FID']));
|
||||
|
||||
if ( empty($array)) { echo '{"answer":"nok","flabel":"'.$fLabel.'"}'; exit;}
|
||||
if ( empty($array))
|
||||
{
|
||||
echo '{"answer":"nok","flabel":"'.$fLabel.'"}';
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$name=$array[0]['vw_name'];
|
||||
$sell=$array[0]['vw_sell'] ;
|
||||
$buy=$array[0]['vw_buy'];
|
||||
$tva_id=$array[0]['tva_id'];
|
||||
$name=$array[0]['vw_name'];
|
||||
$sell=$array[0]['vw_sell'] ;
|
||||
$buy=$array[0]['vw_buy'];
|
||||
$tva_id=$array[0]['tva_id'];
|
||||
|
||||
// Check null
|
||||
$name=($name==null)?" ":str_replace('"','',$name);
|
||||
$sell=($sell==null)?" ":str_replace('"','',$sell);
|
||||
$buy=($buy==null)?" ":str_replace('"','',$buy);
|
||||
$tva_id=($tva_id==null)?" ":str_replace('"','',$tva_id);
|
||||
/* store the answer in an array and transform it later into a JSON object */
|
||||
$tmp=array();
|
||||
$tmp[]=array('flabel',$fLabel);
|
||||
$tmp[]=array('name',h($name));
|
||||
$tmp[]=array('ftva_id',$fTva_id);
|
||||
$tmp[]=array('tva_id',$tva_id);
|
||||
$tmp[]=array('fPrice_sale',$fPrice_sale);
|
||||
$tmp[]=array('sell',$sell);
|
||||
$tmp[]=array('fPrice_purchase',$fPrice_purchase);
|
||||
$tmp[]=array('buy',$buy);
|
||||
$a='{"answer":"ok"';
|
||||
for ($o=0;$o < count($tmp);$o++) {
|
||||
$a.=sprintf(',"%s":"%s"',$tmp[$o][0],$tmp[$o][1]);
|
||||
}
|
||||
$a.='}';
|
||||
// Check null
|
||||
$name=($name==null)?" ":str_replace('"','',$name);
|
||||
$sell=($sell==null)?" ":str_replace('"','',$sell);
|
||||
$buy=($buy==null)?" ":str_replace('"','',$buy);
|
||||
$tva_id=($tva_id==null)?" ":str_replace('"','',$tva_id);
|
||||
/* store the answer in an array and transform it later into a JSON object */
|
||||
$tmp=array();
|
||||
$tmp[]=array('flabel',$fLabel);
|
||||
$tmp[]=array('name',h($name));
|
||||
$tmp[]=array('ftva_id',$fTva_id);
|
||||
$tmp[]=array('tva_id',$tva_id);
|
||||
$tmp[]=array('fPrice_sale',$fPrice_sale);
|
||||
$tmp[]=array('sell',$sell);
|
||||
$tmp[]=array('fPrice_purchase',$fPrice_purchase);
|
||||
$tmp[]=array('buy',$buy);
|
||||
$a='{"answer":"ok"';
|
||||
for ($o=0;$o < count($tmp);$o++)
|
||||
{
|
||||
$a.=sprintf(',"%s":"%s"',$tmp[$o][0],$tmp[$o][1]);
|
||||
}
|
||||
$a.='}';
|
||||
}
|
||||
else
|
||||
$a='{"answer":"unauthorized"}';
|
||||
else
|
||||
$a='{"answer":"unauthorized"}';
|
||||
header("Content-type: text/html; charset: utf8",true);
|
||||
print $a;
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue