From 807fad406f2ef1e982c0db91e9893d1e6944b10b Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Sun, 1 Aug 2010 18:45:19 +0000
Subject: [PATCH] Fix: More log to hunt a bug

---
 htdocs/admin/facture.php | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php
index 4898730629a..37da46c0570 100644
--- a/htdocs/admin/facture.php
+++ b/htdocs/admin/facture.php
@@ -141,12 +141,16 @@ if ($_GET["action"] == 'setdoc')
 
 	// On active le modele
 	$type='invoice';
+
 	$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
-	$sql_del.= " WHERE nom = '".$_GET["value"]."'";
+	$sql_del.= " WHERE nom = '".addslashes($_GET["value"])."'";
 	$sql_del.= " AND type = '".$type."'";
 	$sql_del.= " AND entity = ".$conf->entity;
+    dol_syslog("facture.php ".$sql_del);
 	$result1=$db->query($sql_del);
-	$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type,entity) VALUES ('".$_GET["value"]."','".$type."',".$conf->entity.")";
+
+	$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type,entity) VALUES ('".addslashes($_GET["value"])."','".$type."',".$conf->entity.")";
+    dol_syslog("facture.php ".$sql);
 	$result2=$db->query($sql);
 	if ($result1 && $result2)
 	{
@@ -154,6 +158,7 @@ if ($_GET["action"] == 'setdoc')
 	}
 	else
 	{
+		dol_syslog("facture.php ".$db->lasterror(), LOG_ERR);
 		$db->rollback();
 	}
 }
-- 
GitLab