Skip to content

Commit

Permalink
Merge branch '21.0' of [email protected]:Dolibarr/dolibarr.git into 21.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Feb 15, 2025
2 parents 45321f9 + ed87ce3 commit dcc0ede
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
7 changes: 2 additions & 5 deletions htdocs/core/ajax/box.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')) {
Expand Down
14 changes: 9 additions & 5 deletions htdocs/core/class/infobox.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@
$db->free($resql);

if (empty($num)) {
$colspan = 4;
$colspan = 5;
if (isModEnabled('productbatch')) {
$colspan++;
}
Expand Down

0 comments on commit dcc0ede

Please sign in to comment.