mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-08 10:38:15 +01:00
Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into 9.0
This commit is contained in:
@@ -1009,6 +1009,11 @@ if (! empty($hookmanager->resArray['eventarray'])) {
|
||||
}
|
||||
}
|
||||
|
||||
// Sort events
|
||||
foreach($eventarray as $keyDate => &$dateeventarray)
|
||||
{
|
||||
usort($dateeventarray, 'sort_events_by_date');
|
||||
}
|
||||
|
||||
|
||||
$maxnbofchar=0;
|
||||
@@ -1703,3 +1708,22 @@ function dol_color_minus($color, $minus, $minusunit = 16)
|
||||
}
|
||||
return $newcolor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sort events by date
|
||||
*
|
||||
* @param object $a Event A
|
||||
* @param object $b Event B
|
||||
* @return int < 0 if event A should be before event B, > 0 otherwise, 0 if they have the exact same time slot
|
||||
*/
|
||||
function sort_events_by_date($a, $b)
|
||||
{
|
||||
if($a->datep != $b->datep)
|
||||
{
|
||||
return $a->datep - $b->datep;
|
||||
}
|
||||
|
||||
// If both events have the same start time, longest first
|
||||
return $b->datef - $a->datef;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user