altocompta/doc/developper/html/class__action_8php-source.html
2006-07-06 21:11:40 +00:00

814 lines
93 KiB
HTML
Raw Blame History

<!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: class_action.php Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.4 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">include</a></div>
<h1>class_action.php</h1><a href="class__action_8php.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 &lt;?
<a name="l00002"></a>00002 <span class="comment">/*</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of PhpCompta.</span>
<a name="l00004"></a>00004 <span class="comment"> *</span>
<a name="l00005"></a>00005 <span class="comment"> * PhpCompta is free software; you can redistribute it and/or modify</span>
<a name="l00006"></a>00006 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
<a name="l00007"></a>00007 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00008"></a>00008 <span class="comment"> * (at your option) any later version.</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * PhpCompta is distributed in the hope that it will be useful,</span>
<a name="l00011"></a>00011 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00012"></a>00012 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
<a name="l00013"></a>00013 <span class="comment"> * GNU General Public License for more details.</span>
<a name="l00014"></a>00014 <span class="comment"> *</span>
<a name="l00015"></a>00015 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
<a name="l00016"></a>00016 <span class="comment"> * along with PhpCompta; if not, write to the Free Software</span>
<a name="l00017"></a>00017 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
<a name="l00018"></a>00018 <span class="comment">*/</span>
<a name="l00019"></a>00019 <span class="comment">/* $Revision$ */</span>
<a name="l00020"></a>00020 <span class="comment">// Copyright Author Dany De Bontridder ddebontridder@yahoo.f</span>
<a name="l00021"></a>00021
<a name="l00022"></a>00022 require_once(<span class="stringliteral">"class_fiche.php"</span>);
<a name="l00023"></a>00023 require_once(<span class="stringliteral">"class_document.php"</span>);
<a name="l00024"></a>00024 require_once(<span class="stringliteral">"class_document_type.php"</span>);
<a name="l00025"></a>00025 require_once(<span class="stringliteral">"user_common.php"</span>);
<a name="l00046"></a><a class="code" href="classaction.html">00046</a> <span class="keyword">class </span><a class="code" href="classaction.html">action</a>
<a name="l00047"></a>00047 {
<a name="l00063"></a><a class="code" href="classaction.html#o0">00063</a> var <a class="code" href="classaction.html#o0">$db</a>;
<a name="l00064"></a><a class="code" href="classaction.html#o1">00064</a> var <a class="code" href="classaction.html#o1">$ag_comment</a>;
<a name="l00065"></a><a class="code" href="classaction.html#o2">00065</a> var <a class="code" href="classaction.html#o2">$ag_timestamp</a>;
<a name="l00066"></a><a class="code" href="classaction.html#o3">00066</a> var <a class="code" href="classaction.html#o3">$dt_id</a>;
<a name="l00067"></a><a class="code" href="classaction.html#o4">00067</a> var <a class="code" href="classaction.html#o4">$d_state</a>;
<a name="l00068"></a><a class="code" href="classaction.html#o5">00068</a> var <a class="code" href="classaction.html#o5">$d_number</a>;
<a name="l00069"></a><a class="code" href="classaction.html#o6">00069</a> var <a class="code" href="classaction.html#o6">$d_filename</a>;
<a name="l00070"></a><a class="code" href="classaction.html#o7">00070</a> var <a class="code" href="classaction.html#o7">$d_mimetype</a>;
<a name="l00071"></a><a class="code" href="classaction.html#o8">00071</a> var <a class="code" href="classaction.html#o8">$ag_title</a>;
<a name="l00072"></a><a class="code" href="classaction.html#o9">00072</a> var <a class="code" href="classaction.html#o9">$f_id</a>;
<a name="l00073"></a><a class="code" href="classaction.html#o10">00073</a> var <a class="code" href="classaction.html#o10">$ag_ref_ag_id</a>;
<a name="l00078"></a><a class="code" href="classaction.html#a0">00078</a> function <a class="code" href="classaction.html#a0">action</a> ($p_cn)
<a name="l00079"></a>00079 {
<a name="l00080"></a>00080 $this-&gt;db=$p_cn;
<a name="l00081"></a>00081 $this-&gt;<a class="code" href="facture_8inc_8php.html#a25">f_id</a>=0;
<a name="l00082"></a>00082
<a name="l00083"></a>00083 }
<a name="l00084"></a>00084 <span class="comment">//----------------------------------------------------------------------</span>
<a name="l00101"></a><a class="code" href="classaction.html#a1">00101</a> <span class="comment"></span> function <a class="code" href="classaction.html#a1">Display</a>($p_view,$p_gen)
<a name="l00102"></a>00102 {
<a name="l00103"></a>00103 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,'<a class="code" href="classaction.html#a1">Display</a>() :'.var_export($_POST,<span class="keyword">true</span>));
<a name="l00104"></a>00104 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,'<a class="code" href="classaction.html#a1">Display</a> $<span class="keyword">this</span> :'.var_export($<span class="keyword">this</span>,<span class="keyword">true</span>));
<a name="l00105"></a>00105
<a name="l00106"></a>00106
<a name="l00107"></a>00107 <span class="keywordflow">if</span> ( $p_view=='UPD')
<a name="l00108"></a>00108 {
<a name="l00109"></a>00109 $upd=<span class="keyword">true</span>;
<a name="l00110"></a>00110 $readonly=<span class="keyword">false</span>;
<a name="l00111"></a>00111 }
<a name="l00112"></a>00112 elseif ($p_view==<span class="stringliteral">"NEW"</span>)
<a name="l00113"></a>00113 {
<a name="l00114"></a>00114 $upd=<span class="keyword">false</span>;
<a name="l00115"></a>00115 $readonly=<span class="keyword">false</span>;
<a name="l00116"></a>00116 }
<a name="l00117"></a>00117 elseif ($p_view=='READ')
<a name="l00118"></a>00118 {
<a name="l00119"></a>00119 $upd=<span class="keyword">true</span>;
<a name="l00120"></a>00120 $readonly=<span class="keyword">true</span>;
<a name="l00121"></a>00121 }
<a name="l00122"></a>00122 <span class="keywordflow">else</span>
<a name="l00123"></a>00123 {
<a name="l00124"></a>00124 <a class="code" href="balance_8php.html#a0">exit</a>('class_action'.__LINE__.'Action::Display error unknown parameter'.$p_view);
<a name="l00125"></a>00125
<a name="l00126"></a>00126 }
<a name="l00127"></a>00127 <span class="comment">// Compute the widget</span>
<a name="l00128"></a>00128 <span class="comment">// Date </span>
<a name="l00129"></a>00129 $date=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"text"</span>);
<a name="l00130"></a>00130 $date-&gt;readonly=$readonly;
<a name="l00131"></a>00131 $date-&gt;name=<span class="stringliteral">"ag_timestamp"</span>;
<a name="l00132"></a>00132 $date-&gt;value=$this-&gt;<a class="code" href="action_8inc_8php.html#a6">ag_timestamp</a>;
<a name="l00133"></a>00133
<a name="l00134"></a>00134
<a name="l00135"></a>00135 <span class="comment">// for insert mode only</span>
<a name="l00136"></a>00136 <span class="keywordflow">if</span> ( $upd == <span class="keyword">false</span> )
<a name="l00137"></a>00137 {
<a name="l00138"></a>00138 <span class="comment">// Doc Type</span>
<a name="l00139"></a>00139 $doc_type=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"select"</span>);
<a name="l00140"></a>00140 $doc_type-&gt;name=<span class="stringliteral">"dt_id"</span>;
<a name="l00141"></a>00141 $doc_type-&gt;value=<a class="code" href="ac__common_8php.html#a12">make_array</a>($this-&gt;db,<span class="stringliteral">"select dt_id,dt_value from document_type where dt_id in ("</span>.ACTION.<span class="stringliteral">")"</span>);
<a name="l00142"></a>00142 $doc_type-&gt;selected=$this-&gt;<a class="code" href="action_8inc_8php.html#a8">dt_id</a>;
<a name="l00143"></a>00143 $doc_type-&gt;readonly=<span class="keyword">false</span>;
<a name="l00144"></a>00144 $str_doc_type=$doc_type-&gt;IOValue();
<a name="l00145"></a>00145 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,var_export($doc_type,<span class="keyword">true</span>));
<a name="l00146"></a>00146 }
<a name="l00147"></a>00147 <span class="keywordflow">else</span> {
<a name="l00148"></a>00148 <span class="comment">// Doc Type</span>
<a name="l00149"></a>00149 $doc_type=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"hidden"</span>);
<a name="l00150"></a>00150 $doc_type-&gt;name=<span class="stringliteral">"dt_id"</span>;
<a name="l00151"></a>00151 $doc_type-&gt;value=$this-&gt;<a class="code" href="action_8inc_8php.html#a8">dt_id</a>;
<a name="l00152"></a>00152 $str_doc_type=$doc_type-&gt;IOValue().<span class="stringliteral">" "</span>.<a class="code" href="postgres_8php.html#a25">getDbValue</a>($this-&gt;db,<span class="stringliteral">"select dt_value from document_type where dt_id="</span>.$this-&gt;dt_id);
<a name="l00153"></a>00153 }
<a name="l00154"></a>00154
<a name="l00155"></a>00155 <span class="comment">// Description</span>
<a name="l00156"></a>00156 <a class="code" href="admin__repo_8php.html#a9">$desc</a>=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>('RICHTEXT');
<a name="l00157"></a>00157 <a class="code" href="admin__repo_8php.html#a9">$desc</a>-&gt;width=500;
<a name="l00158"></a>00158 <a class="code" href="admin__repo_8php.html#a9">$desc</a>-&gt;heigh=250;
<a name="l00159"></a>00159 <a class="code" href="admin__repo_8php.html#a9">$desc</a>-&gt;name=<span class="stringliteral">"ag_comment"</span>;
<a name="l00160"></a>00160 <a class="code" href="admin__repo_8php.html#a9">$desc</a>-&gt;readonly=$readonly;
<a name="l00161"></a>00161 <a class="code" href="admin__repo_8php.html#a9">$desc</a>-&gt;value=urldecode($this-&gt;ag_comment);
<a name="l00162"></a>00162
<a name="l00163"></a>00163 <span class="comment">// state</span>
<a name="l00164"></a>00164 <span class="comment">// Retrieve the value</span>
<a name="l00165"></a>00165 <span class="keywordflow">if</span> ( $p_view != 'READ' )
<a name="l00166"></a>00166 {
<a name="l00167"></a>00167 <a class="code" href="balance_8php.html#a10">$a</a>=<a class="code" href="ac__common_8php.html#a12">make_array</a>($this-&gt;db,<span class="stringliteral">"select s_id,s_value from document_state "</span>);
<a name="l00168"></a>00168 $state=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"select"</span>);
<a name="l00169"></a>00169 $state-&gt;readonly=$readonly;
<a name="l00170"></a>00170 $state-&gt;name=<span class="stringliteral">"d_state"</span>;
<a name="l00171"></a>00171 $state-&gt;value=<a class="code" href="balance_8php.html#a10">$a</a>;
<a name="l00172"></a>00172 $state-&gt;selected=$this-&gt;<a class="code" href="action_8inc_8php.html#a7">d_state</a>;
<a name="l00173"></a>00173 $str_state=$state-&gt;IOValue();
<a name="l00174"></a>00174 } <span class="keywordflow">else</span> {
<a name="l00175"></a>00175 $str_state=<a class="code" href="postgres_8php.html#a25">getDbValue</a>($this-&gt;db,<span class="stringliteral">"select s_value from document_state where s_id="</span>.$this-&gt;d_state);
<a name="l00176"></a>00176 $g=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"hidden"</span>);
<a name="l00177"></a>00177 $str_state.=$g-&gt;IOValue('<a class="code" href="action_8inc_8php.html#a7">d_state</a>',$this-&gt;d_state);
<a name="l00178"></a>00178 }
<a name="l00179"></a>00179 <span class="comment">// Retrieve the value if there is an attached doc</span>
<a name="l00180"></a>00180 $doc_ref=<span class="stringliteral">""</span>;
<a name="l00181"></a>00181 <span class="comment">// Document id</span>
<a name="l00182"></a>00182
<a name="l00183"></a>00183 $h2=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"hidden"</span>);
<a name="l00184"></a>00184 $h2-&gt;name=<span class="stringliteral">"d_id"</span>;
<a name="l00185"></a>00185 $h2-&gt;value=$this-&gt;<a class="code" href="action_8inc_8php.html#a12">d_id</a>;
<a name="l00186"></a>00186
<a name="l00187"></a>00187 <span class="keywordflow">if</span> ( $this-&gt;d_id != 0 &amp;&amp; $this-&gt;d_id != <span class="stringliteral">""</span> )
<a name="l00188"></a>00188 {
<a name="l00189"></a>00189 $h2-&gt;readonly=($p_view=='NEW')?<span class="keyword">false</span>:<span class="keyword">true</span>;
<a name="l00190"></a>00190 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>=<span class="keyword">new</span> <a class="code" href="classDocument.html">Document</a>($this-&gt;db,$this-&gt;d_id);
<a name="l00191"></a>00191 <a class="code" href="action_8inc_8php.html#a23">$d_id</a>=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"hidden"</span>);
<a name="l00192"></a>00192 $doc_ref=<span class="stringliteral">"&lt;p&gt; Document "</span>.$doc-&gt;a_ref().'&lt;/p&gt;';
<a name="l00193"></a>00193 $doc_ref.=$h2-&gt;IOValue().$d_id-&gt;IOValue('<a class="code" href="action_8inc_8php.html#a12">d_id</a>',$this-&gt;d_id);
<a name="l00194"></a>00194
<a name="l00195"></a>00195 }
<a name="l00196"></a>00196
<a name="l00197"></a>00197
<a name="l00198"></a>00198 <span class="comment">// title</span>
<a name="l00199"></a>00199 $title=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"text"</span>);
<a name="l00200"></a>00200 $title-&gt;readonly=$readonly;
<a name="l00201"></a>00201 $title-&gt;name=<span class="stringliteral">"ag_title"</span>;
<a name="l00202"></a>00202 $title-&gt;value=<a class="code" href="ac__common_8php.html#a9">FormatString</a>($this-&gt;ag_title);
<a name="l00203"></a>00203 $title-&gt;size=80;
<a name="l00204"></a>00204
<a name="l00205"></a>00205 <span class="comment">// ag_ref</span>
<a name="l00206"></a>00206 <span class="comment">// Always false for update</span>
<a name="l00207"></a>00207 $ag_ref=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"text"</span>);
<a name="l00208"></a>00208 $ag_ref-&gt;readonly=<span class="keyword">true</span>;
<a name="l00209"></a>00209 $ag_ref-&gt;name=<span class="stringliteral">"ag_ref"</span>;
<a name="l00210"></a>00210 $ag_ref-&gt;value=<a class="code" href="ac__common_8php.html#a9">FormatString</a>($this-&gt;ag_ref);
<a name="l00211"></a>00211 $client_label=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"span"</span>);
<a name="l00212"></a>00212
<a name="l00213"></a>00213 <span class="comment">// f_id_dest destination</span>
<a name="l00214"></a>00214 <span class="keywordflow">if</span> ( $this-&gt;qcode_dest != '- <a class="code" href="constant_8php.html#a43">ERROR</a> -' &amp;&amp; strlen(trim($this-&gt;qcode_dest)) != 0)
<a name="l00215"></a>00215 {
<a name="l00216"></a>00216 $tiers=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this-&gt;db);
<a name="l00217"></a>00217 $tiers-&gt;GetByQCode($this-&gt;qcode_dest);
<a name="l00218"></a>00218 $qcode_dest_label=$tiers-&gt;strAttribut(1);
<a name="l00219"></a>00219 } <span class="keywordflow">else</span> {
<a name="l00220"></a>00220 <span class="comment">// echo "f_id $this-&gt;f_id";</span>
<a name="l00221"></a>00221 $qcode_dest_label=($this-&gt;<a class="code" href="action_8inc_8php.html#a14">f_id_dest</a>==0 || trim($this-&gt;qcode_dest)==<span class="stringliteral">""</span>)?'Interne <span class="charliteral">':'</span>Error';
<a name="l00222"></a>00222 }
<a name="l00223"></a>00223
<a name="l00224"></a>00224 <span class="comment">// f_id_exp sender</span>
<a name="l00225"></a>00225 <span class="keywordflow">if</span> ( $this-&gt;qcode_exp != '- <a class="code" href="constant_8php.html#a43">ERROR</a> -' &amp;&amp; strlen(trim($this-&gt;qcode_exp)) != 0)
<a name="l00226"></a>00226 {
<a name="l00227"></a>00227 $tiers=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this-&gt;db);
<a name="l00228"></a>00228 $tiers-&gt;GetByQCode($this-&gt;qcode_exp);
<a name="l00229"></a>00229 $qcode_exp_label=$tiers-&gt;strAttribut(1);
<a name="l00230"></a>00230 } <span class="keywordflow">else</span> {
<a name="l00231"></a>00231 $qcode_exp_label=($this-&gt;<a class="code" href="action_8inc_8php.html#a15">f_id_exp</a>==0 || trim($this-&gt;qcode_exp)==<span class="stringliteral">""</span>)?'Interne <span class="charliteral">':'</span>Error';
<a name="l00232"></a>00232 }
<a name="l00233"></a>00233
<a name="l00234"></a>00234 $h_ag_id=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"hidden"</span>);
<a name="l00235"></a>00235 <span class="comment">// if concerns another action : show the link otherwise nothing</span>
<a name="l00236"></a>00236 $lag_ref_ag_id=<span class="stringliteral">" X / XX "</span>;
<a name="l00237"></a>00237
<a name="l00238"></a>00238 <span class="keywordflow">if</span> ( $this-&gt;ag_ref_ag_id != 0 )
<a name="l00239"></a>00239 {
<a name="l00240"></a>00240 <span class="comment">// $this-&gt;GetAgRef("ag_ref_ag_id")."&lt;/A&gt;";</span>
<a name="l00241"></a>00241
<a name="l00242"></a>00242 $lag_ref_ag_id='&lt;a <span class="keyword">class</span>=<span class="stringliteral">"mtitle"</span> href=<span class="stringliteral">"commercial.php?p_action=suivi_courrier&amp;sa=detail&amp;ag_id='.</span>
<a name="l00243"></a>00243 <span class="stringliteral"> $this-&gt;ag_ref_ag_id.'"</span>&gt;'.
<a name="l00244"></a>00244 <a class="code" href="postgres_8php.html#a25">getDbValue</a>($this-&gt;db,<span class="stringliteral">"select ag_ref from action_gestion where ag_id="</span>.$this-&gt;ag_ref_ag_id).
<a name="l00245"></a>00245 <span class="stringliteral">"&lt;/A&gt;"</span>;
<a name="l00246"></a>00246 }
<a name="l00247"></a>00247 <span class="comment">// sender</span>
<a name="l00248"></a>00248 <a class="code" href="admin_8inc_8php.html#a4">$w</a>=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>('js_search_only');
<a name="l00249"></a>00249 <a class="code" href="admin_8inc_8php.html#a4">$w</a>-&gt;readonly=$readonly;
<a name="l00250"></a>00250 <a class="code" href="admin_8inc_8php.html#a4">$w</a>-&gt;name='<a class="code" href="action_8inc_8php.html#a9">qcode_exp</a>';
<a name="l00251"></a>00251 <a class="code" href="admin_8inc_8php.html#a4">$w</a>-&gt;value=($this-&gt;<a class="code" href="action_8inc_8php.html#a15">f_id_exp</a> != 0)?$this-&gt;<a class="code" href="action_8inc_8php.html#a9">qcode_exp</a>:<span class="stringliteral">""</span>;
<a name="l00252"></a>00252 <a class="code" href="admin_8inc_8php.html#a4">$w</a>-&gt;label=<span class="stringliteral">""</span>;
<a name="l00253"></a>00253 <a class="code" href="admin_8inc_8php.html#a4">$w</a>-&gt;extra='4,8,9,14,16';
<a name="l00254"></a>00254 <a class="code" href="bank_8inc_8php.html#a19">$sp</a>= <span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"span"</span>);
<a name="l00255"></a>00255 $h_agrefid=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>('hidden');
<a name="l00256"></a>00256 <span class="comment">// destination</span>
<a name="l00257"></a>00257 $wdest=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>('js_search_only');
<a name="l00258"></a>00258 $wdest-&gt;readonly=$readonly;
<a name="l00259"></a>00259 $wdest-&gt;name='<a class="code" href="action_8inc_8php.html#a10">qcode_dest</a>';
<a name="l00260"></a>00260 $wdest-&gt;value=($this-&gt;<a class="code" href="action_8inc_8php.html#a14">f_id_dest</a> != 0)?$this-&gt;<a class="code" href="action_8inc_8php.html#a10">qcode_dest</a>:<span class="stringliteral">""</span>;
<a name="l00261"></a>00261 $wdest-&gt;label=<span class="stringliteral">""</span>;
<a name="l00262"></a>00262 $wdest-&gt;extra='4,8,9,14,16';
<a name="l00263"></a>00263 $spdest= <span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"span"</span>);
<a name="l00264"></a>00264 $h_agrefid=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>('hidden');
<a name="l00265"></a>00265 $str_ag_ref=<span class="stringliteral">"&lt;b&gt;"</span>.(($this-&gt;ag_ref != <span class="stringliteral">""</span>)?$this-&gt;<a class="code" href="action_8inc_8php.html#a16">ag_ref</a>:<span class="stringliteral">" Nouveau "</span>).<span class="stringliteral">"&lt;/b&gt;"</span>;
<a name="l00266"></a>00266 <span class="comment">// Preparing the return string</span>
<a name="l00267"></a>00267 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<span class="stringliteral">""</span>;
<a name="l00268"></a>00268 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<a class="code" href="constant_8php.html#a85">JS_SEARCH_CARD</a>;
<a name="l00269"></a>00269 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.= '&lt;p&gt;Date :'.$date-&gt;IOValue().<span class="stringliteral">" Reference "</span>.$str_ag_ref;
<a name="l00270"></a>00270 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&amp;nbsp; Concerne :"</span>.$lag_ref_ag_id.
<a name="l00271"></a>00271 ' Type d\' <a class="code" href="classaction.html">action</a>';
<a name="l00272"></a>00272 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,<span class="stringliteral">"str_doc_type $str_doc_type"</span>);
<a name="l00273"></a>00273 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.= $str_doc_type;
<a name="l00274"></a>00274
<a name="l00275"></a>00275 <span class="comment">// state</span>
<a name="l00276"></a>00276 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">" Etat :"</span>.$str_state.<span class="stringliteral">"&lt;/p&gt;"</span>;
<a name="l00277"></a>00277
<a name="l00278"></a>00278
<a name="l00279"></a>00279 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.= <span class="stringliteral">"&lt;p&gt; "</span>;
<a name="l00280"></a>00280 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"Exp&amp;eacute;diteur : "</span>.$w-&gt;IOValue();
<a name="l00281"></a>00281 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<a class="code" href="bank_8inc_8php.html#a19">$sp</a>-&gt;IOValue('qcode_exp_label',$qcode_exp_label).<span class="stringliteral">"&lt;/TD&gt;&lt;/TR&gt;"</span>;
<a name="l00282"></a>00282
<a name="l00283"></a>00283 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"Destinataire :"</span>.$wdest-&gt;IOValue();
<a name="l00284"></a>00284 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=$spdest-&gt;IOValue('qcode_dest_label',$qcode_dest_label).<span class="stringliteral">"&lt;/TD&gt;&lt;/TR&gt;"</span>;
<a name="l00285"></a>00285
<a name="l00286"></a>00286 <span class="comment">// $r.=' Ref :'.$ag_ref-&gt;IOValue();</span>
<a name="l00287"></a>00287 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;/p&gt;"</span>;
<a name="l00288"></a>00288 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,' <a class="code" href="action_8inc_8php.html#a4">ag_id</a> is '.$this-&gt;ag_id);
<a name="l00289"></a>00289
<a name="l00290"></a>00290 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.= <span class="stringliteral">"&lt;p&gt; Titre : "</span>.$title-&gt;IOValue();
<a name="l00291"></a>00291 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.= $doc_ref;
<a name="l00292"></a>00292 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.= <span class="stringliteral">"&lt;p&gt;"</span>.$desc-&gt;IOValue().<span class="stringliteral">"&lt;/p&gt;"</span>;
<a name="l00293"></a>00293
<a name="l00294"></a>00294 <span class="comment">//hidden</span>
<a name="l00295"></a>00295 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;p&gt;"</span>;
<a name="l00296"></a>00296 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=$h2-&gt;IOValue();
<a name="l00297"></a>00297 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=$h_agrefid-&gt;IOValue(<span class="stringliteral">"ag_ref_ag_id"</span>,$this-&gt;ag_ref_ag_id);
<a name="l00298"></a>00298 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=$h_ag_id-&gt;IOValue('<a class="code" href="action_8inc_8php.html#a4">ag_id</a>',$this-&gt;ag_id);
<a name="l00299"></a>00299 $hidden=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>('hidden');
<a name="l00300"></a>00300 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=$hidden-&gt;IOValue('<a class="code" href="action_8inc_8php.html#a14">f_id_dest</a>',$this-&gt;f_id_dest);
<a name="l00301"></a>00301 $hidden2=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>('hidden');
<a name="l00302"></a>00302 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=$hidden2-&gt;IOValue('<a class="code" href="action_8inc_8php.html#a15">f_id_exp</a>',$this-&gt;f_id_exp);
<a name="l00303"></a>00303 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;/p&gt;"</span>;
<a name="l00304"></a>00304
<a name="l00305"></a>00305 <span class="comment">// show the list of the concern operation</span>
<a name="l00306"></a>00306 <span class="keywordflow">if</span> ( <a class="code" href="postgres_8php.html#a10">CountSql</a>($this-&gt;db,'select * from action_gestion where <a class="code" href="action_8inc_8php.html#a13">ag_ref_ag_id</a>!=0 and <a class="code" href="action_8inc_8php.html#a13">ag_ref_ag_id</a>='.$this-&gt;ag_id.
<a name="l00307"></a>00307 <span class="stringliteral">" limit 2"</span>) &gt; 0 )
<a name="l00308"></a>00308 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=$this-&gt;<a class="code" href="classaction.html#a6">myList</a>(<a class="code" href="constant_8php.html#a44">ACTION</a>,<span class="stringliteral">" and ag_ref_ag_id="</span>.$this-&gt;ag_id);
<a name="l00309"></a>00309 <span class="keywordflow">return</span> <a class="code" href="bank_8inc_8php.html#a29">$r</a>;
<a name="l00310"></a>00310
<a name="l00311"></a>00311 }
<a name="l00312"></a>00312 <span class="comment">//----------------------------------------------------------------------</span>
<a name="l00315"></a><a class="code" href="classaction.html#a2">00315</a> <span class="comment"></span> function <a class="code" href="classaction.html#a2">get</a>()
<a name="l00316"></a>00316 {
<a name="l00317"></a>00317 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,'Action::Get() ');
<a name="l00318"></a>00318 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"select ag_id, ag_comment,to_char (ag_timestamp,'DD-MM-YYYY') as ag_timestamp,"</span>.
<a name="l00319"></a>00319 <span class="stringliteral">" f_id_dest,f_id_exp,ag_title,ag_comment,ag_ref,d_id,ag_type,d_state, "</span>.
<a name="l00320"></a>00320 <span class="stringliteral">" ag_ref_ag_id "</span>.
<a name="l00321"></a>00321 <span class="stringliteral">" from action_gestion left join document using (ag_id) where ag_id="</span>.$this-&gt;ag_id;
<a name="l00322"></a>00322 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,$sql);
<a name="l00323"></a>00323 <a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>=pg_fetch_all($r);
<a name="l00324"></a>00324 <span class="keywordflow">if</span> ( $row==<span class="keyword">false</span>) <span class="keywordflow">return</span>;
<a name="l00325"></a>00325 $this-&gt;<a class="code" href="action_8inc_8php.html#a5">ag_comment</a>=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>[0]['<a class="code" href="action_8inc_8php.html#a5">ag_comment</a>'];
<a name="l00326"></a>00326 $this-&gt;<a class="code" href="action_8inc_8php.html#a6">ag_timestamp</a>=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>[0]['<a class="code" href="action_8inc_8php.html#a6">ag_timestamp</a>'];
<a name="l00327"></a>00327 $this-&gt;<a class="code" href="action_8inc_8php.html#a14">f_id_dest</a>=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>[0]['<a class="code" href="action_8inc_8php.html#a14">f_id_dest</a>'];
<a name="l00328"></a>00328 $this-&gt;<a class="code" href="action_8inc_8php.html#a15">f_id_exp</a>=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>[0]['<a class="code" href="action_8inc_8php.html#a15">f_id_exp</a>'];
<a name="l00329"></a>00329 $this-&gt;<a class="code" href="action_8inc_8php.html#a11">ag_title</a>=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>[0]['<a class="code" href="action_8inc_8php.html#a11">ag_title</a>'];
<a name="l00330"></a>00330 $this-&gt;ag_type=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>[0]['ag_type'];
<a name="l00331"></a>00331 $this-&gt;<a class="code" href="action_8inc_8php.html#a16">ag_ref</a>=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>[0]['<a class="code" href="action_8inc_8php.html#a16">ag_ref</a>'];
<a name="l00332"></a>00332 $this-&gt;<a class="code" href="action_8inc_8php.html#a13">ag_ref_ag_id</a>=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>[0]['<a class="code" href="action_8inc_8php.html#a13">ag_ref_ag_id</a>'];
<a name="l00333"></a>00333 $this-&gt;<a class="code" href="action_8inc_8php.html#a12">d_id</a>=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>[0]['<a class="code" href="action_8inc_8php.html#a12">d_id</a>'];
<a name="l00334"></a>00334 <span class="comment">//</span>
<a name="l00335"></a>00335 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,' <a class="code" href="classDocument.html">Document</a> <span class="keywordtype">id</span> = '.$this-&gt;d_id);
<a name="l00336"></a>00336 <span class="comment">// if there is no document set 0 to d_id</span>
<a name="l00337"></a>00337 <span class="keywordflow">if</span> ( $this-&gt;d_id == <span class="stringliteral">""</span> )
<a name="l00338"></a>00338 $this-&gt;<a class="code" href="action_8inc_8php.html#a12">d_id</a>=0;
<a name="l00339"></a>00339 <span class="comment">// if there is a document fill the object</span>
<a name="l00340"></a>00340 <span class="keywordflow">if</span> ($this-&gt;d_id != 0 )
<a name="l00341"></a>00341 {
<a name="l00342"></a>00342 $this-&gt;state=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>[<span class="charliteral">'0'</span>]['<a class="code" href="action_8inc_8php.html#a7">d_state</a>'];
<a name="l00343"></a>00343 $this-&gt;<a class="code" href="action_8inc_8php.html#a7">d_state</a>=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>[0]['<a class="code" href="action_8inc_8php.html#a7">d_state</a>'];
<a name="l00344"></a>00344 }
<a name="l00345"></a>00345 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,' After test <a class="code" href="classDocument.html">Document</a> <span class="keywordtype">id</span> = '.$this-&gt;d_id);
<a name="l00346"></a>00346 $this-&gt;<a class="code" href="action_8inc_8php.html#a8">dt_id</a>=$this-&gt;ag_type;
<a name="l00347"></a>00347 $adest=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this-&gt;db,$this-&gt;f_id_dest);
<a name="l00348"></a>00348 $this-&gt;<a class="code" href="action_8inc_8php.html#a10">qcode_dest</a>=$adest-&gt;strAttribut(<a class="code" href="constant_8php.html#a78">ATTR_DEF_QUICKCODE</a>);
<a name="l00349"></a>00349 $aexp=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this-&gt;db,$this-&gt;f_id_exp);
<a name="l00350"></a>00350 $this-&gt;<a class="code" href="action_8inc_8php.html#a9">qcode_exp</a>=$aexp-&gt;strAttribut(<a class="code" href="constant_8php.html#a78">ATTR_DEF_QUICKCODE</a>);
<a name="l00351"></a>00351
<a name="l00352"></a>00352 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,'Detail end () :'.var_export($_POST,<span class="keyword">true</span>));
<a name="l00353"></a>00353 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,'Detail $<span class="keyword">this</span> :'.var_export($<span class="keyword">this</span>,<span class="keyword">true</span>));
<a name="l00354"></a>00354
<a name="l00355"></a>00355 }
<a name="l00364"></a><a class="code" href="classaction.html#a3">00364</a> function <a class="code" href="classaction.html#a3">Confirm</a>()
<a name="l00365"></a>00365 {
<a name="l00366"></a>00366 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,'confirm() :'.var_export($_POST,<span class="keyword">true</span>));
<a name="l00367"></a>00367 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,'confirm $<span class="keyword">this</span> :'.var_export($<span class="keyword">this</span>,<span class="keyword">true</span>));
<a name="l00369"></a>00369 <span class="keywordflow">if</span> ( <a class="code" href="ac__common_8php.html#a3">isDate</a>($this-&gt;ag_timestamp) == null )
<a name="l00370"></a>00370 {
<a name="l00371"></a>00371 <span class="comment">// if the date is invalid, default date is today</span>
<a name="l00372"></a>00372 $this-&gt;<a class="code" href="action_8inc_8php.html#a6">ag_timestamp</a>=date(<span class="stringliteral">"d.m.Y"</span>);
<a name="l00373"></a>00373 }
<a name="l00374"></a>00374 <span class="comment">// Compute the widget</span>
<a name="l00375"></a>00375 <span class="comment">// Date </span>
<a name="l00376"></a>00376 $date=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"text"</span>);
<a name="l00377"></a>00377 $date-&gt;readonly=<span class="keyword">true</span>;
<a name="l00378"></a>00378 $date-&gt;name=<span class="stringliteral">"ag_timestamp"</span>;
<a name="l00379"></a>00379 $date-&gt;value=$this-&gt;<a class="code" href="action_8inc_8php.html#a6">ag_timestamp</a>;
<a name="l00380"></a>00380 <span class="comment">// Doc Type</span>
<a name="l00381"></a>00381 $doc_type=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"hidden"</span>);
<a name="l00382"></a>00382 $doc_type-&gt;name=<span class="stringliteral">"dt_id"</span>;
<a name="l00383"></a>00383 $doc_type-&gt;value=$this-&gt;<a class="code" href="action_8inc_8php.html#a8">dt_id</a>;
<a name="l00384"></a>00384 <a class="code" href="balance_8php.html#a10">$a</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,<span class="stringliteral">"select dt_value from document_type where dt_id="</span>.$this-&gt;dt_id);
<a name="l00385"></a>00385 $v=pg_fetch_array($a,0);
<a name="l00386"></a>00386 $str_type=$v[0];
<a name="l00387"></a>00387 <span class="keywordflow">if</span> ( isset ($_REQUEST['url']))
<a name="l00388"></a>00388 {
<a name="l00389"></a>00389 <a class="code" href="action_8inc_8php.html#a1">$retour</a>=sprintf('&lt;A HREF=<span class="stringliteral">"%s"</span>&gt;&lt;input type=<span class="stringliteral">"button"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"Retour"</span>&gt;&lt;/A&gt;',urldecode($_REQUEST['url']));
<a name="l00390"></a>00390 <a class="code" href="action_8inc_8php.html#a2">$h_url</a>=sprintf('&lt;input type=<span class="stringliteral">"hidden"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"url"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"%s"</span>&gt;',urldecode($_REQUEST['url']));
<a name="l00391"></a>00391 }
<a name="l00392"></a>00392 <span class="keywordflow">else</span>
<a name="l00393"></a>00393 {
<a name="l00394"></a>00394 <a class="code" href="action_8inc_8php.html#a1">$retour</a>=<span class="stringliteral">""</span>;
<a name="l00395"></a>00395 <a class="code" href="action_8inc_8php.html#a2">$h_url</a>=<span class="stringliteral">""</span>;
<a name="l00396"></a>00396 }
<a name="l00397"></a>00397
<a name="l00398"></a>00398 <span class="comment">// state</span>
<a name="l00399"></a>00399 <a class="code" href="balance_8php.html#a10">$a</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,<span class="stringliteral">"select s_value from document_state where s_id="</span>.$this-&gt;d_state);
<a name="l00400"></a>00400 $v=pg_fetch_array($a,0);
<a name="l00401"></a>00401 $str_state=$v[0];
<a name="l00402"></a>00402 $state=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"hidden"</span>);
<a name="l00403"></a>00403 $state-&gt;name=<span class="stringliteral">"d_state"</span>;
<a name="l00404"></a>00404 $state-&gt;value=$this-&gt;<a class="code" href="action_8inc_8php.html#a7">d_state</a>;
<a name="l00405"></a>00405
<a name="l00406"></a>00406 <span class="comment">// title</span>
<a name="l00407"></a>00407 $title=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"text"</span>);
<a name="l00408"></a>00408 $title-&gt;readonly=<span class="keyword">true</span>;
<a name="l00409"></a>00409 $title-&gt;name=<span class="stringliteral">"ag_title"</span>;
<a name="l00410"></a>00410 $title-&gt;value=<a class="code" href="ac__common_8php.html#a9">FormatString</a>($this-&gt;ag_title);
<a name="l00411"></a>00411
<a name="l00412"></a>00412 <span class="comment">// Description</span>
<a name="l00413"></a>00413 <a class="code" href="admin__repo_8php.html#a9">$desc</a>=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>('textarea');
<a name="l00414"></a>00414 <a class="code" href="admin__repo_8php.html#a9">$desc</a>-&gt;name=<span class="stringliteral">"ag_comment"</span>;
<a name="l00415"></a>00415 <a class="code" href="admin__repo_8php.html#a9">$desc</a>-&gt;readonly=<span class="stringliteral">" disabled "</span>;
<a name="l00416"></a>00416 <a class="code" href="admin__repo_8php.html#a9">$desc</a>-&gt;value=$this-&gt;<a class="code" href="action_8inc_8php.html#a5">ag_comment</a>;
<a name="l00417"></a>00417 <span class="comment">// Propose to generate a document</span>
<a name="l00418"></a>00418 $gen=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a> (<span class="stringliteral">"checkbox"</span>);
<a name="l00419"></a>00419 $gen-&gt;name=<span class="stringliteral">"p_gen"</span>;
<a name="l00420"></a>00420 $doc_gen=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"select"</span>);
<a name="l00421"></a>00421 $doc_gen-&gt;name=<span class="stringliteral">"gen_doc"</span>;
<a name="l00422"></a>00422 $doc_gen-&gt;value=<a class="code" href="ac__common_8php.html#a12">make_array</a>($this-&gt;db,
<a name="l00423"></a>00423 <span class="stringliteral">"select md_id,md_name from document_modele where md_type="</span>.$this-&gt;dt_id);
<a name="l00424"></a>00424
<a name="l00425"></a>00425 $h_agrefid=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>('hidden');
<a name="l00426"></a>00426
<a name="l00427"></a>00427 <span class="comment">// f_id</span>
<a name="l00428"></a>00428 <span class="keywordflow">if</span> ( trim($this-&gt;qcode_dest) ==<span class="stringliteral">""</span>)
<a name="l00429"></a>00429 {
<a name="l00430"></a>00430 <span class="comment">// internal document</span>
<a name="l00431"></a>00431 $this-&gt;<a class="code" href="action_8inc_8php.html#a14">f_id_dest</a>=0; <span class="comment">// internal document</span>
<a name="l00432"></a>00432 $namedest=<span class="stringliteral">"interne"</span>;
<a name="l00433"></a>00433 }
<a name="l00434"></a>00434 <span class="keywordflow">else</span> <span class="comment">// ( trim($this-&gt;qcode_dest) !="" )</span>
<a name="l00435"></a>00435 {
<a name="l00436"></a>00436 $tiers=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this-&gt;db);
<a name="l00437"></a>00437 $tiers-&gt;GetByQCode($this-&gt;qcode_dest);
<a name="l00438"></a>00438 $this-&gt;<a class="code" href="action_8inc_8php.html#a14">f_id_dest</a>=$tiers-&gt;id;
<a name="l00439"></a>00439 $namedest=$tiers-&gt;strAttribut(1);
<a name="l00440"></a>00440 <span class="keywordflow">if</span> ( $namedest == '- <a class="code" href="constant_8php.html#a43">ERROR</a> -') $this-&gt;<a class="code" href="action_8inc_8php.html#a14">f_id_dest</a>=-1;
<a name="l00441"></a>00441 }
<a name="l00442"></a>00442
<a name="l00443"></a>00443 <span class="comment">// f_id</span>
<a name="l00444"></a>00444 <span class="keywordflow">if</span> ( trim($this-&gt;qcode_exp) ==<span class="stringliteral">""</span>)
<a name="l00445"></a>00445 {
<a name="l00446"></a>00446 <span class="comment">// internal document</span>
<a name="l00447"></a>00447 $this-&gt;<a class="code" href="action_8inc_8php.html#a15">f_id_exp</a>=0; <span class="comment">// internal document</span>
<a name="l00448"></a>00448 $nameexp=<span class="stringliteral">"interne"</span>;
<a name="l00449"></a>00449 }
<a name="l00450"></a>00450 <span class="keywordflow">else</span> <span class="comment">// ( trim($this-&gt;qcode_exp) !="" )</span>
<a name="l00451"></a>00451 {
<a name="l00452"></a>00452 $tiers=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this-&gt;db);
<a name="l00453"></a>00453 $tiers-&gt;GetByQCode($this-&gt;qcode_exp);
<a name="l00454"></a>00454 $this-&gt;<a class="code" href="action_8inc_8php.html#a15">f_id_exp</a>=$tiers-&gt;id;
<a name="l00455"></a>00455 $nameexp=$tiers-&gt;strAttribut(1);
<a name="l00456"></a>00456 <span class="keywordflow">if</span> ( $nameexp == '- <a class="code" href="constant_8php.html#a43">ERROR</a> -') $this-&gt;<a class="code" href="action_8inc_8php.html#a15">f_id_exp</a>=-1;
<a name="l00457"></a>00457 }
<a name="l00458"></a>00458
<a name="l00459"></a>00459
<a name="l00460"></a>00460
<a name="l00461"></a>00461 <span class="comment">// Preparing the return string</span>
<a name="l00462"></a>00462 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<a class="code" href="action_8inc_8php.html#a1">$retour</a>.<span class="stringliteral">"&lt;form method=\"post\"&gt;"</span>;
<a name="l00463"></a>00463 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;p&gt;Date : "</span>.$date-&gt;IOValue().<span class="stringliteral">"&lt;/p&gt;"</span>;
<a name="l00464"></a>00464 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;p&gt;Etat $str_state"</span>.$state-&gt;IOValue().<span class="stringliteral">"&lt;/p&gt;"</span>;
<a name="l00465"></a>00465 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;p&gt;Type du document $str_type"</span>.$doc_type-&gt;IOValue().<span class="stringliteral">"&lt;/p&gt;"</span>;
<a name="l00466"></a>00466 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;p&gt; Expediteur : "</span>.$this-&gt;qcode_exp.<span class="stringliteral">" "</span>.$nameexp.'&lt;/p&gt;';
<a name="l00467"></a>00467 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;p&gt; Destinataire : "</span>.$this-&gt;qcode_dest.<span class="stringliteral">" "</span>.$namedest.'&lt;/p&gt;';
<a name="l00468"></a>00468 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;p&gt; Titre : "</span>.$title-&gt;IOValue();
<a name="l00469"></a>00469 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;p&gt;Description :"</span>.$desc-&gt;IOValue().<span class="stringliteral">"&lt;/p&gt;"</span>;
<a name="l00470"></a>00470
<a name="l00471"></a>00471 <span class="comment">// if no document exist for this type then do not display the question</span>
<a name="l00472"></a>00472 <span class="keywordflow">if</span> ( <span class="keyword">sizeof</span>($doc_gen-&gt;value) != 0)
<a name="l00473"></a>00473 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;p&gt; G&amp;eacute;n&amp;eacute;rer un document "</span>.$gen-&gt;IOValue().<span class="stringliteral">" "</span>.$doc_gen-&gt;IOValue().<span class="stringliteral">"&lt;/p&gt;"</span>;
<a name="l00474"></a>00474
<a name="l00475"></a>00475
<a name="l00476"></a>00476 <span class="comment">// Add the hidden tag</span>
<a name="l00477"></a>00477 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;input type=<span class="stringliteral">"hidden"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"sa"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"save_action_st2"</span>&gt;';
<a name="l00478"></a>00478 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;input type=<span class="stringliteral">"hidden"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"p_action"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"suivi_courrier"</span>&gt;';
<a name="l00479"></a>00479 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;input type=<span class="stringliteral">"hidden"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"f_id_dest"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"'.$this-&gt;f_id_dest.'"</span>&gt;';
<a name="l00480"></a>00480 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;input type=<span class="stringliteral">"hidden"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"f_id_exp"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"'.$this-&gt;f_id_exp.'"</span>&gt;';
<a name="l00481"></a>00481 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;input type=<span class="stringliteral">"hidden"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"qcode_dest"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"'.$this-&gt;qcode_dest.'"</span>&gt;';
<a name="l00482"></a>00482 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;input type=<span class="stringliteral">"hidden"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"qcode_exp"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"'.$this-&gt;qcode_exp.'"</span>&gt;';
<a name="l00483"></a>00483
<a name="l00484"></a>00484
<a name="l00485"></a>00485 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.= $h_agrefid-&gt;IOValue(<span class="stringliteral">"ag_ref_ag_id"</span>,$this-&gt;ag_ref_ag_id);
<a name="l00486"></a>00486
<a name="l00487"></a>00487 <span class="comment">// retrieve customer</span>
<a name="l00488"></a>00488
<a name="l00489"></a>00489
<a name="l00490"></a>00490 <span class="keywordflow">if</span> ( $this-&gt;f_id_dest != -1 &amp;&amp; $this-&gt;f_id_exp !=-1 )
<a name="l00491"></a>00491 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<a class="code" href="admin__repo_8php.html#a9">$desc</a>-&gt;Submit(<span class="stringliteral">"Save"</span>,<span class="stringliteral">"Sauve"</span>);
<a name="l00492"></a>00492 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<a class="code" href="admin__repo_8php.html#a9">$desc</a>-&gt;Submit(<span class="stringliteral">"corr"</span>,<span class="stringliteral">"Corrige"</span>);
<a name="l00493"></a>00493
<a name="l00494"></a>00494 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<a class="code" href="action_8inc_8php.html#a2">$h_url</a>.<span class="stringliteral">"&lt;/form&gt;"</span>;
<a name="l00495"></a>00495 <span class="keywordflow">return</span> <a class="code" href="bank_8inc_8php.html#a29">$r</a>;
<a name="l00496"></a>00496 }
<a name="l00504"></a><a class="code" href="classaction.html#a4">00504</a> function <a class="code" href="classaction.html#a4">SaveStage2</a>()
<a name="l00505"></a>00505 {
<a name="l00506"></a>00506 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,'saveStage2() :'.var_export($_POST,<span class="keyword">true</span>));
<a name="l00507"></a>00507 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,' saveStage2() $<span class="keyword">this</span> :'.var_export($<span class="keyword">this</span>,<span class="keyword">true</span>));
<a name="l00508"></a>00508
<a name="l00509"></a>00509 <span class="comment">// Get The sequence id, </span>
<a name="l00510"></a>00510 $seq_name=<span class="stringliteral">"seq_doc_type_"</span>.$this-&gt;dt_id;
<a name="l00511"></a>00511 <a class="code" href="facture_8inc_8php.html#a28">$str_file</a>=<span class="stringliteral">""</span>;
<a name="l00512"></a>00512 $add_file='';
<a name="l00513"></a>00513 <span class="comment">// f_id dest</span>
<a name="l00514"></a>00514 $tiers=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this-&gt;db);
<a name="l00515"></a>00515 $tiers-&gt;GetByQCode($this-&gt;qcode_dest);
<a name="l00516"></a>00516
<a name="l00517"></a>00517 <span class="comment">// f_id exp</span>
<a name="l00518"></a>00518 $exp=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this-&gt;db);
<a name="l00519"></a>00519 $exp-&gt;GetByQCode($this-&gt;qcode_exp);
<a name="l00520"></a>00520
<a name="l00521"></a>00521 <span class="keywordflow">if</span> ( trim($this-&gt;ag_title) == <span class="stringliteral">""</span>)
<a name="l00522"></a>00522 {
<a name="l00523"></a>00523 $doc_mod=<span class="keyword">new</span> document_type($this-&gt;db);
<a name="l00524"></a>00524 $doc_mod-&gt;dt_id=$this-&gt;<a class="code" href="action_8inc_8php.html#a8">dt_id</a>;
<a name="l00525"></a>00525 $doc_mod-&gt;get();
<a name="l00526"></a>00526 $this-&gt;<a class="code" href="action_8inc_8php.html#a11">ag_title</a>=$doc_mod-&gt;dt_value;
<a name="l00527"></a>00527 }
<a name="l00528"></a>00528 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,<span class="stringliteral">" tiers-&gt;id "</span>.$tiers-&gt;id);
<a name="l00529"></a>00529 $this-&gt;<a class="code" href="action_8inc_8php.html#a4">ag_id</a>=<a class="code" href="postgres_8php.html#a13">NextSequence</a>($this-&gt;db,'action_gestion_ag_id_seq');
<a name="l00530"></a>00530 <span class="comment">// Create the reference </span>
<a name="l00531"></a>00531 $ref=$this-&gt;<a class="code" href="action_8inc_8php.html#a8">dt_id</a>.<span class="charliteral">'/'</span>.$this-&gt;<a class="code" href="action_8inc_8php.html#a4">ag_id</a>;
<a name="l00532"></a>00532 $this-&gt;<a class="code" href="action_8inc_8php.html#a16">ag_ref</a>=$ref;
<a name="l00535"></a>00535 <span class="comment">//we remove newline </span>
<a name="l00536"></a>00536 $this-&gt;<a class="code" href="action_8inc_8php.html#a5">ag_comment</a>=str_replace(<span class="stringliteral">"%OD"</span>,<span class="stringliteral">""</span>,$this-&gt;ag_comment);
<a name="l00537"></a>00537 $this-&gt;<a class="code" href="action_8inc_8php.html#a5">ag_comment</a>=str_replace(<span class="stringliteral">"%OA"</span>,<span class="stringliteral">""</span>,$this-&gt;ag_comment);
<a name="l00538"></a>00538 <span class="comment">// save into the database</span>
<a name="l00539"></a>00539 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf(<span class="stringliteral">"insert into action_gestion"</span>.
<a name="l00540"></a>00540 <span class="stringliteral">"(ag_id,ag_timestamp,ag_type,ag_title,f_id_dest,f_id_exp,ag_comment,ag_ref,ag_ref_ag_id) "</span>.
<a name="l00541"></a>00541 <span class="stringliteral">" values (%d,to_date('%s','DD-MM-YYYY'),'%d','%s',%d,%d,'%s','%s',%d)"</span>,
<a name="l00542"></a>00542 $this-&gt;ag_id,
<a name="l00543"></a>00543 $this-&gt;ag_timestamp,
<a name="l00544"></a>00544 $this-&gt;dt_id,
<a name="l00545"></a>00545 <a class="code" href="ac__common_8php.html#a9">FormatString</a>($this-&gt;ag_title),
<a name="l00546"></a>00546 $tiers-&gt;id,
<a name="l00547"></a>00547 $exp-&gt;id,
<a name="l00548"></a>00548 $this-&gt;ag_comment,
<a name="l00549"></a>00549 $ref,
<a name="l00550"></a>00550 $this-&gt;ag_ref_ag_id
<a name="l00551"></a>00551 );
<a name="l00552"></a>00552 <a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,$sql);
<a name="l00553"></a>00553
<a name="l00554"></a>00554
<a name="l00555"></a>00555
<a name="l00556"></a>00556 <span class="comment">// the lob filename and the mimetype needed if we want to generate a doc.</span>
<a name="l00557"></a>00557 <span class="keywordflow">if</span> ( $this-&gt;gen == 'on' )
<a name="l00558"></a>00558 {
<a name="l00559"></a>00559 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>=<span class="keyword">new</span> <a class="code" href="classDocument.html">Document</a>($this-&gt;db);
<a name="l00560"></a>00560 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>-&gt;f_id=$tiers-&gt;id;
<a name="l00561"></a>00561 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>-&gt;md_id=$this-&gt;<a class="code" href="action_8inc_8php.html#a20">md_id</a>;
<a name="l00562"></a>00562 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>-&gt;ag_id=$this-&gt;<a class="code" href="action_8inc_8php.html#a4">ag_id</a>;
<a name="l00563"></a>00563 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>-&gt;d_state=$this-&gt;<a class="code" href="action_8inc_8php.html#a7">d_state</a>;
<a name="l00564"></a>00564 <a class="code" href="facture_8inc_8php.html#a28">$str_file</a>=<a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>-&gt;Generate();
<a name="l00565"></a>00565 <a class="code" href="impress__jrn_8php.html#a1">$d</a>='&lt;input type=<span class="stringliteral">"hidden"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"d_id"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"'.$doc-&gt;d_id.'"</span>&gt;';
<a name="l00566"></a>00566 }
<a name="l00567"></a>00567 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<span class="stringliteral">""</span>;
<a name="l00568"></a>00568 <span class="comment">// readonly and upload of a file</span>
<a name="l00569"></a>00569 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;hr&gt;"</span>;
<a name="l00570"></a>00570 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;form enctype=<span class="stringliteral">"multipart/form-data"</span> method=<span class="stringliteral">"post"</span>&gt;';
<a name="l00571"></a>00571 <a class="code" href="debug_8php.html#a0">echo_debug</a>(<span class="stringliteral">"class_action"</span>,__LINE__,<span class="stringliteral">"call display"</span>);
<a name="l00572"></a>00572 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=$this-&gt;<a class="code" href="classaction.html#a1">Display</a>('READ',<span class="keyword">false</span>);
<a name="l00573"></a>00573 <span class="comment">// Add the hidden tag</span>
<a name="l00574"></a>00574 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;input type=<span class="stringliteral">"hidden"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"sa"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"save_action_st3"</span>&gt;';
<a name="l00575"></a>00575 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;input type=<span class="stringliteral">"hidden"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"p_action"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"suivi_courrier"</span>&gt;';
<a name="l00576"></a>00576 <span class="comment">// add the d_id</span>
<a name="l00577"></a>00577 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;input type=<span class="stringliteral">"hidden"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"d_id"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"'.$this-&gt;d_id.'"</span>&gt;';
<a name="l00578"></a>00578 <span class="comment">// ag_comment must be saved in urlcode</span>
<a name="l00579"></a>00579 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;input type=<span class="stringliteral">"hidden"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"ag_comment"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"'.urlencode($this-&gt;ag_comment).'"</span>&gt;';
<a name="l00580"></a>00580 <span class="comment">// Value for the generated document</span>
<a name="l00581"></a>00581 <span class="keywordflow">if</span> ( $this-&gt;gen == 'on' )
<a name="l00582"></a>00582 {
<a name="l00583"></a>00583 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;input type=<span class="stringliteral">"hidden"</span> <a class="code" href="action_8inc_8php.html#a18">name</a>=<span class="stringliteral">"d_id"</span> <a class="code" href="action_8inc_8php.html#a19">value</a>=<span class="stringliteral">"'.$doc-&gt;d_id.'"</span>&gt;';
<a name="l00584"></a>00584 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"Sauver le document g<>n<EFBFBD>r<EFBFBD> :"</span>;
<a name="l00585"></a>00585 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<a class="code" href="facture_8inc_8php.html#a28">$str_file</a>;
<a name="l00586"></a>00586 $checkbox=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"checkbox"</span>);
<a name="l00587"></a>00587 $checkbox-&gt;name=<span class="stringliteral">"save_generate"</span>;
<a name="l00588"></a>00588 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=$checkbox-&gt;IOValue();
<a name="l00589"></a>00589 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;hr&gt;"</span>;
<a name="l00590"></a>00590 }
<a name="l00591"></a>00591 <a class="code" href="action_8inc_8php.html#a17">$upload</a>=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"file"</span>);
<a name="l00592"></a>00592 <a class="code" href="action_8inc_8php.html#a17">$upload</a>-&gt;name=<span class="stringliteral">"file_upload"</span>;
<a name="l00593"></a>00593 <a class="code" href="action_8inc_8php.html#a17">$upload</a>-&gt;value=<span class="stringliteral">""</span>;
<a name="l00594"></a>00594 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"Enregistrer le fichier "</span>.$upload-&gt;IOValue();
<a name="l00595"></a>00595 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<a class="code" href="action_8inc_8php.html#a17">$upload</a>-&gt;Submit(<span class="stringliteral">"save"</span>,<span class="stringliteral">"Sauve le fichier"</span>);
<a name="l00596"></a>00596 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;/form&gt;"</span>;
<a name="l00597"></a>00597 <span class="keywordflow">return</span> <a class="code" href="bank_8inc_8php.html#a29">$r</a>;
<a name="l00598"></a>00598 }
<a name="l00604"></a><a class="code" href="classaction.html#a5">00604</a> function <a class="code" href="classaction.html#a5">SaveStage3</a>($<a class="code" href="action_8inc_8php.html#a12">d_id</a>)
<a name="l00605"></a>00605 {
<a name="l00606"></a>00606 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,'<a class="code" href="classaction.html#a5">SaveStage3</a>() :'.var_export($_POST,<span class="keyword">true</span>));
<a name="l00607"></a>00607 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,'<a class="code" href="classaction.html#a5">SaveStage3</a> :'.var_export($<span class="keyword">this</span>,<span class="keyword">true</span>));
<a name="l00608"></a>00608
<a name="l00609"></a>00609 <span class="comment">// if we save the generated doc</span>
<a name="l00610"></a>00610 <span class="keywordflow">if</span> ( isset($_POST['save_generate']))
<a name="l00611"></a>00611 {
<a name="l00612"></a>00612 <span class="keywordflow">return</span>;
<a name="l00613"></a>00613 }
<a name="l00614"></a>00614
<a name="l00615"></a>00615 <span class="comment">// Upload a new document</span>
<a name="l00616"></a>00616 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>=<span class="keyword">new</span> <a class="code" href="classDocument.html">Document</a>($this-&gt;db);
<a name="l00617"></a>00617 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>-&gt;ag_id=$this-&gt;<a class="code" href="action_8inc_8php.html#a4">ag_id</a>;
<a name="l00618"></a>00618 <span class="comment">// if there is a document and it is not an update</span>
<a name="l00619"></a>00619 <span class="keywordflow">if</span> ( <span class="keyword">sizeof</span>($_FILES) !=0 &amp;&amp; $<a class="code" href="action_8inc_8php.html#a12">d_id</a>==0)
<a name="l00620"></a>00620 {
<a name="l00621"></a>00621 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>-&gt;md_type=$this-&gt;<a class="code" href="action_8inc_8php.html#a8">dt_id</a>;
<a name="l00622"></a>00622 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>-&gt;blank();
<a name="l00623"></a>00623 }
<a name="l00624"></a>00624 <span class="keywordflow">else</span>
<a name="l00625"></a>00625 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>-&gt;d_id=<a class="code" href="action_8inc_8php.html#a23">$d_id</a>;
<a name="l00626"></a>00626
<a name="l00627"></a>00627 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>-&gt;Upload($this-&gt;ag_id);
<a name="l00628"></a>00628 }
<a name="l00629"></a>00629
<a name="l00638"></a><a class="code" href="classaction.html#a6">00638</a> function <a class="code" href="classaction.html#a6">myList</a>($p_filter=<span class="stringliteral">""</span>,$p_search=<span class="stringliteral">""</span>)
<a name="l00639"></a>00639 {
<a name="l00640"></a>00640 <span class="comment">// for the sort</span>
<a name="l00641"></a>00641 $sort=<span class="stringliteral">""</span>;
<a name="l00642"></a>00642 <span class="keywordflow">if</span> ( isset($_GET[<span class="charliteral">'s'</span>])){
<a name="l00643"></a>00643 {
<a name="l00644"></a>00644 <span class="keywordflow">switch</span> ($_GET[<span class="charliteral">'s'</span>]) {
<a name="l00645"></a>00645 <span class="keywordflow">case</span> <span class="stringliteral">"date"</span>:
<a name="l00646"></a>00646 $sort=<span class="stringliteral">" ag_timestamp"</span>;
<a name="l00647"></a>00647 <span class="keywordflow">break</span>;
<a name="l00648"></a>00648 <span class="keywordflow">case</span> <span class="stringliteral">"exp"</span>:
<a name="l00649"></a>00649 $sort=<span class="stringliteral">" f_id_exp"</span>;
<a name="l00650"></a>00650 <span class="keywordflow">break</span>;
<a name="l00651"></a>00651 <span class="keywordflow">case</span> <span class="stringliteral">"dest"</span>:
<a name="l00652"></a>00652 $sort=<span class="stringliteral">" f_id_dest"</span>;
<a name="l00653"></a>00653 <span class="keywordflow">break</span>;
<a name="l00654"></a>00654 <span class="keywordflow">case</span> <span class="stringliteral">"ti"</span>:
<a name="l00655"></a>00655 $sort=<span class="stringliteral">" ag_title"</span>;
<a name="l00656"></a>00656 <span class="keywordflow">break</span>;
<a name="l00657"></a>00657 <span class="keywordflow">case</span> <span class="stringliteral">"type"</span>:
<a name="l00658"></a>00658 $sort=<span class="stringliteral">" ag_type"</span>;
<a name="l00659"></a>00659 <span class="keywordflow">break</span>;
<a name="l00660"></a>00660 <span class="keywordflow">case</span> <span class="stringliteral">"ref"</span>:
<a name="l00661"></a>00661 $sort=<span class="stringliteral">" ag_ref"</span>;
<a name="l00662"></a>00662 <span class="keywordflow">break</span>;
<a name="l00663"></a>00663 <span class="keywordflow">case</span> <span class="stringliteral">"conc"</span>:
<a name="l00664"></a>00664 $sort=<span class="stringliteral">" ag_ref_ag_id"</span>;
<a name="l00665"></a>00665 <span class="keywordflow">break</span>;
<a name="l00666"></a>00666 }
<a name="l00667"></a>00667 $sort=<span class="stringliteral">" order by "</span>.$sort.<span class="stringliteral">" desc "</span>;
<a name="l00668"></a>00668 }
<a name="l00669"></a>00669 }
<a name="l00670"></a>00670 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"</span>
<a name="l00671"></a>00671 <span class="stringliteral"> select ag_id,to_char(ag_timestamp,'DD-MM-YYYY') as my_date,ag_ref_ag_id,f_id_dest,f_id_exp"</span>.
<a name="l00672"></a>00672 <span class="stringliteral">",ag_title,d_id,md_type,dt_value,ag_ref </span>
<a name="l00673"></a>00673 <span class="stringliteral"> from action_gestion </span>
<a name="l00674"></a>00674 <span class="stringliteral"> left outer join document using (ag_id)</span>
<a name="l00675"></a>00675 <span class="stringliteral"> left outer join document_modele on (ag_type=md_type) </span>
<a name="l00676"></a>00676 <span class="stringliteral"> join document_type on (ag_type=dt_id)</span>
<a name="l00677"></a>00677 <span class="stringliteral"> where dt_id in ($p_filter) $p_search $sort"</span>;
<a name="l00678"></a>00678 $max_line=<a class="code" href="postgres_8php.html#a10">CountSql</a>($this-&gt;db,$sql);
<a name="l00679"></a>00679 <a class="code" href="bank_8inc_8php.html#a21">$step</a>=<a class="code" href="commercial_8php.html#a0">$_SESSION</a>['g_pagesize'];
<a name="l00680"></a>00680 <a class="code" href="bank_8inc_8php.html#a22">$page</a>=(isset($_GET['offset']))?$_GET['page']:1;
<a name="l00681"></a>00681 <a class="code" href="bank_8inc_8php.html#a23">$offset</a>=(isset($_GET['offset']))?$_GET['offset']:0;
<a name="l00682"></a>00682 <a class="code" href="jrn__pdf_8php.html#a9">$limit</a>=<span class="stringliteral">" LIMIT $step OFFSET $offset "</span>;
<a name="l00683"></a>00683 <a class="code" href="bank_8inc_8php.html#a25">$bar</a>=<a class="code" href="user__common_8php.html#a16">jrn_navigation_bar</a>($offset,$max_line,$step,$page);
<a name="l00684"></a>00684
<a name="l00685"></a>00685 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,$sql.$limit);
<a name="l00686"></a>00686 $a_row=pg_fetch_all($Res);
<a name="l00687"></a>00687 <span class="comment">// $r='&lt;div class="u_redcontent"&gt;';</span>
<a name="l00688"></a>00688 $query=<span class="stringliteral">""</span>;
<a name="l00689"></a>00689 <span class="keywordflow">if</span> ( isset ($_GET['query']))
<a name="l00690"></a>00690 $query.=<span class="stringliteral">"query="</span>.$_GET['query'];
<a name="l00691"></a>00691 <span class="keywordflow">else</span>
<a name="l00692"></a>00692 $query=<span class="stringliteral">"1"</span>;
<a name="l00693"></a>00693
<a name="l00694"></a>00694 <span class="keywordflow">if</span> ( isset ($_GET['qcode_query'])) $query.='&amp;qcode_query='.$_GET['qcode_query'];
<a name="l00695"></a>00695 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,<span class="stringliteral">"jrn bar = $bar"</span>);
<a name="l00696"></a>00696 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,'$_SESSION='.var_export($_SESSION,<span class="keyword">true</span>));
<a name="l00697"></a>00697 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<span class="stringliteral">""</span>;
<a name="l00698"></a>00698 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<a class="code" href="bank_8inc_8php.html#a25">$bar</a>;
<a name="l00699"></a>00699 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;table&gt;"</span>;
<a name="l00700"></a>00700 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;tr&gt;"</span>;
<a name="l00701"></a>00701 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;th&gt;&lt;a href=<span class="stringliteral">"?s=date&amp;p_action=suivi_courrier&amp;'.$query.'"</span>&gt; Date&lt;/a&gt;&lt;/th&gt;';
<a name="l00702"></a>00702 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;th &lt;a href=<span class="stringliteral">"?s=dest&amp;p_action=suivi_courrier&amp;'.$query.'"</span>&gt;Destinataire&lt;/A&gt;&lt;/th&gt;';
<a name="l00703"></a>00703 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;th&gt;&lt;a href=<span class="stringliteral">"?s=exp&amp;p_action=suivi_courrier&amp;'.$query.'"</span>&gt;Exp<EFBFBD>diteur&lt;/A&gt;&lt;/th&gt;';
<a name="l00704"></a>00704 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;th&gt;&lt;a href=<span class="stringliteral">"?s=ti&amp;p_action=suivi_courrier&amp;'.$query.'"</span>&gt;Titre&lt;/a&gt;&lt;/th&gt;';
<a name="l00705"></a>00705 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;th&gt;&lt;a href=<span class="stringliteral">"?s=type&amp;p_action=suivi_courrier&amp;'.$query.'"</span>&gt;type&lt;/a&gt;&lt;/th&gt;';
<a name="l00706"></a>00706 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;th&gt;&lt;a href=<span class="stringliteral">"?s=ref&amp;p_action=suivi_courrier&amp;'.$query.'"</span>&gt;R<EFBFBD>f<EFBFBD>rence&lt;/a&gt;&lt;/th&gt;';
<a name="l00707"></a>00707 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;th&gt;&lt;a href=<span class="stringliteral">"?s=conc&amp;p_action=suivi_courrier&amp;'.$query.'"</span>&gt;concerne&lt;/a&gt;&lt;/th&gt;';
<a name="l00708"></a>00708 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;th&gt;<a class="code" href="classDocument.html">Document</a>&lt;/th&gt;';
<a name="l00709"></a>00709 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;/tr&gt;"</span>;
<a name="l00710"></a>00710
<a name="l00711"></a>00711 <span class="comment">// if there are no records return a message</span>
<a name="l00712"></a>00712 <span class="keywordflow">if</span> ( <span class="keyword">sizeof</span> ($a_row) == 0 or $a_row == <span class="keyword">false</span> )
<a name="l00713"></a>00713 {
<a name="l00714"></a>00714 <a class="code" href="bank_8inc_8php.html#a29">$r</a>='&lt;div <span class="keyword">class</span>=<span class="stringliteral">"u_redcontent"</span>&gt;';
<a name="l00715"></a>00715 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;hr&gt;Aucun enregistrement trouv<75>';
<a name="l00716"></a>00716 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;/div&gt;"</span>;
<a name="l00717"></a>00717 <span class="keywordflow">return</span> <a class="code" href="bank_8inc_8php.html#a29">$r</a>;
<a name="l00718"></a>00718
<a name="l00719"></a>00719 }
<a name="l00720"></a>00720 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<a class="code" href="constant_8php.html#a85">JS_SEARCH_CARD</a>;
<a name="l00721"></a>00721 foreach ($a_row as $row )
<a name="l00722"></a>00722 {
<a name="l00723"></a>00723
<a name="l00724"></a>00724 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;tr&gt;"</span>;
<a name="l00725"></a>00725 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;td&gt;"</span>.$row['my_date'].<span class="stringliteral">"&lt;/td&gt;"</span>;
<a name="l00726"></a>00726 <span class="comment">// Destinataire</span>
<a name="l00727"></a>00727 $fdest=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this-&gt;db);
<a name="l00728"></a>00728 $fdest-&gt;id=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>['<a class="code" href="action_8inc_8php.html#a14">f_id_dest</a>'];
<a name="l00729"></a>00729 $qcode_dest=$fdest-&gt;strAttribut(<a class="code" href="constant_8php.html#a78">ATTR_DEF_QUICKCODE</a>);
<a name="l00730"></a>00730
<a name="l00731"></a>00731 $qdest=($qcode_dest==<span class="stringliteral">"- ERROR -"</span>)?<span class="stringliteral">"Interne"</span>:$qcode_dest;
<a name="l00732"></a>00732 $jsdest=sprintf(<span class="stringliteral">"javascript:showfiche('%s','%s')"</span>,
<a name="l00733"></a>00733 $_REQUEST['PHPSESSID'],$qdest);
<a name="l00734"></a>00734 <span class="keywordflow">if</span> ( $qdest != 'Interne' )
<a name="l00735"></a>00735 {
<a name="l00736"></a>00736 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;td&gt;"</span>.'&lt;A HREF=<span class="stringliteral">"'.$jsdest.'"</span>&gt;'.$qdest.<span class="stringliteral">" : "</span>.$fdest-&gt;getName().'&lt;/A&gt;&lt;/td&gt;';
<a name="l00737"></a>00737 }
<a name="l00738"></a>00738 <span class="keywordflow">else</span>
<a name="l00739"></a>00739 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;td&gt;Interne &lt;/td&gt;"</span>;
<a name="l00740"></a>00740
<a name="l00741"></a>00741 <span class="comment">// Expediteur</span>
<a name="l00742"></a>00742 $fexp=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this-&gt;db);
<a name="l00743"></a>00743 $fexp-&gt;id=<a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>['<a class="code" href="action_8inc_8php.html#a15">f_id_exp</a>'];
<a name="l00744"></a>00744 $qcode_exp=$fexp-&gt;strAttribut(<a class="code" href="constant_8php.html#a78">ATTR_DEF_QUICKCODE</a>);
<a name="l00745"></a>00745
<a name="l00746"></a>00746 $qexp=($qcode_exp==<span class="stringliteral">"- ERROR -"</span>)?<span class="stringliteral">"Interne"</span>:$qcode_exp;
<a name="l00747"></a>00747 $jsexp=sprintf(<span class="stringliteral">"javascript:showfiche('%s','%s')"</span>,
<a name="l00748"></a>00748 $_REQUEST['PHPSESSID'],$qexp);
<a name="l00749"></a>00749 <span class="keywordflow">if</span> ( $qexp != 'Interne' )
<a name="l00750"></a>00750 {
<a name="l00751"></a>00751 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;td&gt;"</span>.'&lt;A HREF=<span class="stringliteral">"'.$jsexp.'"</span>&gt;'.$qexp.<span class="stringliteral">" : "</span>.$fexp-&gt;getName().'&lt;/A&gt;&lt;/td&gt;';
<a name="l00752"></a>00752 }
<a name="l00753"></a>00753 <span class="keywordflow">else</span>
<a name="l00754"></a>00754 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;td&gt;Interne &lt;/td&gt;"</span>;
<a name="l00755"></a>00755
<a name="l00756"></a>00756 $ref=<span class="stringliteral">""</span>;
<a name="l00757"></a>00757
<a name="l00758"></a>00758 <span class="comment">// show reference</span>
<a name="l00759"></a>00759 <span class="keywordflow">if</span> ( $row['<a class="code" href="action_8inc_8php.html#a13">ag_ref_ag_id</a>'] != 0 )
<a name="l00760"></a>00760 {
<a name="l00761"></a>00761 $retSqlStmt=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,
<a name="l00762"></a>00762 <span class="stringliteral">"select ag_ref from action_gestion where ag_id="</span>.$row['<a class="code" href="action_8inc_8php.html#a13">ag_ref_ag_id</a>']);
<a name="l00763"></a>00763 $retSql=pg_fetch_all($retSqlStmt);
<a name="l00764"></a>00764 <span class="keywordflow">if</span> ( $retSql != null )
<a name="l00765"></a>00765 {
<a name="l00766"></a>00766 foreach ($retSql as $line)
<a name="l00767"></a>00767 {
<a name="l00768"></a>00768 $ref.='&lt;A href=<span class="stringliteral">"commercial.php?p_action=suivi_courrier&amp;query='.$line['ag_ref'].'"</span>&gt;'.
<a name="l00769"></a>00769 $line['<a class="code" href="action_8inc_8php.html#a16">ag_ref</a>'].<span class="stringliteral">"&lt;A&gt;"</span>;
<a name="l00770"></a>00770 }
<a name="l00771"></a>00771 }
<a name="l00772"></a>00772 }
<a name="l00773"></a>00773
<a name="l00774"></a>00774 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;td&gt;&lt;A HREF=<span class="stringliteral">"commercial.php?p_action=suivi_courrier&amp;sa=detail&amp;ag_id='.$row['ag_id'].'"</span>&gt;'.
<a name="l00775"></a>00775 <a class="code" href="argenta__be_8inc_8php.html#a0">$row</a>['<a class="code" href="action_8inc_8php.html#a11">ag_title</a>'].<span class="stringliteral">"&lt;/A&gt;&lt;/td&gt;"</span>;
<a name="l00776"></a>00776 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;td&gt;"</span>.$row['dt_value'].<span class="stringliteral">"&lt;/td&gt;"</span>;
<a name="l00777"></a>00777 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;td&gt;"</span>.$row['<a class="code" href="action_8inc_8php.html#a16">ag_ref</a>'].<span class="stringliteral">"&lt;/td&gt;"</span>;
<a name="l00778"></a>00778 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;td&gt;"</span>.$ref.<span class="stringliteral">"&lt;/td&gt;"</span>;
<a name="l00779"></a>00779 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>=<span class="keyword">new</span> <a class="code" href="classDocument.html">Document</a>($this-&gt;db,$row['<a class="code" href="action_8inc_8php.html#a12">d_id</a>']);
<a name="l00780"></a>00780 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;td&gt;"</span>.$doc-&gt;a_ref().<span class="stringliteral">"&lt;/td&gt;"</span>;
<a name="l00781"></a>00781 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;/tr&gt;"</span>;
<a name="l00782"></a>00782
<a name="l00783"></a>00783 }
<a name="l00784"></a>00784 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;/table&gt;"</span>;
<a name="l00785"></a>00785
<a name="l00786"></a>00786 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<a class="code" href="bank_8inc_8php.html#a25">$bar</a>;
<a name="l00787"></a>00787 <span class="comment">//$r.="&lt;/div&gt;";</span>
<a name="l00788"></a>00788 <span class="keywordflow">return</span> <a class="code" href="bank_8inc_8php.html#a29">$r</a>;
<a name="l00789"></a>00789 }
<a name="l00790"></a>00790 <span class="comment">//----------------------------------------------------------------------</span>
<a name="l00795"></a><a class="code" href="classaction.html#a7">00795</a> <span class="comment"></span> function <a class="code" href="classaction.html#a7">Update</a>()
<a name="l00796"></a>00796 {
<a name="l00797"></a>00797 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,'<a class="code" href="classaction.html#a7">Update</a>() $_POST() :'.var_export($_POST,<span class="keyword">true</span>));
<a name="l00798"></a>00798 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_action',__LINE__,'<a class="code" href="classaction.html#a7">Update</a>() $<span class="keyword">this</span> :'.var_export($<span class="keyword">this</span>,<span class="keyword">true</span>));
<a name="l00799"></a>00799
<a name="l00800"></a>00800 <span class="comment">// if ag_id == 0 nothing to do</span>
<a name="l00801"></a>00801 <span class="keywordflow">if</span> ( $this-&gt;ag_id == 0 ) <a class="code" href="impress__listing__client_8php.html#a2">return</a> ;
<a name="l00802"></a>00802
<a name="l00803"></a>00803
<a name="l00804"></a>00804 <span class="comment">// retrieve customer</span>
<a name="l00805"></a>00805 <span class="comment">// f_id</span>
<a name="l00806"></a>00806
<a name="l00807"></a>00807 <span class="keywordflow">if</span> ( trim($this-&gt;qcode_exp) ==<span class="stringliteral">""</span> )
<a name="l00808"></a>00808 {
<a name="l00809"></a>00809 <span class="comment">// internal document</span>
<a name="l00810"></a>00810 $this-&gt;<a class="code" href="action_8inc_8php.html#a15">f_id_exp</a>=0; <span class="comment">// internal document</span>
<a name="l00811"></a>00811 }
<a name="l00812"></a>00812 <span class="keywordflow">else</span>
<a name="l00813"></a>00813 {
<a name="l00814"></a>00814 $tiers=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this-&gt;db);
<a name="l00815"></a>00815 <span class="keywordflow">if</span> ( $tiers-&gt;GetByQCode($this-&gt;qcode_exp) == -1 ) <span class="comment">// Error we cannot retrieve this qcode</span>
<a name="l00816"></a>00816 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00817"></a>00817 <span class="keywordflow">else</span>
<a name="l00818"></a>00818 $this-&gt;<a class="code" href="action_8inc_8php.html#a15">f_id_exp</a>=$tiers-&gt;id;
<a name="l00819"></a>00819
<a name="l00820"></a>00820 }
<a name="l00821"></a>00821 <span class="keywordflow">if</span> ( trim($this-&gt;qcode_dest) ==<span class="stringliteral">""</span> )
<a name="l00822"></a>00822 {
<a name="l00823"></a>00823 <span class="comment">// internal document</span>
<a name="l00824"></a>00824 $this-&gt;<a class="code" href="action_8inc_8php.html#a14">f_id_dest</a>=0; <span class="comment">// internal document</span>
<a name="l00825"></a>00825 }
<a name="l00826"></a>00826 <span class="keywordflow">else</span>
<a name="l00827"></a>00827 {
<a name="l00828"></a>00828 $tiers=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a10">fiche</a>($this-&gt;db);
<a name="l00829"></a>00829 <span class="keywordflow">if</span> ( $tiers-&gt;GetByQCode($this-&gt;qcode_dest) == -1 ) <span class="comment">// Error we cannot retrieve this qcode</span>
<a name="l00830"></a>00830 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00831"></a>00831 <span class="keywordflow">else</span>
<a name="l00832"></a>00832 $this-&gt;<a class="code" href="action_8inc_8php.html#a14">f_id_dest</a>=$tiers-&gt;id;
<a name="l00833"></a>00833
<a name="l00834"></a>00834 }
<a name="l00835"></a>00835
<a name="l00836"></a>00836
<a name="l00837"></a>00837 <span class="comment">//remove newline from ag_comment</span>
<a name="l00838"></a>00838 $this-&gt;<a class="code" href="action_8inc_8php.html#a5">ag_comment</a>=str_replace(<span class="stringliteral">"\n"</span>,<span class="stringliteral">""</span>,$this-&gt;ag_comment);
<a name="l00839"></a>00839 $this-&gt;<a class="code" href="action_8inc_8php.html#a5">ag_comment</a>=str_replace(<span class="stringliteral">"\r"</span>,<span class="stringliteral">""</span>,$this-&gt;ag_comment);
<a name="l00840"></a>00840
<a name="l00841"></a>00841 <span class="comment">// url encoded</span>
<a name="l00842"></a>00842 $this-&gt;<a class="code" href="action_8inc_8php.html#a5">ag_comment</a>=urlencode($this-&gt;ag_comment);
<a name="l00843"></a>00843
<a name="l00844"></a>00844 <span class="comment">// bug PHP : sometimes the newline remains</span>
<a name="l00845"></a>00845 $this-&gt;<a class="code" href="action_8inc_8php.html#a5">ag_comment</a>=str_replace(<span class="stringliteral">"%A0"</span>,<span class="stringliteral">""</span>,$this-&gt;ag_comment);
<a name="l00846"></a>00846 $this-&gt;<a class="code" href="action_8inc_8php.html#a5">ag_comment</a>=str_replace(<span class="stringliteral">"%0D"</span>,<span class="stringliteral">""</span>,$this-&gt;ag_comment);
<a name="l00847"></a>00847 $this-&gt;<a class="code" href="action_8inc_8php.html#a5">ag_comment</a>=str_replace(<span class="stringliteral">"+%A0+"</span>,<span class="stringliteral">""</span>,$this-&gt;ag_comment);
<a name="l00848"></a>00848 $this-&gt;<a class="code" href="action_8inc_8php.html#a5">ag_comment</a>=str_replace(<span class="stringliteral">"+%0D+"</span>,<span class="stringliteral">""</span>,$this-&gt;ag_comment);
<a name="l00849"></a>00849
<a name="l00850"></a>00850
<a name="l00851"></a>00851 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=sprintf(<span class="stringliteral">"update action_gestion set ag_comment='%s',"</span>.
<a name="l00852"></a>00852 <span class="stringliteral">" ag_timestamp=to_date('%s','DD.MM.YYYY'),"</span>.
<a name="l00853"></a>00853 <span class="stringliteral">" ag_title='%s',"</span>.
<a name="l00854"></a>00854 <span class="stringliteral">" ag_type=%d, "</span>.
<a name="l00855"></a>00855 <span class="stringliteral">" f_id_exp=%d, "</span>.
<a name="l00856"></a>00856 <span class="stringliteral">" f_id_dest=%d, "</span>.
<a name="l00857"></a>00857 <span class="stringliteral">" ag_ref_ag_id=%d"</span>.
<a name="l00858"></a>00858 <span class="stringliteral">" where ag_id = %d"</span>,
<a name="l00859"></a>00859 $this-&gt;ag_comment,
<a name="l00860"></a>00860 $this-&gt;ag_timestamp,
<a name="l00861"></a>00861 <a class="code" href="ac__common_8php.html#a9">FormatString</a>($this-&gt;ag_title),
<a name="l00862"></a>00862 $this-&gt;dt_id,
<a name="l00863"></a>00863 $this-&gt;f_id_exp,
<a name="l00864"></a>00864 $this-&gt;f_id_dest,
<a name="l00865"></a>00865 $this-&gt;ag_ref_ag_id,
<a name="l00866"></a>00866 $this-&gt;ag_id);
<a name="l00867"></a>00867 <a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,$sql);
<a name="l00868"></a>00868
<a name="l00869"></a>00869 <span class="keywordflow">if</span> ( <span class="keyword">sizeof</span>($_FILES) !=0 )
<a name="l00870"></a>00870 {
<a name="l00871"></a>00871 <span class="comment">// Upload a new document</span>
<a name="l00872"></a>00872 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>=<span class="keyword">new</span> <a class="code" href="classDocument.html">Document</a>($this-&gt;db);
<a name="l00873"></a>00873 <span class="keywordflow">if</span> ( $this-&gt;d_id !=0 )
<a name="l00874"></a>00874 {
<a name="l00875"></a>00875 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>-&gt;d_id=$this-&gt;<a class="code" href="action_8inc_8php.html#a12">d_id</a>;
<a name="l00876"></a>00876 } <span class="keywordflow">else</span> {
<a name="l00877"></a>00877 <span class="comment">// we need to increment the counter </span>
<a name="l00878"></a>00878 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>-&gt;ag_id=$this-&gt;<a class="code" href="action_8inc_8php.html#a4">ag_id</a>;
<a name="l00879"></a>00879 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>-&gt;md_type=$this-&gt;<a class="code" href="action_8inc_8php.html#a8">dt_id</a>;
<a name="l00880"></a>00880 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>-&gt;blank();
<a name="l00881"></a>00881 }
<a name="l00882"></a>00882 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>-&gt;Upload($this-&gt;ag_id);
<a name="l00883"></a>00883
<a name="l00884"></a>00884 }
<a name="l00885"></a>00885 <span class="keywordflow">if</span> ( $this-&gt;d_id != 0 )
<a name="l00886"></a>00886 {
<a name="l00887"></a>00887 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>=<span class="keyword">new</span> <a class="code" href="classDocument.html">Document</a>($this-&gt;db);
<a name="l00888"></a>00888 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>-&gt;d_id=$this-&gt;<a class="code" href="action_8inc_8php.html#a12">d_id</a> ;
<a name="l00889"></a>00889 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>-&gt;d_state=$this-&gt;<a class="code" href="action_8inc_8php.html#a7">d_state</a>;
<a name="l00890"></a>00890 <a class="code" href="document__modele_8inc_8php.html#a1">$doc</a>-&gt;save();
<a name="l00891"></a>00891 }
<a name="l00892"></a>00892 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00893"></a>00893 }
<a name="l00894"></a>00894
<a name="l00895"></a>00895 }
</pre></div></BODY>
</HTML>