diff --git a/htdocs/admin/osc-languages.php b/htdocs/admin/osc-languages.php
index df359c9d0c6..a66b331fbef 100644
--- a/htdocs/admin/osc-languages.php
+++ b/htdocs/admin/osc-languages.php
@@ -57,7 +57,7 @@ $offset = $limit * $page ;
print_barre_liste("Liste des langues oscommerce", $page, "osc-languages.php");
-$sql = "SELECT l.languages_id, l.name, l.code FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."languages as l";
+$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);
@@ -67,7 +67,7 @@ $sql .= $db->plimit( $limit ,$offset);
print "
Name | ";
print "Code | ";
print "\n";
-
+
if ( $db->query($sql) ) {
$num = $db->num_rows();
$i = 0;
diff --git a/htdocs/boutique/client/client.class.php b/htdocs/boutique/client/client.class.php
index b63a9546c93..b6a8e63a881 100644
--- a/htdocs/boutique/client/client.class.php
+++ b/htdocs/boutique/client/client.class.php
@@ -27,7 +27,7 @@
\version $Revision$
*/
-/**
+/**
\class Client
\brief Classe permettant de gèrer des clients de la boutique online
*/
@@ -52,8 +52,9 @@ class Client
function fetch ($id)
{
+ global $conf;
- $sql = "SELECT customers_id, customers_lastname, customers_firstname FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."customers WHERE customers_id = $id";
+ $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";
$result = $this->db->query($sql) ;
diff --git a/htdocs/boutique/client/fiche.php b/htdocs/boutique/client/fiche.php
index 7cc47fe6da4..537c1f9d9c1 100644
--- a/htdocs/boutique/client/fiche.php
+++ b/htdocs/boutique/client/fiche.php
@@ -20,7 +20,7 @@
* $Id$
* $Source$
*/
-
+
/**
\file htdocs/boutique/client/fiche.php
\ingroup boutique
@@ -44,25 +44,25 @@ if ($action == 'update' && !$cancel) {
*/
if ($_GET['id'])
{
-
+
$client = new Client($dbosc);
$result = $client->fetch($_GET['id']);
if ( $result )
- {
+ {
print 'Fiche Client : '.$client->name.'
';
print '';
print "";
print '| Nom | '.$client->name.' |
';
print "
";
-
-
+
+
/*
* Commandes
*
*/
$sql = "SELECT o.orders_id, o.customers_id,".$dbosc->pdate("date_purchased")." as date_purchased, t.value as total";
- $sql .= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders as o, ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders_total as t";
+ $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'";
if ( $dbosc->query($sql) )
@@ -77,9 +77,9 @@ if ($_GET['id'])
$objp = $dbosc->fetch_object();
$var=!$var;
print "";
-
+
print ' ';
-
+
print dolibarr_print_date($objp->date_purchased,'dayhour')."\n";
print $objp->total . " | \n";
print "
\n";
@@ -93,15 +93,15 @@ if ($_GET['id'])
print "ERROR 1
\n";
dolibarr_print_error($dbosc);
}
-
+
}
else
{
print "ERROR 1
\n";
dolibarr_print_error($dbosc);
}
-
-
+
+
}
else
{
@@ -111,9 +111,9 @@ else
/* ************************************************************************** */
-/* */
-/* Barre d'action */
-/* */
+/* */
+/* Barre d'action */
+/* */
/* ************************************************************************** */
// Pas d'action
diff --git a/htdocs/boutique/client/index.php b/htdocs/boutique/client/index.php
index 0d84d7fc947..ce3500baf89 100644
--- a/htdocs/boutique/client/index.php
+++ b/htdocs/boutique/client/index.php
@@ -48,10 +48,10 @@ $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 ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."customers as c";
+$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);
-
+
if ( $dbosc->query($sql) )
{
$num = $dbosc->num_rows();
diff --git a/htdocs/boutique/commande/ca.php b/htdocs/boutique/commande/ca.php
index 9e8f0f99320..aa0baedaacc 100644
--- a/htdocs/boutique/commande/ca.php
+++ b/htdocs/boutique/commande/ca.php
@@ -51,9 +51,9 @@ print '| '.$langs->trans("Description").' | ';
print ''.$langs->trans("Lastname").' |
';
$sql = "SELECT sum(t.value) as value";
-$sql .= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders_total as t";
+$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
$sql .= " WHERE t.class = 'ot_subtotal'";
-
+
if ( $dbosc->query($sql) )
{
$num = $dbosc->num_rows();
@@ -79,9 +79,9 @@ else
}
$sql = "SELECT sum(t.value) as value";
-$sql .= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders_total as t";
+$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
$sql .= " WHERE t.class = 'ot_shipping'";
-
+
if ( $dbosc->query($sql) )
{
$num = $dbosc->num_rows();
diff --git a/htdocs/boutique/commande/commande.class.php b/htdocs/boutique/commande/commande.class.php
index c5dfbcdfa52..97fe1fac533 100644
--- a/htdocs/boutique/commande/commande.class.php
+++ b/htdocs/boutique/commande/commande.class.php
@@ -57,8 +57,10 @@ class Commande
*/
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_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, ".$this->db->pdate("date_purchased") . " as date_purchased, orders_status, orders_date_finished, currency, currency_value";
- $sql.= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders";
+ $sql.= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders";
$sql.= " WHERE orders_id = ".$id;
$result = $this->db->query($sql) ;
@@ -93,7 +95,7 @@ class Commande
* Totaux
*/
$sql = "SELECT value, class ";
- $sql .= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders_total WHERE orders_id = $id";
+ $sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total WHERE orders_id = $id";
$result = $this->db->query($sql) ;
diff --git a/htdocs/boutique/commande/fiche.php b/htdocs/boutique/commande/fiche.php
index 1dc08fb707d..09459802dfa 100644
--- a/htdocs/boutique/commande/fiche.php
+++ b/htdocs/boutique/commande/fiche.php
@@ -39,10 +39,10 @@ if ($_GET['id'])
{
$commande = new Commande($db);
$result = $commande->fetch($_GET['id']);
-
+
if ( $result )
- {
-
+ {
+
print 'Fiche Commande : '.$commande->id.'
';
print '';
@@ -60,13 +60,13 @@ if ($_GET['id'])
print "
";
print "
";
-
+
/*
* Produits
*
*/
$sql = "SELECT orders_id, products_id, products_model, products_name, products_price, final_price, products_quantity";
- $sql .= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders_products";
+ $sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_products";
$sql .= " WHERE orders_id = " . $commande->id;
if ( $dbosc->query($sql) )
@@ -78,21 +78,21 @@ if ($_GET['id'])
print ''.$langs->trans("Number").' | '.$langs->trans("Price").' | Prix final | ';
print "\n";
$var=True;
- while ($i < $num)
+ while ($i < $num)
{
$objp = $dbosc->fetch_object();
$var=!$var;
print "";
print '';
print ' ';
-
+
print ''.$objp->products_name.'';
print " | ";
print '$objp->products_quantity | \n";
print "rowid\">".price($objp->products_price)." | \n";
print "rowid\">".price($objp->final_price)." | \n";
-
+
print "
\n";
$i++;
}
@@ -116,8 +116,8 @@ if ($_GET['id'])
print ''.$langs->trans("Lastname").' | '.price($commande->total_ot_total).' EUR | ';
print "";
-
-
+
+
}
else
{
@@ -131,17 +131,17 @@ else
/* ************************************************************************** */
-/* */
-/* Barre d'action */
-/* */
+/* */
+/* Barre d'action */
+/* */
/* ************************************************************************** */
print '
';
print '| - | ';
print '- | ';
print '- | ';
-print '- | ';
-print '- | ';
+print '- | ';
+print '- | ';
print '
';
diff --git a/htdocs/boutique/commande/index.php b/htdocs/boutique/commande/index.php
index 2024ffe2ef4..1c2f009d3f4 100644
--- a/htdocs/boutique/commande/index.php
+++ b/htdocs/boutique/commande/index.php
@@ -48,11 +48,11 @@ 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,".$dbosc->pdate("date_purchased")." as date_purchased, orders_status, orders_date_finished, currency, currency_value, t.value";
-$sql .= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders as o, ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders_total as t";
+$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);
-
+
if ( $dbosc->query($sql) )
{
$num = $dbosc->num_rows();
diff --git a/htdocs/boutique/critiques/bestproduct.php b/htdocs/boutique/critiques/bestproduct.php
index b309b7d8d53..1126055f222 100644
--- a/htdocs/boutique/critiques/bestproduct.php
+++ b/htdocs/boutique/critiques/bestproduct.php
@@ -48,7 +48,7 @@ $offset = $limit * $page ;
print_barre_liste("Liste des produits classés pas 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 ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."reviews as r,".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."products as p ";
+$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";
diff --git a/htdocs/boutique/critiques/critique.class.php b/htdocs/boutique/critiques/critique.class.php
index 36c8469f916..4a20b5276fd 100644
--- a/htdocs/boutique/critiques/critique.class.php
+++ b/htdocs/boutique/critiques/critique.class.php
@@ -41,22 +41,22 @@ class Critique {
function Critique($DB, $id=0) {
$this->db = $DB;
$this->id = $id ;
- }
+ }
/*
*
*
*
*/
function fetch ($id) {
-
-
+ global $conf;
+
$sql = "SELECT r.reviews_id, r.reviews_rating, d.reviews_text, p.products_name";
- $sql .= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."reviews as r, ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."reviews_description as d";
- $sql .= " ,".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."products_description as p";
+ $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 = ".OSC_LANGUAGE_ID. " AND d.languages_id=".OSC_LANGUAGE_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) ;
@@ -68,7 +68,7 @@ class Critique {
$this->id = $result["reviews_id"];
$this->product_name = stripslashes($result["products_name"]);
$this->text = stripslashes($result["reviews_text"]);
-
+
$this->db->free();
}
else
@@ -76,7 +76,7 @@ class Critique {
print $this->db->error();
print "$sql";
}
-
+
return $result;
}
diff --git a/htdocs/boutique/critiques/index.php b/htdocs/boutique/critiques/index.php
index b056260cb43..0bf8614d9d3 100644
--- a/htdocs/boutique/critiques/index.php
+++ b/htdocs/boutique/critiques/index.php
@@ -45,9 +45,9 @@ $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 ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."reviews as r, ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."reviews_description as d, ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."products_description as p";
+$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 = ".OSC_LANGUAGE_ID. " AND d.languages_id=".OSC_LANGUAGE_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);
diff --git a/htdocs/boutique/index.php b/htdocs/boutique/index.php
index d70f530da0e..55193f73dd5 100644
--- a/htdocs/boutique/index.php
+++ b/htdocs/boutique/index.php
@@ -18,7 +18,7 @@
*
* $Id$
*/
-
+
/**
\file htdocs/boutique/index.php
\ingroup boutique
@@ -41,8 +41,8 @@ print '
';
print '| ';
-/*
-/* Chiffre d'affaire
+/*
+/* Chiffre d'affaire
*/
//print_barre_liste("Chiffre d'affaire", $page, "ca.php");
@@ -53,8 +53,8 @@ print ' |
| '.$langs->trans("Description").' | ';
print ''.$langs->trans("Total").' |
';
$sql = "SELECT sum(t.value) as value, MONTH(o.date_purchased) as mois";
-$sql .= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders_total as t";
-$sql .= " JOIN ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders as o ON o.orders_id = t.orders_id";
+$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(mktime()).")";
$sql .= " GROUP BY mois ORDER BY mois";
@@ -90,10 +90,10 @@ else
/* mensuel
$sql = "SELECT sum(t.value) as value";
-$sql .= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders_total as t";
-$sql .= " JOIN ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders as o ON o.orders_id = t.orders_id";
+$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->db->idate(mktime()).") AND MONTH(o.date_purchased) = MONTH(".$this->db->idate(mktime()).")";
-
+
if ( $dbosc->query($sql) )
{
$num = $dbosc->num_rows();
@@ -128,10 +128,10 @@ 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.".".OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id ";
+$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";
-if ( $dbosc->query($sql) )
+if ( $dbosc->query($sql) )
{
$langs->load("orders");
$num = $dbosc->num_rows();
@@ -162,10 +162,10 @@ else
* 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.".".OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id ";
+$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";
-if ( $dbosc->query($sql) )
+if ( $dbosc->query($sql) )
{
$langs->load("orders");
$num = $dbosc->num_rows();
@@ -175,11 +175,11 @@ if ( $dbosc->query($sql) )
print '';
print '';
print '| '.$langs->trans("En Attente").' |
';
-
+
$num = min($num,OSC_MAXNBCOM);
while ($i < $num)
{
-
+
$obj = $dbosc->fetch_object();
print "| $obj->orders_id | $obj->customers_name | ".price($obj->value)." | $obj->payment_method |
";
$i++;
@@ -196,10 +196,10 @@ else
* Commandes à traiter
*/
$sql = "SELECT o.orders_id, o.customers_name, o.date_purchased, t.value, o.payment_method";
-$sql .= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id ";
+$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";
-if ( $dbosc->query($sql) )
+if ( $dbosc->query($sql) )
{
$langs->load("orders");
$num = $dbosc->num_rows();
@@ -213,7 +213,7 @@ if ( $dbosc->query($sql) )
$num = min($num,OSC_MAXNBCOM);
while ($i < $num)
{
-
+
$obj = $dbosc->fetch_object();
print "| $obj->orders_id | $obj->customers_name | ".price($obj->value)." | $obj->payment_method |
";
$i++;
@@ -232,11 +232,11 @@ print '';
* 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.".".OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id ";
-$sql .= " JOIN ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders_status as s on o.orders_status = s.orders_status_id and s.language_id = 1";
+$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";
-if ( $dbosc->query($sql) )
+if ( $dbosc->query($sql) )
{
$langs->load("orders");
$num = $dbosc->num_rows();
@@ -246,11 +246,11 @@ if ( $dbosc->query($sql) )
print '';
print '';
print '| '.$langs->trans("Derniers clients").' |
';
-
+
$num = min($num,OSC_MAXNBCOM);
while ($i < $num)
{
-
+
$obj = $dbosc->fetch_object();
print "| $obj->date_purchased | $obj->customers_name | $obj->delivery_country | ".price($obj->value)." | $obj->payment_method | $obj->orders_id | $obj->statut |
";
$i++;
diff --git a/htdocs/boutique/notification/index.php b/htdocs/boutique/notification/index.php
index 581f93e5c8e..56b478d162b 100644
--- a/htdocs/boutique/notification/index.php
+++ b/htdocs/boutique/notification/index.php
@@ -49,13 +49,13 @@ $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 ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."products_notifications as n,".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."products_description as p";
-$sql .= ",".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."customers as c";
+$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 = ".OSC_LANGUAGE_ID;
+$sql .= " AND p.language_id = ".$conf->global->OSC_LANGUAGE_ID;
$sql .= " ORDER BY $sortfield $sortorder ";
$sql .= $dbosc->plimit( $limit ,$offset);
-
+
if ( $dbosc->query($sql) )
{
$num = $dbosc->num_rows();
diff --git a/htdocs/boutique/notification/notification.class.php b/htdocs/boutique/notification/notification.class.php
index b97c8849c08..12360b47f6a 100644
--- a/htdocs/boutique/notification/notification.class.php
+++ b/htdocs/boutique/notification/notification.class.php
@@ -29,7 +29,7 @@ class Editeur {
function Editeur($DB, $id=0) {
$this->db = $DB;
$this->id = $id ;
- }
+ }
/*
*
*
@@ -38,17 +38,17 @@ class Editeur {
function create($user) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."editeur (fk_user_author) VALUES (".$user->id.")";
-
+
if ($this->db->query($sql) )
{
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."editeur");
-
+
if ( $this->update($id, $user) )
{
return $id;
}
}
-
+
}
/*
@@ -64,14 +64,14 @@ class Editeur {
if ($this->db->query($sql) )
{
$nump = $this->db->num_rows();
-
+
if ($nump)
{
$i = 0;
while ($i < $nump)
{
$obj = $this->db->fetch_object();
-
+
$ga[$obj->rowid] = $obj->nom;
$i++;
}
@@ -82,7 +82,7 @@ class Editeur {
{
print $this->db->error();
}
-
+
}
/*
*
@@ -109,7 +109,7 @@ class Editeur {
*
*/
function fetch ($id) {
-
+
$sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."editeur WHERE rowid = $id";
$result = $this->db->query($sql) ;
@@ -120,14 +120,14 @@ class Editeur {
$this->id = $result["rowid"];
$this->nom = stripslashes($result["nom"]);
-
+
$this->db->free();
}
else
{
print $this->db->error();
}
-
+
return $result;
}
@@ -138,15 +138,17 @@ class Editeur {
*/
function delete($user) {
- $sql = "DELETE FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."products WHERE products_id = $idosc ";
+ global $conf;
- $sql = "DELETE FROM ".OSC_DB_NAME.".".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 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";
- $sql = "DELETE FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."products_description WHERE products_id = $idosc";
-
$sql = "DELETE FROM ".MAIN_DB_PREFIX."livre WHERE rowid = $id";
-
-
+
+
}
diff --git a/htdocs/boutique/notification/produits.php b/htdocs/boutique/notification/produits.php
index b588edada1f..4ae8e737509 100644
--- a/htdocs/boutique/notification/produits.php
+++ b/htdocs/boutique/notification/produits.php
@@ -47,12 +47,12 @@ $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 ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."products_notifications as n,".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."products_description as p";
+$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 = ".OSC_LANGUAGE_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)
{
diff --git a/htdocs/boutique/produits/osc-liste.php b/htdocs/boutique/produits/osc-liste.php
index 289da8498e7..24784bc7eba 100644
--- a/htdocs/boutique/produits/osc-liste.php
+++ b/htdocs/boutique/produits/osc-liste.php
@@ -46,13 +46,13 @@ $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.".".OSC_DB_TABLE_PREFIX."products as p, ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."products_description as d, ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."manufacturers as m";
-$sql .= " WHERE p.products_id = d.products_id AND d.language_id =" . OSC_LANGUAGE_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);
@@ -66,7 +66,7 @@ print "Groupe | ";
print 'Stock | ';
print 'Status | ';
print "\n";
-
+
$resql=$dbosc->query($sql);
if ($resql)
{
diff --git a/htdocs/boutique/promotion/index.php b/htdocs/boutique/promotion/index.php
index 6779c41c18d..e0f63cc15d8 100644
--- a/htdocs/boutique/promotion/index.php
+++ b/htdocs/boutique/promotion/index.php
@@ -61,11 +61,11 @@ $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 .= ",".$dbosc->pdate("expires_date")." as fin";
-$sql .= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."specials as s,".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."products_description as pd,".OSC_DB_NAME.".".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 = ".OSC_LANGUAGE_ID;
+$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)
{
@@ -84,7 +84,7 @@ if ($resql)
{
$objp = $dbosc->fetch_object( $i);
$var=!$var;
-
+
print "";
print '| '.$objp->products_model." | ";
print ''.$objp->products_name." | ";
diff --git a/htdocs/boutique/promotion/promotion.class.php b/htdocs/boutique/promotion/promotion.class.php
index 5b8bc61fcfd..a522a5b2cf5 100644
--- a/htdocs/boutique/promotion/promotion.class.php
+++ b/htdocs/boutique/promotion/promotion.class.php
@@ -35,16 +35,17 @@ class Promotion {
function Promotion($DB, $id=0) {
$this->db = $DB;
$this->id = $id ;
- }
+ }
/*
*
*
*
*/
function create($user, $pid, $percent) {
+ global $conf;
$sql = "SELECT products_price ";
- $sql .= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."products as p";
+ $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) ;
@@ -59,20 +60,20 @@ class Promotion {
$date_exp = "2003-05-01";
- $sql = "INSERT INTO ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."specials ";
+ $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(mktime()).", NULL, '$date_exp',NULL,1)";
if ($this->db->query($sql) )
{
$id = $this->db->last_insert_id(OSC_DB_NAME.".specials");
-
+
return $id;
}
else
{
print $this->db->error() . ' in ' . $sql;
- }
+ }
}
/*
*
@@ -100,7 +101,9 @@ class Promotion {
*/
function set_active($id)
{
- $sql = "UPDATE ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."specials";
+ 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;
@@ -110,13 +113,15 @@ class Promotion {
} else {
print $this->db->error() . ' in ' . $sql;
}
- }
+ }
/*
*
*/
function set_inactive($id)
{
- $sql = "UPDATE ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."specials";
+ 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;
@@ -126,17 +131,18 @@ class Promotion {
} else {
print $this->db->error() . ' in ' . $sql;
}
- }
+ }
/*
*
*
*
*/
function fetch ($id) {
-
+ global $conf;
+
$sql = "SELECT c.categories_id, cd.categories_name, c.parent_id";
- $sql .= " FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."categories as c,".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."categories_description as cd";
- $sql .= " WHERE c.categories_id = cd.categories_id AND cd.language_id = ".OSC_LANGUAGE_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) ;
@@ -162,12 +168,14 @@ class Promotion {
*/
function delete($user) {
- $sql = "DELETE FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."products WHERE products_id = $idosc ";
+ global $conf;
- $sql = "DELETE FROM ".OSC_DB_NAME.".".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 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";
- $sql = "DELETE FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."products_description WHERE products_id = $idosc";
-
}
diff --git a/htdocs/commande/osccommande.class.php b/htdocs/commande/osccommande.class.php
index 358916dd7f1..bcccfc059a4 100644
--- a/htdocs/commande/osccommande.class.php
+++ b/htdocs/commande/osccommande.class.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville
* Copyright (C) 2003 Eric Seigne
* Copyright (C) 2005-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 2 of the License, or
@@ -26,17 +26,17 @@
class OscCommande
{
var $db ;
-
+
var $id ;
var $client_name ;
-
+
function OscCommande($DB, $id=0)
{
$this->db = $DB;
$this->id = $id ;
- }
-
+ }
+
/*
*
@@ -45,23 +45,25 @@ class OscCommande
*/
function fetch ($id)
{
- $sql = "SELECT o.orders_id, o.customers_name, o.orders_status FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."orders as o";
+ global $conf;
+
+ $sql = "SELECT o.orders_id, o.customers_name, o.orders_status FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o";
$sql .= " WHERE o.orders_id = $id";
-
+
$result = $this->db->query($sql) ;
-
+
if ( $result )
{
$result = $this->db->fetch_array();
-
+
$this->id = $result["rowid"];
$this->client_name = $result["customers_name"];
}
$this->db->free();
-
+
return $result;
}
-
+
/*
*
@@ -78,14 +80,14 @@ class OscCommande
if ($this->db->query($sql) )
{
$nump = $this->db->num_rows();
-
+
if ($nump)
{
$i = 0;
while ($i < $nump)
{
$obj = $this->db->fetch_object();
-
+
$ga[$obj->rowid] = $obj->title;
$i++;
}
@@ -95,7 +97,7 @@ class OscCommande
else
{
print $this->db->error();
- }
+ }
}
/*
*
diff --git a/htdocs/includes/boxes/box_osc_client.php b/htdocs/includes/boxes/box_osc_client.php
index b1dc3cb66ac..33b2693ca66 100644
--- a/htdocs/includes/boxes/box_osc_client.php
+++ b/htdocs/includes/boxes/box_osc_client.php
@@ -57,28 +57,28 @@ class box_osc_clients extends ModeleBoxes {
*/
function loadBox($max=5)
{
- global $user, $langs, $db;
+ global $conf, $user, $langs, $db;
$langs->load("boxes");
$this->max=$max;
-
+
$this->info_box_head = array('text' => $langs->trans("BoxTitleNbOfCustomers",$max));
if ($user->rights->boutique->lire)
{
- $sql = "SELECT count(*) as cus FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."customers";
-
+ $sql = "SELECT count(*) as cus FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."customers";
+
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
-
+
$i = 0;
-
+
while ($i < $num)
{
$objp = $db->fetch_object($resql);
-
+
$this->info_box_contents[$i][0] = array('td' => 'align="center" width="16"',
'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/boutique/client/index.php");
@@ -96,7 +96,7 @@ class box_osc_clients extends ModeleBoxes {
$this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed"));
}
-
+
}
function showBox()
diff --git a/htdocs/includes/modules/fichinter/pdf_soleil.modules.php b/htdocs/includes/modules/fichinter/pdf_soleil.modules.php
index eced87afaf1..654e2906c0b 100644
--- a/htdocs/includes/modules/fichinter/pdf_soleil.modules.php
+++ b/htdocs/includes/modules/fichinter/pdf_soleil.modules.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2008 Laurent Destailleur
+ * Copyright (C) 2004-2009 Laurent Destailleur
* Copyright (C) 2008 Raphael Bertrand (Resultic)
*
* This program is free software; you can redistribute it and/or modify
diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang
index 66eb716eb54..639c739afa4 100755
--- a/htdocs/langs/en_US/projects.lang
+++ b/htdocs/langs/en_US/projects.lang
@@ -49,4 +49,5 @@ ActivityOnProjectThisMonth=Activity on project this month
ActivityOnProjectThisYear=Activity on project this year
ChildOfTaks=Child of project/task
NotOwnerOfProject=Not owner of this private project
-AffectedTo=Affected to
\ No newline at end of file
+AffectedTo=Affected to
+CantRemoveProject=This project can't be removed as it is referenced by some other objects (invoice, orders or other). See referers tab.
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang
index 7292f4359c8..2444423e1c4 100755
--- a/htdocs/langs/fr_FR/projects.lang
+++ b/htdocs/langs/fr_FR/projects.lang
@@ -49,4 +49,5 @@ ActivityOnProjectThisMonth=Activité sur les projets ce mois
ActivityOnProjectThisYear=Activité sur les projets cette année
ChildOfTaks=Fille du projet/tĂąche
NotOwnerOfProject=Non responsable de ce projet privé
-AffectedTo=AffectĂ© Ă
\ No newline at end of file
+AffectedTo=AffectĂ© Ă
+CantRemoveProject=Ce projet ne peut ĂȘtre supprimĂ© car il est rĂ©fĂ©rencĂ© par de nombreux objets (factures, commandes ou autre). voir la liste sur l'onglet RefĂ©rents.
\ No newline at end of file
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index eee4de94e26..5d442461702 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -1599,11 +1599,11 @@ function dol_print_error($db='',$error='')
{
if ($_SERVER['DOCUMENT_ROOT']) // Mode web
{
- print "
\n";
print "".$langs->trans("DatabaseTypeManager").": ".$db->type."
\n";
print "".$langs->trans("RequestLastAccessInError").": ".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."
\n";
print "".$langs->trans("ReturnCodeLastAccessInError").": ".($db->lasterrno()?$db->lasterrno():$langs->trans("ErrorNoRequestInError"))."
\n";
print "".$langs->trans("InformationLastAccessInError").": ".($db->lasterror()?$db->lasterror():$langs->trans("ErrorNoRequestInError"))."
\n";
+ print "
\n";
}
else // Mode CLI
{
diff --git a/htdocs/project.class.php b/htdocs/project.class.php
index 774b63136f0..56e1798ab6b 100644
--- a/htdocs/project.class.php
+++ b/htdocs/project.class.php
@@ -266,17 +266,19 @@ class Project extends CommonObject
*/
function delete($user)
{
-
$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet";
- $sql .= " WHERE rowid=".$this->id;
+ $sql.= " WHERE rowid=".$this->id;
+ dolibarr_syslog("Project::delete sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
- return 0;
+ return 1;
}
else
{
+ $this->error=$this->db->lasterror();
+ dolibarr_syslog("Project::delete ".$this->error, LOG_ERR);
return -1;
}
}
diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php
index 03ca41e5bcd..12076d3d074 100644
--- a/htdocs/projet/fiche.php
+++ b/htdocs/projet/fiche.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2008 Laurent Destailleur
+ * Copyright (C) 2004-2009 Laurent Destailleur
* Copyright (C) 2005-2007 Regis Houssin
*
* This program is free software; you can redistribute it and/or modify
@@ -116,15 +116,15 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user-
{
$projet = new Project($db);
$projet->id = $_GET["id"];
- if ($projet->delete($user) == 0)
+ $result=$projet->delete($user);
+ if ($result >= 0)
{
Header("Location: index.php");
exit;
}
else
{
- Header("Location: fiche.php?id=".$projet->id);
- exit;
+ $mesg=''.$langs->trans("CantRemoveProject").'
';
}
}
@@ -191,11 +191,9 @@ else
$projet = new Project($db);
$projet->fetch($_GET["id"],$_GET["ref"]);
- $projet->societe->fetch($projet->societe->id);
- if ($projet->user_resp_id > 0)
- {
- $result=$projet->fetch_user($projet->user_resp_id);
- }
+
+ if ($projet->societe->id > 0) $result=$projet->societe->fetch($projet->societe->id);
+ if ($projet->user_resp_id > 0) $result=$projet->fetch_user($projet->user_resp_id);
$head=project_prepare_head($projet);
dolibarr_fiche_head($head, 'project', $langs->trans("Project"));
diff --git a/htdocs/translate.class.php b/htdocs/translate.class.php
index aef468f6887..ca6d419fdf2 100644
--- a/htdocs/translate.class.php
+++ b/htdocs/translate.class.php
@@ -176,7 +176,7 @@ class Translate {
*/
function Load($domain,$alt=0)
{
- dolibarr_syslog("Translate::Load domain=".$domain." alt=".$alt);
+ //dolibarr_syslog("Translate::Load domain=".$domain." alt=".$alt);
// Check parameters
if (empty($domain))