From 6b2fb32bf5e5461e7ad30b7b9404ac426739b4b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 6 Jun 2010 15:53:49 +0000 Subject: [PATCH] Add previous/next on shippings --- htdocs/expedition/class/expedition.class.php | 12 ++++++++---- htdocs/expedition/fiche.php | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 50278c24083..6167d24ae74 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -242,20 +242,24 @@ class Expedition extends CommonObject /** * \brief Lit une expedition - * \param id + * \param id Id of object + * \param ref Ref of object */ - function fetch($id) + function fetch($id,$ref='') { global $conf; - $sql = "SELECT e.rowid, e.fk_soc as socid, e.date_creation, e.ref, e.ref_customer, e.fk_user_author, e.fk_statut"; + if (empty($id) && empty($ref)) return -1; + + $sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.fk_user_author, e.fk_statut"; $sql.= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height"; $sql.= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_adresse_livraison, e.date_delivery"; $sql.= ", e.fk_expedition_methode, e.tracking_number"; $sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->element."'"; - $sql.= " WHERE e.rowid = ".$id; + if ($id) $sql.= " WHERE e.rowid = ".$id; + if ($ref) $sql.= " WHERE e.ref = '".$ref."'"; dol_syslog("Expedition::fetch sql=".$sql); $result = $this->db->query($sql) ; diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index e32671349c5..838218f9b90 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -735,7 +735,9 @@ else // Ref print ''.$langs->trans("Ref").''; - print ''.$expedition->ref.''; + print ''; + print $html->showrefnav($expedition,'ref','',1,'ref','ref'); + print ''; // Customer print ''.$langs->trans("Customer").'';