diff --git a/ChangeLog b/ChangeLog index 23639502135..37af36f3261 100644 --- a/ChangeLog +++ b/ChangeLog @@ -100,6 +100,7 @@ For users, new experimental module (need to set feature level of instance to exp Hydroflex 120 euros Asysteo 120 euros Fournisseur médical 120 euros +- Removed: unmaintained OScommerce module For translators: - Update language files. @@ -132,6 +133,7 @@ For developers: WARNING: Following changes may create regression for some external modules, but was necessary to make Dolibarr better: +- Deprecated module "oscommerce" were removed. - Changed the way parameters are provided to scripts sync_xxx_ldap2dolibarr.php - Some field into database were renamed from "libelle" to "label". - Table llx_c_pays were renamed into llx_c_country. diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 439a09b8266..156f34bc066 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -162,7 +162,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/asterisk %_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/bookmarks -%_datadir/dolibarr/htdocs/boutique %_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/comm diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index 945e8f4812c..176cb07975d 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -242,7 +242,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/asterisk %_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/bookmarks -%_datadir/dolibarr/htdocs/boutique %_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/comm diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index 17b46c3c143..d75c9a84dca 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -159,7 +159,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/asterisk %_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/bookmarks -%_datadir/dolibarr/htdocs/boutique %_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/comm diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index f6192c87c9b..41ea838f3fb 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -170,7 +170,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/asterisk %_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/bookmarks -%_datadir/dolibarr/htdocs/boutique %_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/comm diff --git a/htdocs/admin/osc-languages.php b/htdocs/admin/osc-languages.php deleted file mode 100644 index 804c72f2850..00000000000 --- a/htdocs/admin/osc-languages.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * 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 3 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, see . - */ - -/** - * \file htdocs/admin/osc-languages.php - * \ingroup boutique - * \brief Page d'administration/configuration du module Boutique - */ - -require '../main.inc.php'; - -$langs->load("admin"); - -if (!$user->admin) -accessforbidden(); - - -llxHeader(); - - -if (! dol_strlen(OSC_DB_NAME)) -{ - print "Non dispo"; - llxFooter(); -} - -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 langues oscommerce", $page, "osc-languages.php"); - -$sql = "SELECT l.languages_id, l.name, l.code FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."languages as l"; -$sql.= $db->plimit($limit, $offset); - -print "

"; -print ""; -print ""; -print ""; -print ""; -print "\n"; - -$resql=$db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - $var=True; - while ($i < $num) { - $objp = $db->fetch_object($resql); - $var=!$var; - print ""; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - $db->free(); -} - -print "
idNameCode
$objp->languages_id$objp->name$objp->code
"; - - -$db->close(); - -llxFooter(); diff --git a/htdocs/boutique/admin/boutique.php b/htdocs/boutique/admin/boutique.php deleted file mode 100644 index b4430edcbe1..00000000000 --- a/htdocs/boutique/admin/boutique.php +++ /dev/null @@ -1,204 +0,0 @@ - - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2006 Laurent Destailleur - * Copyright (C) 2012 Juanjo Menent - * - * 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 3 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, see . - * - */ - -/** - * \file htdocs/boutique/admin/boutique.php - * \ingroup boutique - * \brief Page d'administration/configuration du module OsCommerce - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; - -$langs->load("admin"); -$langs->load("oscommerce"); - -if (!$user->admin) accessforbidden(); - - - -/* - * Actions - */ - -if (GETPOST('save','alpha')) -{ - $db->begin(); - - $i=0; - - $i+=dolibarr_set_const($db,'OSC_DB_HOST',trim(GETPOST('oscommerce_dbhost','alpha')),'chaine',0,'',$conf->entity); - $i+=dolibarr_set_const($db,'OSC_DB_NAME',trim(GETPOST('oscommerce_dbname','alpha')),'chaine',0,'',$conf->entity); - $i+=dolibarr_set_const($db,'OSC_DB_USER',trim(GETPOST('oscommerce_dbuser','alpha')),'chaine',0,'',$conf->entity); - $i+=dolibarr_set_const($db,'OSC_DB_PASS',trim(GETPOST('oscommerce_dbpass','alpha')),'chaine',0,'',$conf->entity); - $i+=dolibarr_set_const($db,'OSC_DB_TABLE_PREFIX',trim(GETPOST('oscommerce_db_table_prefix','alpha')),'chaine',0,'',$conf->entity); - $i+=dolibarr_set_const($db,'OSC_LANGUAGE_ID',1,'chaine',0,'',$conf->entity); - - if ($i >= 4) - { - $db->commit(); - setEventMessage($langs->trans("OSCommerceSetupSaved")); - } - else - { - $db->rollback(); - header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } -} -elseif (GETPOST('test','alpha')) -{ - //$resql=$db->query("select count(*) from ".MAIN_DB_PREFIX."const"); - //print "< ".$db." - ".$db->db." - ".$resql." - ".$db->error().">
\n"; - - // Test de la connexion a la database webcalendar - $conf->oscommerce->db->type=$dolibarr_main_db_type; - $conf->oscommerce->db->host=GETPOST('oscommerce_dbhost','alpha'); - $conf->oscommerce->db->port=GETPOST('oscommerce_dbport','alpha'); - $conf->oscommerce->db->name=GETPOST('oscommerce_dbname','alpha'); - $conf->oscommerce->db->user=GETPOST('oscommerce_dbuser','alpha'); - $conf->oscommerce->db->pass=GETPOST('oscommerce_dbpass','alpha'); - - $oscommercedb=getDoliDBInstance($conf->oscommerce->db->type,$conf->oscommerce->db->host,$conf->oscommerce->db->user,$conf->oscommerce->db->pass,$conf->oscommerce->db->name,$conf->oscommerce->db->port); - - if ($oscommercedb->connected == 1 && $oscommercedb->database_selected == 1) - { - // Verifie si bonne base par requete sur une table OSCommerce - $sql ="SELECT configuration_value"; - $sql.=" FROM ".$_POST["oscommerce_db_table_prefix"]."configuration"; - $sql.=" WHERE configuration_key='STORE_NAME'"; - $resql=$oscommercedb->query($sql); - if ($resql) { - $mesg = $langs->trans("OSCommerceTestOk",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbname','alpha'),GETPOST('oscommerce_dbuser','alpha')); - setEventMessage($mesg); - } - else { - $mesg = $langs->trans("OSCommerceErrorConnectOkButWrongDatabase",'STORE_NAME',GETPOST('oscommerce_db_table_prefix','alpha')."configuration"); - setEventMessage($mesg, 'errors'); - } - - //$oscommercedb->close(); Ne pas fermer car la conn de webcal est la meme que dolibarr si parametre host/user/pass identique - } - elseif ($oscommercedb->connected == 1 && $oscommercedb->database_selected != 1) - { - $mesg = $langs->trans("OSCommerceTestKo1",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbname','alpha')); - $mesg.="
".$oscommercedb->error(); - - setEventMessage($mesg, 'errors'); - //$oscommercedb->close(); Ne pas fermer car la conn de webcal est la meme que dolibarr si parametre host/user/pass identique - } - else - { - $mesg = $langs->trans("OSCommerceTestKo2",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbuser','alpha')); - $mesg.="
".$oscommercedb->error(); - setEventMessage($mesg, 'errors'); - } - - //$resql=$db->query("select count(*) from ".MAIN_DB_PREFIX."const"); - //print "< ".$db." - ".$db->db." - ".$resql." - ".$db->error().">
\n"; -} - - - -/* - * Affichage page - */ - -llxHeader(); - -$linkback=''.$langs->trans("BackToModuleList").''; -print_fiche_titre($langs->trans("OSCommerceSetup"),$linkback,'setup'); - - - -print '
'; - -$var=true; -print '

'; -print ''; -print ""; -print ""; -print ""; -print ""; -print ""; -print ""; -$var=!$var; -print ""; -print ""; -print ""; -print ""; -print ""; -$var=!$var; -print ""; -print ""; -print ""; -print ""; -print ""; -$var=!$var; -print ""; -print ""; -print ""; -print ""; -print ""; -$var=!$var; -print ""; -print ""; -print ""; -print ""; -print ""; -$var=!$var; -print ""; -print ""; -print ""; -print ''; -print ""; -$var=!$var; -print ""; -print ""; -print ""; -print ''; -print ""; -print "
".$langs->trans("Parameter")."".$langs->trans("Value")."".$langs->trans("Examples")."
".$langs->trans("OSCommerceServer")."global->OSC_DB_HOST) . "\" size=\"30\">localhost"; -//print "
__dolibarr_main_db_host__ (".$dolibarr_main_db_host.")" -print "
".$langs->trans("OSCommerceDatabaseName")."global->OSC_DB_NAME) . "\" size=\"30\">oscommerce"; -//print "
__dolibarr_main_db_name__ (".$dolibarr_main_db_name.")"; -print "
".$langs->trans("OSCommercePrefix")."global->DB_TABLE_PREFIX) . "\" size=\"30\">osc_"; -print "
".$langs->trans("OSCommerceUser")."global->OSC_DB_USER) . "\" size=\"30\">oscommerceuser"; -//print "
__dolibarr_main_db_user__ (".$dolibarr_main_db_user.")"; -print "
".$langs->trans("Password")."global->OSC_DB_PASS) . "\" size=\"30\">'; -//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ ('.preg_replace('/./i','*',$dolibarr_main_db_pass).')'; -print ' 
".$langs->trans("PasswordRetype")."global->OSC_DB_PASS) ."\" size=\"30\">'; -//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ ('.preg_replace('/./i','*',$dolibarr_main_db_pass).')'; -print ' 
"; - - -print '
'; -print "trans("TestConnection")."\">"; -print "   "; -print "trans("Save")."\">"; -print "
"; - -print "
\n"; - -$db->close(); - -llxFooter(); diff --git a/htdocs/boutique/admin/index.html b/htdocs/boutique/admin/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/boutique/client/card.php b/htdocs/boutique/client/card.php deleted file mode 100644 index 4944911f408..00000000000 --- a/htdocs/boutique/client/card.php +++ /dev/null @@ -1,126 +0,0 @@ - - * Copyright (C) 2003-2005 Eric Seigne - * Copyright (C) 2006-2010 Laurent Destailleur - * - * 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 3 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, see . - * - */ - -/** - * \file htdocs/boutique/client/card.php - * \ingroup boutique - * \brief Page fiche client OSCommerce - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php'; -include_once DOL_DOCUMENT_ROOT.'/boutique/client/class/boutiqueclient.class.php'; - -$id=GETPOST('id', 'int'); - - -/* - * Actions - */ - -// None - - - -/* - * View - */ - -llxHeader(); - -if ($id > 0) -{ - $client = new BoutiqueClient($dbosc); - $result = $client->fetch($id); - if ( $result ) - { - print '
'.$langs->trans("CustomerCard").': '.$client->name.'

