altocompta/doc/developper/html/fiche__inc_8php.html
2006-07-12 21:24:48 +00:00

2925 lines
187 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>phpcompta: fiche_inc.php File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.4 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">include</a></div>
<h1>fiche_inc.php File Reference</h1>Function for managing card, redundant with the class fiche. <a href="#_details">More...</a>
<p>
<p>
<a href="fiche__inc_8php-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a0">AddFiche</a> ($p_cn, $p_type, $p_array)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">ajoute une nouvelle fiche <a href="#a0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a1">EncodeFiche</a> ($p_cn, $p_type, $p_array=null)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Affiche les détails d'une fiche et propose de mettre à jour ou si array est a null, permet d'ajouter une fiche, to fill the attribute. <a href="#a1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a2">GetBaseFiche</a> ($p_cn, $p_type)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">donne la classe comptable de base d'une fiche <a href="#a2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a3">GetBaseFicheDefault</a> ($p_cn, $p_type)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Give the default accounts of <a class="el" href="classfiche__def.html">fiche_def</a>. <a href="#a3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a4">ViewFiche</a> ($p_cn, $p_type)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Montre les fiches d'une rubrique. <a href="#a4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a5">GetNextFiche</a> ($p_cn, $p_base)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Crée le poste suivant pour une fiche en fonction de la classe de base (fichedef(fd_class_base)). <a href="#a5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a6">ViewFicheDetail</a> ($p_cn, $p_id)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Montre le detail d'une fiche et ajoute les lignes manquantes dans le cas où le modèle à changer. <a href="#a6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a7">UpdateFiche</a> ($p_cn, $p_array)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Met a jour une fiche change dans le plan comptable, fiche,et isupp. <a href="#a7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a8">EncodeModele</a> ($p_js)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">parm :<ul>
<li>gen :</li><li>return:</li><li></li></ul>
<a href="#a8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a9">DefModele</a> ($p_cn, $p_js, $p_array=null, $p_ligne=1)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Creation of a model of card or correction. <a href="#a9"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a10">AddModele</a> ($p_cn, $p_array)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Add a modele of card into the database. <a href="#a10"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a11">UpdateModele</a> ($p_cn, $p_fiche)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Modify the model of card change some attribute (fd_label) and permit to add line. <a href="#a11"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a12">GetDataModele</a> ($p_cn, $p_fiche)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the info of an fiche identified by p_fiche. <a href="#a12"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a13">Remove</a> ($p_cn, $p_fid)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">enleve une fiche dans attr_value, jnt_fic_att_value et fiche a la condition que ce poste n'aie jamais été utilisé parm :<ul>
<li>p_cn</li></ul>
<p>
p_fid fiche(f_id) gen :<ul>
<li>none return:</li></ul>
<p>
none <a href="#a13"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a14">getFicheName</a> ($p_cn, $p_id)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">retourne le nom de la fiche en fournissant le quick_code <a href="#a14"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a15">getFicheNameById</a> ($p_cn, $p_id)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">retourne le nom de la fiche en fournissant le f_id <a href="#a15"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a16">getFicheDefName</a> ($p_cn, $p_id)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">retourne le nom de la cat. de fiches <a href="#a16"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a17">GetFicheJrn</a> ($p_cn, $p_jrn, $p_type)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get all the fiche related to a "journal". <a href="#a17"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a18">Get_fiche_def_ref</a> ($p_cn)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">return an array containing all the data contained in the table <a class="el" href="classfiche__def__ref.html">fiche_def_ref</a> parm :<ul>
<li>$p_cn connection to the database gen :</li><li>none return: array if ok null otherwize </li></ul>
<a href="#a18"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a19">Get_attr_min</a> ($p_cn, $p_fiche_def_ref)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">retrieve the mandatory field of the card model <a href="#a19"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a20">Get_attr_def</a> ($p_cn, $p_fiche_def)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">retrieve the fields of the card model <a href="#a20"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a21">GetCreateAccount</a> ($p_cn, $p_fiche_def)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">retrieve the fields of the card model which indicate if each cards needs its own account parm :<ul>
<li>$p_cn database connexion</li></ul>
<p>
$p_fiche_def_ref fiche_def.fd_id gen :<ul>
<li>return: not null if yes, each cards has its own account </li></ul>
<a href="#a21"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a22">GetFicheDefRef</a> ($p_cn, $p_f_id)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">retrieve the <a class="el" href="fiche__def_8inc_8php.html#a1">fiche_def.frd_id</a> thanks the f_id of a card <a href="#a22"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a23">GetFicheDef</a> ($p_cn, $p_f_id)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">retrieve the fiche_def.fd_id thanks the f_id of a card <a href="#a23"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a24">GetClass</a> ($p_cn, $p_fid)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Retrieve the account of a card. <a href="#a24"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a25">InsertModeleLine</a> ($p_cn, $p_fid, $p_adid)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Insert a new row into jnt_fic_attr for adding a new attribute to the card model parm :<ul>
<li>p_cn connection</li></ul>
<p>
the fiche_def.fd_id, id of the cat of the model<ul>
<li>the ad_id is the attr_def.ad_id gen :<ul>
<li>none return: none. </li></ul>
</li></ul>
<a href="#a25"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a26">SaveModeleName</a> ($p_cn, $p_fid, $p_label)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Update the model's name. <a href="#a26"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a27">DisplayDetailModele</a> ($p_cn, $p_array, $MaxLine)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Show the data contained in an array of a model of card (<a class="el" href="classfiche__def.html">fiche_def</a>). <a href="#a27"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a28">GetParent</a> ($p_cn, $p_val)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the parent in tmp_pcmn. <a href="#a28"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a29">getFicheAttribut</a> ($p_cn, $p_id, $p_attr=&quot;&quot;)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">retrun array of attribut or string <a href="#a29"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fiche__inc_8php.html#a30">IsFicheOfJrn</a> ($p_cn, $p_jrn, $p_fiche, $p_type=&quot;&quot;)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check if a fiche is used by a jrn return 1 if the fiche is in the range otherwise 0. <a href="#a30"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Function for managing card, redundant with the class fiche.
<p>
<dl compact><dt><b><a class="el" href="todo.html#_todo000012">Todo:</a></b></dt><dd>remove this file but adapt first the pages which needs those function and complete the <a class="el" href="class__fiche_8php.html">class_fiche.php</a> </dd></dl>
<p>
Definition in file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.<hr><h2>Function Documentation</h2>
<a class="anchor" name="a0"></a><!-- doxytag: member="fiche_inc.php::AddFiche" ref="a0" args="($p_cn, $p_type, $p_array)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">AddFiche </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_type</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_array</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
ajoute une nouvelle fiche
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>$p_cn</em>&nbsp;</td><td>connexion </td></tr>
<tr><td valign="top"></td><td valign="top"><em>$p_type</em>&nbsp;</td><td>type de la fiche </td></tr>
<tr><td valign="top"></td><td valign="top"><em>$p_array</em>&nbsp;</td><td>tableau</td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l00038">38</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="setup_8php-source.html#l00269">$flag</a>, <a class="el" href="jrn__add_8php-source.html#l00172">$num</a>, <a class="el" href="line__update_8php-source.html#l00057">$p_parent</a>, <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="eub__be_8inc_8php-source.html#l00055">$Sql</a>, <a class="el" href="postgres_8php-source.html#l00222">CountSql()</a>, <a class="el" href="debug_8php-source.html#l00034">echo_debug()</a>, <a class="el" href="ac__common_8php-source.html#l00036">echo_error()</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, <a class="el" href="balance_8php-source.html#l00036">exit</a>, <a class="el" href="ac__common_8php-source.html#l00206">FormatString()</a>, <a class="el" href="fiche__inc_8php-source.html#l01181">Get_attr_def()</a>, <a class="el" href="fiche__inc_8php-source.html#l00352">GetBaseFiche()</a>, <a class="el" href="fiche__inc_8php-source.html#l01214">GetCreateAccount()</a>, <a class="el" href="fiche__inc_8php-source.html#l00462">GetNextFiche()</a>, <a class="el" href="postgres_8php-source.html#l00242">GetSequence()</a>, and <a class="el" href="ac__common_8php-source.html#l00076">isNumber()</a>.<div class="fragment"><pre class="fragment"><a name="l00038"></a>00038 {
<a name="l00039"></a>00039 <span class="comment">// TODO ADD ROLLBACK !!!</span>
<a name="l00040"></a>00040 <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,<span class="stringliteral">" AddFiche($p_cn,$p_type,$p_array) "</span>);
<a name="l00041"></a>00041 <span class="comment">// Push the array in element starting with p</span>
<a name="l00042"></a>00042 <span class="comment">//</span>
<a name="l00043"></a>00043 foreach ($p_array as $key=&gt;$element){
<a name="l00044"></a>00044 ${<span class="stringliteral">"p_$key"</span>}=$element;
<a name="l00045"></a>00045 <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,<span class="stringliteral">"p_$key=$element;"</span>);
<a name="l00046"></a>00046 }
<a name="l00047"></a>00047 <span class="comment">// First verify that the name is not null</span>
<a name="l00048"></a>00048 <span class="comment">// av_text.ATTR_DEF_NAME</span>
<a name="l00049"></a>00049 <span class="keywordflow">if</span> ( strlen(trim($p_av_text0 )) ==0 )
<a name="l00050"></a>00050 <span class="keywordflow">return</span>;
<a name="l00051"></a>00051
<a name="l00052"></a>00052 <span class="comment">// First Get the attr of the fiche</span>
<a name="l00053"></a>00053 $field=<a class="code" href="fiche__inc_8php.html#a20">Get_attr_def</a>($p_cn,$p_fd_id);
<a name="l00054"></a>00054
<a name="l00055"></a>00055 <a class="code" href="setup_8php.html#a4">$flag</a>=1;
<a name="l00056"></a>00056
<a name="l00057"></a>00057 <span class="comment">// Create the Fiche</span>
<a name="l00058"></a>00058 <a class="code" href="eub__be_8inc_8php.html#a4">$Sql</a>=<span class="stringliteral">"insert into fiche (fd_id) values ("</span>.$p_fd_id.<span class="stringliteral">")"</span>;
<a name="l00059"></a>00059 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$Sql);
<a name="l00060"></a>00060
<a name="l00061"></a>00061 <span class="comment">// Get is f_id (sequence)</span>
<a name="l00062"></a>00062 $l_f_id=<a class="code" href="postgres_8php.html#a12">GetSequence</a>($p_cn,'s_fiche');
<a name="l00063"></a>00063
<a name="l00064"></a>00064 <span class="comment">// Should we Create accounts for each cards</span>
<a name="l00065"></a>00065 $create=<a class="code" href="fiche__inc_8php.html#a21">GetCreateAccount</a>($p_cn,$p_fd_id);
<a name="l00066"></a>00066
<a name="l00067"></a>00067
<a name="l00068"></a>00068 <span class="comment">// Is a account given ?</span>
<a name="l00069"></a>00069 <span class="keywordflow">for</span> ( $i = 0; $i &lt; $p_inc;$i++) {
<a name="l00070"></a>00070 <span class="comment">//Except for the class base</span>
<a name="l00071"></a>00071 <span class="keywordflow">if</span> ( ${<span class="stringliteral">"p_ad_id$i"</span>} == <a class="code" href="constant_8php.html#a55">ATTR_DEF_ACCOUNT</a> ) {
<a name="l00072"></a>00072 <span class="keywordflow">if</span> (strlen (trim(${<span class="stringliteral">"p_av_text$i"</span>})) == 0 or
<a name="l00073"></a>00073 <a class="code" href="ac__common_8php.html#a2">isNumber</a>(${<span class="stringliteral">"p_av_text$i"</span>}) == 0 )
<a name="l00074"></a>00074 {
<a name="l00075"></a>00075 <span class="keywordflow">break</span>;
<a name="l00076"></a>00076 }
<a name="l00077"></a>00077 <span class="comment">// if account already exist do nothing in tmp_pcmn otherwise add it</span>
<a name="l00078"></a>00078 <span class="keywordflow">if</span> (<a class="code" href="postgres_8php.html#a10">CountSql</a>($p_cn,<span class="stringliteral">"select pcm_val from tmp_pcmn where pcm_val="</span>.${<span class="stringliteral">"p_av_text$i"</span>}) == 0 )
<a name="l00079"></a>00079 {
<a name="l00080"></a>00080 $len=strlen(${<span class="stringliteral">"p_av_text$i"</span>})-1;
<a name="l00081"></a>00081 <span class="comment">// Mother account</span>
<a name="l00082"></a>00082 <a class="code" href="line__update_8php.html#a6">$p_parent</a>=substr(${<span class="stringliteral">"p_av_text$i"</span>},0,$len);
<a name="l00083"></a>00083 <span class="keywordflow">while</span> (<a class="code" href="postgres_8php.html#a10">CountSql</a>($p_cn,<span class="stringliteral">"select pcm_val from tmp_pcmn where pcm_val=$p_parent"</span>) == 0 and
<a name="l00084"></a>00084 $len &gt; 0 ) {
<a name="l00085"></a>00085 $len--;
<a name="l00086"></a>00086 <a class="code" href="line__update_8php.html#a6">$p_parent</a>=substr(${<span class="stringliteral">"p_av_text$i"</span>},0,$len);
<a name="l00087"></a>00087 }
<a name="l00088"></a>00088 <span class="comment">// If no parent found</span>
<a name="l00089"></a>00089 <span class="keywordflow">if</span> ( $len &lt;= 0 ) {
<a name="l00090"></a>00090 <a class="code" href="ac__common_8php.html#a0">echo_error</a> (<span class="stringliteral">"No parent found"</span>);
<a name="l00091"></a>00091 <a class="code" href="balance_8php.html#a0">exit</a>(<span class="stringliteral">"No parent found for "</span>.${<span class="stringliteral">"p_av_text$i"</span>});
<a name="l00092"></a>00092
<a name="l00093"></a>00093 } <span class="comment">// if $len == 0</span>
<a name="l00094"></a>00094 $lib=<a class="code" href="ac__common_8php.html#a9">FormatString</a>($p_av_text0);
<a name="l00095"></a>00095 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf(<span class="stringliteral">"insert into tmp_pcmn (pcm_val,pcm_lib,pcm_val_parent) </span>
<a name="l00096"></a>00096 <span class="stringliteral"> values (%s,'%s',%d)"</span>,
<a name="l00097"></a>00097 ${<span class="stringliteral">"p_av_text$i"</span>},
<a name="l00098"></a>00098 $lib,
<a name="l00099"></a>00099 $p_parent);
<a name="l00100"></a>00100
<a name="l00101"></a>00101 <span class="comment">// Add if into tmp_pcmn</span>
<a name="l00102"></a>00102 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$Sql);
<a name="l00103"></a>00103 }
<a name="l00104"></a>00104 <span class="comment">// Add it the jnt table</span>
<a name="l00105"></a>00105 <span class="comment">// 5 is always for the account post</span>
<a name="l00106"></a>00106 <a class="code" href="eub__be_8inc_8php.html#a4">$Sql</a>=sprintf(<span class="stringliteral">"insert into jnt_fic_att_value (f_id,ad_id) values (%d,%d)"</span>,
<a name="l00107"></a>00107 $l_f_id,<a class="code" href="constant_8php.html#a55">ATTR_DEF_ACCOUNT</a>);
<a name="l00108"></a>00108 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$Sql);
<a name="l00109"></a>00109
<a name="l00110"></a>00110 <span class="comment">// Get the jft_id sequence (s_jnt_fic_att_value)</span>
<a name="l00111"></a>00111 $l_jft_id=<a class="code" href="postgres_8php.html#a12">GetSequence</a>($p_cn,'s_jnt_fic_att_value');
<a name="l00112"></a>00112
<a name="l00113"></a>00113
<a name="l00114"></a>00114 <span class="comment">// Add it the attr_value table</span>
<a name="l00115"></a>00115 <a class="code" href="eub__be_8inc_8php.html#a4">$Sql</a>=sprintf(<span class="stringliteral">"insert into attr_value(jft_id,av_text) values (%d,'%s')"</span>,
<a name="l00116"></a>00116 $l_jft_id,${<span class="stringliteral">"p_av_text$i"</span>});
<a name="l00117"></a>00117 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$Sql);
<a name="l00118"></a>00118 <span class="comment">// If create == 0 we don't create automatically an account</span>
<a name="l00119"></a>00119 $create=0;
<a name="l00120"></a>00120 }
<a name="l00121"></a>00121
<a name="l00122"></a>00122 } <span class="comment">// for $i...</span>
<a name="l00123"></a>00123
<a name="l00124"></a>00124 <a class="code" href="debug_8php.html#a0">echo_debug</a> ( <span class="stringliteral">" create = $create "</span>);
<a name="l00125"></a>00125 <span class="keywordflow">if</span> ( $create == 1 ) {
<a name="l00126"></a>00126 <span class="comment">// We create an account for each</span>
<a name="l00127"></a>00127 <span class="comment">// Get The Class Base</span>
<a name="l00128"></a>00128 $base=<a class="code" href="fiche__inc_8php.html#a2">GetBaseFiche</a>($p_cn,$p_type);
<a name="l00129"></a>00129
<a name="l00130"></a>00130 <span class="comment">// If a specific post account is needed created it</span>
<a name="l00131"></a>00131
<a name="l00132"></a>00132 <span class="keywordflow">if</span> ( $base !=null ) {
<a name="l00133"></a>00133 <span class="comment">// if the class base is not null, create it in the tmp_pcmn</span>
<a name="l00134"></a>00134 <a class="code" href="jrn__add_8php.html#a17">$num</a>=<a class="code" href="fiche__inc_8php.html#a5">GetNextFiche</a>($p_cn,$base);
<a name="l00135"></a>00135
<a name="l00136"></a>00136 $lib=<a class="code" href="ac__common_8php.html#a9">FormatString</a>($p_av_text0);
<a name="l00137"></a>00137 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf(<span class="stringliteral">"insert into tmp_pcmn (pcm_val,pcm_lib,pcm_val_parent) </span>
<a name="l00138"></a>00138 <span class="stringliteral"> values (%s,'%s',%d)"</span>,
<a name="l00139"></a>00139 $num,
<a name="l00140"></a>00140 $lib,
<a name="l00141"></a>00141 $base);
<a name="l00142"></a>00142 <a class="code" href="debug_8php.html#a0">echo_debug</a>($sql);
<a name="l00143"></a>00143 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l00144"></a>00144 <span class="comment">// Add it the jnt table</span>
<a name="l00145"></a>00145 <span class="comment">// 5 is always for the account post</span>
<a name="l00146"></a>00146 <a class="code" href="eub__be_8inc_8php.html#a4">$Sql</a>=sprintf(<span class="stringliteral">"insert into jnt_fic_att_value (f_id,ad_id) values (%d,%d)"</span>,
<a name="l00147"></a>00147 $l_f_id,<a class="code" href="constant_8php.html#a55">ATTR_DEF_ACCOUNT</a>);
<a name="l00148"></a>00148 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$Sql);
<a name="l00149"></a>00149
<a name="l00150"></a>00150 <span class="comment">// Get the jft_id sequence (s_jnt_fic_att_value)</span>
<a name="l00151"></a>00151 $l_jft_id=<a class="code" href="postgres_8php.html#a12">GetSequence</a>($p_cn,'s_jnt_fic_att_value');
<a name="l00152"></a>00152
<a name="l00153"></a>00153
<a name="l00154"></a>00154 <span class="comment">// Add it the attr_value table</span>
<a name="l00155"></a>00155 <a class="code" href="eub__be_8inc_8php.html#a4">$Sql</a>=sprintf(<span class="stringliteral">"insert into attr_value(jft_id,av_text) values (%d,'%s')"</span>,
<a name="l00156"></a>00156 $l_jft_id,$num);
<a name="l00157"></a>00157 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$Sql);
<a name="l00158"></a>00158 }
<a name="l00159"></a>00159 }<span class="comment">// end create accounts for each cards</span>
<a name="l00160"></a>00160
<a name="l00161"></a>00161
<a name="l00162"></a>00162 <span class="comment">// Add the others attribut in jnt_fic_att_value and after in attr_value</span>
<a name="l00163"></a>00163 <span class="keywordflow">for</span> ( $i = 0; $i &lt; $p_inc;$i++) {
<a name="l00164"></a>00164 <span class="comment">//Except for the class base</span>
<a name="l00165"></a>00165 <span class="keywordflow">if</span> ( ${<span class="stringliteral">"p_ad_id$i"</span>} == <a class="code" href="constant_8php.html#a55">ATTR_DEF_ACCOUNT</a> ) <span class="keywordflow">continue</span>;
<a name="l00166"></a>00166
<a name="l00167"></a>00167 <span class="comment">// Special treatment for QuickCode</span>
<a name="l00168"></a>00168 <span class="keywordflow">if</span> ( ${<span class="stringliteral">"p_ad_id$i"</span>} == <a class="code" href="constant_8php.html#a78">ATTR_DEF_QUICKCODE</a> ) {
<a name="l00169"></a>00169 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf(<span class="stringliteral">"select insert_quick_code(%d,'%s')"</span>,
<a name="l00170"></a>00170 $l_f_id,<a class="code" href="ac__common_8php.html#a9">FormatString</a>(${<span class="stringliteral">"p_av_text$i"</span>}));
<a name="l00171"></a>00171 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l00172"></a>00172 <span class="keywordflow">continue</span>;
<a name="l00173"></a>00173 }
<a name="l00174"></a>00174 <span class="comment">// Add it the jnt table</span>
<a name="l00175"></a>00175 <a class="code" href="eub__be_8inc_8php.html#a4">$Sql</a>=sprintf(<span class="stringliteral">"insert into jnt_fic_att_value (f_id,ad_id) values (%d,%d)"</span>,
<a name="l00176"></a>00176 $l_f_id,${<span class="stringliteral">"p_ad_id$i"</span>});
<a name="l00177"></a>00177 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$Sql);
<a name="l00178"></a>00178
<a name="l00179"></a>00179 <span class="comment">// Get the jft_id sequence (s_jnt_fic_att_value)</span>
<a name="l00180"></a>00180 $l_jft_id=<a class="code" href="postgres_8php.html#a12">GetSequence</a>($p_cn,'s_jnt_fic_att_value');
<a name="l00181"></a>00181
<a name="l00182"></a>00182 <span class="comment">// test the vat rate</span>
<a name="l00183"></a>00183 <span class="keywordflow">if</span> ( ${<span class="stringliteral">"p_ad_id$i"</span>} == <a class="code" href="constant_8php.html#a59">ATTR_DEF_TVA</a> ) {
<a name="l00184"></a>00184 <span class="comment">// is a rate given </span>
<a name="l00185"></a>00185 <span class="keywordflow">if</span> ( strlen(trim(${<span class="stringliteral">"p_av_text$i"</span>})) != 0 and
<a name="l00186"></a>00186 <a class="code" href="ac__common_8php.html#a2">isNumber</a>(${<span class="stringliteral">"p_av_text$i"</span>}) == 1) {
<a name="l00187"></a>00187 <span class="comment">// is a valid rate ?</span>
<a name="l00188"></a>00188 <span class="keywordflow">if</span> ( <a class="code" href="postgres_8php.html#a10">CountSql</a>($p_cn,<span class="stringliteral">"select * from tva_rate where tva_id='"</span>.${<span class="stringliteral">"p_av_text$i"</span>}.<span class="stringliteral">"'"</span>) == 0 ) {
<a name="l00189"></a>00189 <span class="comment">// the rate doesn't exist</span>
<a name="l00190"></a>00190 ${<span class="stringliteral">"p_av_text$i"</span>}=1;
<a name="l00191"></a>00191 <span class="comment">// warning</span>
<a name="l00192"></a>00192 <a class="code" href="ac__common_8php.html#a0">echo_error</a>('invalid rate') ;
<a name="l00193"></a>00193 echo '&lt;script&gt;
<a name="l00194"></a>00194 alert(<span class="stringliteral">"Attention tva invalid, valeur par défaut =1 "</span>);
<a name="l00195"></a>00195 &lt;/script&gt;';
<a name="l00196"></a>00196
<a name="l00197"></a>00197 }
<a name="l00198"></a>00198 }<span class="comment">// if a rate is given</span>
<a name="l00199"></a>00199 }
<a name="l00200"></a>00200 $text=<a class="code" href="ac__common_8php.html#a9">FormatString</a>(${<span class="stringliteral">"p_av_text$i"</span>});
<a name="l00201"></a>00201 <span class="comment">// Add it the attr_value table</span>
<a name="l00202"></a>00202 <a class="code" href="eub__be_8inc_8php.html#a4">$Sql</a>=sprintf(<span class="stringliteral">"insert into attr_value(jft_id,av_text) values (%d,'%s')"</span>,
<a name="l00203"></a>00203 $l_jft_id,$text);
<a name="l00204"></a>00204 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$Sql);
<a name="l00205"></a>00205
<a name="l00206"></a>00206 }
<a name="l00207"></a>00207
<a name="l00208"></a>00208 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a10"></a><!-- doxytag: member="fiche_inc.php::AddModele" ref="a10" args="($p_cn, $p_array)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">AddModele </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_array</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Add a modele of card into the database.
<p>
AddModele<p>
parm :<ul>
<li>connection</li></ul>
<p>
array gen :<ul>
<li>none table : insert into <a class="el" href="classfiche__def.html">fiche_def</a> insert into attr_def return:</li><li>none</li></ul>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l00761">761</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="debug_8php-source.html#l00034">echo_debug()</a>, <a class="el" href="ac__common_8php-source.html#l00036">echo_error()</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, <a class="el" href="ac__common_8php-source.html#l00206">FormatString()</a>, <a class="el" href="fiche__inc_8php-source.html#l01149">Get_attr_min()</a>, <a class="el" href="fiche__inc_8php-source.html#l00374">GetBaseFicheDefault()</a>, <a class="el" href="postgres_8php-source.html#l00242">GetSequence()</a>, and <a class="el" href="ac__common_8php-source.html#l00076">isNumber()</a>.<div class="fragment"><pre class="fragment"><a name="l00761"></a>00761 {
<a name="l00762"></a>00762 <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,<span class="stringliteral">"AddModele"</span>);
<a name="l00763"></a>00763 <span class="comment">// Show what we receive for debug purpose only</span>
<a name="l00764"></a>00764 <span class="comment">//</span>
<a name="l00765"></a>00765 foreach ( $p_array as $key=&gt;$element ) {
<a name="l00766"></a>00766 <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,<span class="stringliteral">"p_$key $element"</span>);
<a name="l00767"></a>00767 ${<span class="stringliteral">"p_$key"</span>}=$element;
<a name="l00768"></a>00768 }
<a name="l00769"></a>00769 <span class="comment">// Format correctly the name of the cat. of card</span>
<a name="l00770"></a>00770 $p_nom_mod=<a class="code" href="ac__common_8php.html#a9">FormatString</a>($p_nom_mod);
<a name="l00771"></a>00771 <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,<span class="stringliteral">"Adding $p_nom_mod"</span>);
<a name="l00772"></a>00772 <span class="comment">// Format the p_class_base </span>
<a name="l00773"></a>00773 <span class="comment">// must be an integer</span>
<a name="l00774"></a>00774 <span class="keywordflow">if</span> ( <a class="code" href="ac__common_8php.html#a2">isNumber</a>($p_class_base) == 0 &amp;&amp; <a class="code" href="ac__common_8php.html#a9">FormatString</a>($p_class_base) != null ) {
<a name="l00775"></a>00775 <a class="code" href="ac__common_8php.html#a0">echo_error</a> ('p_class_base is NOT a number');
<a name="l00776"></a>00776 }
<a name="l00777"></a>00777 <span class="keywordflow">if</span> ( strlen(trim($p_nom_mod)) == 0 )
<a name="l00778"></a>00778 <span class="keywordflow">return</span>;
<a name="l00779"></a>00779
<a name="l00780"></a>00780 <span class="comment">// $p_FICHE_REF cannot be null !!! (== fiche_def_ref.frd_id</span>
<a name="l00781"></a>00781 <span class="keywordflow">if</span> (! isset ($p_FICHE_REF) or strlen($p_FICHE_REF) == 0 ) {
<a name="l00782"></a>00782 <a class="code" href="ac__common_8php.html#a0">echo_error</a> (<span class="stringliteral">"AddModele : fiche_ref MUST NOT be null or empty"</span>);
<a name="l00783"></a>00783 <span class="keywordflow">return</span>;
<a name="l00784"></a>00784 }
<a name="l00785"></a>00785 <span class="comment">// build the sql request for fiche_def</span>
<a name="l00786"></a>00786 <span class="comment">// and insert into fiche_def</span>
<a name="l00787"></a>00787 <span class="comment">// if p_class_base is null get the default class base from</span>
<a name="l00788"></a>00788 <span class="comment">// fiche_def_ref</span>
<a name="l00789"></a>00789 <span class="keywordflow">if</span> ( <a class="code" href="ac__common_8php.html#a9">FormatString</a>($p_class_base) == null )
<a name="l00790"></a>00790 { <span class="comment">// p_class is null</span>
<a name="l00791"></a>00791 <span class="comment">// So we take the default one</span>
<a name="l00792"></a>00792 $p_class_base=<a class="code" href="fiche__inc_8php.html#a3">GetBaseFicheDefault</a>($p_cn,$p_FICHE_REF);
<a name="l00793"></a>00793 }
<a name="l00794"></a>00794 <span class="comment">// Set the value of fiche_def.fd_create_account</span>
<a name="l00795"></a>00795 <span class="keywordflow">if</span> ( isset($p_create))
<a name="l00796"></a>00796 $p_create='<span class="keyword">true</span>';
<a name="l00797"></a>00797 <span class="keywordflow">else</span>
<a name="l00798"></a>00798 $p_create='<span class="keyword">false</span>';
<a name="l00799"></a>00799
<a name="l00800"></a>00800 <span class="comment">// Class is valid ?</span>
<a name="l00801"></a>00801 <span class="keywordflow">if</span> ( <a class="code" href="ac__common_8php.html#a9">FormatString</a>($p_class_base) != null) {
<a name="l00802"></a>00802
<a name="l00803"></a>00803 <span class="comment">// p_class is a valid number</span>
<a name="l00804"></a>00804 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf(<span class="stringliteral">"insert into fiche_def(fd_label,fd_class_base,frd_id,fd_create_account) </span>
<a name="l00805"></a>00805 <span class="stringliteral"> values ('%s',%s,%d,'%s')"</span>,
<a name="l00806"></a>00806 $p_nom_mod,$p_class_base,$p_FICHE_REF,$p_create);
<a name="l00807"></a>00807 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l00808"></a>00808
<a name="l00809"></a>00809 <span class="comment">// p_class must be added to tmp_pcmn </span>
<a name="l00810"></a>00810 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf(<span class="stringliteral">"select account_add(%d,'%s')"</span>,
<a name="l00811"></a>00811 $p_class_base,$p_nom_mod);
<a name="l00812"></a>00812
<a name="l00813"></a>00813 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l00814"></a>00814
<a name="l00815"></a>00815 <span class="comment">// Get the fd_id</span>
<a name="l00816"></a>00816 $fd_id=<a class="code" href="postgres_8php.html#a12">GetSequence</a>($p_cn,'s_fdef');
<a name="l00817"></a>00817
<a name="l00818"></a>00818 <span class="comment">// Add the class_base if needed</span>
<a name="l00819"></a>00819
<a name="l00820"></a>00820 <span class="keywordflow">if</span> ( $p_create=='<span class="keyword">true</span>' ) {
<a name="l00821"></a>00821 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf(<span class="stringliteral">"insert into jnt_fic_attr(fd_id,ad_id) </span>
<a name="l00822"></a>00822 <span class="stringliteral"> values (%d,%d)"</span>,$fd_id,<a class="code" href="constant_8php.html#a55">ATTR_DEF_ACCOUNT</a>);
<a name="l00823"></a>00823 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l00824"></a>00824 }
<a name="l00825"></a>00825 } <span class="keywordflow">else</span> {
<a name="l00826"></a>00826 <span class="comment">//There is no class base not even as default</span>
<a name="l00827"></a>00827 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf(<span class="stringliteral">"insert into fiche_def(fd_label,frd_id,fd_create_account) values ('%s',%d,'%s')"</span>,
<a name="l00828"></a>00828 $p_nom_mod,$p_FICHE_REF,$p_create);
<a name="l00829"></a>00829
<a name="l00830"></a>00830 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l00831"></a>00831
<a name="l00832"></a>00832 <span class="comment">// Get the fd_id</span>
<a name="l00833"></a>00833 $fd_id=<a class="code" href="postgres_8php.html#a12">GetSequence</a>($p_cn,'s_fdef');
<a name="l00834"></a>00834
<a name="l00835"></a>00835 }
<a name="l00836"></a>00836
<a name="l00837"></a>00837 <span class="comment">// Get the default attr_def from attr_min</span>
<a name="l00838"></a>00838 $def_attr=<a class="code" href="fiche__inc_8php.html#a19">Get_attr_min</a>($p_cn,$p_FICHE_REF);
<a name="l00839"></a>00839
<a name="l00840"></a>00840 <span class="comment">//if defaut attr not null </span>
<a name="l00841"></a>00841 <span class="comment">// build the sql insert for the table attr_def</span>
<a name="l00842"></a>00842 <span class="keywordflow">if</span> (<span class="keyword">sizeof</span>($def_attr) != 0 ) {
<a name="l00843"></a>00843 <span class="comment">// insert all the mandatory fields into jnt_fiche_attr</span>
<a name="l00844"></a>00844 foreach ( $def_attr as $i=&gt;$v) {
<a name="l00845"></a>00845 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf(<span class="stringliteral">"insert into jnt_fic_Attr(fd_id,ad_id)</span>
<a name="l00846"></a>00846 <span class="stringliteral"> values (%d,%s)"</span>,
<a name="l00847"></a>00847 $fd_id,$v['ad_id']);
<a name="l00848"></a>00848 <a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l00849"></a>00849 }
<a name="l00850"></a>00850 }
<a name="l00851"></a>00851
<a name="l00852"></a>00852
<a name="l00853"></a>00853 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a9"></a><!-- doxytag: member="fiche_inc.php::DefModele" ref="a9" args="($p_cn, $p_js, $p_array=null, $p_ligne=1)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">DefModele </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_js</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_array</em> = <code>null</code>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_ligne</em> = <code>1</code></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Creation of a model of card or correction.
<p>
DefModele<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>$p_cn</em>&nbsp;</td><td>database connection </td></tr>
<tr><td valign="top"></td><td valign="top"><em>$p_ligne</em>&nbsp;</td><td>number of lines </td></tr>
<tr><td valign="top"></td><td valign="top"><em>$p_array</em>&nbsp;</td><td>array </td></tr>
<tr><td valign="top"></td><td valign="top"><em>$p_js</em>&nbsp;</td><td>class base (javascript code)</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>nothing</dd></dl>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l00689">689</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="fortis__be_8inc_8php-source.html#l00054">$check</a>, <a class="el" href="debug_8php-source.html#l00034">echo_debug()</a>, <a class="el" href="fiche__inc_8php-source.html#l01115">Get_fiche_def_ref()</a>, and <a class="el" href="pref_8inc_8php-source.html#l00048">METHOD</a>.<div class="fragment"><pre class="fragment"><a name="l00690"></a>00690 {
<a name="l00691"></a>00691 <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,<span class="stringliteral">"DefModele ($p_array,$p_ligne=1) "</span>);
<a name="l00692"></a>00692
<a name="l00693"></a>00693 <span class="comment">// Creating form</span>
<a name="l00694"></a>00694 $display='&lt;<a class="code" href="constant_8php.html#a7">FORM</a> <a class="code" href="constant_8php.html#a44">ACTION</a>=<span class="stringliteral">"fiche.php"</span> <a class="code" href="pref_8inc_8php.html#a0">METHOD</a>=<span class="stringliteral">"POST"</span>&gt;';
<a name="l00695"></a>00695
<a name="l00696"></a>00696 <span class="comment">// Number of line of the card</span>
<a name="l00697"></a>00697 $display.='&lt;INPUT TYPE=<span class="stringliteral">"HIDDEN"</span> NAME=<span class="stringliteral">"INC"</span> VALUE=<span class="stringliteral">"'.$p_ligne.'"</span>&gt;';
<a name="l00698"></a>00698
<a name="l00699"></a>00699 <span class="comment">// Table of input</span>
<a name="l00700"></a>00700 $display.='&lt;TABLE BORDER=<span class="stringliteral">"0"</span> CELLSPACING=<span class="stringliteral">"0"</span>&gt;';
<a name="l00701"></a>00701
<a name="l00702"></a>00702
<a name="l00703"></a>00703 <span class="comment">//Name of the CARD (fiche_def.fd_label)</span>
<a name="l00704"></a>00704 $display.='&lt;TR&gt;&lt;TD&gt; Catégorie de <a class="code" href="classfiche.html">fiche</a> &lt;/TD&gt;';
<a name="l00705"></a>00705 $display.='&lt;TD&gt;&lt;INPUT TYPE=<span class="stringliteral">"INPUT"</span> NAME=<span class="stringliteral">"nom_mod"</span>&gt;';
<a name="l00706"></a>00706 $display.='&lt;/TD&gt;&lt;/TR&gt;';
<a name="l00707"></a>00707
<a name="l00708"></a>00708 <span class="comment">// Class base fiche_def.fd_class_base (optional)</span>
<a name="l00709"></a>00709 $display.='&lt;TR&gt;&lt;TD&gt; Classe de base &lt;/TD&gt;';
<a name="l00710"></a>00710 $display.='&lt;TD&gt;&lt;INPUT TYPE=<span class="stringliteral">"INPUT"</span> NAME=<span class="stringliteral">"class_base"</span>&gt; '.$p_js;
<a name="l00711"></a>00711 $display.='&lt;/TD&gt;&lt;/TR&gt;';
<a name="l00712"></a>00712 <span class="comment">// Checkbox for the creation of a post</span>
<a name="l00713"></a>00713 $display.='&lt;TR&gt;&lt;TD&gt; &lt;INPUT TYPE=<span class="stringliteral">"CHECKBOX"</span> NAME=<span class="stringliteral">"create"</span> CHECKED&gt;Cr&amp;eacute;ation automatique du <a class="code" href="classposte.html">poste</a> comptable&lt;/TD&gt;&lt;/TR&gt;';
<a name="l00714"></a>00714
<a name="l00715"></a>00715 <span class="comment">//display the different template</span>
<a name="l00716"></a>00716 $ref=<a class="code" href="fiche__inc_8php.html#a18">Get_fiche_def_ref</a>($p_cn);
<a name="l00717"></a>00717
<a name="l00718"></a>00718 <span class="comment">// check if $ref is an array </span>
<a name="l00719"></a>00719 <span class="comment">// and display the choice</span>
<a name="l00720"></a>00720
<a name="l00721"></a>00721 <span class="comment">// select by default the first choice</span>
<a name="l00722"></a>00722 <a class="code" href="fortis__be_8inc_8php.html#a2">$check</a>=<span class="stringliteral">"CHECKED"</span>;
<a name="l00723"></a>00723 <span class="keywordflow">if</span> ( <span class="keyword">sizeof</span>($ref) ) {
<a name="l00724"></a>00724 foreach ($ref as $i=&gt;$v) {
<a name="l00725"></a>00725 $display.='&lt;TR&gt;&lt;TD COLSPAN=<span class="stringliteral">"2"</span>&gt;';
<a name="l00726"></a>00726
<a name="l00727"></a>00727 $display.='&lt;INPUT TYPE=<span class="stringliteral">"RADIO"</span> NAME=<span class="stringliteral">"FICHE_REF"</span> VALUE=<span class="stringliteral">"'.$v['id'].'"</span>'.$check.<span class="charliteral">'&gt;'</span>;
<a name="l00728"></a>00728 $display.=$v['text'];
<a name="l00729"></a>00729 <span class="comment">// if a class base exist in fiche_def_ref, we display it</span>
<a name="l00730"></a>00730 <span class="keywordflow">if</span> ( <span class="keyword">sizeof</span> ($v['<span class="keyword">class</span>']) != 0 )
<a name="l00731"></a>00731 $display.=<span class="stringliteral">"&amp;nbsp;&amp;nbsp&lt;I&gt;Class base = "</span>.$v['<span class="keyword">class</span>'].<span class="stringliteral">"&lt;/I&gt;"</span>;
<a name="l00732"></a>00732 $display.=<span class="stringliteral">"&lt;/TD&gt;&lt;/TR&gt;"</span>;
<a name="l00733"></a>00733 <a class="code" href="fortis__be_8inc_8php.html#a2">$check</a>=<span class="stringliteral">""</span>;
<a name="l00734"></a>00734 }
<a name="l00735"></a>00735
<a name="l00736"></a>00736 }
<a name="l00737"></a>00737 <span class="comment">// closing the form</span>
<a name="l00738"></a>00738 $display.='&lt;/TABLE&gt;';
<a name="l00739"></a>00739 $display.='&lt;INPUT TYPE=<span class="stringliteral">"SUBMIT"</span> NAME=<span class="stringliteral">"add_modele"</span> VALUE=<span class="stringliteral">"Sauve"</span>&gt;';
<a name="l00740"></a>00740 $display.='&lt;/<a class="code" href="constant_8php.html#a7">FORM</a>&gt;';
<a name="l00741"></a>00741
<a name="l00742"></a>00742 <span class="comment">// display it</span>
<a name="l00743"></a>00743 echo $display;
<a name="l00744"></a>00744
<a name="l00745"></a>00745 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a27"></a><!-- doxytag: member="fiche_inc.php::DisplayDetailModele" ref="a27" args="($p_cn, $p_array, $MaxLine)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">DisplayDetailModele </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_array</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>MaxLine</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Show the data contained in an array of a model of card (<a class="el" href="classfiche__def.html">fiche_def</a>).
<p>
DisplayDetailModele<p>
parm :<ul>
<li>p_cn database connection<ul>
<li>array containing label,class_base,fd_id,ad_textX,ad_idX</li></ul>
</li><li>number of line gen :<ul>
<li>none return: none</li></ul>
</li></ul>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l01390">1390</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="balance_8php-source.html#l00118">$i</a>, <a class="el" href="bank_8inc_8php-source.html#l00174">$l</a>, <a class="el" href="setup_8php-source.html#l00431">$M</a>, <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="debug_8php-source.html#l00034">echo_debug()</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, <a class="el" href="balance_8php-source.html#l00076">label</a>, and <a class="el" href="action_8inc_8php-source.html#l00241">value</a>.
<p>
Referenced by <a class="el" href="fiche__inc_8php-source.html#l00869">UpdateModele()</a>.<div class="fragment"><pre class="fragment"><a name="l01391"></a>01391 {
<a name="l01392"></a>01392 <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,<span class="stringliteral">"DisplayDetailModele"</span>);
<a name="l01393"></a>01393
<a name="l01394"></a>01394 foreach ($p_array as $v=&gt;$i) {
<a name="l01395"></a>01395 <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,<span class="stringliteral">"v == $v i==$i"</span>);
<a name="l01396"></a>01396 ${<span class="stringliteral">"$v"</span>}=<a class="code" href="balance_8php.html#a12">$i</a>;
<a name="l01397"></a>01397 }
<a name="l01398"></a>01398 echo '&lt;<a class="code" href="constant_8php.html#a7">FORM</a> <a class="code" href="classaction.html">action</a>=<span class="stringliteral">"fiche.php"</span> method=<span class="stringliteral">"get"</span>&gt;';
<a name="l01399"></a>01399 echo '&lt;INPUT TYPE=<span class="stringliteral">"HIDDEN"</span> NAME=<span class="stringliteral">"fd_id"</span> VALUE=<span class="stringliteral">"'.$fd_id.'"</span>&gt;';
<a name="l01400"></a>01400
<a name="l01401"></a>01401 printf(<span class="stringliteral">"&lt;TABLE&gt;"</span>);
<a name="l01402"></a>01402 <span class="comment">// Display each attribute</span>
<a name="l01403"></a>01403 <span class="keywordflow">for</span> ($i=0;$i&lt;$MaxLine;$i++) {
<a name="l01404"></a>01404 echo '&lt;TR&gt;&lt;td&gt;';
<a name="l01405"></a>01405 <span class="comment">// Can change the name</span>
<a name="l01406"></a>01406 <span class="keywordflow">if</span> ( ${<span class="stringliteral">"ad_id$i"</span>} == <a class="code" href="constant_8php.html#a56">ATTR_DEF_NAME</a> ) {
<a name="l01407"></a>01407 printf('Label&lt;/TD&gt;&lt;TD&gt;&lt;INPUT TYPE=<span class="stringliteral">"TEXT"</span> NAME=<span class="stringliteral">"label"</span> VALUE=<span class="stringliteral">"%s"</span>&gt;',
<a name="l01408"></a>01408 $<a class="code" href="balance_8php.html#a6">label</a>);
<a name="l01409"></a>01409 printf('&lt;/td&gt;&lt;TD&gt;&lt;input type=<span class="stringliteral">"submit"</span> NAME=<span class="stringliteral">"change_name"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"Change Nom"</span>&gt;');
<a name="l01410"></a>01410 } <span class="keywordflow">else</span> {
<a name="l01411"></a>01411 <span class="comment">// The attr.</span>
<a name="l01412"></a>01412 printf('%s ',
<a name="l01413"></a>01413 ${<span class="stringliteral">"ad_text$i"</span>});
<a name="l01414"></a>01414 }
<a name="l01415"></a>01415 echo '&lt;/td&gt;&lt;/tr&gt;';
<a name="l01416"></a>01416 }
<a name="l01417"></a>01417
<a name="l01418"></a>01418 <span class="comment">// Show the possible attribute which are not already attribute of the model</span>
<a name="l01419"></a>01419 <span class="comment">// of card</span>
<a name="l01420"></a>01420 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select ad_id,ad_text from attr_def </span>
<a name="l01421"></a>01421 <span class="stringliteral"> where ad_id not in (select ad_id from fiche_def natural join jnt_fic_attr</span>
<a name="l01422"></a>01422 <span class="stringliteral"> where fd_id=$fd_id)"</span>);
<a name="l01423"></a>01423 <a class="code" href="setup_8php.html#a14">$M</a>=pg_NumRows($Res);
<a name="l01424"></a>01424
<a name="l01425"></a>01425 <span class="comment">// Show the unused attribute</span>
<a name="l01426"></a>01426 echo '&lt;TR&gt; &lt;TD&gt;';
<a name="l01427"></a>01427 echo '&lt;SELECT NAME=<span class="stringliteral">"ad_id"</span>&gt;';
<a name="l01428"></a>01428 <span class="keywordflow">for</span> ($i=0;$i&lt;$M;$i++) {
<a name="l01429"></a>01429 <a class="code" href="bank_8inc_8php.html#a24">$l</a>=pg_fetch_array($Res,$i);
<a name="l01430"></a>01430 printf('&lt;OPTION VALUE=<span class="stringliteral">"%s"</span>&gt; %s',
<a name="l01431"></a>01431 $l['ad_id'],$l['ad_text']);
<a name="l01432"></a>01432 }
<a name="l01433"></a>01433 echo '&lt;/SELECT&gt;';
<a name="l01434"></a>01434 echo '&lt;/TD&gt;&lt;TD&gt; &lt;INPUT TYPE=<span class="stringliteral">"SUBMIT"</span> Value=<span class="stringliteral">"Add that line"</span> NAME=<span class="stringliteral">"add_ligne"</span>&gt;&lt;/TD&gt;&lt;/TR&gt;';
<a name="l01435"></a>01435 printf(<span class="stringliteral">"&lt;/TABLE&gt;"</span>);
<a name="l01436"></a>01436 echo '&lt;/<a class="code" href="constant_8php.html#a7">FORM</a>&gt;';
<a name="l01437"></a>01437 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a1"></a><!-- doxytag: member="fiche_inc.php::EncodeFiche" ref="a1" args="($p_cn, $p_type, $p_array=null)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">EncodeFiche </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_type</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_array</em> = <code>null</code></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Affiche les détails d'une fiche et propose de mettre à jour ou si array est a null, permet d'ajouter une fiche, to fill the attribute.
<p>
EncodeFiche<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>$p_cn</em>&nbsp;</td><td>connexion </td></tr>
<tr><td valign="top"></td><td valign="top"><em>$p_type</em>&nbsp;</td><td>id du modele fiche_def(fd_id) de la fiche SI array est null sinon correspond au id d'une fiche fiche(f_id)</td></tr>
</table>
</dl>
<dl compact><dt><b>Note:</b></dt><dd>STAN: je ne trouve pas le nom "EncodeFiche" super claire pour une fonction qui affiche les détails d'une fiche... on ne changerait pas en "DisplayFiche" ?  <p>
DANY: Oui je suis assez d'accord avec toi</dd></dl>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l00225">225</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="jrn__detail_8php-source.html#l00124">$l_line</a>, <a class="el" href="pref_8inc_8php-source.html#l00139">$label</a>, <a class="el" href="setup_8php-source.html#l00397">$Max</a>, <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="debug_8php-source.html#l00034">echo_debug()</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, <a class="el" href="fiche__inc_8php-source.html#l01010">getFicheNameById()</a>, <a class="el" href="action_8inc_8php-source.html#l00240">name</a>, and <a class="el" href="action_8inc_8php-source.html#l00241">value</a>.
<p>
Referenced by <a class="el" href="fiche__inc_8php-source.html#l00492">ViewFicheDetail()</a>.<div class="fragment"><pre class="fragment"><a name="l00225"></a>00225 {
<a name="l00226"></a>00226 <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,<span class="stringliteral">"function EncodeFiche($p_cn,$p_type) "</span>);
<a name="l00227"></a>00227
<a name="l00228"></a>00228 $ch_col=<span class="stringliteral">"&lt;/TD&gt;&lt;TD&gt;"</span>;
<a name="l00229"></a>00229 $ch_li='&lt;/TR&gt;&lt;TR&gt;';
<a name="l00230"></a>00230 echo '&lt;<a class="code" href="constant_8php.html#a7">FORM</a> <a class="code" href="classaction.html">action</a>=<span class="stringliteral">"fiche.php"</span> method=<span class="stringliteral">"post"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"fiche"</span>&gt;';
<a name="l00231"></a>00231 echo '&lt;INPUT TYPE=<span class="stringliteral">"HIDDEN"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"fiche"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"'.$p_type.'"</span>&gt;';
<a name="l00232"></a>00232 $l_sessid=$_REQUEST['PHPSESSID'];
<a name="l00233"></a>00233
<a name="l00234"></a>00234 echo <a class="code" href="constant_8php.html#a80">JS_SHOW_TVA</a>;
<a name="l00235"></a>00235 echo <a class="code" href="constant_8php.html#a79">JS_SEARCH_POSTE</a>;
<a name="l00236"></a>00236 echo <span class="stringliteral">"&lt;TABLE&gt;"</span>;
<a name="l00237"></a>00237 <span class="keywordflow">if</span> ($p_array == null) {
<a name="l00238"></a>00238 <span class="comment">// Array is null so we display a blank form</span>
<a name="l00239"></a>00239 <span class="comment">// echo '&lt;H2 class="info"&gt;'.getFicheName($p_cn,$p_type).'&lt;/H2&gt;';</span>
<a name="l00240"></a>00240 echo '&lt;H2 <span class="keyword">class</span>=<span class="stringliteral">"info"</span>&gt;New &lt;/H2&gt;';
<a name="l00241"></a>00241 $p_f_id=<span class="stringliteral">""</span>;
<a name="l00242"></a>00242 <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,<span class="stringliteral">"Array is null"</span>);
<a name="l00243"></a>00243 <span class="comment">// Find all the attribute of the existing cards</span>
<a name="l00244"></a>00244 <span class="comment">// --&gt; Get_attr_def </span>
<a name="l00245"></a>00245 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"select frd_id,ad_id,ad_text from fiche_def join jnt_fic_attr using (fd_id)</span>
<a name="l00246"></a>00246 <span class="stringliteral"> join attr_def using (ad_id) where fd_id="</span>.$p_type.<span class="stringliteral">" order by ad_id"</span>;
<a name="l00247"></a>00247
<a name="l00248"></a>00248 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l00249"></a>00249 <a class="code" href="setup_8php.html#a11">$Max</a>=pg_NumRows($Res);
<a name="l00250"></a>00250 <span class="comment">// Put the card modele id (fiche_def.fd_id)</span>
<a name="l00251"></a>00251 echo '&lt;INPUT TYPE=<span class="stringliteral">"HIDDEN"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"fd_id"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"'.$p_type.'"</span>&gt;';
<a name="l00252"></a>00252 <span class="keywordflow">for</span> ($i=0;$i &lt; $Max;$i++) {
<a name="l00253"></a>00253 <a class="code" href="jrn__detail_8php.html#a11">$l_line</a>=pg_fetch_array($Res,$i);
<a name="l00254"></a>00254
<a name="l00255"></a>00255 <span class="comment">// The number of the attribute</span>
<a name="l00256"></a>00256 $Hid=sprintf('&lt;INPUT TYPE=<span class="stringliteral">"HIDDEN"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"ad_id%d"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"%s"</span>&gt;',
<a name="l00257"></a>00257 $i,$l_line['ad_id']);
<a name="l00258"></a>00258
<a name="l00259"></a>00259 $but_search_poste=<span class="stringliteral">""</span>;
<a name="l00260"></a>00260 <span class="comment">// Javascript for searching the account</span>
<a name="l00261"></a>00261 <span class="keywordflow">if</span> ( $l_line ['ad_id'] == <a class="code" href="constant_8php.html#a55">ATTR_DEF_ACCOUNT</a> ) {
<a name="l00262"></a>00262 $ctl_name=<span class="stringliteral">"av_text$i"</span>;
<a name="l00263"></a>00263 $but_search_poste='&lt;INPUT TYPE=<span class="stringliteral">"BUTTON"</span> VALUE=<span class="stringliteral">"Cherche"</span> OnClick=<span class="stringliteral">"SearchPoste(\''.$l_sessid.'\',\''.$ctl_name.'\')"</span>&gt;';
<a name="l00264"></a>00264 }
<a name="l00265"></a>00265 <span class="comment">// Javascript for showing the tva</span>
<a name="l00266"></a>00266 <span class="keywordflow">if</span> ( $l_line ['ad_id'] == <a class="code" href="constant_8php.html#a59">ATTR_DEF_TVA</a> ) {
<a name="l00267"></a>00267 $but_search_poste='&lt;INPUT TYPE=<span class="stringliteral">"BUTTON"</span> VALUE=<span class="stringliteral">"Montre"</span> OnClick=<span class="stringliteral">"ShowTva(\''.$l_sessid.'\', \'av_text'.$i.'\')"</span>&gt;';
<a name="l00268"></a>00268 }
<a name="l00269"></a>00269 <span class="comment">// content of the attribute</span>
<a name="l00270"></a>00270 printf ('&lt;TR&gt;&lt;TD&gt; %s &lt;/TD&gt;&lt;TD&gt;&lt;INPUT TYPE=<span class="stringliteral">"TEXT"</span> NAME=<span class="stringliteral">"av_text%d"</span>&gt;%s %s&lt;/TD&gt;&lt;/TR&gt;',
<a name="l00271"></a>00271 $l_line['ad_text'], $i,$Hid,$but_search_poste);
<a name="l00272"></a>00272 }
<a name="l00273"></a>00273 echo '&lt;/TR&gt;';
<a name="l00274"></a>00274 echo '&lt;/TABLE&gt;';
<a name="l00275"></a>00275 echo '&lt;INPUT TYPE=<span class="stringliteral">"HIDDEN"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"inc"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"'.$Max.'"</span>&gt;';
<a name="l00276"></a>00276 echo '&lt;INPUT TYPE=<span class="stringliteral">"SUBMIT"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"add_fiche"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"ajoute"</span>&gt;';
<a name="l00277"></a>00277 echo '&lt;/<a class="code" href="constant_8php.html#a7">FORM</a>&gt;';
<a name="l00278"></a>00278 }<span class="keywordflow">else</span> {
<a name="l00279"></a>00279 <span class="comment">// Array is not null so we have to find the card's data from the database</span>
<a name="l00280"></a>00280 <span class="comment">// and display them</span>
<a name="l00281"></a>00281
<a name="l00282"></a>00282 <span class="comment">// Display the card name</span>
<a name="l00283"></a>00283 <a class="code" href="pref_8inc_8php.html#a6">$label</a>=<a class="code" href="fiche__inc_8php.html#a15">getFicheNameById</a>($p_cn,$p_type);
<a name="l00284"></a>00284 echo '&lt;H2 <span class="keyword">class</span>=<span class="stringliteral">"info"</span>&gt;'.$label.'&lt;/H2&gt;';
<a name="l00285"></a>00285
<a name="l00286"></a>00286 <span class="comment">// Find all the data related to the card</span>
<a name="l00287"></a>00287 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"select av_text,ad_id,ad_text,jft_id from attr_value</span>
<a name="l00288"></a>00288 <span class="stringliteral"> natural join attr_def </span>
<a name="l00289"></a>00289 <span class="stringliteral"> natural join jnt_fic_att_value </span>
<a name="l00290"></a>00290 <span class="stringliteral"> natural join fiche where f_id=$p_type order by ad_id"</span>;
<a name="l00291"></a>00291
<a name="l00292"></a>00292 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l00293"></a>00293 <a class="code" href="setup_8php.html#a11">$Max</a>=pg_NumRows($Res);
<a name="l00294"></a>00294 <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,<span class="stringliteral">"Max ==== $Max"</span>);
<a name="l00295"></a>00295
<a name="l00296"></a>00296 echo '&lt;INPUT TYPE=<span class="stringliteral">"HIDDEN"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"f_id"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"'.$p_type.'"</span>&gt;';
<a name="l00297"></a>00297 echo '&lt;INPUT TYPE=<span class="stringliteral">"HIDDEN"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"f_label"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"'.$label.'"</span>&gt;';
<a name="l00298"></a>00298 echo '&lt;INPUT TYPE=<span class="stringliteral">"HIDDEN"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"max"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"'.$Max.'"</span>&gt;';
<a name="l00299"></a>00299
<a name="l00300"></a>00300 <span class="keywordflow">for</span> ($i=0;$i &lt; $Max;$i++) {
<a name="l00301"></a>00301 <span class="comment">// fetch the data</span>
<a name="l00302"></a>00302 <a class="code" href="jrn__detail_8php.html#a11">$l_line</a>=pg_fetch_array($Res,$i);
<a name="l00303"></a>00303
<a name="l00304"></a>00304 <span class="comment">// Put also the class in a special variable</span>
<a name="l00305"></a>00305 <span class="comment">// useful when we want to update the PCMN</span>
<a name="l00306"></a>00306
<a name="l00307"></a>00307 $but_search_poste=<span class="stringliteral">""</span>;
<a name="l00308"></a>00308 <span class="keywordflow">if</span> ( $l_line['ad_id'] == <a class="code" href="constant_8php.html#a55">ATTR_DEF_ACCOUNT</a> ) {
<a name="l00309"></a>00309 printf('&lt;INPUT TYPE=<span class="stringliteral">"HIDDEN"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"class"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"%s"</span>&gt;',
<a name="l00310"></a>00310 $l_line['av_text']);
<a name="l00311"></a>00311 <span class="comment">// Javascript for searching the account</span>
<a name="l00312"></a>00312 $ctl_name=<span class="stringliteral">"av_text$i"</span>;
<a name="l00313"></a>00313 $but_search_poste='&lt;INPUT TYPE=<span class="stringliteral">"BUTTON"</span> VALUE=<span class="stringliteral">"Cherche"</span> OnClick=<span class="stringliteral">"SearchPoste(\''.$l_sessid.'\',\''.$ctl_name.'\')"</span>&gt;';
<a name="l00314"></a>00314 }
<a name="l00315"></a>00315
<a name="l00316"></a>00316 <span class="comment">// Javascript for showing the tva</span>
<a name="l00317"></a>00317 <span class="keywordflow">if</span> ( $l_line ['ad_id'] == <a class="code" href="constant_8php.html#a59">ATTR_DEF_TVA</a> ) {
<a name="l00318"></a>00318 $but_search_poste='&lt;INPUT TYPE=<span class="stringliteral">"BUTTON"</span> VALUE=<span class="stringliteral">"Montre"</span> OnClick=<span class="stringliteral">"ShowTva(\''.$l_sessid.'\',\'av_text'.$i.'\')"</span>&gt;';
<a name="l00319"></a>00319 }
<a name="l00320"></a>00320
<a name="l00321"></a>00321 <span class="comment">// hide ad_id</span>
<a name="l00322"></a>00322 $ad=sprintf('&lt;input type=<span class="stringliteral">"hidden"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"ad_id%d"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"%s"</span>&gt;',
<a name="l00323"></a>00323 $l_line['ad_id'],$l_line['av_text']);
<a name="l00324"></a>00324
<a name="l00325"></a>00325 <span class="comment">// in hidden we put the jft_id</span>
<a name="l00326"></a>00326 $Hid=sprintf('&lt;INPUT TYPE=<span class="stringliteral">"HIDDEN"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"jft_id%d"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"%s"</span>&gt;',
<a name="l00327"></a>00327 $i,$l_line['jft_id']);
<a name="l00328"></a>00328 printf ('&lt;TR&gt;&lt;TD&gt; %s &lt;/TD&gt;&lt;TD&gt;&lt;INPUT TYPE=<span class="stringliteral">"TEXT"</span> NAME=<span class="stringliteral">"av_text%d"</span> VALUE=<span class="stringliteral">"%s"</span>&gt;%s %s %s&lt;/TD&gt;&lt;/TR&gt;',
<a name="l00329"></a>00329 $l_line['ad_text'], $i, $l_line['av_text'],$Hid,$but_search_poste,$ad);
<a name="l00330"></a>00330
<a name="l00331"></a>00331 }
<a name="l00332"></a>00332 echo '&lt;/TR&gt;';
<a name="l00333"></a>00333 echo '&lt;/TABLE&gt;';
<a name="l00334"></a>00334 echo '&lt;INPUT TYPE=<span class="stringliteral">"SUBMIT"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"update_fiche"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"Mis à jour"</span>&gt;';
<a name="l00335"></a>00335 echo '&lt;/<a class="code" href="constant_8php.html#a7">FORM</a>&gt;';
<a name="l00336"></a>00336 }
<a name="l00337"></a>00337 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a8"></a><!-- doxytag: member="fiche_inc.php::EncodeModele" ref="a8" args="($p_js)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">EncodeModele </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>p_js</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
parm :<ul>
<li>gen :</li><li>return:</li><li></li></ul>
<p>
EncodeModele
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l00664">664</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="pref_8inc_8php-source.html#l00048">METHOD</a>, and <a class="el" href="action_8inc_8php-source.html#l00240">name</a>.<div class="fragment"><pre class="fragment"><a name="l00665"></a>00665 {
<a name="l00666"></a>00666 echo '&lt;H2 CLASS=<span class="stringliteral">"info"</span>&gt; Ajout d\'un modèle&lt;/H2&gt;';
<a name="l00667"></a>00667 echo '&lt;<a class="code" href="constant_8php.html#a7">FORM</a> <a class="code" href="constant_8php.html#a44">ACTION</a>=<span class="stringliteral">"fiche.php"</span> <a class="code" href="pref_8inc_8php.html#a0">METHOD</a>=<span class="stringliteral">"post"</span>&gt;';
<a name="l00668"></a>00668 echo '&lt;BR&gt;Libellé &lt;INPUT TYPE=<span class="stringliteral">"TEXT"</span> NAME=<span class="stringliteral">"nom_mod"</span>&gt;';
<a name="l00669"></a>00669 echo '&lt;BR&gt;Classe de base &lt;INPUT TYPE=<span class="stringliteral">"TEXT"</span> NAME=<span class="stringliteral">"class_base"</span>&gt;';
<a name="l00670"></a>00670 echo $p_js;
<a name="l00671"></a>00671 echo '&lt;INPUT TYPE=<span class="stringliteral">"HIDDEN"</span> NAME=<span class="stringliteral">"inc"</span> VALUE=<span class="stringliteral">"1"</span>&gt;';
<a name="l00672"></a>00672 echo '&lt;BR&gt;&lt;INPUT TYPE=<span class="stringliteral">"SUBMIT"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"record_model"</span> VALUE=<span class="stringliteral">"Ajoute modèle"</span>&gt;';
<a name="l00673"></a>00673 echo '&lt;/<a class="code" href="constant_8php.html#a7">FORM</a>&gt;';
<a name="l00674"></a>00674 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a20"></a><!-- doxytag: member="fiche_inc.php::Get_attr_def" ref="a20" args="($p_cn, $p_fiche_def)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">Get_attr_def </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_fiche_def</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
retrieve the fields of the card model
<p>
Get_attr_def<p>
parm :<ul>
<li>$p_cn database connexion</li></ul>
<p>
$p_fiche_def_ref fiche_def.fd_id gen :<ul>
<li>return: array of ad_id (attr_def.ad_id) and labels (attr_def.ad_text)</li></ul>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l01181">1181</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="recherche_8php-source.html#l00066">$array</a>, <a class="el" href="balance_8php-source.html#l00118">$i</a>, <a class="el" href="fortis__be_8inc_8php-source.html#l00076">$Num</a>, <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="eub__be_8inc_8php-source.html#l00055">$Sql</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.
<p>
Referenced by <a class="el" href="fiche__inc_8php-source.html#l00038">AddFiche()</a>.<div class="fragment"><pre class="fragment"><a name="l01181"></a>01181 {
<a name="l01182"></a>01182 <span class="comment">// find the min attr for the fiche_def_ref</span>
<a name="l01183"></a>01183 <a class="code" href="eub__be_8inc_8php.html#a4">$Sql</a>=<span class="stringliteral">"select ad_id,ad_text from attr_def </span>
<a name="l01184"></a>01184 <span class="stringliteral"> natural join jnt_fic_attr</span>
<a name="l01185"></a>01185 <span class="stringliteral"> natural join fiche_def</span>
<a name="l01186"></a>01186 <span class="stringliteral"> where</span>
<a name="l01187"></a>01187 <span class="stringliteral"> fd_id= $p_fiche_def order by ad_id"</span>;
<a name="l01188"></a>01188 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$Sql);
<a name="l01189"></a>01189 <a class="code" href="fortis__be_8inc_8php.html#a9">$Num</a>=pg_NumRows($Res);
<a name="l01190"></a>01190
<a name="l01191"></a>01191 <span class="comment">// test the number of returned rows</span>
<a name="l01192"></a>01192 <span class="keywordflow">if</span> ($Num == 0 ) <span class="keywordflow">return</span> null;
<a name="l01193"></a>01193
<a name="l01194"></a>01194 <span class="comment">// Get Results &amp; Store them in a array</span>
<a name="l01195"></a>01195 <span class="keywordflow">for</span> ($i=0;$i&lt;$Num;$i++) {
<a name="l01196"></a>01196 $f=pg_fetch_array($Res,$i);
<a name="l01197"></a>01197 <a class="code" href="recherche_8php.html#a4">$array</a>[<a class="code" href="balance_8php.html#a12">$i</a>]['ad_id']=$f['ad_id'];
<a name="l01198"></a>01198 <a class="code" href="recherche_8php.html#a4">$array</a>[<a class="code" href="balance_8php.html#a12">$i</a>]['ad_text']=$f['ad_text'];
<a name="l01199"></a>01199 }
<a name="l01200"></a>01200 <span class="keywordflow">return</span> <a class="code" href="recherche_8php.html#a4">$array</a>;
<a name="l01201"></a>01201 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a19"></a><!-- doxytag: member="fiche_inc.php::Get_attr_min" ref="a19" args="($p_cn, $p_fiche_def_ref)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">Get_attr_min </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_fiche_def_ref</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
retrieve the mandatory field of the card model
<p>
Get_attr_min<p>
parm :<ul>
<li>$p_cn database connexion</li></ul>
<p>
$p_fiche_def_ref gen :<ul>
<li>return: array of ad_id (attr_min.ad_id) and labels (attr_def.ad_text)</li></ul>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l01149">1149</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="recherche_8php-source.html#l00066">$array</a>, <a class="el" href="balance_8php-source.html#l00118">$i</a>, <a class="el" href="fortis__be_8inc_8php-source.html#l00076">$Num</a>, <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="eub__be_8inc_8php-source.html#l00055">$Sql</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.
<p>
Referenced by <a class="el" href="fiche__inc_8php-source.html#l00761">AddModele()</a>.<div class="fragment"><pre class="fragment"><a name="l01149"></a>01149 {
<a name="l01150"></a>01150 <span class="comment">// find the min attr for the fiche_def_ref</span>
<a name="l01151"></a>01151 <a class="code" href="eub__be_8inc_8php.html#a4">$Sql</a>=<span class="stringliteral">"select ad_id,ad_text from attr_min natural join attr_def </span>
<a name="l01152"></a>01152 <span class="stringliteral"> natural join fiche_def_ref</span>
<a name="l01153"></a>01153 <span class="stringliteral"> where</span>
<a name="l01154"></a>01154 <span class="stringliteral"> frd_id= $p_fiche_def_ref"</span>;
<a name="l01155"></a>01155 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$Sql);
<a name="l01156"></a>01156 <a class="code" href="fortis__be_8inc_8php.html#a9">$Num</a>=pg_NumRows($Res);
<a name="l01157"></a>01157
<a name="l01158"></a>01158 <span class="comment">// test the number of returned rows</span>
<a name="l01159"></a>01159 <span class="keywordflow">if</span> ($Num == 0 ) <span class="keywordflow">return</span> null;
<a name="l01160"></a>01160
<a name="l01161"></a>01161 <span class="comment">// Get Results &amp; Store them in a array</span>
<a name="l01162"></a>01162 <span class="keywordflow">for</span> ($i=0;$i&lt;$Num;$i++) {
<a name="l01163"></a>01163 $f=pg_fetch_array($Res,$i);
<a name="l01164"></a>01164 <a class="code" href="recherche_8php.html#a4">$array</a>[<a class="code" href="balance_8php.html#a12">$i</a>]['ad_id']=$f['ad_id'];
<a name="l01165"></a>01165 <a class="code" href="recherche_8php.html#a4">$array</a>[<a class="code" href="balance_8php.html#a12">$i</a>]['ad_text']=$f['ad_text'];
<a name="l01166"></a>01166 }
<a name="l01167"></a>01167 <span class="keywordflow">return</span> <a class="code" href="recherche_8php.html#a4">$array</a>;
<a name="l01168"></a>01168 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a18"></a><!-- doxytag: member="fiche_inc.php::Get_fiche_def_ref" ref="a18" args="($p_cn)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">Get_fiche_def_ref </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>p_cn</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
return an array containing all the data contained in the table <a class="el" href="classfiche__def__ref.html">fiche_def_ref</a> parm :<ul>
<li>$p_cn connection to the database gen :</li><li>none return: array if ok null otherwize </li></ul>
<p>
Get_fiche_def_ref
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l01115">1115</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="recherche_8php-source.html#l00066">$array</a>, <a class="el" href="balance_8php-source.html#l00118">$i</a>, <a class="el" href="setup_8php-source.html#l00397">$Max</a>, <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, <a class="el" href="fiche__def_8inc_8php-source.html#l00032">frd_class_base</a>, <a class="el" href="fiche__def_8inc_8php-source.html#l00030">frd_id</a>, and <a class="el" href="fiche__def_8inc_8php-source.html#l00031">frd_text</a>.
<p>
Referenced by <a class="el" href="fiche__inc_8php-source.html#l00689">DefModele()</a>.<div class="fragment"><pre class="fragment"><a name="l01116"></a>01116 {
<a name="l01117"></a>01117 <span class="comment">// get all the data from fiche_def_ref</span>
<a name="l01118"></a>01118 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn, <span class="stringliteral">"select frd_id,frd_text,frd_class_base </span>
<a name="l01119"></a>01119 <span class="stringliteral"> from fiche_def_ref</span>
<a name="l01120"></a>01120 <span class="stringliteral"> order by frd_text"</span>);
<a name="l01121"></a>01121
<a name="l01122"></a>01122 <span class="comment">// check if the result is valid</span>
<a name="l01123"></a>01123 <a class="code" href="setup_8php.html#a11">$Max</a>=pg_NumRows($Res);
<a name="l01124"></a>01124 <span class="keywordflow">if</span> ( $Max == 0) <span class="keywordflow">return</span> null;
<a name="l01125"></a>01125
<a name="l01126"></a>01126 <span class="comment">// store the result in a array</span>
<a name="l01127"></a>01127 <span class="keywordflow">for</span> ($i=0;$i&lt;$Max;$i++) {
<a name="l01128"></a>01128 $f=pg_fetch_array($Res,$i);
<a name="l01129"></a>01129 <a class="code" href="recherche_8php.html#a4">$array</a>[<a class="code" href="balance_8php.html#a12">$i</a>]['<span class="keywordtype">id</span>']=$f['<a class="code" href="fiche__def_8inc_8php.html#a1">frd_id</a>'];
<a name="l01130"></a>01130 <a class="code" href="recherche_8php.html#a4">$array</a>[<a class="code" href="balance_8php.html#a12">$i</a>]['text']=$f['<a class="code" href="fiche__def_8inc_8php.html#a2">frd_text</a>'];
<a name="l01131"></a>01131 <a class="code" href="recherche_8php.html#a4">$array</a>[<a class="code" href="balance_8php.html#a12">$i</a>]['<span class="keyword">class</span>']=$f['<a class="code" href="fiche__def_8inc_8php.html#a3">frd_class_base</a>'];
<a name="l01132"></a>01132 }
<a name="l01133"></a>01133
<a name="l01134"></a>01134 <span class="comment">// return result</span>
<a name="l01135"></a>01135 <span class="keywordflow">return</span> <a class="code" href="recherche_8php.html#a4">$array</a>;
<a name="l01136"></a>01136 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a2"></a><!-- doxytag: member="fiche_inc.php::GetBaseFiche" ref="a2" args="($p_cn, $p_type)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">GetBaseFiche </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_type</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
donne la classe comptable de base d'une fiche
<p>
GetBaseFiche<p>
parm :<ul>
<li>p_cn connexion</li></ul>
<p>
p_type fiche id gen :<ul>
<li>none return:</li><li>return la classe id ou rien</li></ul>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l00352">352</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.
<p>
Referenced by <a class="el" href="fiche__inc_8php-source.html#l00038">AddFiche()</a>.<div class="fragment"><pre class="fragment"><a name="l00352"></a>00352 {
<a name="l00353"></a>00353 $base=null;
<a name="l00354"></a>00354 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select fd_class_base from fiche_def where fd_id="</span>.$p_type);
<a name="l00355"></a>00355 <span class="keywordflow">if</span> ( pg_NumRows($Res) == 0 ) <span class="keywordflow">return</span> null;
<a name="l00356"></a>00356 $base=pg_fetch_array($Res,0);
<a name="l00357"></a>00357 <span class="keywordflow">return</span> $base['fd_class_base'];
<a name="l00358"></a>00358 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a3"></a><!-- doxytag: member="fiche_inc.php::GetBaseFicheDefault" ref="a3" args="($p_cn, $p_type)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">GetBaseFicheDefault </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_type</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Give the default accounts of <a class="el" href="classfiche__def.html">fiche_def</a>.
<p>
GetBaseFicheDefault<p>
parm :<ul>
<li>p_cn connexion</li></ul>
<p>
p_type fiche id gen :<ul>
<li>none return:</li><li>return la classe id ou rien</li></ul>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l00374">374</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, and <a class="el" href="fiche__def_8inc_8php-source.html#l00032">frd_class_base</a>.
<p>
Referenced by <a class="el" href="fiche__inc_8php-source.html#l00761">AddModele()</a>.<div class="fragment"><pre class="fragment"><a name="l00374"></a>00374 {
<a name="l00375"></a>00375 $base=null;
<a name="l00376"></a>00376 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select frd_class_base from fiche_def_ref where frd_id="</span>.$p_type);
<a name="l00377"></a>00377 <span class="keywordflow">if</span> ( pg_NumRows($Res) == 0 ) <span class="keywordflow">return</span> null;
<a name="l00378"></a>00378 $base=pg_fetch_array($Res,0);
<a name="l00379"></a>00379 <span class="keywordflow">return</span> $base['<a class="code" href="fiche__def_8inc_8php.html#a3">frd_class_base</a>'];
<a name="l00380"></a>00380 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a24"></a><!-- doxytag: member="fiche_inc.php::GetClass" ref="a24" args="($p_cn, $p_fid)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">GetClass </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_fid</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Retrieve the account of a card.
<p>
GetClass<p>
parm :<ul>
<li>connection</li></ul>
<p>
card id (<a class="el" href="facture_8inc_8php.html#a26">fiche.f_id</a>) gen :<ul>
<li>none return: string if a class if found or null otherwise</li></ul>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l01313">1313</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="debug_8php-source.html#l00034">echo_debug()</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.
<p>
Referenced by <a class="el" href="fiche__inc_8php-source.html#l00938">Remove()</a>.<div class="fragment"><pre class="fragment"><a name="l01313"></a>01313 {
<a name="l01314"></a>01314 <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,<span class="stringliteral">"GetClass($p_fid)"</span>);
<a name="l01315"></a>01315
<a name="l01316"></a>01316 <span class="comment">// the account class is in the av_text with the ad_id=5 in </span>
<a name="l01317"></a>01317 <span class="comment">// attr_Def</span>
<a name="l01318"></a>01318 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"select av_text from attr_value </span>
<a name="l01319"></a>01319 <span class="stringliteral"> natural join jnt_fic_att_value</span>
<a name="l01320"></a>01320 <span class="stringliteral"> natural join attr_def </span>
<a name="l01321"></a>01321 <span class="stringliteral"> where</span>
<a name="l01322"></a>01322 <span class="stringliteral"> ad_id="</span>.ATTR_DEF_ACCOUNT.<span class="stringliteral">" and f_id=$p_fid"</span>;
<a name="l01323"></a>01323 <span class="comment">// Exec</span>
<a name="l01324"></a>01324 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l01325"></a>01325 <span class="keywordflow">if</span> (pg_NumRows($Res) == 0 ) <span class="keywordflow">return</span> null;
<a name="l01326"></a>01326
<a name="l01327"></a>01327 <span class="comment">// Fetch the data and return it</span>
<a name="l01328"></a>01328 $f=pg_fetch_array($Res,0);
<a name="l01329"></a>01329 <span class="keywordflow">return</span> $f['av_text'];
<a name="l01330"></a>01330 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a21"></a><!-- doxytag: member="fiche_inc.php::GetCreateAccount" ref="a21" args="($p_cn, $p_fiche_def)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">GetCreateAccount </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_fiche_def</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
retrieve the fields of the card model which indicate if each cards needs its own account parm :<ul>
<li>$p_cn database connexion</li></ul>
<p>
$p_fiche_def_ref fiche_def.fd_id gen :<ul>
<li>return: not null if yes, each cards has its own account </li></ul>
<p>
GetCreateAccount
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l01214">1214</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="fortis__be_8inc_8php-source.html#l00076">$Num</a>, <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="eub__be_8inc_8php-source.html#l00055">$Sql</a>, <a class="el" href="debug_8php-source.html#l00034">echo_debug()</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.
<p>
Referenced by <a class="el" href="fiche__inc_8php-source.html#l00038">AddFiche()</a>, and <a class="el" href="fiche__inc_8php-source.html#l00938">Remove()</a>.<div class="fragment"><pre class="fragment"><a name="l01214"></a>01214 {
<a name="l01215"></a>01215 <span class="comment">// find the min attr for the fiche_def_ref</span>
<a name="l01216"></a>01216 <a class="code" href="eub__be_8inc_8php.html#a4">$Sql</a>=<span class="stringliteral">"select fd_create_account</span>
<a name="l01217"></a>01217 <span class="stringliteral"> from fiche_def</span>
<a name="l01218"></a>01218 <span class="stringliteral"> where</span>
<a name="l01219"></a>01219 <span class="stringliteral"> fd_id= $p_fiche_def"</span>;
<a name="l01220"></a>01220 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$Sql);
<a name="l01221"></a>01221 <a class="code" href="fortis__be_8inc_8php.html#a9">$Num</a>=pg_NumRows($Res);
<a name="l01222"></a>01222
<a name="l01223"></a>01223 <span class="comment">// test the number of returned rows</span>
<a name="l01224"></a>01224 <span class="keywordflow">if</span> ($Num == 0 ) <span class="keywordflow">return</span> 0;
<a name="l01225"></a>01225
<a name="l01226"></a>01226
<a name="l01227"></a>01227 <span class="keywordflow">for</span> ($i=0;$i&lt;$Num;$i++) {
<a name="l01228"></a>01228 $f=pg_fetch_array($Res,$i);
<a name="l01229"></a>01229 <a class="code" href="debug_8php.html#a0">echo_debug</a> (<span class="stringliteral">"fd_create_account == "</span>.$f['fd_create_account']);
<a name="l01230"></a>01230 <span class="keywordflow">if</span> ( $f['fd_create_account']==<span class="charliteral">'t'</span>) {
<a name="l01231"></a>01231 <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,<span class="stringliteral">"fd_create_account return 1"</span>);
<a name="l01232"></a>01232 <span class="keywordflow">return</span> 1;
<a name="l01233"></a>01233 }
<a name="l01234"></a>01234 }
<a name="l01235"></a>01235 <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,<span class="stringliteral">"fd_create_account return 0"</span>);
<a name="l01236"></a>01236 <span class="keywordflow">return</span> 0;
<a name="l01237"></a>01237 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a12"></a><!-- doxytag: member="fiche_inc.php::GetDataModele" ref="a12" args="($p_cn, $p_fiche)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">GetDataModele </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_fiche</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Return the info of an fiche identified by p_fiche.
<p>
GetDataModele<p>
parm :<ul>
<li>connection</li></ul>
<p>
fiche id gen :<ul>
<li>none return:</li><li>array with all the data</li></ul>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l00895">895</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="recherche_8php-source.html#l00066">$array</a>, <a class="el" href="argenta__be_8inc_8php-source.html#l00028">$line</a>, <a class="el" href="setup_8php-source.html#l00397">$Max</a>, <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, and <a class="el" href="balance_8php-source.html#l00076">label</a>.
<p>
Referenced by <a class="el" href="fiche__inc_8php-source.html#l00869">UpdateModele()</a>.<div class="fragment"><pre class="fragment"><a name="l00895"></a>00895 {
<a name="l00896"></a>00896 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select fd_class_base,ad_id,ad_text from </span>
<a name="l00897"></a>00897 <span class="stringliteral"> fiche_def</span>
<a name="l00898"></a>00898 <span class="stringliteral"> natural join jnt_fic_attr</span>
<a name="l00899"></a>00899 <span class="stringliteral"> natural join attr_def</span>
<a name="l00900"></a>00900 <span class="stringliteral"> where</span>
<a name="l00901"></a>00901 <span class="stringliteral"> fd_id=$p_fiche"</span>);
<a name="l00902"></a>00902 <a class="code" href="setup_8php.html#a11">$Max</a>=pg_NumRows($Res) ;
<a name="l00903"></a>00903 <span class="keywordflow">if</span> ($Max==0) <span class="keywordflow">return</span> null;
<a name="l00904"></a>00904
<a name="l00905"></a>00905 <span class="comment">// store the data in an array</span>
<a name="l00906"></a>00906 <span class="keywordflow">for</span> ($i=0; $i &lt; $Max;$i++) {
<a name="l00907"></a>00907 <a class="code" href="argenta__be_8inc_8php.html#a0">$line</a>=pg_fetch_array($Res,$i);
<a name="l00908"></a>00908 <span class="keywordflow">if</span> ($i == 0 ) {
<a name="l00909"></a>00909 <a class="code" href="recherche_8php.html#a4">$array</a>['<a class="code" href="balance_8php.html#a6">label</a>']=GetFicheDefName($p_cn,$p_fiche);
<a name="l00910"></a>00910 <a class="code" href="recherche_8php.html#a4">$array</a>['class_base']=<a class="code" href="argenta__be_8inc_8php.html#a0">$line</a>['fd_class_base'];
<a name="l00911"></a>00911 <a class="code" href="recherche_8php.html#a4">$array</a>['fd_id']=$p_fiche;
<a name="l00912"></a>00912 }<span class="comment">//if $i == 0</span>
<a name="l00913"></a>00913
<a name="l00914"></a>00914 <span class="comment">//Label</span>
<a name="l00915"></a>00915 $text=sprintf(<span class="stringliteral">"ad_id%d"</span>,$i);
<a name="l00916"></a>00916 <a class="code" href="recherche_8php.html#a4">$array</a>[$text]=<a class="code" href="argenta__be_8inc_8php.html#a0">$line</a>['ad_id'];
<a name="l00917"></a>00917 <span class="comment">//isd_id</span>
<a name="l00918"></a>00918 $text=sprintf(<span class="stringliteral">"ad_text%d"</span>,$i);
<a name="l00919"></a>00919 <a class="code" href="recherche_8php.html#a4">$array</a>[$text]=<a class="code" href="argenta__be_8inc_8php.html#a0">$line</a>['ad_text'];
<a name="l00920"></a>00920
<a name="l00921"></a>00921 }<span class="comment">//for</span>
<a name="l00922"></a>00922 <a class="code" href="recherche_8php.html#a4">$array</a>['ligne']=<a class="code" href="setup_8php.html#a11">$Max</a>;
<a name="l00923"></a>00923 <span class="keywordflow">return</span> <a class="code" href="recherche_8php.html#a4">$array</a>;
<a name="l00924"></a>00924 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a29"></a><!-- doxytag: member="fiche_inc.php::getFicheAttribut" ref="a29" args="($p_cn, $p_id, $p_attr=&quot;&quot;)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">getFicheAttribut </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_id</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_attr</em> = <code>&quot;&quot;</code></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
retrun array of attribut or string
<p>
getFicheAttribut<p>
parm :<ul>
<li>p_cn connexion</li></ul>
<p>
p_id quick_code<ul>
<li>attribut if attribut == "" then return a array taken from vw_fiche_attr gen :<ul>
<li>none return:</li></ul>
</li></ul>
<p>
string avec nom fiche or array
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l01474">1474</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.
<p>
Referenced by <a class="el" href="user__form__ach_8php-source.html#l00472">FormAchView()</a>, <a class="el" href="user__form__ven_8php-source.html#l00426">FormVenteView()</a>, and <a class="el" href="user__common_8php-source.html#l00631">withStock()</a>.<div class="fragment"><pre class="fragment"><a name="l01474"></a>01474 {
<a name="l01475"></a>01475 <span class="comment">// Retrieve the attribute with the ad_id 1</span>
<a name="l01476"></a>01476 <span class="comment">// 1 is always the name</span>
<a name="l01477"></a>01477
<a name="l01478"></a>01478 <span class="keywordflow">if</span> ( $p_attr != <span class="stringliteral">""</span>) {
<a name="l01479"></a>01479 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select av_text from </span>
<a name="l01480"></a>01480 <span class="stringliteral"> attr_value</span>
<a name="l01481"></a>01481 <span class="stringliteral"> natural join jnt_fic_att_value </span>
<a name="l01482"></a>01482 <span class="stringliteral"> natural join fiche </span>
<a name="l01483"></a>01483 <span class="stringliteral"> where</span>
<a name="l01484"></a>01484 <span class="stringliteral"> ad_id=$p_attr </span>
<a name="l01485"></a>01485 <span class="stringliteral"> and f_id=(select f_id from vw_poste_qcode where j_qcode='$p_id') "</span>);
<a name="l01486"></a>01486 <span class="keywordflow">if</span> ( pg_NumRows($Res) == 0 ) <span class="keywordflow">return</span> NULL;
<a name="l01487"></a>01487 $st=pg_fetch_array($Res,0);
<a name="l01488"></a>01488 <span class="keywordflow">return</span> $st['av_text'];
<a name="l01489"></a>01489 } <span class="keywordflow">else</span> {
<a name="l01490"></a>01490 <span class="comment">// Get attribut from the view</span>
<a name="l01491"></a>01491 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select * from vw_fiche_attr where quick_code='$p_id'"</span>);
<a name="l01492"></a>01492 <span class="keywordflow">if</span> ( pg_NumRows($Res) == 0 ) <span class="keywordflow">return</span> null;
<a name="l01493"></a>01493 $st=pg_fetch_array($Res,0);
<a name="l01494"></a>01494 <span class="keywordflow">return</span> $st;
<a name="l01495"></a>01495 }
<a name="l01496"></a>01496 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a23"></a><!-- doxytag: member="fiche_inc.php::GetFicheDef" ref="a23" args="($p_cn, $p_f_id)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">GetFicheDef </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_f_id</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
retrieve the fiche_def.fd_id thanks the f_id of a card
<p>
GetFicheRef<p>
parm :<ul>
<li>$p_cn connection</li></ul>
<p>
$p_f_id <a class="el" href="facture_8inc_8php.html#a26">fiche.f_id</a> gen :<ul>
<li>none return:</li></ul>
<p>
the fiche_def.fd_id or null if nothing has been found
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l01282">1282</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.
<p>
Referenced by <a class="el" href="fiche__inc_8php-source.html#l00938">Remove()</a>, and <a class="el" href="fiche__inc_8php-source.html#l00492">ViewFicheDetail()</a>.<div class="fragment"><pre class="fragment"><a name="l01283"></a>01283 {
<a name="l01284"></a>01284 <span class="comment">// Sql stmt</span>
<a name="l01285"></a>01285 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"select fd_id from fiche_def join fiche using (fd_id) </span>
<a name="l01286"></a>01286 <span class="stringliteral"> where f_id=$p_f_id"</span>;
<a name="l01287"></a>01287 <span class="comment">// Execute it</span>
<a name="l01288"></a>01288 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l01289"></a>01289
<a name="l01290"></a>01290 <span class="comment">// nothing is found</span>
<a name="l01291"></a>01291 <span class="keywordflow">if</span> ( pg_NumRows($Res) == 0 ) <span class="keywordflow">return</span> null;
<a name="l01292"></a>01292
<a name="l01293"></a>01293 <span class="comment">// Fetch the data</span>
<a name="l01294"></a>01294 $f=pg_fetch_array($Res,0);
<a name="l01295"></a>01295
<a name="l01296"></a>01296 <span class="comment">// return the value</span>
<a name="l01297"></a>01297 <span class="keywordflow">return</span> $f['fd_id'];
<a name="l01298"></a>01298
<a name="l01299"></a>01299 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a16"></a><!-- doxytag: member="fiche_inc.php::getFicheDefName" ref="a16" args="($p_cn, $p_id)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">getFicheDefName </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_id</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
retourne le nom de la cat. de fiches
<p>
getFicheDefName<p>
parm :<ul>
<li>p_cn connexion</li></ul>
<p>
p_id fiche id fiche_def.fd_id gen :<ul>
<li>none return:</li></ul>
<p>
string fiche_def.fd_label
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l01038">1038</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.<div class="fragment"><pre class="fragment"><a name="l01038"></a>01038 {
<a name="l01039"></a>01039 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select fd_label from fiche_def where fd_id=$p_id"</span>);
<a name="l01040"></a>01040 <span class="keywordflow">if</span> ( pg_NumRows($Res) == 0 ) <span class="keywordflow">return</span> <span class="stringliteral">"Unknown"</span>;
<a name="l01041"></a>01041 $st=pg_fetch_array($Res,0);
<a name="l01042"></a>01042 <span class="keywordflow">return</span> $st['fd_label'];
<a name="l01043"></a>01043 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a22"></a><!-- doxytag: member="fiche_inc.php::GetFicheDefRef" ref="a22" args="($p_cn, $p_f_id)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">GetFicheDefRef </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_f_id</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
retrieve the <a class="el" href="fiche__def_8inc_8php.html#a1">fiche_def.frd_id</a> thanks the f_id of a card
<p>
GetFicheDefRef<p>
parm :<ul>
<li>$p_cn connection</li></ul>
<p>
$p_f_id <a class="el" href="facture_8inc_8php.html#a26">fiche.f_id</a> gen :<ul>
<li>none return:</li></ul>
<p>
the <a class="el" href="fiche__def_8inc_8php.html#a1">fiche_def.frd_id</a> or null if nothing has been found
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l01251">1251</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, and <a class="el" href="fiche__def_8inc_8php-source.html#l00030">frd_id</a>.
<p>
Referenced by <a class="el" href="fiche__inc_8php-source.html#l00530">UpdateFiche()</a>.<div class="fragment"><pre class="fragment"><a name="l01252"></a>01252 {
<a name="l01253"></a>01253 <span class="comment">// Sql stmt</span>
<a name="l01254"></a>01254 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"select frd_id from fiche_def join fiche using (fd_id) </span>
<a name="l01255"></a>01255 <span class="stringliteral"> where f_id=$p_f_id"</span>;
<a name="l01256"></a>01256 <span class="comment">// Execute it</span>
<a name="l01257"></a>01257 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l01258"></a>01258
<a name="l01259"></a>01259 <span class="comment">// nothing is found</span>
<a name="l01260"></a>01260 <span class="keywordflow">if</span> ( pg_NumRows($Res) == 0 ) <span class="keywordflow">return</span> null;
<a name="l01261"></a>01261
<a name="l01262"></a>01262 <span class="comment">// Fetch the data</span>
<a name="l01263"></a>01263 $f=pg_fetch_array($Res,0);
<a name="l01264"></a>01264
<a name="l01265"></a>01265 <span class="comment">// return the value</span>
<a name="l01266"></a>01266 <span class="keywordflow">return</span> $f['<a class="code" href="fiche__def_8inc_8php.html#a1">frd_id</a>'];
<a name="l01267"></a>01267
<a name="l01268"></a>01268 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a17"></a><!-- doxytag: member="fiche_inc.php::GetFicheJrn" ref="a17" args="($p_cn, $p_jrn, $p_type)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">GetFicheJrn </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_jrn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_type</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Get all the fiche related to a "journal".
<p>
GetFicheJrn<p>
parm :<ul>
<li>p_cn connextion</li></ul>
<p>
j_jrn journal_id<ul>
<li>$p_type : deb or cred gen :<ul>
<li>none return: array containing the fiche(f_id),fiche(f_label)</li></ul>
</li></ul>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l01057">1057</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="balance_8php-source.html#l00113">$a</a>, <a class="el" href="balance_8php-source.html#l00118">$i</a>, <a class="el" href="argenta__be_8inc_8php-source.html#l00028">$line</a>, <a class="el" href="fiche__new_8php-source.html#l00136">$list</a>, <a class="el" href="setup_8php-source.html#l00397">$Max</a>, <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="ac__common_8php-source.html#l00036">echo_error()</a>, <a class="el" href="ac__common_8php-source.html#l00267">echo_warning()</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, <a class="el" href="balance_8php-source.html#l00036">exit</a>, and <a class="el" href="facture_8inc_8php-source.html#l00227">f_id</a>.<div class="fragment"><pre class="fragment"><a name="l01058"></a>01058 {
<a name="l01059"></a>01059 $get=<span class="stringliteral">""</span>;
<a name="l01060"></a>01060 <span class="keywordflow">if</span> ( $p_type == 'deb' ) {
<a name="l01061"></a>01061 $get='jrn_def_fiche_deb';
<a name="l01062"></a>01062 }
<a name="l01063"></a>01063 <span class="keywordflow">if</span> ( $p_type == 'cred' ) {
<a name="l01064"></a>01064 $get='jrn_def_fiche_cred';
<a name="l01065"></a>01065 }
<a name="l01066"></a>01066 <span class="keywordflow">if</span> ( $get == <span class="stringliteral">""</span> ) {
<a name="l01067"></a>01067 <a class="code" href="ac__common_8php.html#a0">echo_error</a>(<span class="stringliteral">"Invalid p_type function GetFicheJrn($p_cn,$p_jrn,$p_type)"</span>);
<a name="l01068"></a>01068 <a class="code" href="balance_8php.html#a0">exit</a> -1;
<a name="l01069"></a>01069 }
<a name="l01070"></a>01070 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select $get as fiche from jrn_def where jrn_def_id=$p_jrn"</span>);
<a name="l01071"></a>01071 <a class="code" href="setup_8php.html#a11">$Max</a>=pg_NumRows($Res);
<a name="l01072"></a>01072 <span class="keywordflow">if</span> ( $Max==0) {
<a name="l01073"></a>01073 <a class="code" href="ac__common_8php.html#a11">echo_warning</a>(<span class="stringliteral">"No rows"</span>);
<a name="l01074"></a>01074 <span class="keywordflow">return</span> null;
<a name="l01075"></a>01075 }
<a name="l01076"></a>01076 <span class="comment">// Normally Max must be == 1</span>
<a name="l01077"></a>01077 <a class="code" href="fiche__new_8php.html#a7">$list</a>=pg_fetch_array($Res,0);
<a name="l01078"></a>01078 <span class="keywordflow">if</span> ( $list['<a class="code" href="classfiche.html">fiche</a>']==<span class="stringliteral">""</span>) {
<a name="l01079"></a>01079 <a class="code" href="ac__common_8php.html#a11">echo_warning</a>(<span class="stringliteral">"No fiche"</span>);
<a name="l01080"></a>01080 <span class="keywordflow">return</span> null;
<a name="l01081"></a>01081 }
<a name="l01082"></a>01082
<a name="l01083"></a>01083 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"select f_id,av_text as f_label </span>
<a name="l01084"></a>01084 <span class="stringliteral"> from fiche natural join jnt_fic_att_value</span>
<a name="l01085"></a>01085 <span class="stringliteral"> natural join attr_def</span>
<a name="l01086"></a>01086 <span class="stringliteral"> natural join attr_value</span>
<a name="l01087"></a>01087 <span class="stringliteral"> natural join fiche_def</span>
<a name="l01088"></a>01088 <span class="stringliteral"> where ad_id=1 and</span>
<a name="l01089"></a>01089 <span class="stringliteral"> fd_id in ("</span>.$list['<a class="code" href="classfiche.html">fiche</a>'].<span class="stringliteral">") order by f_label"</span>;
<a name="l01090"></a>01090
<a name="l01091"></a>01091 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l01092"></a>01092 <a class="code" href="setup_8php.html#a11">$Max</a>=pg_NumRows($Res);
<a name="l01093"></a>01093 <span class="keywordflow">if</span> ($Max==0 ) <span class="keywordflow">return</span> null;
<a name="l01094"></a>01094 <span class="comment">// Get The result and put it into an array</span>
<a name="l01095"></a>01095 <span class="keywordflow">for</span> ($i=0;$i&lt;$Max;$i++) {
<a name="l01096"></a>01096 <a class="code" href="argenta__be_8inc_8php.html#a0">$line</a>=pg_fetch_array($Res,$i);
<a name="l01097"></a>01097 $f_id=<a class="code" href="argenta__be_8inc_8php.html#a0">$line</a>['<a class="code" href="facture_8inc_8php.html#a26">f_id</a>'];
<a name="l01098"></a>01098 $f_label=<a class="code" href="argenta__be_8inc_8php.html#a0">$line</a>['f_label'];
<a name="l01099"></a>01099 <a class="code" href="balance_8php.html#a10">$a</a>[<a class="code" href="balance_8php.html#a12">$i</a>]=array($<a class="code" href="facture_8inc_8php.html#a26">f_id</a>,$f_label);
<a name="l01100"></a>01100 }
<a name="l01101"></a>01101 <span class="keywordflow">return</span> <a class="code" href="balance_8php.html#a10">$a</a>;
<a name="l01102"></a>01102 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a14"></a><!-- doxytag: member="fiche_inc.php::getFicheName" ref="a14" args="($p_cn, $p_id)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">getFicheName </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_id</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
retourne le nom de la fiche en fournissant le quick_code
<p>
getFicheName<p>
parm :<ul>
<li>p_cn connexion</li></ul>
<p>
p_id quick_code gen :<ul>
<li>none return:</li></ul>
<p>
string avec nom fiche
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l00988">988</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.
<p>
Referenced by <a class="el" href="user__form__ach_8php-source.html#l00472">FormAchView()</a>, and <a class="el" href="user__form__ven_8php-source.html#l00426">FormVenteView()</a>.<div class="fragment"><pre class="fragment"><a name="l00988"></a>00988 {
<a name="l00989"></a>00989 <span class="comment">// Retrieve the attribute with the ad_id 1</span>
<a name="l00990"></a>00990 <span class="comment">// 1 is always the name</span>
<a name="l00991"></a>00991
<a name="l00992"></a>00992 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select vw_name from </span>
<a name="l00993"></a>00993 <span class="stringliteral"> vw_fiche_attr where quick_code='$p_id'"</span>);
<a name="l00994"></a>00994 <span class="keywordflow">if</span> ( pg_NumRows($Res) == 0 ) <span class="keywordflow">return</span> <span class="stringliteral">"Unknown"</span>;
<a name="l00995"></a>00995 $st=pg_fetch_array($Res,0);
<a name="l00996"></a>00996 <span class="keywordflow">return</span> $st['vw_name'];
<a name="l00997"></a>00997 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a15"></a><!-- doxytag: member="fiche_inc.php::getFicheNameById" ref="a15" args="($p_cn, $p_id)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">getFicheNameById </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_id</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
retourne le nom de la fiche en fournissant le f_id
<p>
getFicheNameById<p>
parm :<ul>
<li>p_cn connexion</li></ul>
<p>
p_id quick_code gen :<ul>
<li>none return:</li></ul>
<p>
string avec nom fiche
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l01010">1010</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.
<p>
Referenced by <a class="el" href="fiche__inc_8php-source.html#l00225">EncodeFiche()</a>.<div class="fragment"><pre class="fragment"><a name="l01010"></a>01010 {
<a name="l01011"></a>01011 <span class="comment">// Retrieve the attribute with the ad_id 1</span>
<a name="l01012"></a>01012 <span class="comment">// 1 is always the name</span>
<a name="l01013"></a>01013 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select av_text from</span>
<a name="l01014"></a>01014 <span class="stringliteral"> attr_value</span>
<a name="l01015"></a>01015 <span class="stringliteral"> natural join jnt_fic_att_value</span>
<a name="l01016"></a>01016 <span class="stringliteral"> natural join fiche</span>
<a name="l01017"></a>01017 <span class="stringliteral"> where</span>
<a name="l01018"></a>01018 <span class="stringliteral"> f_id=$p_id and</span>
<a name="l01019"></a>01019 <span class="stringliteral"> ad_id="</span>.<a class="code" href="constant_8php.html#a56">ATTR_DEF_NAME</a>);
<a name="l01020"></a>01020
<a name="l01021"></a>01021 <span class="keywordflow">if</span> ( pg_NumRows($Res) == 0 ) <span class="keywordflow">return</span> <span class="stringliteral">"Unknown"</span>;
<a name="l01022"></a>01022 $st=pg_fetch_array($Res,0);
<a name="l01023"></a>01023 <span class="keywordflow">return</span> $st['av_text'];
<a name="l01024"></a>01024 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a5"></a><!-- doxytag: member="fiche_inc.php::GetNextFiche" ref="a5" args="($p_cn, $p_base)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">GetNextFiche </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_base</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Crée le poste suivant pour une fiche en fonction de la classe de base (fichedef(fd_class_base)).
<p>
GetNextFiche<p>
parm :<ul>
<li>p_cn connexion</li></ul>
<p>
p_base gen :<ul>
<li>return:</li><li></li></ul>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l00462">462</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="jrn__detail_8php-source.html#l00124">$l_line</a>, <a class="el" href="setup_8php-source.html#l00397">$Max</a>, <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="impress__bilan_8php-source.html#l00032">$ret</a>, <a class="el" href="debug_8php-source.html#l00034">echo_debug()</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.
<p>
Referenced by <a class="el" href="fiche__inc_8php-source.html#l00038">AddFiche()</a>.<div class="fragment"><pre class="fragment"><a name="l00462"></a>00462 {
<a name="l00463"></a>00463 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select max(pcm_val) as maxcode from tmp_pcmn where pcm_val_parent = $p_base"</span>);
<a name="l00464"></a>00464 <a class="code" href="setup_8php.html#a11">$Max</a>=pg_NumRows($Res);
<a name="l00465"></a>00465 <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,<span class="stringliteral">"$Max=pg_NumRows"</span>);
<a name="l00466"></a>00466 <a class="code" href="jrn__detail_8php.html#a11">$l_line</a>=pg_fetch_array($Res,0);
<a name="l00467"></a>00467 <a class="code" href="impress__bilan_8php.html#a0">$ret</a>=<a class="code" href="jrn__detail_8php.html#a11">$l_line</a>['maxcode'];
<a name="l00468"></a>00468 <span class="keywordflow">if</span> ( $ret == <span class="stringliteral">""</span> ) {
<a name="l00469"></a>00469 <a class="code" href="impress__bilan_8php.html#a0">$ret</a>=sprintf(<span class="stringliteral">"%d%04d"</span>,$p_base,0);
<a name="l00470"></a>00470 <span class="keywordflow">return</span> <a class="code" href="impress__bilan_8php.html#a0">$ret</a>+1;
<a name="l00471"></a>00471
<a name="l00472"></a>00472 }
<a name="l00473"></a>00473
<a name="l00474"></a>00474 <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,<span class="stringliteral">"ret $ret"</span>);
<a name="l00475"></a>00475 <span class="keywordflow">return</span> <a class="code" href="impress__bilan_8php.html#a0">$ret</a>+1;
<a name="l00476"></a>00476 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a28"></a><!-- doxytag: member="fiche_inc.php::GetParent" ref="a28" args="($p_cn, $p_val)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">GetParent </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_val</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Get the parent in tmp_pcmn.
<p>
GetParent<p>
parm :<ul>
<li>cn database connextion</li></ul>
<p>
the base we want insert gen :<ul>
<li>return: the parent</li></ul>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l01450">1450</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="balance_8php-source.html#l00113">$a</a>, <a class="el" href="postgres_8php-source.html#l00222">CountSql()</a>, and <a class="el" href="debug_8php-source.html#l00034">echo_debug()</a>.
<p>
Referenced by <a class="el" href="fiche__inc_8php-source.html#l00530">UpdateFiche()</a>.<div class="fragment"><pre class="fragment"><a name="l01451"></a>01451 {
<a name="l01452"></a>01452 $len=strlen($p_val)-1;
<a name="l01453"></a>01453 <span class="keywordflow">for</span> ($i=$len-1;$i&gt;0;$i--) {
<a name="l01454"></a>01454 <a class="code" href="balance_8php.html#a10">$a</a>=substr($p_val,0,$i);
<a name="l01455"></a>01455 <a class="code" href="debug_8php.html#a0">echo_debug</a> (<span class="stringliteral">"parent == $a len =1"</span>);
<a name="l01456"></a>01456 <span class="keywordflow">if</span> (<a class="code" href="postgres_8php.html#a10">CountSql</a>($p_cn,<span class="stringliteral">"select pcm_val from tmp_pcmn where pcm_val=$a"</span>) == 1)
<a name="l01457"></a>01457 <span class="keywordflow">return</span> <a class="code" href="balance_8php.html#a10">$a</a>;
<a name="l01458"></a>01458 }
<a name="l01459"></a>01459 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a25"></a><!-- doxytag: member="fiche_inc.php::InsertModeleLine" ref="a25" args="($p_cn, $p_fid, $p_adid)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">InsertModeleLine </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_fid</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_adid</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Insert a new row into jnt_fic_attr for adding a new attribute to the card model parm :<ul>
<li>p_cn connection</li></ul>
<p>
the fiche_def.fd_id, id of the cat of the model<ul>
<li>the ad_id is the attr_def.ad_id gen :<ul>
<li>none return: none. </li></ul>
</li></ul>
<p>
InsertModeleLine
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l01343">1343</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.<div class="fragment"><pre class="fragment"><a name="l01344"></a>01344 {
<a name="l01345"></a>01345 <span class="comment">// Insert a new attribute for the model</span>
<a name="l01346"></a>01346 <span class="comment">// it means insert a row in jnt_fic_attr</span>
<a name="l01347"></a>01347 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf(<span class="stringliteral">"insert into jnt_fic_attr (fd_id,ad_id) values (%d,%d)"</span>,
<a name="l01348"></a>01348 $p_fid,$p_adid);
<a name="l01349"></a>01349 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l01350"></a>01350
<a name="l01351"></a>01351 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a30"></a><!-- doxytag: member="fiche_inc.php::IsFicheOfJrn" ref="a30" args="($p_cn, $p_jrn, $p_fiche, $p_type=&quot;&quot;)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">IsFicheOfJrn </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_jrn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_fiche</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_type</em> = <code>&quot;&quot;</code></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Check if a fiche is used by a jrn return 1 if the fiche is in the range otherwise 0.
<p>
IsFicheOfJrn<p>
parm :<ul>
<li>p_cn connextion</li></ul>
<p>
j_jrn journal_id<ul>
<li>$p_type : deb or cred</li><li>$p_fiche : quick_code gen :<ul>
<li>none</li></ul>
</li></ul>
<p>
return 1 if the fiche is in the range otherwise 0
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l01514">1514</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="fiche__new_8php-source.html#l00136">$list</a>, <a class="el" href="setup_8php-source.html#l00397">$Max</a>, <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="ac__common_8php-source.html#l00267">echo_warning()</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.
<p>
Referenced by <a class="el" href="user__form__fin_8php-source.html#l00042">form_verify_input()</a>.<div class="fragment"><pre class="fragment"><a name="l01515"></a>01515 {
<a name="l01516"></a>01516 $get=<span class="stringliteral">""</span>;
<a name="l01517"></a>01517 <span class="keywordflow">if</span> ( $p_type == 'deb' ) {
<a name="l01518"></a>01518 $get='jrn_def_fiche_deb';
<a name="l01519"></a>01519 }
<a name="l01520"></a>01520 <span class="keywordflow">if</span> ( $p_type == 'cred' ) {
<a name="l01521"></a>01521 $get='jrn_def_fiche_cred';
<a name="l01522"></a>01522 }
<a name="l01523"></a>01523 <span class="keywordflow">if</span> ( $get != <span class="stringliteral">""</span> ) {
<a name="l01524"></a>01524 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select $get as fiche from jrn_def where jrn_def_id=$p_jrn"</span>);
<a name="l01525"></a>01525 } <span class="keywordflow">else</span> {
<a name="l01526"></a>01526 <span class="comment">// Get all the fiche type (deb and cred)</span>
<a name="l01527"></a>01527 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">" select jrn_def_fiche_cred as fiche </span>
<a name="l01528"></a>01528 <span class="stringliteral"> from jrn_def where jrn_def_id=$p_jrn</span>
<a name="l01529"></a>01529 <span class="stringliteral"> union</span>
<a name="l01530"></a>01530 <span class="stringliteral"> select jrn_def_fiche_deb </span>
<a name="l01531"></a>01531 <span class="stringliteral"> from jrn_def where jrn_def_id=$p_jrn"</span>
<a name="l01532"></a>01532 );
<a name="l01533"></a>01533 }
<a name="l01534"></a>01534 <a class="code" href="setup_8php.html#a11">$Max</a>=pg_NumRows($Res);
<a name="l01535"></a>01535 <span class="keywordflow">if</span> ( $Max==0) {
<a name="l01536"></a>01536 <a class="code" href="ac__common_8php.html#a11">echo_warning</a>(<span class="stringliteral">"No rows"</span>);
<a name="l01537"></a>01537 <span class="keywordflow">return</span> null;
<a name="l01538"></a>01538 }
<a name="l01539"></a>01539 <span class="comment">// Normally Max must be == 1</span>
<a name="l01540"></a>01540 <a class="code" href="fiche__new_8php.html#a7">$list</a>=pg_fetch_array($Res,0);
<a name="l01541"></a>01541 <span class="keywordflow">if</span> ( $list['<a class="code" href="classfiche.html">fiche</a>']==<span class="stringliteral">""</span>) {
<a name="l01542"></a>01542 <a class="code" href="ac__common_8php.html#a11">echo_warning</a>(<span class="stringliteral">"No fiche"</span>);
<a name="l01543"></a>01543 <span class="keywordflow">return</span> null;
<a name="l01544"></a>01544 }
<a name="l01545"></a>01545
<a name="l01546"></a>01546 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"select *</span>
<a name="l01547"></a>01547 <span class="stringliteral"> from vw_fiche_attr</span>
<a name="l01548"></a>01548 <span class="stringliteral"> where </span>
<a name="l01549"></a>01549 <span class="stringliteral"> fd_id in ("</span>.$list['<a class="code" href="classfiche.html">fiche</a>'].<span class="stringliteral">") and quick_code='$p_fiche'"</span>;
<a name="l01550"></a>01550
<a name="l01551"></a>01551 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l01552"></a>01552 <a class="code" href="setup_8php.html#a11">$Max</a>=pg_NumRows($Res);
<a name="l01553"></a>01553 <span class="keywordflow">if</span> ($Max==0 )
<a name="l01554"></a>01554 <span class="keywordflow">return</span> 0;
<a name="l01555"></a>01555 <span class="keywordflow">else</span>
<a name="l01556"></a>01556 <span class="keywordflow">return</span> 1;
<a name="l01557"></a>01557 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a13"></a><!-- doxytag: member="fiche_inc.php::Remove" ref="a13" args="($p_cn, $p_fid)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">Remove </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_fid</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
enleve une fiche dans attr_value, jnt_fic_att_value et fiche a la condition que ce poste n'aie jamais été utilisé parm :<ul>
<li>p_cn</li></ul>
<p>
p_fid fiche(f_id) gen :<ul>
<li>none return:</li></ul>
<p>
none
<p>
Remove
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l00938">938</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="postgres_8php-source.html#l00222">CountSql()</a>, <a class="el" href="ac__common_8php-source.html#l00036">echo_error()</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, <a class="el" href="ac__common_8php-source.html#l00206">FormatString()</a>, <a class="el" href="fiche__inc_8php-source.html#l01313">GetClass()</a>, <a class="el" href="fiche__inc_8php-source.html#l01214">GetCreateAccount()</a>, <a class="el" href="fiche__inc_8php-source.html#l01282">GetFicheDef()</a>, and <a class="el" href="ac__common_8php-source.html#l00076">isNumber()</a>.<div class="fragment"><pre class="fragment"><a name="l00938"></a>00938 {
<a name="l00939"></a>00939 <span class="keywordflow">if</span> ( ! isset ($p_cn) ||
<a name="l00940"></a>00940 ! isset ($p_fid) ) {
<a name="l00941"></a>00941 <a class="code" href="ac__common_8php.html#a0">echo_error</a> (<span class="stringliteral">"Remove Missing Parameter p_cn = $p_cn p_fid=$p_fid"</span>);
<a name="l00942"></a>00942 <span class="keywordflow">return</span>;
<a name="l00943"></a>00943 }
<a name="l00944"></a>00944 <span class="comment">// if the card has its own account in PCMN</span>
<a name="l00945"></a>00945 <span class="comment">// Get the fiche_def.fd_id from fiche.f_id</span>
<a name="l00946"></a>00946 $fd_id=<a class="code" href="fiche__inc_8php.html#a23">GetFicheDef</a>($p_cn,$p_fid);
<a name="l00947"></a>00947 <span class="keywordflow">if</span> ( <a class="code" href="fiche__inc_8php.html#a21">GetCreateAccount</a>($p_cn,$fd_id) == 1 ) {
<a name="l00948"></a>00948 <span class="comment">// Retrieve the class </span>
<a name="l00949"></a>00949 $class=<a class="code" href="fiche__inc_8php.html#a24">GetClass</a>($p_cn,$p_fid);
<a name="l00950"></a>00950
<a name="l00951"></a>00951 <span class="comment">// if class is not NULL and if we use it before, we can't remove it</span>
<a name="l00952"></a>00952 <span class="keywordflow">if</span> (<a class="code" href="ac__common_8php.html#a9">FormatString</a>($<span class="keyword">class</span>) != null &amp;&amp;
<a name="l00953"></a>00953 <a class="code" href="postgres_8php.html#a10">CountSql</a>($p_cn,<span class="stringliteral">"select * from jrnx where j_poste=$class"</span>) != 0 ) {
<a name="l00954"></a>00954 echo <span class="stringliteral">"&lt;SCRIPT&gt; alert('Impossible ce poste est utilisé dans un journal'); &lt;/SCRIPT&gt;"</span>;
<a name="l00955"></a>00955 <span class="keywordflow">return</span>;
<a name="l00956"></a>00956 } <span class="keywordflow">else</span> {
<a name="l00957"></a>00957 <span class="comment">// Remove in PCMN</span>
<a name="l00958"></a>00958 <span class="keywordflow">if</span> ( trim(strlen($<span class="keyword">class</span>)) != 0 and <a class="code" href="ac__common_8php.html#a2">isNumber</a>($<span class="keyword">class</span>) == 1)
<a name="l00959"></a>00959 <a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"delete from tmp_pcmn where pcm_val="</span>.$<span class="keyword">class</span>);
<a name="l00960"></a>00960 }
<a name="l00961"></a>00961
<a name="l00962"></a>00962 }
<a name="l00963"></a>00963 <span class="comment">// Remove from attr_value</span>
<a name="l00964"></a>00964 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"delete from attr_value </span>
<a name="l00965"></a>00965 <span class="stringliteral"> where jft_id in (select jft_id </span>
<a name="l00966"></a>00966 <span class="stringliteral"> from jnt_fic_att_value </span>
<a name="l00967"></a>00967 <span class="stringliteral"> natural join fiche where f_id=$p_fid)"</span>);
<a name="l00968"></a>00968 <span class="comment">// Remove from jnt_fic_att_value</span>
<a name="l00969"></a>00969 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"delete from jnt_fic_att_value where f_id=$p_fid"</span>);
<a name="l00970"></a>00970
<a name="l00971"></a>00971 <span class="comment">// Remove from fiche</span>
<a name="l00972"></a>00972 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"delete from fiche where f_id=$p_fid"</span>);
<a name="l00973"></a>00973
<a name="l00974"></a>00974 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a26"></a><!-- doxytag: member="fiche_inc.php::SaveModeleName" ref="a26" args="($p_cn, $p_fid, $p_label)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">SaveModeleName </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_fid</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_label</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Update the model's name.
<p>
SaveModeleName<p>
parm :<ul>
<li>p_cn connection</li></ul>
<p>
the fiche_def.fd_id, id of the cat of the model<ul>
<li>the label gen :<ul>
<li>none return: none</li></ul>
</li></ul>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l01364">1364</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.<div class="fragment"><pre class="fragment"><a name="l01365"></a>01365 {
<a name="l01366"></a>01366 <span class="comment">// Insert a new attribute for the model</span>
<a name="l01367"></a>01367 <span class="comment">// it means insert a row in jnt_fic_attr</span>
<a name="l01368"></a>01368 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf(<span class="stringliteral">"update fiche_def set fd_label='%s' where </span>
<a name="l01369"></a>01369 <span class="stringliteral"> fd_id=%d"</span>,
<a name="l01370"></a>01370 $p_label,$p_fid);
<a name="l01371"></a>01371 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l01372"></a>01372
<a name="l01373"></a>01373 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a7"></a><!-- doxytag: member="fiche_inc.php::UpdateFiche" ref="a7" args="($p_cn, $p_array)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">UpdateFiche </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_array</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Met a jour une fiche change dans le plan comptable, fiche,et isupp.
<p>
UpdateFiche<p>
parm :<ul>
<li>p_cn</li></ul>
<p>
p_array gen :<ul>
<li>none return:</li><li>nothing</li></ul>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l00530">530</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="balance_8php-source.html#l00113">$a</a>, <a class="el" href="pref_8inc_8php-source.html#l00139">$label</a>, <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="postgres_8php-source.html#l00222">CountSql()</a>, <a class="el" href="debug_8php-source.html#l00034">echo_debug()</a>, <a class="el" href="ac__common_8php-source.html#l00036">echo_error()</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, <a class="el" href="ac__common_8php-source.html#l00206">FormatString()</a>, <a class="el" href="fiche__inc_8php-source.html#l01251">GetFicheDefRef()</a>, <a class="el" href="fiche__inc_8php-source.html#l01450">GetParent()</a>, and <a class="el" href="balance_8php-source.html#l00076">label</a>.<div class="fragment"><pre class="fragment"><a name="l00530"></a>00530 {
<a name="l00531"></a>00531
<a name="l00532"></a>00532 <a class="code" href="debug_8php.html#a0">echo_debug</a> ('fiche_inc.php',__LINE__,<span class="stringliteral">"UpdateFiche"</span>);
<a name="l00533"></a>00533 $tva_error=<span class="keyword">false</span>;
<a name="l00534"></a>00534 foreach ( $p_array as $key=&gt; $element) {
<a name="l00535"></a>00535 <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,<span class="stringliteral">"UF $key =&gt; $element"</span>);
<a name="l00536"></a>00536 ${<span class="stringliteral">"$key"</span>}=$element;
<a name="l00537"></a>00537 <span class="comment">// Get the name</span>
<a name="l00538"></a>00538 <span class="keywordflow">if</span> ( $key == <span class="stringliteral">"ad_id"</span>.<a class="code" href="constant_8php.html#a56">ATTR_DEF_NAME</a> ) {
<a name="l00539"></a>00539 <a class="code" href="pref_8inc_8php.html#a6">$label</a>=$element;
<a name="l00540"></a>00540 <span class="keywordflow">if</span> (strlen(trim($<a class="code" href="balance_8php.html#a6">label</a>))== 0 )
<a name="l00541"></a>00541 <span class="keywordflow">return</span>;
<a name="l00542"></a>00542 }
<a name="l00543"></a>00543 <span class="comment">// Get the class base</span>
<a name="l00544"></a>00544 <span class="keywordflow">if</span> ( $key==<span class="stringliteral">"ad_id"</span>.<a class="code" href="constant_8php.html#a55">ATTR_DEF_ACCOUNT</a>) {
<a name="l00545"></a>00545 $class=$element;
<a name="l00546"></a>00546 }
<a name="l00547"></a>00547 <span class="comment">// Get the vat and</span>
<a name="l00548"></a>00548 <span class="comment">// test the vat rate</span>
<a name="l00549"></a>00549 <span class="keywordflow">if</span> ( $key == 'ad_id'.<a class="code" href="constant_8php.html#a59">ATTR_DEF_TVA</a> ) {
<a name="l00550"></a>00550 <span class="comment">// is a valid rate ?</span>
<a name="l00551"></a>00551 <span class="keywordflow">if</span> ( strlen(trim($element)) == 0 ) <span class="keywordflow">continue</span>;
<a name="l00552"></a>00552 <span class="keywordflow">if</span> ( <a class="code" href="postgres_8php.html#a10">CountSql</a>($p_cn,<span class="stringliteral">"select * from tva_rate where tva_id='"</span>.$element.<span class="stringliteral">"'"</span>) == 0 ) {
<a name="l00553"></a>00553 <span class="comment">// warning</span>
<a name="l00554"></a>00554 <a class="code" href="ac__common_8php.html#a0">echo_error</a>('invalid rate') ;
<a name="l00555"></a>00555 echo '&lt;script&gt;
<a name="l00556"></a>00556 alert(<span class="stringliteral">"Attention tva invalid remis à sa valeur par défaut "</span>);
<a name="l00557"></a>00557 &lt;/script&gt;';
<a name="l00558"></a>00558 $tva_error=<span class="keyword">true</span>;
<a name="l00559"></a>00559 }
<a name="l00560"></a>00560 }
<a name="l00561"></a>00561 }
<a name="l00562"></a>00562 <span class="comment">// If each card has it own account must also update the tmp_pcm table</span>
<a name="l00563"></a>00563 <span class="comment">//</span>
<a name="l00564"></a>00564 $fd_ref=<a class="code" href="fiche__inc_8php.html#a22">GetFicheDefRef</a>($p_cn,$<a class="code" href="classfiche.html">fiche</a>);
<a name="l00565"></a>00565 <span class="comment">// Update all the others data</span>
<a name="l00566"></a>00566 <span class="keywordflow">for</span> ( $i =0 ; $i &lt; $max ; $i++) {
<a name="l00567"></a>00567 <span class="comment">// Format text</span>
<a name="l00568"></a>00568 $text=<a class="code" href="ac__common_8php.html#a9">FormatString</a>( ${<span class="stringliteral">"av_text$i"</span>});
<a name="l00569"></a>00569 <span class="comment">// Check if we don't try to update a QUICK CODE</span>
<a name="l00570"></a>00570 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select ad_id from jnt_fic_att_value where jft_id="</span>.${<span class="stringliteral">"jft_id$i"</span>});
<a name="l00571"></a>00571 <a class="code" href="balance_8php.html#a10">$a</a>=pg_fetch_array($Res,0);
<a name="l00572"></a>00572 <span class="keywordflow">if</span> ( $a['ad_id'] != <a class="code" href="constant_8php.html#a78">ATTR_DEF_QUICKCODE</a>)
<a name="l00573"></a>00573 {
<a name="l00574"></a>00574 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf(<span class="stringliteral">"update attr_value set av_text='%s' where jft_id=%d"</span>,
<a name="l00575"></a>00575 $text,
<a name="l00576"></a>00576 ${<span class="stringliteral">"jft_id$i"</span>});
<a name="l00577"></a>00577 }
<a name="l00578"></a>00578 <span class="keywordflow">else</span>
<a name="l00579"></a>00579 {
<a name="l00580"></a>00580 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf(<span class="stringliteral">"select update_quick_code(%d,'%s')"</span>,
<a name="l00581"></a>00581 ${<span class="stringliteral">"jft_id$i"</span>},
<a name="l00582"></a>00582 $text);
<a name="l00583"></a>00583 }
<a name="l00584"></a>00584 <span class="comment">// Execute SQL</span>
<a name="l00585"></a>00585 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l00586"></a>00586 }
<a name="l00587"></a>00587 <span class="comment">// Update tva to his default value</span>
<a name="l00588"></a>00588 <span class="keywordflow">if</span> ( $tva_error == <span class="keyword">true</span> ) {
<a name="l00589"></a>00589 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"update attr_value set av_text=1 where jft_id = ( select jft_id from jnt_fic_att_value </span>
<a name="l00590"></a>00590 <span class="stringliteral"> natural join fiche natural join attr_def </span>
<a name="l00591"></a>00591 <span class="stringliteral"> where ad_id="</span>.ATTR_DEF_TVA.<span class="stringliteral">" and f_id=$fiche)"</span>;
<a name="l00592"></a>00592 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l00593"></a>00593 }
<a name="l00594"></a>00594
<a name="l00595"></a>00595 <span class="comment">// Update the PCMN if needed</span>
<a name="l00596"></a>00596 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"select av_text from attr_value natural join jnt_fic_att_value</span>
<a name="l00597"></a>00597 <span class="stringliteral"> where f_id=$fiche and ad_id="</span>.ATTR_DEF_ACCOUNT;
<a name="l00598"></a>00598 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l00599"></a>00599
<a name="l00600"></a>00600 <span class="keywordflow">if</span> ( pg_NumRows($Res) != 0 ) {
<a name="l00601"></a>00601 <span class="comment">// it means that a account exists</span>
<a name="l00602"></a>00602 <span class="comment">// Retrieve the name and the ad_id 5</span>
<a name="l00603"></a>00603 $f=pg_fetch_array($Res,0);
<a name="l00604"></a>00604 $class_old=$f['av_text'];
<a name="l00605"></a>00605
<a name="l00606"></a>00606 <span class="comment">// if the class changed</span>
<a name="l00607"></a>00607 <span class="keywordflow">if</span> ( $<span class="keyword">class</span> != $class_old and $<span class="keyword">class</span> != <span class="stringliteral">""</span> ) {
<a name="l00608"></a>00608 <span class="keywordflow">if</span> ( <a class="code" href="postgres_8php.html#a10">CountSql</a>($p_cn,<span class="stringliteral">"select * from jrnx where j_poste=$class"</span>) or
<a name="l00609"></a>00609 <a class="code" href="postgres_8php.html#a10">CountSql</a>($p_cn,<span class="stringliteral">"select * from jrnx where j_poste=$class_old"</span> ))
<a name="l00610"></a>00610 {
<a name="l00611"></a>00611 <span class="comment">// No change if the account is already used </span>
<a name="l00612"></a>00612 <a class="code" href="ac__common_8php.html#a0">echo_error</a>(<span class="stringliteral">"Not possible to change the account, already used"</span>);
<a name="l00613"></a>00613 } <span class="keywordflow">else</span> {
<a name="l00614"></a>00614 <span class="keywordflow">if</span> ( <a class="code" href="postgres_8php.html#a10">CountSql</a>($p_cn,<span class="stringliteral">"select * from tmp_pcmn where pcm_val="</span>.$<span class="keyword">class</span>) ==0)
<a name="l00615"></a>00615 <span class="comment">// we have to insert </span>
<a name="l00616"></a>00616 {
<a name="l00617"></a>00617 <span class="comment">// First we must use a parent</span>
<a name="l00618"></a>00618 $parent=<a class="code" href="fiche__inc_8php.html#a28">GetParent</a>($p_cn,$<span class="keyword">class</span>);
<a name="l00619"></a>00619 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,
<a name="l00620"></a>00620 <span class="stringliteral">"insert into tmp_pcmn (pcm_val,pcm_lib,pcm_val_parent) </span>
<a name="l00621"></a>00621 <span class="stringliteral"> values ($class,'$f_label',$parent)"</span>);
<a name="l00622"></a>00622 }
<a name="l00623"></a>00623 }
<a name="l00624"></a>00624 $class=$class_old;
<a name="l00625"></a>00625 } <span class="keywordflow">else</span> <span class="comment">// $class=""</span>
<a name="l00626"></a>00626 {
<a name="l00627"></a>00627
<a name="l00628"></a>00628 <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,<span class="stringliteral">"new account "</span>);
<a name="l00629"></a>00629 $class=$class_old;
<a name="l00630"></a>00630 <span class="keywordflow">if</span> ( <a class="code" href="postgres_8php.html#a10">CountSql</a>($p_cn,<span class="stringliteral">"select * from tmp_pcmn where pcm_val="</span>.$<span class="keyword">class</span>) == 0 ) {
<a name="l00631"></a>00631 <span class="comment">// First we must use a parent</span>
<a name="l00632"></a>00632 $parent=<a class="code" href="fiche__inc_8php.html#a28">GetParent</a>($p_cn,$<span class="keyword">class</span>);
<a name="l00633"></a>00633 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,
<a name="l00634"></a>00634 <span class="stringliteral">"insert into tmp_pcmn (pcm_val,pcm_lib,pcm_val_parent) </span>
<a name="l00635"></a>00635 <span class="stringliteral"> values ($class,'$f_label',$parent)"</span>);
<a name="l00636"></a>00636 }
<a name="l00637"></a>00637 }
<a name="l00638"></a>00638
<a name="l00639"></a>00639
<a name="l00640"></a>00640 <span class="comment">// Change the name in TMP_PCMN</span>
<a name="l00641"></a>00641 <span class="comment">// Get the new name</span>
<a name="l00642"></a>00642 $f_label=<a class="code" href="ac__common_8php.html#a9">FormatString</a>($f_label);
<a name="l00643"></a>00643 <a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"update tmp_pcmn set pcm_lib='"</span>.$f_label.<span class="stringliteral">"' where pcm_val="</span>.$<span class="keyword">class</span>);
<a name="l00644"></a>00644
<a name="l00645"></a>00645
<a name="l00646"></a>00646 }
<a name="l00647"></a>00647 <span class="comment">// Update of TMP_PCMN if a class base is given (ad_id=5)</span>
<a name="l00648"></a>00648
<a name="l00649"></a>00649
<a name="l00650"></a>00650
<a name="l00651"></a>00651 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a11"></a><!-- doxytag: member="fiche_inc.php::UpdateModele" ref="a11" args="($p_cn, $p_fiche)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">UpdateModele </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_fiche</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Modify the model of card change some attribute (fd_label) and permit to add line.
<p>
UpdateModele<p>
parm :<ul>
<li>p_cn connexion</li></ul>
<p>
p_fiche fichedef(f_id) gen :<ul>
<li>none return:</li><li>none</li></ul>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l00869">869</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="recherche_8php-source.html#l00066">$array</a>, <a class="el" href="fiche__inc_8php-source.html#l01390">DisplayDetailModele()</a>, <a class="el" href="debug_8php-source.html#l00034">echo_debug()</a>, <a class="el" href="ac__common_8php-source.html#l00036">echo_error()</a>, and <a class="el" href="fiche__inc_8php-source.html#l00895">GetDataModele()</a>.<div class="fragment"><pre class="fragment"><a name="l00869"></a>00869 {
<a name="l00870"></a>00870
<a name="l00871"></a>00871 <a class="code" href="recherche_8php.html#a4">$array</a>=<a class="code" href="fiche__inc_8php.html#a12">GetDataModele</a>($p_cn,$p_fiche);
<a name="l00872"></a>00872 <span class="keywordflow">if</span> ($array==null) {
<a name="l00873"></a>00873 <a class="code" href="ac__common_8php.html#a0">echo_error</a> (<span class="stringliteral">"fiche_inc:UpdateModele Fiche non trouvée"</span>);
<a name="l00874"></a>00874 <span class="keywordflow">return</span>;
<a name="l00875"></a>00875 }
<a name="l00876"></a>00876 echo '&lt;H2 <span class="keyword">class</span>=<span class="stringliteral">"info"</span>&gt;'.getFicheDefName($p_cn,$p_fiche).'&lt;/H2&gt;';
<a name="l00877"></a>00877 foreach ( $array as $key=&gt;$element) <a class="code" href="debug_8php.html#a0">echo_debug</a>('fiche_inc.php',__LINE__,"$key =&gt; $element");
<a name="l00878"></a>00878 <a class="code" href="fiche__inc_8php.html#a27">DisplayDetailModele</a>($p_cn,<a class="code" href="recherche_8php.html#a4">$array</a>,$array['ligne']);
<a name="l00879"></a>00879
<a name="l00880"></a>00880 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a4"></a><!-- doxytag: member="fiche_inc.php::ViewFiche" ref="a4" args="($p_cn, $p_type)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">ViewFiche </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_type</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Montre les fiches d'une rubrique.
<p>
ViewFiche<p>
parm :<ul>
<li>p_cn connexion</li></ul>
<p>
$p_type fiche_def.fd_id catg of card gen :<ul>
<li>none return:</li><li>none</li></ul>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l00394">394</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="commercial_8php-source.html#l00035">$_SESSION</a>, <a class="el" href="bank_8inc_8php-source.html#l00184">$bar</a>, <a class="el" href="jrn__detail_8php-source.html#l00124">$l_line</a>, <a class="el" href="setup_8php-source.html#l00397">$Max</a>, <a class="el" href="bank_8inc_8php-source.html#l00172">$offset</a>, <a class="el" href="bank_8inc_8php-source.html#l00171">$page</a>, <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="jrn__search_8php-source.html#l00150">$sql_limit</a>, <a class="el" href="jrn__search_8php-source.html#l00151">$sql_offset</a>, <a class="el" href="bank_8inc_8php-source.html#l00170">$step</a>, <a class="el" href="postgres_8php-source.html#l00222">CountSql()</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, <a class="el" href="user__common_8php-source.html#l00858">jrn_navigation_bar()</a>, <a class="el" href="pref_8inc_8php-source.html#l00048">METHOD</a>, <a class="el" href="action_8inc_8php-source.html#l00240">name</a>, <a class="el" href="balance_8php-source.html#l00071">table</a>, and <a class="el" href="action_8inc_8php-source.html#l00241">value</a>.<div class="fragment"><pre class="fragment"><a name="l00394"></a>00394 {
<a name="l00395"></a>00395 require_once(<span class="stringliteral">"user_common.php"</span>);
<a name="l00396"></a>00396 echo '&lt;H2 <span class="keyword">class</span>=<span class="stringliteral">"info"</span>&gt;'.getFicheDefName($p_cn,$p_type).'&lt;/H2&gt;';
<a name="l00397"></a>00397
<a name="l00398"></a>00398 <a class="code" href="bank_8inc_8php.html#a21">$step</a>=<a class="code" href="commercial_8php.html#a0">$_SESSION</a>['g_pagesize'];
<a name="l00399"></a>00399 <a class="code" href="jrn__search_8php.html#a16">$sql_limit</a>=<span class="stringliteral">""</span>;
<a name="l00400"></a>00400 <a class="code" href="jrn__search_8php.html#a17">$sql_offset</a>=<span class="stringliteral">""</span>;
<a name="l00401"></a>00401 <span class="keywordflow">if</span> ( $step != -1 ) {
<a name="l00402"></a>00402 <a class="code" href="bank_8inc_8php.html#a22">$page</a>=(isset($_GET['page']))?$_GET['page']:1;
<a name="l00403"></a>00403 <a class="code" href="bank_8inc_8php.html#a23">$offset</a>=(isset($_GET['offset']))?$_GET['offset']:0;
<a name="l00404"></a>00404 $max_line=<a class="code" href="postgres_8php.html#a10">CountSql</a>($p_cn,<span class="stringliteral">"select f_id,av_text from </span>
<a name="l00405"></a>00405 <span class="stringliteral"> fiche join jnt_fic_att_value using (f_id) </span>
<a name="l00406"></a>00406 <span class="stringliteral"> join attr_value using (jft_id)</span>
<a name="l00407"></a>00407 <span class="stringliteral"> where fd_id='"</span>.$p_type.<span class="stringliteral">"' and ad_id="</span>.<a class="code" href="constant_8php.html#a56">ATTR_DEF_NAME</a>.<span class="stringliteral">" order by f_id"</span>);
<a name="l00408"></a>00408 <a class="code" href="jrn__search_8php.html#a16">$sql_limit</a>=<span class="stringliteral">" limit "</span>.$step;
<a name="l00409"></a>00409 <a class="code" href="jrn__search_8php.html#a17">$sql_offset</a>=<span class="stringliteral">" offset "</span>.$offset;
<a name="l00410"></a>00410 <a class="code" href="bank_8inc_8php.html#a25">$bar</a>=<a class="code" href="user__common_8php.html#a16">jrn_navigation_bar</a>($offset,$max_line,$step,$page);
<a name="l00411"></a>00411 }
<a name="l00412"></a>00412
<a name="l00413"></a>00413 <span class="comment">// Get all name the cards of the select category</span>
<a name="l00414"></a>00414 <span class="comment">// 1 for attr_def.ad_id is always the name</span>
<a name="l00415"></a>00415 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select f_id,av_text,j_qcode from </span>
<a name="l00416"></a>00416 <span class="stringliteral"> fiche join jnt_fic_att_value using (f_id) </span>
<a name="l00417"></a>00417 <span class="stringliteral"> join attr_value using (jft_id)</span>
<a name="l00418"></a>00418 <span class="stringliteral"> left outer join vw_poste_qcode using(f_id)</span>
<a name="l00419"></a>00419 <span class="stringliteral"> where fd_id='"</span>.$p_type.
<a name="l00420"></a>00420 <span class="stringliteral">"' and ad_id="</span>.ATTR_DEF_NAME.<span class="stringliteral">" order by f_id $sql_offset $sql_limit "</span>);
<a name="l00421"></a>00421 <a class="code" href="setup_8php.html#a11">$Max</a>=pg_NumRows($Res);
<a name="l00422"></a>00422 echo <a class="code" href="bank_8inc_8php.html#a25">$bar</a>;
<a name="l00423"></a>00423
<a name="l00424"></a>00424 echo '&lt;<a class="code" href="balance_8php.html#a3">table</a>&gt;';
<a name="l00425"></a>00425 <span class="keywordflow">for</span> ( $i = 0; $i &lt; $Max; $i++) {
<a name="l00426"></a>00426 <a class="code" href="jrn__detail_8php.html#a11">$l_line</a>=pg_fetch_array($Res,$i);
<a name="l00427"></a>00427 <span class="keywordflow">if</span> ( $i%2 == 0)
<a name="l00428"></a>00428 echo '&lt;TR <span class="keyword">class</span>=<span class="stringliteral">"odd"</span>&gt;';
<a name="l00429"></a>00429 <span class="keywordflow">else</span>
<a name="l00430"></a>00430 echo '&lt;TR <span class="keyword">class</span>=<span class="stringliteral">"even"</span>&gt;';
<a name="l00431"></a>00431
<a name="l00432"></a>00432 $span_mod='&lt;TD&gt;&lt;A href=<span class="stringliteral">"fiche.php?action=detail&amp;fiche_id='.$l_line['f_id'].'"</span>&gt;'.$l_line['j_qcode'].'&lt;/A&gt;&lt;/TD&gt;';
<a name="l00433"></a>00433 $span_del='&lt;TD&gt;'.
<a name="l00434"></a>00434 '&lt;A href=<span class="stringliteral">"fiche.php?f_fd_id='.$p_type.'&amp;action=delete&amp;fiche_id='.$l_line['f_id'].</span>
<a name="l00435"></a>00435 <span class="stringliteral"> '"</span>&gt; <span class="keyword">delete</span>&lt;/A&gt;&lt;/td&gt;';
<a name="l00436"></a>00436
<a name="l00437"></a>00437 echo $span_del.$span_mod.'&lt;TD&gt;'.$l_line['av_text'].<span class="stringliteral">"&lt;/TD&gt;"</span>;
<a name="l00438"></a>00438 echo '&lt;/tr&gt;';
<a name="l00439"></a>00439 }
<a name="l00440"></a>00440 echo '&lt;/table&gt;';
<a name="l00441"></a>00441 echo '&lt;<a class="code" href="constant_8php.html#a7">FORM</a> <a class="code" href="pref_8inc_8php.html#a0">METHOD</a>=<span class="stringliteral">"POST"</span> <a class="code" href="classaction.html">action</a>=<span class="stringliteral">"fiche.php"</span>&gt;';
<a name="l00442"></a>00442 echo '&lt;INPUT TYPE=<span class="stringliteral">"HIDDEN"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"fiche"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"'.$p_type.'"</span>&gt;';
<a name="l00443"></a>00443 echo '&lt;INPUT TYPE=<span class="stringliteral">"SUBMIT"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"add"</span> Value=<span class="stringliteral">"Ajout fiche"</span>&gt;';
<a name="l00444"></a>00444 echo '&lt;/<a class="code" href="constant_8php.html#a7">FORM</a>&gt;';
<a name="l00445"></a>00445 echo $bar;
<a name="l00446"></a>00446
<a name="l00447"></a>00447 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a6"></a><!-- doxytag: member="fiche_inc.php::ViewFicheDetail" ref="a6" args="($p_cn, $p_id)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">ViewFicheDetail </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_id</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Montre le detail d'une fiche et ajoute les lignes manquantes dans le cas où le modèle à changer.
<p>
ViewFicheDetail<p>
parm :<ul>
<li>p_cn</li></ul>
<p>
id de la fiche fiche(f_id) gen :<ul>
<li>return:</li><li></li></ul>
<p>
Definition at line <a class="el" href="fiche__inc_8php-source.html#l00492">492</a> of file <a class="el" href="fiche__inc_8php-source.html">fiche_inc.php</a>.
<p>
References <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="fiche__inc_8php-source.html#l00225">EncodeFiche()</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, and <a class="el" href="fiche__inc_8php-source.html#l01282">GetFicheDef()</a>.<div class="fragment"><pre class="fragment"><a name="l00492"></a>00492 {
<a name="l00493"></a>00493
<a name="l00494"></a>00494 <span class="comment">// Retrieve the fiche_def.fd_id of the card</span>
<a name="l00495"></a>00495 $fd_id=<a class="code" href="fiche__inc_8php.html#a23">GetFicheDef</a>($p_cn,$p_id);
<a name="l00496"></a>00496
<a name="l00497"></a>00497 <span class="comment">//Update the default attribute of a card if is model has changed</span>
<a name="l00498"></a>00498 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"insert into jnt_fic_att_value (f_id,ad_id) </span>
<a name="l00499"></a>00499 <span class="stringliteral"> select $p_id, ad_id </span>
<a name="l00500"></a>00500 <span class="stringliteral"> from jnt_fic_attr </span>
<a name="l00501"></a>00501 <span class="stringliteral"> where fd_id=$fd_id and </span>
<a name="l00502"></a>00502 <span class="stringliteral"> ad_id not in (select ad_id from jnt_fic_att_value where</span>
<a name="l00503"></a>00503 <span class="stringliteral"> f_id=$p_id)"</span>;
<a name="l00504"></a>00504
<a name="l00505"></a>00505 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l00506"></a>00506
<a name="l00507"></a>00507 <span class="comment">// add a empty string to attr_value</span>
<a name="l00508"></a>00508 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"insert into attr_value select jft_id,'' from jnt_fic_att_value</span>
<a name="l00509"></a>00509 <span class="stringliteral"> where f_id=$p_id and jft_id not in (select jft_id from attr_value natural join jnt_fic_att_value where </span>
<a name="l00510"></a>00510 <span class="stringliteral"> f_id = $p_id)"</span>;
<a name="l00511"></a>00511 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql);
<a name="l00512"></a>00512
<a name="l00513"></a>00513 <a class="code" href="fiche__inc_8php.html#a1">EncodeFiche</a> ($p_cn,$p_id,1);
<a name="l00514"></a>00514 }
</pre></div>
<p>
</td>
</tr>
</table>
</BODY>
</HTML>