From cfc337a79a52fba9e0dd19a7881c14356ac55174 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Sun, 20 Jul 2014 15:27:38 +0200
Subject: [PATCH] Qual: Enable php checkstyle rule Zend.Files.ClosingTag Fix:
 Solve a lot of checkstyle errors.

---
 dev/codesniffer/ruleset.dtd                   |  3 ++-
 dev/codesniffer/ruleset.xml                   |  6 ++++-
 htdocs/core/class/interfaces.class.php        | 20 +++++++++++++---
 .../core/triggers/DolibarrTriggers.class.php  | 10 ++++----
 .../interface_20_all_Logevents.class.php      | 12 +++++-----
 ...face_20_modPaypal_PaypalWorkflow.class.php | 12 +++++-----
 ...e_20_modWorkflow_WorkflowManager.class.php |  8 +++----
 ...terface_50_modAgenda_ActionsAuto.class.php |  6 ++---
 ...interface_50_modLdap_Ldapsynchro.class.php |  6 ++---
 ...odMailmanspip_Mailmanspipsynchro.class.php |  6 ++---
 ..._50_modNotification_Notification.class.php |  6 ++---
 .../interface_90_all_Demo.class.php-NORUN     |  6 ++---
 htdocs/livraison/class/livraison.class.php    |  6 ++---
 htdocs/opensurvey/fonctions.php               | 24 +++++++++----------
 htdocs/opensurvey/results.php                 |  1 -
 htdocs/printipp/admin/printipp.php            |  7 +++---
 htdocs/societe/ajaxcompanies.php              |  2 --
 .../canvas/actions_card_common.class.php      |  2 --
 test/phpunit/CommandeFournisseurTest.php      |  1 -
 test/phpunit/CommandeTest.php                 |  1 -
 test/phpunit/CommonObjectTest.php             |  1 -
 test/phpunit/CompanyBankAccountTest.php       |  1 -
 test/phpunit/EntrepotTest.php                 |  1 -
 test/phpunit/ExportTest.php                   |  1 -
 test/phpunit/FactureRecTest.php               | 13 +++++-----
 test/phpunit/FactureTest.php                  |  1 -
 test/phpunit/FunctionsLibTest.php             |  1 -
 test/phpunit/PropalTest.php                   |  1 -
 test/phpunit/SocieteTest.php                  |  1 -
 test/phpunit/UserTest.php                     |  1 -
 test/phpunit/WebservicesInvoicesTest.php      |  1 -
 test/phpunit/WebservicesThirdpartyTest.php    |  1 -
 32 files changed, 81 insertions(+), 88 deletions(-)

