Skip to content

Commit

Permalink
Merge branch 'develop' into 22_accfydefault
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy authored Feb 17, 2025
2 parents 167e327 + 28cacb8 commit bec6401
Show file tree
Hide file tree
Showing 37 changed files with 844 additions and 384 deletions.
12 changes: 0 additions & 12 deletions dev/build/phpstan/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -14262,18 +14262,6 @@ parameters:
count: 1
path: ../../../htdocs/core/tpl/filemanager.tpl.php

-
message: '#^Variable \$showlinktoai might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/formlayoutai.tpl.php

-
message: '#^Variable \$showlinktoailabel might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/core/tpl/formlayoutai.tpl.php

-
message: '#^Variable \$limit might not be defined\.$#'
identifier: variable.undefined
Expand Down
34 changes: 9 additions & 25 deletions dev/tools/phan/baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
*/
return [
// # Issue statistics:
// PhanTypeMismatchArgument : 1690+ occurrences
// PhanTypeMismatchArgument : 1580+ occurrences
// PhanUndeclaredProperty : 500+ occurrences
// PhanTypeMismatchArgumentNullable : 350+ occurrences
// PhanTypeMismatchArgumentNullable : 330+ occurrences
// PhanPluginUnknownArrayMethodReturnType : 170+ occurrences
// PhanUndeclaredGlobalVariable : 160+ occurrences
// PhanTypeMismatchProperty : 120+ occurrences
// PhanPluginUnknownArrayMethodParamType : 110+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 75+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 65+ occurrences
// PhanTypeExpectedObjectPropAccess : 40+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 55+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 55+ occurrences
// PhanTypeExpectedObjectPropAccess : 35+ occurrences
// PhanTypeInvalidDimOffset : 25+ occurrences
// PhanTypeMismatchDimFetch : 20+ occurrences
// PhanPluginUndeclaredVariableIsset : 15+ occurrences
// PhanUndeclaredConstant : 15+ occurrences
// PhanTypeMismatchArgumentNullableInternal : 10+ occurrences
// PhanUndeclaredMethod : 10+ occurrences
// PhanUndeclaredMethod : 9 occurrences
// PhanTypeComparisonFromArray : 8 occurrences
// PhanPluginDuplicateExpressionBinaryOp : 6 occurrences
// PhanTypeArraySuspiciousNull : 6 occurrences
Expand Down Expand Up @@ -101,7 +101,6 @@ return [
'htdocs/admin/eventorganization.php' => ['PhanTypeMismatchArgument'],
'htdocs/admin/expensereport_rules.php' => ['PhanTypeMismatchArgument'],
'htdocs/admin/external_rss.php' => ['PhanTypeMismatchArgument'],
'htdocs/admin/fckeditor.php' => ['PhanTypeMismatchArgument'],
'htdocs/admin/hrm.php' => ['PhanTypeMismatchArgument'],
'htdocs/admin/knowledgemanagement.php' => ['PhanTypeMismatchArgument'],
'htdocs/admin/mails.php' => ['PhanTypeMismatchArgument'],
Expand Down Expand Up @@ -609,7 +608,6 @@ return [
'htdocs/projet/class/api_tasks.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgument'],
'htdocs/projet/tasks/time.php' => ['PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
'htdocs/projet/tasks/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/public/company/new.php' => ['PhanTypeMismatchArgument'],
'htdocs/public/eventorganization/subscriptionok.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/public/members/new.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/public/payment/newpayment.php' => ['PhanUndeclaredProperty'],
Expand All @@ -636,26 +634,13 @@ return [
'htdocs/recruitment/recruitmentjobposition_card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/recruitment/recruitmentjobposition_document.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/recruitment/recruitmentjobposition_note.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/resource/class/dolresource.class.php' => ['PhanTypeMismatchArgumentNullable'],
'htdocs/salaries/class/api_salaries.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/salaries/paiement_salary.php' => ['PhanUndeclaredProperty'],
'htdocs/salaries/virement_request.php' => ['PhanUndeclaredProperty'],
'htdocs/societe/admin/societe.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'],
'htdocs/societe/ajax/company.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/societe/canvas/actions_card_common.class.php' => ['PhanTypeMismatchArgument'],
'htdocs/societe/canvas/company/actions_card_company.class.php' => ['PhanTypeMismatchArgument'],
'htdocs/societe/card.php' => ['PhanTypeMismatchArgument'],
'htdocs/societe/checkvat/checkVatPopup.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/societe/ajax/company.php' => ['PhanUndeclaredProperty'],
'htdocs/societe/class/api_thirdparties.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
'htdocs/societe/class/companybankaccount.class.php' => ['PhanTypeMismatchArgumentNullable'],
'htdocs/societe/class/societe.class.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchProperty'],
'htdocs/societe/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/societe/contact.php' => ['PhanTypeMismatchArgument'],
'htdocs/societe/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/societe/paymentmodes.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredGlobalVariable'],
'htdocs/societe/price.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/societe/tpl/linesalesrepresentative.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/societe/website.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/societe/class/societe.class.php' => ['PhanTypeMismatchProperty'],
'htdocs/societe/paymentmodes.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgument'],
'htdocs/stripe/admin/stripe.php' => ['PhanTypeMismatchArgument'],
'htdocs/stripe/charge.php' => ['PhanTypeMismatchArgument'],
'htdocs/stripe/class/actions_stripe.class.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginSuspiciousParamPosition', 'PhanTypeMismatchArgument'],
Expand Down Expand Up @@ -714,7 +699,6 @@ return [
'htdocs/user/group/card.php' => ['PhanTypeMismatchArgument'],
'htdocs/user/list.php' => ['PhanTypeMismatchArgument'],
'htdocs/user/param_ihm.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'],
'htdocs/user/virtualcard.php' => ['PhanTypeMismatchArgument'],
'htdocs/variants/ajax/get_attribute_values.php' => ['PhanTypeComparisonFromArray'],
'htdocs/variants/card.php' => ['PhanTypeMismatchArgument'],
'htdocs/variants/class/ProductAttribute.class.php' => ['PhanTypeMismatchArgumentNullable'],
Expand Down
2 changes: 1 addition & 1 deletion htdocs/api/class/api_access.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function __isAllowed()

