From 2a2584b765fa0b8b1fadf1b834305df643e93104 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 14 Feb 2025 23:54:43 +0100 Subject: [PATCH 1/2] Debug v21 --- htdocs/product/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/index.php b/htdocs/product/index.php index fdca1c4133a08..9f08e92aa3580 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -655,7 +655,7 @@ $db->free($resql); if (empty($num)) { - $colspan = 4; + $colspan = 5; if (isModEnabled('productbatch')) { $colspan++; } From ed87ce34bf39c118b42fb5bc30e48b309046bf42 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sat, 15 Feb 2025 00:09:10 +0100 Subject: [PATCH 2/2] Debug v21 --- htdocs/core/ajax/box.php | 7 ++----- htdocs/core/class/infobox.class.php | 14 +++++++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/core/ajax/box.php b/htdocs/core/ajax/box.php index 775f1465def26..d1e2e1a499074 100644 --- a/htdocs/core/ajax/box.php +++ b/htdocs/core/ajax/box.php @@ -53,10 +53,7 @@ $boxid = GETPOSTINT('boxid'); $boxorder = GETPOST('boxorder'); -$zone = GETPOST('zone'); // Can be key for zone -if ($zone !== '') { - $zone = (int) $zone; -} +$zone = GETPOST('zone'); // Can be '0' or '1' or 'pagename'... $userid = GETPOSTINT('userid'); // Security check @@ -91,7 +88,7 @@ // boxorder value is the target order: "A:idboxA1,idboxA2,A-B:idboxB1,idboxB2,B" dol_syslog("AjaxBox boxorder=".$boxorder." zone=".$zone." userid=".$userid, LOG_DEBUG); - $result = InfoBox::saveboxorder($db, (int) $zone, $boxorder, $userid); + $result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid); if ($result > 0) { $langs->load("boxes"); if (!GETPOST('closing')) { diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index cfec6d48773c0..68340e873d28d 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -217,11 +217,11 @@ public static function listBoxes($dbs, $mode, $zone, $user = null, $excludelist /** * Save order of boxes for area and user * - * @param DoliDB $dbs Database handler - * @param int $zone Key of area (0 for Homepage, ...) - * @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...' - * @param int $userid Id of user - * @return int Return integer <0 if KO, 0=Nothing done, > 0 if OK + * @param DoliDB $dbs Database handler + * @param int|string $zone Key of area ('0' for Homepage, '1', 'pagename', ...) + * @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...' + * @param int $userid Id of user + * @return int Return integer <0 if KO, 0=Nothing done, > 0 if OK */ public static function saveboxorder($dbs, $zone, $boxorder, $userid = 0) { @@ -252,6 +252,10 @@ public static function saveboxorder($dbs, $zone, $boxorder, $userid = 0) return -3; } + if (!is_numeric($zone)) { + $zone = '0'; // Force $zone to a numeric value string + } + // Delete all lines $sql = "DELETE FROM ".$dbs->prefix()."boxes"; $sql .= " WHERE entity = ".$conf->entity;