2015-09-27 00:35:53 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file is part of NOALYSS.
|
|
|
|
*
|
|
|
|
* NOALYSS is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* NOALYSS is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with NOALYSS; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Manage the repository
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
|
2018-04-13 18:58:28 +02:00
|
|
|
require_once NOALYSS_INCLUDE.'/database/stock_sql.class.php';
|
|
|
|
require_once NOALYSS_INCLUDE.'/lib/sort_table.class.php';
|
2015-09-27 00:35:53 +02:00
|
|
|
|
2018-04-13 18:58:28 +02:00
|
|
|
global $g_user, $cn,$g_parameter,$http;
|
2015-09-27 00:35:53 +02:00
|
|
|
|
|
|
|
if ($g_parameter->MY_STOCK == 'N')
|
|
|
|
{
|
|
|
|
echo '<h2 class="notice">';
|
|
|
|
echo _("Vous n'utilisez pas de gestion de stock");
|
|
|
|
echo '</h2>';
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ( isset ($_POST['add_stock']))
|
|
|
|
{
|
2018-04-13 18:58:28 +02:00
|
|
|
$post_name=$http->post('r_name');
|
2015-09-27 00:35:53 +02:00
|
|
|
if ( strlen(trim($post_name)) != 0)
|
|
|
|
{
|
|
|
|
$st=new Stock_Sql($cn);
|
|
|
|
$st->from_array($_POST);
|
|
|
|
$st->insert();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( isset ($_POST['mod_stock']))
|
|
|
|
{
|
2018-04-13 18:58:28 +02:00
|
|
|
$post_name=$http->post('r_name');
|
2015-09-27 00:35:53 +02:00
|
|
|
if ( strlen(trim($post_name)) != 0)
|
|
|
|
{
|
|
|
|
|
2018-04-13 18:58:28 +02:00
|
|
|
$st=new Stock_Sql($cn,$http->post('r_id',"number"));
|
2015-09-27 00:35:53 +02:00
|
|
|
$st->from_array($_POST);
|
|
|
|
$st->update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$tb=new Sort_Table();
|
|
|
|
$p_url=HtmlInput::get_to_string(array("ac","gDossier"));
|
|
|
|
|
|
|
|
$tb->add(_("Nom"), $p_url, " order by r_name asc", "order by r_name desc", "ona", "ond");
|
|
|
|
$tb->add(_("Adresse"), $p_url, " order by r_adress asc", "order by r_adress desc", "oaa", "oad");
|
|
|
|
$tb->add(_("Ville"), $p_url, " order by r_city asc", "order by r_city desc", "ova", "ovd");
|
|
|
|
$tb->add(_("Pays"), $p_url, " order by r_country asc", "order by r_country desc", "opa", "opd");
|
|
|
|
$tb->add(_("Téléphone"), $p_url, " order by r_phone asc", "order by r_phone desc", "opa", "opd");
|
|
|
|
|
|
|
|
$sql="select * from stock_repository ";
|
|
|
|
|
|
|
|
$ord=(isset($_GET['ord']))?$_GET['ord']:"ona";
|
|
|
|
|
|
|
|
$order=$tb->get_sql_order($ord);
|
|
|
|
|
|
|
|
$array=$cn->get_array($sql." ".$order);
|
|
|
|
|
|
|
|
?>
|
|
|
|
<div class="content">
|
|
|
|
|
|
|
|
<table class="result">
|
|
|
|
<tr>
|
|
|
|
<th><?php echo $tb->get_header(0)?></th>
|
|
|
|
<th><?php echo $tb->get_header(1)?></th>
|
|
|
|
<th><?php echo $tb->get_header(2)?></th>
|
|
|
|
<th><?php echo $tb->get_header(3)?></th>
|
|
|
|
<th><?php echo $tb->get_header(4)?></th>
|
|
|
|
</tr>
|
|
|
|
<?php for ($i=0;$i<count($array);$i++): ?>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<?php echo h($array[$i]['r_name'])?>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<?php echo h($array[$i]['r_adress'])?>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<?php echo h($array[$i]['r_city'])?>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<?php echo h($array[$i]['r_country'])?>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<?php echo h($array[$i]['r_phone'])?>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<?php
|
|
|
|
$js=' onclick="stock_repo_change(\''.dossier::id().'\',\''.$array[$i]['r_id'].'\')"';
|
|
|
|
echo HtmlInput::button("mod", _("Modifier"), $js);
|
|
|
|
?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<?php endfor;?>
|
|
|
|
</table>
|
2018-04-13 18:58:28 +02:00
|
|
|
<?php echo HtmlInput::button("show_add_depot_d", _("Ajout d'un dépot"), "onclick=\"$('add_depot_d').show();\"");?>
|
2015-09-27 00:35:53 +02:00
|
|
|
<div id="add_depot_d" class="inner_box" style="display:none">
|
2018-04-13 18:58:28 +02:00
|
|
|
<?php echo HtmlInput::title_box(_("Ajouter un dépôt"),"add_depot_d","hide")?>
|
2015-09-27 00:35:53 +02:00
|
|
|
<form method="post">
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
Nom
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<?php $name=new IText("r_name",""); echo $name->input();?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
Adresse
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<?php $name=new IText("r_adress",""); echo $name->input();?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
Ville
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<?php $name=new IText("r_city",""); echo $name->input();?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
Pays
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<?php $name=new IText("r_country",""); echo $name->input();?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
Téléphone
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<?php $name=new IText("r_phone",""); echo $name->input();?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
</table>
|
2018-04-13 18:58:28 +02:00
|
|
|
<?php echo HtmlInput::submit("add_stock",_("Sauver"))?>
|
2015-09-27 00:35:53 +02:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|