'; - - print ''; - print ""; - print ''; - print "
Nom'.$client->name.'
"; - - - /* - * Commandes - */ - $sql = "SELECT o.orders_id, o.customers_id, date_purchased, t.value as total"; - $sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t"; - $sql .= " WHERE o.customers_id = " . $client->id; - $sql .= " AND o.orders_id = t.orders_id AND t.class = 'ot_total'"; - //echo $sql; - $resql=$dbosc->query($sql); - if ($resql) - { - $num = $dbosc->num_rows($resql); - $i = 0; - print ''; - print ""; - print "\n"; - $var=True; - while ($i < $num) - { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - - print '\n"; - print "\n"; - $i++; - } - print "
Commandes
Fiche '; - - print dol_print_date($dbosc->jdate($objp->date_purchased),'dayhour')."\n"; - print $objp->total . "
"; - $dbosc->free($resql); - } - else - { - print "

ERROR 1

\n"; - dol_print_error($dbosc); - } - - } - else - { - print "

ERROR 1

\n"; - dol_print_error($dbosc); - } -} -else -{ - print "

ERROR 1

\n"; - print "Error"; -} - - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -// Pas d'action - - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/client/class/boutiqueclient.class.php b/htdocs/boutique/client/class/boutiqueclient.class.php deleted file mode 100644 index fdf393043b0..00000000000 --- a/htdocs/boutique/client/class/boutiqueclient.class.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * 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 3 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, see . - * - */ - -/** - * \file htdocs/boutique/client/class/boutiqueclient.class.php - * \brief Classe permettant de gerer des clients de la boutique online - * \author Rodolphe Quiedeville - */ - -/** - * \class BoutiqueClient - * \brief Classe permettant de gerer des clients de la boutique online - */ -class BoutiqueClient -{ - var $db ; - - var $id ; - var $nom; - - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; - } - - /** - * Fonction permettant de recuperer les informations d'un clients de la boutique - * - * @param int $id Id du client - * @return int <0 if KO, >0 if OK - */ - function fetch($id) - { - global $conf; - - $sql = "SELECT customers_id, customers_lastname, customers_firstname FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."customers WHERE customers_id = ".$id; - - $resql = $this->db->query($sql); - if ( $resql ) - { - $result = $this->db->fetch_array($resql); - - $this->id = $result["customers_id"]; - $this->name = $result["customers_firstname"] . " " . $result["customers_lastname"]; - - $this->db->free($resql); - return 1; - } - else - { - print $this->db->error(); - return -1; - } - } - -} diff --git a/htdocs/boutique/client/class/index.html b/htdocs/boutique/client/class/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/boutique/client/index.php b/htdocs/boutique/client/index.php deleted file mode 100644 index dae59eb50cb..00000000000 --- a/htdocs/boutique/client/index.php +++ /dev/null @@ -1,91 +0,0 @@ - - * Copyright (C) 2004-2006 Laurent Destailleur - * - * 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 3 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, see . - * - */ - -/** - * \file htdocs/boutique/client/index.php - * \ingroup boutique - * \brief Page gestion client OSCommerce - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php'; - -$langs->load("companies"); - - -/* - * View - */ - -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, $_SERVER["PHP_SELF"]); - -$sql = "SELECT c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, c.customers_newsletter"; -$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."customers as c"; -$sql .= " ORDER BY $sortfield $sortorder "; -$sql .= $dbosc->plimit($limit,$offset); - -$resql=$dbosc->query($sql); -if ($resql) -{ - $num = $dbosc->num_rows($resql); - $i = 0; - print ""; - print ""; - print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"], "c.customers_firstname"); - print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"], "c.customers_lastname"); - print ''; - print "\n"; - $var=True; - while ($i < $num) - { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - print '\n"; - print '\n"; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - print "
'.$langs->trans("EMail").''.$langs->trans("Newsletter").'
'.$objp->customers_firstname."'.$objp->customers_lastname."$objp->customers_email_address$objp->customers_newsletter
"; - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/commande/ca.php b/htdocs/boutique/commande/ca.php deleted file mode 100644 index 5030e5ac559..00000000000 --- a/htdocs/boutique/commande/ca.php +++ /dev/null @@ -1,115 +0,0 @@ - - * Copyright (C) 2004-2006 Laurent Destailleur - * - * 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 3 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, see . - * - */ - -/** - * \file htdocs/boutique/commande/ca.php - * \ingroup boutique - * \brief Page ca commandes du module OsCommerce - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php'; - - -/* - * View - */ - -llxHeader(); - -if ($sortfield == "") -{ - $sortfield="date_purchased"; -} -if ($sortorder == "") -{ - $sortorder="DESC"; -} - -if ($page == -1) { $page = 0 ; } -$limit = $conf->liste_limit; -$offset = $limit * $page ; - -print_barre_liste("Liste des commandes", $page, "ca.php"); - -print ''; -print ''; -print ''; - -$sql = "SELECT sum(t.value) as value"; -$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t"; -$sql .= " WHERE t.class = 'ot_subtotal'"; - -$resql=$dbosc->query($sql); -if ($resql) -{ - $num = $dbosc->num_rows($resql); - - $var=True; - if ($num > 0) - { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - print ''; - print ''; - - print "\n"; - $i++; - } - - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} - -$sql = "SELECT sum(t.value) as value"; -$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t"; -$sql .= " WHERE t.class = 'ot_shipping'"; -$resql=$dbosc->query($sql); -if ($resql) -{ - $num = $dbosc->num_rows($resql); - - $var=True; - if ($num > 0) - { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - print ''; - print ''; - $i++; - } - - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} - - -print "
'.$langs->trans("Description").''.$langs->trans("Lastname").'
Somme des commandes'.price($objp->value).'
Somme des frais de port'.price($objp->value).'
"; - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/commande/card.php b/htdocs/boutique/commande/card.php deleted file mode 100644 index f6719bb40bb..00000000000 --- a/htdocs/boutique/commande/card.php +++ /dev/null @@ -1,155 +0,0 @@ - - * Copyright (C) 2003-2005 Eric Seigne - * Copyright (C) 2004-2006 Laurent Destailleur - * - * 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 3 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, see . - * - */ - -/** - * \file htdocs/boutique/commande/card.php - * \ingroup boutique - * \brief Page fiche commande OSCommerce - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php'; -include_once DOL_DOCUMENT_ROOT.'/boutique/commande/class/boutiquecommande.class.php'; - -$langs->load("products"); - -$id=GETPOST('id', 'int'); - -/* - * View - */ - -llxHeader(); - - -if ($id > 0) -{ - $commande = new BoutiqueCommande($db); - $result = $commande->fetch($id); - if ($result) - { - print '
'.$langs->trans("OrderCard").': '.$commande->id.'

'; - - print ''; - print ''; - print ''; - - print ''; - - print ""; - - print ""; - print ""; - print ""; - - print "
Date'.$commande->date.'
Client'.$commande->client_name.'
Paiement'.$commande->payment_method.'
".$langs->trans("Address")."".$langs->trans("Delivery")."".$langs->trans("Invoice")."
 ".$commande->delivery_adr->name."
".$commande->delivery_adr->street."
".$commande->delivery_adr->zip."
".$commande->delivery_adr->city."
".$commande->delivery_adr->country."
".$commande->billing_adr->name."
".$commande->billing_adr->street."
".$commande->billing_adr->zip."
".$commande->billing_adr->city."
".$commande->billing_adr->country."
"; - - print "
"; - - /* - * Produits - * - */ - $sql = "SELECT orders_id, products_id, products_model, products_name, products_price, final_price, products_quantity"; - $sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_products"; - $sql .= " WHERE orders_id = " . $commande->id; - //$commande->id; - // echo $sql; - $resql=$dbosc->query($sql); - if ($resql) - { - $num = $dbosc->num_rows($resql); - $i = 0; - print ''; - print ''; - print ''; - print "\n"; - $var=True; - while ($i < $num) - { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - print '"; - - print '\n"; - print "\n"; - print "\n"; - - print "\n"; - $i++; - } - print "
'.$langs->trans("Products").''.$langs->trans("Number").''.$langs->trans("Price").'Prix final
'; - print 'Fiche livre'; - - print ''.$objp->products_name.''; - print "$objp->products_quantityrowid\">".price($objp->products_price)."rowid\">".price($objp->final_price)."
"; - $dbosc->free(); - } - else - { - print $dbosc->error(); - } - - /* - * - * - */ - print "
"; - - print ''; - print ""; - print ''; - print ''; - print "
Frais d\'expeditions'.price($commande->total_ot_shipping).' EUR
'.$langs->trans("Lastname").''.price($commande->total_ot_total).' EUR
"; - - - - } - else - { - print "Fetch failed"; - } -} -else -{ - print "Error"; -} - - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print '
-----

'; - - - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/commande/class/boutiquecommande.class.php b/htdocs/boutique/commande/class/boutiquecommande.class.php deleted file mode 100644 index 0a3383a33a3..00000000000 --- a/htdocs/boutique/commande/class/boutiquecommande.class.php +++ /dev/null @@ -1,138 +0,0 @@ - - * Copyright (C) 2008 Laurent Destailleur - * - * 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 3 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, see . - */ - -/** - * \file htdocs/boutique/commande/class/boutiquecommande.class.php - * \ingroup osc - * \brief Fichier de la classe des commandes de la boutique online - */ - -require_once DOL_DOCUMENT_ROOT .'/societe/class/address.class.php'; -include_once DOL_DOCUMENT_ROOT.'/boutique/commande/class/boutiquecommande.class.php'; - - -/** - * Class to manage orders OSC - */ -class BoutiqueCommande -{ - var $db; - - var $id; - var $nom; - - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; - - $this->billing_adr = new Address(); - $this->delivry_adr = new Address(); - - $this->total_ot_subtotal = 0; - $this->total_ot_shipping = 0; - } - - /** - * Get object and lines from database - * - * @param int $id id of object to load - * @param string $ref Ref of order - * @return int >0 if OK, <0 if KO - */ - function fetch($id,$ref='') - { - global $conf; - - $sql = "SELECT orders_id, customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_zipcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_zipcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, last_modified, date_purchased, orders_status, orders_date_finished, currency, currency_value"; - $sql.= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders"; - $sql.= " WHERE orders_id = ".$id; - - $result = $this->db->query($sql); - if ( $result ) - { - $array = $this->db->fetch_array($result); - - $this->id = $array["orders_id"]; - $this->client_id = $array["customers_id"]; - $this->client_name = $array["customers_name"]; - - $this->payment_method = $array["payment_method"]; - - $this->date = $this->db->jdate($array["date_purchased"]); - - $this->delivery_adr->name = $array["delivery_name"]; - $this->delivery_adr->street = $array["delivery_street_address"]; - $this->delivery_adr->zip = $array["delivery_zipcode"]; - $this->delivery_adr->city = $array["delivery_city"]; - $this->delivery_adr->country = $array["delivery_country"]; - - $this->billing_adr->name = $array["billing_name"]; - $this->billing_adr->street = $array["billing_street_address"]; - $this->billing_adr->zip = $array["billing_zipcode"]; - $this->billing_adr->city = $array["billing_city"]; - $this->billing_adr->country = $array["billing_country"]; - - $this->db->free(); - - /* - * Totaux - */ - $sql = "SELECT value, class "; - $sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total WHERE orders_id = $id"; - - $result = $this->db->query($sql); - if ( $result ) - { - $num = $this->db->num_rows($result); - - $i=0; - while ($i < $num) - { - $array = $this->db->fetch_array($result); - if ($array["class"] == 'ot_total') - { - $this->total_ot_total = $array["value"]; - } - if ($array["class"] == 'ot_shipping') - { - $this->total_ot_shipping = $array["value"]; - } - $i++; - } - } - else - { - print $this->db->error(); - } - - } - else - { - print $this->db->error(); - } - - return $result; - } - -} diff --git a/htdocs/boutique/commande/class/index.html b/htdocs/boutique/commande/class/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/boutique/commande/index.php b/htdocs/boutique/commande/index.php deleted file mode 100644 index 0ce6b7b3655..00000000000 --- a/htdocs/boutique/commande/index.php +++ /dev/null @@ -1,92 +0,0 @@ - - * Copyright (C) 2006 Laurent Destailleur - * - * 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 3 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, see . - * - */ - -/** - * \file htdocs/boutique/commande/index.php - * \ingroup boutique - * \brief Page gestion commandes OSCommerce - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php'; - - - -llxHeader(); - -if ($sortfield == "") -{ - $sortfield="date_purchased"; -} -if ($sortorder == "") -{ - $sortorder="DESC"; -} - -if ($page == -1) { $page = 0 ; } -$limit = $conf->liste_limit; -$offset = $limit * $page ; - -print_barre_liste("Liste des commandes", $page, "commande.php"); - - $sql = "SELECT o.orders_id, customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, last_modified, date_purchased, orders_status, orders_date_finished, currency, currency_value, t.value"; - -$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t"; -$sql .= " WHERE o.orders_id = t.orders_id AND t.class = 'ot_total'"; -$sql .= " ORDER BY $sortfield $sortorder "; -$sql .= $dbosc->plimit($limit,$offset); - -$resql=$dbosc->query($sql); -if ($resql) -{ - $num = $dbosc->num_rows($resql); - $i = 0; - print ""; - print ""; - print ""; - print ""; - print_liste_field_titre("Client","commande.php", "customers_name"); - print ''; - print "\n"; - $var=True; - while ($i < $num) - { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - - print ''; - print '\n"; - print ''; - print "\n"; - $i++; - } - print "
".$langs->trans("Ref")."".$langs->trans("Date")."'.$langs->trans("Total").'
Fiche '; - print $objp->orders_id .""; - print dol_print_date($dbosc->jdate($objp->date_purchased),'dayhour').''.$objp->customers_name."'.price($objp->value).'
"; - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/critiques/bestproduct.php b/htdocs/boutique/critiques/bestproduct.php deleted file mode 100644 index dd3cda24d96..00000000000 --- a/htdocs/boutique/critiques/bestproduct.php +++ /dev/null @@ -1,97 +0,0 @@ - - * Copyright (C) 2003 Eric Seigne - * Copyright (C) 2006 Laurent Destailleur - * - * 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 3 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, see . - * - */ - -/** - * \file htdocs/boutique/critiques/bestproduct.php - * \ingroup boutique - * \brief Page affichage meilleures critiques OS Commerce - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php'; - - -/* - * View - */ - -llxHeader(); - -if ($sortfield == "") { - $sortfield="rat"; -} -if ($sortorder == "") { - $sortorder="DESC"; -} - - -if ($page == -1) { $page = 0 ; } -$limit = $conf->liste_limit; -$offset = $limit * $page ; - - -print_barre_liste("Liste des produits classes par critiques", $page, "bestproduct.php"); - -$sql = "SELECT sum(r.reviews_rating)/count(r.reviews_rating) as rat, r.products_id, p.products_model, p.products_quantity, p.products_status"; -$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."reviews as r,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products as p "; -$sql .= " WHERE r.products_id = p.products_id"; -$sql .= " GROUP BY r.products_id, p.products_model, p.products_quantity, p.products_status"; -$sql .= " ORDER BY $sortfield $sortorder "; -$sql .= $dbosc->plimit($limit,$offset); - -print "

