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
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* 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
* 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
\brief Page de création d'une facture
\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->fetch($_GET["facid"]);
@ -771,13 +772,16 @@ else
/* */
/* *************************************************************************** */
{
if ($_GET["facid"] > 0)
{
$fac = New Facture($db);
if ( $fac->fetch($_GET["facid"], $user->societe_id) > 0)
{
{
$soc = new Societe($db, $fac->socidp);
$soc->fetch($fac->socidp);
$author = new User($db);
$author->id = $fac->user_author;
$author->fetch();
@ -1574,9 +1578,8 @@ else
$sql .= " f.rowid DESC ";
$sql .= $db->plimit($limit+1,$offset);
$result = $db->query($sql);
}
if ($result)
{
@ -1589,7 +1592,7 @@ else
}
print_barre_liste("Factures client".($socidp?" $soc->nom":""),$page,"facture.php","&amp;socidp=$socidp",$sortfield,$sortorder,'',$num);
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -1629,7 +1632,7 @@ else
while ($i < min($num,$limit))
{
$objp = $db->fetch_object();
$objp = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
@ -1720,6 +1723,9 @@ else
{
dolibarr_print_error($db);
}
}
}
}

View File

@ -1,8 +1,8 @@
<?php
/* 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 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
* 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
\brief Fichier de la classe des factures clients
\version $Revision$
@ -291,11 +292,12 @@ class Facture
$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->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 .= " FROM ".MAIN_DB_PREFIX."facturedet as l WHERE l.fk_facture = ".$this->id;
$result = $this->db->query($sql);
if ($result)
$result2 = $this->db->query($sql);
if ($result2)
{
$num = $this->db->num_rows();
$i = 0; $total = 0;
while ($i < $num)
{
$objp = $this->db->fetch_object($result);
$objp = $this->db->fetch_object($result2);
$faclig = new FactureLigne($this->db);
$faclig->desc = stripslashes($objp->description);
$faclig->qty = $objp->qty;
@ -379,7 +381,7 @@ class Facture
{
//dolibarr_print_error($this->db);
dolibarr_syslog("Erreur Facture::Fetch rowid=$rowid Erreur dans fetch de la facture");
}
}
}
/**