Qual: Normalize code

This commit is contained in:
Laurent Destailleur 2010-07-21 17:14:45 +00:00
parent 3d14382d4c
commit 3388764b14
11 changed files with 107 additions and 89 deletions

View File

@ -20,8 +20,14 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.php.core.PHPNature</nature> <nature>org.eclipse.php.core.PHPNature</nature>
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
</natures> </natures>
</projectDescription> </projectDescription>

View File

@ -1,8 +1,8 @@
#Thu Jun 24 20:12:23 CEST 2010 #Wed Jul 21 18:10:37 CEST 2010
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.php.debug.core.use-project-settings=true org.eclipse.php.debug.core.use-project-settings=true
org.eclipse.php.debug.coredefaultPHP=PHP Wamp 5.2.8 org.eclipse.php.debug.coredefaultPHP=PHP Wamp 5.3.0
org.eclipse.php.debug.coreoutput_encoding= org.eclipse.php.debug.coreoutput_encoding=UTF-8
org.eclipse.php.debug.corephp_debugger_id=org.eclipse.php.debug.core.xdebugDebugger org.eclipse.php.debug.corephp_debugger_id=org.eclipse.php.debug.core.xdebugDebugger
org.eclipse.php.debug.corestop_at_first_line_string=true org.eclipse.php.debug.corestop_at_first_line_string=true
org.eclipse.php.debug.coretransfer_encoding= org.eclipse.php.debug.coretransfer_encoding=UTF-8

View File

@ -14,3 +14,8 @@ Choose a PHP version,
Set parameter string with Set parameter string with
--src %f --config "phpstandard.cfg.xml" --format console --src %f --config "phpstandard.cfg.xml" --format console
Choose php as Filename extension Choose php as Filename extension
Check Print PHP output to console
Then add patern
* %f INFO Line:%n - %m Warning
* %f WARNING Line:%n - %m Warning
* %f ERROR Line:%n - %m Error

View File