"; -print "'; -print ''; -print "\n"; - - -$resql=$dbosc->query($sql); -if ($resql) -{ - $num = $dbosc->num_rows($resql); - $i = 0; - - $var=True; - while ($i < $num) { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - print ''; - print '\n"; - print '\n"; - print '\n"; - print "\n"; - $i++; - } - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} - -print "
".$langs->trans("Ref"); -print 'Indice critiquesQuantite'; -print 'Status
'.$objp->products_model.''.$objp->rat."'.$objp->products_quantity."'.$objp->products_status."
"; - - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/critiques/card.php b/htdocs/boutique/critiques/card.php deleted file mode 100644 index 1c75faebbee..00000000000 --- a/htdocs/boutique/critiques/card.php +++ /dev/null @@ -1,82 +0,0 @@ - - * Copyright (C) 2006 Laurent Destailleur - * - * 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 3 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, see . - * - */ - -/** - * \file htdocs/boutique/critiques/card.php - * \ingroup boutique - * \brief Page fiche critique OS Commerce - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php'; - -$id=$_GET["id"]; - - - -llxHeader(); - -if ($id) -{ - - $critique = new Critique($dbosc); - $result = $critique->fetch($id); - - if ( $result ) - { - - print '

Fiche Critique

'; - - print ''; - print ""; - print ''; - - print ''; - print "
Produit'.$critique->product_name.'
Texte'.nl2br($critique->text).'
"; - - - - } - else - { - print "Fetch failed"; - } - -} - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print '
-----

