From 28e3e859e4906d71e6bd585217c11eb532fc66f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Apr 2006 23:54:33 +0000 Subject: [PATCH] Fix: Warning mysql --- htdocs/compta/facture/fiche-rec.php | 314 ++++++++++++++-------------- 1 file changed, 157 insertions(+), 157 deletions(-) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 802917786a7..7945099443e 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2006 Laurent Destailleur * * 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 @@ -91,166 +91,166 @@ $html = new Form($db); * Mode creation * ************************************************************************/ -if ($_GET["action"] == 'create') +if ($_GET["action"] == 'create') { - print_titre("Créer une facture récurrente"); + print_titre("Créer une facture récurrente"); - $facture = new Facture($db); + $facture = new Facture($db); - if ($facture->fetch($_GET["facid"]) > 0) - { - - print '
'; - print ''; - print ''; - - print ''; - - $facture->fetch_client(); - - print ''; - print ''; - - print ''; - - print ''; - - print ""; - print ""; - - print "
'.$langs->trans("Customer").' :'.$facture->client->nom.''.$langs->trans("Comment").'
'.$langs->trans("Title").' :'; - print '
".$langs->trans("Author")." :".$user->fullname."
Conditions de réglement :"; - - print $facture->cond_reglement; - - print "
Projet :"; - if ($facture->projetid > 0) + if ($facture->fetch($_GET["facid"]) > 0) { - $proj = new Project($db); - $proj->fetch($facture->projetid); - print $proj->title; + + print ''; + print ''; + print ''; + + print ''; + + $facture->fetch_client(); + + print ''; + print ''; + + print ''; + + print ''; + + print ""; + print ""; + + print "
'.$langs->trans("Customer").' :'.$facture->client->nom.''.$langs->trans("Comment").'
'.$langs->trans("Title").' :'; + print '
".$langs->trans("Author")." :".$user->fullname."
Conditions de réglement :"; + + print $facture->cond_reglement; + + print "
Projet :"; + if ($facture->projetid > 0) + { + $proj = new Project($db); + $proj->fetch($facture->projetid); + print $proj->title; + } + print "
"; + + + + print '
'; + print_titre('Services/Produits'); + + /* + * Lignes de factures + * + */ + print ''; + print ''; + if ($flag_different_price) + { + print ''; + } + print ''; + print "\n"; + print "
'; + + $sql = "SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_taux, l.remise_percent, l.subprice"; + $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l WHERE l.fk_facture = $facture->id ORDER BY l.rowid"; + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + $i = 0; $total = 0; + + echo ''; + if ($num) + { + print ""; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + } + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object($result); + + if ($objp->fk_product > 0) + { + $product = New Product($db); + $product->fetch($objp->fk_product); + } + + $var=!$var; + print ""; + if ($objp->fk_product) + { + print ''; + } + else + { + print "\n"; + } + print ''; + print ''; + if ($objp->remise_percent > 0) + { + print '\n"; + } + else + { + print ''; + } + + print '\n"; + + if ($objp->fk_product > 0 && $objp->subprice <> $product->price) + { + print '\n"; + $flag_different_price++; + } + else + { + print ''; + } + + print ""; + + $i++; + } + + $db->free($result); + + } + else + { + print $db->error(); + } + print "
'.$langs->trans("Description").''.$langs->trans("VAT").''.$langs->trans("Qty").''.$langs->trans("Discount").''.$langs->trans("PriceU").'N.P.
'.stripslashes(nl2br($objp->description)).'".stripslashes(nl2br($objp->description))."'.$objp->tva_taux.' %'.$objp->qty.''.$objp->remise_percent." % '.price($objp->subprice)."'.price($product->price)." 
"; + + print '
'; + print ''; + print '
\n"; + } - print "
"; - - - - print '
'; - print_titre('Services/Produits'); - - print ''; - /* - * Lignes de factures - * - */ - print ''; - if ($flag_different_price) - { - print ''; - } - print ''; - print "\n"; - print "
'; - - $sql = "SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_taux, l.remise_percent, l.subprice"; - $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l WHERE l.fk_facture = $facture->id ORDER BY l.rowid"; - - $result = $db->query($sql); - if ($result) + else { - $num = $db->num_rows(); - $i = 0; $total = 0; - - echo ''; - if ($num) - { - print ""; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - } - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object(); - - if ($objp->fk_product > 0) - { - $product = New Product($db); - $product->fetch($objp->fk_product); - } - - $var=!$var; - print ""; - if ($objp->fk_product) - { - print ''; - } - else - { - print "\n"; - } - print ''; - print ''; - if ($objp->remise_percent > 0) - { - print '\n"; - } - else - { - print ''; - } - - print '\n"; - - if ($objp->fk_product > 0 && $objp->subprice <> $product->price) - { - print '\n"; - $flag_different_price++; - } - else - { - print ''; - } - - print ""; - - $i++; - } - - $db->free(); - - } - else - { - print $db->error(); + print "Erreur facture $facture->id inexistante"; } - print "
'.$langs->trans("Description").''.$langs->trans("VAT").''.$langs->trans("Qty").''.$langs->trans("Discount").''.$langs->trans("PriceU").'N.P.
'.stripslashes(nl2br($objp->description)).'".stripslashes(nl2br($objp->description))."'.$objp->tva_taux.' %'.$objp->qty.''.$objp->remise_percent." % '.price($objp->subprice)."'.price($product->price)." 
"; - - print '
'; - print ''; - print '
\n"; - - } - else - { - print "Erreur facture $facture->id inexistante"; - } -} +} else /* *************************************************************************** */ /* */ @@ -424,7 +424,7 @@ else } if ($result) { - $num = $db->num_rows(); + $num = $db->num_rows($result); print_barre_liste($langs->trans("Bills"),$page,"fiche-rec.php","&socidp=$socidp",$sortfield,$sortorder,'',$num); $i = 0; @@ -441,7 +441,7 @@ else $var=True; while ($i < min($num,$limit)) { - $objp = $db->fetch_object(); + $objp = $db->fetch_object($result); $var=!$var; print ""; @@ -486,5 +486,5 @@ else $db->close(); -llxFooter("Dernière modification $Date$ révision $Revision$"); +llxFooter('$Date$ - $Revision$'); ?>