From 2ffe5b9717d0e03a7b4c8cc933821f9a943c2041 Mon Sep 17 00:00:00 2001
From: Regis Houssin <regis@dolibarr.fr>
Date: Sun, 16 Dec 2007 12:27:38 +0000
Subject: [PATCH] =?UTF-8?q?Fix:=20ajout=20v=E9rification=20sur=20la=20fonc?=
 =?UTF-8?q?tion=20loadXMLDoc?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 htdocs/lib/lib_head.js | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/htdocs/lib/lib_head.js b/htdocs/lib/lib_head.js
index b27c9e8f7c8..86639901dd1 100644
--- a/htdocs/lib/lib_head.js
+++ b/htdocs/lib/lib_head.js
@@ -145,7 +145,7 @@ function loadMonth(base,month,year,ymd)
 		theURL+="&sd="+ymd;
 	}
 
-	loadXMLDoc(theURL,null,false);
+	loadXMLDoc(theURL,alertContents,false);
 	showDP.box.innerHTML=req.responseText;	
 }
 
@@ -259,6 +259,13 @@ function loadXMLDoc(url,readyStateFunction,async)
 	// branch for native XMLHttpRequest object
 	if (window.XMLHttpRequest) {
 		req = new XMLHttpRequest();
+		if (req.overrideMimeType) {
+      req.overrideMimeType('text/xml');
+    }
+    if (!req) {
+      alert('Cannot create XMLHTTP instance');
+      return false;
+    }
 		req.onreadystatechange = readyStateFunction;
 		req.open("GET", url, async);
 		req.send(null);
@@ -273,6 +280,17 @@ function loadXMLDoc(url,readyStateFunction,async)
 	}
 }
 
+function alertContents(httpRequest)
+{
+	if (httpRequest.readyState == 4) {
+		if (httpRequest.status == 200) {
+			alert(httpRequest.responseText);
+    } else {
+    	alert('There was a problem with the request.');
+    }
+  }
+}
+
 function hideSelectBoxes() {
 	var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);
 	if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE") > -1) {		
-- 
GitLab