dolibarr/htdocs/fourn/commande/history.php

194 lines
5.1 KiB
PHP
Raw Normal View History

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>
2012-12-30 15:13:49 +01:00
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
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 3 of the License, or
2004-11-30 14:35:44 +01:00
* (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
2011-08-01 01:45:11 +02:00
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2004-11-30 14:35:44 +01:00
*/
2005-08-31 23:56:05 +02:00
/**
2009-07-29 21:47:15 +02:00
* \file htdocs/fourn/commande/history.php
* \ingroup commande
* \brief Fiche commande
*/
2004-11-30 14:35:44 +01:00
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.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
2012-07-13 10:15:47 +02:00
$id=GETPOST('id','int');
$ref=GETPOST('ref','alpha');
// Security check
2012-07-13 10:15:47 +02:00
$socid='';
if (! empty($user->societe_id)) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $id, '', 'commande');
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
*/
$form = new Form($db);
2009-01-31 01:06:19 +01:00
2012-03-23 18:19:50 +01:00
$now=dol_now();
2005-04-04 16:01:56 +02:00
2009-01-31 01:06:19 +01:00
if ($id > 0 || ! empty($ref))
2004-11-30 14:35:44 +01:00
{
$soc = new Societe($db);
$commande = new CommandeFournisseur($db);
2012-07-13 10:15:47 +02:00
$result=$commande->fetch($id,$ref);
2009-01-31 01:06:19 +01:00
if ($result >= 0)
{
$soc->fetch($commande->socid);
2006-08-20 01:00:53 +02:00
$author = new User($db);
$author->fetch($commande->user_author_id);
2006-08-20 01:00:53 +02:00
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);
$title=$langs->trans("SupplierOrder");
2009-08-06 16:44:24 +02:00
dol_fiche_head($head, 'info', $title, 0, 'order');
/*
* Commande
*/
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/liste.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
2009-01-31 01:06:19 +01:00
print '<td colspan="2">';
print $form->showrefnav($commande, 'ref', $linkback, 1, 'ref', 'ref');
2009-01-31 01:06:19 +01:00
print '</td>';
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>';
print '</tr>';
2009-01-31 01:06:19 +01:00
// Statut
print '<tr>';
print '<td>'.$langs->trans("Status").'</td>';
print '<td colspan="2">';
print $commande->getLibStatut(4);
print "</td></tr>";
2009-01-31 01:06:19 +01:00
// Date
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)
{
print dol_print_date($commande->date_commande,"dayhourtext")."\n";
2009-01-31 01:06:19 +01:00
}
print "</td></tr>";
2009-01-31 01:06:19 +01:00
if ($commande->methode_commande)
{
2012-08-24 19:55:31 +02:00
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$commande->getInputMethod().'</td></tr>';
2009-01-31 01:06:19 +01: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>';
print "</table>\n";
print "<br>";
/*
* Suivi historique
* Date - Statut - Auteur
*/
print '<table class="noborder" width="100%">';
2009-07-29 21:47:15 +02:00
print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Date").'</td>';
print '<td class="liste_titre">'.$langs->trans("Status").'</td>';
print '<td class="liste_titre" align="center">'.$langs->trans("Author").'</td>';
print '<td class="liste_titre" align="left">'.$langs->trans("Comment").'</td>';
print '</tr>';
2013-02-23 17:40:28 +01:00
$sql = "SELECT l.fk_statut, l.datelog as dl, l.comment, u.rowid, u.login, u.firstname, u.lastname";
$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);
2013-06-20 09:18:12 +02:00
print "<tr ".$bc[$var].">";
print '<td width="20%">'.dol_print_date($db->jdate($obj->dl),"dayhour")."</td>\n";
// Statut
print '<td class="nowrap">'.$commande->LibStatut($obj->fk_statut,4)."</td>\n";
// User
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">';
print img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
// Comment
print '<td class="nowrap" title="'.dol_escape_htmltag($obj->comment).'">'.dol_trunc($obj->comment,48)."</td>\n";
print '</tr>';
$i++;
}
$db->free($resql);
}
else
{
dol_print_error($db);
}
print "</table>";
print '</div>';
}
else
{
2009-07-29 21:47:15 +02:00
/* Commande non trouvee */
print "Commande inexistante ou acces refuse";
}
2009-01-31 01:06:19 +01:00
}
2004-11-30 14:35:44 +01:00
llxFooter();
2012-07-13 10:15:47 +02:00
$db->close();
2004-11-30 14:35:44 +01:00
?>