noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
stock_cfg.inc.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  *   This file is part of NOALYSS.
00005  *
00006  *   NOALYSS is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   NOALYSS is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with NOALYSS; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00022 
00023 /**
00024  * @file
00025  * @brief Manage the repository
00026  *
00027  */
00028 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00029 require_once 'class_stock_sql.php';
00030 require_once 'class_sort_table.php';
00031 
00032 global $g_user, $cn,$g_parameter;
00033 
00034 if ($g_parameter->MY_STOCK == 'N')
00035 {
00036         echo '<h2 class="notice">';
00037         echo _("Vous n'utilisez pas de gestion de stock");
00038         echo '</h2>';
00039         exit();
00040 }
00041 if ( isset ($_POST['add_stock']))
00042 {
00043     $post_name=HtmlInput::default_value_post('r_name', "");
00044     if ( strlen(trim($post_name)) != 0)
00045     {
00046         $st=new Stock_Sql($cn);
00047         $st->from_array($_POST);
00048         $st->insert();
00049     }
00050 }
00051 if ( isset ($_POST['mod_stock']))
00052 {
00053     $post_name=HtmlInput::default_value_post('r_name', "");
00054     if ( strlen(trim($post_name)) != 0)
00055     {
00056 
00057         $st=new Stock_Sql($cn,$_POST['r_id']);
00058         $st->from_array($_POST);
00059         $st->update();
00060     }
00061 }
00062 $tb=new Sort_Table();
00063 $p_url=HtmlInput::get_to_string(array("ac","gDossier"));
00064 
00065 $tb->add(_("Nom"), $p_url, " order by r_name asc", "order by r_name desc", "ona", "ond");
00066 $tb->add(_("Adresse"), $p_url, " order by r_adress asc", "order by r_adress desc", "oaa", "oad");
00067 $tb->add(_("Ville"), $p_url, " order by r_city asc", "order by r_city desc", "ova", "ovd");
00068 $tb->add(_("Pays"), $p_url, " order by r_country asc", "order by r_country desc", "opa", "opd");
00069 $tb->add(_("Téléphone"), $p_url, " order by r_phone asc", "order by r_phone desc", "opa", "opd");
00070 
00071 $sql="select * from stock_repository ";
00072 
00073 $ord=(isset($_GET['ord']))?$_GET['ord']:"ona";
00074 
00075 $order=$tb->get_sql_order($ord);
00076 
00077 $array=$cn->get_array($sql." ".$order);
00078 
00079 ?>
00080 <div class="content">
00081 
00082 <table class="result">
00083         <tr>
00084                 <th><?php echo $tb->get_header(0)?></th>
00085                 <th><?php echo $tb->get_header(1)?></th>
00086                 <th><?php echo $tb->get_header(2)?></th>
00087                 <th><?php echo $tb->get_header(3)?></th>
00088                 <th><?php echo $tb->get_header(4)?></th>
00089         </tr>
00090 <?php for ($i=0;$i<count($array);$i++): ?>
00091         <tr>
00092                 <td>
00093                         <?php echo h($array[$i]['r_name'])?>
00094                 </td>
00095                 <td>
00096                         <?php echo h($array[$i]['r_adress'])?>
00097                 </td>
00098                 <td>
00099                         <?php echo h($array[$i]['r_city'])?>
00100                 </td>
00101                 <td>
00102                         <?php echo h($array[$i]['r_country'])?>
00103                 </td>
00104                 <td>
00105                         <?php echo h($array[$i]['r_phone'])?>
00106                 </td>
00107                 <td>
00108                         <?php
00109                                 $js=' onclick="stock_repo_change(\''.dossier::id().'\',\''.$array[$i]['r_id'].'\')"';
00110                                 echo HtmlInput::button("mod", _("Modifier"), $js);
00111                         ?>
00112                 </td>
00113         </tr>
00114 
00115 <?php endfor;?>
00116 </table>
00117         <?php echo HtmlInput::button("show_add_depot_d", "Ajout d'un dépot", "onclick=\"$('add_depot_d').show();\"");?>
00118         <div id="add_depot_d" class="inner_box" style="display:none">
00119         <?php echo HtmlInput::title_box("Ajouter un dépôt","add_depot_d","hide")?>
00120         <form method="post">
00121                 <table>
00122                         <tr>
00123                                 <td>
00124                                         Nom
00125                                 </td>
00126                                 <td>
00127                                         <?php $name=new IText("r_name",""); echo $name->input();?>
00128                                 </td>
00129                         </tr>
00130                         <tr>
00131                                 <td>
00132                                         Adresse
00133                                 </td>
00134                                 <td>
00135                                         <?php $name=new IText("r_adress",""); echo $name->input();?>
00136                                 </td>
00137                         </tr>
00138                         <tr>
00139                                 <td>
00140                                         Ville
00141                                 </td>
00142                                 <td>
00143                                         <?php $name=new IText("r_city",""); echo $name->input();?>
00144                                 </td>
00145                         </tr>
00146                         <tr>
00147                                 <td>
00148                                         Pays
00149                                 </td>
00150                                 <td>
00151                                         <?php $name=new IText("r_country",""); echo $name->input();?>
00152                                 </td>
00153                         </tr>
00154                         <tr>
00155                                 <td>
00156                                         Téléphone
00157                                 </td>
00158                                 <td>
00159                                         <?php $name=new IText("r_phone",""); echo $name->input();?>
00160                                 </td>
00161                         </tr>
00162 
00163                 </table>
00164                 <?php echo HtmlInput::submit("add_stock","Sauver")?>
00165         </form>
00166         </div>
00167 </div>
 All Data Structures Namespaces Files Functions Variables Enumerations