20 |
|
|
21 |
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr |
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr |
22 |
//$Revision$ |
//$Revision$ |
23 |
|
include_once("impress_inc.php"); |
24 |
/* function EncodeForm |
/* function EncodeForm |
25 |
* Purpose : |
* Purpose : |
26 |
* Encoding Form |
* Encoding Form |
104 |
echo '<INPUT TYPE="submit" value="Enregistre" name="record">'; |
echo '<INPUT TYPE="submit" value="Enregistre" name="record">'; |
105 |
} |
} |
106 |
echo '<INPUT TYPE="submit" value="Ajoute une ligne" name="add_line">'; |
echo '<INPUT TYPE="submit" value="Ajoute une ligne" name="add_line">'; |
107 |
|
echo '<INPUT TYPE="submit" value="Efface ce formulaire" name="del_form">'; |
108 |
|
|
109 |
echo "</FORM>"; |
echo "</FORM>"; |
110 |
|
|
111 |
} |
} |
131 |
EncodeForm($l_line,$p_sessid,$array); |
EncodeForm($l_line,$p_sessid,$array); |
132 |
|
|
133 |
} |
} |
134 |
|
/* function ViewForm |
135 |
|
* Purpose : Show the details of a form |
136 |
|
* |
137 |
|
* parm : |
138 |
|
* - $p_cn connection |
139 |
|
* - $p_id gives the formdef.fr_id |
140 |
|
* - sessid for the search window |
141 |
|
* gen : |
142 |
|
* - none |
143 |
|
* return: |
144 |
|
* - none |
145 |
|
* |
146 |
|
*/ |
147 |
|
function DeleteForm($p_cn,$p_id) { |
148 |
|
ExecSql($p_cn,"delete from form where fo_fr_id=$p_id"); |
149 |
|
ExecSql($p_cn,"delete from formdef where fr_id=$p_id"); |
150 |
|
} |
151 |
/* function GetDataForm |
/* function GetDataForm |
152 |
* Purpose : |
* Purpose : |
153 |
* Get data from a form |
* Get data from a form |
237 |
echo_debug ("UpdateForm $key = $element"); |
echo_debug ("UpdateForm $key = $element"); |
238 |
${"$key"}=$element; |
${"$key"}=$element; |
239 |
} |
} |
240 |
$Res=ExecSql($p_cn,"update formdef set fr_label='".$form_nom."' where fr_id=".$fr_id); |
$Res=ExecSql($p_cn,"update formdef set fr_label='".FormatString($form_nom)."' where fr_id=".$fr_id); |
241 |
$Res=ExecSql($p_cn,"delete from form where fo_fr_id=".$fr_id); |
$Res=ExecSql($p_cn,"delete from form where fo_fr_id=".$fr_id); |
242 |
// Test les positions |
// Test les positions |
243 |
for ($i =0; $i <$line;$i++) { |
for ($i =0; $i <$line;$i++) { |
262 |
${"text$i"}=FormatString(${"text$i"}); |
${"text$i"}=FormatString(${"text$i"}); |
263 |
${"form$i"}=FormatString(${"form$i"}); |
${"form$i"}=FormatString(${"form$i"}); |
264 |
if ( ${"text$i"} != null ) { |
if ( ${"text$i"} != null ) { |
265 |
|
if ( CheckFormula(${"form$i"}) == false ) |
266 |
|
${"form$i"}="!!!!!!! FORMULE INVALIDE ".${"form$i"}; |
267 |
|
|
268 |
${"form$i"}=(${"form$i"}==null)?"null":"'".${"form$i"}."'"; |
${"form$i"}=(${"form$i"}==null)?"null":"'".${"form$i"}."'"; |
269 |
$sql=sprintf("insert into form (fo_fr_id, |
$sql=sprintf("insert into form (fo_fr_id, |
270 |
fo_pos, |
fo_pos, |
274 |
%d, |
%d, |
275 |
'%s', |
'%s', |
276 |
%s)", |
%s)", |
277 |
$fr_id,${"pos$i"},${"text$i"},${"form$i"} |
$fr_id,${"pos$i"}, |
278 |
|
${"text$i"}, |
279 |
|
${"form$i"} |
280 |
); |
); |
281 |
$Res=ExecSql($p_cn,$sql); |
$Res=ExecSql($p_cn,$sql); |
282 |
} |
} |
307 |
echo_error("Nom ou ligne non défini"); |
echo_error("Nom ou ligne non défini"); |
308 |
return; |
return; |
309 |
} |
} |
310 |
$sql="insert into formdef (fr_label) values ('".$form_nom."')"; |
$sql="insert into formdef (fr_label) values ('".FormatString($form_nom)."')"; |
311 |
$Res=ExecSql($p_cn,$sql); |
$Res=ExecSql($p_cn,$sql); |
312 |
$n=GetSequence($p_cn,"s_formdef"); |
$n=GetSequence($p_cn,"s_formdef"); |
313 |
|
|
315 |
${"text$i"}=FormatString(${"text$i"}); |
${"text$i"}=FormatString(${"text$i"}); |
316 |
${"form$i"}=FormatString(${"form$i"}); |
${"form$i"}=FormatString(${"form$i"}); |
317 |
if ( ${"text$i"} != null ) { |
if ( ${"text$i"} != null ) { |
318 |
${"form$i"}=(${"form$i"}==null)?${"form$i"}:"'".${"form$i"}."'"; |
// ${"form$i"}=(${"form$i"}==null)?${"form$i"}:"'".${"form$i"}."'"; |
319 |
|
${"form$i"}=(${"form$i"}==null)?"null":"'".${"form$i"}."'"; |
320 |
|
CheckFormula(${"form$i"}); |
321 |
$sql=sprintf("insert into form (fo_fr_id, |
$sql=sprintf("insert into form (fo_fr_id, |
322 |
fo_pos, |
fo_pos, |
323 |
fo_label, |
fo_label, |