Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
d19a756e
Commit
d19a756e
authored
13 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Qual: Removed errors and warnings reported by codesniffer
parent
047d5cd8
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/boxes.php
+29
-28
29 additions, 28 deletions
htdocs/boxes.php
test/codesniffer/ruleset.xml
+15
-3
15 additions, 3 deletions
test/codesniffer/ruleset.xml
with
44 additions
and
31 deletions
htdocs/boxes.php
+
29
−
28
View file @
d19a756e
...
@@ -23,16 +23,17 @@
...
@@ -23,16 +23,17 @@
* \brief File of class to manage widget boxes
* \brief File of class to manage widget boxes
* \author Rodolphe Qiedeville
* \author Rodolphe Qiedeville
* \author Laurent Destailleur
* \author Laurent Destailleur
* \version $Id: boxes.php,v 1.5
2
2011/0
6/28 15:05:44 hregis
Exp $
* \version $Id: boxes.php,v 1.5
3
2011/0
7/08 17:59:55 eldy
Exp $
*/
*/
/**
/**
* \brief Show a HTML Tab with boxes of a particular area including personalized choices of user
* Show a HTML Tab with boxes of a particular area including personalized choices of user
* \param user User
*
* \param areacode Code of area for pages (0=value for Home page)
* @param User $user Object User
* \return int <0 if KO, Nb of boxes shown of OK (0 to n)
* @param String $areacode Code of area for pages (0=value for Home page)
* @return int <0 if KO, Nb of boxes shown of OK (0 to n)
*/
*/
function
printBoxesArea
(
$user
,
$areacode
)
function
printBoxesArea
(
$user
,
$areacode
)
{
{
...
@@ -43,7 +44,7 @@ function printBoxesArea($user,$areacode)
...
@@ -43,7 +44,7 @@ function printBoxesArea($user,$areacode)
//$boxid_left = array();
//$boxid_left = array();
//$boxid_right = array();
//$boxid_right = array();
if
(
sizeof
(
$boxarray
))
if
(
count
(
$boxarray
))
{
{
print_fiche_titre
(
$langs
->
trans
(
"OtherInformationsBoxes"
),
''
,
''
,
''
,
'otherboxes'
);
print_fiche_titre
(
$langs
->
trans
(
"OtherInformationsBoxes"
),
''
,
''
,
''
,
'otherboxes'
);
print
'<table width="100%" class="notopnoleftnoright">'
;
print
'<table width="100%" class="notopnoleftnoright">'
;
...
@@ -157,22 +158,22 @@ function printBoxesArea($user,$areacode)
...
@@ -157,22 +158,22 @@ function printBoxesArea($user,$areacode)
}
}
}
}
return
sizeof
(
$boxarray
);
return
count
(
$boxarray
);
}
}
/**
/**
* \class InfoBox
* Class to manage boxes on pages
* \brief Classe permettant la gestion des boxes sur une page
*/
*/
class
InfoBox
class
InfoBox
{
{
var
$db
;
var
$db
;
/**
/**
* \brief Constructeur de la classe
* Constructor
* \param $DB Handler d'acc�s base
*
* @param DoliDb $DB Database handler
*/
*/
function
InfoBox
(
$DB
)
function
InfoBox
(
$DB
)
{
{
...
@@ -181,10 +182,11 @@ class InfoBox
...
@@ -181,10 +182,11 @@ class InfoBox
/**
/**
* \brief Retourne tableau des boites elligibles pour la zone et le user
* Return array of boxes qualified for area and user
* \param $zone ID de la zone (0 pour la Homepage, ...)
*
* \param $user Objet user
* @param string $zone Name or area (0 for Homepage, ...)
* \return array Tableau d'objet box
* @param User $user Objet user
* @return array Array of boxes
*/
*/
function
listBoxes
(
$zone
,
$user
)
function
listBoxes
(
$zone
,
$user
)
{
{
...
@@ -236,7 +238,7 @@ class InfoBox
...
@@ -236,7 +238,7 @@ class InfoBox
$box
->
box_order
=
$obj
->
box_order
;
$box
->
box_order
=
$obj
->
box_order
;
$box
->
fk_user
=
$obj
->
fk_user
;
$box
->
fk_user
=
$obj
->
fk_user
;
$enabled
=
true
;
$enabled
=
true
;
if
(
$box
->
depends
&&
sizeof
(
$box
->
depends
)
>
0
)
if
(
$box
->
depends
&&
count
(
$box
->
depends
)
>
0
)
{
{
foreach
(
$box
->
depends
as
$module
)
foreach
(
$box
->
depends
as
$module
)
{
{
...
@@ -302,7 +304,7 @@ class InfoBox
...
@@ -302,7 +304,7 @@ class InfoBox
}
}
$box
->
fk_user
=
$obj
->
fk_user
;
$box
->
fk_user
=
$obj
->
fk_user
;
$enabled
=
true
;
$enabled
=
true
;
if
(
$box
->
depends
&&
sizeof
(
$box
->
depends
)
>
0
)
if
(
$box
->
depends
&&
count
(
$box
->
depends
)
>
0
)
{
{
foreach
(
$box
->
depends
as
$module
)
foreach
(
$box
->
depends
as
$module
)
{
{
...
@@ -325,12 +327,14 @@ class InfoBox
...
@@ -325,12 +327,14 @@ class InfoBox
}
}
/**
/**
* \brief Sauvegarde sequencement des boites pour la zone et le user
* Save order of boxes for area and user
* \param $zone ID de la zone (0 pour la Homepage, ...)
*
* \param $boxorder Liste des boites dans le bon ordre 'A:123,456,...-B:789,321...'
* @param string $zone Name of area (0 for Homepage, ...)
* \param $userid Id du user
* @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...'
* \return int <0 si ko, >= 0 si ok
* @param int $userid Id of user
* @return int <0 if KO, >= 0 if OK
*/
*/
function
saveboxorder
(
$zone
,
$boxorder
,
$userid
=
0
)
function
saveboxorder
(
$zone
,
$boxorder
,
$userid
=
0
)
{
{
...
@@ -382,7 +386,7 @@ class InfoBox
...
@@ -382,7 +386,7 @@ class InfoBox
{
{
if
(
is_numeric
(
$id
))
if
(
is_numeric
(
$id
))
{
{
//dol_syslog("aaaaa".
sizeof
($listarray));
//dol_syslog("aaaaa".
count
($listarray));
$i
++
;
$i
++
;
$ii
=
sprintf
(
'%02d'
,
$i
);
$ii
=
sprintf
(
'%02d'
,
$i
);
$sql
=
"INSERT INTO "
.
MAIN_DB_PREFIX
.
"boxes"
;
$sql
=
"INSERT INTO "
.
MAIN_DB_PREFIX
.
"boxes"
;
...
@@ -427,7 +431,4 @@ class InfoBox
...
@@ -427,7 +431,4 @@ class InfoBox
}
}
?>
?>
This diff is collapsed.
Click to expand it.
test/codesniffer/ruleset.xml
+
15
−
3
View file @
d19a756e
...
@@ -70,7 +70,7 @@
...
@@ -70,7 +70,7 @@
<!-- Tweaks to metrics -->
<!-- Tweaks to metrics -->
<rule
ref=
"Generic.Metrics.CyclomaticComplexity"
>
<rule
ref=
"Generic.Metrics.CyclomaticComplexity"
>
<properties>
<properties>
<property
name=
"complexity"
value=
"
1
0"
/>
<property
name=
"complexity"
value=
"
2
0"
/>
<property
name=
"absoluteComplexity"
value=
"100"
/>
<property
name=
"absoluteComplexity"
value=
"100"
/>
</properties>
</properties>
</rule>
</rule>
...
@@ -82,6 +82,10 @@
...
@@ -82,6 +82,10 @@
</rule>
</rule>
<rule
ref=
"Generic.NamingConventions.ConstructorName"
/>
<rule
ref=
"Generic.NamingConventions.ConstructorName"
/>
<!-- Check if we use PHP4 constructor instead of __construct() -->
<rule
ref=
"Generic.NamingConventions.ConstructorName.OldStyle"
>
<severity>
0
</severity>
</rule>
<rule
ref=
"Generic.NamingConventions.UpperCaseConstantName"
/>
<rule
ref=
"Generic.NamingConventions.UpperCaseConstantName"
/>
...
@@ -104,7 +108,9 @@
...
@@ -104,7 +108,9 @@
<!-- Disallow usage of tab -->
<!-- Disallow usage of tab -->
<!-- <rule ref="Generic.WhiteSpace.DisallowTabIndent" /> -->
<!-- <rule ref="Generic.WhiteSpace.DisallowTabIndent" /> -->
<rule
ref=
"Generic.WhiteSpace.ScopeIndent"
/>
<!-- Check indent are done with spaces and wiht correct number -->
<!-- Disabled as this does not support tab -->
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
<rule
ref=
"PEAR.Classes.ClassDeclaration"
/>
<rule
ref=
"PEAR.Classes.ClassDeclaration"
/>
...
@@ -112,6 +118,9 @@
...
@@ -112,6 +118,9 @@
<!-- <rule ref="Generic.Classes.DuplicateClassName" /> -->
<!-- <rule ref="Generic.Classes.DuplicateClassName" /> -->
<rule
ref=
"PEAR.Commenting.ClassComment"
/>
<rule
ref=
"PEAR.Commenting.ClassComment"
/>
<rule
ref=
"PEAR.Commenting.ClassComment.MissingTag"
>
<severity>
0
</severity>
</rule>
<!--
<!--
<rule ref="PEAR.Commenting.FileComment" />
<rule ref="PEAR.Commenting.FileComment" />
...
@@ -139,6 +148,9 @@
...
@@ -139,6 +148,9 @@
<rule
ref=
"PEAR.Commenting.FunctionComment.SpacingAfterParams"
>
<rule
ref=
"PEAR.Commenting.FunctionComment.SpacingAfterParams"
>
<severity>
0
</severity>
<severity>
0
</severity>
</rule>
</rule>
<rule
ref=
"PEAR.Commenting.FunctionComment.ParameterCommentsNotAligned"
>
<severity>
0
</severity>
</rule>
<rule
ref=
"PEAR.Commenting.InlineComment"
/>
<rule
ref=
"PEAR.Commenting.InlineComment"
/>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment