From f605fcf3e1f88d567f2107c2faea05b561cf1f4d Mon Sep 17 00:00:00 2001 From: marc_ocebo Date: Thu, 28 Apr 2005 23:56:47 +0000 Subject: [PATCH] Affiche les numeros de commande au lieu de l'id de bdd --- htdocs/comm/propal.php | 13 ++++++++----- htdocs/propal.class.php | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index c050d2e973c..ab584690118 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -41,6 +41,9 @@ if (!$user->rights->propale->lire) if ($conf->projet->enabled) { require_once "../project.class.php"; } +if($conf->commande->enabled) { + require_once "../commande/commande.class.php"; +} require("./propal_model_pdf.class.php"); require("../propal.class.php"); require("../actioncomm.class.php"); @@ -57,8 +60,8 @@ if ($user->societe_id > 0) // Nombre de ligne pour choix de produit/service prédéfinis $NBLINES=4; - - + + /******************************************************************************/ /* Actions */ /******************************************************************************/ @@ -740,14 +743,14 @@ if ($_GET["propalid"]) $nb_commande = sizeof($propal->commande_liste_array()); if ($nb_commande > 0) { - $coms = $propal->commande_liste_array(); - print '
'; + $coms = $propal->associated_orders(); + print '
'; print "\n"; for ($i = 0 ; $i < $nb_commande ; $i++) { - print '\n"; + print '\n"; print "\n"; } diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index 59eb80919f8..ea9ffb902a5 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -740,6 +740,41 @@ class Propal } } + /** + * \brief Renvoie un tableau contenant les commandes associées + * + */ + + function associated_orders () + { + $ga = array(); + + $sql = "SELECT fk_commande FROM ".MAIN_DB_PREFIX."co_pr"; + $sql .= " WHERE fk_propale = " . $this->id; + if ($this->db->query($sql) ) + { + $nump = $this->db->num_rows(); + + if ($nump) + { + $i = 0; + while ($i < $nump) + { + $obj = $this->db->fetch_object(); + $order=new Commande($this->db); + $order->fetch($obj->fk_commande); + $ga[$i] = $order; + $i++; + } + } + return $ga; + } + else + { + print $this->db->error(); + } + } + /* * *
Commande(s) rattachée(s)
'.$coms[$i]."
'.$coms[$i]->ref."