Files
le-matelot/client/plugins/combidecli/CombidecliCommande.class.php
2020-01-27 08:56:08 +01:00

94 lines
3.4 KiB
PHP

<?php
/*************************************************************************************/
/* */
/* Thelia - Plugin de combinaison des déclinaisons */
/* */
/* Copyright (c) Franck Allimant, 2011 */
/* email : franck.allimant@cqfdev.fr */
/* web : http://www.cqfdev.fr */
/* idée originale: Jean-Baptiste Billot (ottoroots@gmail.com) */
/* */
/* 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 */
/* the Free Software Foundation; either version 2 of the License, or */
/* (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 */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* */
/*************************************************************************************/
include_once(realpath(dirname(__FILE__)) . "/../../../classes/Baseobj.class.php");
class CombidecliCommande extends Baseobj
{
const TABLE = 'combideclicommande';
public $id;
public $commande;
public $combidecli;
public $quantite;
public $table = self::TABLE;
public $bddvars = array('id', 'commande', 'combidecli', 'quantite');
public function CombidecliCommande($id = false)
{
parent::Baseobj();
if ($id) $this->charger($id);
}
public static function init()
{
$query = 'CREATE TABLE IF NOT EXISTS '.self::TABLE.' (
id int(11) NOT NULL auto_increment,
commande int(11) NOT NULL,
combidecli int(11) NOT NULL,
quantite int(11) not null,
PRIMARY KEY (id),
INDEX (commande)
) AUTO_INCREMENT=1 ;';
$result = mysql_query($query);
}
public static function destroy()
{
mysql_query('DROP TABLE ' . self::TABLE);
}
function charger_id($id)
{
$this->id = $id;
return parent::charger();
}
static function lister_par_commande($idcommande)
{
$arr = array();
$result = mysql_query("select * from ".self::TABLE." where commande=$idcommande");
while ($result && $obj = mysql_fetch_object($result, 'CombidecliCommande'))
{
$arr[] = $obj;
}
return $arr;
}
static function supprimer_par_commande($idcommande)
{
mysql_query("delete from ".self::TABLE." where commande=$idcommande");
}
}