Fix CI: Better typing for TBomLineId (#39275)

This commit is contained in:
MDW 2026-07-27 13:20:15 +02:00 committed by GitHub
parent 9d2c5edae3
commit c2943aade9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View file

@ -2,7 +2,7 @@
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020 Lenin Rivas <lenin@leninrivas.com>
* Copyright (C) 2023-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -274,7 +274,7 @@ class MoLine extends CommonObjectLine
* @param string $sortfield Sort field
* @param int $limit limit
* @param int $offset Offset
* @param string|array<string,string> $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...)
* @param string|array<string,string|int> $filter Filter array. Example array('field'=>'valueforlike', ...)
* @param string $filtermode Filter mode (AND or OR)
* @return MoLine[]|int int <0 if KO, array of pages if OK
*/
@ -305,7 +305,7 @@ class MoLine extends CommonObjectLine
} elseif (strpos($key, 'date') !== false) {
$sqlwhere[] = $this->db->sanitize($key)." = '".$this->db->idate((int) $value)."'";
} else {
$sqlwhere[] = $this->db->sanitize($key)." LIKE '%".$this->db->escape($this->db->escapeforlike($value))."%'";
$sqlwhere[] = $this->db->sanitize($key)." LIKE '%".$this->db->escape($this->db->escapeforlike((string) $value))."%'";
}
}
}

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2017-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -64,7 +64,7 @@ $cancel = GETPOST('cancel');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'mocard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
$TBomLineId = GETPOST('bomlineid', 'array');
$TBomLineId = GETPOST('bomlineid', 'array:int');
$lineid = GETPOSTINT('lineid');
$socid = GETPOSTINT("socid");
@ -168,13 +168,13 @@ if (empty($reshook)) {
foreach ($TBomLineId as $id_bom_line) {
$object = new Mo($db); // modified by the actions_addupdatedelete.inc.php
$objectbomchildline->fetch($id_bom_line);
$objectbomchildline->fetch((int) $id_bom_line);
// Find the consume line of the parent MO generated from this BOM line.
// The lookup must be scoped to the parent MO and use an exact match on origin_id/origin_type,
// otherwise the default 'origin_id LIKE %..%' filter can return an unrelated line (or none),
// which would let the child MO be created from the leftover parent POST data (duplicate MO).
$TMoLines = $moline->fetchAll('DESC', 'rowid', 1, 0, array('fk_mo' => $mo_parent->id, 'origin_id' => $id_bom_line, 'origin_type' => 'bomline'));
$TMoLines = $moline->fetchAll('DESC', 'rowid', 1, 0, array('fk_mo' => $mo_parent->id, 'origin_id' => (int) $id_bom_line, 'origin_type' => 'bomline'));
if (empty($TMoLines)) {
continue;