* qual: Update branch protection rules in AGENTS.md
Updated the branch protection rules in AGENTS.md to reflect the new policy of never committing directly to the `develop` branch or version branches matching the regex `^\d+\.\d+$`.
* Fix: Rename .claude directory to .agents
Renamed the .claude directory and its contents to .agents.
.agents is AI provider agnostic.
The legacy FCKeditor file manager connector (config.inc.php, also included
by browser/default/browser.php and connectors/php/connector.php) only called
main.inc.php and never checked any module right on 21.0 and 22.0, so any
authenticated user, even one with no permission, could reach the connector,
browse the medias directory and upload files.
The permission check already present on 23.0 and develop was never backported.
This adds the same guard so a non-admin without website write right is refused.
Reported by Abderrahmane Aksoum.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
Extrafield labels are stored HTML encoded in llx_extrafields.label
because they are saved through Translate::trans(), which runs the
string through htmlentities(). write_title() wrote the label as-is,
so the CSV header line showed raw entities (Données instead of
Données) while the data cells were fine. With a ; separator the
trailing ; of each entity also wrapped the label in double quotes.
Decode entities and remove HTML with dol_string_nohtmltag() before
csvClean(), consistent with the TSV and Excel export drivers. For the
derived _label column of Select extrafields, append the suffix before
csvClean() so the column stays valid CSV when the decoded label
contains the separator or a quote.
Signed-off-by: Gregory Aliot <greg.aliot@gmail.com>
Co-authored-by: Gregory Aliot <greg.aliot@gmail.com>
Since PHP 8.3 ldap_connect() takes a single URI argument. connectBind()
concatenated host and port as "host:port", which is a malformed URI for a
scheme-less host (localhost, 192.168.0.2) since the host is then parsed as the
URI scheme, so the following bind returns false. It also appended ":port" to an
already qualified ldaps:// URI. Prefix scheme-less hosts with ldap:// and leave
ldap(s):// URIs untouched.
Signed-off-by: Dolicraft <clement@pixodeo.com>
The double-space removal loop guarded its condition with the truthiness
of strpos():
while (strpos($temp, " ")) {
strpos() returns int 0 when the first double space is at position 0 of
the string, and 0 is falsy, so the loop body never runs. As a result NO
double spaces are collapsed at all in that string, including interior
ones. This happens for any input that begins with two spaces, e.g. text
whose leading "<br><br>" is turned into two leading spaces by the
removelinefeed step just above. The trailing trim() hides the leading
spaces but the interior double spaces survive, producing wrong output
(e.g. "Total amount due" instead of "Total amount due").
Fix by comparing against false, the standard PHP idiom used elsewhere in
this codebase. Strings that do not start with a double space were already
handled correctly, so behaviour is unchanged for them. Also corrected the
neighbouring comment ("double quotes" -> "double spaces").
Signed-off-by: TowyTowy <towy@airreps.link>
Co-authored-by: Claude <noreply@anthropic.com>
* FIX Invoice creation from template ignores extra fields set in form
* Fix Strict comparison using === between mixed and null will always evaluate to false
---------
Co-authored-by: Zakaria Boushaba <z.boushaba@vold.africa>
# Qual: Update logToCheckStyle (now extracts PHP Lint error msg)
logToCheckStyle was updated to extract PHP Lint (php -l) errors.
So they will show in the summary report and as annotations.
Two errors were surfaced on the 21.0 branch by the automated pullmerge
from the 18.0 to 20.0 branches, and they make the phan and phpstan CI
jobs fail on every open pull request:
- htdocs/takepos/invoice.php: dol_htmloutput_errors() second argument
must be an array, not null (phpstan).
- htdocs/societe/class/societe.class.php: the string parameter $remise
must be cast to float before the multiplication, like the surrounding
lines already do (phan PhanTypeInvalidLeftOperandOfNumericOp).
Signed-off-by: Gregory Aliot <greg.aliot@gmail.com>
Co-authored-by: Gregory Aliot <greg.aliot@gmail.com>
Removed an extra closing parenthesis in the user note permission check to fix a syntax error. Also added a new copyright line for 2026 and updated the parameters array formatting for consistency.
Two errors were surfaced on the 21.0 branch by the automated pullmerge
from the 18.0 to 20.0 branches, and they make the phan and phpstan CI
jobs fail on every open pull request:
- htdocs/takepos/invoice.php: dol_htmloutput_errors() second argument
must be an array, not null (phpstan).
- htdocs/societe/class/societe.class.php: the string parameter $remise
must be cast to float before the multiplication, like the surrounding
lines already do (phan PhanTypeInvalidLeftOperandOfNumericOp).
Signed-off-by: Gregory Aliot <greg.aliot@gmail.com>
Co-authored-by: Gregory Aliot <greg.aliot@gmail.com>
The full PHPStan analysis that runs on push to develop (and *.0 branches)
reported 5 new 'always true/false' errors, not caught by the per-PR diff
analysis and not yet in the baseline:
- htdocs/document.php: is_numeric() on the int-cast $entity is always true;
the redundant check is removed.
- htdocs/salaries/stats/index.php: $mode is hardcoded to 'statistics', so the
three view-switch button state comparisons are constant; replaced with their
literal results (1/1/2) and removed the now-unused $mode.
- htdocs/theme/md/style.css.php: method_exists($menumanager, 'showmenu') is
always true since $menumanager is a MenuManager; the redundant check is removed.
Behaviour is unchanged.
Several pages read a variable that is never defined on that page (copy/paste
from another page), so PHPStan level 10 flags 'Variable $x might not be
defined' and PHP 8 emits an undefined-variable warning with a null value:
- reception/card.php: $reception -> $object (matches the 10 other builddoc
blocks in the same file; otherwise the output PDF language is wrong)
- loan/payment/card.php: $object->id -> $id (page uses $id; matches the
adjacent enabled-button line)
- opensurvey/card.php: ConfirmRemovalOfPoll uses $id -> $numsondage
(otherwise the confirmation message placeholder is empty)
- opensurvey/results.php: guard $expiredate with !empty() (never defined on
this page; still falls back to $object->date_fin)
- projet/card.php: guard $morecss with !empty() (never defined here)
No behaviour change beyond removing the undefined-variable reads.
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
In htdocs/product/stock/stocktransfer/stocktransfer_contact.php the
'addcontact' action assigns $result only inside 'if ($object->id > 0)', but
the success test 'if ($result >= 0)' runs unconditionally. On a POST with no
id/ref the object is not fetched ($object->id == 0), so $result is undefined
and 'null >= 0' evaluates to true, redirecting as if the contact was added.
Initialize $result = -1 at the start of the block so the missing-object case
takes the error branch instead of a false-success redirect. PHPStan level 10
also flagged 'Variable $result might not be defined' here.