2005-04-04 16:03:21 +02:00
|
|
|
|
<?php
|
|
|
|
|
|
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2009-01-31 01:06:19 +01:00
|
|
|
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
2009-04-27 22:37:50 +02:00
|
|
|
|
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
2005-04-04 16:03:21 +02: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.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-08-06 16:44:24 +02:00
|
|
|
|
* \file htdocs/fourn/commande/note.php
|
|
|
|
|
|
* \ingroup commande
|
|
|
|
|
|
* \brief Fiche note commande
|
|
|
|
|
|
* \version $Id$
|
|
|
|
|
|
*/
|
2005-04-04 16:03:21 +02:00
|
|
|
|
|
2010-03-27 16:06:19 +01:00
|
|
|
|
require("../../main.inc.php");
|
2008-11-24 21:09:23 +01:00
|
|
|
|
require_once(DOL_DOCUMENT_ROOT."/lib/fourn.lib.php");
|
2010-04-09 11:04:28 +02:00
|
|
|
|
require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.commande.class.php");
|
2005-04-04 16:03:21 +02:00
|
|
|
|
|
|
|
|
|
|
$langs->load("orders");
|
|
|
|
|
|
$langs->load("suppliers");
|
|
|
|
|
|
$langs->load("companies");
|
2006-12-20 12:21:33 +01:00
|
|
|
|
$langs->load('stocks');
|
2005-04-04 16:03:21 +02:00
|
|
|
|
|
2009-04-27 22:37:50 +02:00
|
|
|
|
// Security check
|
|
|
|
|
|
$id = isset($_GET["id"])?$_GET["id"]:'';
|
|
|
|
|
|
if ($user->societe_id) $socid=$user->societe_id;
|
|
|
|
|
|
$result = restrictedArea($user, 'commande_fournisseur', $id,'');
|
2005-04-04 16:03:21 +02:00
|
|
|
|
|
2006-03-18 19:03:01 +01:00
|
|
|
|
|
2005-04-04 16:03:21 +02:00
|
|
|
|
/*
|
2006-03-18 19:03:01 +01:00
|
|
|
|
* Actions
|
2009-01-31 01:06:19 +01:00
|
|
|
|
*/
|
2005-04-04 16:03:21 +02:00
|
|
|
|
|
|
|
|
|
|
if ($_POST["action"] == 'updatenote' && $user->rights->fournisseur->commande->creer)
|
|
|
|
|
|
{
|
2006-03-18 19:03:01 +01:00
|
|
|
|
$commande = new CommandeFournisseur($db);
|
|
|
|
|
|
$commande->fetch($_GET["id"]);
|
2009-01-31 01:06:19 +01:00
|
|
|
|
|
2006-03-18 19:03:01 +01:00
|
|
|
|
$result = $commande->UpdateNote($user, $_POST["note"], $_POST["note_public"]);
|
|
|
|
|
|
if ($result >= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Header("Location: note.php?id=".$_GET["id"]);
|
|
|
|
|
|
exit;
|
|
|
|
|
|
}
|
2005-04-04 16:03:21 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2006-03-18 19:03:01 +01:00
|
|
|
|
|
2009-01-31 01:06:19 +01:00
|
|
|
|
/*
|
|
|
|
|
|
* View
|
|
|
|
|
|
*/
|
2006-03-18 19:03:01 +01:00
|
|
|
|
|
2005-04-11 17:31:26 +02:00
|
|
|
|
llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur");
|
2005-04-04 16:03:21 +02:00
|
|
|
|
|
|
|
|
|
|
$html = new Form($db);
|
|
|
|
|
|
|
|
|
|
|
|
/* *************************************************************************** */
|
|
|
|
|
|
/* */
|
|
|
|
|
|
/* Mode vue et edition */
|
|
|
|
|
|
/* */
|
|
|
|
|
|
/* *************************************************************************** */
|
2009-01-31 01:06:19 +01:00
|
|
|
|
|
|
|
|
|
|
$now=gmmktime();
|
|
|
|
|
|
|
|
|
|
|
|
$id = $_GET['id'];
|
|
|
|
|
|
$ref= $_GET['ref'];
|
|
|
|
|
|
if ($id > 0 || ! empty($ref))
|
2005-04-04 16:03:21 +02:00
|
|
|
|
{
|
2006-05-06 17:30:34 +02:00
|
|
|
|
$commande = new CommandeFournisseur($db);
|
2009-01-31 01:06:19 +01:00
|
|
|
|
$result=$commande->fetch($_GET["id"],$_GET['ref']);
|
|
|
|
|
|
if ($result >= 0)
|
2005-04-04 16:03:21 +02:00
|
|
|
|
{
|
2006-05-06 17:30:34 +02:00
|
|
|
|
$soc = new Societe($db);
|
2006-09-13 20:56:30 +02:00
|
|
|
|
$soc->fetch($commande->socid);
|
2006-08-20 01:00:53 +02:00
|
|
|
|
|
2006-05-06 17:30:34 +02:00
|
|
|
|
$author = new User($db);
|
|
|
|
|
|
$author->id = $commande->user_author_id;
|
|
|
|
|
|
$author->fetch();
|
|
|
|
|
|
|
2008-11-24 21:09:23 +01:00
|
|
|
|
$head = ordersupplier_prepare_head($commande);
|
2009-01-31 01:06:19 +01:00
|
|
|
|
|
2006-05-06 17:30:34 +02:00
|
|
|
|
$title=$langs->trans("SupplierOrder");
|
2009-08-06 16:44:24 +02:00
|
|
|
|
dol_fiche_head($head, 'note', $title, 0, 'order');
|
2006-05-06 17:30:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
* Commande
|
|
|
|
|
|
*/
|
|
|
|
|
|
print '<form action="note.php?id='.$commande->id.'" method="post">';
|
2009-05-17 10:01:54 +02:00
|
|
|
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
2006-05-06 17:30:34 +02:00
|
|
|
|
print '<input type="hidden" name="action" value="updatenote">';
|
|
|
|
|
|
|
|
|
|
|
|
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
|
2006-05-06 17:30:34 +02:00
|
|
|
|
print '<tr>';
|
|
|
|
|
|
print '<td>'.$langs->trans("Status").'</td>';
|
2009-01-31 01:06:19 +01:00
|
|
|
|
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">';
|
2006-05-06 17:30:34 +02:00
|
|
|
|
if ($commande->date_commande)
|
|
|
|
|
|
{
|
2009-02-20 23:53:15 +01:00
|
|
|
|
print dol_print_date($commande->date_commande,"dayhourtext")."\n";
|
2006-05-06 17:30:34 +02:00
|
|
|
|
}
|
2009-01-31 01:06:19 +01:00
|
|
|
|
print "</td></tr>";
|
2006-05-06 17:30:34 +02:00
|
|
|
|
|
|
|
|
|
|
if ($commande->methode_commande)
|
|
|
|
|
|
{
|
2009-01-31 01:06:19 +01:00
|
|
|
|
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-08-26 02:52:26 +02:00
|
|
|
|
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
|
2009-01-31 01:06:19 +01:00
|
|
|
|
print '<td colspan="2">';
|
2006-08-26 02:52:26 +02:00
|
|
|
|
if ($user->rights->fournisseur->commande->creer) print '<textarea cols="90" rows="'.ROWS_4.'" name="note_public">';
|
2009-04-02 01:00:59 +02:00
|
|
|
|
print $commande->note_public;
|
2006-08-26 02:52:26 +02:00
|
|
|
|
if ($user->rights->fournisseur->commande->creer) print '</textarea>';
|
|
|
|
|
|
print '</td></tr>';
|
2006-05-06 17:30:34 +02:00
|
|
|
|
|
2006-08-19 00:03:47 +02:00
|
|
|
|
if (! $user->societe_id)
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
|
2009-01-31 01:06:19 +01:00
|
|
|
|
print '<td colspan="2">';
|
2006-08-26 02:52:26 +02:00
|
|
|
|
if ($user->rights->fournisseur->commande->creer) print '<textarea cols="90" rows="'.ROWS_6.'" name="note">';
|
2009-04-02 01:00:59 +02:00
|
|
|
|
print $commande->note;
|
2006-08-19 00:03:47 +02:00
|
|
|
|
if ($user->rights->fournisseur->commande->creer) print '</textarea>';
|
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
}
|
2009-01-31 01:06:19 +01:00
|
|
|
|
|
2006-03-18 19:03:01 +01:00
|
|
|
|
if ($user->rights->fournisseur->commande->creer)
|
|
|
|
|
|
{
|
2009-01-31 01:06:19 +01:00
|
|
|
|
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>';
|
2006-03-18 19:03:01 +01:00
|
|
|
|
}
|
2006-05-06 17:30:34 +02:00
|
|
|
|
|
2006-03-18 19:03:01 +01:00
|
|
|
|
print "</table></form>";
|
2009-01-31 01:06:19 +01:00
|
|
|
|
|
|
|
|
|
|
print "</div>\n";
|
2006-05-06 17:30:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2009-08-06 16:44:24 +02:00
|
|
|
|
/* Commande non trouv<75>e */
|
2006-05-06 17:30:34 +02:00
|
|
|
|
print "Commande inexistante";
|
|
|
|
|
|
}
|
2009-01-31 01:06:19 +01:00
|
|
|
|
}
|
2005-04-04 16:03:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$db->close();
|
|
|
|
|
|
|
2005-08-31 23:56:05 +02:00
|
|
|
|
llxFooter('$Date$ - $Revision$');
|
2005-04-04 16:03:21 +02:00
|
|
|
|
?>
|