@ -6,13 +6,15 @@
<!-- **************** --> <!-- **************** -->
<!-- Check Constant Naming --> <!-- Check Constant Naming -->
<!-- Disabled to avoid warning with $sql="SELECT ..."
<test name="constantNaming" regexp="/^[A-Z_][A-Z_]*[A-Z_]$/" level="ERROR"/> <test name="constantNaming" regexp="/^[A-Z_][A-Z_]*[A-Z_]$/" level="ERROR"/>
-->
<!-- Check Variable Naming --> <!-- Check Variable Naming -->
<test name="variableNaming" regexp="/^[a-z_][a-zA-Z0-9]*$/" /> <test name="variableNaming" regexp="/^[a-z_][a-zA-Z0-9]*$/" />
<!-- Check Function Naming --> <!-- Check Function Naming -->
<test name="functionNaming" regexp="/^[a-z]/" level="ERROR"/> <test name="functionNaming" regexp="/^[a-z_]/" level="ERROR"/>
<!-- Check Private Function Naming --> <!-- Check Private Function Naming -->
<test name="privateFunctionNaming" regexp="/^_[a-z]/" level="ERROR"/> <test name="privateFunctionNaming" regexp="/^_[a-z]/" level="ERROR"/>
@ -37,7 +39,7 @@
<test name="noShortPhpCodeTag"/> <test name="noShortPhpCodeTag"/>
<!-- Test if a PHP closing file is present at the end of a file --> <!-- Test if a PHP closing file is present at the end of a file -->
<test name="noFileCloseTag"/> <!-- <test name="noFileCloseTag"/> -->
<!-- Test if a file finish with some inner HTML (OK for some view but could provoque "header already sent" error) --> <!-- Test if a file finish with some inner HTML (OK for some view but could provoque "header already sent" error) -->
<test name="noFileFinishHTML" level="ERROR" /> <test name="noFileFinishHTML" level="ERROR" />
@ -72,7 +74,7 @@
<!-- sl = same line --> <!-- sl = same line -->
<!-- nl = new line --> <!-- nl = new line -->
<test name="controlStructOpenCurly"> <test name="controlStructOpenCurly">
<property name="position" value="sl"/> <property name="position" value="nl"/>
</test> </test>
<!-- Check the position of the close curly brace --> <!-- Check the position of the close curly brace -->
@ -82,11 +84,9 @@
<!-- Check the position of the open curly brace after a function --> <!-- Check the position of the open curly brace after a function -->
<!-- sl = same line --> <!-- sl = same line -->
<!-- nl = new line --> <!-- nl = new line -->
<!--
<test name="funcDefinitionOpenCurly"> <test name="funcDefinitionOpenCurly">
<property name="position" value="sl"/> <property name="position" value="nl"/>
</test> </test>
-->
<!-- Check the position of the else --> <!-- Check the position of the else -->
<!-- sl = same line --> <!-- sl = same line -->
@ -111,24 +111,31 @@
<!-- Check for the (required) presence of a white space after some tokens (like ,) --> <!-- Check for the (required) presence of a white space after some tokens (like ,) -->
<!--
<test name="checkWhiteSpaceAfter"> <test name="checkWhiteSpaceAfter">
<exception value="."/> <!-- Exceptions to this rule --> <exception value="."/>
</test> </test>
-->
<!-- Check for the (required) presence of a white space before some tokens --> <!-- Check for the (required) presence of a white space before some tokens -->
<!--
<test name="checkWhiteSpaceBefore"> <test name="checkWhiteSpaceBefore">
<exception value="."/> <!-- Exceptions to this rule --> <exception value="."/>
<exception value=":"/> <!-- Because of the switch/case --> <exception value=":"/>
</test> </test>
-->
<!-- Check that there is no space before before some tokens --> <!-- Check that there is no space before before some tokens -->
<!--
<test name="noSpaceBeforeToken" level="INFO"> <test name="noSpaceBeforeToken" level="INFO">
</test> </test>
-->
<!-- Check that there is no space after some tokens --> <!-- Check that there is no space after some tokens -->
<!--
<test name="noSpaceAfterToken" level="INFO"> <test name="noSpaceAfterToken" level="INFO">
</test> </test>
-->
<!-- **************** --> <!-- **************** -->
<!-- Metrics --> <!-- Metrics -->
@ -173,9 +180,9 @@
<item value="print_r"/> <item value="print_r"/>
<item value="var_dump"/> <item value="var_dump"/>
<item value="dl"/> <item value="dl"/>
<item value="exec"/> <!--<item value="exec"/>-->
<item value="passthru"/> <item value="passthru"/>
<item value="delete"/> <!-- <item value="delete"/> We disable because of false report when using method delete -->
<item value="ereg_replace"/> <item value="ereg_replace"/>
<item value="ereg"/> <item value="ereg"/>
<item value="eregi"/> <item value="eregi"/>
@ -196,7 +203,7 @@
<item value="T_ENDWHILE"/> <item value="T_ENDWHILE"/>
<item value="T_HALT_COMPILER"/> <item value="T_HALT_COMPILER"/>
<item value="T_OLD_FUNCTION"/> <item value="T_OLD_FUNCTION"/>
<item value="T_PRINT"/> <!-- <item value="T_PRINT"/> -->
<!-- Same thing as the noShortPhpCodeTag rule --> <!-- Same thing as the noShortPhpCodeTag rule -->
<!-- <item value="T_OPEN_TAG_WITH_ECHO"/> --> <!-- <item value="T_OPEN_TAG_WITH_ECHO"/> -->

View File

