* 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>
The current solutions only uses time() which is a timestamp based on seconds. In some scenarios like automizing mails this is not enough. Even with the mt_rand there could be more likely collisions of the ids which is not allowed as it should be overall unique.
The newly used uniqid used a timestamp based on milliseconds and adds additionally a bit randomness which reduces the collision changes much more.
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* FIX 21.0: $height and $width can be ints, but also 'auto' (which is commonly used), so check for this special value before typecasting
* Update html.form.class.php
* Update html.form.class.php
---------
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>
* fix: manage correctly external module object link with myobject@mymodule element type
* add more doc in template module builder
---------
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.