/*
* This file is part of WCOMPTA.
*
* WCOMPTA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* WCOMPTA is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WCOMPTA; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
// $Revision$
/* function
* Purpose :
*
* parm :
* -
* gen :
* -
* return:
* -
*
*/
function AddFiche($p_cn,$p_type,$p_array) {
echo_debug(" AddFiche($p_cn,$p_type,$p_array) ");
foreach ($p_array as $key=>$element){
${"p_$key"}=$element;
echo_debug("p_$key=$element;");
}
$base=GetBaseFiche($p_cn,$p_type);
$num=GetNextFiche($p_cn,$base);
$sql=sprintf("insert into tmp_pcmn (pcm_val,pcm_lib,pcm_val_parent)
values (%s,'%s',%d)",
$num,
$p_nom0,
$base);
echo_debug($sql);
$Res=ExecSql($p_cn,$sql);
$sql=sprintf("insert into fiche ( f_id,f_label,f_fd_id) values (%d,'%s',%d)",
$num,$p_nom0,$p_type);
$Res=ExecSql($p_cn,$sql);
for ( $i = 1; $i < $p_inc;$i++) {
$sql=sprintf("insert into isupp (is_f_id,is_isd_id,is_value) values (
%d,%d,'%s')",
$num, ${"p_isd_id$i"},${"p_nom$i"});
echo_debug($sql);
$Res=ExecSql($p_cn,$sql);
}
}
/* function
* Purpose :
*
* parm :
* -
* gen :
* -
* return:
* -
*
*/
function EncodeFiche($p_cn,$p_type,$p_array=null) {
echo_debug("function EncodeFiche($p_cn,$p_type) ");
$ch_col="
";
$ch_li='
';
echo '';
}else {
$sql="select f_label,f_fd_id from fiche where f_id=".$p_type;
$Res=ExecSql($p_cn,$sql);
$Max=pg_NumRows($Res);
if ( $Max == 0 ) return;
$l_line=pg_fetch_array($Res,0);
printf(' ',
$l_line['f_label']);
echo '';
$sql="select isd_fd_id,isd_id,isd_label,is_value,is_id,is_f_id from isupp left join isupp_def on isd_id=is_isd_id where is_f_id=".$p_type;
$Res=ExecSql($p_cn,$sql);
$Max=pg_NumRows($Res);
echo_debug("Max ==== $Max");
echo '';
echo '';
for ($i=0;$i < $Max;$i++) {
$l_line=pg_fetch_array($Res,$i);
$Hid=sprintf('',
$i,$l_line['is_id']);
printf ('
%s
%s
',
$l_line['isd_label'], $i, $l_line['is_value'],$Hid);
}
echo '';
echo '';
echo '';
echo '';
}
}
/* function
* Purpose :
*
* parm :
* -
* gen :
* -
* return:
* -
*
*/
function GetBaseFiche($p_cn,$p_type) {
$base=null;
$Res=ExecSql($p_cn,"select fd_class_base from fichedef where fd_id=".$p_type);
if ( pg_NumRows($Res) == 0 ) return;
$base=pg_fetch_array($Res,0);
return $base['fd_class_base'];
}
/* function
* Purpose :
*
* parm :
* -
* gen :
* -
* return:
* -
*
*/
function ViewFiche($p_cn,$p_type) {
$Res=ExecSql($p_cn,"select f_id,f_label from fiche where f_fd_id='".$p_type."' order by f_id");
$Max=pg_NumRows($Res);
for ( $i = 0; $i < $Max; $i++) {
$l_line=pg_fetch_array($Res,$i);
$div="