2004-11-30 14:35:44 +01:00
|
|
|
|
<?php
|
2005-04-04 15:56:57 +02:00
|
|
|
|
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2009-01-31 01:06:19 +01:00
|
|
|
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
2004-11-30 14:35:44 +01:00
|
|
|
|
*
|
|
|
|
|
|
* This program 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.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This program 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 this program; if not, write to the Free Software
|
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2005-08-31 23:56:05 +02:00
|
|
|
|
/**
|
|
|
|
|
|
\file htdocs/fourn/commande/history.php
|
|
|
|
|
|
\ingroup commande
|
|
|
|
|
|
\brief Fiche commande
|
2008-11-24 21:09:23 +01:00
|
|
|
|
\version $Id$
|
2004-11-30 14:35:44 +01:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
require("./pre.inc.php");
|
2008-11-24 21:09:23 +01:00
|
|
|
|
require_once(DOL_DOCUMENT_ROOT."/lib/fourn.lib.php");
|
2004-11-30 14:35:44 +01:00
|
|
|
|
|
|
|
|
|
|
$langs->load("orders");
|
|
|
|
|
|
$langs->load("suppliers");
|
|
|
|
|
|
$langs->load("companies");
|
2006-12-20 12:21:33 +01:00
|
|
|
|
$langs->load('stocks');
|
2004-11-30 14:35:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
2005-04-04 16:01:56 +02:00
|
|
|
|
if (!$user->rights->fournisseur->commande->lire) accessforbidden();
|
2005-08-31 23:56:05 +02:00
|
|
|
|
|
2004-11-30 14:35:44 +01:00
|
|
|
|
|
2009-01-31 01:06:19 +01:00
|
|
|
|
/*
|
|
|
|
|
|
* View
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
$html = new Form($db);
|
|
|
|
|
|
|
|
|
|
|
|
$now=gmmktime();
|
2005-04-04 16:01:56 +02:00
|
|
|
|
|
2009-01-31 01:06:19 +01:00
|
|
|
|
$id = $_GET['id'];
|
|
|
|
|
|
$ref= $_GET['ref'];
|
|
|
|
|
|
if ($id > 0 || ! empty($ref))
|
2004-11-30 14:35:44 +01:00
|
|
|
|
{
|
2006-05-06 17:30:34 +02:00
|
|
|
|
$soc = new Societe($db);
|
|
|
|
|
|
$commande = new CommandeFournisseur($db);
|
|
|
|
|
|
|
2009-01-31 01:06:19 +01:00
|
|
|
|
$result=$commande->fetch($_GET["id"],$_GET['ref']);
|
|
|
|
|
|
if ($result >= 0)
|
2006-05-06 17:30:34 +02:00
|
|
|
|
{
|
2006-09-13 20:56:30 +02:00
|
|
|
|
$soc->fetch($commande->socid);
|
2006-05-06 17:30:34 +02:00
|
|
|
|
|
2006-08-20 01:00:53 +02:00
|
|
|
|
$author = new User($db);
|
|
|
|
|
|
$author->id = $commande->user_author_id;
|
|
|
|
|
|
$author->fetch();
|
|
|
|
|
|
|
2009-01-31 01:06:19 +01:00
|
|
|
|
llxHeader('',$langs->trans("History"),"CommandeFournisseur");
|
2004-11-30 14:35:44 +01:00
|
|
|
|
|
2008-11-24 21:09:23 +01:00
|
|
|
|
$head = ordersupplier_prepare_head($commande);
|
2006-05-06 17:30:34 +02:00
|
|
|
|
|
|
|
|
|
|
$title=$langs->trans("SupplierOrder");
|
2009-02-20 23:53:15 +01:00
|
|
|
|
dol_fiche_head($head, 'info', $title);
|
2006-05-06 17:30:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
* Commande
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
print '<table class="border" width="100%">';
|
|
|
|
|
|
|
|
|
|
|
|
// Ref
|
|
|
|
|
|
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
|
2009-01-31 01:06:19 +01:00
|
|
|
|
print '<td colspan="2">';
|
|
|
|
|
|
print $html->showrefnav($commande,'ref','',1,'ref','ref');
|
|
|
|
|
|
print '</td>';
|
2006-05-06 17:30:34 +02:00
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
|
|
// Fournisseur
|
2009-01-31 01:06:19 +01:00
|
|
|
|
print '<tr><td>'.$langs->trans("Supplier")."</td>";
|
|
|
|
|
|
print '<td colspan="2">'.$soc->getNomUrl(1,'supplier').'</td>';
|
2006-05-06 17:30:34 +02:00
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
2009-01-31 01:06:19 +01:00
|
|
|
|
// Statut
|
|
|
|
|
|
print '<tr>';
|
|
|
|
|
|
print '<td>'.$langs->trans("Status").'</td>';
|
|
|
|
|
|
print '<td colspan="2">';
|
2006-05-06 17:30:34 +02:00
|
|
|
|
print $commande->getLibStatut(4);
|
|
|
|
|
|
print "</td></tr>";
|
|
|
|
|
|
|
2009-01-31 01:06:19 +01:00
|
|
|
|
// Date
|
2006-05-06 17:30:34 +02:00
|
|
|
|
if ($commande->methode_commande_id > 0)
|
|
|
|
|
|
{
|
2009-01-31 01:06:19 +01:00
|
|
|
|
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
|
|
|
|
|
|
if ($commande->date_commande)
|
|
|
|
|
|
{
|
2009-02-20 23:53:15 +01:00
|
|
|
|
print dol_print_date($commande->date_commande,"dayhourtext")."\n";
|
2009-01-31 01:06:19 +01:00
|
|
|
|
}
|
2006-05-06 17:30:34 +02:00
|
|
|
|
print "</td></tr>";
|
2009-01-31 01:06:19 +01:00
|
|
|
|
|
|
|
|
|
|
if ($commande->methode_commande)
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$commande->methode_commande.'</td></tr>';
|
|
|
|
|
|
}
|
2006-05-06 17:30:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2009-01-31 01:06:19 +01:00
|
|
|
|
// Auteur
|
|
|
|
|
|
print '<tr><td>'.$langs->trans("AuthorRequest").'</td>';
|
|
|
|
|
|
print '<td colspan="2">'.$author->getNomUrl(1).'</td>';
|
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
2006-05-06 17:30:34 +02:00
|
|
|
|
print "</table>\n";
|
|
|
|
|
|
print "<br>";
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
* Suivi historique
|
|
|
|
|
|
* Date - Statut - Auteur
|
|
|
|
|
|
*/
|
|
|
|
|
|
print '<table class="noborder" width="100%">';
|
|
|
|
|
|
|
|
|
|
|
|
print '<tr class="liste_titre"><td>'.$langs->trans("Date").'</td>';
|
|
|
|
|
|
print '<td>'.$langs->trans("Status").'</td>';
|
|
|
|
|
|
print '<td align="center">'.$langs->trans("Author").'</td>';
|
2009-02-02 23:11:10 +01:00
|
|
|
|
print '<td align="left">'.$langs->trans("Comment").'</td>';
|
2006-05-06 17:30:34 +02:00
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
2009-02-02 23:11:10 +01:00
|
|
|
|
$sql = "SELECT l.fk_statut, l.datelog as dl, l.comment, u.rowid, u.login, u.firstname, u.name";
|
|
|
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_log as l";
|
2006-05-06 17:30:34 +02:00
|
|
|
|
$sql .= " , ".MAIN_DB_PREFIX."user as u ";
|
|
|
|
|
|
$sql .= " WHERE l.fk_commande = ".$commande->id." AND u.rowid = l.fk_user";
|
|
|
|
|
|
$sql .= " ORDER BY l.rowid DESC";
|
|
|
|
|
|
|
|
|
|
|
|
$resql = $db->query($sql);
|
|
|
|
|
|
if ($resql)
|
|
|
|
|
|
{
|
|
|
|
|
|
$num = $db->num_rows($resql);
|
|
|
|
|
|
$i = 0;
|
|
|
|
|
|
|
|
|
|
|
|
$var=True;
|
|
|
|
|
|
while ($i < $num)
|
|
|
|
|
|
{
|
|
|
|
|
|
$var=!$var;
|
|
|
|
|
|
|
|
|
|
|
|
$obj = $db->fetch_object($resql);
|
|
|
|
|
|
print "<tr $bc[$var]>";
|
|
|
|
|
|
|
2009-02-20 23:53:15 +01:00
|
|
|
|
print '<td width="20%">'.dol_print_date($db->jdate($obj->dl),"dayhour")."</td>\n";
|
2006-05-06 17:30:34 +02:00
|
|
|
|
|
|
|
|
|
|
// Statut
|
2006-08-26 02:52:26 +02:00
|
|
|
|
print '<td width="100px" nowrap="1">'.$commande->LibStatut($obj->fk_statut,4)."</td>\n";
|
2006-05-06 17:30:34 +02:00
|
|
|
|
|
|
|
|
|
|
// User
|
|
|
|
|
|
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">';
|
2007-03-10 23:14:14 +01:00
|
|
|
|
print img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
|
2006-05-06 17:30:34 +02:00
|
|
|
|
|
2009-02-02 23:11:10 +01:00
|
|
|
|
// Comment
|
2009-02-20 23:53:15 +01:00
|
|
|
|
print '<td width="100px" nowrap="1" title="'.dol_escape_htmltag($obj->comment).'">'.dol_trunc($obj->comment,48)."</td>\n";
|
2009-02-02 23:11:10 +01:00
|
|
|
|
|
2006-05-06 17:30:34 +02:00
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
|
|
$i++;
|
|
|
|
|
|
}
|
|
|
|
|
|
$db->free($resql);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2009-02-20 23:53:15 +01:00
|
|
|
|
dol_print_error($db);
|
2006-05-06 17:30:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
print "</table>";
|
|
|
|
|
|
|
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
/* Commande non trouv<75>e */
|
|
|
|
|
|
print "Commande inexistante ou acc<63>s refus<75>";
|
|
|
|
|
|
}
|
2009-01-31 01:06:19 +01:00
|
|
|
|
}
|
2004-11-30 14:35:44 +01:00
|
|
|
|
|
|
|
|
|
|
$db->close();
|
|
|
|
|
|
|
2005-08-31 23:56:05 +02:00
|
|
|
|
llxFooter('$Date$ - $Revision$');
|
2004-11-30 14:35:44 +01:00
|
|
|
|
?>
|