Fix: Restauration de la bonne utilisation du fetch.

This commit is contained in:
Laurent Destailleur 2004-11-06 14:46:34 +00:00
parent b672e97a9f
commit bc62c155f7
2 changed files with 26 additions and 10 deletions

View File

@ -20,6 +20,12 @@
* $Source$ * $Source$
* *
*/ */
/*!
\file htdocs/compta/deplacement/fiche.php
\brief Page fiche d'un déplacement
*/
require("./pre.inc.php"); require("./pre.inc.php");
$mesg = ''; $mesg = '';
@ -45,13 +51,13 @@ if ($_POST["action"] == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
$deplacement->userid = $user->id; //$_POST["km"]; $deplacement->userid = $user->id; //$_POST["km"];
$id = $deplacement->create($user); $id = $deplacement->create($user);
if ($_POST["id"]) if ($id)
{ {
Header ( "Location: fiche.php?id=".$_POST["id"]); Header ( "Location: fiche.php?id=".$id);
} }
else else
{ {
print "Error"; dolibarr_print_error($db);
} }
} }
@ -136,6 +142,8 @@ else
$html = new Form($db); $html = new Form($db);
$html->form_confirm("fiche.php?id=".$_GET["id"],"Supprimer ce déplacement","Etes-vous sûr de vouloir supprimer ce déplacement ?","confirm_delete"); $html->form_confirm("fiche.php?id=".$_GET["id"],"Supprimer ce déplacement","Etes-vous sûr de vouloir supprimer ce déplacement ?","confirm_delete");
print '<br>';
} }
@ -147,7 +155,7 @@ else
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$_GET["id"].'">'; print '<input type="hidden" name="id" value="'.$_GET["id"].'">';
print '<table class="border" width="100%" cellspacing="0" cellpadding="3">'; print '<table class="border" width="100%">';
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($deplacement->socid); $soc->fetch($deplacement->socid);

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* *
* 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
@ -21,9 +21,18 @@
* $Source$ * $Source$
* *
*/ */
/*!
\file htdocs/compta/deplacement/index.php
\brief Page liste des déplacements
*/
require("./pre.inc.php"); require("./pre.inc.php");
require("../../tva.class.php"); require("../../tva.class.php");
$langs->load("companies");
$langs->load("users");
llxHeader(); llxHeader();
/* /*
@ -71,13 +80,13 @@ if ( $db->query($sql) )
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Date"),"index.php","d.dated","","&socidp=$socidp",'',$sortfield); print_liste_field_titre($langs->trans("Date"),"index.php","d.dated","","&socidp=$socidp",'',$sortfield);
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","&socidp=$socidp",'',$sortfield); print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","&socidp=$socidp",'',$sortfield);
print_liste_field_titre($langs->trans("User"),"index.php","u.name","","&socidp=$socidp",'',$sortfield); print_liste_field_titre($langs->trans("Person"),"index.php","u.name","","&socidp=$socidp",'',$sortfield);
print "</tr>\n"; print "</tr>\n";
$var=True; $var=True;
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($i); $objp = $db->fetch_object();
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($objp->idp); $soc->fetch($objp->idp);
$var=!$var; $var=!$var;
@ -85,7 +94,7 @@ if ( $db->query($sql) )
print '<td><a href="fiche.php?id='.$objp->rowid.'">'.dolibarr_print_date($objp->dd).'</a></td>'; print '<td><a href="fiche.php?id='.$objp->rowid.'">'.dolibarr_print_date($objp->dd).'</a></td>';
print '<td>' . $soc->nom_url . '</a></td>'; print '<td>' . $soc->nom_url . '</a></td>';
print '<td align="center">'.$objp->firstname.' '.$objp->name.'</td>'; print '<td align="left">'.$objp->firstname.' '.$objp->name.'</td>';
print "</tr>\n"; print "</tr>\n";
@ -97,8 +106,7 @@ if ( $db->query($sql) )
} }
else else
{ {
print $db->error(); dolibarr_print_error($db);
print "<p>$sql";
} }
$db->close(); $db->close();