mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 17:48:25 +01:00
Move function
This commit is contained in:
@@ -1095,6 +1095,38 @@ function GETPOSTFLOAT($paramname, $rounding = '')
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper function that combines values of a dolibarr DatePicker (such as Form::selectDate) for year, month, day (and
|
||||
* optionally hour, minute, second) fields to return a timestamp.
|
||||
*
|
||||
* @param string $prefix Prefix used to build the date selector (for instance using Form::selectDate)
|
||||
* @param string $hourTime 'getpost' to include hour, minute, second values from the HTTP request, 'XX:YY:ZZ' to set
|
||||
* hour, minute, second respectively (for instance '23:59:59')
|
||||
* @param string $gm Passed to dol_mktime
|
||||
* @return int|string Date as a timestamp, '' or false if error
|
||||
*/
|
||||
function GETPOSTDATE($prefix, $hourTime = '', $gm = 'auto')
|
||||
{
|
||||
$m = array();
|
||||
if ($hourTime === 'getpost') {
|
||||
$hour = GETPOSTINT($prefix . 'hour');
|
||||
$minute = GETPOSTINT($prefix . 'minute');
|
||||
$second = GETPOSTINT($prefix . 'second');
|
||||
} elseif (preg_match('/^(\d\d):(\d\d):(\d\d)$/', $hourTime, $m)) {
|
||||
$hour = intval($m[1]);
|
||||
$minute = intval($m[2]);
|
||||
$second = intval($m[3]);
|
||||
} else {
|
||||
$hour = $minute = $second = 0;
|
||||
}
|
||||
// normalize out of range values
|
||||
$hour = min($hour, 23);
|
||||
$minute = min($minute, 59);
|
||||
$second = min($second, 59);
|
||||
return dol_mktime($hour, $minute, $second, GETPOSTINT($prefix . 'month'), GETPOSTINT($prefix . 'day'), GETPOSTINT($prefix . 'year'), $gm);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a sanitized or empty value after checking value against a rule.
|
||||
*
|
||||
@@ -14340,37 +14372,6 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = null,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function that combines values of a dolibarr DatePicker (such as Form::selectDate) for year, month, day (and
|
||||
* optionally hour, minute, second) fields to return a timestamp.
|
||||
*
|
||||
* @param string $prefix Prefix used to build the date selector (for instance using Form::selectDate)
|
||||
* @param string $hourTime 'getpost' to include hour, minute, second values from the HTTP request, 'XX:YY:ZZ' to set
|
||||
* hour, minute, second respectively (for instance '23:59:59')
|
||||
* @param string $gm Passed to dol_mktime
|
||||
* @return int|string Date as a timestamp, '' or false if error
|
||||
*/
|
||||
function GETPOSTDATE($prefix, $hourTime = '', $gm = 'auto')
|
||||
{
|
||||
$m = array();
|
||||
if ($hourTime === 'getpost') {
|
||||
$hour = GETPOSTINT($prefix . 'hour');
|
||||
$minute = GETPOSTINT($prefix . 'minute');
|
||||
$second = GETPOSTINT($prefix . 'second');
|
||||
} elseif (preg_match('/^(\d\d):(\d\d):(\d\d)$/', $hourTime, $m)) {
|
||||
$hour = intval($m[1]);
|
||||
$minute = intval($m[2]);
|
||||
$second = intval($m[3]);
|
||||
} else {
|
||||
$hour = $minute = $second = 0;
|
||||
}
|
||||
// normalize out of range values
|
||||
$hour = min($hour, 23);
|
||||
$minute = min($minute, 59);
|
||||
$second = min($second, 59);
|
||||
return dol_mktime($hour, $minute, $second, GETPOSTINT($prefix . 'month'), GETPOSTINT($prefix . 'day'), GETPOSTINT($prefix . 'year'), $gm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function that combines values of a dolibarr DatePicker (such as Form::selectDate) for year, month, day (and
|
||||
* optionally hour, minute, second) fields to return a a portion of URL reproducing the values from the current HTTP
|
||||
|
||||
Reference in New Issue
Block a user