'; - - - -$dbosc->close(); - -llxFooter(); - diff --git a/htdocs/boutique/critiques/class/critique.class.php b/htdocs/boutique/critiques/class/critique.class.php deleted file mode 100644 index cd3a72088ad..00000000000 --- a/htdocs/boutique/critiques/class/critique.class.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * 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 3 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, see . - */ - -/** - * \file htdocs/boutique/critiques/class/critique.class.php - * \ingroup osc - * \brief Fichier de la classe des critiques OSCommerce - */ - - -/** - * Classe permettant la gestion des critiques OSCommerce - */ -class Critique -{ - var $db; - - var $id; - var $nom; - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; - } - - /** - * Load instance - * - * @param int $id Id to load - * @return int <0 if KO, >0 if OK - */ - function fetch ($id) - { - global $conf; - - $sql = "SELECT r.reviews_id, r.reviews_rating, d.reviews_text, p.products_name"; - - $sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."reviews as r, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."reviews_description as d"; - $sql .= " ,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description as p"; - - $sql .= " WHERE r.reviews_id = d.reviews_id AND r.products_id=p.products_id"; - $sql .= " AND p.language_id = ".$conf->global->OSC_LANGUAGE_ID. " AND d.languages_id=".$conf->global->OSC_LANGUAGE_ID; - $sql .= " AND r.reviews_id=$id"; - - $result = $this->db->query($sql); - - if ( $result ) - { - $result = $this->db->fetch_array($result); - - $this->id = $result["reviews_id"]; - $this->product_name = stripslashes($result["products_name"]); - $this->text = stripslashes($result["reviews_text"]); - - $this->db->free($result); - } - else - { - print $this->db->lasterror(); - } - - return $result; - } - -} diff --git a/htdocs/boutique/critiques/class/index.html b/htdocs/boutique/critiques/class/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/boutique/critiques/index.php b/htdocs/boutique/critiques/index.php deleted file mode 100644 index 35e536ed66e..00000000000 --- a/htdocs/boutique/critiques/index.php +++ /dev/null @@ -1,92 +0,0 @@ - - * Copyright (C) 2006 Laurent Destailleur - * - * 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 3 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, see . - * - */ - -/** - * \file htdocs/boutique/critiques/index.php - * \ingroup boutique - * \brief Page gestion critiques OSCommerce - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php'; - - -/* - * View - */ - -llxHeader(); - -if ($sortfield == "") { - $sortfield="date_added"; -} -if ($sortorder == "") { - $sortorder="DESC"; -} - - -if ($page == -1) { $page = 0 ; } -$limit = $conf->liste_limit; -$offset = $limit * $page ; - -print_barre_liste("Critiques", $page, "index.php"); - -$sql = "SELECT r.reviews_id, r.reviews_rating, d.reviews_text, p.products_name FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."reviews as r, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."reviews_description as d, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description as p"; -$sql .= " WHERE r.reviews_id = d.reviews_id AND r.products_id=p.products_id"; -$sql .= " AND p.language_id = ".$conf->global->OSC_LANGUAGE_ID. " AND d.languages_id=".$conf->global->OSC_LANGUAGE_ID; -$sql .= " ORDER BY $sortfield $sortorder "; -$sql .= $dbosc->plimit($limit,$offset); - -print "