if (isset($_SERVER['HTTP_DOLAPIKEY'])) { // HTTP Header entry "DOLAPIKEY: ..." can be read with $_SERVER["HTTP_DOLAPIKEY"]
$api_key = $_SERVER['HTTP_DOLAPIKEY']; // With header method (recommended)
} else {
} elseif (empty($api_key)) {
$headers = getallheaders(); // HTTP Header entry "Authorization: Bearer ..." can be read with getallheaders
$api_key = preg_replace('/^Bearer\s+/i', '', empty($headers['Authorization']) ? '' : $headers['Authorization']);
};
Expand Down
23 changes: 12 additions & 11 deletions htdocs/categories/class/api_categories.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,21 @@ class Categories extends DolibarrApi
* @var array<int,string> Code mapping from ID
*/
public static $TYPES = array(
0 => 'product',
1 => 'supplier',
2 => 'customer',
3 => 'member',
4 => 'contact',
5 => 'account',
6 => 'project',
7 => 'user',
8 => 'bank_line',
9 => 'warehouse',
0 => 'product',
1 => 'supplier',
2 => 'customer',
3 => 'member',
4 => 'contact',
5 => 'account',
6 => 'project',
7 => 'user',
8 => 'bank_line',
9 => 'warehouse',
10 => 'actioncomm',
11 => 'website_page',
12 => 'ticket',
13 => 'knowledgemanagement'
13 => 'knowledgemanagement',
16 => 'order'
);

