From 2cd49043a644e2b137bae7dac083fa1e2a3d23ff Mon Sep 17 00:00:00 2001
From: philippe grand <philippe.grand@atoo-net.com>
Date: Fri, 11 Dec 2015 19:37:12 +0100
Subject: [PATCH] [Qual] Close database handler should be after Footer

---
 htdocs/don/info.php                       | 3 +--
 htdocs/don/list.php                       | 4 +---
 htdocs/don/payment/payment.php            | 4 +---
 htdocs/ecm/docfile.php                    | 3 +--
 htdocs/ecm/docmine.php                    | 3 +--
 htdocs/ecm/docother.php                   | 3 +--
 htdocs/expedition/list.php                | 3 +--
 htdocs/expensereport/card.php             | 3 +--
 htdocs/expensereport/payment/payment.php  | 4 +---
 htdocs/fichinter/info.php                 | 3 +--
 htdocs/fourn/facture/impayees.php         | 2 +-
 htdocs/fourn/facture/paiement.php         | 3 +--
 htdocs/fourn/product/list.php             | 4 +---
 htdocs/fourn/recap-fourn.php              | 4 +---
 htdocs/hrm/establishment/info.php         | 3 +--
 htdocs/loan/payment/payment.php           | 4 +---
 htdocs/product/stock/fiche-valo.php       | 3 +--
 htdocs/projet/admin/project.php           | 5 ++---
 htdocs/societe/checkvat/checkVatPopup.php | 1 +
 htdocs/societe/commerciaux.php            | 4 +---
 htdocs/societe/societecontact.php         | 6 +++---
 htdocs/user/group/perms.php               | 3 +--
 htdocs/user/ldap.php                      | 6 +-----
 23 files changed, 26 insertions(+), 55 deletions(-)

diff --git a/htdocs/don/info.php b/htdocs/don/info.php
index daa5c6e62de..1c51a1fa9f8 100644
--- a/htdocs/don/info.php
+++ b/htdocs/don/info.php
@@ -57,6 +57,5 @@ if ($id)
     print '</div>';
 }
 
-$db->close();
-
 llxFooter();
+$db->close();
diff --git a/htdocs/don/list.php b/htdocs/don/list.php
index 36c74826952..0a91e59593d 100644
--- a/htdocs/don/list.php
+++ b/htdocs/don/list.php
@@ -236,7 +236,5 @@ else
 	dol_print_error($db);
 }
 
-
-$db->close();
-
 llxFooter();
+$db->close();
diff --git a/htdocs/don/payment/payment.php b/htdocs/don/payment/payment.php
index da33a92e750..a0062632770 100644
--- a/htdocs/don/payment/payment.php
+++ b/htdocs/don/payment/payment.php
@@ -308,7 +308,5 @@ if (GETPOST("action") == 'create')
 	print "</form>\n";
 }
 
-
-$db->close();
-
 llxFooter();
+$db->close();
diff --git a/htdocs/ecm/docfile.php b/htdocs/ecm/docfile.php
index d533e1cf559..ce4bf480668 100644
--- a/htdocs/ecm/docfile.php
+++ b/htdocs/ecm/docfile.php
@@ -285,6 +285,5 @@ if ($_GET["action"] != 'edit')
 
 
 // End of page
-$db->close();
-
 llxFooter();
+$db->close();
diff --git a/htdocs/ecm/docmine.php b/htdocs/ecm/docmine.php
index 13f5ee516b9..ae4e6c6b08c 100644
--- a/htdocs/ecm/docmine.php
+++ b/htdocs/ecm/docmine.php
@@ -364,6 +364,5 @@ if ($user->rights->ecm->read)
 */
 
 // End of page
-$db->close();
-
 llxFooter();
