noalyss Version-9
stock_cfg.inc.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of NOALYSS.
5 *
6 * NOALYSS is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * NOALYSS is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with NOALYSS; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21// Copyright Author Dany De Bontridder danydb@aevalys.eu
22
23/**
24 * @file
25 * @brief Manage the repository
26 *
27 */
28if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
29require_once NOALYSS_INCLUDE.'/database/stock_sql.class.php';
30
32
33if ($g_parameter->MY_STOCK == 'N')
34{
35 echo '<h2 class="notice">';
36 echo _("Vous n'utilisez pas de gestion de stock");
37 echo '</h2>';
38 return;
39}
40if ( isset ($_POST['add_stock']))
41{
42 $post_name=$http->post('r_name');
43 if ( noalyss_strlentrim($post_name) != 0)
44 {
45 $st=new Stock_Sql($cn);
46 $st->from_array($_POST);
47 $st->insert();
48 }
49}
50if ( isset ($_POST['mod_stock']))
51{
52 $post_name=$http->post('r_name');
53 if ( noalyss_strlentrim($post_name) != 0)
54 {
55
56 $st=new Stock_Sql($cn,$http->post('r_id',"number"));
57 $st->from_array($_POST);
58 $st->update();
59 }
60}
62$p_url=HtmlInput::get_to_string(array("ac","gDossier"));
63
64$tb->add(_("Nom"), $p_url, " order by r_name asc", "order by r_name desc", "ona", "ond");
65$tb->add(_("Adresse"), $p_url, " order by r_adress asc", "order by r_adress desc", "oaa", "oad");
66$tb->add(_("Ville"), $p_url, " order by r_city asc", "order by r_city desc", "ova", "ovd");
67$tb->add(_("Pays"), $p_url, " order by r_country asc", "order by r_country desc", "opa", "opd");
68$tb->add(_("Téléphone"), $p_url, " order by r_phone asc", "order by r_phone desc", "opa", "opd");
69
70$sql="select * from stock_repository ";
71
72$ord=(isset($_GET['ord']))?$_GET['ord']:"ona";
73
74$order=$tb->get_sql_order($ord);
75
76$array=$cn->get_array($sql." ".$order);
77
78?>
79<div class="content">
80
81<table class="result">
82 <tr>
83 <th><?php echo $tb->get_header(0)?></th>
84 <th><?php echo $tb->get_header(1)?></th>
85 <th><?php echo $tb->get_header(2)?></th>
86 <th><?php echo $tb->get_header(3)?></th>
87 <th><?php echo $tb->get_header(4)?></th>
88 </tr>
89<?php for ($i=0;$i<count($array);$i++): ?>
90 <tr>
91 <td>
92 <?php echo h($array[$i]['r_name'])?>
93 </td>
94 <td>
95 <?php echo h($array[$i]['r_adress'])?>
96 </td>
97 <td>
98 <?php echo h($array[$i]['r_city'])?>
99 </td>
100 <td>
101 <?php echo h($array[$i]['r_country'])?>
102 </td>
103 <td>
104 <?php echo h($array[$i]['r_phone'])?>
105 </td>
106 <td>
107 <?php
108 $js=' onclick="stock_repo_change(\''.dossier::id().'\',\''.$array[$i]['r_id'].'\')"';
109 echo HtmlInput::button("mod", _("Modifier"), $js);
110 ?>
111 </td>
112 </tr>
113
114<?php endfor;?>
115</table>
116 <?php echo HtmlInput::button("show_add_depot_d", _("Ajout d'un dépot"), "onclick=\"$('add_depot_d').show();\"");?>
117 <div id="add_depot_d" class="inner_box" style="display:none">
118 <?php echo HtmlInput::title_box(_("Ajouter un dépôt"),"add_depot_d","hide")?>
119 <form method="post">
120 <table>
121 <tr>
122 <td>
123 Nom
124 </td>
125 <td>
126 <?php $name=new IText("r_name",""); echo $name->input();?>
127 </td>
128 </tr>
129 <tr>
130 <td>
131 Adresse
132 </td>
133 <td>
134 <?php $name=new IText("r_adress",""); echo $name->input();?>
135 </td>
136 </tr>
137 <tr>
138 <td>
139 Ville
140 </td>
141 <td>
142 <?php $name=new IText("r_city",""); echo $name->input();?>
143 </td>
144 </tr>
145 <tr>
146 <td>
147 Pays
148 </td>
149 <td>
150 <?php $name=new IText("r_country",""); echo $name->input();?>
151 </td>
152 </tr>
153 <tr>
154 <td>
155 Téléphone
156 </td>
157 <td>
158 <?php $name=new IText("r_phone",""); echo $name->input();?>
159 </td>
160 </tr>
161
162 </table>
163 <?php echo HtmlInput::submit("add_stock",_("Sauver"))?>
164 </form>
165 </div>
166</div>
th($p_string, $p_extra='', $raw='')
Definition: ac_common.php:58
noalyss_strlentrim($p_string)
Definition: ac_common.php:1549
tr($p_string, $p_extra='')
Definition: ac_common.php:88
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
h( $row[ 'oa_description'])
$_GET['qcode']
static get_to_string($array, $start="?")
transform $_GET data to string
Description of class_syn_sort_table.
ORM abstract of the table public.stock_repository.
$all table
$_POST['ac']
Definition: do.php:310
$sql
$order
global $http
global $g_user
global $cn
$ord
$array
global $g_parameter
if($g_parameter->MY_STOCK=='N') if(isset( $_POST[ 'add_stock'])) if(isset($_POST['mod_stock'])) $tb
$p_url