00001 <?
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00022 require_once('class_contact.php');
00023 require_once('class_widget.php');
00030 $sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
00031
00032
00033
00034
00035 if ( isset ($_REQUEST['url']))
00036 {
00037 $retour=sprintf('<A class="mtitle" HREF="%s"><input type="button" value="Retour"></A>',urldecode($_REQUEST['url']));
00038 $h_url=sprintf('<input type="hidden" name="url" value="%s">',urldecode($_REQUEST['url']));
00039 }
00040 else
00041 {
00042 $retour="";
00043 $h_url="";
00044 }
00045
00046
00047
00048 if ( isset ($_POST['delete']) )
00049 {
00050 echo 'delete';
00051 $f_id=$_REQUEST['f_id'];
00052
00053 $fiche=new contact($cn,$f_id);
00054 $fiche->remove();
00055 $sub_action="list";
00056 }
00057
00058
00059 if ( $sub_action=="insert" )
00060 {
00061 $contact=new Contact($cn);
00062 $contact->Save($_REQUEST['fd_id']);
00063 echo $retour;
00064 echo "<table>";
00065 echo $contact->Display(true);
00066 echo "</table>";
00067 echo $retour;
00068
00069 }
00070
00071
00072
00073 if ( isset ($_POST['mod']))
00074 {
00075
00076 $f_id=$_REQUEST['f_id'];
00077
00078 $contact=new contact($cn,$f_id);
00079 $contact->Save();
00080 $sub_action="list";
00081 }
00082
00083 if ( $sub_action == "" )
00084 $sub_action="list";
00085
00086
00087 if ( $sub_action=="blank")
00088 {
00089 $retour=sprintf('<A class="two" HREF="%s"><input type="button" value="Retour"></A>',
00090 "commercial.php?p_action=contact");
00091 echo '<div class="u_redcontent">';
00092
00093 echo $retour;
00094 $c=new contact($cn);
00095 echo '<form method="post" action="commercial.php"';
00096 echo '<input type="hidden" name="p_action" value="client">';
00097 echo '<input type="hidden" name="sa" value="insert">';
00098 echo '<input type="hidden" name="fd_id" value="'.$_GET['fd_id'].'">';
00099 echo '<input type="hidden" name="url" value="'.$_GET['url'].'">';
00100 echo $c->blank($_GET['fd_id']);
00101 echo '<input type="Submit" value="Sauve">';
00102 echo '</form>';
00103 echo $retour;
00104 echo '</div>';
00105 }
00106
00107
00108 if ( $sub_action == "list" )
00109 {
00110 ?>
00111 <div class="u_content">
00112 <span>
00113 <form method="get" action="commercial.php">
00114 <?
00115 $a=(isset($_GET['query']))?$_GET['query']:"";
00116 printf ('<input type="text" name="query" value="%s">',
00117 $a);
00118 ?>
00119 <input type="submit" name="submit_query" value="recherche">
00120 <input type="hidden" name="p_action" value="contact">
00121 </form>
00122 </span>
00123 <span>
00124 <form method="get" action="commercial.php">
00125 <input type="hidden" name="url" <? $url=urlencode($_SERVER['REQUEST_URI']);echo 'value="'.$url.'"'; ?>
00126 <input type="hidden" name="p_action" value="contact">
00127
00128 <?
00129 $w=new widget("select");
00130 $w->name="fd_id";
00131 $w->value= make_array($cn,"select fd_id,fd_label from fiche_def where ".
00132 " frd_id=".FICHE_TYPE_CONTACT);
00133
00134 if ( sizeof ($w->value) == 0 ) {
00135 echo '<p style="color:red">Aucune fiche de catégories contact</p>';
00136 echo '<p>allez dans comptabilité -> fiche creation et choississez contact comme sorte</p>';
00137 exit();
00138 }
00139 echo $w->IOValue();
00140
00141 ?>
00142 <input type="hidden" name="sa" value="blank">
00143 <input type="submit" name="submit_query" value="Ajout Contact">
00144
00145 </form>
00146 </span>
00147
00148 <form>
00149 <?
00150 $qcode=(isset($_GET['qcode']))?$_GET['qcode']:"";
00151 echo JS_SEARCH_CARD;
00152 $w=new widget('js_search_only');
00153 $w->name='qcode';
00154 $w->value=$qcode;
00155 $w->label='qcode';
00156 $w->extra='4,8,9,14';
00157 $sp= new widget("span");
00158 echo $sp->IOValue("qcode_label",$qcode)."</TD></TR>";
00159
00160 echo $w->IOValue();
00161
00162 ?>
00163 <input type="submit" name="submit_query" value="recherche">
00164 <input type="hidden" name="p_action" value="contact">
00165
00166 </FORM>
00167 <?
00168 $contact=new Contact($cn);
00169 $search=(isset($_GET['query']))?$_GET['query']:"";
00170
00171 if ( $qcode != "" )
00172 {
00173 $contact->company=$qcode;
00174 }
00175 echo $retour;
00176 echo '<div class="u_redcontent">';
00177 echo $contact->Summary($search);
00178 echo '</div>';
00179 echo $retour;
00180
00181
00182 }
00183
00184
00185 if ( $sub_action == 'detail' )
00186 {
00187 $f_id=$_REQUEST['f_id'];
00188 echo '<div class="u_redcontent">';
00189 $contact=new contact($cn,$f_id);
00190 echo $retour;
00191 echo '<form action="'.$_SERVER['REQUEST_URI'].'" method="post">';
00192 echo $contact->Display(false);
00193 $w=new widget("hidden");
00194 $w->name="p_action";
00195 $w->value="contact";
00196 echo $w->IOValue();
00197 $w->name="f_id";
00198 $w->value=$f_id;
00199 echo $w->IOValue();
00200
00201 echo $w->Submit('mod','Sauver les modifications');
00202 echo '<A HREF="commercial.php?p_action=contact"><INPUT TYPE="button" value="Retour"></A>';
00203 echo $w->Submit('delete','Effacer cette fiche');
00204 echo '</form>';
00205 echo $retour;
00206 echo '<div>';
00207 }
00208 html_page_stop();
00209
00210