From 00aa90606c1be7b512f7f905c5a00fbd6d64e5da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2011 14:45:07 +0100 Subject: [PATCH] Qual: Removed a FIXME --- htdocs/fourn/class/fournisseur.class.php | 16 +++++++++------- htdocs/fourn/fiche.php | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php index ffce7ae6681..43ef033c532 100644 --- a/htdocs/fourn/class/fournisseur.class.php +++ b/htdocs/fourn/class/fournisseur.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2007 Rodolphe Quiedeville * Copyright (C) 2006 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011 Juanjo Menent * * 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 @@ -82,19 +82,21 @@ class Fournisseur extends Societe } /** - * FIXME This returns number of prices, not number of products. Is it what we want ? + * Returns number of ref prices (not number of products). + * + * @return int Nb of ref prices, or <0 if error */ - function NbProduct() + function nbOfProductRefs() { - $sql = "SELECT count(pfp.rowid)"; + $sql = "SELECT count(pfp.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql .= " WHERE pfp.fk_soc = ".$this->id; $resql = $this->db->query($sql); if ( $resql ) { - $row = $this->db->fetch_row($resql); - return $row[0]; + $obj = $this->db->fetch_object($resql); + return $obj->nb; } else { @@ -104,7 +106,7 @@ class Fournisseur extends Societe /** * Create the order from an existing - * + * * @param User $user Creator user * @param int $idc Id source * @param int $comclientid Id thirdparty diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index a45b15d62b1..0afce405673 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -229,7 +229,7 @@ if ($object->fetch($id)) print ''; print ''; print '
'.$langs->trans("ProductsAndServices").''; - print ''.$langs->trans("All").' ('.$object->NbProduct().')'; + print ''.$langs->trans("All").' ('.$object->nbOfProductRefs().')'; print '
'; }