Fix: Avoid class name conflict
This commit is contained in:
parent
009b251d52
commit
630d932d5b
@ -27,18 +27,18 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \class Client
|
||||
* \class BoutiqueClient
|
||||
* \brief Classe permettant de gerer des clients de la boutique online
|
||||
*/
|
||||
|
||||
class Client
|
||||
class BoutiqueClient
|
||||
{
|
||||
var $db ;
|
||||
|
||||
var $id ;
|
||||
var $nom;
|
||||
|
||||
function Client($DB, $id=0)
|
||||
function BoutiqueClient($DB, $id=0)
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->id = $id ;
|
||||
@ -52,25 +52,24 @@ class Client
|
||||
{
|
||||
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) ;
|
||||
|
||||
if ( $result )
|
||||
$resql = $this->db->query($sql) ;
|
||||
if ( $resql )
|
||||
{
|
||||
$result = $this->db->fetch_array();
|
||||
$result = $this->db->fetch_array($resql);
|
||||
|
||||
$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
|
||||
{
|
||||
print $this->db->error();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003-2005 <EFBFBD>ric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2003-2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2006-2010 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
|
||||
@ -21,94 +21,99 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/boutique/client/fiche.php
|
||||
\ingroup boutique
|
||||
\brief Page fiche client OSCommerce
|
||||
\version $Revision$
|
||||
*/
|
||||
* \file htdocs/boutique/client/fiche.php
|
||||
* \ingroup boutique
|
||||
* \brief Page fiche client OSCommerce
|
||||
* \version $Revision$
|
||||
*/
|
||||
|
||||
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();
|
||||
|
||||
if ($action == 'update' && !$cancel) {
|
||||
$client = new Client($dbosc);
|
||||
$client->nom = $nom;
|
||||
$client->update($id, $user);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($_GET['id'])
|
||||
{
|
||||
|
||||
$client = new Client($dbosc);
|
||||
$result = $client->fetch($_GET['id']);
|
||||
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) )
|
||||
$client = new BoutiqueClient($dbosc);
|
||||
$result = $client->fetch($_GET['id']);
|
||||
if ( $result )
|
||||
{
|
||||
$num = $dbosc->num_rows();
|
||||
$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 '<div class="titre">'.$langs->trans("CustomerCard").': '.$client->name.'</div><br>';
|
||||
|
||||
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"> ';
|
||||
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"> ';
|
||||
|
||||
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";
|
||||
dol_print_error($dbosc);
|
||||
print "<p>ERROR 1</p>\n";
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<p>ERROR 1</p>\n";
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<p>ERROR 1</p>\n";
|
||||
print "Error";
|
||||
print "<p>ERROR 1</p>\n";
|
||||
print "Error";
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user