Nouveau fichier
This commit is contained in:
parent
72cfe954eb
commit
8131c09f29
68
htdocs/admin/boutique-special-all.php
Normal file
68
htdocs/admin/boutique-special-all.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?PHP
|
||||
/* 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
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require("../boutique/livre/livre.class.php");
|
||||
require("../boutique/editeur/editeur.class.php");
|
||||
require("../boutique/auteur/auteur.class.php");
|
||||
require("../product/promotion/promotion.class.php");
|
||||
|
||||
$db = new Db();
|
||||
|
||||
llxHeader();
|
||||
|
||||
print_barre_liste("Mise a jour de tous les livres", $page, $PHP_SELF);
|
||||
|
||||
$sql = "SELECT l.rowid FROM llx_livre as l";
|
||||
|
||||
if ( $db->query($sql) )
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object( $i);
|
||||
|
||||
$livre = new Livre($db);
|
||||
if ($livre->fetch($objp->rowid))
|
||||
{
|
||||
|
||||
$prom = new Promotion($db);
|
||||
$prom->create($user,$livre->oscid, 5);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Error can't fetch";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error();
|
||||
}
|
||||
|
||||
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
71
htdocs/product/promotion/index.php
Normal file
71
htdocs/product/promotion/index.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?PHP
|
||||
/* 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
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
llxHeader();
|
||||
|
||||
$db = new Db();
|
||||
|
||||
print_barre_liste("Liste des promotions", $page, $PHP_SELF);
|
||||
|
||||
$sql = "SELECT pd.products_name, s.specials_new_products_price, p.products_price";
|
||||
$sql .= " FROM ".DB_NAME_OSC.".specials as s,".DB_NAME_OSC.".products_description as pd,".DB_NAME_OSC.".products as p";
|
||||
$sql .= " WHERE s.products_id = pd.products_id AND pd.products_id = p.products_id AND pd.language_id = ".OSC_LANGUAGE_ID;
|
||||
|
||||
if ( $db->query($sql) )
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
print '<p><TABLE border="0" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print "<TR class=\"liste_titre\"><td>";
|
||||
print_liste_field_titre("Titre",$PHP_SELF, "a.title");
|
||||
print "</td>";
|
||||
print '<td align="right">Prix initial</td>';
|
||||
print '<td align="right">Prix remisé</td>';
|
||||
print "</TR>\n";
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object( $i);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr>";
|
||||
print '<td>'.$objp->products_name."</td>";
|
||||
print '<td align="rigth">'.price($objp->products_price)."</td>";
|
||||
print '<td align="right">'.price($objp->specials_new_products_price)."</td>";
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
print "</TABLE>";
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error();
|
||||
}
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
|
||||
|
||||
?>
|
||||
85
htdocs/product/promotion/pre.inc.php
Normal file
85
htdocs/product/promotion/pre.inc.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?PHP
|
||||
/* 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
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
require("../../main.inc.php3");
|
||||
require("./promotion.class.php");
|
||||
|
||||
function llxHeader($head = "", $urlp = "") {
|
||||
global $user, $conf;
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
top_menu($head);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
if ($conf->boutique->livre->enabled)
|
||||
{
|
||||
$menu->add("/boutique/livre/", "Livres");
|
||||
|
||||
$menu->add_submenu("/boutique/livre/fiche.php?&action=create","Nouvel ouvrage");
|
||||
|
||||
$menu->add("/boutique/auteur/", "Auteurs");
|
||||
|
||||
$menu->add_submenu("/boutique/auteur/fiche.php?&action=create","Nouvel auteur");
|
||||
|
||||
$menu->add("/boutique/editeur/", "Editeurs");
|
||||
|
||||
$menu->add_submenu("/boutique/editeur/fiche.php?&action=create","Nouvel éditeur");
|
||||
|
||||
}
|
||||
|
||||
$menu->add("/product/categorie/", "Catégories");
|
||||
|
||||
$menu->add("/product/promotion/", "Promotions");
|
||||
|
||||
if ($conf->boutique->album->enabled)
|
||||
{
|
||||
$menu->add("/product/album/", "Albums");
|
||||
|
||||
$menu->add_submenu("../osc-liste.php", "Osc");
|
||||
$menu->add_submenu("../osc-liste.php?reqstock=epuise", "Produits Epuisés");
|
||||
|
||||
$menu->add_submenu("/product/album/fiche.php?&action=create","Nouvel album");
|
||||
|
||||
$menu->add("/product/groupart/", "Artistes/Groupes");
|
||||
|
||||
$menu->add_submenu("/product/groupart/fiche.php?&action=create","Nouvel Artiste/Groupe");
|
||||
|
||||
$menu->add("/product/concert/", "Concerts");
|
||||
|
||||
$menu->add_submenu("/product/concert/fiche.php?&action=create","Nouveau concert");
|
||||
|
||||
$menu->add("../osc-reviews.php", "Critiques");
|
||||
|
||||
$menu->add_submenu("../osc-productsbyreviews.php", "Meilleurs produits");
|
||||
}
|
||||
|
||||
left_menu($menu->liste);
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
}
|
||||
?>
|
||||
147
htdocs/product/promotion/promotion.class.php
Normal file
147
htdocs/product/promotion/promotion.class.php
Normal file
@ -0,0 +1,147 @@
|
||||
<?PHP
|
||||
/* 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
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
class Promotion {
|
||||
var $db ;
|
||||
|
||||
var $id ;
|
||||
var $parent_id ;
|
||||
var $oscid ;
|
||||
var $ref;
|
||||
var $titre;
|
||||
var $description;
|
||||
var $price ;
|
||||
var $status ;
|
||||
|
||||
Function Promotion($DB, $id=0) {
|
||||
$this->db = $DB;
|
||||
$this->id = $id ;
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function create($user, $pid, $percent) {
|
||||
|
||||
$sql = "SELECT products_price ";
|
||||
$sql .= " FROM ".DB_NAME_OSC.".products as p";
|
||||
$sql .= " WHERE p.products_id = $pid";
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
|
||||
if ( $result )
|
||||
{
|
||||
$result = $this->db->fetch_array();
|
||||
$this->price_init = $result["products_price"];
|
||||
}
|
||||
|
||||
$newprice = 0.95 * $this->price_init;
|
||||
|
||||
$date_exp = "2003-05-01";
|
||||
|
||||
$sql = "INSERT INTO ".DB_NAME_OSC.".specials ";
|
||||
$sql .= " (products_id, specials_new_products_price, specials_date_added, specials_last_modified, expires_date, date_status_change, status) ";
|
||||
$sql .= " VALUES ($pid, $newprice, now(),NULL,'$date_exp',NULL,1)";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$id = $this->db->last_insert_id();
|
||||
|
||||
return $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function update($id, $user)
|
||||
{
|
||||
|
||||
|
||||
$sql = "UPDATE llx_album ";
|
||||
$sql .= " SET title = '" . trim($this->titre) ."'";
|
||||
$sql .= ",description = '" . trim($this->description) ."'";
|
||||
|
||||
$sql .= " WHERE rowid = " . $id;
|
||||
|
||||
if ( $this->db->query($sql) ) {
|
||||
return 1;
|
||||
} else {
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function fetch ($id) {
|
||||
|
||||
$sql = "SELECT c.categories_id, cd.categories_name, c.parent_id";
|
||||
$sql .= " FROM ".DB_NAME_OSC.".categories as c,".DB_NAME_OSC.".categories_description as cd";
|
||||
$sql .= " WHERE c.categories_id = cd.categories_id AND cd.language_id = ".OSC_LANGUAGE_ID;
|
||||
$sql .= " AND c.categories_id = $id";
|
||||
$result = $this->db->query($sql) ;
|
||||
|
||||
if ( $result ) {
|
||||
$result = $this->db->fetch_array();
|
||||
|
||||
$this->id = $result["categories_id"];
|
||||
$this->parent_id = $result["parent_id"];
|
||||
$this->name = $result["categories_name"];
|
||||
$this->titre = $result["title"];
|
||||
$this->description = $result["description"];
|
||||
$this->oscid = $result["osc_id"];
|
||||
}
|
||||
$this->db->free();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function delete($user) {
|
||||
|
||||
$sql = "DELETE FROM ".DB_NAME_OSC.".products WHERE products_id = $idosc ";
|
||||
|
||||
$sql = "DELETE FROM ".DB_NAME_OSC.".products_to_categories WHERE products_id = $idosc";
|
||||
|
||||
$sql = "DELETE FROM ".DB_NAME_OSC.".products_description WHERE products_id = $idosc";
|
||||
|
||||
$sql = "DELETE FROM llx_album WHERE rowid = $id";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user