"; -print ''; -print ""; -print ""; -print ""; -print ""; -print "\n"; - -$resql=$dbosc->query($sql); -if ($resql) { - $num = $dbosc->num_rows($resql); - $i = 0; - - $var=True; - while ($i < $num) { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - print "\n"; - print '\n"; - print "\n"; - print "\n"; - $i++; - } - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} - -print "
ProduitCritiqueNote
".substr($objp->products_name, 0, 30)."'.substr($objp->reviews_text, 0, 40)." ...$objp->reviews_rating
"; - - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/index.php b/htdocs/boutique/index.php deleted file mode 100644 index 28cd6ec397a..00000000000 --- a/htdocs/boutique/index.php +++ /dev/null @@ -1,245 +0,0 @@ - - * Copyright (C) 2004-2007 Laurent Destailleur - * - * 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 3 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, see . - */ - -/** - * \file htdocs/boutique/index.php - * \ingroup boutique - * \brief Main page of shop zone - */ - -require '../main.inc.php'; - -$langs->load("shop"); -$langs->load("orders"); - -require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php'; - -llxHeader("",$langs->trans("OSCommerceShop"),""); - -print_fiche_titre($langs->trans("OSCommerceShop")); - -print ''; - -print ''; -/* - * Last customers who ordered - */ -$sql = "SELECT o.orders_id, o.customers_name, o.delivery_country, o.date_purchased, t.value, s.orders_status_name as statut"; -$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id "; -$sql .= " JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."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"; - -$resql=$dbosc->query($sql); -if ($resql) -{ - $langs->load("orders"); - $num = $dbosc->num_rows($resql); - if ($num > 0) - { - $i = 0; - print '
'; - - -/* - * Turnover - */ - -print_titre($langs->trans('SalesTurnover')); - -print ''; -print ''; -print ''; - -$now=dol_now(); - -$sql = "SELECT SUM(t.value) as value, MONTH(o.date_purchased) as month"; -$sql.= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t"; -$sql.= " JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o ON o.orders_id = t.orders_id"; -//$sql.= " WHERE t.class = 'ot_subtotal' AND YEAR(o.date_purchased) = YEAR(".$dbosc->idate($now).")"; -$sql.= " WHERE t.class = 'ot_subtotal' AND YEAR(o.date_purchased) = YEAR('".$db->idate($now)."')"; -$sql.= " GROUP BY month"; -$sql.= " ORDER BY month"; -//print $sql;exit; - -$result=$dbosc->query($sql); -if ($result) -{ - $num = $dbosc->num_rows($result); - - $var=True; - $i=0; - if ($num > 0) - { - while ($i < $num) - { - $objp = $dbosc->fetch_object($result); - $var=!$var; - print ""; - print ''; - print ''; - - print "\n"; - $i++; - } - } - - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} - - -print "
'.$langs->trans("Month").''.$langs->trans("Total").'
'.$objp->mois.''.price($objp->value).'
"; -print '
'; -print_titre($langs->trans("Orders")); - -/* - * Last 5 successful commands - 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 ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id "; -$sql .= " WHERE t.class = 'ot_subtotal' ORDER BY o.date_purchased desc"; - -$resql=$dbosc->query($sql); -if ($resql) -{ - $langs->load("orders"); - $num = $dbosc->num_rows($resql); - if ($num > 0) - { - $i = 0; - print ''; - print ''; - print ''; - - $num = min($num,OSC_MAXNBCOM); - while ($i < $num) - { - - $obj = $dbosc->fetch_object($resql); - print ""; - $i++; - } - print "
'.$langs->trans("LastOrders").'
".$obj->orders_id."".$obj->customers_name."".price($obj->value)."".$obj->payment_method."

"; - } -} -else -{ - dol_print_error($dbosc); -} - -/* - * Last 5 orders on hold - */ -$sql = "SELECT o.orders_id, o.customers_name, o.date_purchased, t.value, o.payment_method"; -$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."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"; - -$resql=$dbosc->query($sql); -if ($resql) -{ - $langs->load("orders"); - $num = $dbosc->num_rows($resql); - if ($num > 0) - { - $i = 0; - print ''; - print ''; - print ''; - - $num = min($num,OSC_MAXNBCOM); - while ($i < $num) - { - - $obj = $dbosc->fetch_object($resql); - print ""; - $i++; - } - print "
'.$langs->trans("En Attente").'
$obj->orders_id$obj->customers_name".price($obj->value)."$obj->payment_method

"; - } -} -else -{ - dol_print_error($dbosc); -} - -/* - * Commands to treat - */ -$sql = "SELECT o.orders_id, o.customers_name, o.date_purchased, t.value, o.payment_method"; -$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."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"; - -$resql=$dbosc->query($sql); -if ($resql) -{ - $langs->load("orders"); - $num = $dbosc->num_rows($resql); - if ($num > 0) - { - $i = 0; - print ''; - print ''; - print ''; - - $num = min($num,OSC_MAXNBCOM); - while ($i < $num) - { - - $obj = $dbosc->fetch_object($resql); - print ""; - $i++; - } - print "
'.$langs->trans("TreatmentInProgress").'
$obj->orders_id$obj->customers_name".price($obj->value)."$obj->payment_method

"; - } -} -else -{ - dol_print_error($dbosc); -} - - -print '
'; - print ''; - print ''; - - $num = min($num,OSC_MAXNBCOM); - while ($i < $num) - { - $obj = $dbosc->fetch_object($resql); - print ""; - $i++; - } - print "
'.$langs->trans("Derniers clients").'
$obj->date_purchased$obj->customers_name$obj->delivery_country".price($obj->value)."$obj->payment_method$obj->orders_id$obj->statut

