The per-card Send by email button on Propal, Commande and Facture
already honours the hidden constants
`PROPOSAL_SENDBYEMAIL_FOR_ALL_STATUS`,
`COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS` and
`FACTURE_SENDBYEMAIL_FOR_ALL_STATUS` to allow sending drafts. The
mass Send by email action in the corresponding lists silently dropped
draft objects regardless of those constants, so an administrator who
intentionally enabled the override saw inconsistent behaviour between
the card and the list.
Apply the same constant check on the three draft-skip guards in
`htdocs/core/actions_massactions.inc.php` so the mass action behaves
the same way as the single-object button. Default behaviour is
unchanged: with none of the constants set, drafts are still skipped
with the existing 'OnlyXxxNotDraftCanBeSentInMassAction' error
message.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix#38491 Name the field in the ticket too-long error message
When a ticket message exceeds 65000 characters, Ticket::verify() and
Ticket::update() appended the bare string "ErrorFieldTooLong" to
$this->errors. setEventMessages forwards that string and
dol_htmloutput_mesg applies $langs->trans() to it, which yields the
raw template "Field %s is too long." with the %s placeholder still
visible because no argument was passed.
Replace the bare key with a pre-translated message that names the
field ("Initial message"), the same pattern already used in
htdocs/barcode/printsheet.php for the same lang key. Two identical
sites in the file are updated (one in verify, called by create, and
one in update). The "errors" and "ticket" lang files are loaded
defensively before translation because both methods can run before
the page-level loadLangs.
Reported by @ocemag, expected field name confirmed by @aspangaro.
Signed-off-by: Dolicraft <contact@dolicraft.com>
* Fix phan: declare $langs as global in ticket too-long branches
phan level 10 raised PhanUndeclaredVariable and PhanNonClassMethodCall
on the two branches that translate the new error message. The enclosing
Ticket::verify() and Ticket::update() do not declare global $langs;
add it where needed instead of opening the method scope further.
Signed-off-by: Dolicraft <contact@dolicraft.com>
---------
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Alexandre SPANGARO <alexandre.spangaro@gmail.com>
ExtraFields::showInputField normalises the legacy "(field=123)"
filter syntax of "List from a table" extrafields into the modern
USF "(field:=:123)" form. The compatibility regex
"/^\(?([a-z0-9]+)([=<>]+)(\d+)\)?$/i" only accepts alphanumeric
field names, so a filter like "fk_typent=2" does not match, the
filter is left as is, and forgeSQLFromUniversalSearchCriteria later
fails with "Filter error" because the raw expression is not valid
universal search syntax.
Accept the underscore character in the field name class, the rest
of the predicate is untouched. The two identical occurrences in
the file (one per branch of the dispatch) are updated.
Reported and root cause pinpointed by @stephanebourdon-cmyk.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
Updating a product selling price via /product/price.php triggered a
fatal "Call to undefined method stdClass::isEmpty()" at
Product::update line 1457 of 21.0. In the update_price flow,
$this->oldcopy is a stdClass (not a Product instance), so isEmpty()
does not exist on it. The page returned HTTP 500 and the open
transaction was forcibly closed by DoliDBMysqli::close.
Replace the isEmpty() call with empty($this->oldcopy->id), which is
the form already shipped in 22.0, 23.0 and develop after upstream
commit ef94452f77. The accompanying comment from that commit is
also brought in.
Same root cause as issue 37792 (closed, fixed in 23.0.3 and
forward); the fix was never backported to 21.0 even though the bug
is still triggered on that branch.
Reported by @YOYOKMC.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix#27987 refuse to save signature when too-many-links sanitizer fires
When the user signature contains more inline links/images than
MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT allows, GETPOST('signature',
'restricthtml') returns the literal string 'ErrorTooManyLinksIntoHTMLString'
instead of the sanitized HTML (see dol_string_unicode in
htdocs/core/lib/functions.lib.php:8755-8757). On the user/card.php save
sites, that literal was assigned verbatim to $object->signature and
persisted; the next outgoing email then used the literal as the
signature block, so the customer received an email whose entire
signature was the string 'ErrorTooManyLinksIntoHTMLString'.
Detect the literal at both save sites (action == 'add' around line 316
and action == 'update' around line 499), increment $error, surface a
clear setEventMessages and route the user back to the form so the
signature is not persisted. The MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT
setting is the legitimate guard; this PR only ensures its rejection
output never reaches the database or downstream emails.
Signed-off-by: Dolicraft <contact@dolicraft.com>
* Add ErrorTooManyLinksIntoHTMLString en_US translation
pre-commit CI on PR #38534 (Fix#27987) flagged the new lang key
ErrorTooManyLinksIntoHTMLString used in user/card.php as missing.
Add the en_US entry so the existing helper text from the constant
MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT is reachable through
$langs->trans().
Signed-off-by: Dolicraft <contact@dolicraft.com>
---------
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix#29799 widen RUM truncation so customer code fits
BonPrelevement::buildRumNumber() builds an auto-generated SEPA UMR
when no UMR was supplied on a new bank-mandate row. The format is
{RUM/UMR}-{yymmddHHMM}-{drum_id-customer_code}
with the tail truncated to 13 characters. That truncation is too
aggressive: typical Dolibarr customer codes (CU1908-00002,
CU2509-00012, ...) are already 12 characters, so any drum id at all
pushes the tail past 13 and the customer code is cut mid-string.
The generated UMR then no longer matches the actual customer code,
which is the symptom in the report ("customer code CU1908-00002
becomes 1-CU1908-0000 in the UMR").
The SEPA standard allows up to 35 characters for MndtId. The
non-truncatable prefix (RUM/UMR + '-' + 10-char date + '-') uses
15 characters, leaving up to 20 characters for the tail before hitting
the 35-char limit, and 17 before hitting the more conservative 32-char
target the original comment referenced. Bump the truncation to 20:
the typical drum-id + 12-char customer code (14 chars) now fits
cleanly, and longer codes still get truncated but at a much later
point.
Only the generation of newly created mandates is affected. Existing
$companybankaccount->rum values stored in the database are not
touched, so no migration is needed.
Signed-off-by: Dolicraft <contact@dolicraft.com>
* Update bonprelevement.class.php
---------
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
`Facture::createFromClone()` calls `Facture::fetch($fromid)` to
populate the in-memory object, then immediately runs
`$object->create($user)` to persist the clone. `fetch()` explicitly
sets `$this->thirdparty = null;` (see facture.class.php fetch()), and
the clone path never calls `fetch_thirdparty()` before `create()`.
When `create()` walks the cloned lines it goes through
`addLine()` -> `getLocalTaxesFromRate($txtva, 0, $this->thirdparty,
$mysoc)` -> `get_localtax($vatrate, 2, $buyer, $seller)`. The buyer
argument is the now-null $this->thirdparty, and `get_localtax()`
guards on `!$thirdparty_buyer->localtax2_assuj` and returns 0 as soon
as that property is unreadable. `calcul_price_total()` then computes
total_localtax2 = 0, and addLine() resets the line's localtax2_tx to
0 ("if ($total_localtax2)" branch in addLine()). The cloned line is
inserted with the IRPF (localtax2) rate stripped, which is the symptom
the reporter and the four other thread participants observed.
Call `fetch_thirdparty()` once in createFromClone() so the buyer is
populated for the rest of the clone flow. The fix is local to the
clone path; the regular "create from form" flow already had a
thirdparty set by its caller and is not affected.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
ProductCombination::update() called $this->updateProperties($parent,
$user) at line 439 and discarded the return value. updateProperties()
walks the parent's price levels, computes the variant price from the
combination's variation_price / variation_price_percentage and calls
Product::updatePrice() on the child product. updatePrice() refuses
to set a price below the configured price_min (returns -1 with
'ErrorPriceCantBeLowerThanMinPrice'), but ProductCombination::update()
still returned 1 because the failure was thrown away.
createProductCombination() initialises the new variant product with
price = price_ttc = price_min = price_min_ttc = 0 to keep a clean
price history, then commits the combination by calling
$newcomb->update($user). When the parent product has a non-zero
minimum price and the variation drops the computed price below it,
updateProperties() returns -1, update() reports success anyway, the
combination is committed and the variant product stays at price 0.
The card displays price 0 and minimum 0 with no error message, which
is exactly the behaviour the reporter described and that @JonBendtsen
confirmed was still present on develop after the v22 release.
Capture updateProperties()'s return value and propagate the negative
result so the calling createProductCombination() sees the failure,
rolls back the transaction and surfaces the underlying
'ErrorPriceCantBeLowerThanMinPrice' message. The variant is no longer
silently created with a 0 price; users get either the legitimate
adjusted price (when the variation is permissible) or a clear error
prompting them to drop the parent's minimum price first.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
The single subscription form (htdocs/adherents/subscription.php
lines 219-220 and 262) computes the subscription end date from the
selected AdherentType: it uses adht->duration_value and
adht->duration_unit to derive the end date with dol_time_plus_duree,
and only falls back to '1 year' when those fields are empty.
The mass action on the member list (htdocs/adherents/list.php
$action == 'createsubscription_confirm') skipped that step and
called Adherent::subscription($now, $amount, ..., $datesubend = 0)
with $datesubend left at 0 for any member. Adherent::subscription()
treats $datesubend = 0 as 'no end date supplied' and defaults to
+1 year - 1 day, so a member type configured for 6 months ended up
with a 12-month subscription whenever the mass action was used.
Compute the per-member end date before the call, mirroring the
single form: fetch the AdherentType of the current member, take
duration_value / duration_unit, and add them to $now. The previously
shipped MEMBER_SUBSCRIPTION_SUGGEST_END_OF_MONTH /
MEMBER_SUBSCRIPTION_SUGGEST_END_OF_YEAR override (commit b1d906d6d3)
still wins when set, because $datesubend keeps its computed value;
the per-type fallback only kicks in when no global override was used.
Same code path on 21.0, 22.0, 23.0 and develop; PR targets 21.0.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
Facture::addline()'s sixteenth positional argument is $type, which
defaults to 0 (TYPE_PRODUCT). When the addline call passes a non-zero
$fk_product, addline overrides $type from the fetched Product object,
so the type the caller passed is just a default for the no-product
case.
htdocs/projet/tasks/time.php had three invoice-line creation paths
for the project time-spent flow:
- line 567 (one line per user per day)
- line 666 (one line per time-spent declaration)
- line 764 (one line per task)
Only line 764 explicitly passed type=1. The other two relied on the
addline default of 0, so when a time entry had no product attached
and the chosen "service to use on lines by default" did not match a
product row that addline could fetch (for example if the service id
got reset between sessions or the product was disabled), the line
was stored with product_type=0. The PDF then computed
'Delivery of goods' in the category-of-operations mention even
though the invoice was for time spent. The reporter confirmed the
'one line per user' and 'one line per task' modes already worked,
which lines up with mode 567 (no product on the time entry) and
mode 764 (explicit type=1).
Pass Product::TYPE_SERVICE as the type at the two affected call
sites, matching the explicit value already used by the per-task
mode. The product fetch inside addline still overrides this when a
real service product is bound to the line, so the change is a
no-op in the happy path and only fixes the leak when no product is
resolved.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
htdocs/holiday/card.php fired the 'HolidaysToValidateAlertSolde' note
on the approval email whenever the number of requested open days
exceeded the current balance, even when the leave type was configured
in c_holiday_types with affect=0 (the type does not deduct from the
holiday balance). For non-deducted types, by definition, the balance
cannot drop, so the warning is bogus and misleading for the approver.
Look up c_holiday_types.affect via getDictionaryValue() and only
compute the balance comparison when affect=1. The
HOLIDAY_HIDE_APPROVER_ABOUT_NEGATIVE_BALANCE global keeps its previous
effect of silencing the warning entirely.
Same code path on 21.0, 22.0, 23.0 and develop; PR targets 21.0.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
When generating a PDF for an Evaluation on an entity other than entity 1,
$conf->hrm->multidir_output[$entity] was used without a fallback to
$conf->hrm->dir_output. If multidir_output for the target entity is empty,
the resulting path was '/evaluation/<ref>' (missing base), causing a
directory creation failure.
Apply the same pattern used in other PDF modules (e.g. pdf_crabe for invoices):
fall back to dir_output when multidir_output[$entity] is not set.
holiday module stores files using an ID-based 2-level hierarchy
(get_exdir with level=2), not a ref-based flat path.
Using dol_sanitizeFileName($object->ref) returns the wrong directory,
causing the attachment badge count to always read 0.
When cloning an invoice from one entity to another via the multicompany
entity selector, the cloned invoice was always created in the source entity.
The multicompany module correctly displays an entity selector in the clone
confirmation dialog (formConfirm hook), but the core handler for
'confirm_clone' in card.php never read the posted 'entity' parameter.
Additionally, Facture::createFromClone() had no 'forceentity' parameter,
unlike Propal::createFromClone() which already handled this correctly.
Fix:
- Add $forceentity = null parameter to Facture::createFromClone()
- Apply forceentity to the cloned object after fetch, before create()
- Pass GETPOST('entity') from card.php confirm_clone handler to createFromClone()
The Leistungsdatum (date_pointoftax) field on customer invoices remained
editable after invoice validation. This is the basis for the VAT-return
period assignment under accrual taxation (Soll-Versteuerung in Germany)
and is also a mandatory invoice content per §14 (4) Nr. 6 UStG — once the
invoice has been legally issued, the field must remain immutable to keep
the printed document, the bookkeeping period, and the VAT return in sync.
Hide the edit-pencil and gate the inline edit form on $object->status to
the draft status. Correction now requires either setting the invoice back
to draft or issuing a credit note + corrected new invoice — the GoBD-
conform path.
The action handler at line ~563 is intentionally not gated: a manually
crafted POST is functionally equivalent to direct DB write and out of
scope for the UI-layer protection.
* Fix#34069 read shipping weight, dimensions and quantities as floats
htdocs/expedition/card.php read the package weight, the three box
dimensions (sizeH / sizeW / sizeS), the true* fields (trueWeight /
trueWidth / trueHeight / trueDepth) and the per-line shipped quantity
with GETPOSTINT(). All of these are physical quantities that routinely
use decimals (a 1.6 kg parcel, a 0.25 m box edge, a 0.5 unit of
service), and GETPOSTINT() silently truncates the fractional part so
a 1.6 kg weight was stored as 1 kg and a 0.25 line quantity was
stored as 0, breaking the link with the source order line. The
reporter ran into both cases on v20 and confirmed it is still present
on v22.
Replace the GETPOSTINT() reads with GETPOST() + price2num() casts at
the six save sites (the initial create from source order, the four
'settrueX' inline actions and the per-line qtyl input) and the
displayed weight value, mirroring the float handling that exists in
htdocs/commande/card.php and other places. The weight unit and size
unit dropdowns stay as GETPOSTINT() since those are dictionary ids.
Same code path on 21.0, 22.0, 23.0 and develop; PR targets 21.0.
Signed-off-by: Dolicraft <contact@dolicraft.com>
* Fix#34069 use GETPOSTFLOAT helper per review
Address @eldy review on PR #38549: the develop branch already uses
GETPOSTFLOAT() at the same call sites, so backport the helper to v21
instead of inlining (float) price2num(GETPOST(...)). Same semantics
(GETPOSTFLOAT wraps the same expression at functions.lib.php line
1152 on 21.0) but shorter and idiomatic with the rest of the codebase.
Signed-off-by: Dolicraft <contact@dolicraft.com>
---------
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix#38429 validate recruitment API candidature payload against candidature model
api_recruitments::_validate hard-coded $this->jobposition->fields, so
postCandidature rejected payloads missing the jobposition mandatory
fields (ref, label, qty, fk_user_recruiter) instead of the candidature
ones (ref, email, status). A client posting a valid candidature with
just ref + email + status got '400 label field missing' first, then
'500 Field EMail is required' once they added the irrelevant fields.
Take the target model as second argument and pass $this->candidature
from postCandidature, $this->jobposition from postJobPosition. Same
shape as the fix already in develop (forward-port). Reported by the
issue author with the exact diff suggestion.
Same bug on 23.0; this PR targets 22.0 because that is the version
the reporter hit.
Signed-off-by: Dolicraft <contact@dolicraft.com>
* Update api_recruitments.class.php
---------
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
`make_substitutions()` resolves `__(TranslationKey)__` tokens via the
third $outputlangs argument, falling back to the global $langs (the
operator's language) when nothing is passed in. The mail-template
helpers in `html.formmail.class.php` already build the recipient
language at line 509-518 from `this->param['langsmodels']` (or from
the template's own `lang` column in `llx_c_email_templates`), but the
three call sites that turn the template body and subject into the
final preview dropped the argument:
- line 1041, when rebuilding repeated `__LINES__` from the template
`content_lines`
- line 1086, when substituting the template body for the form preview
- line 1478, when substituting the topic in `getHtmlForTopic()`
So a translation key set up in two languages was always resolved
with the operator's locale, never the recipient's, even when the
operator picked the French template for a French customer (or when
the template carried an explicit `lang` column). The PDF flow was
already correct because it routes its substitutions through the
already-localised `$outputlangs` of the document generator.
Pass $outputlangs at the two existing sites in the main render path,
and compute it from the template's `lang` column in the helper
`getHtmlForTopic()` so the subject and the body are localised
together. Templates with no explicit `lang` still resolve via the
operator's language, preserving the prior behaviour for that case.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
`htdocs/fourn/facture/card-rec.php` rendered the PDF model dropdown by
reading the constant directly with $conf->global->INVOICE_SUPPLIER_ADDON_PDF.
On PHP 8 that raises "Warning: Undefined property stdClass::$INVOICE_SUPPLIER_ADDON_PDF"
whenever the constant is not set, which is the typical case on a fresh
install or on installs that have never picked an explicit supplier
invoice PDF model. The warning shows up in the UI when an admin converts
a supplier invoice into a recurring template (see issue #32053, still
present in 21.0.0 per @mikygee).
Replace the direct property read with getDolGlobalString() which returns
an empty string when the constant is undefined; selectarray() then just
renders the dropdown without a preselected value, matching the previous
behaviour minus the PHP warning.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
ExtraLanguages::fetch_name_extralanguages() populates
$this->attributes only when the global
MAIN_USE_ALTERNATE_TRANSLATION_FOR constant lists the element type;
on a default install it stays empty. PHP 8 then raises
"Warning: Undefined array key 'societe'" when html.form.class.php
read $extralanguages->attributes['societe'][...] without checking
the parent key.
Two sites are affected: the early-return guard at line 440 (used by
field-level translation widgets) and the showRefNav helper at
line 10315 (used by the third-party card). Both already wrap their
real logic in empty() / is_array() but on the inner key only; add
an extra check on the parent so the array key access does not raise
on default installs.
Same code path on 21.0, 22.0, 23.0 and develop; PR targets 21.0.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
The product picker on order/proposal/invoice lines always left the
measuring-unit dropdown at the static initial value (the first row
returned by FormProduct::selectUnits(), typically 'Kg'), regardless
of which product the user picked. The reporter and the four other
confirmations on the issue describe exactly this: the dropdown
shows 'Kg' or 'ton' on every product even when each product is
configured with its own default unit in llx_product.fk_unit.
Two pieces were missing:
1. htdocs/product/ajax/products.php did not include the product's
fk_unit in the JSON payload returned to the line form, so the
client side had nothing to read.
2. htdocs/core/tpl/objectline_create.tpl.php never updated the
units dropdown when the ajax response came back. The price,
tva_tx and description fields were updated; fk_unit was not.
Add fk_unit to the JSON response and a small jQuery snippet right
after the VAT update that pushes the value into #units and fires
the change event so Select2 redraws. The dropdown now reflects the
product's default unit immediately after pick, and the existing
behaviour (no unit on the product) keeps showing the previous
static default.
Same code path on 21.0, 22.0, 23.0 and develop; PR targets 21.0.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
CUnits::fetch() and CUnits::fetchAll() both read the scale column with
'$obj->scale ? (int) $obj->scale : null', which collapses the legitimate
scale of 0 (kg, kilogram, second, ...) into null. selectMeasuringUnits in
htdocs/product/class/html.formproduct.class.php then renders that row as
'<option value="">' and the loose comparison '$lines->scale == $selected'
becomes 'null == "0"', which was true on PHP 7 but is false on PHP 8.
The kg option therefore stops getting the selected attribute on a product
that has weight_units=0 stored, the browser falls back to the first
option (mg in the default seed, scale=-6), and the next plain save of the
form posts back -6 even though the user only changed the name or the
description. Same path on net_measure_units when the stored unit has
scale=0 (kilogram), so the field flips to 'piece' on the same save.
Switch both reads to 'isset($obj->scale) ? (int) $obj->scale : null', the
same form already used by write() and update() at lines 113 and 357, so
scale=0 is preserved and only a truly missing column is mapped to null.
Reported by @daxitsolutions on 22.0.4; same code path on 21.0, 22.0,
23.0 and develop.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
Facture::createDepositFromOrigin buckets origin lines by tva_tx alone in
both the MAIN_DEPOSIT_MULTI_TVA branch (line 1796) and the default
%tot branch (line 1827), then passes the bare rate to Facture::addline
as $txtva. Facture::addline accepts the rate in the 'rate (CODE)'
form (line 4268: it preserves whatever is in parentheses), but the
bucket key has none, so the generated deposit line is stored with
vat_src_code = ''. The same loss cascades into Facture::convertToReduc
which then creates DiscountAbsolute rows with no code, and the final
invoice's discount line and PDF both render the rate without the
dictionary Code (see #38036 for the downstream effect).
Bucket by 'tva_tx (vat_src_code)' so addline receives the same form
the codebase already uses elsewhere (factureligne fetch at line 2557,
addline test at line 4268, c_payment_term key at line 1040). Two
origin lines with the same tva_tx but different codes now produce two
deposit lines with their respective codes preserved. updateline is
also called with the formatted rate so the MAIN_DEPOSIT_MULTI_TVA
rebalancing does not wipe the code right after addline set it.
$amount_ttc_diff in the %tot branch was reading $amountdeposit[0]
unconditionally even when the only key was a non-zero tva rate; switch
to ?? 0 to keep the unused value safe. The MULTI_TVA arithmetic now
takes the rate from a stripped variant of the bucket key so the
percentage maths still works when the key contains a Code in
parentheses.
Reported by @vincentpoussev. Same bucketing on 22.0, 23.0 and develop;
this PR targets 22.0.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>