dolibarr/htdocs/fourn/commande/note.php

165 lines
4.9 KiB
PHP
Raw Permalink Normal View History

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>
2012-12-30 15:13:49 +01:00
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
2012-08-24 19:55:31 +02:00
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
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 3 of the License, or
2005-04-04 16:03:21 +02: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/>.
2005-04-04 16:03:21 +02:00
*/
/**
2009-08-06 16:44:24 +02:00
* \file htdocs/fourn/commande/note.php
* \ingroup commande
* \brief Fiche note commande
*/
2005-04-04 16:03:21 +02: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';
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
$id = GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int');
$ref = GETPOST('ref');
$action = GETPOST('action');
// Security check
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $id, '', 'commande');
2005-04-04 16:03:21 +02:00
$object = new CommandeFournisseur($db);
$object->fetch($id, $ref);
2005-04-04 16:03:21 +02:00
/*
* Actions
2009-01-31 01:06:19 +01:00
*/
2005-04-04 16:03:21 +02:00
if ($action == 'setnote_public' && $user->rights->fournisseur->commande->creer)
2005-04-04 16:03:21 +02:00
{
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
if ($result < 0) dol_print_error($db,$object->error);
}
2013-04-20 06:14:45 +02:00
elseif ($action == 'setnote_private' && $user->rights->fournisseur->commande->creer)
{
2013-04-20 06:14:45 +02:00
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES), '_private');
if ($result < 0) dol_print_error($db,$object->error);
2005-04-04 16:03:21 +02:00
}
2009-01-31 01:06:19 +01:00
/*
* View
*/
2005-04-11 17:31:26 +02:00
llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur");
2005-04-04 16:03:21 +02:00
$form = new Form($db);
2005-04-04 16:03:21 +02:00
/* *************************************************************************** */
/* */
/* Mode vue et edition */
/* */
/* *************************************************************************** */
2009-01-31 01:06:19 +01:00
2010-09-04 19:18:13 +02:00
$now=dol_now();
2009-01-31 01:06:19 +01:00
if ($id > 0 || ! empty($ref))
2005-04-04 16:03:21 +02:00
{
2011-09-25 01:42:31 +02:00
if ($result >= 0)
{
$soc = new Societe($db);
$soc->fetch($object->socid);
2011-09-25 01:42:31 +02:00
$author = new User($db);
$author->fetch($object->user_author_id);
2011-09-25 01:42:31 +02:00
$head = ordersupplier_prepare_head($object);
2011-09-25 01:42:31 +02:00
$title=$langs->trans("SupplierOrder");
dol_fiche_head($head, 'note', $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>';
2011-09-25 01:42:31 +02:00
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="2">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
2011-09-25 01:42:31 +02:00
print '</td>';
print '</tr>';
// Fournisseur
print '<tr><td>'.$langs->trans("Supplier")."</td>";
print '<td colspan="2">'.$soc->getNomUrl(1,'supplier').'</td>';
print '</tr>';
// Statut
print '<tr>';
print '<td>'.$langs->trans("Status").'</td>';
print '<td colspan="2">';
print $object->getLibStatut(4);
2011-09-25 01:42:31 +02:00
print "</td></tr>";
// Date
if ($object->methode_commande_id > 0)
2011-09-25 01:42:31 +02:00
{
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
if ($object->date_commande)
2011-09-25 01:42:31 +02:00
{
print dol_print_date($object->date_commande,"dayhourtext")."\n";
2011-09-25 01:42:31 +02:00
}
print "</td></tr>";
if ($object->methode_commande)
2011-09-25 01:42:31 +02:00
{
2012-08-24 19:55:31 +02:00
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$object->getInputMethod().'</td></tr>';
2011-09-25 01:42:31 +02:00
}
}
// Author
2011-09-25 01:42:31 +02:00
print '<tr><td>'.$langs->trans("AuthorRequest").'</td>';
print '<td colspan="2">'.$author->getNomUrl(1).'</td>';
print '</tr>';
print "</table>";
print '<br>';
2011-09-25 01:42:31 +02:00
$colwidth=20;
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
2011-09-25 01:42:31 +02:00
dol_fiche_end();
}
else
{
/* Order not found */
$langs->load("errors");
print $langs->trans("ErrorRecordNotFound");
}
2009-01-31 01:06:19 +01:00
}
2005-04-04 16:03:21 +02:00
llxFooter();
$db->close();
2005-04-04 16:03:21 +02:00
?>