1414 lines
96 KiB
HTML
1414 lines
96 KiB
HTML
<!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: Document Class 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 Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||
<h1>Document Class Reference</h1><!-- doxytag: class="Document" -->Class Document corresponds to the table document.
|
||
<a href="#_details">More...</a>
|
||
<p>
|
||
<table border="0" cellpadding="0" cellspacing="0">
|
||
<tr><td></td></tr>
|
||
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#a0">Document</a> ($p_cn, $p_d_id=0)</td></tr>
|
||
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#a1">blank</a> ()</td></tr>
|
||
|
||
<tr><td class="mdescLeft"> </td><td class="mdescRight">insert a minimal document and set the d_id <a href="#a1"></a><br></td></tr>
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#a2">save</a> ()</td></tr>
|
||
|
||
<tr><td class="mdescLeft"> </td><td class="mdescRight">Save save the state of the document. <a href="#a2"></a><br></td></tr>
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#a3">Generate</a> ()</td></tr>
|
||
|
||
<tr><td class="mdescLeft"> </td><td class="mdescRight">Generate the document, Call $this->Replace to replace tag by value. <a href="#a3"></a><br></td></tr>
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#a4">ParseDocument</a> ($p_dir, $p_file, $p_type)</td></tr>
|
||
|
||
<tr><td class="mdescLeft"> </td><td class="mdescRight">This function parse a document and replace all the predefined tags by a value. This functions generate diffent documents (invoice, order, letter) with the info from the database. <a href="#a4"></a><br></td></tr>
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#a5">SaveGenerated</a> ($p_file)</td></tr>
|
||
|
||
<tr><td class="mdescLeft"> </td><td class="mdescRight">Save the generated Document. <a href="#a5"></a><br></td></tr>
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#a6">Upload</a> ()</td></tr>
|
||
|
||
<tr><td class="mdescLeft"> </td><td class="mdescRight">Upload a file into document all the needed data are in $_FILES we don't increment the seq. <a href="#a6"></a><br></td></tr>
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#a7">a_ref</a> ()</td></tr>
|
||
|
||
<tr><td class="mdescLeft"> </td><td class="mdescRight">create and compute a string for reference the doc <A ...> <a href="#a7"></a><br></td></tr>
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#a8">Send</a> ()</td></tr>
|
||
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#a9">get</a> ()</td></tr>
|
||
|
||
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get complete all the data member thx info from the database. <a href="#a9"></a><br></td></tr>
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#a10">Replace</a> ($p_tag)</td></tr>
|
||
|
||
<tr><td class="mdescLeft"> </td><td class="mdescRight">replace the TAG by the real value, this value can be into the database or in $_POST The possible tags are<ul>
|
||
<li>[CUST_NAME] customer's name</li><li>[CUST_ADDR_1] customer's address line 1</li><li>[CUST_CP] customer's ZIP code</li><li>[CUST_CO] customer's country</li><li>[CUST_VAT] customer's VAT</li><li>[MARCH_NEXT] end this item and increment the counter $i</li><li>[VEN_ART_NAME]</li><li>[VEN_ART_PRICE]</li><li>[VEN_ART_QUANT]</li><li>[VEN_ART_TVA_CODE]</li><li>[VEN_ART_TVA_AMOUNT]</li><li>[VEN_ART_STOCK_CODE]</li><li>[VEN_HTVA]</li><li>[VEN_TVAC]</li><li>[VEN_TVA]</li><li>[TOTAL_VEN_HTVA]</li><li>[DATE]</li><li>[NUMBER_ID]</li><li>[MY_NAME]</li><li>[MY_CP]</li><li>[MY_COMMUNE]</li><li>[MY_TVA]</li><li>[MY_STREET]</li><li>[MY_NUMBER] </li></ul>
|
||
<a href="#a10"></a><br></td></tr>
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#a11">remove</a> ()</td></tr>
|
||
|
||
<tr><td class="mdescLeft"> </td><td class="mdescRight">remove a row from the table document, the lob object is not deleted because can be linked elsewhere <a href="#a11"></a><br></td></tr>
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#a12">MoveDocumentPj</a> ($p_internal)</td></tr>
|
||
|
||
<tr><td class="mdescLeft"> </td><td class="mdescRight">Move a document from the table document into the concerned row the document is not copied : it is only a link. <a href="#a12"></a><br></td></tr>
|
||
<tr><td colspan="2"><br><h2>Data Fields</h2></td></tr>
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#o0">$db</a></td></tr>
|
||
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#o1">$ag_id</a></td></tr>
|
||
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#o2">$d_mimetype</a></td></tr>
|
||
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#o3">$d_filename</a></td></tr>
|
||
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#o4">$d_lob</a></td></tr>
|
||
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#o5">$d_number</a></td></tr>
|
||
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#o6">$md_id</a></td></tr>
|
||
|
||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDocument.html#o7">$d_state</a></td></tr>
|
||
|
||
</table>
|
||
<hr><a name="_details"></a><h2>Detailed Description</h2>
|
||
Class Document corresponds to the table document.
|
||
<p>
|
||
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00028">28</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>.<hr><h2>Constructor & Destructor Documentation</h2>
|
||
<a class="anchor" name="a0"></a><!-- doxytag: member="Document::Document" ref="a0" args="($p_cn, $p_d_id=0)" --><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">Document::Document </td>
|
||
<td class="md" valign="top">( </td>
|
||
<td class="md" nowrap valign="top">$ </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>$ </td>
|
||
<td class="mdname" nowrap> <em>p_d_id</em> = <code>0</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="md"></td>
|
||
<td class="md">) </td>
|
||
<td class="md" colspan="2"></td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00042">42</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>.
|
||
<p>
|
||
References <a class="el" href="action_8inc_8php-source.html#l00167">d_id</a>.
|
||
<p>
|
||
Referenced by <a class="el" href="class__document_8php-source.html#l00256">SaveGenerated()</a>.<div class="fragment"><pre class="fragment"><a name="l00043"></a>00043 {
|
||
<a name="l00044"></a>00044 $this->db=$p_cn;
|
||
<a name="l00045"></a>00045 $this-><a class="code" href="action_8inc_8php.html#a12">d_id</a>=$p_d_id;
|
||
<a name="l00046"></a>00046 }
|
||
</pre></div>
|
||
<p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<hr><h2>Member Function Documentation</h2>
|
||
<a class="anchor" name="a7"></a><!-- doxytag: member="Document::a_ref" ref="a7" args="()" --><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">Document::a_ref </td>
|
||
<td class="md" valign="top">( </td>
|
||
<td class="mdname1" valign="top" nowrap> </td>
|
||
<td class="md" valign="top"> ) </td>
|
||
<td class="md" nowrap></td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
create and compute a string for reference the doc <A ...>
|
||
<p>
|
||
a_ref<p>
|
||
<dl compact><dt><b>Returns:</b></dt><dd>a string</dd></dl>
|
||
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00344">344</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>.
|
||
<p>
|
||
References <a class="el" href="bank_8inc_8php-source.html#l00237">$r</a>.<div class="fragment"><pre class="fragment"><a name="l00345"></a>00345 {
|
||
<a name="l00346"></a>00346 <span class="keywordflow">if</span> ( $this->d_id == 0 )
|
||
<a name="l00347"></a>00347 <span class="keywordflow">return</span> '';
|
||
<a name="l00348"></a>00348 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<span class="stringliteral">""</span>;
|
||
<a name="l00349"></a>00349 <a class="code" href="bank_8inc_8php.html#a29">$r</a>='<A <span class="keyword">class</span>=<span class="stringliteral">"mtitle"</span> HREF=<span class="stringliteral">"show_document.php?d_id='.$this->d_id.'"</span>><a class="code" href="classDocument.html">Document</a></A>';
|
||
<a name="l00350"></a>00350 <span class="keywordflow">return</span> <a class="code" href="bank_8inc_8php.html#a29">$r</a>;
|
||
<a name="l00351"></a>00351 }
|
||
</pre></div>
|
||
<p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<a class="anchor" name="a1"></a><!-- doxytag: member="Document::blank" ref="a1" args="()" --><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">Document::blank </td>
|
||
<td class="md" valign="top">( </td>
|
||
<td class="mdname1" valign="top" nowrap> </td>
|
||
<td class="md" valign="top"> ) </td>
|
||
<td class="md" nowrap></td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
insert a minimal document and set the d_id
|
||
<p>
|
||
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00049">49</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>.
|
||
<p>
|
||
References <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="action_8inc_8php-source.html#l00159">ag_id</a>, <a class="el" href="action_8inc_8php-source.html#l00167">d_id</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, and <a class="el" href="postgres_8php-source.html#l00251">NextSequence()</a>.<div class="fragment"><pre class="fragment"><a name="l00050"></a>00050 {
|
||
<a name="l00051"></a>00051 $this-><a class="code" href="action_8inc_8php.html#a12">d_id</a>=<a class="code" href="postgres_8php.html#a13">NextSequence</a>($this->db,<span class="stringliteral">"document_d_id_seq"</span>);
|
||
<a name="l00052"></a>00052 <span class="comment">// affect a number</span>
|
||
<a name="l00053"></a>00053 $this->d_number=<a class="code" href="postgres_8php.html#a13">NextSequence</a>($this->db,<span class="stringliteral">"seq_doc_type_"</span>.$this->md_type);
|
||
<a name="l00054"></a>00054 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf('insert into document(<a class="code" href="action_8inc_8php.html#a12">d_id</a>,<a class="code" href="action_8inc_8php.html#a4">ag_id</a>,d_number) values(%d,%d,%d)',
|
||
<a name="l00055"></a>00055 $this->d_id,
|
||
<a name="l00056"></a>00056 $this->ag_id,
|
||
<a name="l00057"></a>00057 $this->d_number);
|
||
<a name="l00058"></a>00058 <a class="code" href="postgres_8php.html#a2">ExecSql</a>($this->db,$sql);
|
||
<a name="l00059"></a>00059
|
||
<a name="l00060"></a>00060 }
|
||
</pre></div>
|
||
<p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<a class="anchor" name="a3"></a><!-- doxytag: member="Document::Generate" ref="a3" args="()" --><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">Document::Generate </td>
|
||
<td class="md" valign="top">( </td>
|
||
<td class="mdname1" valign="top" nowrap> </td>
|
||
<td class="md" valign="top"> ) </td>
|
||
<td class="md" nowrap></td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
Generate the document, Call $this->Replace to replace tag by value.
|
||
<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>none</em> </td><td></td></tr>
|
||
</table>
|
||
</dl>
|
||
<dl compact><dt><b>Returns:</b></dt><dd>an array : the url where the generated doc can be found, the name of the file and his mimetype</dd></dl>
|
||
<dl compact><dt><b><a class="el" href="todo.html#_todo000006">Todo:</a></b></dt><dd>Carefull : the slash is not windows compliant </dd></dl>
|
||
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00079">79</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>.
|
||
<p>
|
||
References <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="argenta__be_8inc_8php-source.html#l00028">$row</a>, <a class="el" href="postgres_8php-source.html#l00263">Commit()</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="document__modele_8inc_8php-source.html#l00044">md_type</a>, <a class="el" href="postgres_8php-source.html#l00251">NextSequence()</a>, <a class="el" href="class__document_8php-source.html#l00163">ParseDocument()</a>, <a class="el" href="class__document_8php-source.html#l00256">SaveGenerated()</a>, and <a class="el" href="postgres_8php-source.html#l00257">StartSql()</a>.<div class="fragment"><pre class="fragment"><a name="l00080"></a>00080 {
|
||
<a name="l00081"></a>00081 <span class="comment">// create a temp directory in /tmp to unpack file and to parse it</span>
|
||
<a name="l00082"></a>00082 $dirname=tempnam('/tmp<span class="charliteral">','</span>doc_');
|
||
<a name="l00083"></a>00083
|
||
<a name="l00084"></a>00084
|
||
<a name="l00085"></a>00085 unlink($dirname);
|
||
<a name="l00086"></a>00086 mkdir ($dirname);
|
||
<a name="l00087"></a>00087 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,<span class="stringliteral">"Dirname is $dirname"</span>);
|
||
<a name="l00088"></a>00088 <span class="comment">// Retrieve the lob and save it into $dirname</span>
|
||
<a name="l00089"></a>00089 <a class="code" href="postgres_8php.html#a14">StartSql</a>($this->db);
|
||
<a name="l00090"></a>00090 $dm_info=<span class="stringliteral">"select md_type,md_lob,md_filename,md_mimetype </span>
|
||
<a name="l00091"></a>00091 <span class="stringliteral"> from document_modele where md_id="</span>.$this->md_id;
|
||
<a name="l00092"></a>00092 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this->db,$dm_info);
|
||
<a name="l00093"></a>00093
|
||
<a name="l00094"></a>00094 <a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>=pg_fetch_array($Res,0);
|
||
<a name="l00095"></a>00095 $this->d_lob=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>['md_lob'];
|
||
<a name="l00096"></a>00096 $this->d_filename=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>['md_filename'];
|
||
<a name="l00097"></a>00097 $this->d_mimetype=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>['md_mimetype'];
|
||
<a name="l00098"></a>00098
|
||
<a name="l00099"></a>00099 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__,<span class="stringliteral">"OID is "</span>.$row['md_lob']);
|
||
<a name="l00101"></a>00101 chdir($dirname);
|
||
<a name="l00102"></a>00102 $filename=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>['md_filename'];
|
||
<a name="l00103"></a>00103 pg_lo_export($this->db,$row['md_lob'],$filename);
|
||
<a name="l00104"></a>00104 $type=<span class="stringliteral">"n"</span>;
|
||
<a name="l00105"></a>00105 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__,'The document type is '.$row['md_mimetype']);
|
||
<a name="l00106"></a>00106 <span class="comment">// if the doc is a OOo, we need to unzip it first</span>
|
||
<a name="l00107"></a>00107 <span class="comment">// and the name of the file to change is always content.xml</span>
|
||
<a name="l00108"></a>00108 <span class="keywordflow">if</span> ( strpos($row['md_mimetype'],'vnd.oasis') != 0 )
|
||
<a name="l00109"></a>00109 {
|
||
<a name="l00110"></a>00110 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__,'Unzip the OOo');
|
||
<a name="l00111"></a>00111 echo '<span <span class="keywordtype">id</span>=<span class="stringliteral">"gen_msg"</span>>';
|
||
<a name="l00112"></a>00112 echo '<blink><font color=<span class="stringliteral">"red"</span>>Un moment de patience, le document se pr<70>pare...</font></blink>';
|
||
<a name="l00113"></a>00113 echo '</span>';
|
||
<a name="l00114"></a>00114 ob_start();
|
||
<a name="l00115"></a>00115 system(<span class="stringliteral">"unzip "</span>.$filename);
|
||
<a name="l00116"></a>00116 <span class="comment">// Remove the file we do not need anymore</span>
|
||
<a name="l00117"></a>00117 unlink($filename);
|
||
<a name="l00118"></a>00118 ob_end_clean();
|
||
<a name="l00119"></a>00119 $file_to_parse=<span class="stringliteral">"content.xml"</span>;
|
||
<a name="l00120"></a>00120 $type=<span class="stringliteral">"OOo"</span>;
|
||
<a name="l00121"></a>00121 }
|
||
<a name="l00122"></a>00122 <span class="keywordflow">else</span>
|
||
<a name="l00123"></a>00123 $file_to_parse=$filename;
|
||
<a name="l00124"></a>00124 <span class="comment">// affect a number</span>
|
||
<a name="l00125"></a>00125 $this->d_number=<a class="code" href="postgres_8php.html#a13">NextSequence</a>($this->db,<span class="stringliteral">"seq_doc_type_"</span>.$row['<a class="code" href="document__modele_8inc_8php.html#a4">md_type</a>']);
|
||
<a name="l00126"></a>00126
|
||
<a name="l00127"></a>00127
|
||
<a name="l00128"></a>00128 <span class="comment">// parse the document - return the doc number ?</span>
|
||
<a name="l00129"></a>00129 $this-><a class="code" href="classDocument.html#a4">ParseDocument</a>($dirname,$file_to_parse,$type);
|
||
<a name="l00130"></a>00130
|
||
<a name="l00131"></a>00131 <a class="code" href="postgres_8php.html#a16">Commit</a>($this->db);
|
||
<a name="l00132"></a>00132 <span class="comment">// if the doc is a OOo, we need to re-zip it </span>
|
||
<a name="l00133"></a>00133 <span class="keywordflow">if</span> ( strpos($row['md_mimetype'],'vnd.oasis') != 0 )
|
||
<a name="l00134"></a>00134 {
|
||
<a name="l00135"></a>00135 ob_start();
|
||
<a name="l00136"></a>00136 system (<span class="stringliteral">"zip -r "</span>.$filename.<span class="stringliteral">" *"</span>);
|
||
<a name="l00137"></a>00137 ob_end_clean();
|
||
<a name="l00138"></a>00138 echo <span class="stringliteral">"le document est pr<70>t "</span>;
|
||
<a name="l00139"></a>00139
|
||
<a name="l00140"></a>00140 $file_to_parse=$filename;
|
||
<a name="l00141"></a>00141 }
|
||
<a name="l00142"></a>00142 <span class="comment">// Create a directory </span>
|
||
<a name="l00143"></a>00143 mkdir ($_SERVER['DOCUMENT_ROOT'].$dirname);
|
||
<a name="l00144"></a>00144
|
||
<a name="l00145"></a>00145 <span class="comment">// we need to rename the new generated file</span>
|
||
<a name="l00146"></a>00146 rename($dirname.<span class="stringliteral">"/"</span>.$file_to_parse,$_SERVER['DOCUMENT_ROOT'].$dirname.<span class="charliteral">'/'</span>.$file_to_parse);
|
||
<a name="l00147"></a>00147 <a class="code" href="impress__bilan_8php.html#a0">$ret</a>=sprintf('<A HREF=<span class="stringliteral">"%s"</span>><a class="code" href="classDocument.html">Document</a> g<>n<EFBFBD>r<EFBFBD></A>',
|
||
<a name="l00148"></a>00148 $dirname.<span class="charliteral">'/'</span>.$file_to_parse);
|
||
<a name="l00149"></a>00149 $this-><a class="code" href="classDocument.html#a5">SaveGenerated</a>($_SERVER['DOCUMENT_ROOT'].$dirname.<span class="stringliteral">"/"</span>.$file_to_parse);
|
||
<a name="l00150"></a>00150 <span class="keywordflow">return</span> <a class="code" href="impress__bilan_8php.html#a0">$ret</a>;
|
||
<a name="l00151"></a>00151 }
|
||
</pre></div>
|
||
<p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<a class="anchor" name="a9"></a><!-- doxytag: member="Document::get" ref="a9" args="()" --><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">Document::get </td>
|
||
<td class="md" valign="top">( </td>
|
||
<td class="mdname1" valign="top" nowrap> </td>
|
||
<td class="md" valign="top"> ) </td>
|
||
<td class="md" nowrap></td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
Get complete all the data member thx info from the database.
|
||
<p>
|
||
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00393">393</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>.
|
||
<p>
|
||
References <a class="el" href="impress__bilan_8php-source.html#l00032">$ret</a>, <a class="el" href="argenta__be_8inc_8php-source.html#l00028">$row</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="action_8inc_8php-source.html#l00159">ag_id</a>, and <a class="el" href="action_8inc_8php-source.html#l00162">d_state</a>.<div class="fragment"><pre class="fragment"><a name="l00394"></a>00394 {
|
||
<a name="l00395"></a>00395 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"select * from document where d_id="</span>.$this->d_id;
|
||
<a name="l00396"></a>00396 <a class="code" href="impress__bilan_8php.html#a0">$ret</a>=Exec($this->db,$sql);
|
||
<a name="l00397"></a>00397 <span class="keywordflow">if</span> ( pg_num_rows($ret) == 0 )
|
||
<a name="l00398"></a>00398 <span class="keywordflow">return</span>;
|
||
<a name="l00399"></a>00399 <a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>=pg_fetch_array($ret,0);
|
||
<a name="l00400"></a>00400 $this-><a class="code" href="action_8inc_8php.html#a4">ag_id</a>=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>['<a class="code" href="action_8inc_8php.html#a4">ag_id</a>'];
|
||
<a name="l00401"></a>00401 $this->d_mimetype=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>['d_mimetype'];
|
||
<a name="l00402"></a>00402 $this->d_filename=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>['d_filename'];
|
||
<a name="l00403"></a>00403 $this->d_lob=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>['d_lob'];
|
||
<a name="l00404"></a>00404 $this->d_number=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>[''];
|
||
<a name="l00405"></a>00405 $this-><a class="code" href="action_8inc_8php.html#a7">d_state</a>=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>['<a class="code" href="action_8inc_8php.html#a4">ag_id</a>'];
|
||
<a name="l00406"></a>00406 $this->d_number=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>['d_number'];
|
||
<a name="l00407"></a>00407
|
||
<a name="l00408"></a>00408 }
|
||
</pre></div>
|
||
<p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<a class="anchor" name="a12"></a><!-- doxytag: member="Document::MoveDocumentPj" ref="a12" args="($p_internal)" --><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">Document::MoveDocumentPj </td>
|
||
<td class="md" valign="top">( </td>
|
||
<td class="md" nowrap valign="top">$ </td>
|
||
<td class="mdname1" valign="top" nowrap> <em>p_internal</em> </td>
|
||
<td class="md" valign="top"> ) </td>
|
||
<td class="md" nowrap></td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
Move a document from the table document into the concerned row the document is not copied : it is only a link.
|
||
<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_internal</em> </td><td>internal code</td></tr>
|
||
</table>
|
||
</dl>
|
||
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00751">751</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>.
|
||
<p>
|
||
References <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="l00752"></a>00752 {
|
||
<a name="l00753"></a>00753
|
||
<a name="l00754"></a>00754 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf(<span class="stringliteral">"update jrn set jr_pj=%s,jr_pj_name='%s',jr_pj_type='%s' where jr_internal='%s'"</span>,
|
||
<a name="l00755"></a>00755 $this->d_lob,$this->d_filename,$this->d_mimetype,$p_internal);
|
||
<a name="l00756"></a>00756 <a class="code" href="postgres_8php.html#a2">ExecSql</a>($this->db,$sql);
|
||
<a name="l00757"></a>00757 <span class="comment">// clean the table document</span>
|
||
<a name="l00758"></a>00758 $this-><a class="code" href="classDocument.html#a11">remove</a>();
|
||
<a name="l00759"></a>00759 }
|
||
</pre></div>
|
||
<p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<a class="anchor" name="a4"></a><!-- doxytag: member="Document::ParseDocument" ref="a4" args="($p_dir, $p_file, $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">Document::ParseDocument </td>
|
||
<td class="md" valign="top">( </td>
|
||
<td class="md" nowrap valign="top">$ </td>
|
||
<td class="mdname" nowrap> <em>p_dir</em>, </td>
|
||
</tr>
|
||
<tr>
|
||
<td class="md" nowrap align="right"></td>
|
||
<td class="md"></td>
|
||
<td class="md" nowrap>$ </td>
|
||
<td class="mdname" nowrap> <em>p_file</em>, </td>
|
||
</tr>
|
||
<tr>
|
||
<td class="md" nowrap align="right"></td>
|
||
<td class="md"></td>
|
||
<td class="md" nowrap>$ </td>
|
||
<td class="mdname" nowrap> <em>p_type</em></td>
|
||
</tr>
|
||
<tr>
|
||
<td class="md"></td>
|
||
<td class="md">) </td>
|
||
<td class="md" colspan="2"></td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
This function parse a document and replace all the predefined tags by a value. This functions generate diffent documents (invoice, order, letter) with the info from the database.
|
||
<p>
|
||
ParseDocument<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_dir</em> </td><td>directory name </td></tr>
|
||
<tr><td valign="top"></td><td valign="top"><em>$p_file</em> </td><td>filename </td></tr>
|
||
<tr><td valign="top"></td><td valign="top"><em>$p_type</em> </td><td>For the OOo document the tag are &lt and &gt instead of < and ></td></tr>
|
||
</table>
|
||
</dl>
|
||
<dl compact><dt><b>Note:</b></dt><dd>Replace in the doc the tags by their values.<ul>
|
||
<li>MY_* table parameter</li><li>ART_VEN* table quant_sold for invoice</li><li>CUST_* table quant_sold and fiche for invoice</li><li>e_* for the invoice in the $_POST</li></ul>
|
||
</dd></dl>
|
||
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00163">163</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>.
|
||
<p>
|
||
References <a class="el" href="poste_8inc_8php-source.html#l00069">$h</a>, <a class="el" href="debug_8php-source.html#l00034">echo_debug()</a>, <a class="el" href="balance_8php-source.html#l00036">exit</a>, <a class="el" href="class__document_8php-source.html#l00441">Replace()</a>, and <a class="el" href="action_8inc_8php-source.html#l00241">value</a>.
|
||
<p>
|
||
Referenced by <a class="el" href="class__document_8php-source.html#l00079">Generate()</a>.<div class="fragment"><pre class="fragment"><a name="l00164"></a>00164 {
|
||
<a name="l00165"></a>00165
|
||
<a name="l00166"></a>00166 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__,'Begin parsing of '.$p_dir.<span class="charliteral">' '</span>.$p_file.'Type = '.$p_type);
|
||
<a name="l00167"></a>00167
|
||
<a name="l00174"></a>00174 <span class="comment">// open the document</span>
|
||
<a name="l00175"></a>00175 $infile_name=$p_dir.<span class="stringliteral">"/"</span>.$p_file;
|
||
<a name="l00176"></a>00176 <a class="code" href="debug_8php.html#a0">echo_debug</a>(<span class="stringliteral">"class_document.php"</span>,__LINE__,<span class="stringliteral">"Open the document $p_dir/$p_file"</span>);
|
||
<a name="l00177"></a>00177 <a class="code" href="poste_8inc_8php.html#a8">$h</a>=fopen($infile_name,<span class="stringliteral">"r"</span>);
|
||
<a name="l00178"></a>00178 $output_name=tempnam($_SERVER[<span class="stringliteral">"DOCUMENT_ROOT"</span>].<span class="stringliteral">"/tmp"</span>,<span class="stringliteral">"gen_doc_"</span>);
|
||
<a name="l00179"></a>00179 $output_file=fopen($output_name,<span class="stringliteral">"w+"</span>);
|
||
<a name="l00180"></a>00180 <span class="comment">// check if the opening is sucessfull</span>
|
||
<a name="l00181"></a>00181 <span class="keywordflow">if</span> ( $h == <span class="keyword">false</span> )
|
||
<a name="l00182"></a>00182 {
|
||
<a name="l00183"></a>00183 echo <span class="stringliteral">"cannot open $p_dir $p_file "</span>;
|
||
<a name="l00184"></a>00184 <a class="code" href="balance_8php.html#a0">exit</a>();
|
||
<a name="l00185"></a>00185 }
|
||
<a name="l00186"></a>00186 <span class="keywordflow">if</span> ( $output_file == <span class="keyword">false</span>)
|
||
<a name="l00187"></a>00187 {
|
||
<a name="l00188"></a>00188 echo <span class="stringliteral">"ne peut pas ouvrir le fichier de sortie"</span>;
|
||
<a name="l00189"></a>00189 <a class="code" href="balance_8php.html#a0">exit</a>();
|
||
<a name="l00190"></a>00190 }
|
||
<a name="l00191"></a>00191 <span class="comment">// compute the regex</span>
|
||
<a name="l00192"></a>00192 <span class="keywordflow">if</span> ( $p_type=='OOo')
|
||
<a name="l00193"></a>00193 {
|
||
<a name="l00194"></a>00194 $regex=<span class="stringliteral">"&lt;&lt;[A-Z]+_*[A-Z]*_*[A-Z]*_*[0-9]*&gt;&gt;"</span>;
|
||
<a name="l00195"></a>00195 $lt=<span class="stringliteral">"&lt;"</span>;
|
||
<a name="l00196"></a>00196 $gt=<span class="stringliteral">"&gt;"</span>;
|
||
<a name="l00197"></a>00197 }
|
||
<a name="l00198"></a>00198 <span class="keywordflow">else</span>
|
||
<a name="l00199"></a>00199 {
|
||
<a name="l00200"></a>00200 $regex=<span class="stringliteral">"<<[A-Z]+_*[A-Z]*_*[A-Z]*_*[0-9]*>>"</span>;
|
||
<a name="l00201"></a>00201 $lt=<span class="stringliteral">"<"</span>;
|
||
<a name="l00202"></a>00202 $gt=<span class="stringliteral">">"</span>;
|
||
<a name="l00203"></a>00203 }
|
||
<a name="l00204"></a>00204 <span class="comment">//read the file</span>
|
||
<a name="l00205"></a>00205 <span class="keywordflow">while</span>(! feof($h))
|
||
<a name="l00206"></a>00206 {
|
||
<a name="l00207"></a>00207 <span class="comment">// replace the tag</span>
|
||
<a name="l00208"></a>00208 $buffer=fgets($h);
|
||
<a name="l00209"></a>00209 <span class="comment">// search in the buffer the magic << and >></span>
|
||
<a name="l00210"></a>00210 <span class="comment">// while ereg finds something to replace</span>
|
||
<a name="l00211"></a>00211 <span class="keywordflow">while</span> ( ereg ($regex,$buffer,$f) )
|
||
<a name="l00212"></a>00212 {
|
||
<a name="l00213"></a>00213
|
||
<a name="l00214"></a>00214 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__,'var_export '.var_export( $f,<span class="keyword">true</span>));
|
||
<a name="l00215"></a>00215 foreach ( $f as $pattern )
|
||
<a name="l00216"></a>00216 {
|
||
<a name="l00217"></a>00217 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__, <span class="stringliteral">"pattern"</span>);
|
||
<a name="l00218"></a>00218 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__, var_export($pattern,<span class="keyword">true</span>));
|
||
<a name="l00219"></a>00219 $to_remove=$pattern;
|
||
<a name="l00220"></a>00220 <span class="comment">// we remove the < and > from the pattern</span>
|
||
<a name="l00221"></a>00221 $pattern=str_replace($lt,'',$pattern);
|
||
<a name="l00222"></a>00222 $pattern=str_replace($gt,'',$pattern);
|
||
<a name="l00223"></a>00223
|
||
<a name="l00224"></a>00224
|
||
<a name="l00225"></a>00225 <span class="comment">// if the pattern if found we replace it</span>
|
||
<a name="l00226"></a>00226 $value=$this-><a class="code" href="classDocument.html#a10">Replace</a>($pattern);
|
||
<a name="l00227"></a>00227 <span class="comment">// replace into the $buffer</span>
|
||
<a name="l00228"></a>00228 <span class="comment">// take the position in the buffer </span>
|
||
<a name="l00229"></a>00229 $pos=strpos($buffer,$to_remove);
|
||
<a name="l00230"></a>00230 <span class="comment">// get the length of the string to remove</span>
|
||
<a name="l00231"></a>00231 $len=strlen($to_remove);
|
||
<a name="l00232"></a>00232 $buffer=substr_replace($buffer,$<a class="code" href="action_8inc_8php.html#a19">value</a>,$pos,$len);
|
||
<a name="l00233"></a>00233
|
||
<a name="l00234"></a>00234 <span class="comment">// echo_debug('class_document',__LINE__, $buffer);</span>
|
||
<a name="l00235"></a>00235 <span class="comment">// if the pattern if found we replace it</span>
|
||
<a name="l00236"></a>00236 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__,<span class="stringliteral">"Transform $pattern by $value"</span>);
|
||
<a name="l00237"></a>00237 }
|
||
<a name="l00238"></a>00238 }
|
||
<a name="l00239"></a>00239 <span class="comment">// write into the output_file</span>
|
||
<a name="l00240"></a>00240 fwrite($output_file,$buffer);
|
||
<a name="l00241"></a>00241
|
||
<a name="l00242"></a>00242 }
|
||
<a name="l00243"></a>00243 fclose($h);
|
||
<a name="l00244"></a>00244 fclose($output_file);
|
||
<a name="l00245"></a>00245 rename ($output_name,$infile_name);
|
||
<a name="l00246"></a>00246 <span class="comment">// Save the document into the database</span>
|
||
<a name="l00247"></a>00247
|
||
<a name="l00248"></a>00248 }
|
||
</pre></div>
|
||
<p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<a class="anchor" name="a11"></a><!-- doxytag: member="Document::remove" ref="a11" args="()" --><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">Document::remove </td>
|
||
<td class="md" valign="top">( </td>
|
||
<td class="mdname1" valign="top" nowrap> </td>
|
||
<td class="md" valign="top"> ) </td>
|
||
<td class="md" nowrap></td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
remove a row from the table document, the lob object is not deleted because can be linked elsewhere
|
||
<p>
|
||
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00740">740</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>.
|
||
<p>
|
||
References <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="action_8inc_8php-source.html#l00167">d_id</a>, and <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>.<div class="fragment"><pre class="fragment"><a name="l00741"></a>00741 {
|
||
<a name="l00742"></a>00742 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>='<span class="keyword">delete</span> from document where <a class="code" href="action_8inc_8php.html#a12">d_id</a>='.$this->d_id;
|
||
<a name="l00743"></a>00743 <a class="code" href="postgres_8php.html#a2">ExecSql</a>($this->db,$sql);
|
||
<a name="l00744"></a>00744 }
|
||
</pre></div>
|
||
<p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<a class="anchor" name="a10"></a><!-- doxytag: member="Document::Replace" ref="a10" args="($p_tag)" --><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">Document::Replace </td>
|
||
<td class="md" valign="top">( </td>
|
||
<td class="md" nowrap valign="top">$ </td>
|
||
<td class="mdname1" valign="top" nowrap> <em>p_tag</em> </td>
|
||
<td class="md" valign="top"> ) </td>
|
||
<td class="md" nowrap></td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
replace the TAG by the real value, this value can be into the database or in $_POST The possible tags are<ul>
|
||
<li>[CUST_NAME] customer's name</li><li>[CUST_ADDR_1] customer's address line 1</li><li>[CUST_CP] customer's ZIP code</li><li>[CUST_CO] customer's country</li><li>[CUST_VAT] customer's VAT</li><li>[MARCH_NEXT] end this item and increment the counter $i</li><li>[VEN_ART_NAME]</li><li>[VEN_ART_PRICE]</li><li>[VEN_ART_QUANT]</li><li>[VEN_ART_TVA_CODE]</li><li>[VEN_ART_TVA_AMOUNT]</li><li>[VEN_ART_STOCK_CODE]</li><li>[VEN_HTVA]</li><li>[VEN_TVAC]</li><li>[VEN_TVA]</li><li>[TOTAL_VEN_HTVA]</li><li>[DATE]</li><li>[NUMBER_ID]</li><li>[MY_NAME]</li><li>[MY_CP]</li><li>[MY_COMMUNE]</li><li>[MY_TVA]</li><li>[MY_STREET]</li><li>[MY_NUMBER] </li></ul>
|
||
|
||
<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>TAG</em> </td><td></td></tr>
|
||
</table>
|
||
</dl>
|
||
<dl compact><dt><b>Returns:</b></dt><dd>String which must replace the tag</dd></dl>
|
||
<dl compact><dt><b><a class="el" href="todo.html#_todo000007">Todo:</a></b></dt><dd>verify that price and quant are numeric </dd></dl>
|
||
<dl compact><dt><b><a class="el" href="todo.html#_todo000007">Todo:</a></b></dt><dd>carefull round problem ? </dd></dl>
|
||
<dl compact><dt><b><a class="el" href="todo.html#_todo000007">Todo:</a></b></dt><dd>verify that price and quant are numeric </dd></dl>
|
||
<dl compact><dt><b><a class="el" href="todo.html#_todo000007">Todo:</a></b></dt><dd>carefull round problem ? </dd></dl>
|
||
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00441">441</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>.
|
||
<p>
|
||
References <a class="el" href="action_8inc_8php-source.html#l00157">$act</a>, <a class="el" href="parametre_8php-source.html#l00167">$my</a>, <a class="el" href="line__update_8php-source.html#l00095">$p</a>, <a class="el" href="send__poste__pdf_8php-source.html#l00044">$poste</a>, <a class="el" href="bank_8inc_8php-source.html#l00154">$qcode</a>, <a class="el" href="bank_8inc_8php-source.html#l00237">$r</a>, <a class="el" href="action_8inc_8php-source.html#l00159">ag_id</a>, <a class="el" href="readme_8php-source.html#l00200">break</a>, <a class="el" href="user__impress_8php-source.html#l00095">fiche</a>, <a class="el" href="user__common_8php-source.html#l00040">GetTvaRate()</a>, <a class="el" href="parametre_8php-source.html#l00160">MY_COMMUNE</a>, <a class="el" href="parametre_8php-source.html#l00159">MY_CP</a>, <a class="el" href="parametre_8php-source.html#l00162">MY_FAX</a>, <a class="el" href="parametre_8php-source.html#l00155">MY_NAME</a>, <a class="el" href="parametre_8php-source.html#l00158">MY_NUMBER</a>, <a class="el" href="parametre_8php-source.html#l00163">MY_PAYS</a>, <a class="el" href="parametre_8php-source.html#l00157">MY_STREET</a>, <a class="el" href="parametre_8php-source.html#l00161">MY_TEL</a>, <a class="el" href="parametre_8php-source.html#l00156">MY_TVA</a>, and <a class="el" href="action_8inc_8php-source.html#l00165">qcode_dest</a>.
|
||
<p>
|
||
Referenced by <a class="el" href="class__document_8php-source.html#l00163">ParseDocument()</a>.<div class="fragment"><pre class="fragment"><a name="l00442"></a>00442 {
|
||
<a name="l00443"></a>00443 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<span class="stringliteral">"Tag inconnu"</span>;
|
||
<a name="l00444"></a>00444 <span class="keyword">static</span> $counter=0;
|
||
<a name="l00445"></a>00445 <span class="keywordflow">switch</span> ($p_tag)
|
||
<a name="l00446"></a>00446 {
|
||
<a name="l00447"></a>00447 <span class="keywordflow">case</span> 'DATE':
|
||
<a name="l00448"></a>00448 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=' Date inconnue ';
|
||
<a name="l00449"></a>00449 <span class="comment">// Date are in $_REQUEST['ag_date'] </span>
|
||
<a name="l00450"></a>00450 <span class="comment">// or $_POST['e_date']</span>
|
||
<a name="l00451"></a>00451 <span class="keywordflow">if</span> ( isset ($_REQUEST['ag_date']))
|
||
<a name="l00452"></a>00452 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=$_REQUEST['ag_date'];
|
||
<a name="l00453"></a>00453 <span class="keywordflow">if</span> ( isset ($_REQUEST['e_date']))
|
||
<a name="l00454"></a>00454 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=$_REQUEST['e_date'];
|
||
<a name="l00455"></a>00455
|
||
<a name="l00456"></a>00456 <span class="keywordflow">break</span>;
|
||
<a name="l00457"></a>00457 <span class="comment">//</span>
|
||
<a name="l00458"></a>00458 <span class="comment">// the company priv</span>
|
||
<a name="l00459"></a>00459
|
||
<a name="l00460"></a>00460 <span class="keywordflow">case</span> '<a class="code" href="parametre_8php.html#a8">MY_NAME</a>':
|
||
<a name="l00461"></a>00461 <a class="code" href="parametre_8php.html#a17">$my</a>=<span class="keyword">new</span> own($this->db);
|
||
<a name="l00462"></a>00462 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<a class="code" href="parametre_8php.html#a17">$my</a>->MY_NAME;
|
||
<a name="l00463"></a>00463 <span class="keywordflow">break</span>;
|
||
<a name="l00464"></a>00464 <span class="keywordflow">case</span> '<a class="code" href="parametre_8php.html#a12">MY_CP</a>':
|
||
<a name="l00465"></a>00465 <a class="code" href="parametre_8php.html#a17">$my</a>=<span class="keyword">new</span> own($this->db);
|
||
<a name="l00466"></a>00466 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<a class="code" href="parametre_8php.html#a17">$my</a>->MY_CP;
|
||
<a name="l00467"></a>00467 <span class="keywordflow">break</span>;
|
||
<a name="l00468"></a>00468 <span class="keywordflow">case</span> '<a class="code" href="parametre_8php.html#a13">MY_COMMUNE</a>':
|
||
<a name="l00469"></a>00469 <a class="code" href="parametre_8php.html#a17">$my</a>=<span class="keyword">new</span> own($this->db);
|
||
<a name="l00470"></a>00470 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<a class="code" href="parametre_8php.html#a17">$my</a>->MY_COMMUNE;
|
||
<a name="l00471"></a>00471 <span class="keywordflow">break</span>;
|
||
<a name="l00472"></a>00472 <span class="keywordflow">case</span> '<a class="code" href="parametre_8php.html#a9">MY_TVA</a>':
|
||
<a name="l00473"></a>00473 <a class="code" href="parametre_8php.html#a17">$my</a>=<span class="keyword">new</span> own($this->db);
|
||
<a name="l00474"></a>00474 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<a class="code" href="parametre_8php.html#a17">$my</a>->MY_TVA;
|
||
<a name="l00475"></a>00475 <span class="keywordflow">break</span>;
|
||
<a name="l00476"></a>00476 <span class="keywordflow">case</span> '<a class="code" href="parametre_8php.html#a10">MY_STREET</a>':
|
||
<a name="l00477"></a>00477 <a class="code" href="parametre_8php.html#a17">$my</a>=<span class="keyword">new</span> own($this->db);
|
||
<a name="l00478"></a>00478 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<a class="code" href="parametre_8php.html#a17">$my</a>->MY_STREET;
|
||
<a name="l00479"></a>00479 <span class="keywordflow">break</span>;
|
||
<a name="l00480"></a>00480 <span class="keywordflow">case</span> '<a class="code" href="parametre_8php.html#a11">MY_NUMBER</a>':
|
||
<a name="l00481"></a>00481 <a class="code" href="parametre_8php.html#a17">$my</a>=<span class="keyword">new</span> own($this->db);
|
||
<a name="l00482"></a>00482 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<a class="code" href="parametre_8php.html#a17">$my</a>->MY_NUMBER;
|
||
<a name="l00483"></a>00483 <span class="keywordflow">break</span>;
|
||
<a name="l00484"></a>00484 <span class="keywordflow">case</span> '<a class="code" href="parametre_8php.html#a14">MY_TEL</a>':
|
||
<a name="l00485"></a>00485 <a class="code" href="parametre_8php.html#a17">$my</a>=<span class="keyword">new</span> own($this->db);
|
||
<a name="l00486"></a>00486 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<a class="code" href="parametre_8php.html#a17">$my</a>->MY_TEL;
|
||
<a name="l00487"></a>00487 <span class="keywordflow">break</span>;
|
||
<a name="l00488"></a>00488 <span class="keywordflow">case</span> '<a class="code" href="parametre_8php.html#a15">MY_FAX</a>':
|
||
<a name="l00489"></a>00489 <a class="code" href="parametre_8php.html#a17">$my</a>=<span class="keyword">new</span> own($this->db);
|
||
<a name="l00490"></a>00490 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<a class="code" href="parametre_8php.html#a17">$my</a>->MY_FAX;
|
||
<a name="l00491"></a>00491 <span class="keywordflow">break</span>;
|
||
<a name="l00492"></a>00492 <span class="keywordflow">case</span> '<a class="code" href="parametre_8php.html#a16">MY_PAYS</a>':
|
||
<a name="l00493"></a>00493 <a class="code" href="parametre_8php.html#a17">$my</a>=<span class="keyword">new</span> own($this->db);
|
||
<a name="l00494"></a>00494 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<a class="code" href="parametre_8php.html#a17">$my</a>->MY_PAYS;
|
||
<a name="l00495"></a>00495 <span class="keywordflow">break</span>;
|
||
<a name="l00496"></a>00496
|
||
<a name="l00497"></a>00497 <span class="comment">// customer </span>
|
||
<a name="l00498"></a>00498 <span class="comment">/*\note The CUST_* are retrieved thx the $_REQUEST['tiers'] </span>
|
||
<a name="l00499"></a>00499 <span class="comment"> * which contains the quick_code</span>
|
||
<a name="l00500"></a>00500 <span class="comment"> */</span>
|
||
<a name="l00501"></a>00501 <span class="keywordflow">case</span> 'SOLDE':
|
||
<a name="l00502"></a>00502 $tiers=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this->db);
|
||
<a name="l00503"></a>00503 <a class="code" href="bank_8inc_8php.html#a16">$qcode</a>=isset($_REQUEST['<a class="code" href="action_8inc_8php.html#a10">qcode_dest</a>'])?$_REQUEST['<a class="code" href="action_8inc_8php.html#a10">qcode_dest</a>']:$_REQUEST['e_client'];
|
||
<a name="l00504"></a>00504 $tiers->Getbyqcode($qcode,<span class="keyword">false</span>);
|
||
<a name="l00505"></a>00505 <a class="code" href="line__update_8php.html#a10">$p</a>=$tiers->strAttribut(<a class="code" href="constant_8php.html#a55">ATTR_DEF_ACCOUNT</a>);
|
||
<a name="l00506"></a>00506 <a class="code" href="send__poste__pdf_8php.html#a2">$poste</a>=<span class="keyword">new</span> Poste($this->db,$p);
|
||
<a name="l00507"></a>00507 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<a class="code" href="send__poste__pdf_8php.html#a2">$poste</a>->GetSolde(' <span class="keyword">true</span>' );
|
||
<a name="l00508"></a>00508 <span class="keywordflow">break</span>;
|
||
<a name="l00509"></a>00509 <span class="keywordflow">case</span> 'CUST_NAME':
|
||
<a name="l00510"></a>00510 $tiers=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this->db);
|
||
<a name="l00511"></a>00511 <a class="code" href="bank_8inc_8php.html#a16">$qcode</a>=isset($_REQUEST['<a class="code" href="action_8inc_8php.html#a10">qcode_dest</a>'])?$_REQUEST['<a class="code" href="action_8inc_8php.html#a10">qcode_dest</a>']:$_REQUEST['e_client'];
|
||
<a name="l00512"></a>00512 $tiers->getByQcode($qcode,<span class="keyword">false</span>);
|
||
<a name="l00513"></a>00513 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=$tiers->strAttribut(<a class="code" href="constant_8php.html#a56">ATTR_DEF_NAME</a>);
|
||
<a name="l00514"></a>00514 <span class="keywordflow">break</span>;
|
||
<a name="l00515"></a>00515 <span class="keywordflow">case</span> 'CUST_ADDR_1':
|
||
<a name="l00516"></a>00516 $tiers=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this->db);
|
||
<a name="l00517"></a>00517 <a class="code" href="bank_8inc_8php.html#a16">$qcode</a>=isset($_REQUEST['<a class="code" href="action_8inc_8php.html#a10">qcode_dest</a>'])?$_REQUEST['<a class="code" href="action_8inc_8php.html#a10">qcode_dest</a>']:$_REQUEST['e_client'];
|
||
<a name="l00518"></a>00518 $tiers->getByQcode($qcode,<span class="keyword">false</span>);
|
||
<a name="l00519"></a>00519 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=$tiers->strAttribut(<a class="code" href="constant_8php.html#a61">ATTR_DEF_ADRESS</a>);
|
||
<a name="l00520"></a>00520
|
||
<a name="l00521"></a>00521 <a class="code" href="readme_8php.html#a13">break</a> ;
|
||
<a name="l00522"></a>00522 <span class="keywordflow">case</span> 'CUST_CP':
|
||
<a name="l00523"></a>00523 $tiers=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this->db);
|
||
<a name="l00524"></a>00524 <a class="code" href="bank_8inc_8php.html#a16">$qcode</a>=isset($_REQUEST['<a class="code" href="action_8inc_8php.html#a10">qcode_dest</a>'])?$_REQUEST['<a class="code" href="action_8inc_8php.html#a10">qcode_dest</a>']:$_REQUEST['e_client'];
|
||
<a name="l00525"></a>00525 $tiers->getByQcode($qcode,<span class="keyword">false</span>);
|
||
<a name="l00526"></a>00526 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=$tiers->strAttribut(<a class="code" href="constant_8php.html#a62">ATTR_DEF_CP</a>);
|
||
<a name="l00527"></a>00527
|
||
<a name="l00528"></a>00528 <span class="keywordflow">break</span>;
|
||
<a name="l00529"></a>00529 <span class="keywordflow">case</span> 'CUST_CO':
|
||
<a name="l00530"></a>00530 $tiers=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this->db);
|
||
<a name="l00531"></a>00531 <a class="code" href="bank_8inc_8php.html#a16">$qcode</a>=isset($_REQUEST['<a class="code" href="action_8inc_8php.html#a10">qcode_dest</a>'])?$_REQUEST['<a class="code" href="action_8inc_8php.html#a10">qcode_dest</a>']:$_REQUEST['e_client'];
|
||
<a name="l00532"></a>00532 $tiers->getByQcode($qcode,<span class="keyword">false</span>);
|
||
<a name="l00533"></a>00533 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=$tiers->strAttribut(<a class="code" href="constant_8php.html#a63">ATTR_DEF_PAYS</a>);
|
||
<a name="l00534"></a>00534
|
||
<a name="l00535"></a>00535 <span class="keywordflow">break</span>;
|
||
<a name="l00536"></a>00536 <span class="keywordflow">case</span> 'CUST_VAT':
|
||
<a name="l00537"></a>00537 $tiers=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this->db);
|
||
<a name="l00538"></a>00538 <a class="code" href="bank_8inc_8php.html#a16">$qcode</a>=isset($_REQUEST['<a class="code" href="action_8inc_8php.html#a10">qcode_dest</a>'])?$_REQUEST['<a class="code" href="action_8inc_8php.html#a10">qcode_dest</a>']:$_REQUEST['e_client'];
|
||
<a name="l00539"></a>00539 $tiers->getByQcode($qcode,<span class="keyword">false</span>);
|
||
<a name="l00540"></a>00540 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=$tiers->strAttribut(<a class="code" href="constant_8php.html#a60">ATTR_DEF_NUMTVA</a>);
|
||
<a name="l00541"></a>00541 <span class="keywordflow">break</span>;
|
||
<a name="l00542"></a>00542 <span class="comment">// Marchandise in $_POST['e_march*']</span>
|
||
<a name="l00543"></a>00543 <span class="comment">// \see user_form_achat.php or user_form_ven.php</span>
|
||
<a name="l00544"></a>00544 <span class="keywordflow">case</span> 'NUMBER':
|
||
<a name="l00545"></a>00545 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=$this->d_number;
|
||
<a name="l00546"></a>00546 <span class="keywordflow">break</span>;
|
||
<a name="l00547"></a>00547 <span class="keywordflow">case</span> 'REFERENCE':
|
||
<a name="l00548"></a>00548 <a class="code" href="action_8inc_8php.html#a3">$act</a>=<span class="keyword">new</span> <a class="code" href="classaction.html">action</a>($this->db);
|
||
<a name="l00549"></a>00549 <a class="code" href="action_8inc_8php.html#a3">$act</a>->ag_id=$this-><a class="code" href="action_8inc_8php.html#a4">ag_id</a>;
|
||
<a name="l00550"></a>00550 <a class="code" href="action_8inc_8php.html#a3">$act</a>->get();
|
||
<a name="l00551"></a>00551 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<a class="code" href="action_8inc_8php.html#a3">$act</a>->ag_ref;
|
||
<a name="l00552"></a>00552 <span class="keywordflow">break</span>;
|
||
<a name="l00553"></a>00553
|
||
<a name="l00554"></a>00554 <span class="comment">/*</span>
|
||
<a name="l00555"></a>00555 <span class="comment"> * - [VEN_ART_NAME]</span>
|
||
<a name="l00556"></a>00556 <span class="comment"> * - [VEN_ART_PRICE]</span>
|
||
<a name="l00557"></a>00557 <span class="comment"> * - [VEN_ART_QUANT]</span>
|
||
<a name="l00558"></a>00558 <span class="comment"> * - [VEN_ART_TVA_CODE]</span>
|
||
<a name="l00559"></a>00559 <span class="comment"> * - [VEN_ART_TVA_AMOUNT]</span>
|
||
<a name="l00560"></a>00560 <span class="comment"> * - [VEN_ART_STOCK_CODE]</span>
|
||
<a name="l00561"></a>00561 <span class="comment"> * - [VEN_HTVA]</span>
|
||
<a name="l00562"></a>00562 <span class="comment"> * - [VEN_TVAC]</span>
|
||
<a name="l00563"></a>00563 <span class="comment"> * - [VEN_TVA]</span>
|
||
<a name="l00564"></a>00564 <span class="comment"> * - [TOTAL_VEN_HTVA]</span>
|
||
<a name="l00565"></a>00565 <span class="comment"> */</span>
|
||
<a name="l00566"></a>00566 <span class="keywordflow">case</span> 'MARCH_NEXT':
|
||
<a name="l00567"></a>00567 $counter++;
|
||
<a name="l00568"></a>00568 <a class="code" href="bank_8inc_8php.html#a29">$r</a>='';
|
||
<a name="l00569"></a>00569 <span class="keywordflow">break</span>;
|
||
<a name="l00570"></a>00570
|
||
<a name="l00571"></a>00571 <span class="keywordflow">case</span> 'VEN_ART_NAME':
|
||
<a name="l00572"></a>00572 extract ($_POST);
|
||
<a name="l00573"></a>00573 $id='e_march'.$counter;
|
||
<a name="l00574"></a>00574 <span class="comment">// check if the march exists</span>
|
||
<a name="l00575"></a>00575 <span class="keywordflow">if</span> ( ! isset (${$<span class="keywordtype">id</span>})) <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
|
||
<a name="l00576"></a>00576 <span class="comment">// check that something is sold</span>
|
||
<a name="l00577"></a>00577 <span class="keywordflow">if</span> ( ${'e_march'.$counter.'_sell'} != 0 && ${'e_quant'.$counter} != 0 )
|
||
<a name="l00578"></a>00578 {
|
||
<a name="l00579"></a>00579 $f=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this->db);
|
||
<a name="l00580"></a>00580 $f->GetByQCode(${$<span class="keywordtype">id</span>},<span class="keyword">false</span>);
|
||
<a name="l00581"></a>00581 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=$f->strAttribut(<a class="code" href="constant_8php.html#a56">ATTR_DEF_NAME</a>);
|
||
<a name="l00582"></a>00582 } <span class="keywordflow">else</span> <a class="code" href="bank_8inc_8php.html#a29">$r</a> = <span class="stringliteral">""</span>;
|
||
<a name="l00583"></a>00583 <span class="keywordflow">break</span>;
|
||
<a name="l00584"></a>00584
|
||
<a name="l00585"></a>00585 <span class="keywordflow">case</span> 'VEN_ART_PRICE':
|
||
<a name="l00586"></a>00586 extract ($_POST);
|
||
<a name="l00587"></a>00587 $id='e_march'.$counter.'_sell' ;
|
||
<a name="l00588"></a>00588 <span class="keywordflow">if</span> ( !isset (${$<span class="keywordtype">id</span>}) ) <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
|
||
<a name="l00589"></a>00589 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=${$id};
|
||
<a name="l00590"></a>00590 <span class="keywordflow">break</span>;
|
||
<a name="l00591"></a>00591
|
||
<a name="l00592"></a>00592 <span class="keywordflow">case</span> 'TVA_CODE':
|
||
<a name="l00593"></a>00593 extract ($_POST);
|
||
<a name="l00594"></a>00594 $id='e_march'.$counter.'_tva_id';
|
||
<a name="l00595"></a>00595 <span class="keywordflow">if</span> ( !isset (${$<span class="keywordtype">id</span>}) ) <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
|
||
<a name="l00596"></a>00596 <span class="keywordflow">if</span> ( ${$<span class="keywordtype">id</span>} == -1 ) <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
|
||
<a name="l00597"></a>00597 $qt='e_quant'.$counter;
|
||
<a name="l00598"></a>00598 $price='e_march'.$counter.'_sell' ;
|
||
<a name="l00599"></a>00599 <span class="keywordflow">if</span> ( ${$price} == 0 || ${$qt} == 0
|
||
<a name="l00600"></a>00600 || strlen(trim( $price )) ==0
|
||
<a name="l00601"></a>00601 || strlen(trim($qt)) ==0)
|
||
<a name="l00602"></a>00602 <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
|
||
<a name="l00603"></a>00603
|
||
<a name="l00604"></a>00604 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=${$id};
|
||
<a name="l00605"></a>00605 <span class="keywordflow">break</span>;
|
||
<a name="l00606"></a>00606
|
||
<a name="l00607"></a>00607 <span class="keywordflow">case</span> 'TVA_LABEL':
|
||
<a name="l00608"></a>00608 extract ($_POST);
|
||
<a name="l00609"></a>00609 $id='e_march'.$counter.'_tva_id';
|
||
<a name="l00610"></a>00610 <span class="keywordflow">if</span> ( !isset (${$<span class="keywordtype">id</span>}) ) <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
|
||
<a name="l00611"></a>00611 $tva=<a class="code" href="user__common_8php.html#a0">GetTvaRate</a>($this->db,${$<span class="keywordtype">id</span>});
|
||
<a name="l00612"></a>00612 <span class="keywordflow">if</span> ( $tva == null || $tva==0 ) <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
|
||
<a name="l00613"></a>00613 $r=$tva['tva_label'];
|
||
<a name="l00614"></a>00614 <span class="keywordflow">break</span>;
|
||
<a name="l00615"></a>00615
|
||
<a name="l00616"></a>00616
|
||
<a name="l00617"></a>00617 <span class="keywordflow">case</span> 'TVA_AMOUNT':
|
||
<a name="l00618"></a>00618 extract ($_POST);
|
||
<a name="l00619"></a>00619 $qt='e_quant'.$counter;
|
||
<a name="l00620"></a>00620 $price='e_march'.$counter.'_sell' ;
|
||
<a name="l00621"></a>00621 $tva='e_march'.$counter.'_tva_id';
|
||
<a name="l00622"></a>00622 if ( !isset (${'e_march'.$counter}) ) <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
|
||
<a name="l00623"></a>00623 <span class="comment">// check that something is sold</span>
|
||
<a name="l00624"></a>00624 <span class="keywordflow">if</span> ( ${$price} == 0 || ${$qt} == 0
|
||
<a name="l00625"></a>00625 || strlen(trim( $price )) ==0
|
||
<a name="l00626"></a>00626 || strlen(trim($qt)) ==0)
|
||
<a name="l00627"></a>00627 <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
|
||
<a name="l00628"></a>00628 $a_tva=<a class="code" href="user__common_8php.html#a0">GetTvaRate</a>($this->db,${$tva});
|
||
<a name="l00629"></a>00629 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__,'Tva :'.var_export($a_tva,<span class="keyword">true</span>));
|
||
<a name="l00630"></a>00630 <span class="comment">// if no vat returns 0</span>
|
||
<a name="l00631"></a>00631 <span class="keywordflow">if</span> ( <span class="keyword">sizeof</span>($a_tva) == 0 ) <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
|
||
<a name="l00632"></a>00632 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=round(${$price},2)*${$qt}*$a_tva['tva_rate'];
|
||
<a name="l00633"></a>00633 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=round($r,2);
|
||
<a name="l00634"></a>00634 <span class="keywordflow">break</span>;
|
||
<a name="l00635"></a>00635
|
||
<a name="l00636"></a>00636 <span class="keywordflow">case</span> 'VEN_ART_QUANT':
|
||
<a name="l00637"></a>00637 extract ($_POST);
|
||
<a name="l00638"></a>00638 $id='e_quant'.$counter;
|
||
<a name="l00639"></a>00639 <span class="keywordflow">if</span> ( !isset (${$<span class="keywordtype">id</span>}) ) <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
|
||
<a name="l00640"></a>00640 <span class="comment">// check that something is sold</span>
|
||
<a name="l00641"></a>00641 <span class="keywordflow">if</span> ( ${'e_march'.$counter.'_sell'} == 0
|
||
<a name="l00642"></a>00642 || ${'e_quant'.$counter} == 0
|
||
<a name="l00643"></a>00643 || strlen(trim( ${'e_march'.$counter.'_sell'} )) ==0
|
||
<a name="l00644"></a>00644 || strlen(trim(${'e_quant'.$counter})) ==0 )
|
||
<a name="l00645"></a>00645 <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
|
||
<a name="l00646"></a>00646 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=${$id};
|
||
<a name="l00647"></a>00647 <span class="keywordflow">break</span>;
|
||
<a name="l00648"></a>00648
|
||
<a name="l00649"></a>00649 <span class="keywordflow">case</span> 'VEN_HTVA':
|
||
<a name="l00650"></a>00650 extract ($_POST);
|
||
<a name="l00651"></a>00651 $id='e_march'.$counter.'_sell' ;
|
||
<a name="l00652"></a>00652 $quant='e_quant'.$counter;
|
||
<a name="l00653"></a>00653 <span class="keywordflow">if</span> ( !isset (${$<span class="keywordtype">id</span>}) ) <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
|
||
<a name="l00654"></a>00654
|
||
<a name="l00655"></a>00655 <span class="comment">// check that something is sold</span>
|
||
<a name="l00656"></a>00656 <span class="keywordflow">if</span> ( ${'e_march'.$counter.'_sell'} == 0 || ${'e_quant'.$counter} == 0
|
||
<a name="l00657"></a>00657 || strlen(trim( ${'e_march'.$counter.'_sell'} )) ==0
|
||
<a name="l00658"></a>00658 || strlen(trim(${'e_quant'.$counter})) ==0)
|
||
<a name="l00659"></a>00659 <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
|
||
<a name="l00665"></a>00665 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=round(${$<span class="keywordtype">id</span>}*${$quant},2);
|
||
<a name="l00666"></a>00666 <span class="keywordflow">break</span>;
|
||
<a name="l00667"></a>00667
|
||
<a name="l00668"></a>00668 <span class="keywordflow">case</span> 'VEN_TVAC':
|
||
<a name="l00669"></a>00669 extract ($_POST);
|
||
<a name="l00670"></a>00670 $id='e_march'.$counter.'_sell' ;
|
||
<a name="l00671"></a>00671 $quant='e_quant'.$counter;
|
||
<a name="l00672"></a>00672 <span class="comment">// if it is exist</span>
|
||
<a name="l00673"></a>00673 <span class="keywordflow">if</span> ( ! isset(${$<span class="keywordtype">id</span>}))
|
||
<a name="l00674"></a>00674 <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
|
||
<a name="l00675"></a>00675 <span class="comment">// check that something is sold</span>
|
||
<a name="l00676"></a>00676 <span class="keywordflow">if</span> ( ${'e_march'.$counter.'_sell'} == 0 || ${'e_quant'.$counter} == 0 )
|
||
<a name="l00677"></a>00677 <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
|
||
<a name="l00682"></a>00682 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=${$id}*${$quant};
|
||
<a name="l00683"></a>00683 $tva=<a class="code" href="user__common_8php.html#a0">GetTvaRate</a>($this->db,${'e_march'.$counter.'_tva_id'});
|
||
<a name="l00684"></a>00684 <span class="comment">// if there is no vat we return now</span>
|
||
<a name="l00685"></a>00685 <span class="keywordflow">if</span> ( $tva == null || $tva == 0 ) <span class="keywordflow">return</span> $r;
|
||
<a name="l00686"></a>00686 <span class="comment">// we compute with the vat included</span>
|
||
<a name="l00687"></a>00687 $r=$r+$r*$tva['tva_rate'];
|
||
<a name="l00688"></a>00688 $r=round($r,2);
|
||
<a name="l00689"></a>00689 <span class="keywordflow">break</span>;
|
||
<a name="l00690"></a>00690 <span class="keywordflow">case</span> 'TOTAL_VEN_HTVA':
|
||
<a name="l00691"></a>00691 extract($_POST);
|
||
<a name="l00692"></a>00692 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__,'TOTAL_VEN_TVA item :'.$nb_item);
|
||
<a name="l00693"></a>00693
|
||
<a name="l00694"></a>00694 $sum=0.0;
|
||
<a name="l00695"></a>00695 <span class="keywordflow">for</span> ($i=0;$i<$nb_item;$i++)
|
||
<a name="l00696"></a>00696 {
|
||
<a name="l00697"></a>00697 $sell='e_march'.$i.'_sell';
|
||
<a name="l00698"></a>00698 $qt='e_quant'.$i;
|
||
<a name="l00699"></a>00699 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__,'sell :'.$sell.' qt = '.$qt);
|
||
<a name="l00700"></a>00700
|
||
<a name="l00701"></a>00701 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__,'counter :'.$i.' sur '.$nb_item);
|
||
<a name="l00702"></a>00702 if ( ! isset (${$sell}) ) <span class="keywordflow">break</span>;
|
||
<a name="l00703"></a>00703 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__,'sell :'.${$sell}.' qt = '.${$qt});
|
||
<a name="l00704"></a>00704
|
||
<a name="l00705"></a>00705 <span class="keywordflow">if</span> ( strlen(trim(${$sell})) == 0 ||
|
||
<a name="l00706"></a>00706 strlen(trim(${$qt})) == 0 ||
|
||
<a name="l00707"></a>00707 ${$qt}==0 || ${$sell}==0)
|
||
<a name="l00708"></a>00708 <span class="keywordflow">continue</span>;
|
||
<a name="l00709"></a>00709 $sum+=${$sell}*${$qt};
|
||
<a name="l00710"></a>00710 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__,'sum :'.$sum);
|
||
<a name="l00711"></a>00711
|
||
<a name="l00712"></a>00712 }
|
||
<a name="l00713"></a>00713 $r=round($sum,2);
|
||
<a name="l00714"></a>00714 <span class="keywordflow">break</span>;
|
||
<a name="l00715"></a>00715 <span class="keywordflow">case</span> 'TOTAL_VEN_TVAC':
|
||
<a name="l00716"></a>00716 extract($_POST);
|
||
<a name="l00717"></a>00717 $sum=0.0;
|
||
<a name="l00718"></a>00718 <span class="keywordflow">for</span> ($i=0;$i<$nb_item;$i++)
|
||
<a name="l00719"></a>00719 {
|
||
<a name="l00720"></a>00720 $tva=<a class="code" href="user__common_8php.html#a0">GetTvaRate</a>($this->db,${'e_march'.$i.'_tva_id'});
|
||
<a name="l00721"></a>00721 <a class="code" href="tva_8inc_8php.html#a2">$tva_rate</a>=( $tva == null || $tva == 0 )?0.0:$tva['tva_rate'];
|
||
<a name="l00722"></a>00722 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__,' :'.$i.' sur '.$nb_item);
|
||
<a name="l00723"></a>00723 $sell=${'e_march'.$i.'_sell'};
|
||
<a name="l00724"></a>00724 $qt=${'e_quant'.$i};
|
||
<a name="l00725"></a>00725 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__,'sell :'.$sell.' qt = '.$qt);
|
||
<a name="l00726"></a>00726
|
||
<a name="l00727"></a>00727 <a class="code" href="export__ouv_8php.html#a7">$sum</a>+=$sell*$qt*(1+<a class="code" href="tva_8inc_8php.html#a2">$tva_rate</a>);
|
||
<a name="l00728"></a>00728 <span class="comment">// $sum+=${'e_march'.$i.'_sell'}*${'e_quant'.$i}*(1+$tva_rate);</span>
|
||
<a name="l00729"></a>00729 }
|
||
<a name="l00730"></a>00730 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=round($sum,2);
|
||
<a name="l00731"></a>00731
|
||
<a name="l00732"></a>00732 <span class="keywordflow">break</span>;
|
||
<a name="l00733"></a>00733
|
||
<a name="l00734"></a>00734 }
|
||
<a name="l00735"></a>00735 <span class="keywordflow">return</span> <a class="code" href="bank_8inc_8php.html#a29">$r</a>;
|
||
<a name="l00736"></a>00736 }
|
||
</pre></div>
|
||
<p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<a class="anchor" name="a2"></a><!-- doxytag: member="Document::save" ref="a2" args="()" --><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">Document::save </td>
|
||
<td class="md" valign="top">( </td>
|
||
<td class="mdname1" valign="top" nowrap> </td>
|
||
<td class="md" valign="top"> ) </td>
|
||
<td class="md" nowrap></td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
Save save the state of the document.
|
||
<p>
|
||
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00063">63</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>.
|
||
<p>
|
||
References <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="l00064"></a>00064 {
|
||
<a name="l00065"></a>00065 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"update document set d_state="</span>.$this->d_state.
|
||
<a name="l00066"></a>00066 <span class="stringliteral">" where d_id="</span>.$this->d_id;
|
||
<a name="l00067"></a>00067 <a class="code" href="postgres_8php.html#a2">ExecSql</a>($this->db,$sql);
|
||
<a name="l00068"></a>00068 }
|
||
</pre></div>
|
||
<p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<a class="anchor" name="a5"></a><!-- doxytag: member="Document::SaveGenerated" ref="a5" args="($p_file)" --><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">Document::SaveGenerated </td>
|
||
<td class="md" valign="top">( </td>
|
||
<td class="md" nowrap valign="top">$ </td>
|
||
<td class="mdname1" valign="top" nowrap> <em>p_file</em> </td>
|
||
<td class="md" valign="top"> ) </td>
|
||
<td class="md" nowrap></td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
Save the generated Document.
|
||
<p>
|
||
SaveGenerated <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_file</em> </td><td>is the generated file</td></tr>
|
||
</table>
|
||
</dl>
|
||
<dl compact><dt><b>Returns:</b></dt><dd>0 if no error otherwise 1</dd></dl>
|
||
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00256">256</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>.
|
||
<p>
|
||
References <a class="el" href="document__modele_8inc_8php-source.html#l00031">$doc</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="postgres_8php-source.html#l00263">Commit()</a>, <a class="el" href="action_8inc_8php-source.html#l00167">d_id</a>, <a class="el" href="class__document_8php-source.html#l00042">Document()</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="postgres_8php-source.html#l00242">GetSequence()</a>, <a class="el" href="postgres_8php-source.html#l00266">Rollback()</a>, and <a class="el" href="postgres_8php-source.html#l00257">StartSql()</a>.
|
||
<p>
|
||
Referenced by <a class="el" href="class__document_8php-source.html#l00079">Generate()</a>.<div class="fragment"><pre class="fragment"><a name="l00257"></a>00257 {
|
||
<a name="l00258"></a>00258 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__,'Save generated');
|
||
<a name="l00259"></a>00259 <span class="comment">// We save the generated file</span>
|
||
<a name="l00260"></a>00260 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>=<span class="keyword">new</span> <a class="code" href="classDocument.html#a0">Document</a>($this->db);
|
||
<a name="l00261"></a>00261 <a class="code" href="postgres_8php.html#a14">StartSql</a>($this->db);
|
||
<a name="l00262"></a>00262 $this->d_lob=pg_lo_import($this->db,$p_file);
|
||
<a name="l00263"></a>00263 <span class="keywordflow">if</span> ( $this->d_lob == <span class="keyword">false</span> ) {
|
||
<a name="l00264"></a>00264 <a class="code" href="postgres_8php.html#a17">Rollback</a>($this->db); <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__,<span class="stringliteral">"can't save file $p_file"</span>);
|
||
<a name="l00265"></a>00265 <span class="keywordflow">return</span> 1; }
|
||
<a name="l00266"></a>00266
|
||
<a name="l00267"></a>00267 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf(<span class="stringliteral">"insert into document(ag_id,d_lob,d_number,d_filename,d_mimetype,d_state) </span>
|
||
<a name="l00268"></a>00268 <span class="stringliteral"> values (%d,%s,%d,'%s','%s',%d)"</span>,
|
||
<a name="l00269"></a>00269 $this->ag_id,
|
||
<a name="l00270"></a>00270 $this->d_lob,
|
||
<a name="l00271"></a>00271 $this->d_number,
|
||
<a name="l00272"></a>00272 $this->d_filename,
|
||
<a name="l00273"></a>00273 $this->d_mimetype,
|
||
<a name="l00274"></a>00274 $this->d_state
|
||
<a name="l00275"></a>00275 );
|
||
<a name="l00276"></a>00276 <a class="code" href="postgres_8php.html#a2">ExecSql</a>($this->db,$sql);
|
||
<a name="l00277"></a>00277 $this-><a class="code" href="action_8inc_8php.html#a12">d_id</a>=<a class="code" href="postgres_8php.html#a12">GetSequence</a>($this->db,<span class="stringliteral">"document_d_id_seq"</span>);
|
||
<a name="l00278"></a>00278 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_document',__LINE__,'document sauv<75> : <a class="code" href="action_8inc_8php.html#a12">d_id</a>'.$this->d_id);
|
||
<a name="l00279"></a>00279 <a class="code" href="postgres_8php.html#a16">Commit</a>($this->db);
|
||
<a name="l00280"></a>00280 <span class="keywordflow">return</span> 0;
|
||
<a name="l00281"></a>00281 }
|
||
</pre></div>
|
||
<p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<a class="anchor" name="a8"></a><!-- doxytag: member="Document::Send" ref="a8" args="()" --><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">Document::Send </td>
|
||
<td class="md" valign="top">( </td>
|
||
<td class="mdname1" valign="top" nowrap> </td>
|
||
<td class="md" valign="top"> ) </td>
|
||
<td class="md" nowrap></td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00355">355</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>.
|
||
<p>
|
||
References <a class="el" href="show__document__modele_8php-source.html#l00060">$file</a>, <a class="el" href="impress__bilan_8php-source.html#l00032">$ret</a>, <a class="el" href="argenta__be_8inc_8php-source.html#l00028">$row</a>, <a class="el" href="show__document__modele_8php-source.html#l00050">$tmp</a>, <a class="el" href="postgres_8php-source.html#l00263">Commit()</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, and <a class="el" href="postgres_8php-source.html#l00257">StartSql()</a>.<div class="fragment"><pre class="fragment"><a name="l00356"></a>00356 {
|
||
<a name="l00357"></a>00357 <span class="comment">// retrieve the template and generate document</span>
|
||
<a name="l00358"></a>00358 <a class="code" href="postgres_8php.html#a14">StartSql</a>($this->db);
|
||
<a name="l00359"></a>00359 <a class="code" href="impress__bilan_8php.html#a0">$ret</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this->db,
|
||
<a name="l00360"></a>00360 <span class="stringliteral">"select d_id,d_lob,d_filename,d_mimetype from document where d_id="</span>.$this->d_id );
|
||
<a name="l00361"></a>00361 <span class="keywordflow">if</span> ( pg_num_rows ($ret) == 0 )
|
||
<a name="l00362"></a>00362 <span class="keywordflow">return</span>;
|
||
<a name="l00363"></a>00363 <a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>=pg_fetch_array($ret,0);
|
||
<a name="l00364"></a>00364 <span class="comment">//the document is saved into file $tmp</span>
|
||
<a name="l00365"></a>00365 <a class="code" href="show__document__modele_8php.html#a5">$tmp</a>=tempnam('/tmp/<span class="charliteral">','</span>document_');
|
||
<a name="l00366"></a>00366 pg_lo_export($this->db,$row['d_lob'],$tmp);
|
||
<a name="l00367"></a>00367 $this->d_mimetype=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>['d_mimetype'];
|
||
<a name="l00368"></a>00368 $this->d_filename=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>['d_filename'];
|
||
<a name="l00369"></a>00369
|
||
<a name="l00370"></a>00370 <span class="comment">// send it to stdout</span>
|
||
<a name="l00371"></a>00371 ini_set('zlib.output_compression<span class="charliteral">','</span>Off');
|
||
<a name="l00372"></a>00372 header(<span class="stringliteral">"Pragma: public"</span>);
|
||
<a name="l00373"></a>00373 header(<span class="stringliteral">"Expires: Mon, 26 Jul 1997 05:00:00 GMT"</span>);
|
||
<a name="l00374"></a>00374 header(<span class="stringliteral">"Last-Modified: "</span> . gmdate(<span class="stringliteral">"D, d M Y H:i:s"</span>) . <span class="stringliteral">" GMT"</span>);
|
||
<a name="l00375"></a>00375 header(<span class="stringliteral">"Cache-Control: must-revalidate"</span>);
|
||
<a name="l00376"></a>00376 header('Content-type: <span class="stringliteral">"'.$this->d_mimetype.'"</span>');
|
||
<a name="l00377"></a>00377 header('Content-Disposition: attachment;filename=<span class="stringliteral">"'.$this->d_filename.'"</span>',FALSE);
|
||
<a name="l00378"></a>00378 header(<span class="stringliteral">"Accept-Ranges: bytes"</span>);
|
||
<a name="l00379"></a>00379 <a class="code" href="show__document__modele_8php.html#a6">$file</a>=fopen($tmp,<span class="charliteral">'r'</span>);
|
||
<a name="l00380"></a>00380 <span class="keywordflow">while</span> ( !feof ($file) )
|
||
<a name="l00381"></a>00381 {
|
||
<a name="l00382"></a>00382 echo fread($file,8192);
|
||
<a name="l00383"></a>00383 }
|
||
<a name="l00384"></a>00384 fclose($file);
|
||
<a name="l00385"></a>00385
|
||
<a name="l00386"></a>00386 unlink ($tmp);
|
||
<a name="l00387"></a>00387
|
||
<a name="l00388"></a>00388 <a class="code" href="postgres_8php.html#a16">Commit</a>($this->db);
|
||
<a name="l00389"></a>00389
|
||
<a name="l00390"></a>00390 }
|
||
</pre></div>
|
||
<p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<a class="anchor" name="a6"></a><!-- doxytag: member="Document::Upload" ref="a6" args="()" --><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">Document::Upload </td>
|
||
<td class="md" valign="top">( </td>
|
||
<td class="mdname1" valign="top" nowrap> </td>
|
||
<td class="md" valign="top"> ) </td>
|
||
<td class="md" nowrap></td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
Upload a file into document all the needed data are in $_FILES we don't increment the seq.
|
||
<p>
|
||
Upload<p>
|
||
<dl compact><dt><b>Returns:</b></dt><dd></dd></dl>
|
||
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00289">289</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>.
|
||
<p>
|
||
References <a class="el" href="modify__op_8php-source.html#l00125">$old_oid</a>, <a class="el" href="bank_8inc_8php-source.html#l00237">$r</a>, <a class="el" href="impress__bilan_8php-source.html#l00032">$ret</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="postgres_8php-source.html#l00263">Commit()</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, <a class="el" href="action_8inc_8php-source.html#l00240">name</a>, <a class="el" href="postgres_8php-source.html#l00266">Rollback()</a>, and <a class="el" href="postgres_8php-source.html#l00257">StartSql()</a>.<div class="fragment"><pre class="fragment"><a name="l00290"></a>00290 {
|
||
<a name="l00291"></a>00291
|
||
<a name="l00292"></a>00292 <span class="comment">// nothing to save</span>
|
||
<a name="l00293"></a>00293 <span class="keywordflow">if</span> ( <span class="keyword">sizeof</span>($_FILES) == 0 ) <span class="keywordflow">return</span>;
|
||
<a name="l00294"></a>00294
|
||
<a name="l00295"></a>00295 <span class="comment">// Start Transaction</span>
|
||
<a name="l00296"></a>00296 <a class="code" href="postgres_8php.html#a14">StartSql</a>($this->db);
|
||
<a name="l00297"></a>00297 $new_name=tempnam('/tmp<span class="charliteral">','</span>doc_');
|
||
<a name="l00298"></a>00298
|
||
<a name="l00299"></a>00299
|
||
<a name="l00300"></a>00300 <span class="comment">// check if a file is submitted</span>
|
||
<a name="l00301"></a>00301 <span class="keywordflow">if</span> ( strlen($_FILES['file_upload']['tmp_name']) != 0 )
|
||
<a name="l00302"></a>00302 {
|
||
<a name="l00303"></a>00303 <span class="comment">// upload the file and move it to temp directory</span>
|
||
<a name="l00304"></a>00304 <span class="keywordflow">if</span> ( move_uploaded_file($_FILES['file_upload']['tmp_name'],$new_name))
|
||
<a name="l00305"></a>00305 {
|
||
<a name="l00306"></a>00306 $oid=pg_lo_import($this->db,$new_name);
|
||
<a name="l00307"></a>00307 <span class="comment">// check if the lob is in the database</span>
|
||
<a name="l00308"></a>00308 <span class="keywordflow">if</span> ( $oid == <span class="keyword">false</span> )
|
||
<a name="l00309"></a>00309 {
|
||
<a name="l00310"></a>00310 <a class="code" href="postgres_8php.html#a17">Rollback</a>($this->db);
|
||
<a name="l00311"></a>00311 <span class="keywordflow">return</span> 1;
|
||
<a name="l00312"></a>00312 }
|
||
<a name="l00313"></a>00313 }
|
||
<a name="l00314"></a>00314 <span class="comment">// the upload in the database is successfull</span>
|
||
<a name="l00315"></a>00315 $this->d_lob=$oid;
|
||
<a name="l00316"></a>00316 $this->d_filename=$_FILES['file_upload']['<a class="code" href="action_8inc_8php.html#a18">name</a>'];
|
||
<a name="l00317"></a>00317 $this->d_mimetype=$_FILES['file_upload']['type'];
|
||
<a name="l00318"></a>00318 <span class="comment">// now we have to update the col.</span>
|
||
<a name="l00319"></a>00319 <span class="comment">// We retrieve the row to remove a possible existing lob (replace)</span>
|
||
<a name="l00320"></a>00320 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"select d_lob from document where d_id="</span>.$this->d_id;
|
||
<a name="l00321"></a>00321 <a class="code" href="impress__bilan_8php.html#a0">$ret</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this->db,$sql);
|
||
<a name="l00322"></a>00322
|
||
<a name="l00323"></a>00323 <span class="keywordflow">if</span> (pg_num_rows($ret) != 0)
|
||
<a name="l00324"></a>00324 {
|
||
<a name="l00325"></a>00325 <span class="comment">// a result is found, the old oid is keept in order to</span>
|
||
<a name="l00326"></a>00326 <span class="comment">// remove it later</span>
|
||
<a name="l00327"></a>00327 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=pg_fetch_array($ret,0) ;
|
||
<a name="l00328"></a>00328 <a class="code" href="modify__op_8php.html#a6">$old_oid</a>=<a class="code" href="bank_8inc_8php.html#a29">$r</a>['d_lob'] ;
|
||
<a name="l00329"></a>00329 <span class="keywordflow">if</span> (strlen($old_oid) != 0) { pg_lo_unlink ($this->db,$old_oid);}
|
||
<a name="l00330"></a>00330 }
|
||
<a name="l00331"></a>00331 <span class="comment">// Update the table</span>
|
||
<a name="l00332"></a>00332 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf(<span class="stringliteral">"update document set d_lob=%s,d_filename='%s',d_mimetype='%s' where d_id=%d"</span>,
|
||
<a name="l00333"></a>00333 $this->d_lob,$this->d_filename,$this->d_mimetype,$this->d_id);
|
||
<a name="l00334"></a>00334 <a class="code" href="postgres_8php.html#a2">ExecSql</a>($this->db,$sql);
|
||
<a name="l00335"></a>00335 }
|
||
<a name="l00336"></a>00336 <a class="code" href="postgres_8php.html#a16">Commit</a>($this->db);
|
||
<a name="l00337"></a>00337
|
||
<a name="l00338"></a>00338 }
|
||
</pre></div>
|
||
<p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<hr><h2>Field Documentation</h2>
|
||
<a class="anchor" name="o1"></a><!-- doxytag: member="Document::$ag_id" ref="o1" args="" --><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">Document::$<a class="el" href="facture_8inc_8php.html#a27">ag_id</a> </td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
<a class="el" href="facture_8inc_8php.html#a27">action_gestion.ag_id</a> (pk)
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00032">32</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>. </td>
|
||
</tr>
|
||
</table>
|
||
<a class="anchor" name="o3"></a><!-- doxytag: member="Document::$d_filename" ref="o3" args="" --><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">Document::$d_filename </td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00034">34</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>. </td>
|
||
</tr>
|
||
</table>
|
||
<a class="anchor" name="o4"></a><!-- doxytag: member="Document::$d_lob" ref="o4" args="" --><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">Document::$d_lob </td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
the oid of the lob
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00035">35</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>. </td>
|
||
</tr>
|
||
</table>
|
||
<a class="anchor" name="o2"></a><!-- doxytag: member="Document::$d_mimetype" ref="o2" args="" --><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">Document::$d_mimetype </td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00033">33</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>. </td>
|
||
</tr>
|
||
</table>
|
||
<a class="anchor" name="o5"></a><!-- doxytag: member="Document::$d_number" ref="o5" args="" --><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">Document::$d_number </td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
number of the document
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00036">36</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>. </td>
|
||
</tr>
|
||
</table>
|
||
<a class="anchor" name="o7"></a><!-- doxytag: member="Document::$d_state" ref="o7" args="" --><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">Document::$<a class="el" href="action_8inc_8php.html#a7">d_state</a> </td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
<a class="el" href="action_8inc_8php.html#a7">document.d_state</a> status of the document
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00038">38</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>. </td>
|
||
</tr>
|
||
</table>
|
||
<a class="anchor" name="o0"></a><!-- doxytag: member="Document::$db" ref="o0" args="" --><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">Document::$db </td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
Database connexion var $d_id; /*!
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00030">30</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>. </td>
|
||
</tr>
|
||
</table>
|
||
<a class="anchor" name="o6"></a><!-- doxytag: member="Document::$md_id" ref="o6" args="" --><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">Document::$<a class="el" href="facture_8inc_8php.html#a26">md_id</a> </td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing="5" cellpadding="0" border="0">
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
document's template
|
||
<p>
|
||
Definition at line <a class="el" href="class__document_8php-source.html#l00037">37</a> of file <a class="el" href="class__document_8php-source.html">class_document.php</a>. </td>
|
||
</tr>
|
||
</table>
|
||
<hr>The documentation for this class was generated from the following file:<ul>
|
||
<li><a class="el" href="class__document_8php-source.html">class_document.php</a></ul>
|
||
</BODY>
|
||
</HTML>
|