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

This commit is contained in:
Laurent Destailleur
2019-04-23 12:25:53 +02:00
2 changed files with 32 additions and 4 deletions

View File

@@ -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;
}