Add navigation bar on supplier orders

This commit is contained in:
Laurent Destailleur 2009-01-31 00:06:19 +00:00
parent 4606095b1e
commit 23eb5d2c2d
6 changed files with 185 additions and 109 deletions

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
*
@ -93,14 +93,18 @@ llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur");
$html = new Form($db);
$now=gmmktime();
$id = $_GET['id'];
if ($id > 0)
$ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{
//if ($mesg) print $mesg.'<br>';
$commande = new CommandeFournisseur($db);
if ( $commande->fetch($_GET['id']) >= 0)
$result=$commande->fetch($_GET['id'],$_GET['ref']);
if ($result >= 0)
{
$soc = new Societe($db);
$soc->fetch($commande->socid);
@ -110,55 +114,55 @@ if ($id > 0)
$author->fetch();
$head = ordersupplier_prepare_head($commande);
$title=$langs->trans("SupplierOrder");
dolibarr_fiche_head($head, 'dispatch', $title);
/*
* Commande
*/
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="5">'.$commande->ref.'</td>';
print '<td colspan="2">';
print $html->showrefnav($commande,'ref','',1,'ref','ref');
print '</td>';
print '</tr>';
// Fournisseur
print '<tr><td width="20%">'.$langs->trans("Supplier")."</td>";
print '<td colspan="5">';
print '<b><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id.'">';
print img_object($langs->trans("ShowSupplier"),'company').' '.$soc->nom.'</a></b></td>';
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 width="50%" colspan="5">';
print '<td colspan="2">';
print $commande->getLibStatut(4);
print "</td></tr>";
// Date
if ($commande->methode_commande_id > 0)
{
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
if ($commande->date_commande)
{
print dolibarr_print_date($commande->date_commande,"dayhourtext")."\n";
}
print "</td></tr>";
print '</td><td width="50%" colspan="3">';
if ($commande->methode_commande)
{
print $langs->trans("Method")." : " .$commande->methode_commande;
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$commande->methode_commande.'</td></tr>';
}
print "</td></tr>";
}
// Auteur
print '<tr><td>'.$langs->trans("AuthorRequest").'</td>';
print '<td colspan="2">'.$author->getNomUrl(1).'</td>';
print '<td colspan="3" width="50%">';
print "&nbsp;</td></tr>";
print '</tr>';
print "</table>";
if ($mesg) print $mesg;

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
*
@ -71,12 +71,14 @@ $pagenext = $page + 1;
$commande = new CommandeFournisseur($db);
if ($commande->fetch($id) < 0)
if ($commande->fetch($_GET['id'],$_GET['ref']) < 0)
{
dolibarr_print_error($db);
exit;
}
/*
* Actions
*/
@ -114,16 +116,25 @@ if ($action=='delete')
/*
* Affichage
* View
*/
if ($id > 0)
$html = new Form($db);
$id = $_GET['id'];
$ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{
llxHeader();
$upload_dir = $conf->fournisseur->commande->dir_output.'/'.sanitizeFileName($commande->ref);
$societe = new Societe($db);
$societe->fetch($commande->socid);
$soc = new Societe($db);
$soc->fetch($commande->socid);
$author = new User($db);
$author->id = $commande->user_author_id;
$author->fetch();
$head = ordersupplier_prepare_head($commande);
@ -142,20 +153,49 @@ if ($id > 0)
print '<table class="border"width="100%">';
// Ref
print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">'.$commande->ref.'</td></tr>';
print '<tr><td width="35%">'.$langs->trans("Ref").'</td>';
print '<td colspan="2">';
print $html->showrefnav($commande,'ref','',1,'ref','ref');
print '</td>';
print '</tr>';
print '<tr><td>'.$langs->trans('Supplier').'</td><td colspan="3">'.$societe->getNomUrl(1).'</td></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="3">';
print '<td colspan="2">';
print $commande->getLibStatut(4);
print "</td></tr>";
// Date
if ($commande->methode_commande_id > 0)
{
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
if ($commande->date_commande)
{
print dolibarr_print_date($commande->date_commande,"dayhourtext")."\n";
}
print "</td></tr>";
if ($commande->methode_commande)
{
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$commande->methode_commande.'</td></tr>';
}
}
// Auteur
print '<tr><td>'.$langs->trans("AuthorRequest").'</td>';
print '<td colspan="2">'.$author->getNomUrl(1).'</td>';
print '</tr>';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print "</table>\n";
print "</div>\n";
if ($mesg) { print $mesg."<br>"; }

View File

@ -595,14 +595,14 @@ if ($id > 0 || ! empty($ref))
print '</tr>';
// Fournisseur
print '<tr><td width="20%">'.$langs->trans("Supplier")."</td>";
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 width="50%" colspan="2">';
print '<td colspan="2">';
print $commande->getLibStatut(4);
print "</td></tr>";

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -36,18 +36,23 @@ $langs->load('stocks');
if (!$user->rights->fournisseur->commande->lire) accessforbidden();
/* *************************************************************************** */
/* */
/* Mode vue */
/* */
/* *************************************************************************** */
/*
* View
*/
if ($_GET["id"] > 0)
$html = new Form($db);
$now=gmmktime();
$id = $_GET['id'];
$ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{
$soc = new Societe($db);
$commande = new CommandeFournisseur($db);
if ( $commande->fetch($_GET["id"]) >= 0)
$result=$commande->fetch($_GET["id"],$_GET['ref']);
if ($result >= 0)
{
$soc->fetch($commande->socid);
@ -55,10 +60,7 @@ if ($_GET["id"] > 0)
$author->id = $commande->user_author_id;
$author->fetch();
$addons[0][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id;
$addons[0][1] = $soc->nom;
llxHeader('',$langs->trans("History"),"CommandeFournisseur",$addons);
llxHeader('',$langs->trans("History"),"CommandeFournisseur");
$head = ordersupplier_prepare_head($commande);
@ -74,27 +76,44 @@ if ($_GET["id"] > 0)
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'.$commande->ref.'</td>';
print '<td colspan="2">';
print $html->showrefnav($commande,'ref','',1,'ref','ref');
print '</td>';
print '</tr>';
// Fournisseur
print '<tr><td width="20%">'.$langs->trans("Supplier")."</td>";
print '<td colspan="3">';
print '<b><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id.'">'.img_object($langs->trans("ShowSupplier"),'company').' '.$soc->nom.'</a></b></td>';
print '<tr><td>'.$langs->trans("Supplier")."</td>";
print '<td colspan="2">'.$soc->getNomUrl(1,'supplier').'</td>';
print '</tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">';
// Statut
print '<tr>';
print '<td>'.$langs->trans("Status").'</td>';
print '<td colspan="2">';
print $commande->getLibStatut(4);
print "</td></tr>";
// Date
if ($commande->methode_commande_id > 0)
{
print '<tr><td>'.$langs->trans("Date").'</td>';
print '<td colspan="2">'.dolibarr_print_date($commande->date_commande,"dayhourtext")."</td>\n";
print '<td width="50%">&nbsp;';
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
if ($commande->date_commande)
{
print dolibarr_print_date($commande->date_commande,"dayhourtext")."\n";
}
print "</td></tr>";
if ($commande->methode_commande)
{
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$commande->methode_commande.'</td></tr>';
}
}
// Auteur
print '<tr><td>'.$langs->trans("AuthorRequest").'</td>';
print '<td colspan="2">'.$author->getNomUrl(1).'</td>';
print '</tr>';
print "</table>\n";
print "<br>";
@ -157,7 +176,7 @@ if ($_GET["id"] > 0)
/* Commande non trouvée */
print "Commande inexistante ou accés refusé";
}
}
}
$db->close();

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -37,13 +37,13 @@ if (!$user->rights->fournisseur->commande->lire) accessforbidden();
/*
* Actions
*/
*/
if ($_POST["action"] == 'updatenote' && $user->rights->fournisseur->commande->creer)
{
$commande = new CommandeFournisseur($db);
$commande->fetch($_GET["id"]);
$result = $commande->UpdateNote($user, $_POST["note"], $_POST["note_public"]);
if ($result >= 0)
{
@ -53,6 +53,9 @@ if ($_POST["action"] == 'updatenote' && $user->rights->fournisseur->commande->cr
}
/*
* View
*/
llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur");
@ -63,11 +66,16 @@ $html = new Form($db);
/* Mode vue et edition */
/* */
/* *************************************************************************** */
if ($_GET["id"] > 0)
$now=gmmktime();
$id = $_GET['id'];
$ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{
$commande = new CommandeFournisseur($db);
if ( $commande->fetch($_GET["id"]) >= 0)
$result=$commande->fetch($_GET["id"],$_GET['ref']);
if ($result >= 0)
{
$soc = new Societe($db);
$soc->fetch($commande->socid);
@ -77,7 +85,7 @@ if ($_GET["id"] > 0)
$author->fetch();
$head = ordersupplier_prepare_head($commande);
$title=$langs->trans("SupplierOrder");
dolibarr_fiche_head($head, 'note', $title);
@ -92,41 +100,46 @@ if ($_GET["id"] > 0)
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'.$commande->ref.'</td>';
print '<td colspan="2">';
print $html->showrefnav($commande,'ref','',1,'ref','ref');
print '</td>';
print '</tr>';
// Fournisseur
print '<tr><td width="20%">'.$langs->trans("Supplier").'</td>';
print '<td colspan="3">';
print '<a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id.'">'.img_object($langs->trans("ShowSupplier"),'company').' '.$soc->nom.'</a></td>';
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="3">';
print '<td colspan="2">';
print $commande->getLibStatut(4);
print "</td></tr>";
// Date
if ($commande->methode_commande_id > 0)
{
print '<tr><td>'.$langs->trans("Date").'</td>';
print '<td colspan="2">';
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
if ($commande->date_commande)
{
print dolibarr_print_date($commande->date_commande,'dayhourtext')."\n";
}
print '&nbsp;</td><td width="50%">';
if ($commande->methode_commande)
{
print "Méthode : " .$commande->methode_commande;
print dolibarr_print_date($commande->date_commande,"dayhourtext")."\n";
}
print "</td></tr>";
if ($commande->methode_commande)
{
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$commande->methode_commande.'</td></tr>';
}
}
// Auteur
print '<tr><td>'.$langs->trans("AuthorRequest").'</td>';
print '<td colspan="2">'.$author->getNomUrl(1).'</td>';
print '</tr>';
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
print '<td colspan="3">';
print '<td colspan="2">';
if ($user->rights->fournisseur->commande->creer) print '<textarea cols="90" rows="'.ROWS_4.'" name="note_public">';
print nl2br($commande->note_public);
if ($user->rights->fournisseur->commande->creer) print '</textarea>';
@ -135,26 +148,28 @@ if ($_GET["id"] > 0)
if (! $user->societe_id)
{
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
print '<td colspan="3">';
print '<td colspan="2">';
if ($user->rights->fournisseur->commande->creer) print '<textarea cols="90" rows="'.ROWS_6.'" name="note">';
print nl2br($commande->note);
if ($user->rights->fournisseur->commande->creer) print '</textarea>';
print '</td></tr>';
}
if ($user->rights->fournisseur->commande->creer)
{
print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>';
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>';
}
print "</table></form>";
print "</div>\n";
}
else
{
/* Commande non trouvée */
print "Commande inexistante";
}
}
}
$db->close();

View File

@ -21,11 +21,11 @@
*
*/
/**
\file htdocs/fourn/commande/pre.inc.php
\ingroup compta
\brief Fichier gestionnaire du menu commandes fournisseurs
*/
/**
\file htdocs/fourn/commande/pre.inc.php
\ingroup compta
\brief Fichier gestionnaire du menu commandes fournisseurs
*/
require("../../main.inc.php");
$langs->load("orders");
@ -37,38 +37,36 @@ require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.commande.class.php");
function llxHeader($head = "", $title = "", $help_url='', $addons='')
{
global $user, $langs;
$langs->load("orders");
/*
*
*
*/
top_menu($head, $title);
global $user, $langs;
$langs->load("orders");
$menu = new Menu();
if (is_array($addons))
{
$menu->add($addons[0][0], $addons[0][1]);
}
if ($user->societe_id == 0 && $user->rights->societe->lire)
{
$menu->add(DOL_URL_ROOT."/fourn/index.php", $langs->trans("Suppliers"));
$menu->add_submenu(DOL_URL_ROOT."/fourn/contact.php",$langs->trans("Contacts"));
}
top_menu($head, $title);
$langs->load("bills");
if ($user->rights->fournisseur->facture->lire)
{
$menu->add(DOL_URL_ROOT."/fourn/facture/index.php", $langs->trans("Bills"));
}
if ($user->rights->fournisseur->commande->lire)
{
$menu->add(DOL_URL_ROOT."/fourn/commande/", $langs->trans("Orders"));
$menu->add_submenu(DOL_URL_ROOT."/fourn/commande/liste.php", $langs->trans("List"));
}
$menu = new Menu();
left_menu($menu->liste,$help_url);
if (is_array($addons))
{
$menu->add($addons[0][0], $addons[0][1]);
}
if ($user->societe_id == 0 && $user->rights->societe->lire)
{
$menu->add(DOL_URL_ROOT."/fourn/index.php", $langs->trans("Suppliers"));
$menu->add_submenu(DOL_URL_ROOT."/fourn/contact.php",$langs->trans("Contacts"));
}
$langs->load("bills");
if ($user->rights->fournisseur->facture->lire)
{
$menu->add(DOL_URL_ROOT."/fourn/facture/index.php", $langs->trans("Bills"));
}
if ($user->rights->fournisseur->commande->lire)
{
$menu->add(DOL_URL_ROOT."/fourn/commande/", $langs->trans("Orders"));
$menu->add_submenu(DOL_URL_ROOT."/fourn/commande/liste.php", $langs->trans("List"));
}
left_menu($menu->liste,$help_url);
}
?>