je n'ai aucune entrree a l'unite dans mes tarifs fournisseurs/produits, donc la requete ne marchait pas (where quantity=1) donc modif en fonction

This commit is contained in:
erics 2005-07-22 16:45:56 +00:00
parent f68f63bb3d
commit d0498cbf39

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -447,11 +448,10 @@ if ($_GET["id"] > 0)
if ($_GET["action"] <> 'valid' && $commande->statut == 0 && $user->rights->fournisseur->commande->creer) if ($_GET["action"] <> 'valid' && $commande->statut == 0 && $user->rights->fournisseur->commande->creer)
{ {
$sql = "SELECT p.rowid,p.label,p.ref "; $sql = "SELECT p.rowid,p.label,p.ref ";
$sql .=" , pf.price"; $sql .=" , (pf.price / pf.quantity) as priceunit";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p "; $sql .= " FROM ".MAIN_DB_PREFIX."product as p ";
$sql .= " , ".MAIN_DB_PREFIX."product_fournisseur_price as pf "; $sql .= " , ".MAIN_DB_PREFIX."product_fournisseur_price as pf ";
$sql .= " WHERE p.rowid = pf.fk_product AND pf.fk_soc = ".$commande->fourn_id; $sql .= " WHERE p.rowid = pf.fk_product AND pf.fk_soc = ".$commande->fourn_id;
$sql .= " AND quantity = 1";
$sql .= " ORDER BY p.ref "; $sql .= " ORDER BY p.ref ";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -464,7 +464,7 @@ if ($_GET["id"] > 0)
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$opt .= "<option value=\"$objp->rowid\">[$objp->ref] $objp->label : $objp->price</option>\n"; $opt .= "<option value=\"$objp->rowid\">[$objp->ref] $objp->label : $objp->priceunit</option>\n";
$i++; $i++;
} }
} }