diff --git a/htdocs/admin/boutique-special-all.php b/htdocs/admin/boutique-special-all.php
new file mode 100644
index 00000000000..42fb613fda8
--- /dev/null
+++ b/htdocs/admin/boutique-special-all.php
@@ -0,0 +1,68 @@
+
+ *
+ * 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();
+?>
diff --git a/htdocs/product/promotion/index.php b/htdocs/product/promotion/index.php
new file mode 100644
index 00000000000..6e4fe4cb7d8
--- /dev/null
+++ b/htdocs/product/promotion/index.php
@@ -0,0 +1,71 @@
+
+ *
+ * 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 '
';
+ print "| ";
+ print_liste_field_titre("Titre",$PHP_SELF, "a.title");
+ print " | ";
+ print 'Prix initial | ';
+ print 'Prix remisé | ';
+ print "
\n";
+ $var=True;
+ while ($i < $num)
+ {
+ $objp = $db->fetch_object( $i);
+ $var=!$var;
+
+ print "";
+ print '| '.$objp->products_name." | ";
+ print ''.price($objp->products_price)." | ";
+ print ''.price($objp->specials_new_products_price)." | ";
+ print "
";
+ $i++;
+ }
+ print "
";
+ $db->free();
+}
+else
+{
+ print $db->error();
+}
+$db->close();
+
+llxFooter("Dernière modification $Date$ révision $Revision$");
+
+
+?>
diff --git a/htdocs/product/promotion/pre.inc.php b/htdocs/product/promotion/pre.inc.php
new file mode 100644
index 00000000000..12e4233f8c7
--- /dev/null
+++ b/htdocs/product/promotion/pre.inc.php
@@ -0,0 +1,85 @@
+
+ *
+ * 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);
+ /*
+ *
+ *
+ */
+
+}
+?>
diff --git a/htdocs/product/promotion/promotion.class.php b/htdocs/product/promotion/promotion.class.php
new file mode 100644
index 00000000000..3565849fdab
--- /dev/null
+++ b/htdocs/product/promotion/promotion.class.php
@@ -0,0 +1,147 @@
+
+ *
+ * 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";
+
+
+ }
+
+
+}
+?>