/[phpcompta]/phpcompta/include/form_inc.php
ViewVC logotype

Diff of /phpcompta/include/form_inc.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by sparkyx, Sun Oct 3 16:47:44 2004 UTC revision 1.6 by sparkyx, Fri Jul 8 18:18:34 2005 UTC
# Line 20  Line 20 
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
# Line 104  if ( isset ($fr_id))   printf ('<INPUT T Line 104  if ( isset ($fr_id))   printf ('<INPUT T
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  }  }
# Line 129  function ViewForm($p_cn,$p_sessid,$p_id) Line 131  function ViewForm($p_cn,$p_sessid,$p_id)
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
# Line 218  function UpdateForm($p_cn,$p_array) { Line 237  function UpdateForm($p_cn,$p_array) {
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++) {
# Line 243  function UpdateForm($p_cn,$p_array) { Line 262  function UpdateForm($p_cn,$p_array) {
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,
# Line 252  function UpdateForm($p_cn,$p_array) { Line 274  function UpdateForm($p_cn,$p_array) {
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        }        }
# Line 283  function AddForm($p_cn,$p_array) { Line 307  function AddForm($p_cn,$p_array) {
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    
# Line 291  function AddForm($p_cn,$p_array) { Line 315  function AddForm($p_cn,$p_array) {
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,

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26