Ajout du patch Jean concernant OSCommerce

This commit is contained in:
Regis Houssin 2006-03-22 17:52:12 +00:00
parent a0b058421d
commit 1762631108
10 changed files with 564 additions and 5 deletions

270
htdocs/boutique/index.php Normal file
View File

@ -0,0 +1,270 @@
<?php
/* Copyright (C) 2003-2004 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$
*
*/
/**
\file htdocs/boutique/index.php
\ingroup boutique
\brief Page accueil zone boutique
\version $Revision$
*/
require("./pre.inc.php");
$langs->load("boutique");
llxHeader("",$langs->trans("Orders"),"Commande");
print_titre($langs->trans("BoutiqueWeb"));
print '<table class="noborder" width="100%">';
print '<tr><td valign="top" width="40%">';
/*
/* Chiffre d'affaire
*/
//print_barre_liste("Chiffre d'affaire", $page, "ca.php");
print_titre($langs->trans("Chiffre d'affaire"));
print '<table class="noborder" cellspacing="0" cellpadding="3" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Description").'</td>';
print '<td align="right">'.$langs->trans("Total").'</td></tr>';
$sql = "SELECT sum(t.value) as value, MONTH(o.date_purchased) as mois";
$sql .= " FROM ".OSC_DB_NAME.".orders_total as t";
$sql .= " JOIN ".OSC_DB_NAME.".orders as o ON o.orders_id = t.orders_id";
$sql .= " WHERE t.class = 'ot_subtotal' AND YEAR(o.date_purchased) = YEAR(now()) ";
$sql .= " GROUP BY mois ORDER BY mois";
if ( $db->query($sql) )
{
$num = $db->num_rows();
$var=True;
$i=0;
if ($num > 0)
{
while ($i < $num)
{
$objp = $db->fetch_object();
$var=!$var;
print "<tr $bc[$var]>";
print '<td align="left">'.$objp->mois.'</td>';
print '<td align="right">'.price($objp->value).'</td>';
print "</tr>\n";
$i++;
}
}
$db->free();
}
else
{
dolibarr_print_error($db);
}
/* mensuel
$sql = "SELECT sum(t.value) as value";
$sql .= " FROM ".OSC_DB_NAME.".orders_total as t";
$sql .= " JOIN ".OSC_DB_NAME.".orders as o ON o.orders_id = t.orders_id";
$sql .= " WHERE t.class = 'ot_subtotal' AND YEAR(o.date_purchased) = YEAR(now()) AND MONTH(o.date_purchased) = MONTH(now())";
if ( $db->query($sql) )
{
$num = $db->num_rows();
$var=True;
if ($num > 0)
{
$objp = $db->fetch_object();
$var=!$var;
print "<tr $bc[$var]>";
print '<td>CA du mois en cours </td>';
print '<td align="right">'.price($objp->value).'</td></tr>';
$i++;
}
$db->free();
}
else
{
dolibarr_print_error($db);
}
*/
print "</table>";
print '</td><td valign="top" width="60%">';
print_titre($langs->trans("Commandes"));
/*
* 5 dernières commandes reçues
select o.orders_id, o.customers_id, o.customers_name, o.date_purchased, o.payement_method, o.status, t.value
from orders_total as t
join orders as o on o.orders_id = t.orders_id where t.class = 'ot_subtotal' order by o.date_purchased desc
*/
$sql = "SELECT o.orders_id, o.customers_name, o.date_purchased, t.value, o.payment_method";
$sql .= " FROM ".OSC_DB_NAME.".orders_total as t JOIN ".OSC_DB_NAME.".orders as o on o.orders_id = t.orders_id ";
$sql .= " WHERE t.class = 'ot_subtotal' ORDER BY o.date_purchased desc";
if ( $db->query($sql) )
{
$langs->load("orders");
$num = $db->num_rows();
if ($num > 0)
{
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="4">'.$langs->trans("Dernières commandes").'</td></tr>';
$num = min($num,OSC_MAXNBCOM);
while ($i < $num)
{
$obj = $db->fetch_object();
print "<tr><td>$obj->orders_id</td><td>$obj->customers_name</td><td>".price($obj->value)."</td><td>$obj->payment_method</td></tr>";
$i++;
}
print "</table><br>";
}
}
else
{
dolibarr_print_error($db);
}
/*
* 5 dernières commandes en attente
*/
$sql = "SELECT o.orders_id, o.customers_name, o.date_purchased, t.value, o.payment_method";
$sql .= " FROM ".OSC_DB_NAME.".orders_total as t JOIN ".OSC_DB_NAME.".orders as o on o.orders_id = t.orders_id ";
$sql .= " WHERE t.class = 'ot_subtotal' and o.orders_status = 5 order by o.date_purchased desc";
if ( $db->query($sql) )
{
$langs->load("orders");
$num = $db->num_rows();
if ($num > 0)
{
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="4">'.$langs->trans("En Attente").'</td></tr>';
$num = min($num,OSC_MAXNBCOM);
while ($i < $num)
{
$obj = $db->fetch_object();
print "<tr><td>$obj->orders_id</td><td>$obj->customers_name</td><td>".price($obj->value)."</td><td>$obj->payment_method</td></tr>";
$i++;
}
print "</table><br>";
}
}
else
{
dolibarr_print_error($db);
}
/*
* Commandes à traiter
*/
$sql = "SELECT o.orders_id, o.customers_name, o.date_purchased, t.value, o.payment_method";
$sql .= " FROM ".OSC_DB_NAME.".orders_total as t JOIN ".OSC_DB_NAME.".orders as o on o.orders_id = t.orders_id ";
$sql .= " WHERE t.class = 'ot_subtotal' and o.orders_status = 2 order by o.date_purchased desc";
if ( $db->query($sql) )
{
$langs->load("orders");
$num = $db->num_rows();
if ($num > 0)
{
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="4">'.$langs->trans("Traitement en cours").'</td></tr>';
$num = min($num,OSC_MAXNBCOM);
while ($i < $num)
{
$obj = $db->fetch_object();
print "<tr><td>$obj->orders_id</td><td>$obj->customers_name</td><td>".price($obj->value)."</td><td>$obj->payment_method</td></tr>";
$i++;
}
print "</table><br>";
}
}
else
{
dolibarr_print_error($db);
}
print '</td></tr><tr>';
/*
* Derniers clients qui ont commandé
*/
$sql = "SELECT o.orders_id, o.customers_name, o.delivery_country, o.date_purchased, t.value, s.orders_status_name as statut";
$sql .= " FROM ".OSC_DB_NAME.".orders_total as t JOIN ".OSC_DB_NAME.".orders as o on o.orders_id = t.orders_id ";
$sql .= " JOIN ".OSC_DB_NAME.".orders_status as s on o.orders_status = s.orders_status_id and s.language_id = 1";
$sql .= " WHERE t.class = 'ot_subtotal' order by o.date_purchased desc";
if ( $db->query($sql) )
{
$langs->load("orders");
$num = $db->num_rows();
if ($num > 0)
{
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="7">'.$langs->trans("Derniers clients").'</td></tr>';
$num = min($num,OSC_MAXNBCOM);
while ($i < $num)
{
$obj = $db->fetch_object();
print "<tr><td>$obj->date_purchased</td><td>$obj->customers_name</td><td>$obj->delivery_country</td><td>".price($obj->value)."</td><td>$obj->payment_method</td><td>$obj->orders_id</td><td>$obj->statut</td></tr>";
$i++;
}
print "</table><br>";
}
}
else
{
dolibarr_print_error($db);
}
print '</tr></table>';
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -20,11 +20,14 @@
*
*/
require("../main.inc.php");
require("./livre/livre.class.php");
require("./editeur/editeur.class.php");
require("./auteur/auteur.class.php");
//require("./livre/livre.class.php");
//require("./editeur/editeur.class.php");
//require("./auteur/auteur.class.php");
require("../product/categorie/categorie.class.php");
//affichages dans la page d'accueil
define("OSC_MAXNBCOM", 5);
function llxHeader($head = "", $urlp = "")
{
global $user, $conf;
@ -36,7 +39,7 @@ function llxHeader($head = "", $urlp = "")
top_menu($head);
$menu = new Menu();
/*
$menu->add(DOL_URL_ROOT."/boutique/livre/", "Livres");
$menu->add_submenu(DOL_URL_ROOT."/boutique/livre/fiche.php?&action=create","Nouvel ouvrage");
@ -50,7 +53,15 @@ function llxHeader($head = "", $urlp = "")
$menu->add(DOL_URL_ROOT."/boutique/editeur/", "Editeurs");
$menu->add_submenu(DOL_URL_ROOT."/boutique/editeur/fiche.php?&action=create","Nouvel éditeur");
*/
$menu->add(DOL_URL_ROOT."/boutique/produits/osc-liste.php", "Produits");
$menu->add(DOL_URL_ROOT."/boutique/commande/", "Commandes");
$menu->add(DOL_URL_ROOT."/boutique/client/", "Clients");
/*
$menu->add(DOL_URL_ROOT."/product/categorie/", "Catégories");
$menu->add(DOL_URL_ROOT."/product/promotion/", "Promotions");
@ -59,7 +70,7 @@ function llxHeader($head = "", $urlp = "")
{
$menu->add(DOL_URL_ROOT."/postnuke/articles/", "Editorial");
}
*/
left_menu($menu->liste);
}
?>

