Affiche les numeros de commande au lieu de l'id de bdd

This commit is contained in:
marc_ocebo 2005-04-28 23:56:47 +00:00
parent 3a87f3ffef
commit f605fcf3e1
2 changed files with 43 additions and 5 deletions

View File

@ -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 '<br><table class="border" width="100%">';
$coms = $propal->associated_orders();
print '<br><table class="border" width="100%">';
print "<tr><td>Commande(s) rattachée(s)</td></tr>\n";
for ($i = 0 ; $i < $nb_commande ; $i++)
{
print '<tr><td><a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$coms[$i].'">'.$coms[$i]."</a></td>\n";
print '<tr><td><a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$coms[$i]->id.'">'.$coms[$i]->ref."</a></td>\n";
print "</tr>\n";
}

View File

@ -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();
}
}
/*
*
*