From 507c7bd930688cf6bb9ac0c450aee4c4c4d0fdf2 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Sat, 5 Feb 2011 03:34:25 +0000
Subject: [PATCH] New: Add some code to allow to transform any select list into
 an autocomplete list with just one line of code.

---
 htdocs/main.inc.php | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index b5ec392817e..93e11c3722d 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -867,8 +867,6 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
 		// Output standard javascript links
 		if (! $disablejs && $conf->use_javascript_ajax)
 		{
-			print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/lib/lib_head.js"></script>'."\n";
-
 			// Other external js
 			require_once DOL_DOCUMENT_ROOT.'/lib/ajax.lib.php';
 
@@ -876,7 +874,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
 			if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) { $mini='_mini'; $ext='.jgz'; }	// mini='_mini', ext='.gz'
 
 			// JQuery. Must be before other includes (prototype/scriptaculous/...)
-			print '<!-- Includes for JQuery -->'."\n";
+			print '<!-- Includes JS for JQuery -->'."\n";
             print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min'.$ext.'"></script>'."\n";
 			print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-ui-latest.custom.min'.$ext.'"></script>'."\n";
 			print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/tablednd/jquery.tablednd_0_5'.$ext.'"></script>'."\n";
@@ -889,14 +887,18 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
             // CKEditor
             if (! empty($conf->global->FCKEDITOR_EDITORNAME) && $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor')
             {
+                print '<!-- Includes JS for CKEditor -->'."\n";
                 print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/ckeditor/ckeditor'.$ext.'"></script>'."\n";
             }
+            // Global js function
+            print '<!-- Includes JS of Dolibarr -->'."\n";
+            print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/lib/lib_head.js"></script>'."\n";
 		}
 
 		// Output module javascript
 		if (is_array($arrayofjs))
 		{
-			print '<!-- Includes specific to page -->'."\n";
+			print '<!-- Includes JS specific to page -->'."\n";
 			foreach($arrayofjs as $jsfile)
 			{
 				if (! preg_match('/^\//',$jsfile)) $jsfile='/'.$jsfile;	// For backward compatibility
-- 
GitLab