View File

@ -0,0 +1,83 @@
<?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");
$langs->load("companies");
llxHeader();
if ($sortfield == "") {
$sortfield="lower(c.customers_lastname)";
}
if ($sortorder == "") {
$sortorder="ASC";
}
if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
print_barre_liste("Liste des clients", $page, "index.php");
$sql = "SELECT c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, c.customers_newsletter";
$sql .= " FROM ".DB_NAME_OSC.".customers as c";
$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("Firstname"),"index.php", "c.customers_firstname");
print_liste_field_titre($langs->trans("Lastname"),"index.php", "c.customers_lastname");
print '<td>'.$langs->trans("EMail").'</td><td align="center">'.$langs->trans("Newsletter").'</td>';
print "</tr>\n";
$var=True;
while ($i < $num)
{
$objp = $db->fetch_object();
$var=!$var;
print "<tr $bc[$var]>";
print '<td><a href="fiche.php?id='.$objp->customers_id.'">'.$objp->customers_firstname."</a></td>\n";
print '<td><a href="fiche.php?id='.$objp->customers_id.'">'.$objp->customers_lastname."</a></td>\n";
print "<td>$objp->customers_email_address</td>\n";
print "<td align=\"center\">$objp->customers_newsletter</td>\n";
print "</tr>\n";
$i++;
}
print "</table>";
$db->free();
}
else
{
dolibarr_print_error($db);
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,91 @@
<?php
/* Copyright (C) 2001-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();
if ($sortfield == "") {
$sortfield="lower(p.label),p.price";
}
if ($sortorder == "") {
$sortorder="ASC";
}
if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
print_barre_liste("Liste des produits oscommerce", $page, "osc-liste.php");
$sql = "SELECT p.products_id, p.products_model, p.products_quantity, p.products_status, d.products_name, m.manufacturers_name, m.manufacturers_id";
$sql .= " FROM ".OSC_DB_NAME.".products as p, ".OSC_DB_NAME.".products_description as d, ".OSC_DB_NAME.".manufacturers as m";
$sql .= " WHERE p.products_id = d.products_id AND d.language_id =" . OSC_LANGUAGE_ID;
$sql .= " AND p.manufacturers_id=m.manufacturers_id";
if ($reqstock=='epuise')
{
$sql .= " AND p.products_quantity <= 0";
}
//$sql .= " ORDER BY $sortfield $sortorder ";
$sql .= $db->plimit( $limit ,$offset);
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print '<TR class="liste_titre">';
print "<td>id</td>";
print "<td>Ref</td>";
print "<td>Titre</td>";
print "<td>Groupe</td>";
print '<td align="center">Stock</td>';
print '<TD align="center">Status</TD>';
print "</TR>\n";
if ( $db->query($sql) ) {
$num = $db->num_rows();
$i = 0;
$var=True;
while ($i < $num) {
$objp = $db->fetch_object( $i);
$var=!$var;
print "<TR $bc[$var]>";
print "<TD>$objp->products_id</TD>\n";
print "<TD>$objp->products_model</TD>\n";
print "<TD>$objp->products_name</TD>\n";
print "<TD>$objp->manufacturers_name</TD>\n";
print '<TD align="center">'.$objp->products_quantity."</TD>\n";
print '<TD align="center">'.$objp->products_status."</TD>\n";
print "</TR>\n";
$i++;
}
$db->free();
}
print "</TABLE>";
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,53 @@
<?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("../../product/categorie/categorie.class.php");
function llxHeader($head = "", $urlp = "")
{
global $user, $conf;
/*
*
*
*/
top_menu($head);
$menu = new Menu();
$menu->add(DOL_URL_ROOT."/boutique/produits/osc-liste.php", "Produits");
$menu->add(DOL_URL_ROOT."/boutique/client/", "Clients");
$menu->add(DOL_URL_ROOT."/boutique/commande/", "Commandes");
/* $menu->add(DOL_URL_ROOT."/product/categorie/", "Catégories");
$menu->add(DOL_URL_ROOT."/product/promotion/", "Promotions");
if (defined("MAIN_MODULE_POSTNUKE") && MAIN_MODULE_POSTNUKE)
{
$menu->add(DOL_URL_ROOT."/postnuke/articles/", "Editorial");
}
*/
left_menu($menu->liste);
}
?>