/**
Expand Down
165 changes: 86 additions & 79 deletions htdocs/categories/class/categorie.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,22 @@
class Categorie extends CommonObject
{
// Categories types (we use string because we want to accept any modules/types in a future)
const TYPE_PRODUCT = 'product';
const TYPE_SUPPLIER = 'supplier';
const TYPE_CUSTOMER = 'customer';
const TYPE_MEMBER = 'member';
const TYPE_CONTACT = 'contact';
const TYPE_USER = 'user';
const TYPE_PROJECT = 'project';
const TYPE_ACCOUNT = 'bank_account';
const TYPE_BANK_LINE = 'bank_line';
const TYPE_WAREHOUSE = 'warehouse';
const TYPE_ACTIONCOMM = 'actioncomm';
const TYPE_WEBSITE_PAGE = 'website_page';
const TYPE_TICKET = 'ticket';
const TYPE_PRODUCT = 'product';
const TYPE_SUPPLIER = 'supplier';
const TYPE_CUSTOMER = 'customer';
const TYPE_MEMBER = 'member';
const TYPE_CONTACT = 'contact';
const TYPE_USER = 'user';
const TYPE_PROJECT = 'project';
const TYPE_ACCOUNT = 'bank_account';
const TYPE_BANK_LINE = 'bank_line';
const TYPE_WAREHOUSE = 'warehouse';
const TYPE_ACTIONCOMM = 'actioncomm';
const TYPE_WEBSITE_PAGE = 'website_page';
const TYPE_TICKET = 'ticket';
const TYPE_KNOWLEDGEMANAGEMENT = 'knowledgemanagement';
const TYPE_FICHINTER = 'fichinter';
const TYPE_FICHINTER = 'fichinter';
const TYPE_ORDER = 'order';

/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
Expand All @@ -74,21 +75,22 @@ class Categorie extends CommonObject
* @var array<string,int> Table of mapping between type string and ID used for field 'type' in table llx_categories
*/
protected $MAP_ID = array(
'product' => 0,
'supplier' => 1,
'customer' => 2,
'member' => 3,
'contact' => 4,
'bank_account' => 5,
'project' => 6,
'user' => 7,
'bank_line' => 8,
'warehouse' => 9,
'actioncomm' => 10,
'website_page' => 11,
'ticket' => 12,
'product' => 0,
'supplier' => 1,
'customer' => 2,
'member' => 3,
'contact' => 4,
'bank_account' => 5,
'project' => 6,
'user' => 7,
'bank_line' => 8,
'warehouse' => 9,
'actioncomm' => 10,
'website_page' => 11,
'ticket' => 12,
'knowledgemanagement' => 13,
'fichinter' => 14,
'fichinter' => 14,
'order' => 16,
);

/**
Expand All @@ -97,21 +99,22 @@ class Categorie extends CommonObject
* @note This array should be removed in future, once previous constants are moved to the string value. Deprecated
*/
public static $MAP_ID_TO_CODE = array(
0 => 'product',
1 => 'supplier',
2 => 'customer',
3 => 'member',
4 => 'contact',
5 => 'bank_account',
6 => 'project',
7 => 'user',
8 => 'bank_line',
9 => 'warehouse',
0 => 'product',
1 => 'supplier',
2 => 'customer',
3 => 'member',
4 => 'contact',
5 => 'bank_account',
6 => 'project',
7 => 'user',
8 => 'bank_line',
9 => 'warehouse',
10 => 'actioncomm',
11 => 'website_page',
12 => 'ticket',
13 => 'knowledgemanagement',
14 => 'fichinter',
16 => 'order',
);

/**
Expand All @@ -120,9 +123,9 @@ class Categorie extends CommonObject
* @todo Move to const array when PHP 5.6 will be our minimum target
*/
public $MAP_CAT_FK = array(
'customer' => 'soc',
'supplier' => 'soc',
'contact' => 'socpeople',
'customer' => 'soc',
'supplier' => 'soc',
'contact' => 'socpeople',
'bank_account' => 'account',
);

Expand All @@ -132,8 +135,8 @@ class Categorie extends CommonObject
* @note Move to const array when PHP 5.6 will be our minimum target
*/
public $MAP_CAT_TABLE = array(
'customer' => 'societe',
'supplier' => 'fournisseur',
'customer' => 'societe',
'supplier' => 'fournisseur',
'bank_account' => 'account',
);

