calculateBalanceForProductBefore() cast the SUM of stock movement values
to (int), which truncated the fractional part. For products tracked in
fractional units (kg, liters, ...), the before/after period stock balance
displayed in the stock movement list (product/stock/movement_list.php) was
wrong (for example a real balance of 10.5 was shown as 10).
Cast the computed balance to (float) instead and update the method return
type accordingly.
Add a PHPUnit test (MouvementStockTest::testCalculateBalanceForProductBefore)
that records a fractional reception and checks the returned balance is not
truncated.
* opérations CRUD du modèle DiscountAbsolute
* taux de taxes locales et types ajoutés au modèle
* canvas et méthode paramétrées pour test unitaires
* test création et lecture OK
* #37423 - DiscountAbsolute model refactor to have localtaxes on a remise - unit tests completed
* phpcs
* remove comment
* phpcs local
* remove attributes in favor of parent
* phpstan - type de données et correction tests unitaires
* typage des retours
* .
* exceptions Phan sur test unitaire
* commentaire de fonction bien formatté
* directives phan depuis CommonClassTest
* avertissements phan
* removing localtaxes from multicurrency attributes as not supported by data model
* interface testing from ThirdParty comm/remx.php with added multicurrency ttc support
* phpcs OK
* phan typage
* merci phan
* buyer / seller roles of thirdparty integrity
* attribute typo in fetch
* setabsolutediscount and converttoreduc controller actions take into account localtaxes
* usage of localtaxes for discounts in objects
* phpcs
* stan typing
* integrity of multicurrency for generated credit note from supplier invoice
htdocs/core/actions_massactions.inc.php:1060-1140 wrapped all selected
records in a single begin/commit so a mid-loop failure rolled back
records that had already validated. For modules that side-effect on
validate (VeriFactu / AEAT push, e-invoice gateways), the side effect
cannot be reverted alongside the local rollback, leaving the local DB
and the external system out of sync.
Add a hidden constant MAIN_MASSVALIDATE_<OBJECTCLASS>_NO_GLOBAL_TRANSACTION
that, when set to 1, moves the begin/commit pair inside the loop so each
record is its own atomic unit. The constant is per-objectclass per eldy's
review on the issue, so it can be enabled by the module on the page that
needs it (e.g. MAIN_MASSVALIDATE_FACTURE_NO_GLOBAL_TRANSACTION on the
customer invoice list) without affecting other mass-validate pages.
Default behavior is unchanged: with no constant set, the original
all-or-nothing transaction stays in place.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
htdocs/datapolicy/class/datapolicycron.class.php:378 skipped the row as soon
as isObjectUsed() returned non-zero, regardless of whether the cron loop was
running the delete or anonymize action. isObjectUsed() on Societe is true as
soon as a quote, order, contract, intervention, shipment, etc. points at the
record - all things that are legitimately kept under accounting / commercial
retention while the personal data on the thirdparty itself must still be
erasable under GDPR.
Apply the guard only for action='delete' (where referential integrity is at
stake). Anonymization runs to completion regardless of attached commercial
documents.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>