From 332414303be5bd95822623314a33ca88ef859659 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 1 Sep 2008 11:59:17 +0000 Subject: [PATCH] Add function fetch_delivery_methods() --- htdocs/expedition/expedition.class.php | 90 ++++++++++++++++---------- 1 file changed, 55 insertions(+), 35 deletions(-) diff --git a/htdocs/expedition/expedition.class.php b/htdocs/expedition/expedition.class.php index 8c6aea8c79b..abedd50084e 100644 --- a/htdocs/expedition/expedition.class.php +++ b/htdocs/expedition/expedition.class.php @@ -1,8 +1,8 @@ - * Copyright (C) 2006 Laurent Destailleur - * Copyright (C) 2007 Franky Van Liedekerke +/* Copyright (C) 2003-2008 Rodolphe Quiedeville * Copyright (C) 2005-2008 Régis Houssin + * Copyright (C) 2007 Franky Van Liedekerke + * Copyright (C) 2006 Laurent Destailleur * * 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,38 +37,38 @@ if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/commande */ class Expedition extends CommonObject { - var $db; - var $error; - var $element="expedition"; - var $table_element="expedition"; - - var $id; - var $socid; - var $brouillon; - var $entrepot_id; - var $modelpdf; - var $origin; - var $origin_id; - - - /** - * Initialisation - * - */ - function Expedition($DB) - { - global $langs; - - $this->db = $DB; - $this->lignes = array(); - - $this->statuts[-1] = $langs->trans("Canceled"); - $this->statuts[0] = $langs->trans("Draft"); - $this->statuts[1] = $langs->trans("Validated"); - - $this->products = array(); - } - + var $db; + var $error; + var $element="expedition"; + var $table_element="expedition"; + + var $id; + var $socid; + var $brouillon; + var $entrepot_id; + var $modelpdf; + var $origin; + var $origin_id; + + var $meths; + /** + * Initialisation + * + */ + function Expedition($DB) + { + global $langs; + + $this->db = $DB; + $this->lignes = array(); + + $this->statuts[-1] = $langs->trans("Canceled"); + $this->statuts[0] = $langs->trans("Draft"); + $this->statuts[1] = $langs->trans("Validated"); + + $this->products = array(); + } + /** * \brief Créé expédition en base * \param user Objet du user qui cré @@ -733,6 +733,26 @@ class Expedition extends CommonObject $xnbp++; } } + /* + Fecth deliveries method and return an array + */ + function fetch_delivery_methods() + { + $meths = array(); + + $sql = "SELECT em.rowid, em.libelle"; + $sql.= " FROM ".MAIN_DB_PREFIX."expedition_methode as em"; + $sql.= " WHERE em.statut = 1"; + + $resql = $this->db->query($sql); + if ($resql) + { + while ($obj = $this->db->fetch_object($resql)) + { + $this->meths[$obj->rowid] = $obj->libelle; + } + } + } }