+$db->close();
diff --git a/htdocs/ecm/docother.php b/htdocs/ecm/docother.php
index 2f0f231523f..addf559e01c 100644
--- a/htdocs/ecm/docother.php
+++ b/htdocs/ecm/docother.php
@@ -167,6 +167,5 @@ if ($mesg) { print $mesg."<br>"; }
 print $langs->trans("FeatureNotYetAvailable");
 
 // End of page
-$db->close();
-
 llxFooter();
+$db->close();
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index 6d8dc1d22df..5339538901e 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -237,6 +237,5 @@ else
 	dol_print_error($db);
 }
 
-$db->close();
-
 llxFooter();
+$db->close();
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index e7b0be3d6d5..aa36b690619 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -1198,9 +1198,8 @@ else
 					print $langs->trans('NotUserRightToView');
 					print '</div>';
 
-					$db->close();
-
 					llxFooter();
+					$db->close();
 
 					exit;
 				}
diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php
index 94f37389fc9..b7d40b2e65b 100644
--- a/htdocs/expensereport/payment/payment.php
+++ b/htdocs/expensereport/payment/payment.php
@@ -313,7 +313,5 @@ if (GETPOST("action") == 'create')
 	print "</form>\n";
 }
 
-
-$db->close();
-
 llxFooter();
+$db->close();
diff --git a/htdocs/fichinter/info.php b/htdocs/fichinter/info.php
index f577913ebe2..5be4af71d27 100644
--- a/htdocs/fichinter/info.php
+++ b/htdocs/fichinter/info.php
@@ -65,6 +65,5 @@ print '</td></tr></table>';
 
 print '</div>';
 
-$db->close();
-
 llxFooter();
+$db->close();
diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php
index ecb6b990a64..ccb6671ba3a 100644
--- a/htdocs/fourn/facture/impayees.php
+++ b/htdocs/fourn/facture/impayees.php
@@ -299,5 +299,5 @@ if ($user->rights->fournisseur->facture->lire)
 }
 
 // End of page
-$db->close();
 llxFooter();
+$db->close();
diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php
index d500f8eceb1..599ce879d8e 100644
--- a/htdocs/fourn/facture/paiement.php
+++ b/htdocs/fourn/facture/paiement.php
@@ -621,6 +621,5 @@ if (empty($action))
     }
 }
 
-$db->close();
-
 llxFooter();
+$db->close();
diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php
index fc04c6838ab..f21390776d3 100644
--- a/htdocs/fourn/product/list.php
+++ b/htdocs/fourn/product/list.php
@@ -249,7 +249,5 @@ else
 	dol_print_error($db);
 }
 
-
-$db->close();
-
 llxFooter();
+$db->close();
diff --git a/htdocs/fourn/recap-fourn.php b/htdocs/fourn/recap-fourn.php
index eb976acb4a0..acf4c9400d3 100644
--- a/htdocs/fourn/recap-fourn.php
+++ b/htdocs/fourn/recap-fourn.php
@@ -213,7 +213,5 @@ else
     dol_print_error($db);
 }
 
-
-$db->close();
-
 llxFooter();
+$db->close();
diff --git a/htdocs/hrm/establishment/info.php b/htdocs/hrm/establishment/info.php
index 806bd893fbb..1ef523fa607 100644
--- a/htdocs/hrm/establishment/info.php
+++ b/htdocs/hrm/establishment/info.php
@@ -53,6 +53,5 @@ if ($id)
     print '</div>';
 }
 
-$db->close();
-
 llxFooter();
+$db->close();
diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php
index f095272d5f2..06061da5c22 100644
--- a/htdocs/loan/payment/payment.php
+++ b/htdocs/loan/payment/payment.php
@@ -307,7 +307,5 @@ if ($_GET["action"] == 'create')
 	print "</form>\n";
 }
 
-
-$db->close();
-
 llxFooter();
+$db->close();
diff --git a/htdocs/product/stock/fiche-valo.php b/htdocs/product/stock/fiche-valo.php
index 10cdb0144ac..8add246afa2 100644
--- a/htdocs/product/stock/fiche-valo.php
+++ b/htdocs/product/stock/fiche-valo.php
@@ -141,6 +141,5 @@ if ($_GET["id"])
 	print "</div>";
 }
 
