Database set search_path to the schema with function

This commit is contained in:
Dany De Bontridder 2010-04-12 15:00:52 +00:00
parent ae93b5e010
commit aef684fa1a
7 changed files with 508 additions and 28 deletions

View file

@ -134,22 +134,22 @@ if ( isset ($_POST['view'] ) ) {
echo '<TD><form method="POST" ACTION="print_balance.php">'.
dossier::hidden().
HtmlInput::submit('bt_pdf',"Export PDF").
$hid->input("p_action","impress").
$hid->input("from_periode",$_POST['from_periode']).
$hid->input("to_periode",$_POST['to_periode']).
$hid->input("p_jrn",$_POST['p_jrn']).
$hid->input("from_poste",$_POST['from_poste']).
$hid->input("to_poste",$_POST['to_poste']);
HtmlInput::hidden("p_action","impress").
HtmlInput::hidden("from_periode",$_POST['from_periode']).
HtmlInput::hidden("to_periode",$_POST['to_periode']).
HtmlInput::hidden("p_jrn",$_POST['p_jrn']).
HtmlInput::hidden("from_poste",$_POST['from_poste']).
HtmlInput::hidden("to_poste",$_POST['to_poste']);
echo "</form></TD>";
echo '<TD><form method="POST" ACTION="bal_csv.php">'.
HtmlInput::submit('bt_csv',"Export CSV").
dossier::hidden().
$hid->input("p_action","impress").
$hid->input("from_periode",$_POST['from_periode']).
$hid->input("to_periode",$_POST['to_periode']).
$hid->input("p_jrn",$_POST['p_jrn']).
$hid->input("from_poste",$_POST['from_poste']).
$hid->input("to_poste",$_POST['to_poste']);
HtmlInput::hidden("p_action","impress").
HtmlInput::hidden("from_periode",$_POST['from_periode']).
HtmlInput::hidden("to_periode",$_POST['to_periode']).
HtmlInput::hidden("p_jrn",$_POST['p_jrn']).
HtmlInput::hidden("from_poste",$_POST['from_poste']).
HtmlInput::hidden("to_poste",$_POST['to_poste']);
echo "</form></TD>";
@ -179,10 +179,10 @@ if ( isset($_POST['view'] ) ) {
$row=$bal->get_row($_POST['from_periode'],
$_POST['to_periode']);
$periode=new Periode($cn);
$a=$periode->get_date_limit($_POST['from_periode']);
$b=$periode->get_date_limit($_POST['to_periode']);
echo "<h2 class=\"info\"> période du ".$a['p_start']." au ".$b['p_end']."</h2>";
$periode=new Periode($cn);
$a=$periode->get_date_limit($_POST['from_periode']);
$b=$periode->get_date_limit($_POST['to_periode']);
echo "<h2 class=\"info\"> période du ".$a['p_start']." au ".$b['p_end']."</h2>";
echo '<table width="100%">';
echo '<th>Poste Comptable</th>';

View file

@ -80,6 +80,7 @@ de donn&eacute;es");
}
$this->db=$a;
if ($p_type == 'dos'||$p_type=='mod') (pg_exec($this->db,'set search_path to public,comptaproc;');
ob_end_clean();
}

View file

@ -817,7 +817,7 @@ Array
$class=$this->strAttribut(ATTR_DEF_ACCOUNT);
$is_used_jrnx=0;
if ( trim(strlen($class)) != 0 && isNumber($class) == 1 )
$is_used_jrnx= $this->cn->count_sql("select * from jrnx where j_poste=$class");
$is_used_jrnx= $this->cn->count_sql("select * from jrnx where j_poste=$1",array($class));
// if class is not NULL and if we use it before, we can't remove it
if (FormatString($class) != null && $is_used_jrnx != 0 )
{
@ -828,7 +828,7 @@ Array
// Remove in PCMN
if ( trim(strlen($class)) != 0 && isNumber($class) == 1 && $is_used_jrnx == 0)
{
$this->cn->exec_sql("delete from tmp_pcmn where pcm_val=$class");
$this->cn->exec_sql("delete from tmp_pcmn where pcm_val=$1",array($class));
}
}

View file

@ -152,7 +152,7 @@ if ( isset( $_REQUEST['bt_html'] ) ) {
$go=3;
}
// Check if the post is numeric and exists
elseif ( $cn->count_sql('select * from tmp_pcmn where pcm_val='.FormatString($_GET['poste_id'])) != 0 )
elseif ( $cn->count_sql('select * from tmp_pcmn where pcm_val=$1',array($_GET['poste_id'])) != 0 )
{
$Poste=new Acc_Account_Ledger($cn,$_GET['poste_id']);$go=1;
}