From 6e47327ee7b1bb3ec7e4a0685f2cc0050b4251d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Jan 2009 13:06:56 +0000 Subject: [PATCH] Fix: Fix bad link toward suplier invoice in referer stat page of products --- htdocs/fourn/fournisseur.class.php | 27 ++++++++++---------- htdocs/product/stats/facture.php | 23 +++++++++-------- htdocs/product/stats/facture_fournisseur.php | 18 ++++++++----- 3 files changed, 37 insertions(+), 31 deletions(-) diff --git a/htdocs/fourn/fournisseur.class.php b/htdocs/fourn/fournisseur.class.php index 93a4fd3078d..ce3e30f63dc 100644 --- a/htdocs/fourn/fournisseur.class.php +++ b/htdocs/fourn/fournisseur.class.php @@ -40,7 +40,7 @@ class Fournisseur extends Societe /** * \brief Constructeur de la classe - * \param DB handler accès base de données + * \param DB handler acc�s base de donn�es * \param id id societe (0 par defaut) */ @@ -84,12 +84,12 @@ class Fournisseur extends Societe function NbProduct() { - $sql = "SELECT count(*)"; - $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur"; - $sql .= " WHERE fk_soc = ".$this->id; + $sql = "SELECT count(pf.rowid)"; + $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur as pf,"; + $sql.= " ".MAIN_DB_PREFIX."product_fournisseur_price as ppf"; + $sql .= " WHERE fk_soc = ".$this->id." AND ppf.fk_product_fournisseur = pf.rowid"; $resql = $this->db->query($sql) ; - if ( $resql ) { $row = $this->db->fetch_row($resql); @@ -99,13 +99,12 @@ class Fournisseur extends Societe { return -1; } - } /** - * \brief Créé la commande au statut brouillon - * \param user Utilisateur qui crée - * \return int <0 si ko, id de la commande créée si ok + * \brief Cr�� la commande au statut brouillon + * \param user Utilisateur qui cr�e + * \return int <0 si ko, id de la commande cr��e si ok */ function updateFromCommandeClient($user, $idc, $comclientid) { @@ -116,9 +115,9 @@ class Fournisseur extends Societe } /** - * \brief Créé la commande au statut brouillon - * \param user Utilisateur qui crée - * \return int <0 si ko, id de la commande créée si ok + * \brief Cr�� la commande au statut brouillon + * \param user Utilisateur qui cr�e + * \return int <0 si ko, id de la commande cr��e si ok */ function create_commande($user) { @@ -215,8 +214,8 @@ class Fournisseur extends Societe } /** - * \brief Créé une categorie fournisseur - * \param user Utilisateur qui crée + * \brief Cr�� une categorie fournisseur + * \param user Utilisateur qui cr�e * \param name Nom categorie * \return int <0 si ko, 0 si ok */ diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 888f08ad68b..cd098d8b8d1 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2006 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -56,9 +56,11 @@ if ($user->societe_id > 0) /* - * Affiche fiche - * + * View */ + +$invoicestatic=new Facture($db); + $html = new Form($db); @@ -96,8 +98,8 @@ if ($_GET["id"] || $_GET["ref"]) // Libelle print ''.$langs->trans("Label").''.$product->libelle.''; print ''; - - // Prix + + // Price print ''.$langs->trans("SellingPrice").''; if ($product->price_base_type == 'TTC') { @@ -164,16 +166,17 @@ if ($_GET["id"] || $_GET["ref"]) $var=!$var; print ""; - print ''.img_object($langs->trans("ShowBill"),"bill").' '; - print $objp->facnumber; - print "\n"; + print ''; + $invoicestatic->id=$objp->facid; + $invoicestatic->ref=$objp->facnumber; + print $invoicestatic->getNomUrl(1); + print "\n"; print ''.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,44).''; print "".$objp->code_client."\n"; print ""; print dolibarr_print_date($objp->date).""; print "".price($objp->total_ht)."\n"; - $fac=new Facture($db); - print ''.$fac->LibStatut($objp->paye,$objp->statut,5).''; + print ''.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).''; print "\n"; $i++; } diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 05f6e6d704c..a03cfc02cbf 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2007 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); +require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); $langs->load("companies"); @@ -57,9 +57,11 @@ if ($user->societe_id > 0) /* - * Affiche fiche - * + * View */ + +$supplierinvoicestatic=new FactureFournisseur($db); + $html = new Form($db); if ($_GET["id"] || $_GET["ref"]) @@ -164,9 +166,11 @@ if ($_GET["id"] || $_GET["ref"]) $var=!$var; print ""; - print ''.img_object($langs->trans("ShowBill"),"bill").' '; - print $objp->facnumber; - print "\n"; + print ''; + $supplierinvoicestatic->id=$objp->facid; + $supplierinvoicestatic->ref=$objp->facnumber; + print $supplierinvoicestatic->getNomUrl(1); + print "\n"; print ''.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,44).''; print "".$objp->code_client."\n"; print "";