2004-10-19 19:31:11 +00:00
< ? php
2003-03-24 21:50:34 +00:00
/* Copyright ( C ) 2003 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
*
* 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
2013-01-16 14:36:08 +00:00
* the Free Software Foundation ; either version 3 of the License , or
2003-03-24 21:50:34 +00:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2011-08-03 00:45:22 +00:00
* along with this program . If not , see < http :// www . gnu . org / licenses />.
2003-03-24 21:50:34 +00:00
*
*/
2005-08-24 16:37:10 +00:00
/**
2010-04-27 08:22:48 +00:00
* \file htdocs / boutique / client / class / boutiqueclient . class . php
2010-01-13 17:58:34 +00:00
* \brief Classe permettant de gerer des clients de la boutique online
* \author Rodolphe Quiedeville
*/
2004-07-28 19:36:48 +00:00
2009-01-31 01:17:53 +00:00
/**
2010-04-27 08:17:40 +00:00
* \class BoutiqueClient
2010-01-13 17:58:34 +00:00
* \brief Classe permettant de gerer des clients de la boutique online
*/
2010-04-27 08:17:40 +00:00
class BoutiqueClient
2005-08-24 16:37:10 +00:00
{
var $db ;
2003-03-24 21:50:34 +00:00
2005-08-24 16:37:10 +00:00
var $id ;
var $nom ;
2003-03-24 21:50:34 +00:00
2011-09-20 22:24:03 +00:00
/**
* Constructor
*
2012-01-30 09:22:50 +00:00
* @ param DoliDB $db Database handler
2011-09-20 22:24:03 +00:00
*/
2012-07-30 15:17:33 +00:00
function __construct ( $db )
2005-08-24 16:37:10 +00:00
{
2012-01-30 09:22:50 +00:00
$this -> db = $db ;
2005-08-24 16:37:10 +00:00
}
2004-07-28 19:36:48 +00:00
2005-08-24 16:37:10 +00:00
/**
2011-09-20 22:24:03 +00:00
* Fonction permettant de recuperer les informations d ' un clients de la boutique
*
* @ param int $id Id du client
* @ return int < 0 if KO , > 0 if OK
2010-01-13 17:58:34 +00:00
*/
2011-09-20 22:24:03 +00:00
function fetch ( $id )
2005-08-24 16:37:10 +00:00
{
2009-01-31 01:17:53 +00:00
global $conf ;
2005-08-24 16:37:10 +00:00
2010-04-27 08:17:40 +00:00
$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 ;
2005-08-24 16:37:10 +00:00
2011-09-20 13:32:16 +00:00
$resql = $this -> db -> query ( $sql );
2010-04-27 08:17:40 +00:00
if ( $resql )
2005-08-24 16:37:10 +00:00
{
2010-04-27 08:17:40 +00:00
$result = $this -> db -> fetch_array ( $resql );
2003-03-24 21:50:34 +00:00
2005-08-24 16:37:10 +00:00
$this -> id = $result [ " customers_id " ];
2010-04-27 08:17:40 +00:00
$this -> name = $result [ " customers_firstname " ] . " " . $result [ " customers_lastname " ];
2003-03-24 21:50:34 +00:00
2010-04-27 08:17:40 +00:00
$this -> db -> free ( $resql );
return 1 ;
2005-08-24 16:37:10 +00:00
}
else
{
print $this -> db -> error ();
2010-04-27 08:17:40 +00:00
return - 1 ;
2005-08-24 16:37:10 +00:00
}
}
2003-03-24 21:50:34 +00:00
}
?>