* fix(commonobject): ensure `tms` field is updated with current timestamp
- Added logic to automatically update the `tms` field with the current timestamp when it exists in `$fieldvalues`.
- Aligns `tms` behavior with other timestamp fields like `date_modification`.
Improves consistency in timestamp handling across the codebase.
* fix(commonobject): set timezone for `dol_now()` call
- Updated `dol_now()` to use the user's timezone (`tz_user`).
- Ensures timestamps are consistent with user-specific settings.
* fix(commonobject): correct parameter for `dol_now()` function
- Updated `dol_now()` to use 'tzuser' instead of 'tz_user'.
- Fixes incorrect parameter causing potential timezone inconsistencies.
* fix(commonobject): respect `MAIN_DISABLE_AUTO_UPDATE_OF_TMS_FIELDS` setting
- Added a check for `MAIN_DISABLE_AUTO_UPDATE_OF_TMS_FIELDS` in the logic updating the `tms` field.
- Ensures the `tms` field is not auto-updated when this global setting is enabled.
- Retains the update behavior for `date_modification` and `fk_user_modif` fields.
Improves flexibility by honoring user-defined global settings for timestamp management.
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* commonobject: line_max: factor conditonals together
The SQL request is shared, except for the additional filter.
* Update commonobject.class.php
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
Simplify the code by early returning on query failure, which removes
almost every indentation level of the function.
It also highlights some important flaws here, since there is a return
without value (void return type) between the two queries if an error
happened, which would indicate the first query failed and nothing was
registered, but also an error check leading to printing an error message
if the second query fails, without actually reverting the first one, and
since there is no error code, there's no way to trigger a db->rollback()
from the caller code for this reason.
Simplify the code by early returning on query failure, which removes
almost every indentation level of the function.
It also highlights some important flaws here, since there is a return
without value (void return type) between the two queries if an error
happened, which would indicate the first query failed and nothing was
registered, but also an error check leading to printing an error message
if the second query fails, without actually reverting the first one, and
since there is no error code, there's no way to trigger a db->rollback()
from the caller code for this reason.
There's no need for the else{} block when the if block early returns,
and it helps highlighting the happy path. Note that this kind of change
only make sense when one of the block is an error, not a choice between
two possibilities.
* insertExtrafields(): simplify by returning 0 early if array_options is empty
* insertExtrafields(): simplify by using local variables $newValue and $attributeType
* insertExtrafields(): refactor by grouping the empty value cases for geodatabase-type extrafields
* insertExtrafields(): refactor by using a static mapping of geodata types to their ST_* db function on ExtraField class
* FIX: when an object that is shared across multiple entities already has some extrafields from another entity that are not reachable from the current entity, their values are lost
* Compliance with
- phan ( Closure Closure($key) has no declared or inferred parameter type for $key)
- php-stan (Error: Property ExtraFields::$geoDataTypes has no type specified)
* fill extrafields default values in case THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_SUPPLIER_ORDER applies
* Fix: send param changecompany when changing company on a supplier order creation
* introduce method User::getAffectedThirdparties()
* Forbid to display thirdparties on contact tab is user has no right to see them
* add control in add_contacts
* fix precommit
* fix phan, phpstan
* fix travis + fix using wrong table
* Forbid to display thirdparties on contact tab is user has no right to see them (more secure way)
* try to fix TRAVIS
* more efficient way to check user is allowed to ad a socpeople
* remove dead code
* FIX : Wrong entity to download document
* MODIFICATION : Remplacement de l'ID d'entité par l'objet dans les fonctions de gestion des fichiers pour une meilleure cohérence.
* Update files.lib.php
* Update files.lib.php
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>