View File

@ -272,6 +272,23 @@ class MenuTop {
print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/energie/"'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Energy").'</a></td>';
}
// Entrée boutique
if ($conf->boutique->enabled)
{
$langs->load("shop");
$class="";
if (ereg("^".DOL_URL_ROOT."\/energie\/",$_SERVER["PHP_SELF"]))
{
$class='class="tmenu" id="sel"';
}
else
{
$class = 'class="tmenu"';
}
print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/boutique/"'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Shop").'</a></td>';
}
// Entrée webcal
if ($conf->webcal->enabled)

View File

@ -230,6 +230,24 @@ class MenuTop {
print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/index.php?mainmenu=tools&leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Tools").'</a></td>';
}
// Projets
if ($conf->boutique->enabled)
{
$langs->load("shop");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "shop")
{
$class='class="tmenu" id="sel"';
}
else
{
$class = 'class="tmenu"';
}
print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/boutique/index.php?mainmenu=shop&leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Shop").'</a></td>';
}
// Webcal
if ($conf->webcal->enabled)
{

View File

@ -0,0 +1,7 @@
# Dolibarr language file - en_US - shop
Shop=Shop
ShopWeb=Web Shop
LastOrders=Last orders
OnStandBy=On standby
TreatmentInProgress=Treatment in progress
LastCustomers=Last customers

View File

@ -0,0 +1,7 @@
# Dolibarr language file - fr_FR - shop
Shop=Boutique
ShopWeb=Boutique Web
LastOrders=Dernières commandes
OnStandBy=En attente
TreatmentInProgress=Traitement en cours
LastCustomers=Dernier clients

View File

@ -97,6 +97,7 @@ function llxHeader($head = "") {
if ($conf->service->enabled) { $chaine.= $langs->trans("Services"); }
$menu->add(DOL_URL_ROOT."/product/index.php", "$chaine");
/*
if ($conf->boutique->enabled)
{
if ($conf->boutique->livre->enabled)
@ -110,6 +111,7 @@ function llxHeader($head = "") {
}
}
}
*/
if ($conf->commande->enabled && $user->rights->commande->lire)
{