-$db->close();
-
 llxFooter();
+$db->close();
diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php
index f42fc7c4720..400560d0040 100644
--- a/htdocs/projet/admin/project.php
+++ b/htdocs/projet/admin/project.php
@@ -2,7 +2,7 @@
 /* Copyright (C) 2010-2014	Regis Houssin		<regis.houssin@capnetworks.com>
  * Copyright (C) 2011		Laurent Destailleur	<eldy@users.sourceforge.net>
  * Copyright (C) 2011-2012	Juanjo Menent		<jmenent@2byte.es>
- * Copyright (C) 2011-2013	Philippe Grand		<philippe.grand@atoo-net.com>
+ * Copyright (C) 2011-2015	Philippe Grand		<philippe.grand@atoo-net.com>
  * Copyright (C) 2013		Florian Henry		<florian.henry@open-concept.pro>
  * Copyright (C) 2015		Juanjo Menent		<jmenent@2byte.es>
  * Copyright (C) 2015       Marcos García       <marcosgdf@gmail.com>
@@ -935,6 +935,5 @@ else
 }
 print '</tr></table></form>';
 
-$db->close();
-
 llxFooter();
+$db->close();
diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php
index 152cd5d9a3f..702dbb0a08a 100644
--- a/htdocs/societe/checkvat/checkVatPopup.php
+++ b/htdocs/societe/checkvat/checkVatPopup.php
@@ -171,3 +171,4 @@ if ($messagetoshow)
 
 
 llxFooter();
+$db->close();
diff --git a/htdocs/societe/commerciaux.php b/htdocs/societe/commerciaux.php
index 12a1612ab1d..b35e7096ef3 100644
--- a/htdocs/societe/commerciaux.php
+++ b/htdocs/societe/commerciaux.php
@@ -256,7 +256,5 @@ if ($socid)
 
 }
 
-
-$db->close();
-
 llxFooter();
+$db->close();
diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php
index 691f930b767..69298f263e8 100644
--- a/htdocs/societe/societecontact.php
+++ b/htdocs/societe/societecontact.php
@@ -2,9 +2,9 @@
 /* Copyright (C) 2005     	Patrick Rouillon    <patrick@rouillon.net>
  * Copyright (C) 2005-2011	Laurent Destailleur <eldy@users.sourceforge.net>
  * Copyright (C) 2005-2012	Regis Houssin       <regis.houssin@capnetworks.com>
- * Copyright (C) 2011-2012	Philippe Grand      <philippe.grand@atoo-net.com>
+ * Copyright (C) 2011-2015	Philippe Grand      <philippe.grand@atoo-net.com>
  * Copyright (C) 2014		Charles-Fr Benke	<charles.fr@benke.fr>
- * Copyright (C) 2015      Marcos García        <marcosgdf@gmail.com>
+ * Copyright (C) 2015       Marcos García       <marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -333,5 +333,5 @@ if ($id > 0 || ! empty($ref))
 	}
 }
 
-$db->close();
 llxFooter();
+$db->close();
diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php
index a910753c643..11e08988de6 100644
--- a/htdocs/user/group/perms.php
+++ b/htdocs/user/group/perms.php
@@ -326,6 +326,5 @@ if ($id)
     print '</table>';
 }
 
-$db->close();
-
 llxFooter();
+$db->close();
diff --git a/htdocs/user/ldap.php b/htdocs/user/ldap.php
index 968c3e565a5..34d29150251 100644
--- a/htdocs/user/ldap.php
+++ b/htdocs/user/ldap.php
@@ -209,9 +209,5 @@ else
 
 print '</table>';
 
-
-
-
-$db->close();
-
 llxFooter();
+$db->close();
-- 
GitLab