diff --git a/dev/codesniffer/ruleset.dtd b/dev/codesniffer/ruleset.dtd
index 0d498bb033c..e307d564e12 100755
--- a/dev/codesniffer/ruleset.dtd
+++ b/dev/codesniffer/ruleset.dtd
@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!ELEMENT ruleset (description,rule+)>
+<!ELEMENT ruleset (description,exclude-pattern*,rule+)>
 <!ATTLIST ruleset name CDATA "">
 <!ELEMENT description (#PCDATA)>
+<!ELEMENT exclude-pattern (#PCDATA)>
 <!ELEMENT rule (properties*,severity*)>
 <!ATTLIST rule ref CDATA "">
 <!ELEMENT properties (property+)>
diff --git a/dev/codesniffer/ruleset.xml b/dev/codesniffer/ruleset.xml
index 9d605cefbb1..ba1a1ba65c3 100755
--- a/dev/codesniffer/ruleset.xml
+++ b/dev/codesniffer/ruleset.xml
@@ -3,6 +3,10 @@
 <ruleset name="Dolibarr">
 	<description>Dolibarr coding standard.</description>
 
+	<exclude-pattern>*/conf.php</exclude-pattern>
+	<exclude-pattern>*/includes/*</exclude-pattern>
+	<exclude-pattern>*/documents/*</exclude-pattern>
+
 	<!-- List of all tests -->
 
 	<rule ref="Internal.NoCodeFound">
@@ -19,7 +23,7 @@
 	</rule>
 
     <!-- The closing ?> tag MUST be omitted from files containing only PHP. -->
-    <!-- <rule ref="Zend.Files.ClosingTag"/> -->
+    <rule ref="Zend.Files.ClosingTag"/>
 
     <!-- <rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" /> -->
 
diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php
index 2f70c91ac6d..50a9cced421 100644
--- a/htdocs/core/class/interfaces.class.php
+++ b/htdocs/core/class/interfaces.class.php
@@ -149,9 +149,23 @@ class Interfaces
             $objMod = new $modName($this->db);
             if ($objMod)
             {
-                dol_syslog(get_class($this)."::run_triggers action=".$action." Launch triggers for file '".$files[$key]."'", LOG_INFO);
+            	$result=0;
+
+				if (method_exists($objMod, 'runTrigger'))	// New method to implement
+				{
+	                dol_syslog(get_class($this)."::run_triggers action=".$action." Launch runTrigger for file '".$files[$key]."'", LOG_INFO);
+	                $result=$objMod->runTrigger($action,$object,$user,$langs,$conf);
+				}
+				elseif (method_exists($objMod, 'run_trigger'))	// Deprecated method
+				{
+	                dol_syslog(get_class($this)."::run_triggers action=".$action." Launch run_trigger for file '".$files[$key]."'", LOG_INFO);
+					$result=$objMod->run_trigger($action,$object,$user,$langs,$conf);
+				}
+				else
+				{
+	                dol_syslog(get_class($this)."::run_triggers action=".$action." A trigger was declared for class ".get_class($objMod)." but method runTrigger was not found", LOG_ERR);
+				}
 
-                $result=$objMod->run_trigger($action,$object,$user,$langs,$conf);
                 if ($result > 0)
                 {
                     // Action OK
@@ -173,7 +187,7 @@ class Interfaces
                 }
             }
             else
-            {
+			{
                 dol_syslog(get_class($this)."::run_triggers action=".$action." Failed to instantiate trigger for file '".$files[$key]."'", LOG_ERR);
             }
         }
diff --git a/htdocs/core/triggers/DolibarrTriggers.class.php b/htdocs/core/triggers/DolibarrTriggers.class.php
index 8d3227e6482..1fd29359d74 100644
--- a/htdocs/core/triggers/DolibarrTriggers.class.php
+++ b/htdocs/core/triggers/DolibarrTriggers.class.php
@@ -1,7 +1,5 @@
 <?php
-
-/*
- * Copyright (C) 2014 Marcos García         <marcosgdf@gmail.com>
+/* Copyright (C) 2014 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
@@ -135,15 +133,15 @@ abstract class DolibarrTriggers
 
 	/**
 	 * Function called when a Dolibarrr business event is done.
-	 * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
+	 * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
 	 *
 	 * @param string		$action		Event action code
 	 * @param Object		$object     Object
 	 * @param User		    $user       Object user
 	 * @param Translate 	$langs      Object langs
 	 * @param conf		    $conf       Object conf
-	 * @return int         			<0 if KO, 0 if no triggered ran, >0 if OK
+	 * @return int         				<0 if KO, 0 if no triggered ran, >0 if OK
 	 */
-	abstract function run_trigger($action, $object, User $user, Translate $langs, Conf $conf);
+	abstract function runTrigger($action, $object, User $user, Translate $langs, Conf $conf);
 
 }
\ No newline at end of file
diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php
index a16eb82e2ab..0770af54520 100644
--- a/htdocs/core/triggers/interface_20_all_Logevents.class.php
+++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php
@@ -36,16 +36,16 @@ class InterfaceLogevents extends DolibarrTriggers
 
 	/**
 	 * Function called when a Dolibarrr business event is done.
-	 * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
+	 * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
 	 *
 	 * @param string		$action		Event action code
 	 * @param Object		$object     Object
-	 * @param User		$user       Object user
-	 * @param Translate	$langs      Object langs
-	 * @param conf		$conf       Object conf
-	 * @return int         			<0 if KO, 0 if no triggered ran, >0 if OK
+	 * @param User			$user       Object user
+	 * @param Translate		$langs      Object langs
+	 * @param conf			$conf       Object conf
+	 * @return int         				<0 if KO, 0 if no triggered ran, >0 if OK
 	 */
-	public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
+	public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
     {
     	if (! empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) return 0;	// Log events is disabled (hidden features)
 
diff --git a/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php b/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php
index 631b6a28639..13647814bb4 100644
--- a/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php
+++ b/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php
@@ -35,16 +35,16 @@ class InterfacePaypalWorkflow extends DolibarrTriggers
 
 	/**
 	 * Function called when a Dolibarrr business event is done.
-	 * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
+	 * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
 	 *
 	 * @param string		$action		Event action code
 	 * @param Object		$object     Object
-	 * @param User		$user       Object user
-	 * @param Translate	$langs      Object langs
-	 * @param conf		$conf       Object conf
-	 * @return int         			<0 if KO, 0 if no triggered ran, >0 if OK
+	 * @param User			$user       Object user
+	 * @param Translate		$langs      Object langs
+	 * @param conf			$conf       Object conf
+	 * @return int         				<0 if KO, 0 if no triggered ran, >0 if OK
 	 */
-	public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
+	public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
     {
         // Mettre ici le code a executer en reaction de l'action
         // Les donnees de l'action sont stockees dans $object
diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
index 074118ebdd4..c1e3995afa8 100644
--- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
+++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
@@ -37,16 +37,16 @@ class InterfaceWorkflowManager extends DolibarrTriggers
 
 	/**
 	 * Function called when a Dolibarrr business event is done.
-	 * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
+	 * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
 	 *
 	 * @param string		$action		Event action code
 	 * @param Object		$object     Object
 	 * @param User		    $user       Object user
 	 * @param Translate 	$langs      Object langs
 	 * @param conf		    $conf       Object conf
-	 * @return int         			<0 if KO, 0 if no triggered ran, >0 if OK
+	 * @return int         				<0 if KO, 0 if no triggered ran, >0 if OK
 	 */
-	public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
+	public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
     {
         if (empty($conf->workflow->enabled)) return 0;     // Module not active, we do nothing
 
@@ -116,7 +116,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
         		return $ret;
         	}
         }
-        
+
         // classify billed order
         if ($action == 'BILL_VALIDATE')
         {
diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
index 8ad12b34638..a30c26ece3b 100644
--- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
+++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
@@ -38,7 +38,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
 
 	/**
 	 * Function called when a Dolibarrr business event is done.
-	 * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
+	 * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
 	 *
 	 * Following properties must be filled:
 	 *      $object->actiontypecode (translation action code: AC_OTH, ...)
@@ -55,9 +55,9 @@ class InterfaceActionsAuto extends DolibarrTriggers
 	 * @param User		    $user       Object user
 	 * @param Translate 	$langs      Object langs
 	 * @param conf		    $conf       Object conf
-	 * @return int         			<0 if KO, 0 if no triggered ran, >0 if OK
+	 * @return int         				<0 if KO, 0 if no triggered ran, >0 if OK
 	 */
-	public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
+	public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
 	{
 		// Module not active, we do nothing
         if (empty($conf->agenda->enabled)) {
diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php
index f98d8bf5248..dcecdc26991 100644
--- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php
+++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php
@@ -37,16 +37,16 @@ class InterfaceLdapsynchro extends DolibarrTriggers
 
 	/**
 	 * Function called when a Dolibarrr business event is done.
-	 * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
+	 * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
 	 *
 	 * @param string		$action		Event action code
 	 * @param Object		$object     Object
 	 * @param User		    $user       Object user
 	 * @param Translate 	$langs      Object langs
 	 * @param conf		    $conf       Object conf
-	 * @return int         			<0 if KO, 0 if no triggered ran, >0 if OK
+	 * @return int         				<0 if KO, 0 if no triggered ran, >0 if OK
 	 */
-	public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
+	public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
     {
         if (empty($conf->ldap->enabled)) return 0;     // Module not active, we do nothing
 
diff --git a/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php b/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php
index 51f84d2f39e..d2c01f5f508 100644
--- a/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php
+++ b/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php
@@ -37,16 +37,16 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
 
 	/**
 	 * Function called when a Dolibarrr business event is done.
-	 * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
+	 * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
 	 *
 	 * @param string		$action		Event action code
 	 * @param Object		$object     Object
 	 * @param User		    $user       Object user
 	 * @param Translate 	$langs      Object langs
 	 * @param conf		    $conf       Object conf
-	 * @return int         			<0 if KO, 0 if no triggered ran, >0 if OK
+	 * @return int         				<0 if KO, 0 if no triggered ran, >0 if OK
 	 */
-	public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
+	public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
 	{
         if (empty($conf->mailmanspip->enabled)) return 0;     // Module not active, we do nothing
 
diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php
index 159b3575855..c26ca4e33ef 100644
--- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php
+++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php
@@ -46,16 +46,16 @@ class InterfaceNotification extends DolibarrTriggers
 
 	/**
 	 * Function called when a Dolibarrr business event is done.
-	 * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
+	 * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
 	 *
 	 * @param string		$action		Event action code
 	 * @param Object		$object     Object
 	 * @param User		    $user       Object user
 	 * @param Translate 	$langs      Object langs
 	 * @param conf		    $conf       Object conf
-	 * @return int         			<0 if KO, 0 if no triggered ran, >0 if OK
+	 * @return int         				<0 if KO, 0 if no triggered ran, >0 if OK
 	 */
-	public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
+	public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
 	{
 		if (empty($conf->notification->enabled)) return 0;     // Module not active, we do nothing
 
diff --git a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN
index 1599ec2c45d..d1f093af09b 100644
--- a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN
+++ b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN
@@ -43,16 +43,16 @@ class InterfaceDemo extends DolibarrTriggers
 
 	/**
      * Function called when a Dolibarrr business event is done.
-     * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
+	 * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
      *
      * @param string		$action		Event action code
      * @param Object		$object     Object
      * @param User		    $user       Object user
      * @param Translate 	$langs      Object langs
      * @param conf		    $conf       Object conf
-     * @return int         			<0 if KO, 0 if no triggered ran, >0 if OK
+     * @return int         				<0 if KO, 0 if no triggered ran, >0 if OK
      */
-    public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
+    public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
     {
 		// Put here code you want to execute when a Dolibarr business events occurs.
         // Data and type of action are stored into $object and $action
diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php
index c46e333c191..7db42b6ac44 100644
--- a/htdocs/livraison/class/livraison.class.php
+++ b/htdocs/livraison/class/livraison.class.php
@@ -606,8 +606,8 @@ class Livraison extends CommonObject
                     if ($result < 0)
                     {
                         $this->db->rollback();
-                        return -4; 
-                    }            
+                        return -4;
+                    }
                     // End call triggers
 
 					return 1;
@@ -959,5 +959,3 @@ class LivraisonLigne
 	}
 
 }
-
-?>
diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php
index c3c80a59b86..b65abcaffe9 100644
--- a/htdocs/opensurvey/fonctions.php
+++ b/htdocs/opensurvey/fonctions.php
@@ -25,14 +25,14 @@
 /**
  * Returns an array with the tabs for the "Opensurvey poll" section
  * It loads tabs from modules looking for the entity Opensurveyso
- * 
+ *
  * @param Opensurveysondage $object Current viewing poll
  * @return array Tabs for the opensurvey section
  */
 function opensurvey_prepare_head(Opensurveysondage $object) {
-	
+
 	global $langs, $conf;
-	
+
 	$h = 0;
 	$head = array();
 
@@ -40,7 +40,7 @@ function opensurvey_prepare_head(Opensurveysondage $object) {
 	$head[0][1] = $langs->trans("Card");
 	$head[0][2] = 'general';
 	$h++;
-	
+
 	$head[1][0] = 'results.php?id='.$object->id_sondage;
 	$head[1][1] = $langs->trans("SurveyResults");
 	$head[1][2] = 'preview';
@@ -111,12 +111,12 @@ function showlogo()
 			$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=companylogo&amp;file=thumbs/'.urlencode($mysoc->logo_small);
 		}
 	}
-	
+
 	if (!$urllogo && (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png')))
 	{
 		$urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
 	}
-	
+
 	print '<div style="text-align:center"><img alt="Logo" id="logosubscribe" title="" src="'.$urllogo.'"/></div>';
 	print '<br>';
 }
@@ -205,14 +205,14 @@ function dol_survey_random($car)
 function ajouter_sondage()
 {
 	global $db, $user;
-	
+
 	require_once DOL_DOCUMENT_ROOT.'/opensurvey/class/opensurveysondage.class.php';
 
 	$sondage=dol_survey_random(16);
 
 	$allow_comments = empty($_SESSION['allow_comments']) ? 0 : 1;
 	$allow_spy = empty($_SESSION['allow_spy']) ? 0 : 1;
-	
+
 	// Insert survey
 	$opensurveysondage = new Opensurveysondage($db);
 	$opensurveysondage->id_sondage = $sondage;
@@ -226,9 +226,9 @@ function ajouter_sondage()
 	$opensurveysondage->allow_comments = $allow_comments;
 	$opensurveysondage->allow_spy = $allow_spy;
 	$opensurveysondage->sujet = $_SESSION['toutchoix'];
-	
+
 	$res = $opensurveysondage->create($user);
-	
+
 	if ($res < 0) {
 		dol_print_error($db);
 	}
@@ -243,11 +243,9 @@ function ajouter_sondage()
 	unset($_SESSION['toutchoix']);
 	unset($_SESSION['totalchoixjour']);
 	unset($_SESSION['champdatefin']);
-	
+
 	$urlback=dol_buildpath('/opensurvey/card.php',1).'?id='.$sondage;
 
 	header("Location: ".$urlback);
 	exit();
 }
-
-?>
diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php
index 7dbdac8c2bc..63c56f9d5e3 100644
--- a/htdocs/opensurvey/results.php
+++ b/htdocs/opensurvey/results.php
@@ -1078,4 +1078,3 @@ print '<a name="bas"></a>'."\n";
 llxFooterSurvey();
 
 $db->close();
-?>
diff --git a/htdocs/printipp/admin/printipp.php b/htdocs/printipp/admin/printipp.php
index 08202b38f8e..68dee5ca22b 100644
--- a/htdocs/printipp/admin/printipp.php
+++ b/htdocs/printipp/admin/printipp.php
@@ -149,7 +149,7 @@ if ($mode == 'config' && $user->admin)
     print $langs->trans("PRINTIPP_PASSWORD").'</td><td>';
     print '<input size="32" type="text" name="PRINTIPP_PASSWORD" value="'.$conf->global->PRINTIPP_PASSWORD.'">';
     print '</td></tr>';
-    
+
     //$var=true;
     //print '<tr class="liste_titre">';
     //print '<td>'.$langs->trans("OtherParameter").'</td>';
@@ -181,7 +181,7 @@ if ($mode == 'test' && $user->admin)
     print '<td>Media</td>';
     print '<td>Supported</td>';
     print "</tr>\n";
-    
+
     $list = $printer->getlist_available_printers();
     $var = true;
     foreach ($list as $value)
@@ -203,7 +203,7 @@ if ($mode == 'test' && $user->admin)
         print "</tr>\n";
     }
     print '</table>';
-    
+
     if (count($list) == 0) print $langs->trans("NoPrinterFound");
 }
 
@@ -212,4 +212,3 @@ dol_fiche_end();
 llxFooter();
 
 $db->close();
-?>
diff --git a/htdocs/societe/ajaxcompanies.php b/htdocs/societe/ajaxcompanies.php
index 36abbb909ad..8771c0219c7 100644
--- a/htdocs/societe/ajaxcompanies.php
+++ b/htdocs/societe/ajaxcompanies.php
@@ -110,5 +110,3 @@ else
 {
     echo json_encode(array('nom'=>'ErrorBadParameter','label'=>'ErrorBadParameter','key'=>'ErrorBadParameter','value'=>'ErrorBadParameter'));
 }
-
-?>
\ No newline at end of file
diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php
index 1ee163038bb..27630fa4dfe 100644
--- a/htdocs/societe/canvas/actions_card_common.class.php
+++ b/htdocs/societe/canvas/actions_card_common.class.php
@@ -705,5 +705,3 @@ abstract class ActionsCardCommon
     }
 
 }
-
-?>
diff --git a/test/phpunit/CommandeFournisseurTest.php b/test/phpunit/CommandeFournisseurTest.php
index 2c83b4fdfc3..90c0d10e3fb 100644
--- a/test/phpunit/CommandeFournisseurTest.php
+++ b/test/phpunit/CommandeFournisseurTest.php
@@ -338,4 +338,3 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase
     }
 
 }
-?>
\ No newline at end of file
diff --git a/test/phpunit/CommandeTest.php b/test/phpunit/CommandeTest.php
index 451e886a761..8a2e3f57120 100644
--- a/test/phpunit/CommandeTest.php
+++ b/test/phpunit/CommandeTest.php
@@ -265,4 +265,3 @@ class CommandeTest extends PHPUnit_Framework_TestCase
     }
 
 }
