Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
f012a52465
@ -66,7 +66,7 @@
|
||||
<!-- Generate checkstyle.xml -->
|
||||
<target name="phpcs">
|
||||
<exec executable="phpcs" dir="${basedir}" output="${basedir}/hudson/logs/checkstyle.xml">
|
||||
<arg line=" --standard=${basedir}/dev/codesniffer/ruleset.xml
|
||||
<arg line=" --standard=${basedir}/dev/codesniffer/jenkins_ruleset.xml
|
||||
--report=checkstyle
|
||||
--ignore=${ignorepaths},${ignoreregexp}
|
||||
htdocs
|
||||
|
||||
222
dev/codesniffer/jenkins_ruleset.xml
Executable file
222
dev/codesniffer/jenkins_ruleset.xml
Executable file
@ -0,0 +1,222 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE ruleset SYSTEM "ruleset.dtd">
|
||||
<ruleset name="Dolibarr">
|
||||
<description>Dolibarr coding standard.</description>
|
||||
|
||||
<!-- List of all tests -->
|
||||
|
||||
<rule ref="Generic.CodeAnalysis.EmptyStatement" />
|
||||
|
||||
<rule ref="Generic.CodeAnalysis.EmptyStatement.NotAllowedWarning">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<!-- <rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" /> -->
|
||||
|
||||
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall" />
|
||||
|
||||
<rule ref="Generic.CodeAnalysis.JumbledIncrementer" />
|
||||
|
||||
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement" />
|
||||
|
||||
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier" />
|
||||
|
||||
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter" />
|
||||
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter.Found">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod" />
|
||||
|
||||
<rule ref="Generic.Commenting.Todo" />
|
||||
|
||||
<!-- Warning if action on same line than if -->
|
||||
<!--
|
||||
<rule ref="Generic.ControlStructures.InlineControlStructure">
|
||||
<properties> <property name="error" value="false"/> </properties>
|
||||
</rule>
|
||||
-->
|
||||
|
||||
<!-- Lines can be 85 chars long, but never show errors -->
|
||||
<rule ref="Generic.Files.LineLength">
|
||||
<properties>
|
||||
<property name="lineLimit" value="1000" />
|
||||
<property name="absoluteLineLimit" value="0" />
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Use Unix newlines -->
|
||||
<rule ref="Generic.Files.LineEndings">
|
||||
<properties>
|
||||
<property name="eolChar" value="\n" />
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- To disallow several statements on same line -->
|
||||
<!-- <rule ref="Generic.Formatting.DisallowMultipleStatements" /> -->
|
||||
|
||||
<!-- Have 2 chars padding maximum and always show as errors -->
|
||||
<!--
|
||||
<rule ref="Generic.Formatting.MultipleStatementAlignment">
|
||||
<properties> <property name="maxPadding" value="2"/> <property
|
||||
name="ignoreMultiLine" value="true"/> </properties> </rule>
|
||||
-->
|
||||
|
||||
<rule ref="Generic.Formatting.SpaceAfterCast" />
|
||||
|
||||
<rule ref="Generic.Functions.CallTimePassByReference" />
|
||||
|
||||
<rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
|
||||
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule
|
||||
ref="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<!-- Tweaks to metrics -->
|
||||
<rule ref="Generic.Metrics.CyclomaticComplexity">
|
||||
<properties>
|
||||
<property name="complexity" value="25" />
|
||||
<property name="absoluteComplexity" value="100" />
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="Generic.Metrics.NestingLevel">
|
||||
<properties>
|
||||
<property name="nestingLevel" value="6" />
|
||||
<property name="absoluteNestingLevel" value="50" />
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<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.PHP.DeprecatedFunctions" />
|
||||
|
||||
<rule ref="Generic.PHP.DisallowShortOpenTag" />
|
||||
|
||||
<rule ref="Generic.PHP.ForbiddenFunctions" />
|
||||
|
||||
<!-- Warning when using @ before functions -->
|
||||
<!-- <rule ref="Generic.PHP.NoSilencedErrors" /> -->
|
||||
|
||||
<!-- Say if null, true, false must be uppercase -->
|
||||
<!-- <rule ref="Generic.PHP.UpperCaseConstant" /> -->
|
||||
|
||||
<rule ref="Generic.Strings.UnnecessaryStringConcat" />
|
||||
|
||||
<rule ref="Generic.VersionControl.SubversionProperties" />
|
||||
|
||||
<!-- Disallow usage of tab -->
|
||||
<!-- <rule ref="Generic.WhiteSpace.DisallowTabIndent" /> -->
|
||||
|
||||
<!-- 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" />
|
||||
|
||||
<!-- Check for duplicate class names -->
|
||||
<!-- <rule ref="Generic.Classes.DuplicateClassName" /> -->
|
||||
|
||||
<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.WrongStyle">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FileComment.MissingVersion">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FileComment.MissingTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
-->
|
||||
<rule ref="PEAR.Commenting.FunctionComment.WrongStyle">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.FunctionComment.Empty">
|
||||
<severity>5</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.FunctionComment" />
|
||||
<rule ref="PEAR.Commenting.FunctionComment.SpacingBeforeParamType">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterLongType">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterLongName">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParams">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.ParameterCommentsNotAligned">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.ParameterNamesNotAligned">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.InlineComment" />
|
||||
|
||||
<!-- <rule ref="PEAR.ControlStructures.ControlSignature" /> -->
|
||||
|
||||
<!-- <rule ref="PEAR.ControlStructures.MultiLineCondition" /> -->
|
||||
|
||||
<!-- Test if () are removed for includes -->
|
||||
<!-- <rule ref="PEAR.Files.IncludingFile"/> -->
|
||||
|
||||
<rule ref="PEAR.Formatting.MultiLineAssignment" />
|
||||
|
||||
<rule ref="PEAR.Functions.FunctionCallSignature" />
|
||||
|
||||
<rule ref="PEAR.Functions.ValidDefaultValue" />
|
||||
|
||||
<rule ref="PEAR.NamingConventions.ValidClassName" />
|
||||
<rule ref="PEAR.NamingConventions.ValidClassName.StartWithCaptial">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.NamingConventions.ValidFunctionName" />
|
||||
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNoCaptial">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.NamingConventions.ValidFunctionName.NotCamelCaps">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.NamingConventions.ValidFunctionName.PrivateNoUnderscore">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.NamingConventions.ValidVariableName" />
|
||||
|
||||
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent" />
|
||||
|
||||
<!--
|
||||
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace.Line">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
-->
|
||||
|
||||
<!-- Already found as a Generic rule -->
|
||||
<!-- <rule ref="PEAR.WhiteSpace.ScopeIndent" /> -->
|
||||
|
||||
</ruleset>
|
||||
@ -402,26 +402,27 @@ class Menubase
|
||||
}
|
||||
|
||||
/**
|
||||
* Load tabMenu array
|
||||
* Load tabMenu array with top menu entries found into database.
|
||||
*
|
||||
* @param string $mainmenu Value for mainmenu that defined top menu
|
||||
* @param string $myleftmenu Left menu name
|
||||
* @param int $type_user 0=Internal,1=External,2=All
|
||||
* @param string $menu_handler Name of menu_handler used (auguria, eldy...)
|
||||
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
||||
* @param string $mymainmenu Value for mainmenu to filter menu to load (always '')
|
||||
* @param string $myleftmenu Value for leftmenu to filter menu to load (always '')
|
||||
* @param int $type_user Filter on type of user (0=Internal,1=External,2=All)
|
||||
* @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...)
|
||||
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
||||
* @return array Return array with menu entries for top menu
|
||||
*/
|
||||
function menuTopCharger($mainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
|
||||
function menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
|
||||
{
|
||||
global $langs, $user, $conf;
|
||||
global $leftmenu,$rights; // To export to dol_eval function
|
||||
global $mainmenu,$leftmenu,$rights; // To export to dol_eval function
|
||||
|
||||
$mainmenu=$mymainmenu; // To export to dol_eval function
|
||||
$leftmenu=$myleftmenu; // To export to dol_eval function
|
||||
|
||||
// Load datas into tabMenu
|
||||
if (count($tabMenu) == 0)
|
||||
{
|
||||
$this->menuLoad($leftmenu, $type_user, $menu_handler, $tabMenu);
|
||||
$this->menuLoad($mainmenu, $leftmenu, $type_user, $menu_handler, $tabMenu);
|
||||
}
|
||||
|
||||
$newTabMenu=array();
|
||||
@ -438,9 +439,9 @@ class Menubase
|
||||
$newTabMenu[$i]['titre']=$val['titre'];
|
||||
$newTabMenu[$i]['right']=$val['perms'];
|
||||
$newTabMenu[$i]['atarget']=$val['atarget'];
|
||||
$newTabMenu[$i]['mainmenu']=$val['mainmenu'];
|
||||
$newTabMenu[$i]['leftmenu']=$val['leftmenu'];
|
||||
$newTabMenu[$i]['enabled']=$val['enabled'];
|
||||
$newTabMenu[$i]['mainmenu']=$val['mainmenu'];
|
||||
$newTabMenu[$i]['type']=$val['type'];
|
||||
$newTabMenu[$i]['lang']=$val['langs'];
|
||||
|
||||
@ -456,18 +457,19 @@ class Menubase
|
||||
* Load entries found in database in a menu array.
|
||||
*
|
||||
* @param array $newmenu Menu array to complete (in most cases, it's empty, may be already initialized with some menu manager like eldy)
|
||||
* @param string $mainmenu Value for mainmenu that defines top menu of left menu to load
|
||||
* @param string $myleftmenu Value that defines leftmenu
|
||||
* @param int $type_user 0=Internal,1=External,2=All
|
||||
* @param string $menu_handler Name of menu_handler used (auguria, eldy...)
|
||||
* @param string $mymainmenu Value for mainmenu to filter menu to load (often $_SESSION['mainmenu'])
|
||||
* @param string $myleftmenu Value for leftmenu to filter menu to load (always '')
|
||||
* @param int $type_user Filter on type of user (0=Internal,1=External,2=All)
|
||||
* @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...)
|
||||
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
||||
* @return array Menu array for particular mainmenu value or full tabArray
|
||||
*/
|
||||
function menuLeftCharger($newmenu, $mainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
|
||||
function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
|
||||
{
|
||||
global $langs, $user, $conf; // To export to dol_eval function
|
||||
global $leftmenu,$rights; // To export to dol_eval function
|
||||
global $mainmenu,$leftmenu,$rights; // To export to dol_eval function
|
||||
|
||||
$mainmenu=$mymainmenu; // To export to dol_eval function
|
||||
$leftmenu=$myleftmenu; // To export to dol_eval function
|
||||
|
||||
// We initialize newmenu with first already found menu entries
|
||||
@ -476,7 +478,7 @@ class Menubase
|
||||
// Load datas from database into $tabMenu, then we will complete this->newmenu with values into $tabMenu
|
||||
if (count($tabMenu) == 0)
|
||||
{
|
||||
$this->menuLoad($leftmenu, $type_user, $menu_handler, $tabMenu);
|
||||
$this->menuLoad($mainmenu, $leftmenu, $type_user, $menu_handler, $tabMenu);
|
||||
}
|
||||
//var_dump($tabMenu);
|
||||
|
||||
@ -544,18 +546,20 @@ class Menubase
|
||||
/**
|
||||
* Load entries found in database to $tabMenu.
|
||||
*
|
||||
* @param string $mymainmenu Value for left that defined mainmenu
|
||||
* @param string $myleftmenu Value for left that defined leftmenu
|
||||
* @param int $type_user 0=Internal,1=External,2=All
|
||||
* @param string $menu_handler Name of menu_handler used (auguria, eldy...)
|
||||
* @param array &$tabMenu Array to store new entries found (in most cases, it's empty, but may be alreay filled)
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function menuLoad($myleftmenu, $type_user, $menu_handler, &$tabMenu)
|
||||
function menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
|
||||
{
|
||||
global $langs, $user, $conf; // To export to dol_eval function
|
||||
global $leftmenu, $rights; // To export to dol_eval function
|
||||
global $mainmenu, $leftmenu, $rights; // To export to dol_eval function
|
||||
|
||||
$menutopid=0;
|
||||
$mainmenu=$mymainmenu; // To export to dol_eval function
|
||||
$leftmenu=$myleftmenu; // To export to dol_eval function
|
||||
|
||||
$sql = "SELECT m.rowid, m.type, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.url, m.titre, m.langs, m.perms, m.enabled, m.target, m.mainmenu, m.leftmenu";
|
||||
@ -629,12 +633,12 @@ class Menubase
|
||||
}
|
||||
$tabMenu[$b]['titre'] = $title;
|
||||
$tabMenu[$b]['target'] = $menu['target'];
|
||||
$tabMenu[$b]['mainmenu'] = $menu['mainmenu'];
|
||||
$tabMenu[$b]['leftmenu'] = $menu['leftmenu'];
|
||||
if (! isset($tabMenu[$b]['perms'])) $tabMenu[$b]['perms'] = $perms;
|
||||
else $tabMenu[$b]['perms'] = ($tabMenu[$b]['perms'] && $perms);
|
||||
if (! isset($tabMenu[$b]['enabled'])) $tabMenu[$b]['enabled'] = $enabled;
|
||||
else $tabMenu[$b]['enabled'] = ($tabMenu[$b]['enabled'] && $enabled);
|
||||
$tabMenu[$b]['mainmenu'] = $menu['mainmenu'];
|
||||
$tabMenu[$b]['type'] = $menu['type'];
|
||||
$tabMenu[$b]['langs'] = $menu['langs'];
|
||||
$tabMenu[$b]['fk_mainmenu'] = $menu['fk_mainmenu'];
|
||||
|
||||
@ -44,7 +44,7 @@ function print_auguria_menu($db,$atarget,$type_user)
|
||||
|
||||
$tabMenu=array();
|
||||
$menuArbo = new Menubase($db,'auguria','top');
|
||||
$newTabMenu = $menuArbo->menuTopCharger($_SESSION['mainmenu'], '', $type_user, 'auguria',$tabMenu);
|
||||
$newTabMenu = $menuArbo->menuTopCharger('', '', $type_user, 'auguria',$tabMenu);
|
||||
|
||||
print_start_menu_array_auguria();
|
||||
|
||||
|
||||
@ -440,7 +440,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
||||
|
||||
$tabMenu=array();
|
||||
$menuArbo = new Menubase($db,'eldy','top');
|
||||
$newTabMenu = $menuArbo->menuTopCharger($_SESSION['mainmenu'],'',$type_user,'eldy',$tabMenu);
|
||||
$newTabMenu = $menuArbo->menuTopCharger('','',$type_user,'eldy',$tabMenu);
|
||||
|
||||
$num = count($newTabMenu);
|
||||
for($i = 0; $i < $num; $i++)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user