Reformat the code with

- astyle --style=ansi
Broke : the <<<<EOF
.
This commit is contained in:
Dany De Bontridder 2010-09-14 15:27:31 +00:00
parent 6c1a597fdf
commit 0e5fcddfc1
246 changed files with 42452 additions and 36227 deletions

View file

@ -43,11 +43,13 @@ extract($_REQUEST);
$var=array('gDossier','op','ctl');
$cont=0;
/* check if mandatory parameters are given */
foreach ($var as $v) {
if ( ! isset ($_REQUEST [$v] ) ) {
echo "$v is not set ";
$cont=1;
}
foreach ($var as $v)
{
if ( ! isset ($_REQUEST [$v] ) )
{
echo "$v is not set ";
$cont=1;
}
}
set_language();
@ -59,100 +61,113 @@ $User->Check();
if ($User->get_ledger_access(dossier::id()) == 'X') exit();
$xml="";
switch ($op) {
/*----------------------------------------------------------------------
* Show the form and the result
*
----------------------------------------------------------------------*/
switch ($op)
{
/*----------------------------------------------------------------------
* Show the form and the result
*
----------------------------------------------------------------------*/
case "sf":
$ipopup=$ctl;
$attr=sprintf('this.ctl=\'%s\';',$ipopup);
$ctl.='_content';
$it=new IText('acc_query');
$it->size=30;
$it->value=(isset($q))?$q:'';
$str_poste=$it->input();
$str_submit=HtmlInput::submit('sf',_('Recherche'));
$ipopup=$ctl;
$attr=sprintf('this.ctl=\'%s\';',$ipopup);
$ctl.='_content';
$it=new IText('acc_query');
$it->size=30;
$it->value=(isset($q))?$q:'';
$str_poste=$it->input();
$str_submit=HtmlInput::submit('sf',_('Recherche'));
$r='<form id="sp" method="get" onsubmit="'.$attr.'search_get_poste(this);return false;">';
ob_start();
require_once('template/account_search.php');
$r.=ob_get_contents();
ob_clean();
$r.=dossier::hidden();
$r.=(isset ($c))?HtmlInput::hidden('account',$c):"";
$r.=(isset ($l))?HtmlInput::hidden('label',$l):"";
$r.=(isset ($j))?HtmlInput::hidden('jrn',$j):"";
$r.=(isset ($nover))?HtmlInput::hidden('nover','1'):"";
$r.=(isset ($nosearch))?HtmlInput::hidden('nosearch','1'):"";
$r.=(isset ($bracket))?HtmlInput::hidden('bracket','1'):"";
$r='<form id="sp" method="get" onsubmit="'.$attr.'search_get_poste(this);return false;">';
ob_start();
require_once('template/account_search.php');
$r.=ob_get_contents();
ob_clean();
$r.=dossier::hidden();
$r.=(isset ($c))?HtmlInput::hidden('account',$c):"";
$r.=(isset ($l))?HtmlInput::hidden('label',$l):"";
$r.=(isset ($j))?HtmlInput::hidden('jrn',$j):"";
$r.=(isset ($nover))?HtmlInput::hidden('nover','1'):"";
$r.=(isset ($nosearch))?HtmlInput::hidden('nosearch','1'):"";
$r.=(isset ($bracket))?HtmlInput::hidden('bracket','1'):"";
$r.='</form>';
$sql="select pcm_val,pcm_lib,pcm_val_parent,pcm_type ".
" from tmp_pcmn ";
$sep=" where ";
/* build the sql stmt */
if ( isset($j) && $j > 0 && isNumber($j)) {
/* create a filter on the ledger */
$ledger=new Acc_Account_Ledger($cn,0);
$fd_id=$ledger->build_sql_account($j);
if ( $fd_id != '' ){
$sql.=" $sep (".$fd_id.')';
$sep=" and ";
$r.='</form>';
$sql="select pcm_val,pcm_lib,pcm_val_parent,pcm_type ".
" from tmp_pcmn ";
$sep=" where ";
/* build the sql stmt */
if ( isset($j) && $j > 0 && isNumber($j))
{
/* create a filter on the ledger */
$ledger=new Acc_Account_Ledger($cn,0);
$fd_id=$ledger->build_sql_account($j);
if ( $fd_id != '' )
{
$sql.=" $sep (".$fd_id.')';
$sep=" and ";
}
}
}
/* show result */
if ( isset($q) && strlen(trim($q)) > 0) {
$q=sql_string($q);
$sql.=sprintf(" $sep ( pcm_val::text like '%s%%' or pcm_lib::text ilike '%%%s%%') ",
$q,$q);
}
$sql.=' order by pcm_val::text limit 50';
if ( isset($q) && strlen(trim($q))> 0 ) {
$array=$cn->get_array($sql);
}
if ( ! isset($q) ) $array=array();
if ( isset($q) && strlen(trim($q))==0) $array=array();
/* set the javascript */
for ($i=0;$i<count($array);$i++) {
$pcm_val=$array[$i]['pcm_val'];
if ( isset($bracket)) {$pcm_val='['.$pcm_val.']'; }
if (isset($nover)) {
/* no overwrite */
$str=sprintf("$('%s').value=$('%s').value+' '+'%s';",
$c,$c,$pcm_val);
} else {
$str=sprintf("$('%s').value='%s';",
$c,$pcm_val);
/* show result */
if ( isset($q) && strlen(trim($q)) > 0)
{
$q=sql_string($q);
$sql.=sprintf(" $sep ( pcm_val::text like '%s%%' or pcm_lib::text ilike '%%%s%%') ",
$q,$q);
}
if ( isset($l) ){
$str.=sprintf("set_value('%s',g('%s').innerHTML);",
$l,"lib$i");
$sql.=' order by pcm_val::text limit 50';
if ( isset($q) && strlen(trim($q))> 0 )
{
$array=$cn->get_array($sql);
}
$str.="hideIPopup('$ipopup');";
$array[$i]['javascript']=$str;
}
ob_start();
if ( ! isset($q) ) $array=array();
if ( isset($q) && strlen(trim($q))==0) $array=array();
require_once('template/account_result.php');
$r.=ob_get_contents();
ob_clean();
/* set the javascript */
for ($i=0;$i<count($array);$i++)
{
$pcm_val=$array[$i]['pcm_val'];
if ( isset($bracket))
{
$pcm_val='['.$pcm_val.']';
}
if (isset($nover))
{
/* no overwrite */
$str=sprintf("$('%s').value=$('%s').value+' '+'%s';",
$c,$c,$pcm_val);
$html=$r;
break;
}
else
{
$str=sprintf("$('%s').value='%s';",
$c,$pcm_val);
}
if ( isset($l) )
{
$str.=sprintf("set_value('%s',g('%s').innerHTML);",
$l,"lib$i");
}
$str.="hideIPopup('$ipopup');";
$array[$i]['javascript']=$str;
}
ob_start();
require_once('template/account_result.php');
$r.=ob_get_contents();
ob_clean();
$html=$r;
break;
}
$html=escape_xml($html);
header('Content-type: text/xml; charset=UTF-8');
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<ctl>$ctl</ctl>
<code>$html</code>
</data>
<data>
<ctl>$ctl</ctl>
<code>$html</code>
</data>
EOF;