-?>
\ No newline at end of file
diff --git a/test/phpunit/CommonObjectTest.php b/test/phpunit/CommonObjectTest.php
index cbdde31e14d..a22146dfc2a 100644
--- a/test/phpunit/CommonObjectTest.php
+++ b/test/phpunit/CommonObjectTest.php
@@ -183,4 +183,3 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase
     	return $result;
     }
 }
-?>
\ No newline at end of file
diff --git a/test/phpunit/CompanyBankAccountTest.php b/test/phpunit/CompanyBankAccountTest.php
index 24d6ad03d80..a105bb37a53 100644
--- a/test/phpunit/CompanyBankAccountTest.php
+++ b/test/phpunit/CompanyBankAccountTest.php
@@ -233,4 +233,3 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase
     }
 
 }
-?>
diff --git a/test/phpunit/EntrepotTest.php b/test/phpunit/EntrepotTest.php
index efd5f54008f..53788d71dab 100755
--- a/test/phpunit/EntrepotTest.php
+++ b/test/phpunit/EntrepotTest.php
@@ -257,4 +257,3 @@ class EntrepotTest extends PHPUnit_Framework_TestCase
         return;
     }
 }
-?>
\ No newline at end of file
diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php
index d5938fc4691..49695ab1946 100755
--- a/test/phpunit/ExportTest.php
+++ b/test/phpunit/ExportTest.php
@@ -265,4 +265,3 @@ class ExportTest extends PHPUnit_Framework_TestCase
         return true;
     }
 }
