Enhancements on datawarehouse management
This commit is contained in:
parent
51160ac2e0
commit
f2238b6885
@ -105,7 +105,7 @@ if ($_POST["action"] == 'update_price' && ! $_POST["cancel"] && $user->rights->p
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'delete' && $user->rights->produit->creer)
|
||||
if ($_GET["action"] == 'delete' && $user->rights->produit->supprimer)
|
||||
{
|
||||
$productstatic = new Product($db);
|
||||
$result=$productstatic->log_price_delete($user,$_GET["lineid"]);
|
||||
@ -406,7 +406,7 @@ if ($result)
|
||||
print '<td align="right">'.$langs->trans("MinPrice").' '.$langs->trans("HT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("MinPrice").' '.$langs->trans("TTC").'</td>';
|
||||
print '<td align="right">'.$langs->trans("ChangedBy").'</td>';
|
||||
if ($user->rights->produit->creer) print '<td align="right"> </td>';
|
||||
if ($user->rights->produit->supprimer) print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=True;
|
||||
@ -436,7 +436,7 @@ if ($result)
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$objp->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$objp->login.'</a></td>';
|
||||
|
||||
// Action
|
||||
if ($user->rights->produit->creer)
|
||||
if ($user->rights->produit->supprimer)
|
||||
{
|
||||
print '<td align="right">';
|
||||
if ($i > 0)
|
||||
|
||||
@ -20,11 +20,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/product/stock/fiche.php
|
||||
\ingroup stock
|
||||
\brief Page fiche entrepot
|
||||
\version $Id$
|
||||
*/
|
||||
\file htdocs/product/stock/fiche.php
|
||||
\ingroup stock
|
||||
\brief Page fiche entrepot
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
@ -48,80 +48,80 @@ $mesg = '';
|
||||
// Ajout entrepot
|
||||
if ($_POST["action"] == 'add')
|
||||
{
|
||||
$entrepot = new Entrepot($db);
|
||||
$entrepot = new Entrepot($db);
|
||||
|
||||
$entrepot->ref = $_POST["ref"];
|
||||
$entrepot->libelle = $_POST["libelle"];
|
||||
$entrepot->description = $_POST["desc"];
|
||||
$entrepot->statut = $_POST["statut"];
|
||||
$entrepot->lieu = $_POST["lieu"];
|
||||
$entrepot->address = $_POST["address"];
|
||||
$entrepot->cp = $_POST["cp"];
|
||||
$entrepot->ville = $_POST["ville"];
|
||||
$entrepot->pays_id = $_POST["pays_id"];
|
||||
$entrepot->ref = $_POST["ref"];
|
||||
$entrepot->libelle = $_POST["libelle"];
|
||||
$entrepot->description = $_POST["desc"];
|
||||
$entrepot->statut = $_POST["statut"];
|
||||
$entrepot->lieu = $_POST["lieu"];
|
||||
$entrepot->address = $_POST["address"];
|
||||
$entrepot->cp = $_POST["cp"];
|
||||
$entrepot->ville = $_POST["ville"];
|
||||
$entrepot->pays_id = $_POST["pays_id"];
|
||||
|
||||
if ($entrepot->libelle) {
|
||||
$id = $entrepot->create($user);
|
||||
if ($id > 0) {
|
||||
Header("Location: fiche.php?id=$id");
|
||||
}
|
||||
if ($entrepot->libelle) {
|
||||
$id = $entrepot->create($user);
|
||||
if ($id > 0) {
|
||||
Header("Location: fiche.php?id=$id");
|
||||
}
|
||||
|
||||
$_GET["action"] = 'create';
|
||||
$mesg="<div class='error'>".$entrepot->error."</div>";
|
||||
}
|
||||
else {
|
||||
$mesg="<div class='error'>".$langs->trans("ErrorWarehouseRefRequired")."</div>";
|
||||
$_GET["action"]="create"; // Force retour sur page création
|
||||
}
|
||||
$_GET["action"] = 'create';
|
||||
$mesg="<div class='error'>".$entrepot->error."</div>";
|
||||
}
|
||||
else {
|
||||
$mesg="<div class='error'>".$langs->trans("ErrorWarehouseRefRequired")."</div>";
|
||||
$_GET["action"]="create"; // Force retour sur page cr<EFBFBD>ation
|
||||
}
|
||||
}
|
||||
|
||||
// Modification entrepot
|
||||
if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||
{
|
||||
$entrepot = new Entrepot($db);
|
||||
if ($entrepot->fetch($_POST["id"]))
|
||||
{
|
||||
$entrepot->libelle = $_POST["libelle"];
|
||||
$entrepot->description = $_POST["desc"];
|
||||
$entrepot->statut = $_POST["statut"];
|
||||
$entrepot->lieu = $_POST["lieu"];
|
||||
$entrepot->address = $_POST["address"];
|
||||
$entrepot->cp = $_POST["cp"];
|
||||
$entrepot->ville = $_POST["ville"];
|
||||
$entrepot->pays_id = $_POST["pays_id"];
|
||||
$entrepot = new Entrepot($db);
|
||||
if ($entrepot->fetch($_POST["id"]))
|
||||
{
|
||||
$entrepot->libelle = $_POST["libelle"];
|
||||
$entrepot->description = $_POST["desc"];
|
||||
$entrepot->statut = $_POST["statut"];
|
||||
$entrepot->lieu = $_POST["lieu"];
|
||||
$entrepot->address = $_POST["address"];
|
||||
$entrepot->cp = $_POST["cp"];
|
||||
$entrepot->ville = $_POST["ville"];
|
||||
$entrepot->pays_id = $_POST["pays_id"];
|
||||
|
||||
if ( $entrepot->update($_POST["id"], $user) > 0)
|
||||
{
|
||||
$_GET["action"] = '';
|
||||
$_GET["id"] = $_POST["id"];
|
||||
//$mesg = '<div class="ok">Fiche mise à jour</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$_GET["action"] = 'edit';
|
||||
$_GET["id"] = $_POST["id"];
|
||||
$mesg = '<div class="error">Fiche non mise à jour !' . "<br>" . $entrepot->error.'</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$_GET["action"] = 'edit';
|
||||
$_GET["id"] = $_POST["id"];
|
||||
$mesg = '<div class="error">Fiche non mise à jour !' . "<br>" . $entrepot->error.'</div>';
|
||||
}
|
||||
if ( $entrepot->update($_POST["id"], $user) > 0)
|
||||
{
|
||||
$_GET["action"] = '';
|
||||
$_GET["id"] = $_POST["id"];
|
||||
//$mesg = '<div class="ok">Fiche mise <20> jour</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$_GET["action"] = 'edit';
|
||||
$_GET["id"] = $_POST["id"];
|
||||
$mesg = '<div class="error">Fiche non mise <20> jour !' . "<br>" . $entrepot->error.'</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$_GET["action"] = 'edit';
|
||||
$_GET["id"] = $_POST["id"];
|
||||
$mesg = '<div class="error">Fiche non mise <20> jour !' . "<br>" . $entrepot->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST["cancel"] == $langs->trans("Cancel"))
|
||||
{
|
||||
$_GET["action"] = '';
|
||||
$_GET["id"] = $_POST["id"];
|
||||
$_GET["action"] = '';
|
||||
$_GET["id"] = $_POST["id"];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader("","",$langs->trans("WarehouseCard"));
|
||||
|
||||
@ -129,322 +129,335 @@ $form=new Form($db);
|
||||
|
||||
if ($_GET["action"] == 'create')
|
||||
{
|
||||
print "<form action=\"fiche.php\" method=\"post\">\n";
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">'."\n";
|
||||
print_titre($langs->trans("NewWarehouse"));
|
||||
print "<form action=\"fiche.php\" method=\"post\">\n";
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">'."\n";
|
||||
print_titre($langs->trans("NewWarehouse"));
|
||||
|
||||
if ($mesg)
|
||||
{
|
||||
print $mesg;
|
||||
}
|
||||
if ($mesg)
|
||||
{
|
||||
print $mesg;
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3"><input name="libelle" size="20" value=""></td></tr>';
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3"><input name="libelle" size="20" value=""></td></tr>';
|
||||
|
||||
print '<tr><td >'.$langs->trans("LocationSummary").'</td><td colspan="3"><input name="lieu" size="40" value="'.$entrepot->lieu.'"></td></tr>';
|
||||
print '<tr><td >'.$langs->trans("LocationSummary").'</td><td colspan="3"><input name="lieu" size="40" value="'.$entrepot->lieu.'"></td></tr>';
|
||||
|
||||
// Description
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">';
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">';
|
||||
if ($conf->fckeditor->enabled)
|
||||
{
|
||||
// Editeur wysiwyg
|
||||
{
|
||||
// Editeur wysiwyg
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
$doleditor=new DolEditor('desc',$entrepot->description,180,'dolibarr_notes','In',false);
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="desc" cols="70" rows="5">'.dol_htmlentitiesbr_decode($entrepot->description).'</textarea>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" cols="60" rows="3" wrap="soft">';
|
||||
print $entrepot->address;
|
||||
print '</textarea></td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" cols="60" rows="3" wrap="soft">';
|
||||
print $entrepot->address;
|
||||
print '</textarea></td></tr>';
|
||||
|
||||
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%"><input size="6" type="text" name="cp" value="'.$entrepot->cp.'"></td>';
|
||||
print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%"><input type="text" name="ville" value="'.$entrepot->ville.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
$form->select_pays($entrepot->pays_id?$entrepot->pays_id:$mysoc->pays_code, 'pays_id');
|
||||
print '</td></tr>';
|
||||
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%"><input size="6" type="text" name="cp" value="'.$entrepot->cp.'"></td>';
|
||||
print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%"><input type="text" name="ville" value="'.$entrepot->ville.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">';
|
||||
print '<select name="statut">';
|
||||
print '<option value="0">'.$langs->trans("WarehouseClosed").'</option>';
|
||||
print '<option value="1" selected="true">'.$langs->trans("WarehouseOpened").'</option>';
|
||||
print '</select>';
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
$form->select_pays($entrepot->pays_id?$entrepot->pays_id:$mysoc->pays_code, 'pays_id');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">';
|
||||
print '<select name="statut">';
|
||||
print '<option value="0">'.$langs->trans("WarehouseClosed").'</option>';
|
||||
print '<option value="1" selected="true">'.$langs->trans("WarehouseOpened").'</option>';
|
||||
print '</select>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($_GET["id"])
|
||||
{
|
||||
if ($mesg) print $mesg;
|
||||
if ($_GET["id"])
|
||||
{
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
$entrepot = new Entrepot($db);
|
||||
$result = $entrepot->fetch($_GET["id"]);
|
||||
if ($result < 0)
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
$entrepot = new Entrepot($db);
|
||||
$result = $entrepot->fetch($_GET["id"]);
|
||||
if ($result < 0)
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
/*
|
||||
* Affichage fiche
|
||||
*/
|
||||
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
|
||||
{
|
||||
/*
|
||||
* Affichage fiche
|
||||
*/
|
||||
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
|
||||
{
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$h = 0;
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id;
|
||||
$head[$h][1] = $langs->trans("WarehouseCard");
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id;
|
||||
$head[$h][1] = $langs->trans("WarehouseCard");
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$entrepot->id;
|
||||
$head[$h][1] = $langs->trans("StockMovements");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche-valo.php?id='.$entrepot->id;
|
||||
$head[$h][1] = $langs->trans("EnhancedValue");
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$entrepot->id;
|
||||
$head[$h][1] = $langs->trans("StockMovements");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche-valo.php?id='.$entrepot->id;
|
||||
$head[$h][1] = $langs->trans("EnhancedValue");
|
||||
$h++;
|
||||
|
||||
if ($conf->global->STOCK_USE_WAREHOUSE_BY_USER)
|
||||
{
|
||||
// Add the constant STOCK_USE_WAREHOUSE_BY_USER in cont table to use this feature.
|
||||
// Should not be enabled by defaut because does not work yet correctly because
|
||||
// there is no way to add values in the table llx_user_entrepot
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/stock/user.php?id='.$entrepot->id;
|
||||
$head[$h][1] = $langs->trans("Users");
|
||||
$h++;
|
||||
}
|
||||
if ($conf->global->STOCK_USE_WAREHOUSE_BY_USER)
|
||||
{
|
||||
// Add the constant STOCK_USE_WAREHOUSE_BY_USER in cont table to use this feature.
|
||||
// Should not be enabled by defaut because does not work yet correctly because
|
||||
// there is no way to add values in the table llx_user_entrepot
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/stock/user.php?id='.$entrepot->id;
|
||||
$head[$h][1] = $langs->trans("Users");
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Warehouse").': '.$entrepot->libelle);
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Warehouse").': '.$entrepot->libelle);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">'.$entrepot->libelle.'</td>';
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">'.$entrepot->libelle.'</td>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("LocationSummary").'</td><td colspan="3">'.$entrepot->lieu.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("LocationSummary").'</td><td colspan="3">'.$entrepot->lieu.'</td></tr>';
|
||||
|
||||
// Description
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">'.nl2br($entrepot->description).'</td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">'.nl2br($entrepot->description).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3">';
|
||||
print $entrepot->address;
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3">';
|
||||
print $entrepot->address;
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$entrepot->cp.'</td>';
|
||||
print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$entrepot->ville.'</td></tr>';
|
||||
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$entrepot->cp.'</td>';
|
||||
print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$entrepot->ville.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
print $entrepot->pays;
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
print $entrepot->pays;
|
||||
print '</td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$entrepot->getLibStatut(4).'</td></tr>';
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$entrepot->getLibStatut(4).'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("NumberOfProducts").'</td><td colspan="3">';
|
||||
print $entrepot->nb_products();
|
||||
print "</td></tr>";
|
||||
print '<tr><td valign="top">'.$langs->trans("NumberOfProducts").'</td><td colspan="3">';
|
||||
print $entrepot->nb_products();
|
||||
print "</td></tr>";
|
||||
|
||||
// Dernier mouvement
|
||||
$sql = "SELECT max( ".$db->pdate("m.datem").") as datem";
|
||||
$sql .= " FROM llx_stock_mouvement as m";
|
||||
$sql .= " WHERE m.fk_entrepot = '".$entrepot->id."';";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
// Dernier mouvement
|
||||
$sql = "SELECT max( ".$db->pdate("m.datem").") as datem";
|
||||
$sql .= " FROM llx_stock_mouvement as m";
|
||||
$sql .= " WHERE m.fk_entrepot = '".$entrepot->id."';";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("LastMovement").'</td><td colspan="3">';
|
||||
print '<a href="mouvement.php?id='.$entrepot->id.'">'.dolibarr_print_date($row[0]).'</a>';
|
||||
print "</td></tr>";
|
||||
print '<tr><td valign="top">'.$langs->trans("LastMovement").'</td><td colspan="3">';
|
||||
print '<a href="mouvement.php?id='.$entrepot->id.'">'.dolibarr_print_date($row[0]).'</a>';
|
||||
print "</td></tr>";
|
||||
|
||||
print "</table>";
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Barre d'action */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($_GET["action"] == '')
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"fiche.php?action=edit&id=".$entrepot->id."\">".$langs->trans("Modify")."</a>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
print '</div>';
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Affichage de la liste des produits de l'entrepot */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
print '<br>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Barre d'action */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
print_liste_field_titre($langs->trans("Product"),"", "p.ref","&id=".$_GET['id'],"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),"", "p.label","&id=".$_GET['id'],"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Units"),"", "ps.reel","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder);
|
||||
|
||||
print "</tr>";
|
||||
$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, ps.reel as value ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p ";
|
||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
||||
{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
||||
}
|
||||
$sql .= " WHERE ps.fk_product = p.rowid ";
|
||||
$sql .= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse)
|
||||
$sql .= " AND ps.fk_entrepot = ".$entrepot->id;
|
||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
||||
{
|
||||
$sql.= ' AND IFNULL(c.visible,1)=1';
|
||||
}
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($_GET["action"] == '')
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"fiche.php?action=edit&id=".$entrepot->id."\">".$langs->trans("Modify")."</a>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Affichage de la liste des produits de l'entrepot */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
print '<br>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("Product"),"", "p.ref","&id=".$_GET['id'],"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),"", "p.label","&id=".$_GET['id'],"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Units"),"", "ps.reel","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder);
|
||||
if ($user->rights->stock->mouvement->creer) print '<td> </td>';
|
||||
if ($user->rights->stock->creer) print '<td> </td>';
|
||||
print "</tr>";
|
||||
|
||||
$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, ps.reel as value ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p ";
|
||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
||||
{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
||||
}
|
||||
$sql .= " WHERE ps.fk_product = p.rowid ";
|
||||
$sql .= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse)
|
||||
$sql .= " AND ps.fk_entrepot = ".$entrepot->id;
|
||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
||||
{
|
||||
$sql.= ' AND IFNULL(c.visible,1)=1';
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY " . $sortfield . " " . $sortorder;
|
||||
|
||||
//$sql .= $db->plimit($limit + 1 ,$offset);
|
||||
//$sql .= $db->plimit($limit + 1 ,$offset);
|
||||
|
||||
$resql = $db->query($sql) ;
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
// Multilangs
|
||||
if ($conf->global->MAIN_MULTILANGS) // si l'option est active
|
||||
{
|
||||
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
|
||||
$sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'";
|
||||
$sql.= " LIMIT 1";
|
||||
$resql = $db->query($sql) ;
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$objtp = $db->fetch_object($result);
|
||||
if ($objtp->label != '') $objp->produit = $objtp->label;
|
||||
}
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
//print '<td>'.dolibarr_print_date($objp->datem).'</td>';
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"../fiche.php?id=$objp->rowid\">";
|
||||
print img_object($langs->trans("ShowProduct"),"product").' '.$objp->ref;
|
||||
print "</a></td>";
|
||||
print '<td>'.$objp->produit.'</td>';
|
||||
print '<td align="right">'.$objp->value.'</td>';
|
||||
//print "<td><a href=\"fiche.php?id=$objp->entrepot_id\">";
|
||||
//print img_object($langs->trans("ShowWarehous"),"stock").' '.$objp->stock;
|
||||
//print "</a></td>\n";
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
// Multilangs
|
||||
if ($conf->global->MAIN_MULTILANGS) // si l'option est active
|
||||
{
|
||||
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
|
||||
$sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'";
|
||||
$sql.= " LIMIT 1";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$objtp = $db->fetch_object($result);
|
||||
if ($objtp->label != '') $objp->produit = $objtp->label;
|
||||
}
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
//print '<td>'.dolibarr_print_date($objp->datem).'</td>';
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"../fiche.php?id=$objp->rowid\">";
|
||||
print img_object($langs->trans("ShowProduct"),"product").' '.$objp->ref;
|
||||
print "</a></td>";
|
||||
print '<td>'.$objp->produit.'</td>';
|
||||
print '<td align="right">'.$objp->value.'</td>';
|
||||
|
||||
if ($user->rights->stock->mouvement->creer)
|
||||
{
|
||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/product/stock/product.php?dwid='.$entrepot->id.'&id='.$objp->rowid.'&action=transfert">';
|
||||
print $langs->trans("StockMovement");
|
||||
print "</a></td>";
|
||||
}
|
||||
|
||||
if ($user->rights->stock->creer)
|
||||
{
|
||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/product/stock/product.php?dwid='.$entrepot->id.'&id='.$objp->rowid.'&action=correction">';
|
||||
print $langs->trans("StockCorrection");
|
||||
print "</a></td>";
|
||||
}
|
||||
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Edition fiche
|
||||
*/
|
||||
if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && 1)
|
||||
{
|
||||
print_fiche_titre($langs->trans("WarehouseEdit"), $mesg);
|
||||
/*
|
||||
* Edition fiche
|
||||
*/
|
||||
if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && 1)
|
||||
{
|
||||
print_fiche_titre($langs->trans("WarehouseEdit"), $mesg);
|
||||
|
||||
print '<form action="fiche.php" method="POST">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$entrepot->id.'">';
|
||||
print '<form action="fiche.php" method="POST">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$entrepot->id.'">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3"><input name="libelle" size="20" value="'.$entrepot->libelle.'"></td></tr>';
|
||||
|
||||
print '<tr><td width="20%">'.$langs->trans("LocationSummary").'</td><td colspan="3"><input name="lieu" size="40" value="'.$entrepot->lieu.'"></td></tr>';
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3"><input name="libelle" size="20" value="'.$entrepot->libelle.'"></td></tr>';
|
||||
|
||||
// Description
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">';
|
||||
print '<tr><td width="20%">'.$langs->trans("LocationSummary").'</td><td colspan="3"><input name="lieu" size="40" value="'.$entrepot->lieu.'"></td></tr>';
|
||||
|
||||
// Description
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">';
|
||||
if ($conf->fckeditor->enabled)
|
||||
{
|
||||
// Editeur wysiwyg
|
||||
{
|
||||
// Editeur wysiwyg
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
$doleditor=new DolEditor('desc',$entrepot->description,180,'dolibarr_notes','In',false);
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="desc" cols="70" rows="5">'.dol_htmlentitiesbr_decode($entrepot->description).'</textarea>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" cols="60" rows="3" wrap="soft">';
|
||||
print $entrepot->address;
|
||||
print '</textarea></td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" cols="60" rows="3" wrap="soft">';
|
||||
print $entrepot->address;
|
||||
print '</textarea></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Zip').'</td><td><input size="6" type="text" name="cp" value="'.$entrepot->cp.'"></td>';
|
||||
print '<td>'.$langs->trans('Town').'</td><td><input type="text" name="ville" value="'.$entrepot->ville.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Zip').'</td><td><input size="6" type="text" name="cp" value="'.$entrepot->cp.'"></td>';
|
||||
print '<td>'.$langs->trans('Town').'</td><td><input type="text" name="ville" value="'.$entrepot->ville.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
$form->select_pays($entrepot->pays_id, 'pays_id');
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
$form->select_pays($entrepot->pays_id, 'pays_id');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td width="20%">'.$langs->trans("Status").'</td><td colspan="3">';
|
||||
print '<select name="statut">';
|
||||
print '<option value="0" '.($entrepot->statut == 0?'selected="true"':'').'>'.$langs->trans("WarehouseClosed").'</option>';
|
||||
print '<option value="1" '.($entrepot->statut == 0?'':'selected="true"').'>'.$langs->trans("WarehouseOpened").'</option>';
|
||||
print '</select>';
|
||||
print '</td></tr>';
|
||||
print '<tr><td width="20%">'.$langs->trans("Status").'</td><td colspan="3">';
|
||||
print '<select name="statut">';
|
||||
print '<option value="0" '.($entrepot->statut == 0?'selected="true"':'').'>'.$langs->trans("WarehouseClosed").'</option>';
|
||||
print '<option value="1" '.($entrepot->statut == 0?'':'selected="true"').'>'.$langs->trans("WarehouseOpened").'</option>';
|
||||
print '</select>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -121,7 +121,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Libellé
|
||||
// Libell<EFBFBD>
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -231,7 +231,9 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
print '<td width="20%">'.$langs->trans("Warehouse").'</td>';
|
||||
|
||||
// Entrepot
|
||||
print '<td width="20%"><select class="flat" name="id_entrepot">';
|
||||
print '<td width="20%">';
|
||||
|
||||
print '<select class="flat" name="id_entrepot">';
|
||||
$sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e";
|
||||
$sql .= " WHERE statut = 1";
|
||||
$sql .= " ORDER BY lower(e.label)";
|
||||
@ -240,15 +242,20 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 1) print '<option value="-1"> ';
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<option value="'.$obj->rowid.'">'.$obj->label ;
|
||||
print '<option value="'.$obj->rowid.'"';
|
||||
if ($_GET["dwid"]==$obj->rowid) print ' selected="true"';
|
||||
print '>'.$obj->label ;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print '</select></td>';
|
||||
print '</select>';
|
||||
|
||||
print '</td>';
|
||||
print '<td width="20%">';
|
||||
print '<select name="mouvement" class="flat">';
|
||||
print '<option value="0">'.$langs->trans("Add").'</option>';
|
||||
@ -265,7 +272,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
}
|
||||
|
||||
/*
|
||||
* Transfert de pièces
|
||||
* Transfert of units
|
||||
*/
|
||||
if ($_GET["action"] == "transfert")
|
||||
{
|
||||
@ -273,7 +280,10 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
print "<form action=\"product.php?id=$product->id\" method=\"post\">\n";
|
||||
print '<input type="hidden" name="action" value="transfert_stock">';
|
||||
print '<table class="border" width="100%"><tr>';
|
||||
print '<td width="20%">'.$langs->trans("Source").'</td><td width="20%"><select name="id_entrepot_source">';
|
||||
print '<td width="20%">'.$langs->trans("Source").'</td><td width="20%">';
|
||||
|
||||
// Select datewarehous
|
||||
print '<select name="id_entrepot_source">';
|
||||
|
||||
$sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e";
|
||||
$sql .= " WHERE statut = 1";
|
||||
@ -283,18 +293,25 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 1) print '<option value="-1"> ';
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<option value="'.$obj->rowid.'">'.$obj->label ;
|
||||
print '<option value="'.$obj->rowid.'"';
|
||||
if ($_GET["dwid"]==$obj->rowid) print ' selected="true"';
|
||||
print '>'.$obj->label ;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print '</select></td>';
|
||||
|
||||
print '<td width="20%">'.$langs->trans("Target").'</td><td width="20%"><select name="id_entrepot_destination">';
|
||||
print '</select>';
|
||||
|
||||
print '</td>';
|
||||
|
||||
print '<td width="20%">'.$langs->trans("Target").'</td><td width="20%">';
|
||||
|
||||
// Select datawarehous
|
||||
print '<select name="id_entrepot_destination">';
|
||||
$sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e";
|
||||
$sql .= " WHERE statut = 1";
|
||||
$sql .= " ORDER BY lower(e.label)";
|
||||
@ -303,6 +320,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 1) print '<option value="-1"> ';
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
@ -311,7 +329,9 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print '</select></td>';
|
||||
print '</select>';
|
||||
|
||||
print '</td>';
|
||||
print '<td width="20%">'.$langs->trans("NumberOfUnit").'</td><td width="20%"><input name="nbpiece" size="10" value=""></td></tr>';
|
||||
print '<tr><td colspan="6" align="center"><input type="submit" class="button" value="'.$langs->trans('Save').'"> ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||
@ -329,8 +349,10 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
print "<form action=\"product.php?id=$product->id\" method=\"post\">\n";
|
||||
print '<input type="hidden" name="action" value="create_stock">';
|
||||
print '<table class="border" width="100%"><tr>';
|
||||
print '<td width="20%">'.$langs->trans("Warehouse").'</td><td width="40%"><select name="id_entrepot">';
|
||||
print '<td width="20%">'.$langs->trans("Warehouse").'</td><td width="40%">';
|
||||
|
||||
// Select datawarehouse
|
||||
print '<select name="id_entrepot">';
|
||||
$sql = "SELECT e.rowid, e.label FROM ".MAIN_DB_PREFIX."entrepot as e";
|
||||
$sql .= " ORDER BY lower(e.label)";
|
||||
|
||||
@ -338,6 +360,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 1) print '<option value="-1"> ';
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
@ -346,7 +369,8 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print '</select></td><td width="20%">Nb de pièce</td><td width="20%"><input name="nbpiece" size="10" value=""></td></tr>';
|
||||
print '</select>';
|
||||
print '</td><td width="20%">'.$langs->trans("NbOfUnit").'</td><td width="20%"><input name="nbpiece" size="10" value=""></td></tr>';
|
||||
print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans('Save').'"> ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user