Fix: Fix mineur

This commit is contained in:
Laurent Destailleur 2005-01-08 00:50:59 +00:00
parent 1943b728d4
commit e4d4a054e3
2 changed files with 26 additions and 18 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* 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
@ -22,7 +22,8 @@
* *
*/ */
/*! \file htdocs/compta/facture.php /**
\file htdocs/compta/facture.php
\ingroup facture \ingroup facture
\brief Page de création d'une facture \brief Page de création d'une facture
\version $Revision$ \version $Revision$
@ -220,7 +221,7 @@ if ($_POST["action"] == 'add')
* *
*/ */
if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == yes && $user->rights->facture->valider) if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == "yes" && $user->rights->facture->valider)
{ {
$fac = new Facture($db); $fac = new Facture($db);
$fac->fetch($_GET["facid"]); $fac->fetch($_GET["facid"]);
@ -771,13 +772,16 @@ else
/* */ /* */
/* *************************************************************************** */ /* *************************************************************************** */
{ {
if ($_GET["facid"] > 0) if ($_GET["facid"] > 0)
{ {
$fac = New Facture($db); $fac = New Facture($db);
if ( $fac->fetch($_GET["facid"], $user->societe_id) > 0) if ( $fac->fetch($_GET["facid"], $user->societe_id) > 0)
{ {
$soc = new Societe($db, $fac->socidp); $soc = new Societe($db, $fac->socidp);
$soc->fetch($fac->socidp); $soc->fetch($fac->socidp);
$author = new User($db); $author = new User($db);
$author->id = $fac->user_author; $author->id = $fac->user_author;
$author->fetch(); $author->fetch();
@ -1576,7 +1580,6 @@ else
$sql .= $db->plimit($limit+1,$offset); $sql .= $db->plimit($limit+1,$offset);
$result = $db->query($sql); $result = $db->query($sql);
}
if ($result) if ($result)
{ {
@ -1629,7 +1632,7 @@ else
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$objp = $db->fetch_object(); $objp = $db->fetch_object($result);
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
@ -1720,6 +1723,9 @@ else
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }
}
} }
} }

View File

@ -1,8 +1,8 @@
<?php <?php
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* *
* 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
@ -23,7 +23,8 @@
* *
*/ */
/*! \file htdocs/facture.class.php /**
\file htdocs/facture.class.php
\ingroup facture \ingroup facture
\brief Fichier de la classe des factures clients \brief Fichier de la classe des factures clients
\version $Revision$ \version $Revision$
@ -291,11 +292,12 @@ class Facture
$sql .= " AND f.fk_soc = ".$societe_id; $sql .= " AND f.fk_soc = ".$societe_id;
} }
if ($this->db->query($sql) ) $result=$this->db->query($sql);
if ($result)
{ {
if ($this->db->num_rows()) if ($this->db->num_rows($result))
{ {
$obj = $this->db->fetch_object(); $obj = $this->db->fetch_object($result);
$this->id = $rowid; $this->id = $rowid;
$this->datep = $obj->dp; $this->datep = $obj->dp;
@ -335,15 +337,15 @@ class Facture
$sql = "SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_taux, l.remise, l.remise_percent, l.subprice, ".$this->db->pdate("l.date_start")." as date_start,".$this->db->pdate("l.date_end")." as date_end"; $sql = "SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_taux, l.remise, l.remise_percent, l.subprice, ".$this->db->pdate("l.date_start")." as date_start,".$this->db->pdate("l.date_end")." as date_end";
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l WHERE l.fk_facture = ".$this->id; $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l WHERE l.fk_facture = ".$this->id;
$result = $this->db->query($sql); $result2 = $this->db->query($sql);
if ($result) if ($result2)
{ {
$num = $this->db->num_rows(); $num = $this->db->num_rows();
$i = 0; $total = 0; $i = 0; $total = 0;
while ($i < $num) while ($i < $num)
{ {
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result2);
$faclig = new FactureLigne($this->db); $faclig = new FactureLigne($this->db);
$faclig->desc = stripslashes($objp->description); $faclig->desc = stripslashes($objp->description);
$faclig->qty = $objp->qty; $faclig->qty = $objp->qty;