* FIX#38959 - Supplier payment : multi-currency code/rate not saved on auto-created discount when a DEPOSIT supplier invoice is fully paid
* Move set of multicurrency_code like in PR #38966 merged
* Fix#38949 enforce takepos editlines permission on all line actions
addline, freezone, addnote, deleteline, updateqty, updateprice, updatereduction
and update_reduction_global all mutated the invoice content but only updateqty,
updateprice and updatereduction had a server-side editlines check. A user with
only takepos.run could therefore add free-text lines, change prices, delete
lines and apply discounts before payment, bypassing the editlines permission
that was supposed to gate exactly those operations. Refuse the request at the
top of the action dispatcher when editlines is missing. The editlines right
is enabled by default at module activation so existing setups are unaffected.
The editorderedlines per-line check kept by updateqty/updateprice/updatereduction
still applies after this gate, so the special_code = 4 override path is not
broken.
Signed-off-by: Dolicraft <contact@dolicraft.com>
* Fix#38949 move editlines guard after hook and use hasRight
Signed-off-by: Dolicraft <contact@dolicraft.com>
* Fix#38949 limit editlines guard to line-edit actions only
Adding a line, free zone or note stays under the run permission as in the
current stable branch, so a cashier without editlines can still ring up
sales. The guard now enforces editlines only on delete/qty/price/discount
actions, which is exactly what the report targets.
Signed-off-by: Dolicraft <contact@dolicraft.com>
---------
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
Switch four list endpoints that still used the legacy DolibarrApi::_checkFilters
+ bare preg_replace_callback path to the hardened forgeSQLFromUniversalSearchCriteria()
already used by the rest of the same files. The legacy path only validated
parenthesis balance and concatenated non-matching text verbatim into the WHERE
clause, while the hardened path applies the dummy-criteria syntax check first.
Endpoints touched:
- htdocs/api/class/api_setup.class.php getListOfRegions
- htdocs/api/class/api_setup.class.php getListOfIncoterms
- htdocs/api/class/api_setup.class.php getListOfVAT
- htdocs/multicurrency/class/api_multicurrencies.class.php index
See #38768 for the report.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: w3houde <clement@pixodeo.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
The note editor set $permissionnote from user->self->write only, so a user
holding user->user->read plus user->self->write (but not user->user->write)
could edit the public/private notes of any user, admins included: the
setnote actions are not in restrictedArea's write-check list, so
$permissionnote was the only remaining guard. It now requires user->user->write
to edit another user's notes, matching caneditfield in user/card.php.
Reported by Abderrahmane Aksoum.
Signed-off-by: Dolicraft <contact@dolicraft.com>
The dict.php renderer translated 'label' for some tables (c_units, c_product_nature,
c_productbatch_qcstatus) but left the 'libelle' column of c_stcomm and
c_stcommcontact as the raw English seed text. Map the row to its StatusProspect{id}
translation key when present so the French (or any other locale) shows the
expected label instead of 'Do not contact' / 'Never contacted' etc.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* FIX#38957 - Supplier invoice : Multi-currency code/rate and amount not saved when converting EXCESS PAID, CREDIT_NOTE or DEPOSIT to discount
* Add author
print_liste_field_titre signature is (name, file, field, begin, moreparam, ...)
but the seven calls in fourn/product/list.php passed $param at position 4
(begin) instead of 5 (moreparam), so the URL was rebuilt without the
fourn_id filter and the list reset when the user clicked a column header.
Swap to the correct slot, matching the fix already in the 22.0 line.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix#36238 keep supplier filter when sorting product list
print_liste_field_titre signature is (name, file, field, begin, moreparam, ...)
but the seven calls in fourn/product/list.php passed $param at position 4
(begin) instead of 5 (moreparam), so the URL was rebuilt without the
fourn_id filter and the list reset when the user clicked a column header.
Swap to the correct slot, matching the fix already in the 22.0 line.
Signed-off-by: Dolicraft <contact@dolicraft.com>
* Fix#34720 do not crash on duplicate bank_url link for same target
llx_bank_url has a UNIQUE key on (fk_bank, url_id, type) so dispatching two
distinct credit transfers for the same employee on the same bank line raised a
Duplicate entry crash that left the operation in an unfinished state. Pre-check
the row and reuse the existing rowid silently, keeping the historical link
without breaking the calling transaction.
Signed-off-by: Dolicraft <contact@dolicraft.com>
---------
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
import.php loadLangs only loaded exports/compta/errors, so labels coming from
modProduct / modService import_fields_array that resolve to keys in
products.lang (PriceBaseType) and margins.lang (CostPrice) stayed in English
on a French install. Add 'products' and 'margins' to the loaded set so the
import field picker shows the translated label everywhere else the user sees
the product card.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
Sanitize SQL query parameters.
Replace urlencode with explicit type casting to int for fk_statut and signed_status parameters.
Co-authored-by: MDW <mdeweerd@users.noreply.github.com>
Cache key was using legacy fk_contact field instead of the current
contact id ($cid), causing all contacts after the first to resolve
to the same cached entry in show_actions_messaging().
The import_fields_array entry for p.price_base_type accepted a missing/empty
value because the CSV importer skips the regex check when newval is empty
(import_csv.modules.php:682). Marking the field as mandatory with the trailing
star forces the user to map a column and provide HT or TTC, so the row no
longer ends up with an empty/NULL value that breaks price displays.
Signed-off-by: Dolicraft <contact@dolicraft.com>
On the third party discount tabs (htdocs/comm/remx.php), the multicurrency amount columns
(MulticurrencyAmountHT / MulticurrencyAmountTTC) and their colspan adjustments were guarded by
isModEnabled('multicompany') instead of isModEnabled('multicurrency'). As a result the foreign
currency amounts of available and consumed discounts/down payments were never shown when the
Multicurrency module is enabled (and the Multi-company module disabled).
The wrong test was introduced in commit 3bb1a2387b (2022, 'FIX php8 compatibility') which converted
!empty($conf->multicurrency->enabled) into isModEnabled('multicompany'). Restore the correct module
test. Present from v17 to develop; fixed here on the oldest maintained LTS branch (18.0).
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.