Fix: Avoid class name conflict

This commit is contained in:
Laurent Destailleur 2010-04-27 08:17:40 +00:00
parent 009b251d52
commit 630d932d5b
2 changed files with 88 additions and 84 deletions

View File

@ -27,18 +27,18 @@
*/ */
/** /**
* \class Client * \class BoutiqueClient
* \brief Classe permettant de gerer des clients de la boutique online * \brief Classe permettant de gerer des clients de la boutique online
*/ */
class Client class BoutiqueClient
{ {
var $db ; var $db ;
var $id ; var $id ;
var $nom; var $nom;
function Client($DB, $id=0) function BoutiqueClient($DB, $id=0)
{ {
$this->db = $DB; $this->db = $DB;
$this->id = $id ; $this->id = $id ;
@ -52,25 +52,24 @@ class Client
{ {
global $conf; global $conf;
$sql = "SELECT customers_id, customers_lastname, customers_firstname FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."customers WHERE customers_id = $id"; $sql = "SELECT customers_id, customers_lastname, customers_firstname FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."customers WHERE customers_id = ".$id;
$result = $this->db->query($sql) ; $resql = $this->db->query($sql) ;
if ( $resql )
if ( $result )
{ {
$result = $this->db->fetch_array(); $result = $this->db->fetch_array($resql);
$this->id = $result["customers_id"]; $this->id = $result["customers_id"];
$this->name = stripslashes($result["customers_firstname"]) . " " . stripslashes($result["customers_lastname"]); $this->name = $result["customers_firstname"] . " " . $result["customers_lastname"];
$this->db->free(); $this->db->free($resql);
return 1;
} }
else else
{ {
print $this->db->error(); print $this->db->error();
return -1;
} }
return $result;
} }
} }

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) 2003-2005 <EFBFBD>ric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2003-2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2010 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
@ -21,94 +21,99 @@
*/ */
/** /**
\file htdocs/boutique/client/fiche.php * \file htdocs/boutique/client/fiche.php
\ingroup boutique * \ingroup boutique
\brief Page fiche client OSCommerce * \brief Page fiche client OSCommerce
\version $Revision$ * \version $Revision$
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
include_once(DOL_DOCUMENT_ROOT.'/boutique/client/client.class.php');
/*
* Actions
*/
if ($action == 'update' && !$cancel)
{
$client = new BoutiqueClient($dbosc);
$client->nom = $nom;
$client->update($id, $user);
}
/*
* View
*/
llxHeader(); llxHeader();
if ($action == 'update' && !$cancel) {
$client = new Client($dbosc);
$client->nom = $nom;
$client->update($id, $user);
}
/*
*
*
*/
if ($_GET['id']) if ($_GET['id'])
{ {
$client = new BoutiqueClient($dbosc);
$client = new Client($dbosc); $result = $client->fetch($_GET['id']);
$result = $client->fetch($_GET['id']); if ( $result )
if ( $result )
{
print '<div class="titre">Fiche Client : '.$client->name.'</div><br>';
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print "<tr>";
print '<td width="20%">Nom</td><td width="80%">'.$client->name.'</td></tr>';
print "</table>";
/*
* Commandes
*
*/
$sql = "SELECT o.orders_id, o.customers_id,".$dbosc->pdate("date_purchased")." as date_purchased, t.value as total";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
$sql .= " WHERE o.customers_id = " . $_GET['id'];
$sql .= " AND o.orders_id = t.orders_id AND t.class = 'ot_total'";
//echo $sql;
if ( $dbosc->query($sql) )
{ {
$num = $dbosc->num_rows(); print '<div class="titre">'.$langs->trans("CustomerCard").': '.$client->name.'</div><br>';
$i = 0;
print '<table class="noborder" width="50%">';
print "<tr class=\"liste_titre\"><td>Commandes</td>";
print "</tr>\n";
$var=True;
while ($i < $num) {
$objp = $dbosc->fetch_object();
$var=!$var;
print "<tr $bc[$var]>";
print '<td><a href="'.DOL_URL_ROOT.'/boutique/commande/fiche.php?id='.$objp->orders_id.'"><img src="/theme/'.$conf->theme.'/img/filenew.png" border="0" alt="Fiche">&nbsp;'; print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print "<tr>";
print '<td width="20%">Nom</td><td width="80%">'.$client->name.'</td></tr>';
print "</table>";
/*
* Commandes
*/
$sql = "SELECT o.orders_id, o.customers_id,".$dbosc->pdate("date_purchased")." as date_purchased, t.value as total";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
$sql .= " WHERE o.customers_id = " . $_GET['id'];
$sql .= " AND o.orders_id = t.orders_id AND t.class = 'ot_total'";
//echo $sql;
$resql=$dbosc->query($sql);
if ($resql)
{
$num = $dbosc->num_rows($resql);
$i = 0;
print '<table class="noborder" width="50%">';
print "<tr class=\"liste_titre\"><td>Commandes</td>";
print "</tr>\n";
$var=True;
while ($i < $num)
{
$objp = $dbosc->fetch_object($resql);
$var=!$var;
print "<tr $bc[$var]>";
print '<td><a href="'.DOL_URL_ROOT.'/boutique/commande/fiche.php?id='.$objp->orders_id.'"><img src="/theme/'.$conf->theme.'/img/filenew.png" border="0" alt="Fiche">&nbsp;';
print dol_print_date($objp->date_purchased,'dayhour')."</a>\n";
print $objp->total . "</a></TD>\n";
print "</tr>\n";
$i++;
}
print "</table>";
$dbosc->free($resql);
}
else
{
print "<p>ERROR 1</p>\n";
dol_print_error($dbosc);
}
print dol_print_date($objp->date_purchased,'dayhour')."</a>\n";
print $objp->total . "</a></TD>\n";
print "</tr>\n";
$i++;
}
print "</table>";
$dbosc->free();
} }
else else
{ {
print "<p>ERROR 1</p>\n"; print "<p>ERROR 1</p>\n";
dol_print_error($dbosc); dol_print_error($dbosc);
} }
}
else
{
print "<p>ERROR 1</p>\n";
dol_print_error($dbosc);
}
} }
else else
{ {
print "<p>ERROR 1</p>\n"; print "<p>ERROR 1</p>\n";
print "Error"; print "Error";
} }