*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -305,10 +305,10 @@ if ($action == "correct_stock" && !$cancel && $usercanupdatestock) {
$result = $object->correct_stock_batch(
$user,
GETPOSTINT("id_entrepot"),
- $nbpiece,
+ (float) $nbpiece,
GETPOSTINT("mouvement"),
GETPOST("label", 'alphanohtml'), // label movement
- $priceunit,
+ (float) $priceunit,
$d_eatby,
$d_sellby,
$batchnumber,
@@ -321,10 +321,10 @@ if ($action == "correct_stock" && !$cancel && $usercanupdatestock) {
$result = $object->correct_stock(
$user,
GETPOSTINT("id_entrepot"),
- $nbpiece,
+ (float) $nbpiece,
GETPOSTINT("mouvement"),
GETPOST("label", 'alphanohtml'),
- $priceunit,
+ (float) $priceunit,
GETPOST('inventorycode', 'alphanohtml'),
$origin_element,
$origin_id,
@@ -375,11 +375,16 @@ if ($action == "transfert_stock" && !$cancel && $usercanupdatestock) {
$action = 'transfert';
}
}
+ $batch = '';
+ $sellby = 0;
+ $eatby = 0;
if (!$error) {
if ($id) {
$object = new Product($db);
$result = $object->fetch($id);
+ $result1 = -1;
+ $result2 = -1;
$db->begin();
@@ -397,6 +402,8 @@ if ($action == "transfert_stock" && !$cancel && $usercanupdatestock) {
if ($object->hasbatch()) {
$pdluo = new Productbatch($db);
+ $srcwarehouseid = 0;
+
if ($pdluoid > 0) {
$result = $pdluo->fetch($pdluoid);
if ($result) {
@@ -422,7 +429,7 @@ if ($action == "transfert_stock" && !$cancel && $usercanupdatestock) {
$result1 = $object->correct_stock_batch(
$user,
$srcwarehouseid,
- $nbpiece,
+ (float) $nbpiece,
1,
GETPOST("label", 'alphanohtml'),
$pricesrc,
@@ -440,13 +447,13 @@ if ($action == "transfert_stock" && !$cancel && $usercanupdatestock) {
$result2 = $object->correct_stock_batch(
$user,
GETPOSTINT("id_entrepot_destination"),
- $nbpiece,
+ (float) $nbpiece,
0,
GETPOST("label", 'alphanohtml'),
$pricedest,
$eatby,
$sellby,
- $batch,
+ (string) $batch,
GETPOST('inventorycode', 'alphanohtml')
);
if ($result2 < 0) {
@@ -459,7 +466,7 @@ if ($action == "transfert_stock" && !$cancel && $usercanupdatestock) {
$result1 = $object->correct_stock(
$user,
GETPOSTINT("id_entrepot"),
- $nbpiece,
+ (float) $nbpiece,
1,
GETPOST("label", 'alphanohtml'),
$pricesrc,
@@ -474,7 +481,7 @@ if ($action == "transfert_stock" && !$cancel && $usercanupdatestock) {
$result2 = $object->correct_stock(
$user,
GETPOSTINT("id_entrepot_destination"),
- $nbpiece,
+ (float) $nbpiece,
0,
GETPOST("label", 'alphanohtml'),
$pricedest,
@@ -543,10 +550,13 @@ if ($action == 'updateline' && GETPOST('save') == $langs->trans("Save") && $user
$form = new Form($db);
$formproduct = new FormProduct($db);
+$formproject = null;
if (isModEnabled('project')) {
$formproject = new FormProjets($db);
}
+
+$variants = false;
if ($id > 0 || $ref) {
$object = new Product($db);
$result = $object->fetch($id, $ref);
@@ -645,7 +655,7 @@ if ($id > 0 || $ref) {
if (isModEnabled("product") && isModEnabled("service")) {
$typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service");
print '';
- print (!getDolGlobalString('PRODUCT_DENY_CHANGE_PRODUCT_TYPE')) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, 0, $typeformat) : $langs->trans('Type');
+ print (!getDolGlobalString('PRODUCT_DENY_CHANGE_PRODUCT_TYPE')) ? $form->editfieldkey("Type", 'fk_product_type', (string) $object->type, $object, 0, $typeformat) : $langs->trans('Type');
print ' ';
print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, 0, $typeformat);
print ' ';
@@ -667,7 +677,7 @@ if ($id > 0 || $ref) {
print '';
print $form->editfieldval($text, 'cost_price', '', $object, 0, 'amount:6');
} else {
- print $form->editfieldkey($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6');
+ print $form->editfieldkey($text, 'cost_price', (string) $object->cost_price, $object, (int) $usercancreate, 'amount:6');
print ' ';
print $form->editfieldval($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6');
}
@@ -746,12 +756,12 @@ if ($id > 0 || $ref) {
print '';
// Stock alert threshold
- print ''.$form->editfieldkey($form->textwithpicto($langs->trans("StockLimit"), $langs->trans("StockLimitDesc"), 1), 'seuil_stock_alerte', $object->seuil_stock_alerte, $object, $user->hasRight('produit', 'creer')).' ';
+ print ' '.$form->editfieldkey($form->textwithpicto($langs->trans("StockLimit"), $langs->trans("StockLimitDesc"), 1), 'seuil_stock_alerte', (string) $object->seuil_stock_alerte, $object, $user->hasRight('produit', 'creer')).' ';
print $form->editfieldval("StockLimit", 'seuil_stock_alerte', $object->seuil_stock_alerte, $object, $user->hasRight('produit', 'creer'), 'string');
print ' ';
// Desired stock
- print ''.$form->editfieldkey($form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1), 'desiredstock', $object->desiredstock, $object, $user->hasRight('produit', 'creer'));
+ print ' '.$form->editfieldkey($form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1), 'desiredstock', (string) $object->desiredstock, $object, $user->hasRight('produit', 'creer'));
print ' ';
print $form->editfieldval("DesiredStock", 'desiredstock', $object->desiredstock, $object, $user->hasRight('produit', 'creer'), 'string');
print ' ';
@@ -891,6 +901,7 @@ if ($id > 0 || $ref) {
$sql = "SELECT max(m.datem) as datem";
$sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m";
$sql .= " WHERE m.fk_product = ".((int) $object->id);
+ $lastmovementdate = 0;
$resqlbis = $db->query($sql);
if ($resqlbis) {
$obj = $db->fetch_object($resqlbis);
diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php
index a21f6041664..7ef691049c2 100644
--- a/htdocs/product/stock/productlot_card.php
+++ b/htdocs/product/stock/productlot_card.php
@@ -608,7 +608,7 @@ if ($action != 'presend') {
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $usercanread; // If you can read, you can build the PDF to read content
$delallowed = $usercancreate; // If you can create/edit, you can remove a file on card
- print $formfile->showdocuments('product_batch', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', (empty($object->default_lang) ? '' : $object->default_lang), '', $object);
+ print $formfile->showdocuments('product_batch', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', '', '', (empty($object->default_lang) ? '' : $object->default_lang), '', $object);
}
print '';
diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php
index e6164d741d3..ca502f5cae7 100644
--- a/htdocs/product/stock/productlot_list.php
+++ b/htdocs/product/stock/productlot_list.php
@@ -2,6 +2,7 @@
/* Copyright (C) 2007-2016 Laurent Destailleur
* Copyright (C) 2018-2021 Ferran Marcet
* Copyright (C) 2019-2024 Frédéric France
+ * Copyright (C) 2025 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -122,11 +123,11 @@ foreach ($object->fields as $key => $val) {
if (!empty($val['visible'])) {
$visible = (int) dol_eval((string) $val['visible'], 1);
$arrayfields['t.'.$key] = array(
- 'label'=>$val['label'],
- 'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>(abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
- 'position'=>$val['position'],
- 'help'=> isset($val['help']) ? $val['help'] : ''
+ 'label' => $val['label'],
+ 'checked' => (($visible < 0) ? 0 : 1),
+ 'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
+ 'position' => $val['position'],
+ 'help' => isset($val['help']) ? $val['help'] : ''
);
}
}
@@ -526,7 +527,7 @@ foreach ($object->fields as $key => $val) {
} elseif ($key == 'lang') {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($db);
- print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2);
+ print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2);
} else {
print ' ';
}
@@ -537,7 +538,7 @@ foreach ($object->fields as $key => $val) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
-$parameters = array('arrayfields'=>$arrayfields);
+$parameters = array('arrayfields' => $arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
/*if (!empty($arrayfields['anotherfield']['checked'])) {
@@ -581,7 +582,7 @@ foreach ($object->fields as $key => $val) {
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
-$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
+$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@@ -655,13 +656,13 @@ while ($i < $imaxinloop) {
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '$key)) {
- print ' title="'.dol_escape_htmltag($object->$key).'"';
+ print ' title="'.dol_escape_htmltag((string) $object->$key).'"';
}
print '>';
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'rowid') {
- print $object->showOutputField($val, $key, $object->id, '');
+ print $object->showOutputField($val, $key, (string) $object->id, '');
} else {
if ($key == 'batch') {
print $object->getNomUrl(1);
@@ -690,7 +691,7 @@ while ($i < $imaxinloop) {
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
- $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
+ $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@@ -731,7 +732,7 @@ if ($num == 0) {
$db->free($resql);
-$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
+$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php
index 1f0a72aeb43..b242e522acd 100644
--- a/htdocs/product/stock/replenish.php
+++ b/htdocs/product/stock/replenish.php
@@ -7,7 +7,7 @@
* Copyright (C) 2019-2024 Frédéric France
* Copyright (C) 2021 Ferran Marcet
* Copyright (C) 2021 Antonin MARCHAL
- * Copyright (C) 2024 MDW
+ * Copyright (C) 2024-2025 MDW
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -80,6 +80,7 @@ $fk_entrepot = GETPOSTINT('fk_entrepot');
// List all visible warehouses
$resWar = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize(getEntity('stock')) . ")");
$listofqualifiedwarehousesid = "";
+$lastWarehouseID = 0;
$count = 0;
while ($tmpobj = $db->fetch_object($resWar)) {
if (!empty($listofqualifiedwarehousesid)) {
@@ -286,10 +287,10 @@ if ($action == 'order' && GETPOST('valid') && $user->hasRight('fournisseur', 'co
0,
$line->type,
0,
- false,
- null,
- null,
0,
+ null,
+ null,
+ array(),
$line->fk_unit,
$line->multicurrency_subprice
);
@@ -855,7 +856,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
exit;
}
- $prod->load_stock('warehouseopen, warehouseinternal'.(!$usevirtualstock ? ', novirtual' : ''), $draftchecked);
+ $prod->load_stock('warehouseopen, warehouseinternal'.(!$usevirtualstock ? ', novirtual' : ''), $draftchecked === 'checked' ? 1 : 0);
// Multilangs
if (getDolGlobalInt('MAIN_MULTILANGS')) {
diff --git a/htdocs/product/stock/stats/commande_fournisseur.php b/htdocs/product/stock/stats/commande_fournisseur.php
index ce07ee4a3de..8bf1ba453f3 100644
--- a/htdocs/product/stock/stats/commande_fournisseur.php
+++ b/htdocs/product/stock/stats/commande_fournisseur.php
@@ -6,6 +6,7 @@
* Copyright (C) 2014 Florian Henry
* Copyright (C) 2023 Gauthier VERDOL
* Copyright (C) 2024 Frédéric France
+ * Copyright (C) 2025 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -241,10 +242,10 @@ if ($id > 0 || !empty($ref)) {
$sql .= " WHERE cf.entity IN (".getEntity('product').")";
$sql .= " AND cfdi.batch = '".($db->escape($object->batch))."'";
if (!empty($search_month)) {
- $sql .= ' AND MONTH(cf.date_commande) IN ('.$db->sanitize($search_month).')';
+ $sql .= ' AND MONTH(cf.date_commande) IN ('.$db->sanitize((string) $search_month).')';
}
if (!empty($search_year)) {
- $sql .= ' AND YEAR(cf.date_commande) IN ('.$db->sanitize($search_year).')';
+ $sql .= ' AND YEAR(cf.date_commande) IN ('.$db->sanitize((string) $search_year).')';
}
if (!$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
@@ -300,7 +301,7 @@ if ($id > 0 || !empty($ref)) {
print '';
print $langs->trans('Period').' ('.$langs->trans("OrderDate").') - ';
print $langs->trans('Month').':
';
- print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
+ print $langs->trans('Year').':'.$formother->selectyear($search_year ? (string) $search_year : '-1', 'search_year', 1, 20, 5);
print '
';
print '
';
print '
';
diff --git a/htdocs/product/stock/stats/expedition.php b/htdocs/product/stock/stats/expedition.php
index 98e95f94520..b7e8e77a5f1 100644
--- a/htdocs/product/stock/stats/expedition.php
+++ b/htdocs/product/stock/stats/expedition.php
@@ -6,6 +6,7 @@
* Copyright (C) 2014 Florian Henry
* Copyright (C) 2023 Gauthier VERDOL
* Copyright (C) 2024 Frédéric France
+ * Copyright (C) 2025 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -241,10 +242,10 @@ if ($id > 0 || !empty($ref)) {
$sql .= " WHERE exp.entity IN (".getEntity('product').")";
$sql .= " AND db.batch = '".($db->escape($object->batch))."'";
if (!empty($search_month)) {
- $sql .= ' AND MONTH(exp.date_creation) IN ('.$db->sanitize($search_month).')';
+ $sql .= ' AND MONTH(exp.date_creation) IN ('.$db->sanitize((string) $search_month).')';
}
if (!empty($search_year)) {
- $sql .= ' AND YEAR(exp.date_creation) IN ('.$db->sanitize($search_year).')';
+ $sql .= ' AND YEAR(exp.date_creation) IN ('.$db->sanitize((string) $search_year).')';
}
if (!$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
@@ -299,7 +300,7 @@ if ($id > 0 || !empty($ref)) {
print '';
print $langs->trans('Period').' ('.$langs->trans("DateCreation").') - ';
print $langs->trans('Month').':
';
- print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
+ print $langs->trans('Year').':'.$formother->selectyear($search_year ? (string) $search_year : '-1', 'search_year', 1, 20, 5);
print '
';
print '
';
print '
';
diff --git a/htdocs/product/stock/stats/mo.php b/htdocs/product/stock/stats/mo.php
index b1a3477871b..933de644b1f 100644
--- a/htdocs/product/stock/stats/mo.php
+++ b/htdocs/product/stock/stats/mo.php
@@ -188,10 +188,10 @@ if ($id > 0 || !empty($ref)) {
$sql .= " AND c.entity IN (".getEntity('mo').")";
$sql .= " AND cd.batch = '".($db->escape($object->batch))."'";
if (!empty($search_month)) {
- $sql .= ' AND MONTH(c.date_valid) IN ('.$db->sanitize($search_month).')';
+ $sql .= ' AND MONTH(c.date_valid) IN ('.$db->sanitize((string) $search_month).')';
}
if (!empty($search_year)) {
- $sql .= ' AND YEAR(c.date_valid) IN ('.$db->sanitize($search_year).')';
+ $sql .= ' AND YEAR(c.date_valid) IN ('.$db->sanitize((string) $search_year).')';
}
if ($socid > 0) {
$sql .= " AND s.rowid = ".((int) $socid);
@@ -245,7 +245,7 @@ if ($id > 0 || !empty($ref)) {
print '
';
print $langs->trans('Period').' ('.$langs->trans("DateCreation").') - ';
print $langs->trans('Month').':
';
- print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
+ print $langs->trans('Year').':'.$formother->selectyear($search_year ? (string) $search_year : '-1', 'search_year', 1, 20, 5);
print '
';
print '
';
print '
';
diff --git a/htdocs/product/stock/stats/reception.php b/htdocs/product/stock/stats/reception.php
index 00eae3cb6aa..bbd3c4f129f 100644
--- a/htdocs/product/stock/stats/reception.php
+++ b/htdocs/product/stock/stats/reception.php
@@ -6,6 +6,7 @@
* Copyright (C) 2014 Florian Henry
* Copyright (C) 2023 Gauthier VERDOL
* Copyright (C) 2024 Frédéric France
+ * Copyright (C) 2025 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -240,10 +241,10 @@ if ($id > 0 || !empty($ref)) {
$sql .= " WHERE recep.entity IN (".getEntity('product').")";
$sql .= " AND d.batch = '".($db->escape($object->batch))."'";
if (!empty($search_month)) {
- $sql .= ' AND MONTH(recep.date_creation) IN ('.$db->sanitize($search_month).')';
+ $sql .= ' AND MONTH(recep.date_creation) IN ('.$db->sanitize((string) $search_month).')';
}
if (!empty($search_year)) {
- $sql .= ' AND YEAR(recep.date_creation) IN ('.$db->sanitize($search_year).')';
+ $sql .= ' AND YEAR(recep.date_creation) IN ('.$db->sanitize((string) $search_year).')';
}
if (!$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
@@ -298,7 +299,7 @@ if ($id > 0 || !empty($ref)) {
print '';
print $langs->trans('Period').' ('.$langs->trans("DateCreation").') - ';
print $langs->trans('Month').':
';
- print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
+ print $langs->trans('Year').':'.$formother->selectyear($search_year ? (string) $search_year : '-1', 'search_year', 1, 20, 5);
print '
';
print '
';
print '
';
diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php
index 1ae34e47050..0c25b9bb8ba 100644
--- a/htdocs/product/stock/stockatdate.php
+++ b/htdocs/product/stock/stockatdate.php
@@ -5,7 +5,7 @@
* Copyright (C) 2016 Juanjo Menent
* Copyright (C) 2016 ATM Consulting
* Copyright (C) 2019-2024 Frédéric France
- * Copyright (C) 2024 MDW
+ * Copyright (C) 2024-2025 MDW
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -612,6 +612,8 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
//}
}
+ $nbofmovement = 0;
+ $virtualstock = 0;
if ($mode == 'future') {
$prod->load_stock('warehouseopen,warehouseinternal,nobatch', 0, $dateendofday);
$stock = $prod->stock_theorique; // virtual stock at a date
@@ -619,7 +621,6 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$virtualstock = $prod->stock_theorique; // virtual stock in infinite future
} else {
$stock = $currentstock;
- $nbofmovement = 0;
if (!empty($search_fk_warehouse)) {
foreach ($search_fk_warehouse as $val) {
$stock -= empty($movements_prod_warehouse[$objp->rowid][$val]) ? 0 : $movements_prod_warehouse[$objp->rowid][$val];
diff --git a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php
index f4bc5fa55c7..a9b6de52bf7 100644
--- a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php
+++ b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php
@@ -1,9 +1,8 @@
* Copyright (C) 2021 Gauthier VERDOL
- * Copyright (C) ---Put here your own copyright and developer email---
* Copyright (C) 2024 Frédéric France
- * Copyright (C) 2024 MDW
+ * Copyright (C) 2024-2025 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -457,7 +456,7 @@ class StockTransferLine extends CommonObjectLine
$user,
$p->id,
$fk_entrepot,
- $op[$direction],
+ (float) $op[$direction],
$direction,
empty($direction) ? $this->pmp : 0,
$label,
@@ -484,7 +483,7 @@ class StockTransferLine extends CommonObjectLine
$user,
$p->id,
$fk_entrepot,
- $op[$direction],
+ (float) $op[$direction],
$direction,
empty($direction) ? $this->pmp : 0,
$label,
diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php
index 5e17dbc626e..32edbcc2494 100644
--- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php
+++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2024 MDW
+ * Copyright (C) 2024-2025 MDW
* Copyright (C) 2024 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
@@ -647,7 +647,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($action != 'classify') {
$morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' ';
}
- $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
+ $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);
@@ -941,9 +941,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$filtertype = '';
}
if (getDolGlobalInt('PRODUIT_LIMIT_SIZE') <= 0) {
- $limit = '';
+ $limit = 0;
} else {
- $limit = getDolGlobalString('PRODUIT_LIMIT_SIZE');
+ $limit = getDolGlobalInt('PRODUIT_LIMIT_SIZE');
}
$form->select_produits($fk_product, 'fk_product', $filtertype, $limit, 0, -1, 2, '', 0, array(), 0, 0, 0, 'minwidth200imp maxwidth300', 1);
diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_contact.php b/htdocs/product/stock/stocktransfer/stocktransfer_contact.php
index aab6d493cc7..dfae3f2f121 100644
--- a/htdocs/product/stock/stocktransfer/stocktransfer_contact.php
+++ b/htdocs/product/stock/stocktransfer/stocktransfer_contact.php
@@ -5,6 +5,7 @@
* Copyright (C) 2011-2015 Philippe Grand
* Copyright (C) 2021 Gauthier VERDOL
* Copyright (C) 2024 Frédéric France
+ * Copyright (C) 2025 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -123,7 +124,7 @@ if ($action == 'addcontact' && $user->hasRight('stocktransfer', 'stocktransfer',
}
} elseif ($action == 'swapstatut' && $user->hasRight('stocktransfer', 'stocktransfer', 'write')) { // Toggle the status of a contact
if ($object->id > 0) {
- $result = $object->swapContactStatus(GETPOST('ligne'));
+ $result = $object->swapContactStatus(GETPOSTINT('ligne'));
}
} elseif ($action == 'deletecontact' && $user->hasRight('stocktransfer', 'stocktransfer', 'write')) { // Deletes a contact
$result = $object->delete_contact($lineid);
diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_list.php b/htdocs/product/stock/stocktransfer/stocktransfer_list.php
index c108ba11a80..cef55ad167c 100644
--- a/htdocs/product/stock/stocktransfer/stocktransfer_list.php
+++ b/htdocs/product/stock/stocktransfer/stocktransfer_list.php
@@ -1,8 +1,8 @@
* Copyright (C) 2021 Gauthier VERDOL
- * Copyright (C) ---Put here your own copyright and developer email---
* Copyright (C) 2024 Frédéric France
+ * Copyright (C) 2025 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -523,7 +523,7 @@ foreach ($object->fields as $key => $val) {
} elseif ($key == 'lang') {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($db);
- print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2);
+ print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2);
} else {
print ' ';
}
@@ -534,7 +534,7 @@ foreach ($object->fields as $key => $val) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
-$parameters = array('arrayfields'=>$arrayfields);
+$parameters = array('arrayfields' => $arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@@ -577,7 +577,7 @@ foreach ($object->fields as $key => $val) {
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
-$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
+$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@@ -676,13 +676,13 @@ while ($i < $imaxinloop) {
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '$key)) {
- print ' title="'.dol_escape_htmltag($object->$key).'"';
+ print ' title="'.dol_escape_htmltag((string) $object->$key).'"';
}
print '>';
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'rowid') {
- print $object->showOutputField($val, $key, $object->id, '');
+ print $object->showOutputField($val, $key, (string) $object->id, '');
} else {
print $object->showOutputField($val, $key, $object->$key, '');
}
@@ -707,7 +707,7 @@ while ($i < $imaxinloop) {
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
- $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
+ $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@@ -749,7 +749,7 @@ if ($num == 0) {
$db->free($resql);
-$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
+$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;