Merge branch 'upstream/develop'

This commit is contained in:
aspangaro 2014-04-29 06:37:39 +02:00
commit 06b386443d
13 changed files with 193 additions and 138 deletions

View File

@ -13,36 +13,7 @@ filter:
paths: { } paths: { }
tools: tools:
# Similar code detection # php_analyzer. Doc on https://scrutinizer-ci.com/docs/tools/php/php-analyzer/
php_sim:
enabled: true
min_mass: 16
filter:
excluded_paths:
- 'build/*'
- 'dev/*'
- 'doc/*'
- 'test/*'
- 'htdocs/includes/*'
paths: { }
# php_depend
php_pdepend:
enabled: true
configuration_file: null
suffixes:
- php
excluded_dirs: { }
filter:
excluded_paths:
- 'build/*'
- 'dev/*'
- 'doc/*'
- 'test/*'
- 'htdocs/includes/*'
paths: { }
# php_analyzer
php_analyzer: php_analyzer:
enabled: true enabled: true
extensions: extensions:
@ -56,11 +27,131 @@ tools:
- 'test/*' - 'test/*'
- 'htdocs/includes/*' - 'htdocs/includes/*'
paths: { } paths: { }
path_configs: { } config:
parameter_reference_check:
enabled: true
checkstyle:
enabled: false
no_trailing_whitespace: true
naming:
enabled: true
local_variable: ^[a-z][a-zA-Z0-9]*$
abstract_class_name: ^Abstract|Factory$
utility_class_name: Utils?$
constant_name: ^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$
property_name: ^[a-z][a-zA-Z0-9]*$
method_name: ^(?:[a-z]|__)[a-zA-Z0-9]*$
parameter_name: ^[a-z][a-zA-Z0-9]*$
interface_name: ^[A-Z][a-zA-Z0-9]*Interface$
type_name: ^[A-Z][a-zA-Z0-9]*$
exception_name: ^[A-Z][a-zA-Z0-9]*Exception$
isser_method_name: ^(?:is|has|should|may|supports)
unreachable_code:
enabled: true
check_access_control:
enabled: true
typo_checks:
enabled: true
check_variables:
enabled: true
check_calls:
enabled: true
too_many_arguments: true
missing_argument: true
argument_type_checks: lenient # Allowed Values: "disabled", "lenient", "strict"
suspicious_code:
enabled: true
overriding_parameter: false
overriding_closure_use: true
parameter_closure_use_conflict: true
parameter_multiple_times: true
non_existent_class_in_instanceof_check: true
non_existent_class_in_catch_clause: true
assignment_of_null_return: true
non_commented_switch_fallthrough: true
non_commented_empty_catch_block: true
overriding_private_members: true
use_statement_alias_conflict: true
precedence_in_condition_assignment: true
dead_assignments:
enabled: true
verify_php_doc_comments:
enabled: false
parameters: true
return: true
suggest_more_specific_types: true
ask_for_return_if_not_inferrable: true
ask_for_param_type_annotation: true
loops_must_use_braces:
enabled: true
check_usage_context:
enabled: true
simplify_boolean_return:
enabled: false
phpunit_checks:
enabled: false
reflection_checks:
enabled: true
# Checks Common Precedence Mistakes
precedence_checks:
enabled: true
assignment_in_condition: true
comparison_of_bit_result: true
basic_semantic_checks:
enabled: true
unused_code:
enabled: true
deprecation_checks:
enabled: true
useless_function_calls:
enabled: true
metrics_lack_of_cohesion_methods:
enabled: true
metrics_coupling:
enabled: true
stable_code:
namespace_prefixes: []
classes: []
doctrine_parameter_binding:
enabled: false
doctrine_entity_manager_injection:
enabled: false
symfony_request_injection:
enabled: false
doc_comment_fixes:
enabled: true
reflection_fixes:
enabled: false
use_statement_fixes:
enabled: true
remove_unused: true
# Whether you would like multiple imports in one USE statement to be preserved, e.g. ``use A, B;``.
preserve_multiple: false
# Whether you would like to preserve blank lines between use statements.
preserve_blanklines: false
order_alphabetically: false
# To use specific config for a specific path, use path_configs: (see example on page https://scrutinizer-ci.com/docs/configuration/tool_config_structure)
# php_depend
php_pdepend:
enabled: false
configuration_file: null
suffixes:
- php
excluded_dirs: { }
filter:
excluded_paths:
- 'build/*'
- 'dev/*'
- 'doc/*'
- 'test/*'
- 'htdocs/includes/*'
paths: { }
# change tracking # change tracking
php_changetracking: php_changetracking:
enabled: true enabled: false
bug_patterns: bug_patterns:
- '\bfix(?:es|ed)?\b' - '\bfix(?:es|ed)?\b'
feature_patterns: feature_patterns:
@ -75,8 +166,21 @@ tools:
- 'htdocs/includes/*' - 'htdocs/includes/*'
paths: { } paths: { }
# Similar code detection
php_sim:
enabled: false
min_mass: 30
filter:
excluded_paths:
- 'build/*'
- 'dev/*'
- 'doc/*'
- 'test/*'
- 'htdocs/includes/*'
paths: { }
# Coding-Style / Bug Detection # Coding-Style / Bug Detection
js_hint: true js_hint: false
before_commands: { } before_commands: { }

