* Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * * 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. */ /** * \file htdocs/fourn/commande/history.php * \ingroup commande * \brief Fiche commande * \version $Id$ */ require("../../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/fourn.lib.php"); require_once(DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php"); $langs->load("orders"); $langs->load("suppliers"); $langs->load("companies"); $langs->load('stocks'); // Security check $id = isset($_GET["id"])?$_GET["id"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'commande_fournisseur', $id,''); /* * View */ $html = new Form($db); $now=gmmktime(); $ref= $_GET['ref']; if ($id > 0 || ! empty($ref)) { $soc = new Societe($db); $commande = new CommandeFournisseur($db); $result=$commande->fetch($_GET["id"],$_GET['ref']); if ($result >= 0) { $soc->fetch($commande->socid); $author = new User($db); $author->fetch($commande->user_author_id); llxHeader('',$langs->trans("History"),"CommandeFournisseur"); $head = ordersupplier_prepare_head($commande); $title=$langs->trans("SupplierOrder"); dol_fiche_head($head, 'info', $title, 0, 'order'); /* * Commande */ print ''; // Ref print ''; print ''; print ''; // Fournisseur print '"; print ''; print ''; // Statut print ''; print ''; print '"; // Date if ($commande->methode_commande_id > 0) { print '"; if ($commande->methode_commande) { print ''; } } // Auteur print ''; print ''; print ''; print "
'.$langs->trans("Ref").''; print $html->showrefnav($commande,'ref','',1,'ref','ref'); print '
'.$langs->trans("Supplier")."'.$soc->getNomUrl(1,'supplier').'
'.$langs->trans("Status").''; print $commande->getLibStatut(4); print "
'.$langs->trans("Date").''; if ($commande->date_commande) { print dol_print_date($commande->date_commande,"dayhourtext")."\n"; } print "
'.$langs->trans("Method").''.$commande->methode_commande.'
'.$langs->trans("AuthorRequest").''.$author->getNomUrl(1).'
\n"; print "
"; /* * Suivi historique * Date - Statut - Auteur */ print ''; print ''; print ''; print ''; print ''; print ''; $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"; $sql.= " , ".MAIN_DB_PREFIX."user as u "; $sql.= " WHERE l.fk_commande = ".$commande->id; $sql.= " 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 ""; print '\n"; // Statut print '\n"; // User print ''; // Comment print '\n"; print ''; $i++; } $db->free($resql); } else { dol_print_error($db); } print "
'.$langs->trans("Date").''.$langs->trans("Status").''.$langs->trans("Author").''.$langs->trans("Comment").'
'.dol_print_date($db->jdate($obj->dl),"dayhour")."'.$commande->LibStatut($obj->fk_statut,4)."'; print img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''.dol_trunc($obj->comment,48)."
"; print ''; } else { /* Commande non trouvee */ print "Commande inexistante ou acces refuse"; } } $db->close(); llxFooter('$Date$ - $Revision$'); ?>