Expand All @@ -143,21 +146,22 @@ class Categorie extends CommonObject
* @note Move to const array when PHP 5.6 will be our minimum target
*/
public $MAP_OBJ_CLASS = array(
'product' => 'Product',
'customer' => 'Societe',
'supplier' => 'Fournisseur',
'member' => 'Adherent',
'contact' => 'Contact',
'user' => 'User',
'account' => 'Account', // old for bank account
'bank_account' => 'Account',
'project' => 'Project',
'warehouse' => 'Entrepot',
'actioncomm' => 'ActionComm',
'website_page' => 'WebsitePage',
'ticket' => 'Ticket',
'product' => 'Product',
'customer' => 'Societe',
'supplier' => 'Fournisseur',
'member' => 'Adherent',
'contact' => 'Contact',
'user' => 'User',
'account' => 'Account', // old for bank account
'bank_account' => 'Account',
'project' => 'Project',
'warehouse' => 'Entrepot',
'actioncomm' => 'ActionComm',
'website_page' => 'WebsitePage',
'ticket' => 'Ticket',
'knowledgemanagement' => 'KnowledgeRecord',
'fichinter' => 'Fichinter',
'fichinter' => 'Fichinter',
'order' => 'Commande',
);

/**
Expand All @@ -166,37 +170,39 @@ class Categorie extends CommonObject
* @note Move to const array when PHP 5.6 will be our minimum target
*/
public static $MAP_TYPE_TITLE_AREA = array(
'product' => 'ProductsCategoriesArea',
'customer' => 'CustomersCategoriesArea',
'supplier' => 'SuppliersCategoriesArea',
'member' => 'MembersCategoriesArea',
'contact' => 'ContactsCategoriesArea',
'user' => 'UsersCategoriesArea',
'account' => 'AccountsCategoriesArea', // old for bank account
'bank_account' => 'AccountsCategoriesArea',
'project' => 'ProjectsCategoriesArea',
'warehouse' => 'StocksCategoriesArea',
'actioncomm' => 'ActioncommCategoriesArea',
'website_page' => 'WebsitePagesCategoriesArea',
'ticket' => 'TicketsCategoriesArea',
'product' => 'ProductsCategoriesArea',
'customer' => 'CustomersCategoriesArea',
'supplier' => 'SuppliersCategoriesArea',
'member' => 'MembersCategoriesArea',
'contact' => 'ContactsCategoriesArea',
'user' => 'UsersCategoriesArea',
'account' => 'AccountsCategoriesArea', // old for bank account
'bank_account' => 'AccountsCategoriesArea',
'project' => 'ProjectsCategoriesArea',
'warehouse' => 'StocksCategoriesArea',
'actioncomm' => 'ActioncommCategoriesArea',
'website_page' => 'WebsitePagesCategoriesArea',
'ticket' => 'TicketsCategoriesArea',
'knowledgemanagement' => 'KnowledgemanagementsCategoriesArea',
'fichinter' => 'FichintersCategoriesArea',
'fichinter' => 'FichintersCategoriesArea',
'order' => 'OrderCategoriesArea',
);

/**
* @var array<string,string> Object table mapping from type string (table llx_...) when value of key does not match table name.
* This array may be completed by external modules with hook "constructCategory"
*/
public $MAP_OBJ_TABLE = array(
'customer' => 'societe',
'supplier' => 'societe',
'member' => 'adherent',
'contact' => 'socpeople',
'account' => 'bank_account', // old for bank account
'project' => 'projet',
'warehouse' => 'entrepot',
'customer' => 'societe',
'supplier' => 'societe',
'member' => 'adherent',
'contact' => 'socpeople',
'account' => 'bank_account', // old for bank account
'project' => 'projet',
'warehouse' => 'entrepot',
'knowledgemanagement' => 'knowledgemanagement_knowledgerecord',
'fichinter' => 'fichinter',
'fichinter' => 'fichinter',
'order' => 'commande',
);

/**
Expand Down Expand Up @@ -261,6 +267,7 @@ class Categorie extends CommonObject
* @see Categorie::TYPE_WEBSITE_PAGE
* @see Categorie::TYPE_TICKET
* @see Categorie::TYPE_FICHINTER
* @see Categorie::TYPE_ORDER
*/
public $type;

Expand Down
Loading

0 comments on commit bec6401

Please sign in to comment.