View File

@ -368,7 +368,7 @@ abstract class ActionsAdherentCardCommon
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$login=dol_buildlogin($this->object->lastname, $this->object->firstname); $login=dol_buildlogin($this->object->lastname, $this->object->firstname);
$generated_password=getRandomPassword(''); $generated_password=getRandomPassword(false);
$password=$generated_password; $password=$generated_password;
// Create a form array // Create a form array

View File

@ -825,7 +825,7 @@ class Adherent extends CommonObject
if (! $password) if (! $password)
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$password=getRandomPassword(''); $password=getRandomPassword(false);
} }
// Cryptage mot de passe // Cryptage mot de passe
@ -1242,15 +1242,15 @@ class Adherent extends CommonObject
/** /**
* Insert subscription into database and eventually add links to banks, mailman, etc... * Insert subscription into database and eventually add links to banks, mailman, etc...
* *
* @param timestamp $date Date d'effet de la cotisation * @param timestamp $date Date of effect of subscription
* @param amount $montant Montant cotisation (accepte 0 pour les adherents non soumis a cotisation) * @param double $montant Amount of subscription (0 accepted for some members)
* @param int $accountid Id compte bancaire * @param int $accountid Id bank account
* @param string $operation Type operation (si Id compte bancaire fourni) * @param string $operation Type operation (if Id bank account provided)
* @param string $label Label operation (si Id compte bancaire fourni) * @param string $label Label operation (if Id bank account provided)
* @param string $num_chq Numero cheque (si Id compte bancaire fourni) * @param string $num_chq Numero cheque (if Id bank account provided)
* @param string $emetteur_nom Nom emetteur cheque * @param string $emetteur_nom Name of cheque writer
* @param string $emetteur_banque Nom banque emetteur cheque * @param string $emetteur_banque Name of bank of cheque
* @param timestamp $datesubend Date fin adhesion * @param timestamp $datesubend Date end subscription
* @return int rowid of record added, <0 if KO * @return int rowid of record added, <0 if KO
*/ */
function cotisation($date, $montant, $accountid=0, $operation='', $label='', $num_chq='', $emetteur_nom='', $emetteur_banque='', $datesubend=0) function cotisation($date, $montant, $accountid=0, $operation='', $label='', $num_chq='', $emetteur_nom='', $emetteur_banque='', $datesubend=0)

View File

@ -812,7 +812,7 @@ else
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$generated_password=getRandomPassword(''); $generated_password=getRandomPassword(false);
print '<tr><td><span class="fieldrequired">'.$langs->trans("Password").'</span></td><td>'; print '<tr><td><span class="fieldrequired">'.$langs->trans("Password").'</span></td><td>';
print '<input size="30" maxsize="32" type="text" name="password" value="'.$generated_password.'">'; print '<input size="30" maxsize="32" type="text" name="password" value="'.$generated_password.'">';
print '</td></tr>'; print '</td></tr>';

View File