"; - } -} -else -{ - dol_print_error($dbosc); -} -print ''; - - -llxFooter(); - -$dbosc->close(); diff --git a/htdocs/boutique/notification/index.php b/htdocs/boutique/notification/index.php deleted file mode 100644 index 6799af10708..00000000000 --- a/htdocs/boutique/notification/index.php +++ /dev/null @@ -1,89 +0,0 @@ - - * Copyright (C) 2003 Eric Seigne - * Copyright (C) 2004-2006 Laurent Destailleur - * - * 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 3 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, see . - * - */ - -/** - * \file htdocs/boutique/notification/index.php - * \ingroup boutique - * \brief Page gestion notification OS Commerce - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php'; - -$langs->load("products"); - - - -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 notifications", $page, "index.php"); - -$sql = "SELECT c.customers_id, c.customers_lastname, c.customers_firstname, p.products_name, p.products_id"; -$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_notifications as n,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description as p"; -$sql .= ",".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."customers as c"; -$sql .= " WHERE n.customers_id = c.customers_id AND p.products_id=n.products_id"; -$sql .= " AND p.language_id = ".$conf->global->OSC_LANGUAGE_ID; -$sql .= " ORDER BY $sortfield $sortorder "; -$sql .= $dbosc->plimit($limit,$offset); - -$resql=$dbosc->query($sql); -if ($resql) -{ - $num = $dbosc->num_rows($resql); - $i = 0; - print ""; - print ""; - print_liste_field_titre("Client",$_SERVER["PHP_SELF"], "c.customers_lastname"); - print ''; - print "\n"; - $var=True; - while ($i < $num) - { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - print "\n"; - print '"; - print "\n"; - $i++; - } - print "
'.$langs->trans("Product").'
rowid\">$objp->customers_firstname $objp->customers_lastname'.$objp->products_name."
"; - $dbosc->free($resql); -} -else -{ - dol_print_error($dbosc); -} - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/notification/produits.php b/htdocs/boutique/notification/produits.php deleted file mode 100644 index ad04d7d61b0..00000000000 --- a/htdocs/boutique/notification/produits.php +++ /dev/null @@ -1,95 +0,0 @@ - - * Copyright (C) 2003 Eric Seigne - * Copyright (C) 2006 Laurent Destailleur - * - * 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 3 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, see . - * - */ - -/** - * \file htdocs/boutique/notification/produits.php - * \ingroup boutique - * \brief Page fiche notification produits OS Commerce - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php'; - - -/* - * View - */ - -llxHeader(); - -if ($sortfield == "") { - $sortfield="lower(p.products_name)"; -} -if ($sortorder == "") { - $sortorder="ASC"; -} - - -if ($page == -1) { $page = 0 ; } -$limit = $conf->liste_limit; -$offset = $limit * $page ; - -print_barre_liste("Liste des produits suivis", $page, "produits.php"); - -$sql = "SELECT p.products_name, p.products_id, count(p.products_id) as nb"; -$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_notifications as n,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description as p"; -$sql .= " WHERE p.products_id=n.products_id"; -$sql .= " AND p.language_id = ".$conf->global->OSC_LANGUAGE_ID; -$sql .= " GROUP BY p.products_name, p.products_id"; -$sql .= $dbosc->plimit($limit,$offset); - -$resql=$dbosc->query($sql); -if ($resql) -{ - $num = $dbosc->num_rows($resql); - $i = 0; - print "

"; - print ""; - print ''; - print ""; - print ""; - print "\n"; - $var=True; - while ($i < $num) - { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - - print '"; - print ''; - - print ''; - print ''; - - print "\n"; - $i++; - } - print "
ProduitNb.
'.$objp->products_name."'.$objp->nb.'Voir les clientsEnvoyer une news
"; - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/osc_master.inc.php b/htdocs/boutique/osc_master.inc.php deleted file mode 100644 index 057c15f30e1..00000000000 --- a/htdocs/boutique/osc_master.inc.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * 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 3 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, see . - */ - -/** - * \file htdocs/boutique/osc_master.inc.php - * \brief File of preparation of the environment Dolibarr for OSCommerce - */ - - -/* - * Creation objet $dbosc - */ -$dbosc=getDoliDBInstance($conf->db->type,$conf->global->OSC_DB_HOST,$conf->global->OSC_DB_USER,$conf->global->OSC_DB_PASS,$conf->global->OSC_DB_NAME,$conf->global->OSC_DB_PORT); - -if (! $dbosc->connected) -{ - dol_syslog($dbosc,"host=".$conf->global->OSC_DB_HOST.", user=".$conf->global->OSC_DB_USER.", databasename=".$conf->global->OSC_DB_NAME.", ".$db->error,LOG_ERR); - - llxHeader("",$langs->trans("OSCommerceShop"),""); - print '

'.$langs->trans('FailedConnectDBCheckModuleSetup').'
'; - llxFooter(); - exit; -} - diff --git a/htdocs/boutique/produits/index.php b/htdocs/boutique/produits/index.php deleted file mode 100644 index 2574b7cb7f4..00000000000 --- a/htdocs/boutique/produits/index.php +++ /dev/null @@ -1,88 +0,0 @@ - - * Copyright (C) 2004-2006 Laurent Destailleur - * - * 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 3 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, see . - * - */ - -/** - * \file htdocs/boutique/produits/index.php - * \ingroup boutique - * \brief Page gestion produits du module OsCommerce - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.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, $_SERVER["PHP_SELF"]); - -$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 .= $dbosc->plimit($limit,$offset); - -$resql=$dbosc->query($sql); -if ($resql) -{ - $num = $dbosc->num_rows($resql); - $i = 0; - print ""; - print ""; - print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"], "c.customers_firstname"); - print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"], "c.customers_lastname"); - print ''; - print "\n"; - $var=True; - while ($i < $num) - { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - print '\n"; - print '\n"; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - print "
'.$langs->trans("EMail").''.$langs->trans("Newsletter").'
'.$objp->customers_firstname."'.$objp->customers_lastname."$objp->customers_email_address$objp->customers_newsletter
"; - $dbosc->free($resql); -} -else -{ - dol_print_error($dbosc); -} - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/produits/osc-list.php b/htdocs/boutique/produits/osc-list.php deleted file mode 100644 index 4edf156dd05..00000000000 --- a/htdocs/boutique/produits/osc-list.php +++ /dev/null @@ -1,106 +0,0 @@ - - * Copyright (C) 2006 Laurent Destailleur - * - * 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 3 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, see . - * - */ - -/** - * \file htdocs/boutique/produits/osc-list.php - * \ingroup boutique - * \brief Page gestion produits du module OsCommerce - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php'; - - -/* - * View - */ - -llxHeader(); - -if ($sortfield == "") { - $sortfield="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-list.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 ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products as p, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description as d, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."manufacturers as m"; -$sql .= " WHERE p.products_id = d.products_id AND d.language_id =" . $conf->global->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 .= $dbosc->plimit($limit,$offset); - -print "

