00001 <?
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 require_once("class_customer.php");
00022 $sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
00023
00027 $User->AccessRequest($cn,CLIENT);
00028
00029 ?>
00030
00031 <?
00032
00033
00034 if ( isset ($_POST['delete']) )
00035 {
00036
00037 echo 'delete';
00038 $f_id=$_REQUEST['f_id'];
00039
00040 $fiche=new Customer($cn,$f_id);
00041 $fiche->remove();
00042 $sub_action="list";
00043 }
00044
00045
00046 if ( $sub_action=="insert" )
00047 {
00048
00049 $retour=sprintf('<A class="two" HREF="%s"><input type="button" value="Retour"></A>',
00050 urldecode($_REQUEST['url']));
00051
00052 $customer=new Customer($cn);
00053 $customer->Save($_REQUEST['fd_id']);
00054 echo $retour;
00055 echo "<table>";
00056 echo $customer->Display(true);
00057 echo "</table>";
00058 echo $retour;
00059
00060 }
00061
00062
00063 if ( isset ($_POST['mod']))
00064 {
00065
00066
00067 $f_id=$_REQUEST['f_id'];
00068
00069 $client=new Customer($cn,$f_id);
00070 $client->Save();
00071 }
00072
00073 if ( $sub_action == "" )
00074 $sub_action="list";
00075
00076
00077 if ( $sub_action=="blank")
00078 {
00079
00080 $retour=sprintf('<A class="two" HREF="%s"><input type="button" value="Retour"></A>',
00081 "commercial.php?p_action=client");
00082 echo '<div class="u_redcontent">';
00083
00084 echo $retour;
00085 $c=new Customer($cn);
00086 echo '<form method="post" action="commercial.php"';
00087 echo '<input type="hidden" name="p_action" value="client">';
00088 echo '<input type="hidden" name="sa" value="insert">';
00089 echo '<input type="hidden" name="fd_id" value="'.$_GET['fd_id'].'">';
00090 echo '<input type="hidden" name="url" value="'.$_GET['url'].'">';
00091 echo $c->blank($_GET['fd_id']);
00092 echo '<input type="Submit" value="Sauve">';
00093 echo '</form>';
00094 echo $retour;
00095 echo '</div>';
00096 }
00097
00098
00099 if ( $sub_action == "list" )
00100 {
00101 ?>
00102 <div class="u_content">
00103 <span>
00104 <form method="get" action="commercial.php">
00105 <?
00106 $a=(isset($_GET['query']))?$_GET['query']:"";
00107 printf ('<input type="text" name="query" value="%s">',
00108 $a);
00109 ?>
00110 <input type="submit" name="submit_query" value="recherche">
00111 <input type="hidden" name="p_action" value="client">
00112 </form>
00113 </span>
00114 <span>
00115 <form method="get" action="commercial.php">
00116 <input type="hidden" name="url" <? $url=urlencode($_SERVER['REQUEST_URI']);echo 'value="'.$url.'"'; ?>
00117 <input type="hidden" name="p_action" value="client">
00118
00119 <?
00120 $w=new widget("select");
00121 $w->name="fd_id";
00122 $w->value= make_array($cn,"select fd_id,fd_label from fiche_def where ".
00123 " frd_id=".FICHE_TYPE_CLIENT);
00124 echo $w->IOValue();
00125 ?>
00126 <input type="hidden" name="sa" value="blank">
00127 <input type="submit" name="submit_query" value="Ajout Client">
00128
00129 </form>
00130 </span>
00131 <?
00132 $client=new Customer($cn);
00133 $search=(isset($_GET['query']))?$_GET['query']:"";
00134
00135 echo '<div class="u_redcontent">';
00136 echo $client->Summary($search);
00137 echo '</div>';
00138 echo '</div>';
00139
00140 }
00141
00142
00143 if ( $sub_action == 'detail' )
00144 {
00145 $f_id=$_REQUEST['f_id'];
00146 echo '<div class="u_redcontent">';
00147 $client=new Customer($cn,$f_id);
00148 $retour=sprintf('<A class="two" HREF="%s"><input type="button" value="Retour"></A>',
00149 urldecode($_REQUEST['url']));
00150 echo $retour;
00151 echo '<form action="'.$_REQUEST['url'].'" method="post">';
00152 echo $client->Display(false);
00153 $w=new widget("hidden");
00154 $w->name="p_action";
00155 $w->value="client";
00156 echo $w->IOValue();
00157 $w->name="f_id";
00158 $w->value=$f_id;
00159 echo $w->IOValue();
00160
00161
00162 echo $w->Submit('mod','Sauver les modifications');
00163 echo $w->Reset("Annuler");
00164 echo $w->Submit('delete','Effacer cette fiche');
00165
00166 echo '</form>';
00167 echo $retour;
00168 echo '<div>';
00169 }
00170 html_page_stop();
00171 ?>