mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +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;
|
||||
}
|
||||
|
||||
@@ -1540,14 +1540,16 @@ if (empty($reshook))
|
||||
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
if (empty($datefacture)) {
|
||||
$error++;
|
||||
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("Date")) . '</div>';
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->trans("Date"));
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
|
||||
if (!($_POST['situations'] > 0)) {
|
||||
$error++;
|
||||
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")) . '</div>';
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation"));
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
@@ -2275,11 +2277,13 @@ if (empty($reshook))
|
||||
if (!$object->fetch($id) > 0) dol_print_error($db);
|
||||
if (!is_null(GETPOST('all_progress')) && GETPOST('all_progress') != "")
|
||||
{
|
||||
$all_progress = GETPOST('all_progress', 'int');
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$percent = $line->get_prev_progress($object->id);
|
||||
if (GETPOST('all_progress') < $percent) {
|
||||
$mesg = '<div class="warning">' . $langs->trans("CantBeLessThanMinPercent") . '</div>';
|
||||
if (floatval($all_progress) < floatval($percent)) {
|
||||
$mesg = $langs->trans("Line") . ' ' . $i . ' '. $line->ref .' : ' . $langs->trans("CantBeLessThanMinPercent");
|
||||
setEventMessages($mesg, null, 'warnings');
|
||||
$result = -1;
|
||||
} else
|
||||
$object->update_percent($line, $_POST['all_progress']);
|
||||
|
||||
Reference in New Issue
Block a user