"; -print ''; -print ""; -print ""; -print ""; -print ""; -print ''; -print ''; -print ''."\n"; - -$resql=$dbosc->query($sql); -if ($resql) -{ - $num = $dbosc->num_rows($resql); - $i = 0; - - $var=True; - while ($i < $num) - { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print '\n"; - print '\n"; - print "\n"; - $i++; - } - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} - -print "
idRefTitreGroupeStockStatus
$objp->products_id$objp->products_model$objp->products_name$objp->manufacturers_name'.$objp->products_quantity."'.$objp->products_status."
"; - - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/promotion/class/index.html b/htdocs/boutique/promotion/class/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/boutique/promotion/class/promotion.class.php b/htdocs/boutique/promotion/class/promotion.class.php deleted file mode 100644 index 6e965ad76d1..00000000000 --- a/htdocs/boutique/promotion/class/promotion.class.php +++ /dev/null @@ -1,213 +0,0 @@ - - * - * 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 3 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, see . - * - */ - -/** - * \file htdocs/boutique/promotion/class/promotion.class.php - * \brief File of class to manage discounts on online shop - */ - -/** - * \class Promotion - * \brief Class to manage discounts on online shop - */ -class Promotion -{ - var $db; - - var $id; - var $parent_id; - var $oscid; - var $ref; - var $titre; - var $description; - var $price; - var $status; - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; - } - - /** - * Create promotion - * - * @param User $user Object user - * @param int $pid Pid - * @param int $percent Percent - * @return int <0 if KO, >0 if OK - */ - function create($user, $pid, $percent) - { - global $conf; - - $sql = "SELECT products_price "; - $sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products as p"; - $sql .= " WHERE p.products_id = ".$pid; - - $result = $this->db->query($sql); - if ( $result ) - { - $result = $this->db->fetch_array($result); - $this->price_init = $result["products_price"]; - } - - $newprice = $percent * $this->price_init; - - $date_exp = "2003-05-01"; // TODO ???? - - $now=dol_now(); - - $sql = "INSERT INTO ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."specials "; - $sql .= " (products_id, specials_new_products_price, specials_date_added, specials_last_modified, expires_date, date_status_change, status) "; - $sql .= " VALUES ($pid, $newprice, '".$this->db->idate($now)."', NULL, '".$this->db->idate($now+3600*24*365)."', 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; - } - } - - /** - * Update - * - * @param int $id id - * @param User $user Object user - * @return int <0 if KO, >0 if OK - */ - 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; - } - } - - /** - * Set active - * - * @param int $id id - * @return int <0 if KO, >0 if OK - */ - function set_active($id) - { - global $conf; - - $sql = "UPDATE ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."specials"; - $sql .= " SET status = 1"; - - $sql .= " WHERE products_id = " . $id; - - if ( $this->db->query($sql) ) { - return 1; - } else { - print $this->db->error() . ' in ' . $sql; - } - } - - /** - * Set inactive - * - * @param int $id id - * @return int <0 if KO, >0 if OK - */ - function set_inactive($id) - { - global $conf; - - $sql = "UPDATE ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."specials"; - $sql .= " SET status = 0"; - - $sql .= " WHERE products_id = " . $id; - - if ( $this->db->query($sql) ) { - return 1; - } else { - print $this->db->error() . ' in ' . $sql; - } - } - - /** - * Fetch datas - * - * @param int $id id - * @return int <0 if KO, >0 if OK - */ - function fetch($id) - { - global $conf; - - $sql = "SELECT c.categories_id, cd.categories_name, c.parent_id"; - $sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."categories as c,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."categories_description as cd"; - $sql .= " WHERE c.categories_id = cd.categories_id AND cd.language_id = ".$conf->global->OSC_LANGUAGE_ID; - $sql .= " AND c.categories_id = ".$id; - $result = $this->db->query($sql); - - if ( $result ) { - $result = $this->db->fetch_array($result); - - $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($result); - - return $result; - } - - - /** - * Delete object - * - * @param User $user Object user - * @return int <0 if KO, >0 if OK - */ - function delete($user) - { - global $conf; - - $sql = "DELETE FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products WHERE products_id = $idosc "; - - $sql = "DELETE FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_to_categories WHERE products_id = $idosc"; - - $sql = "DELETE FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description WHERE products_id = $idosc"; - - } - - -} diff --git a/htdocs/boutique/promotion/index.php b/htdocs/boutique/promotion/index.php deleted file mode 100644 index 10dfa09a8c1..00000000000 --- a/htdocs/boutique/promotion/index.php +++ /dev/null @@ -1,119 +0,0 @@ - - * Copyright (C) 2004-2006 Laurent Destailleur - * - * 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 3 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, see . - */ - -/** - * \file htdocs/boutique/promotion/index.php - * \ingroup boutique - * \brief Page gestion promotions OSCommerce - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php'; - - -llxHeader(); - -if ($action == "inactive") -{ - $promotion = new Promotion($dbosc); - $promotion->set_inactive($id); -} -if ($action == "active") -{ - $promotion = new Promotion($dbosc); - $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.= " expires_date as fin"; -$sql.= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."specials as s,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description as pd,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products as p"; -$sql.= " WHERE s.products_id = pd.products_id AND pd.products_id = p.products_id AND pd.language_id = ".$conf->global->OSC_LANGUAGE_ID; -$sql.= " ORDER BY $sortfield $sortorder "; -$sql.= $dbosc->plimit($limit,$offset); - -$resql=$dbosc->query($sql); -if ($resql) -{ - $num = $dbosc->num_rows($resql); - $i = 0; - print ''; - print ""; - print_liste_field_titre($langs->trans("Ref"),"index.php", "p.products_model"); - print_liste_field_titre("Titre","index.php", "pd.products_name"); - print ""; - print ''; - print ''; - print "\n"; - $var=True; - while ($i < $num) - { - $objp = $dbosc->fetch_object($i); - $var=!$var; - - print ""; - print '"; - print '"; - - if ($objp->status == 1) - { - print ''; - print ''; - } - else - { - print ''; - print ''; - } - print ""; - print '"; - print '"; - print ""; - $i++; - } - print "
  FinPrix initialPrix remise