@ -20,7 +20,7 @@
*/ */
/** /**
* \file htdocs/compta/export/class/ComptaJournalPaiement.php * \file htdocs/compta/export/class/ComptaJournalPaiement.class.php
* \ingroup compta * \ingroup compta
* \brief Fichier de la classe export compta journal * \brief Fichier de la classe export compta journal
* \version $Id$ * \version $Id$
@ -40,7 +40,7 @@ class ComptaJournalPaiement
$this->db = $db; $this->db = $db;
} }
function GeneratePdf($user, $dir, $excid, $excref) function generatePdf($user, $dir, $excid, $excref)
{ {
global $conf,$langs; global $conf,$langs;

View File

@ -18,7 +18,7 @@
*/ */
/** /**
* \file htdocs/compta/export/class/ComptaJournalPdf.php * \file htdocs/compta/export/class/ComptaJournalPdf.class.php
* \ingroup compta * \ingroup compta
* \brief Fichier de la classe export compta journal * \brief Fichier de la classe export compta journal
* \version $Id$ * \version $Id$

View File

@ -19,7 +19,7 @@
*/ */
/** /**
\file htdocs/compta/export/classComptaJournalVente.php \file htdocs/compta/export/class/ComptaJournalVente.class.php
\ingroup compta \ingroup compta
\brief Fichier de la classe export compta journal \brief Fichier de la classe export compta journal
\version $Id$ \version $Id$
@ -40,7 +40,7 @@ class ComptaJournalVente {
} }
function GeneratePdf($user, $dir, $excid, $excref) function generatePdf($user, $dir, $excid, $excref)
{ {
global $conf, $langs; global $conf, $langs;

View File

@ -72,12 +72,12 @@ if ($_GET["action"] == 'export')
/* G<>n<EFBFBD>ration du journal des Paiements */ /* G<>n<EFBFBD>ration du journal des Paiements */
$jp= new ComptaJournalPaiement($db); $jp= new ComptaJournalPaiement($db);
$jp->GeneratePdf($user, $dir, $exc->id, $exc->ref); $jp->generatePdf($user, $dir, $exc->id, $exc->ref);
/* G<>n<EFBFBD>ration du journal des Ventes */ /* G<>n<EFBFBD>ration du journal des Ventes */
$jp= new ComptaJournalVente($db); $jp= new ComptaJournalVente($db);
$jp->GeneratePdf($user, $dir, $exc->id, $exc->ref); $jp->generatePdf($user, $dir, $exc->id, $exc->ref);
} }
/* /*

View File

@ -62,7 +62,7 @@ class RemiseCheque extends CommonObject
* \param ref Ref record * \param ref Ref record
* \return int <0 if KO, >= 0 if OK * \return int <0 if KO, >= 0 if OK
*/ */
function Fetch($id,$ref='') function fetch($id,$ref='')
{ {
global $conf; global $conf;
@ -117,7 +117,7 @@ class RemiseCheque extends CommonObject
* \param account_id Compte bancaire concerne * \param account_id Compte bancaire concerne
* \return int <0 if KO, >0 if OK * \return int <0 if KO, >0 if OK
*/ */
function Create($user, $account_id) function create($user, $account_id)
{ {
global $conf; global $conf;
@ -220,7 +220,7 @@ class RemiseCheque extends CommonObject
if ($this->id > 0 && $this->errno == 0) if ($this->id > 0 && $this->errno == 0)
{ {
if ($this->UpdateAmount() <> 0) if ($this->updateAmount() <> 0)
{ {
$this->errno = -1027; $this->errno = -1027;
dol_syslog("RemiseCheque::Create ERREUR ($this->errno)"); dol_syslog("RemiseCheque::Create ERREUR ($this->errno)");
@ -254,7 +254,7 @@ class RemiseCheque extends CommonObject
\brief Supprime la remise en base \brief Supprime la remise en base
\param user utilisateur qui effectue l'operation \param user utilisateur qui effectue l'operation
*/ */
function Delete($user='') function delete($user='')
{ {
global $conf; global $conf;
@ -308,7 +308,7 @@ class RemiseCheque extends CommonObject
* \brief Validate receipt * \brief Validate receipt
* \param user User * \param user User
*/ */
function Validate($user) function validate($user)
{ {
global $langs,$conf; global $langs,$conf;
@ -530,7 +530,7 @@ class RemiseCheque extends CommonObject
* \brief Mets a jour le montant total * \brief Mets a jour le montant total
* \return int, 0 en cas de succes * \return int, 0 en cas de succes
*/ */
function UpdateAmount() function updateAmount()
{ {
global $conf; global $conf;
@ -563,13 +563,13 @@ class RemiseCheque extends CommonObject
if (!$resql) if (!$resql)
{ {
$this->errno = -1030; $this->errno = -1030;
dol_syslog("RemiseCheque::UpdateAmount ERREUR UPDATE ($this->errno)"); dol_syslog("RemiseCheque::updateAmount ERREUR UPDATE ($this->errno)");
} }
} }
else else
{ {
$this->errno = -1031; $this->errno = -1031;
dol_syslog("RemiseCheque::UpdateAmount ERREUR SELECT ($this->errno)"); dol_syslog("RemiseCheque::updateAmount ERREUR SELECT ($this->errno)");
} }
if ($this->errno === 0) if ($this->errno === 0)
@ -579,7 +579,7 @@ class RemiseCheque extends CommonObject
else else
{ {
$this->db->rollback(); $this->db->rollback();
dol_syslog("RemiseCheque::UpdateAmount ROLLBACK ($this->errno)"); dol_syslog("RemiseCheque::updateAmount ROLLBACK ($this->errno)");
} }
return $this->errno; return $this->errno;
@ -590,7 +590,7 @@ class RemiseCheque extends CommonObject
\param user utilisateur qui effectue l'operation \param user utilisateur qui effectue l'operation
\param account_id Compte bancaire concerne \param account_id Compte bancaire concerne
*/ */
function RemoveCheck($account_id) function removeCheck($account_id)
{ {
$this->errno = 0; $this->errno = 0;
@ -604,12 +604,12 @@ class RemiseCheque extends CommonObject
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$this->UpdateAmount(); $this->updateAmount();
} }
else else
{ {
$this->errno = -1032; $this->errno = -1032;
dol_syslog("RemiseCheque::RemoveCheck ERREUR UPDATE ($this->errno)"); dol_syslog("RemiseCheque::removeCheck ERREUR UPDATE ($this->errno)");
} }
} }
return 0; return 0;

View File

@ -111,7 +111,7 @@ if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' &&
if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' && $user->rights->banque->cheque) if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' && $user->rights->banque->cheque)
{ {
$remisecheque = new RemiseCheque($db); $remisecheque = new RemiseCheque($db);
$result = $remisecheque->Fetch($_GET["id"]); $result = $remisecheque->fetch($_GET["id"]);
$result = $remisecheque->Validate($user); $result = $remisecheque->Validate($user);
if ($result >= 0) if ($result >= 0)
{ {
@ -127,7 +127,7 @@ if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' &&
if ($_POST['action'] == 'builddoc' && $user->rights->banque->cheque) if ($_POST['action'] == 'builddoc' && $user->rights->banque->cheque)
{ {
$remisecheque = new RemiseCheque($db); $remisecheque = new RemiseCheque($db);
$result = $remisecheque->Fetch($_GET["id"]); $result = $remisecheque->fetch($_GET["id"]);
/*if ($_REQUEST['model']) /*if ($_REQUEST['model'])
{ {
@ -141,7 +141,7 @@ if ($_POST['action'] == 'builddoc' && $user->rights->banque->cheque)
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
$result = $remisecheque->GeneratePdf($_POST["model"], $outputlangs); $result = $remisecheque->generatePdf($_POST["model"], $outputlangs);
if ($result <= 0) if ($result <= 0)
{ {
dol_print_error($db,$remisecheque->error); dol_print_error($db,$remisecheque->error);

View File

@ -84,7 +84,7 @@ if ($_POST["action"] == 'infotrans')
if ($_POST["action"] == 'infocredit') if ($_POST["action"] == 'infocredit')
{ {
$bon = new BonPrelevement($db,""); $bon = new BonPrelevement($db,"");
$bon->Fetch($_GET["id"]); $bon->fetch($_GET["id"]);
$dt = mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); $dt = mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
$error = $bon->set_infocredit($user, $dt); $error = $bon->set_infocredit($user, $dt);