From ba15e00bfcc26e1a85225c41b0a1fb1c40f2511a Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Mon, 31 May 2010 09:45:15 +0000
Subject: [PATCH] Fix: SQL Error

---
 htdocs/product/stock/class/entrepot.class.php | 11 +++++------
 htdocs/product/stock/fiche.php                |  6 +++---
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php
index 0d7281d6934..1fcfdb08543 100644
--- a/htdocs/product/stock/class/entrepot.class.php
+++ b/htdocs/product/stock/class/entrepot.class.php
@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2010 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005-2008 Regis Houssin        <regis@dolibarr.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -276,12 +276,11 @@ class Entrepot extends CommonObject
 	 */
 	function info($id)
 	{
-		$sql  = "SELECT e.rowid, e.datec,";
-		$sql .= " e.datem,";
-		$sql .= " fk_user_author";
-		$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e";
-		$sql .= " WHERE e.rowid = ".$id;
+		$sql = "SELECT e.rowid, e.datec, e.tms as datem, e.fk_user_author";
+		$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e";
+		$sql.= " WHERE e.rowid = ".$id;
 
+		dol_syslog("Entrepot::info sql=".$sql);
 		$result=$this->db->query($sql);
 		if ($result)
 		{
diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php
index cd8e47ae46a..e7f64e273c2 100644
--- a/htdocs/product/stock/fiche.php
+++ b/htdocs/product/stock/fiche.php
@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2009 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2010 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005      Simon Tosser         <simon@kornog-computing.com>
  * Copyright (C) 2005-2009 Regis Houssin        <regis@dolibarr.fr>
  *
@@ -124,14 +124,14 @@ if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
 		{
 			$_GET["action"] = 'edit';
 			$_GET["id"] = $_POST["id"];
-			$mesg = '<div class="error">Fiche non mise � jour !' . "<br>" . $entrepot->error.'</div>';
+			$mesg = '<div class="error">'.$entrepot->error.'</div>';
 		}
 	}
 	else
 	{
 		$_GET["action"] = 'edit';
 		$_GET["id"] = $_POST["id"];
-		$mesg = '<div class="error">Fiche non mise � jour !' . "<br>" . $entrepot->error.'</div>';
+		$mesg = '<div class="error">'.$entrepot->error.'</div>';
 	}
 }
 
-- 
GitLab