Add navigation on order pages

This commit is contained in:
Laurent Destailleur 2009-01-12 16:33:54 +00:00
parent 4e01c23974
commit f31fd284a7
15 changed files with 508 additions and 475 deletions

View File

@ -49,17 +49,17 @@ class Commande
$this->total_ot_shipping = 0; $this->total_ot_shipping = 0;
} }
/* /**
* * \brief Get object and lines from database
* * \param rowid id of object to load
* * \param ref Ref of order
* \return int >0 si ok, <0 si ko
*/ */
function fetch ($id) { function fetch ($id,$ref='')
{
$sql = "SELECT orders_id, customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, last_modified, ".$this->db->pdate("date_purchased") . " as date_purchased, orders_status, orders_date_finished, currency, currency_value"; $sql = "SELECT orders_id, customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, last_modified, ".$this->db->pdate("date_purchased") . " as date_purchased, orders_status, orders_date_finished, currency, currency_value";
$sql.= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders";
$sql.= " WHERE orders_id = ".$id;
$sql .= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders WHERE orders_id = $id";
$result = $this->db->query($sql) ; $result = $this->db->query($sql) ;

View File

@ -816,10 +816,12 @@ class Commande extends CommonObject
/** /**
* \brief Load an order from database * \brief Get object and lines from database
* \param rowid id de la commande a recuperer * \param rowid id of object to load
* \param ref Ref of invoice
* \return int >0 if OK, <0 if KO
*/ */
function fetch($id) function fetch($id,$ref='')
{ {
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut'; $sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut';
$sql.= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.fk_cond_reglement, c.fk_mode_reglement'; $sql.= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.fk_cond_reglement, c.fk_mode_reglement';
@ -834,10 +836,10 @@ class Commande extends CommonObject
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'cond_reglement as cr ON (c.fk_cond_reglement = cr.rowid)'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'cond_reglement as cr ON (c.fk_cond_reglement = cr.rowid)';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON (c.fk_mode_reglement = p.id)'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON (c.fk_mode_reglement = p.id)';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'co_pr as cp ON (cp.fk_commande = c.rowid)'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'co_pr as cp ON (cp.fk_commande = c.rowid)';
$sql.= ' WHERE c.rowid = '.$id; if ($ref) $sql.= " WHERE c.ref='".$ref."'";
else $sql.= " WHERE c.rowid=".$id;
dolibarr_syslog("Commande::fetch sql=$sql"); dolibarr_syslog("Commande::fetch sql=$sql");
$result = $this->db->query($sql) ; $result = $this->db->query($sql) ;
if ($result) if ($result)
{ {

View File

@ -154,14 +154,15 @@ $contactstatic=new Contact($db);
/* Mode vue et edition */ /* Mode vue et edition */
/* */ /* */
/* *************************************************************************** */ /* *************************************************************************** */
if ( isset($mesg)) if (isset($mesg)) print $mesg;
print $mesg;
$id = $_GET["id"]; $id = $_GET['id'];
if ($id > 0) $ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{ {
$langs->trans("OrderCard"); $langs->trans("OrderCard");
$commande = New Commande($db); $commande = new Commande($db);
if ( $commande->fetch($_GET['id'], $user->societe_id) > 0) if ( $commande->fetch($_GET['id'],$_GET['ref']) > 0)
{ {
$soc = new Societe($db, $commande->socid); $soc = new Societe($db, $commande->socid);
$soc->fetch($commande->socid); $soc->fetch($commande->socid);
@ -178,7 +179,7 @@ if ($id > 0)
// Ref // Ref
print '<tr><td width="18%">'.$langs->trans("Ref").'</td><td colspan="3">'; print '<tr><td width="18%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $commande->ref; print $html->showrefnav($commande,'ref','',1,'ref','ref');
print "</td></tr>"; print "</td></tr>";
// Ref commande client // Ref commande client

View File

@ -62,11 +62,15 @@ $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
$id = $_GET['id'];
$ref= $_GET['ref'];
$commande = new Commande($db); $commande = new Commande($db);
if (!$commande->fetch($id)) { if (! $commande->fetch($_GET['id'],$_GET['ref']) > 0)
{
dolibarr_print_error($db); dolibarr_print_error($db);
} }
/* /*
* Actions * Actions
*/ */
@ -104,12 +108,15 @@ if ($action=='delete')
/* /*
* Affichage * View
*/ */
if ($id > 0)
{
llxHeader(); llxHeader();
$html = new Form($db);
if ($id > 0 || ! empty($ref))
{
$upload_dir = $conf->commande->dir_output.'/'.sanitizeFileName($commande->ref); $upload_dir = $conf->commande->dir_output.'/'.sanitizeFileName($commande->ref);
$societe = new Societe($db); $societe = new Societe($db);
@ -131,7 +138,9 @@ if ($id > 0)
print '<table class="border"width="100%">'; print '<table class="border"width="100%">';
// Ref // Ref
print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">'.$commande->ref.'</td></tr>'; print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">';
print $html->showrefnav($commande,'ref','',1,'ref','ref');
print '</td></tr>';
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$societe->getNomUrl(1).'</td></tr>'; print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$societe->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>'; print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';

View File

@ -1136,13 +1136,17 @@ else
/* Mode vue et edition */ /* Mode vue et edition */
/* */ /* */
/* *************************************************************************** */ /* *************************************************************************** */
$now=gmmktime();
$id = $_GET['id']; $id = $_GET['id'];
if ($id > 0) $ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{ {
if ($mesg) print $mesg.'<br>'; if ($mesg) print $mesg.'<br>';
$commande = new Commande($db); $commande = new Commande($db);
if ( $commande->fetch($_GET['id']) > 0) $result=$commande->fetch($_GET['id'],$_GET['ref']);
if ($result > 0)
{ {
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($commande->socid); $soc->fetch($commande->socid);
@ -1221,7 +1225,9 @@ else
// Ref // Ref
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>'; print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">'.$commande->ref.'</td>'; print '<td colspan="3">';
print $html->showrefnav($commande,'ref','',1,'ref','ref');
print '</td>';
print '</tr>'; print '</tr>';
// Ref commande client // Ref commande client

View File

@ -16,15 +16,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/ */
/** /**
\file htdocs/commande/note.php \file htdocs/commande/note.php
\ingroup commande \ingroup commande
\brief Fiche de notes sur une commande \brief Fiche de notes sur une commande
\version $Revision$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -47,13 +45,18 @@ if ($user->societe_id > 0)
} }
$id = $_GET['id'];
$ref= $_GET['ref'];
$commande = new Commande($db); $commande = new Commande($db);
$commande->fetch($_GET["id"]); if (! $commande->fetch($_GET['id'],$_GET['ref']) > 0)
{
dolibarr_print_error($db);
}
/******************************************************************************/ /*
/* Actions */ * Actions
/******************************************************************************/ */
if ($_POST["action"] == 'update' && $user->rights->commande->creer) if ($_POST["action"] == 'update' && $user->rights->commande->creer)
{ {
@ -75,15 +78,15 @@ if ($_POST["action"] == 'update' && $user->rights->commande->creer)
/******************************************************************************/ /*
/* Affichage fiche */ * View
/******************************************************************************/ */
llxHeader(); llxHeader();
$html = new Form($db); $html = new Form($db);
if ($_GET["id"]) if ($id > 0 || ! empty($ref))
{ {
$soc = new Societe($db, $commande->socid); $soc = new Societe($db, $commande->socid);
$soc->fetch($commande->socid); $soc->fetch($commande->socid);
@ -96,7 +99,7 @@ if ($_GET["id"])
// Ref // Ref
print '<tr><td width="18%">'.$langs->trans("Ref").'</td><td colspan="3">'; print '<tr><td width="18%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $commande->ref; print $html->showrefnav($commande,'ref','',1,'ref','ref');
print "</td></tr>"; print "</td></tr>";
// Ref commande client // Ref commande client

View File

@ -105,22 +105,21 @@ if ($_POST['action'] == 'setconditions' && $user->rights->commande->creer)
} }
llxHeader('',$langs->trans("OrderCard"),"Commande"); /*
* View
*/
llxHeader('',$langs->trans("OrderCard"),"Commande");
$html = new Form($db); $html = new Form($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
/* *************************************************************************** */ $id = $_GET['id'];
/* */ $ref= $_GET['ref'];
/* Mode vue et edition */ if ($id > 0 || ! empty($ref))
/* */
/* *************************************************************************** */
if ($_GET["id"] > 0)
{ {
$commande = new Commande($db); $commande = new Commande($db);
if ( $commande->fetch($_GET["id"]) > 0) if ( $commande->fetch($_GET['id'],$_GET['ref']) > 0)
{ {
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($commande->socid); $soc->fetch($commande->socid);
@ -142,7 +141,9 @@ if ($_GET["id"] > 0)
// Ref // Ref
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>'; print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">'.$commande->ref.'</td>'; print '<td colspan="3">';
print $html->showrefnav($commande,'ref','',1,'ref','ref');
print '</td>';
print '</tr>'; print '</tr>';
// Ref commande client // Ref commande client

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -123,10 +123,12 @@ $formfile = new FormFile($db);
llxHeader('',$langs->trans("OrderCard")); llxHeader('',$langs->trans("OrderCard"));
if ($_GET["id"] > 0) $id = $_GET['id'];
$ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{ {
$commande = new Commande($db); $commande = new Commande($db);
if ( $commande->fetch($_GET["id"]) > 0) if ( $commande->fetch($_GET['id'],$_GET['ref']) > 0)
{ {
$commande->loadExpeditions(1); $commande->loadExpeditions(1);
@ -158,7 +160,9 @@ if ($_GET["id"] > 0)
// Ref // Ref
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>'; print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">'.$commande->ref.'</td>'; print '<td colspan="3">';
print $html->showrefnav($commande,'ref','',1,'ref','ref');
print '</td>';
print '</tr>'; print '</tr>';
// Ref commande client // Ref commande client
@ -507,19 +511,29 @@ if ($_GET["id"] > 0)
print '<div class="tabsAction">'; print '<div class="tabsAction">';
// Bouton expedier sans gestion des stocks // Bouton expedier sans gestion des stocks
if (! $conf->stock->enabled && $reste_a_livrer_total > 0 && ! $commande->brouillon && $user->rights->expedition->creer) if (! $conf->stock->enabled && ! $commande->brouillon)
{
if ($user->rights->expedition->creer)
{ {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/fiche.php?action=create&amp;origin=commande&amp;object_id='.$_GET["id"].'">'.$langs->trans("NewSending").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/fiche.php?action=create&amp;origin=commande&amp;object_id='.$_GET["id"].'">'.$langs->trans("NewSending").'</a>';
if ($reste_a_livrer_total <= 0)
{
print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend"));
}
}
else
{
print '<a class="butActionRefused" href="#">'.$langs->trans("NewSending").'</a>';
}
} }
print "</div>"; print "</div>";
} }
// Bouton expedier avec gestion des stocks // Bouton expedier avec gestion des stocks
if ($conf->stock->enabled && $commande->statut > 0 && $commande->statut < 3)
print '<table width="100%"><tr><td width="100%" colspan="2" valign="top">'; {
if ($user->rights->expedition->creer)
if ($conf->stock->enabled && $reste_a_livrer_total > 0 && $commande->statut > 0 && $commande->statut < 3 && $user->rights->expedition->creer)
{ {
print_titre($langs->trans("NewSending")); print_titre($langs->trans("NewSending"));
@ -550,29 +564,32 @@ if ($_GET["id"] > 0)
if (sizeof($entrepot->list_array()) <= 0) if (sizeof($entrepot->list_array()) <= 0)
{ {
print ' &nbsp; Aucun entrepôt définit, <a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?action=create">definissez en un</a>'; print ' &nbsp; No warehouse defined, <a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?action=create">add one</a>';
} }
print '</td></tr>'; print '</td><td align="center">';
/*
print '<tr><td width="20%">Mode d\'expédition</td>';
print '<td>';
$html->select_array("entrepot_id",$entrepot->list_array());
print '</td></tr>';
*/
print '<tr><td align="center" colspan="2">';
print '<input type="submit" class="button" named="save" value="'.$langs->trans("NewSending").'">'; print '<input type="submit" class="button" named="save" value="'.$langs->trans("NewSending").'">';
if ($reste_a_livrer_total <= 0)
{
print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend"));
}
print '</td></tr>'; print '</td></tr>';
print "</table>"; print "</table>";
print "</form>\n"; print "</form>\n";
print '<br>';
$somethingshown=1; $somethingshown=1;
}
else
{
print '<div class="tabsAction">';
print '<a class="butActionRefused" href="#">'.$langs->trans("NewSending").'</a>';
print '</div>';
}
} }
print "</td></tr></table>";
print '<br>';
show_list_sending_receive('commande',$commande->id); show_list_sending_receive('commande',$commande->id);
} }

View File

@ -210,7 +210,7 @@ if ($_GET["action"] == 'create')
$expe = new Expedition($db); $expe = new Expedition($db);
print_titre($langs->trans("CreateASending")); print_fiche_titre($langs->trans("CreateASending"));
if (! $origin) if (! $origin)
{ {
$mesg='<div class="error">'.$langs->trans("ErrorBadParameters").'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorBadParameters").'</div>';
@ -295,9 +295,8 @@ if ($_GET["action"] == 'create')
{ {
print '<tr><td colspan="3">'.$langs->trans("NotePrivate").': '.nl2br($object->note)."</td></tr>"; print '<tr><td colspan="3">'.$langs->trans("NotePrivate").': '.nl2br($object->note)."</td></tr>";
} }
print "</table>";
print '<table><tr><td>'; print '<tr><td>';
print $langs->trans("Weight"); print $langs->trans("Weight");
print '</td><td><input name="weight" size="4" value=""></td><td>'; print '</td><td><input name="weight" size="4" value=""></td><td>';
print $formproduct->select_measuring_units("weight_units","weight"); print $formproduct->select_measuring_units("weight_units","weight");
@ -311,10 +310,7 @@ if ($_GET["action"] == 'create')
print '</td></tr><tr><td>'; print '</td></tr><tr><td>';
print $langs->trans("Depth"); print $langs->trans("Depth");
print '</td><td><input name="sizeS" size="4" value=""></td>'; print '</td><td><input name="sizeS" size="4" value=""></td>';
print '<td>&nbsp;</td></tr></table>'; print '<td>&nbsp;</td></tr>';
print '<table>';
// Delivery method // Delivery method
print "<tr><td>".$langs->trans("DeliveryMethod")."</td>"; print "<tr><td>".$langs->trans("DeliveryMethod")."</td>";

View File

@ -485,10 +485,10 @@ class Facture extends CommonObject
/** /**
* \brief Recupére l'objet facture et ses lignes de factures * \brief Get object and lines from database
* \param rowid id de la facture a récupérer * \param rowid id of object to load
* \param ref Ref of invoice * \param ref Ref of invoice
* \return int >0 si ok, <0 si ko * \return int >0 if OK, <0 if KO
*/ */
function fetch($rowid,$ref='') function fetch($rowid,$ref='')
{ {

View File

@ -62,6 +62,7 @@ FeaturesSupported=Features supported
Width=Width Width=Width
Height=Height Height=Height
Weight=Weight Weight=Weight
Depth=Depth
TotalWeight=Total weight TotalWeight=Total weight
WeightUnitton=tonnes WeightUnitton=tonnes
WeightUnitkg=kg WeightUnitkg=kg
@ -73,9 +74,6 @@ VolumeUnitm3=m3
VolumeUnitdm3=dm3 VolumeUnitdm3=dm3
VolumeUnitcm3=cm3 VolumeUnitcm3=cm3
VolumeUnitmm3=mm3 VolumeUnitmm3=mm3
Height=height
Width=width
Depth=depth
Size=size Size=size
SizeUnitm=m SizeUnitm=m
SizeUnitdm=dm SizeUnitdm=dm

View File

@ -41,6 +41,7 @@ ConfirmCancelSending=Are you sure you want to cancel this sending ?
GenericTransport=Generic transport GenericTransport=Generic transport
Enlevement=Gotten by customer Enlevement=Gotten by customer
DocumentModelSimple=Simple document model DocumentModelSimple=Simple document model
WarningNoQtyLeftToSend=Warning, no products waiting to be shipped.
# NumRef # NumRef
NumRefModelJade=Return a reference number with format BLYY00001, ... where YY is year. Number at end is never reset to zero. NumRefModelJade=Return a reference number with format BLYY00001, ... where YY is year. Number at end is never reset to zero.

View File

@ -62,6 +62,7 @@ FeaturesSupported=Fonctionnalit
Width=Largeur Width=Largeur
Height=Hauteur Height=Hauteur
Weight=Poids Weight=Poids
Depth=Profondeur
TotalWeight=Poids total TotalWeight=Poids total
WeightUnitton=tonnes WeightUnitton=tonnes
WeightUnitkg=kg WeightUnitkg=kg
@ -73,9 +74,6 @@ VolumeUnitm3=m3
VolumeUnitdm3=dm3 VolumeUnitdm3=dm3
VolumeUnitcm3=cm3 VolumeUnitcm3=cm3
VolumeUnitmm3=mm3 VolumeUnitmm3=mm3
Height=hauteur
Width=largeur
Depth=profondeur
Size=taille Size=taille
SizeUnitm=m SizeUnitm=m
SizeUnitdm=dm SizeUnitdm=dm

View File

@ -41,6 +41,7 @@ ConfirmCancelSending=Etes-vous s
GenericTransport=Transporteur générique GenericTransport=Transporteur générique
Enlevement=Enlèvement sur place par le client Enlevement=Enlèvement sur place par le client
DocumentModelSimple=Modèle simple DocumentModelSimple=Modèle simple
WarningNoQtyLeftToSend=Alerte, aucun produit en attente de livraison.
# NumRef # NumRef
NumRefModelJade=Renvoie un numéro de référence sous la forme numérique BLYY00001, ... où YY représente l'année. Le numéro d'incrément qui suit l'année n'est PAS remis à zéro en début d'année. NumRefModelJade=Renvoie un numéro de référence sous la forme numérique BLYY00001, ... où YY représente l'année. Le numéro d'incrément qui suit l'année n'est PAS remis à zéro en début d'année.

View File

@ -1142,7 +1142,7 @@ if ($_GET["action"] == '')
print '<a class="butAction" href="fiche.php?action=edit&amp;id='.$product->id.'">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="fiche.php?action=edit&amp;id='.$product->id.'">'.$langs->trans("Modify").'</a>';
if ($product->no_button_copy <> 1) if ($product->no_button_copy <> 1)
print '<a class="butAction" href="fiche.php?action=clone&amp;id='.$product->id.'">'.$langs->trans("CreateCopy").'</a>'; print '<a class="butAction" href="fiche.php?action=clone&amp;id='.$product->id.'">'.$langs->trans("ToClone").'</a>';
} }
/* /*