Merge branch '22.0' of git@github.com:Dolibarr/dolibarr.git into 22.0

This commit is contained in:
Laurent Destailleur 2025-11-05 22:13:35 +01:00
commit 9cc747d020
3 changed files with 9 additions and 8 deletions

View file

@ -1207,9 +1207,11 @@ if ($action == 'create') {
$objectsav = $object; // Because Expedition is $expe and not $object that is wrongly a duplicate of $objectsrc.
$object = $expe;
// Propagate extrafieldsvalue from source object to shipment object
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if (array_key_exists('options_'.$key, $objectsav->array_options)) { // We take value from order only if extrafield has the same name/key.
$object->array_options['options_'.$key] = $objectsav->array_options['options_'.$key];
if (isset($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if (array_key_exists('options_' . $key, $objectsav->array_options)) { // We take value from order only if extrafield has the same name/key.
$object->array_options['options_' . $key] = $objectsav->array_options['options_' . $key];
}
}
}
$parameters = array('objectsrc' => isset($objectsrc) ? $objectsrc : '', 'cols' => '3', 'socid' => $socid);

View file

@ -292,9 +292,8 @@ if (!getDolGlobalString('PRODUCT_STOCK_LIST_SHOW_WITH_PRECALCULATED_DENORMALIZED
$sql_having .= " HAVING SUM(" . $db->ifsql('s.reel IS NULL', '0', 's.reel') . ") < p.seuil_stock_alerte";
}
if ($search_stock_physique != '') {
//$natural_search_physique = natural_search('HAVING SUM(' . $db->ifsql('s.reel IS NULL', '0', 's.reel') . ')', $search_stock_physique, 1, 1);
$natural_search_physique = natural_search('SUM(' . $db->ifsql('s.reel IS NULL', '0', 's.reel') . ')', $search_stock_physique, 1, 1);
$natural_search_physique = " " . substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters
$natural_search_physique = natural_search('__SUM_OF_REEL__', $search_stock_physique, 1, 1);
$natural_search_physique = " " . substr(str_replace('__SUM_OF_REEL__', 'SUM(COALESCE(s.reel, 0))', $natural_search_physique), 1, -1); // remove first "(" and last ")" characters
if (!empty($sql_having)) {
$sql_having .= " AND";
} else {

View file

@ -394,8 +394,8 @@ if ($search_toolowstock) {
$sql_having .= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet
}
if ($search_stock_physique != '') {
$natural_search_physique = natural_search('SUM(' . $db->ifsql('pb.qty IS NULL', $db->ifsql('ps.reel IS NULL', '0', 'ps.reel'), 'pb.qty') . ')', $search_stock_physique, 1, 1);
$natural_search_physique = " " . substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters
$natural_search_physique = natural_search('__SEARCH_PHYSIQUE__', $search_stock_physique, 1, 1);
$natural_search_physique = " " . substr(str_replace('__SEARCH_PHYSIQUE__', 'SUM(COALESCE(pb.qty, ps.reel, 0))', $natural_search_physique), 1, -1); // remove first "(" and last ")" characters
if (!empty($sql_having)) {
$sql_having .= " AND";
} else {