'.$objp->products_model."'.$objp->products_name."actif'; - print ''; - print ''; - print ''; - print 'inactif".dol_print_date($dbosc->jdate($objp->fin),'day')."'.price($objp->products_price)."'.price($objp->specials_new_products_price)."
"; - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} -$dbosc->close(); - -llxFooter(); - diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 63ea8fd6e04..607f8e14c4e 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -218,7 +218,7 @@ if ($action == 'add') { if ($i == 0) // First entry { - if ($value['id'] > 0) $usertodo->fetch($value['id']); + if ($value['id'] > 0) $object->userownerid=$value['id']; $object->transparency = (GETPOST("transparency")=='on'?1:0); } @@ -287,19 +287,22 @@ if ($action == 'add') { unset($_SESSION['assignedtouser']); + $moreparam=''; + if ($user->id != $object->ownerid) $moreparam="usertodo=-1"; // We force to remove filter so created record is visible when going back to per user view. + $db->commit(); if (! empty($backtopage)) { - dol_syslog("Back to ".$backtopage); - header("Location: ".$backtopage); + dol_syslog("Back to ".$backtopage.($moreparam?(preg_match('/\?/',$backtopage)?'&'.$moreparam:'?'.$moreparam):'')); + header("Location: ".$backtopage.($moreparam?(preg_match('/\?/',$backtopage)?'&'.$moreparam:'?'.$moreparam):'')); } elseif($idaction) { - header("Location: ".DOL_URL_ROOT.'/comm/action/card.php?id='.$idaction); + header("Location: ".DOL_URL_ROOT.'/comm/action/card.php?id='.$idaction.($moreparam?'&'.$moreparam:'')); } else { - header("Location: ".DOL_URL_ROOT.'/comm/action/index.php'); + header("Location: ".DOL_URL_ROOT.'/comm/action/index.php'.($moreparam?'?'.$moreparam:'')); } exit; } @@ -377,8 +380,6 @@ if ($action == 'update') // Users $listofuserid=array(); - $assignedtouser=(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : 0); - if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>($user->id == $assignedtouser ? $transparency : '')); // Owner first if (! empty($_SESSION['assignedtouser'])) // Now concat assigned users { // Restore array with key with same value than param 'id' @@ -388,11 +389,18 @@ if ($action == 'update') if ($val['id'] > 0 && $val['id'] != $assignedtouser) $listofuserid[$val['id']]=$val; } } + else { + $assignedtouser=(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : 0); + if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>($user->id == $assignedtouser ? $transparency : '')); // Owner first + } - $object->userassigned=array(); // Clear old content + $object->userassigned=array(); $object->userownerid=0; // Clear old content + $i=0; foreach($listofuserid as $key => $val) { + if ($i == 0) $object->userownerid = $val['id']; $object->userassigned[$val['id']]=array('id'=>$val['id'], 'mandatory'=>0, 'transparency'=>($user->id == $val['id'] ? $transparency : '')); + $i++; } if (! empty($conf->global->AGENDA_ENABLE_DONEBY)) @@ -1068,7 +1076,7 @@ if ($id > 0) $listofuserid=array(); if (empty($donotclearsession)) { - if (is_object($object->userownerid)) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->transparency); // Owner first + if ($object->userownerid > 0) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->transparency); // Owner first if (! empty($object->userassigned)) // Now concat assigned users { // Restore array with key with same value than param 'id' diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 43bc2be4272..df0a359dd56 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -543,9 +543,9 @@ class ActionComm extends CommonObject $sql.= ", datep2 = ".(strval($this->datef)!='' ? "'".$this->db->idate($this->datef)."'" : 'null'); $sql.= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null"); // deprecated $sql.= ", note = ".($this->note ? "'".$this->db->escape($this->note)."'":"null"); - $sql.= ", fk_soc =". ($this->socid > 0 ? "'".$this->socid."'":"null"); $sql.= ", fk_project =". ($this->fk_project > 0 ? "'".$this->fk_project."'":"null"); - $sql.= ", fk_contact =". ($contactid > 0 ? "'".$this->contactid."'":"null"); + $sql.= ", fk_soc =". ($socid > 0 ? "'".$socid."'":"null"); + $sql.= ", fk_contact =". ($contactid > 0 ? "'".$contactid."'":"null"); $sql.= ", priority = '".$this->priority."'"; $sql.= ", fulldayevent = '".$this->fulldayevent."'"; $sql.= ", location = ".($this->location ? "'".$this->db->escape($this->location)."'":"null"); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index e540e164d96..2db6936e1d3 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -219,10 +219,10 @@ if (empty($action) || $action=='show_month') $max_day_in_prev_month = date("t",dol_mktime(0,0,0,$prev_month,1,$prev_year)); // Nb of days in previous month $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); // Nb of days in next month - // tmpday is a negative or null cursor to know how many days before the 1 to show on month view (if tmpday=0 we start on monday) - $tmpday = -date("w",dol_mktime(0,0,0,$month,1,$year))+2; + // tmpday is a negative or null cursor to know how many days before the 1st to show on month view (if tmpday=0, 1st is monday) + $tmpday = -date("w",dol_mktime(12,0,0,$month,1,$year,true))+2; // date('w') is 0 fo sunday $tmpday+=((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)-1); - if ($tmpday >= 1) $tmpday -= 7; + if ($tmpday >= 1) $tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week. // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$max_day_in_prev_month+$tmpday,$prev_year); $next_day=7 - ($max_day_in_month+1-$tmpday) % 7; @@ -918,7 +918,7 @@ if (empty($action) || $action == 'show_month') // View by month echo " \n"; for ($iter_day = 0; $iter_day < 7; $iter_day++) { - /* Show days before the beginning of the current month (previous month) */ + /* Show days before the beginning of the current month (previous month) */ if ($tmpday <= 0) { $style='cal_other_month cal_past'; @@ -931,21 +931,20 @@ if (empty($action) || $action == 'show_month') // View by month elseif ($tmpday <= $max_day_in_month) { $curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year); - $style='cal_current_month'; if ($iter_day == 6) $style.=' cal_current_month_right'; $today=0; if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1; if ($today) $style='cal_today'; if ($curtime < $todaytms) $style.=' cal_past'; - + //var_dump($todayarray['mday']."==".$tmpday." && ".$todayarray['mon']."==".$month." && ".$todayarray['year']."==".$year.' -> '.$style); echo ' '; show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam); echo " \n"; } /* Show days after the current month (next month) */ else - { + { $style='cal_other_month'; if ($iter_day == 6) $style.=' cal_other_month_right'; echo ' '; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 303ca3dc2a3..51ddb81c0b4 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -566,19 +566,50 @@ echo "\n"; $usernames = array(); //init $usernamesid = array(); /* Use this to have list of users only if users have events */ -foreach ($eventarray as $daykey => $notused) +if (! empty($conf->global->AGENDA_SHOWOWNERONLY_ONPERUSERVIEW)) { - // Get all assigned users for each event - foreach ($eventarray[$daykey] as $index => $event) - { - $event->fetch_userassigned(); - $listofuserid=$event->userassigned; - foreach($listofuserid as $userid => $tmp) - { - if (! in_array($userid, $usernamesid)) $usernamesid[$userid] = $userid; - } - } + foreach ($eventarray as $daykey => $notused) + { + // Get all assigned users for each event + foreach ($eventarray[$daykey] as $index => $event) + { + $event->fetch_userassigned(); + $listofuserid=$event->userassigned; + foreach($listofuserid as $userid => $tmp) + { + if (! in_array($userid, $usernamesid)) $usernamesid[$userid] = $userid; + } + } + } } +/* Use this list to have for all users */ +else +{ + $sql = "SELECT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity"; + $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; + if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON u.rowid = ug.fk_user"; + $sql.= " WHERE u.entity IN (".getEntity('user').")"; + if ($usergroup > 0) $sql.= " AND ug.fk_usergroup = ".$usergroup; + if (GETPOST("usertodo","int",3) > 0) $sql.=" AND u.rowid = ".GETPOST("usertodo","int",3); + //print $sql; + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $usernamesid[$obj->rowid]=$obj->rowid; + $i++; + } + } + } + else dol_print_error($db); +} +//var_dump($usernamesid); foreach($usernamesid as $id) { $tmpuser=new User($db); @@ -608,11 +639,13 @@ else // Load array of colors by type $colorsbytype=array(); -$sql="SELECT code, color FROM ".MAIN_DB_PREFIX."c_actioncomm"; +$labelbytype=array(); +$sql="SELECT code, color, libelle FROM ".MAIN_DB_PREFIX."c_actioncomm"; $resql=$db->query($sql); while ($obj = $db->fetch_object($resql)) { $colorsbytype[$obj->code]=$obj->color; + $labelbytype[$obj->code]=$obj->libelle; } // Loop on each user to show calendar @@ -658,6 +691,27 @@ foreach ($usernames as $username) echo "\n"; + +if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) +{ + $langs->load("commercial"); + print '
'.$langs->trans("Legend").':
'; + foreach($colorsbytype as $code => $color) + { + if ($color) + { + print '

 
'; + print $langs->trans("Action".$code)!="Action".$code?$langs->trans("Action".$code):$labelbytype[$code]; + //print $code; + print '
'; + } + } + //$color=sprintf("%02x%02x%02x",$theme_datacolor[0][0],$theme_datacolor[0][1],$theme_datacolor[0][2]); + print '
 
'; + print $langs->trans("Other"); + print '
'; +} + // Add js code to manage click on a box print '