Qual: Suppression pages obsoletes
This commit is contained in:
parent
a6b032cc67
commit
0717cdb2be
@ -1,117 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 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
|
||||
* 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();
|
||||
|
||||
if ($action == "inactive")
|
||||
{
|
||||
$promotion = new Promotion($db);
|
||||
$promotion->set_inactive($id);
|
||||
}
|
||||
if ($action == "active")
|
||||
{
|
||||
$promotion = new Promotion($db);
|
||||
$promotion->set_active($id);
|
||||
}
|
||||
|
||||
if ($sortfield == "")
|
||||
{
|
||||
$sortfield="pd.products_name";
|
||||
}
|
||||
if ($sortorder == "")
|
||||
{
|
||||
$sortorder="ASC";
|
||||
}
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
print_barre_liste("Liste des promotions", $page, "index.php", "",$sortfield, $sortorder);
|
||||
|
||||
$urladd = "&sortorder=$sortorder&sortfield=$sortfield";
|
||||
|
||||
$sql = "SELECT pd.products_name, s.specials_new_products_price, p.products_price, p.products_model, s.status, p.products_id";
|
||||
$sql .= ",".$db->pdate("expires_date")." as fin";
|
||||
$sql .= " FROM ".OSC_DB_NAME.".specials as s,".OSC_DB_NAME.".products_description as pd,".OSC_DB_NAME.".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;
|
||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql .= $db->plimit( $limit ,$offset);
|
||||
|
||||
if ( $db->query($sql) )
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
print '<table class=\"noborder width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("Ref"),"index.php", "p.products_model");
|
||||
print_liste_field_titre("Titre","index.php", "pd.products_name");
|
||||
print "<td> </td><td> </td><td>Fin</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 $bc[$var]>";
|
||||
print '<td>'.$objp->products_model."</td>";
|
||||
print '<td>'.$objp->products_name."</td>";
|
||||
|
||||
if ($objp->status == 1)
|
||||
{
|
||||
print '<td align="center"><img src="/theme/'.$conf->theme.'/img/icon_status_green.png" border="0" alt="actif"></td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="index.php?action=inactive&id='.$objp->products_id.''.$urladd.'&page='.$page.'">';
|
||||
print '<img src="/theme/'.$conf->theme.'/img/icon_status_red_light.png" border="0"></a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center">';
|
||||
print '<a href="index.php?action=active&id='.$objp->products_id.''.$urladd.'&page='.$page.'">';
|
||||
print '<img src="/theme/'.$conf->theme.'/img/icon_status_green_light.png" border="0"></a></td>';
|
||||
print '<td align="center"><img src="/theme/'.$conf->theme.'/img/icon_status_red.png" border="0" alt="inactif"></td>';
|
||||
}
|
||||
print "<td>".strftime("%d/%m/%Y", $objp->fin)."</td>";
|
||||
print '<td align="right">'.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>");
|
||||
|
||||
|
||||
?>
|
||||
@ -1,85 +0,0 @@
|
||||
<?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.php");
|
||||
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);
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
}
|
||||
?>
|
||||
@ -1,178 +0,0 @@
|
||||
<?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 ".OSC_DB_NAME.".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 ".OSC_DB_NAME.".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(OSC_DB_NAME.".specials");
|
||||
|
||||
return $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function update($id, $user)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."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 set_active($id)
|
||||
{
|
||||
$sql = "UPDATE ".OSC_DB_NAME.".specials";
|
||||
$sql .= " SET status = 1";
|
||||
|
||||
$sql .= " WHERE products_id = " . $id;
|
||||
|
||||
if ( $this->db->query($sql) ) {
|
||||
return 1;
|
||||
} else {
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*/
|
||||
function set_inactive($id)
|
||||
{
|
||||
$sql = "UPDATE ".OSC_DB_NAME.".specials";
|
||||
$sql .= " SET status = 0";
|
||||
|
||||
$sql .= " WHERE products_id = " . $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 ".OSC_DB_NAME.".categories as c,".OSC_DB_NAME.".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 ".OSC_DB_NAME.".products WHERE products_id = $idosc ";
|
||||
|
||||
$sql = "DELETE FROM ".OSC_DB_NAME.".products_to_categories WHERE products_id = $idosc";
|
||||
|
||||
$sql = "DELETE FROM ".OSC_DB_NAME.".products_description WHERE products_id = $idosc";
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."album WHERE rowid = $id";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user