@ -1055,63 +1055,6 @@ class Categorie extends CommonObject
} }
/**
* Affiche le chemin le plus court pour se rendre a un produit
*
* @param int $id Id of category
* @param string $type Type of category
* @return void
* @deprecated function not used ?
*/
function get_primary_way($id, $type="")
{
$primary_way = array("taille" => -1, "chemin" => array());
$meres = $this->containing($id,$type);
foreach ($meres as $mere)
{
foreach ($mere->get_all_ways() as $way)
{
if(count($way) < $primary_way["taille"] || $primary_way["taille"] < 0)
{
$primary_way["taille"] = count($way);
$primary_way["chemin"] = $way;
}
}
}
return $primary_way["chemin"];
}
/**
* Affiche le chemin le plus court pour se rendre a un produit
*
* @param int $id Id of category
* @param string $sep Separator
* @param string $url Url
* @param string $type Type
* @return void
* @deprecated function not used ?
*/
function print_primary_way($id, $sep= " &gt;&gt; ", $url="", $type="")
{
$primary_way = array();
$way = $this->get_primary_way($id,$type);
$w = array();
foreach ($way as $cat)
{
if ($url == '')
{
$w[] = "<a href='".DOL_URL_ROOT."/categories/viewcat.php?id=".$cat->id."'>".$cat->label."</a>";
}
else
{
$w[] = "<a href='".DOL_URL_ROOT."/".$url."?catid=".$cat->id."'>".$cat->label."</a>";
}
}
return implode($sep, $w);
}
/** /**
* Retourne un tableau contenant la liste des categories meres * Retourne un tableau contenant la liste des categories meres
* *

View File

@ -1803,10 +1803,13 @@ if ($action == 'create') {
if ($action != 'editline') { if ($action != 'editline') {
$var = true; $var = true;
if ($conf->global->MAIN_FEATURES_LEVEL > 1) { if ($conf->global->MAIN_FEATURES_LEVEL > 1)
{
// Add free or predefined products/services // Add free or predefined products/services
$object->formAddObjectLine(1, $mysoc, $soc); $object->formAddObjectLine(1, $mysoc, $soc);
} else { }
else
{
// Add free products/services // Add free products/services
$object->formAddFreeProduct(1, $mysoc, $soc); $object->formAddFreeProduct(1, $mysoc, $soc);

View File

@ -2102,10 +2102,13 @@ if ($action == 'create' && $user->rights->commande->creer) {
if ($action != 'editline') { if ($action != 'editline') {
$var = true; $var = true;
if ($conf->global->MAIN_FEATURES_LEVEL > 1) { if ($conf->global->MAIN_FEATURES_LEVEL > 1)
{
// Add free or predefined products/services // Add free or predefined products/services
$object->formAddObjectLine(1, $mysoc, $soc); $object->formAddObjectLine(1, $mysoc, $soc);
} else { }
else
{
// Add free products/services // Add free products/services
$object->formAddFreeProduct(1, $mysoc, $soc); $object->formAddFreeProduct(1, $mysoc, $soc);

View File

@ -3307,10 +3307,13 @@ if ($action == 'create')
if ($object->statut == 0 && $user->rights->facture->creer && $action != 'valid' && $action != 'editline') { if ($object->statut == 0 && $user->rights->facture->creer && $action != 'valid' && $action != 'editline') {
$var = true; $var = true;
if ($conf->global->MAIN_FEATURES_LEVEL > 1) { if ($conf->global->MAIN_FEATURES_LEVEL > 1)
{
// Add free or predefined products/services // Add free or predefined products/services
$object->formAddObjectLine(1, $mysoc, $soc); $object->formAddObjectLine(1, $mysoc, $soc);
} else { }
else
{
// Add free products/services // Add free products/services
$object->formAddFreeProduct(1, $mysoc, $soc); $object->formAddFreeProduct(1, $mysoc, $soc);

View File

@ -400,7 +400,7 @@ abstract class ActionsContactCardCommon
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$login=dol_buildlogin($this->object->lastname, $this->object->firstname); $login=dol_buildlogin($this->object->lastname, $this->object->firstname);
$generated_password=getRandomPassword(''); $generated_password=getRandomPassword(false);
$password=$generated_password; $password=$generated_password;
// Create a form array // Create a form array

View File

@ -843,7 +843,7 @@ else
if (! $ldap_sid) // TODO ldap_sid ? if (! $ldap_sid) // TODO ldap_sid ?
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$generated_password=getRandomPassword(''); $generated_password=getRandomPassword(false);
} }
$password=$generated_password; $password=$generated_password;

View File

@ -2693,13 +2693,12 @@ abstract class CommonObject
/** /**
* Show add free products/services form * Show add free products/services form
* TODO Edit templates to use global variables and include them directly in controller call * TODO Edit templates to use global variables and include them directly in controller call
* But for the moment we don't know if it'st possible as we keep a method available on overloaded objects. * But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
* *
* @param int $dateSelector 1=Show also date range input fields * @param int $dateSelector 1=Show also date range input fields (start and end date)
* @param Societe $seller Object thirdparty who sell * @param Societe $seller Object thirdparty who sell
* @param Societe $buyer Object thirdparty who buy * @param Societe $buyer Object thirdparty who buy
* @return void * @return void
* @deprecated
*/ */
function formAddFreeProduct($dateSelector,$seller,$buyer) function formAddFreeProduct($dateSelector,$seller,$buyer)
{ {

View File

@ -1356,7 +1356,7 @@ class User extends CommonObject
// If new password not provided, we generate one // If new password not provided, we generate one
if (! $password) if (! $password)
{ {
$password=getRandomPassword(''); $password=getRandomPassword(false);
} }
// Crypte avec md5 // Crypte avec md5

View File

@ -748,7 +748,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
if (empty($ldap_sid)) // ldap_sid is for activedirectory if (empty($ldap_sid)) // ldap_sid is for activedirectory
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$generated_password=getRandomPassword(''); $generated_password=getRandomPassword(false);
} }
$password=$generated_password; $password=$generated_password;