Merge branch 'develop' into extrafields_object_filter

This commit is contained in:
Frédéric FRANCE
2024-11-27 22:06:10 +01:00
committed by GitHub
20 changed files with 22 additions and 91 deletions

View File

@@ -27852,12 +27852,6 @@ parameters:
count: 1
path: ../../htdocs/product/stock/movement_list.php
-
message: '#^Variable \$whClass might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/product/stock/movement_list.php
-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse

View File

@@ -96,4 +96,6 @@ CI also runs pre-commit to help maintain code quality.
Note:
Code for precommits are saved into:
.cache/pre-commit/repo*/pre_commit_hooks/php-*.sh
and
.cache/pre-commit/repo*/py_env-python3/lib/python*/site-packages/pre_commit_hooks/no_commit_to_branch.py

View File

@@ -43,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonpeople.class.php';
/**
* Class to manage members of a foundation
* Class to manage members of a foundation.
*/
class Adherent extends CommonObject
{
@@ -829,7 +829,8 @@ class Adherent extends CommonObject
$sql .= ", fk_user_mod = ".($user->id > 0 ? $user->id : 'null'); // Can be null because member can be create by a guest
$sql .= " WHERE rowid = ".((int) $this->id);
// If we change the type of membership, we set also label of new type
// If we change the type of membership, we set also label of new type..
'@phan-var-force Adherent $oldcopy';
if (!empty($this->oldcopy) && $this->typeid != $this->oldcopy->typeid) {
$sql2 = "SELECT libelle as label";
$sql2 .= " FROM ".MAIN_DB_PREFIX."adherent_type";
@@ -3104,11 +3105,14 @@ class Adherent extends CommonObject
$nbko++;
$listofmembersko[$adherent->id] = $adherent->id;
} else {
$adherent->fetch_thirdparty();
// Language code to use ($languagecodeformember) is default language of thirdparty, if no thirdparty, the language found from country of member then country of thirdparty, and if still not found we use the language of company.
$languagefromcountrycode = getLanguageCodeFromCountryCode($adherent->country_code ? $adherent->country_code : $adherent->thirdparty->country_code);
$languagecodeformember = (empty($adherent->thirdparty->default_lang) ? ($languagefromcountrycode ? $languagefromcountrycode : $mysoc->default_lang) : $adherent->thirdparty->default_lang);
$thirdpartyres = $adherent->fetch_thirdparty();
if ($thirdpartyres === -1 ) {
$languagecodeformember = $mysoc->default_lang;
} else {
// Language code to use ($languagecodeformember) is default language of thirdparty, if no thirdparty, the language found from country of member then country of thirdparty, and if still not found we use the language of company.
$languagefromcountrycode = getLanguageCodeFromCountryCode($adherent->country_code ? $adherent->country_code : $adherent->thirdparty->country_code);
$languagecodeformember = (empty($adherent->thirdparty->default_lang) ? ($languagefromcountrycode ? $languagefromcountrycode : $mysoc->default_lang) : $adherent->thirdparty->default_lang);
}
// Send reminder email
$outputlangs = new Translate('', $conf);

View File

@@ -231,12 +231,6 @@ class Asset extends CommonObject
*/
public $status;
/**
* @var static object oldcopy
*/
public $oldcopy;
/**
* @var AssetDepreciationOptions Used for computed fields of depreciation options class.
*/

View File

@@ -122,11 +122,6 @@ class Propal extends CommonObject
*/
public $ref_customer;
/**
* @var static oldcopy with propal properties
*/
public $oldcopy;
/**
* Status of the quote
* @var int

View File

@@ -248,11 +248,6 @@ class Facture extends CommonInvoice
*/
public $tab_next_situation_invoice = array();
/**
* @var static object oldcopy
*/
public $oldcopy;
/**
* @var float percentage of retainage
*/

View File

@@ -343,13 +343,6 @@ class Contact extends CommonObject
public $ip;
// END MODULEBUILDER PROPERTIES
/**
* Old copy
* @var static
*/
public $oldcopy; // To contain a clone of this when we need to save old properties of object
/**
* @var array<int,array{id:int,socid:int,element:string,source:string,code:string,label:string}> roles
*/

View File

@@ -76,11 +76,6 @@ class Comment extends CommonObject
public $comments = array();
/**
* @var static Object oldcopy
*/
public $oldcopy;
/**
* Constructor

View File

@@ -177,7 +177,7 @@ abstract class CommonObject
private $linkedObjectsFullLoaded = array();
/**
* @var static|null To store a cloned copy of the object before editing it (to keep track of its former properties)
* @var ?static To store a cloned copy of the object before editing it (to keep track of its former properties)
*/
public $oldcopy;

View File

@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2000-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2022 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2024 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
@@ -122,10 +122,10 @@ if (!function_exists('str_contains')) {
/**
* Return the full path of the directory where a module (or an object of a module) stores its files,
* Return the full path of the directory where a module (or an object of a module) stores its files.
* Path may depends on the entity if a multicompany module is enabled.
*
* @param CommonObject $object Dolibarr common object
* @param CommonObject $object Dolibarr common object.
* @param string $module Override object element, for example to use 'mycompany' instead of 'societe'
* @param int $forobject Return the more complete path for the given object instead of for the module only.
* @param string $mode 'output' (full main dir) or 'outputrel' (relative dir) or 'temp' (for temporary files) or 'version' (dir for archived files)
@@ -1592,7 +1592,7 @@ function dol_clone($object, $native = 2)
}
/**
* Optimize a size for some browsers (phone, smarphone, ...)
* Optimize a size for some browsers (phone, smarphone...)
*
* @param int $size Size we want
* @param string $type Type of optimizing:

View File

@@ -71,11 +71,6 @@ class Product extends CommonObject
*/
public $fk_element = 'fk_product';
/**
* @var static
*/
public $oldcopy;
/**
* @var array<string, array<string>> List of child tables. To test if we can delete object.
*/

View File

@@ -848,7 +848,6 @@ class Productlot extends CommonObject
*/
public function loadStatsExpedition($socid = 0)
{
// phpcs:enable
global $user, $hookmanager, $action;
$sql = "SELECT COUNT(DISTINCT exp.fk_soc) as nb_customers, COUNT(DISTINCT exp.rowid) as nb,";
@@ -923,7 +922,6 @@ class Productlot extends CommonObject
*/
public function loadStatsSupplierOrder($socid = 0)
{
// phpcs:enable
global $user, $hookmanager, $action;
$sql = "SELECT COUNT(DISTINCT cf.fk_soc) as nb_customers, COUNT(DISTINCT cf.rowid) as nb,";
@@ -998,7 +996,6 @@ class Productlot extends CommonObject
*/
public function loadStatsReception($socid = 0)
{
// phpcs:enable
global $user, $hookmanager, $action;
$sql = "SELECT COUNT(DISTINCT recep.fk_soc) as nb_customers, COUNT(DISTINCT recep.rowid) as nb,";
@@ -1072,7 +1069,6 @@ class Productlot extends CommonObject
*/
public function loadStatsMo($socid = 0)
{
// phpcs:enable
global $user, $hookmanager, $action;
$error = 0;

View File

@@ -333,8 +333,7 @@ if (empty($reshook)) {
}
if ($action == 'update_extras' && $permissiontoadd) {
$whClass = get_class($whClass);
$whClass::$oldcopy = dol_clone($tmpwarehouse, 2);
$tmpwarehouse->oldcopy = dol_clone($tmpwarehouse, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
// Fill array 'array_options' with data from update form
$ret = $extrafields->setOptionalsFromPost(null, $tmpwarehouse, GETPOST('attribute', 'restricthtml'));

View File

@@ -246,11 +246,6 @@ class Project extends CommonObject
*/
public $email_msgid;
/**
* @var ?static
*/
public $oldcopy;
/**
* @var array<int,int> Used to store workload details of a projet (array[day])
*/

View File

@@ -131,11 +131,6 @@ class Dolresource extends CommonObject
*/
public $cache_code_type_resource;
/**
* @var static Clone of object before changing it
*/
public $oldcopy;
/**
* Constructor

View File

@@ -133,11 +133,6 @@ class Societe extends CommonObject
*/
public $restrictiononfksoc = 1;
/**
* @var static To store a cloned copy of object before to edit it and keep track of old properties
*/
public $oldcopy;
/**
* array of supplier categories
* @var string[]

View File

@@ -177,7 +177,7 @@ if (empty($reshook)) {
}
if (!$error) {
$companybankaccount->oldcopy = dol_clone($companybankaccount, 2);
$companybankaccount->oldcopy = dol_clone($companybankaccount, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
$companybankaccount->socid = $object->id;
@@ -254,7 +254,7 @@ if (empty($reshook)) {
$companypaymentmode->fetch($id);
if (!$error) {
$companypaymentmode->oldcopy = dol_clone($companypaymentmode, 2);
$companypaymentmode->oldcopy = dol_clone($companypaymentmode, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
$companypaymentmode->fk_soc = $object->id;
@@ -311,7 +311,7 @@ if (empty($reshook)) {
// Ajout
$companybankaccount = new CompanyBankAccount($db);
$companybankaccount->socid = $object->id;
$companybankaccount->socid = $object->id;
$companybankaccount->fetch_thirdparty();

View File

@@ -246,17 +246,11 @@ class Ticket extends CommonObject
*/
public $ip;
/**
* @var static Save the ticket before an update operation (for triggers)
*/
public $oldcopy;
/**
* @var Ticket[] Array of Tickets
*/
public $lines;
/**
* @var string Regex pour les images
*/

View File

@@ -75,11 +75,6 @@ class User extends CommonObject
*/
public $id = 0;
/**
* @var static old copy of User
*/
public $oldcopy;
/**
* @var int
* @deprecated Use $status

View File

@@ -125,11 +125,6 @@ class UserGroup extends CommonObject
*/
public $all_permissions_are_loaded;
/**
* @var static
*/
public $oldcopy; // To contains a clone of this when we need to save old properties of object
public $fields = array(
'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'),
'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'default' => '1', 'index' => 1, 'position' => 5),