diff --git a/ChangeLog b/ChangeLog
index 3aae68b567ad071e407a72a7a16fca0d468b9520..8f822d08771f0f022ce601a3aac676bc91e87135 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -37,6 +37,7 @@ English Dolibarr ChangeLog
 - Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme
 - Fix: [ bug #2542 ] Contracts store localtax preferences
 - Fix: Bad permission assignments for stock movements actions
+- Fix: [ bug #2891 ] Category hooks do not work
 
 ***** ChangeLog for 3.6.2 compared to 3.6.1 *****
 - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
@@ -205,6 +206,11 @@ Fix: [ bug #2577 ] Incorrect invoice status in "Linked objects" page of a projec
 Fix: [ bug #2576 ] Unable to edit a dictionary entry that has # in its ref
 Fix: [ bug #2758 ] Product::update sets product note to "null" when $prod->note is null
 Fix: [ bug #2757 ] Deleting product category photo gives "Forbidden access" error
+Fix: [ bug #2976 ] "Report" tab is the current tab but it is not marked as selected by the UI
+Fix: [ bug #2861 ] Undefined variable $res when migrating
+Fix: [ bug #2837 ] Product list table column header does not match column body
+Fix: [ bug #2835 ] Customer prices of a product shows incorrect history order
+Fix: [ bug #2814 ] JPEG photos are not displayed in Product photos page
 
 ***** ChangeLog for 3.5.6 compared to 3.5.5 *****
 Fix: Avoid missing class error for fetch_thirdparty method #1973
diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php
index 0c61ab8cca68467351dacda67ab8988505396ffc..cdca440da137c90a0d160aa60abd53ab0e88cf1e 100644
--- a/htdocs/categories/edit.php
+++ b/htdocs/categories/edit.php
@@ -56,6 +56,9 @@ $object = new Categorie($db);
 $extrafields = new ExtraFields($db);
 $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
 
+// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
+$hookmanager->initHooks(array('categorycard'));
+
 /*
  * Actions
  */
diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php
index 208cbb38331eb13af30d4d9ab89f37a6764b714a..566249748de06cfb2472dd51d9bd39d4292ca399 100644
--- a/htdocs/categories/fiche.php
+++ b/htdocs/categories/fiche.php
@@ -64,6 +64,9 @@ $object = new Categorie($db);
 $extrafields = new ExtraFields($db);
 $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
 
+// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
+$hookmanager->initHooks(array('categorycard'));
+
 /*
  *	Actions
  */
diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php
index 010306d1e0028296ba45fbbd185dac268020a379..f9df0aff71e839f277775a3349dac0a1fca081e0 100644
--- a/htdocs/categories/viewcat.php
+++ b/htdocs/categories/viewcat.php
@@ -63,6 +63,9 @@ $type=$object->type;
 $extrafields = new ExtraFields($db);
 $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
 
+// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
+$hookmanager->initHooks(array('categorycard'));
+
 /*
  *	Actions
  */
diff --git a/htdocs/compta/bank/virement.php b/htdocs/compta/bank/virement.php
index 9bf4fd9ea2e80dd20d4501837d8ce12dd019111c..66a61850ee89801c0b71b6e0f7e8477324d4f41e 100644
--- a/htdocs/compta/bank/virement.php
+++ b/htdocs/compta/bank/virement.php
@@ -1,7 +1,7 @@
 <?php
 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  * Copyright (C) 2004-2008 Laurent Destailleur  <eldy@users.sourceforge.net>
- * Copytight (C) 2005-2009 Regis Houssin        <regis.houssin@capnetworks.com>
+ * Copytight (C) 2005-2015 Regis Houssin        <regis.houssin@capnetworks.com>
  * Copytight (C) 2012	   Juanjo Menent        <jmenent@2byte.es>
  * Copyright (C) 2015      Marcos GarcĂ­a        <marcosgdf@gmail.com>
  *
@@ -180,7 +180,7 @@ print $form->select_comptes($account_to,'account_to',0,'',1);
 print "</td>\n";
 
 print "<td>";
-$form->select_date($dateo,'','','','','add');
+$form->select_date((! empty($dateo)?$dateo:''),'','','','','add');
 print "</td>\n";
 print '<td><input name="label" class="flat" type="text" size="40" value="'.$label.'"></td>';
 print '<td><input name="amount" class="flat" type="text" size="8" value="'.$amount.'"></td>';
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 7a07125f8115bba53b6339de03632342022506d6..c530f612d2959fa062eb00ffedfdf64a1be09b66 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -165,7 +165,7 @@ function dol_shutdown()
 	global $conf,$user,$langs,$db;
 	$disconnectdone=false; $depth=0;
 	if (is_object($db) && ! empty($db->connected)) { $depth=$db->transaction_opened; $disconnectdone=$db->close(); }
-	dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth)?' (Warn: db disconnection forced, transaction depth was '.$depth.')':''), (($disconnectdone && $depth)?LOG_WARNING:LOG_DEBUG));
+	dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth)?' (Warn: db disconnection forced, transaction depth was '.$depth.')':''), (($disconnectdone && $depth)?LOG_WARNING:LOG_INFO));
 }
 
 
diff --git a/htdocs/core/lib/report.lib.php b/htdocs/core/lib/report.lib.php
index 9c701441765c6c7cbece9a62f6635688f2754e18..1704dcf92e87cbdaa731f3e20731f06663fb387a 100644
--- a/htdocs/core/lib/report.lib.php
+++ b/htdocs/core/lib/report.lib.php
@@ -39,7 +39,7 @@
 */
 function report_header($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='')
 {
-	global $langs, $hselected;
+	global $langs;
 
 	print "\n\n<!-- debut cartouche rapport -->\n";
 
@@ -48,7 +48,7 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
 	$head[$h][1] = $langs->trans("Report");
 	$head[$h][2] = 'report';
 
-	dol_fiche_head($head, $hselected);
+	dol_fiche_head($head, 'report');
 
 	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
 	foreach($moreparam as $key => $value)
diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php
index 7262a3b3bd909e1ad51d1deece77567a4eea933c..a8c9434acec6716486a2cc1270247b8db6b624a3 100644
--- a/htdocs/core/tpl/objectline_create.tpl.php
+++ b/htdocs/core/tpl/objectline_create.tpl.php
@@ -184,7 +184,7 @@ else {
 	<td align="right"><?php
 	if (GETPOST('prod_entry_mode') != 'predef')
 	{
-		if ($seller->tva_assuj == "0") echo '<input type="hidden" name="tva_tx" value="0">0';
+		if ($seller->tva_assuj == "0") echo '<input type="hidden" name="tva_tx" value="0"> '.vatrate(0, true);
 		else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?$_POST["tva_tx"]:-1), $seller, $buyer);
 	}
 	?>
diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php
index 736346d0f721d8a2fa86764eab419c333de19379..5c67837f37371c5fc515ba6a8689b02e2f2542eb 100644
--- a/htdocs/install/upgrade2.php
+++ b/htdocs/install/upgrade2.php
@@ -3661,8 +3661,8 @@ function migrate_reload_modules($db,$langs,$conf)
     if (! empty($conf->global->MAIN_MODULE_SERVICE))    // Permission has changed into 2.7
     {
         dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Service");
-        if ($res) {
-            $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modService.class.php';
+	    $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modService.class.php';
+	    if ($res) {
             $mod=new modService($db);
             //$mod->remove('noboxes');
             $mod->init('newboxdefonly');
@@ -3671,8 +3671,8 @@ function migrate_reload_modules($db,$langs,$conf)
     if (! empty($conf->global->MAIN_MODULE_COMMANDE))   // Permission has changed into 2.9
     {
         dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Commande");
-        if ($res) {
-            $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modCommande.class.php';
+	    $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modCommande.class.php';
+	    if ($res) {
             $mod=new modCommande($db);
             //$mod->remove('noboxes');
             $mod->init('newboxdefonly');
@@ -3681,8 +3681,8 @@ function migrate_reload_modules($db,$langs,$conf)
     if (! empty($conf->global->MAIN_MODULE_FACTURE))    // Permission has changed into 2.9
     {
         dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Facture");
-        if ($res) {
-            $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modFacture.class.php';
+	    $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modFacture.class.php';
+	    if ($res) {
             $mod=new modFacture($db);
             //$mod->remove('noboxes');
             $mod->init('newboxdefonly');
@@ -3732,8 +3732,8 @@ function migrate_reload_modules($db,$langs,$conf)
     if (! empty($conf->global->MAIN_MODULE_ECM))    // Permission has changed into 3.0 and 3.1
     {
         dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module ECM");
-        if ($res) {
-            $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modECM.class.php';
+	    $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modECM.class.php';
+	    if ($res) {
             $mod=new modECM($db);
             $mod->remove('noboxes');	// We need to remove because a permission id has been removed
             $mod->init('newboxdefonly');
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index da407b29ccc9c804c8430182f34b2f10533e55cf..b45d672b385b93bdad0da25bb8c04a7580ced2df 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -531,7 +531,7 @@ if (! defined('NOLOGIN'))
     {
         // We are already into an authenticated session
         $login=$_SESSION["dol_login"];
-        dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login);
+        dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login, LOG_DEBUG);
 
         $resultFetchUser=$user->fetch('',$login);
         if ($resultFetchUser <= 0)
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index c1497ce19eeb2a0954a86f8fd1d051960b60ae6d..13fc195ff06f724296f4dd90c0855d7c7deb7c6d 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -3196,7 +3196,7 @@ class Product extends CommonObject
 
     				if (! utf8_check($file)) $file=utf8_encode($file);	// To be sure file is stored in UTF8 in memory
 
-    				if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i', $dir.$file))
+    				if (dol_is_file($dir.$file) && preg_match('/(\.jp(e?)g|\.bmp|\.gif|\.png|\.tiff)$/i', $dir.$file))
     				{
     					$nbphoto++;
     					$photo = $file;
diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php
index 69453cb2a5039c8e20ba2138b4894d03549ead69..8c0e859ac4efeab15e353f7d5dab0f317c6e7bd0 100644
--- a/htdocs/product/liste.php
+++ b/htdocs/product/liste.php
@@ -49,8 +49,8 @@ $sall=GETPOST("sall");
 $type=GETPOST("type","int");
 $search_sale = GETPOST("search_sale");
 $search_categ = GETPOST("search_categ",'int');
-$tosell = GETPOST("tosell");
-$tobuy = GETPOST("tobuy");
+$tosell = GETPOST("tosell", 'int');
+$tobuy = GETPOST("tobuy", 'int');
 $fourn_id = GETPOST("fourn_id",'int');
 $catid = GETPOST('catid','int');
 
@@ -324,7 +324,7 @@ else
     		print '<td class="liste_titre" align="left">';
     		print '<input class="flat" type="text" name="snom" size="12" value="'.htmlspecialchars($snom).'">';
     		print '</td>';
-			
+
 			// Barcode
     		if (! empty($conf->barcode->enabled))
     		{
@@ -332,7 +332,7 @@ else
     			print '<input class="flat" type="text" name="sbarcode" size="6" value="'.htmlspecialchars($sbarcode).'">';
     			print '</td>';
     		}
-			
+
 			// Date modification
     		print '<td class="liste_titre">';
     		print '&nbsp;';
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index 856a68face6b45c21ce0039be4078fdf48cef171..9c916ec4b7440c41d93e15173113d895d94bb5d7 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -366,10 +366,10 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) {
 			// Prix mini
 			print '<tr><td>' . $langs->trans("MinPrice") . ' ' . $i . '</td><td>';
 			if (empty($object->multiprices_base_type["$i"])) $object->multiprices_base_type["$i"]="HT";
-			if ($object->multiprices_base_type["$i"] == 'TTC') 
+			if ($object->multiprices_base_type["$i"] == 'TTC')
 			{
 				print price($object->multiprices_min_ttc["$i"]) . ' ' . $langs->trans($object->multiprices_base_type["$i"]);
-			} 
+			}
 			else
 			{
 				print price($object->multiprices_min["$i"]) . ' ' . $langs->trans($object->multiprices_base_type["$i"]);
@@ -686,9 +686,8 @@ $sql .= " " . MAIN_DB_PREFIX . "user as u";
 $sql .= " WHERE fk_product = " . $object->id;
 $sql .= " AND p.entity IN (" . getEntity('productprice', 1) . ")";
 $sql .= " AND p.fk_user_author = u.rowid";
-if (! empty($socid) && ! empty($conf->global->PRODUIT_MULTIPRICES))
-	$sql .= " AND p.price_level = " . $soc->price_level;
-$sql .= " ORDER BY p.date_price DESC, p.price_level ASC";
+if (! empty($socid) && ! empty($conf->global->PRODUIT_MULTIPRICES)) $sql .= " AND p.price_level = " . $soc->price_level;
+$sql .= " ORDER BY p.date_price DESC, p.price_level ASC, p.rowid DESC";
 // $sql .= $db->plimit();
 
 dol_syslog("sql=" . $sql);