-?>
diff --git a/test/phpunit/FactureRecTest.php b/test/phpunit/FactureRecTest.php
index 4adace8ef9a..8933b9a73e0 100644
--- a/test/phpunit/FactureRecTest.php
+++ b/test/phpunit/FactureRecTest.php
@@ -131,7 +131,7 @@ class FactureRecTest extends PHPUnit_Framework_TestCase
 		$localobjectinv=new Facture($this->savdb);
 		$localobjectinv->initAsSpecimen();
 		$localobjectinv->create($user);
-		
+
 		$localobject=new FactureRec($this->savdb);
     	$localobject->initAsSpecimen();
     	$result=$localobject->create($user, $localobjectinv->id);
@@ -141,11 +141,11 @@ class FactureRecTest extends PHPUnit_Framework_TestCase
     	return $result;
     }
 
-    
-    
-    
-    
-    
+
+
+
+
+
     /**
      * Edit an object to test updates
      *
@@ -196,4 +196,3 @@ class FactureRecTest extends PHPUnit_Framework_TestCase
         return $retAr;
     }
 }
-?>
\ No newline at end of file
diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php
index 9551c6ce02e..a16ddbbbf47 100644
--- a/test/phpunit/FactureTest.php
+++ b/test/phpunit/FactureTest.php
@@ -329,4 +329,3 @@ class FactureTest extends PHPUnit_Framework_TestCase
         return $retAr;
     }
 }
-?>
diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php
index 2178ad6fb5a..8bf126e99c5 100755
--- a/test/phpunit/FunctionsLibTest.php
+++ b/test/phpunit/FunctionsLibTest.php
@@ -784,4 +784,3 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
     }
 
 }
-?>
diff --git a/test/phpunit/PropalTest.php b/test/phpunit/PropalTest.php
index 3cac847a01f..20b6a5afa38 100644
--- a/test/phpunit/PropalTest.php
+++ b/test/phpunit/PropalTest.php
@@ -265,4 +265,3 @@ class PropalTest extends PHPUnit_Framework_TestCase
     }
 
 }
-?>
diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php
index 162248f2e98..730d3d457a2 100755
--- a/test/phpunit/SocieteTest.php
+++ b/test/phpunit/SocieteTest.php
@@ -456,4 +456,3 @@ class SocieteTest extends PHPUnit_Framework_TestCase
     }
 
 }
-?>
diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php
index d161b3ce395..5df1549ea14 100644
--- a/test/phpunit/UserTest.php
+++ b/test/phpunit/UserTest.php
@@ -318,4 +318,3 @@ class UserTest extends PHPUnit_Framework_TestCase
     	return $retAr;
     }
 }
-?>
\ No newline at end of file
diff --git a/test/phpunit/WebservicesInvoicesTest.php b/test/phpunit/WebservicesInvoicesTest.php
index 12c01eeba70..20e01595375 100755
--- a/test/phpunit/WebservicesInvoicesTest.php
+++ b/test/phpunit/WebservicesInvoicesTest.php
@@ -181,4 +181,3 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
     }
 
 }
-?>
diff --git a/test/phpunit/WebservicesThirdpartyTest.php b/test/phpunit/WebservicesThirdpartyTest.php
index 8ef0c383955..64753dcc502 100755
--- a/test/phpunit/WebservicesThirdpartyTest.php
+++ b/test/phpunit/WebservicesThirdpartyTest.php
@@ -181,4 +181,3 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
     }
 
 }
-?>
-- 
GitLab