Last movement date info is mre clear.

This commit is contained in:
Laurent Destailleur 2011-11-06 13:54:06 +01:00
parent 02a70efdf5
commit 9e50499195
2 changed files with 41 additions and 26 deletions

View File

@ -34,9 +34,10 @@ $langs->load("products");
$langs->load("stocks"); $langs->load("stocks");
$langs->load("companies"); $langs->load("companies");
$action=GETPOST('action');
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; $sortfield = GETPOST("sortfield");
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; $sortorder = GETPOST("sortorder");
if (! $sortfield) $sortfield="p.ref"; if (! $sortfield) $sortfield="p.ref";
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC";
@ -48,7 +49,7 @@ $mesg = '';
*/ */
// Ajout entrepot // Ajout entrepot
if ($_POST["action"] == 'add' && $user->rights->stock->creer) if ($action == 'add' && $user->rights->stock->creer)
{ {
$entrepot = new Entrepot($db); $entrepot = new Entrepot($db);
@ -70,17 +71,17 @@ if ($_POST["action"] == 'add' && $user->rights->stock->creer)
exit; exit;
} }
$_GET["action"] = 'create'; $action = 'create';
$mesg='<div class="error">'.$entrepot->error.'</div>'; $mesg='<div class="error">'.$entrepot->error.'</div>';
} }
else { else {
$mesg='<div class="error">'.$langs->trans("ErrorWarehouseRefRequired").'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorWarehouseRefRequired").'</div>';
$_GET["action"]="create"; // Force retour sur page creation $action="create"; // Force retour sur page creation
} }
} }
// Delete warehouse // Delete warehouse
if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->stock->supprimer) if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->stock->supprimer)
{ {
$entrepot = new Entrepot($db); $entrepot = new Entrepot($db);
$entrepot->fetch($_REQUEST["id"]); $entrepot->fetch($_REQUEST["id"]);
@ -93,12 +94,12 @@ if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' &&
else else
{ {
$mesg='<div class="error">'.$entrepot->error.'</div>'; $mesg='<div class="error">'.$entrepot->error.'</div>';
$_REQUEST['action']=''; $action='';
} }
} }
// Modification entrepot // Modification entrepot
if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel")) if ($action == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
{ {
$entrepot = new Entrepot($db); $entrepot = new Entrepot($db);
if ($entrepot->fetch($_POST["id"])) if ($entrepot->fetch($_POST["id"]))
@ -114,20 +115,20 @@ if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
if ( $entrepot->update($_POST["id"], $user) > 0) if ( $entrepot->update($_POST["id"], $user) > 0)
{ {
$_GET["action"] = ''; $action = '';
$_GET["id"] = $_POST["id"]; $_GET["id"] = $_POST["id"];
//$mesg = '<div class="ok">Fiche mise a jour</div>'; //$mesg = '<div class="ok">Fiche mise a jour</div>';
} }
else else
{ {
$_GET["action"] = 'edit'; $action = 'edit';
$_GET["id"] = $_POST["id"]; $_GET["id"] = $_POST["id"];
$mesg = '<div class="error">'.$entrepot->error.'</div>'; $mesg = '<div class="error">'.$entrepot->error.'</div>';
} }
} }
else else
{ {
$_GET["action"] = 'edit'; $action = 'edit';
$_GET["id"] = $_POST["id"]; $_GET["id"] = $_POST["id"];
$mesg = '<div class="error">'.$entrepot->error.'</div>'; $mesg = '<div class="error">'.$entrepot->error.'</div>';
} }
@ -135,7 +136,7 @@ if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
if ($_POST["cancel"] == $langs->trans("Cancel")) if ($_POST["cancel"] == $langs->trans("Cancel"))
{ {
$_GET["action"] = ''; $action = '';
$_GET["id"] = $_POST["id"]; $_GET["id"] = $_POST["id"];
} }
@ -152,7 +153,7 @@ $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
llxHeader("",$langs->trans("WarehouseCard"),$help_url); llxHeader("",$langs->trans("WarehouseCard"),$help_url);
if ($_GET["action"] == 'create') if ($action == 'create')
{ {
print_fiche_titre($langs->trans("NewWarehouse")); print_fiche_titre($langs->trans("NewWarehouse"));
@ -218,14 +219,14 @@ else
/* /*
* Affichage fiche * Affichage fiche
*/ */
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') if ($action <> 'edit' && $action <> 're-edit')
{ {
$head = stock_prepare_head($entrepot); $head = stock_prepare_head($entrepot);
dol_fiche_head($head, 'card', $langs->trans("Warehouse"), 0, 'stock'); dol_fiche_head($head, 'card', $langs->trans("Warehouse"), 0, 'stock');
// Confirm delete third party // Confirm delete third party
if ($_GET["action"] == 'delete') if ($action == 'delete')
{ {
$html = new Form($db); $html = new Form($db);
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$entrepot->id,$langs->trans("DeleteAWarehouse"),$langs->trans("ConfirmDeleteWarehouse",$entrepot->libelle),"confirm_delete",'',0,2); $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$entrepot->id,$langs->trans("DeleteAWarehouse"),$langs->trans("ConfirmDeleteWarehouse",$entrepot->libelle),"confirm_delete",'',0,2);
@ -290,8 +291,15 @@ else
dol_print_error($db); dol_print_error($db);
} }
print '<tr><td valign="top">'.$langs->trans("LastMovement").'</td><td colspan="3">'; print '<tr><td valign="top">'.$langs->trans("LastMovement").'</td><td colspan="3">';
if ($lastmovementdate) print dol_print_date($lastmovementdate,'dayhour').' '; if ($lastmovementdate)
print '(<a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$entrepot->id.'">'.$langs->trans("FullList").'</a>)'; {
print dol_print_date($lastmovementdate,'dayhour').' ';
print '(<a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$entrepot->id.'">'.$langs->trans("FullList").'</a>)';
}
else
{
print $langs->trans("None");
}
print "</td></tr>"; print "</td></tr>";
print "</table>"; print "</table>";
@ -307,7 +315,7 @@ else
print "<div class=\"tabsAction\">\n"; print "<div class=\"tabsAction\">\n";
if ($_GET["action"] == '') if ($action == '')
{ {
if ($user->rights->stock->creer) if ($user->rights->stock->creer)
print "<a class=\"butAction\" href=\"fiche.php?action=edit&id=".$entrepot->id."\">".$langs->trans("Modify")."</a>"; print "<a class=\"butAction\" href=\"fiche.php?action=edit&id=".$entrepot->id."\">".$langs->trans("Modify")."</a>";
@ -460,7 +468,7 @@ else
/* /*
* Edition fiche * Edition fiche
*/ */
if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && 1) if (($action == 'edit' || $action == 're-edit') && 1)
{ {
print_fiche_titre($langs->trans("WarehouseEdit"), $mesg); print_fiche_titre($langs->trans("WarehouseEdit"), $mesg);

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -43,9 +43,9 @@ $search_movement = isset($_REQUEST["search_movement"])?$_REQUEST["search_movemen
$search_product = isset($_REQUEST["search_product"])?$_REQUEST["search_product"]:''; $search_product = isset($_REQUEST["search_product"])?$_REQUEST["search_product"]:'';
$search_warehouse = isset($_REQUEST["search_warehouse"])?$_REQUEST["search_warehouse"]:''; $search_warehouse = isset($_REQUEST["search_warehouse"])?$_REQUEST["search_warehouse"]:'';
$search_user = isset($_REQUEST["search_user"])?$_REQUEST["search_user"]:''; $search_user = isset($_REQUEST["search_user"])?$_REQUEST["search_user"]:'';
$page = $_GET["page"]; $page = GETPOST("page");
$sortfield = $_GET["sortfield"]; $sortfield = GETPOST("sortfield");
$sortorder = $_GET["sortorder"]; $sortorder = GETPOST("sortorder");
if ($page < 0) $page = 0; if ($page < 0) $page = 0;
$offset = $conf->liste_limit * $page; $offset = $conf->liste_limit * $page;
@ -173,7 +173,7 @@ if ($resql)
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 // 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">'.dol_htmlentitiesbr($entrepot->description).'</td></tr>';
// Address // Address
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3">';
@ -222,7 +222,14 @@ if ($resql)
} }
print '<tr><td valign="top">'.$langs->trans("LastMovement").'</td><td colspan="3">'; print '<tr><td valign="top">'.$langs->trans("LastMovement").'</td><td colspan="3">';
if ($lastmovementdate) print dol_print_date($lastmovementdate,'dayhour'); if ($lastmovementdate)
{
print dol_print_date($lastmovementdate,'dayhour');
}
else
{
print $langs->trans("None");
}
print "</td></tr>"; print "</td></tr>";
print "</table>"; print "</table>";