Code comments
This commit is contained in:
parent
c947502efa
commit
9f6118ed52
@ -1651,9 +1651,16 @@ class ExtraFields
|
|||||||
$error_field_required[] = $value;
|
$error_field_required[] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($key_type,array('date','datetime')))
|
if (in_array($key_type,array('date')))
|
||||||
{
|
{
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
|
// TODO GMT date in memory must be GMT so we should add gm=true in parameters
|
||||||
|
$value_key=dol_mktime(0, 0, 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]);
|
||||||
|
}
|
||||||
|
elseif (in_array($key_type,array('datetime')))
|
||||||
|
{
|
||||||
|
// Clean parameters
|
||||||
|
// TODO GMT date in memory must be GMT so we should add gm=true in parameters
|
||||||
$value_key=dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]);
|
$value_key=dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]);
|
||||||
}
|
}
|
||||||
else if (in_array($key_type,array('checkbox','chkbxlst')))
|
else if (in_array($key_type,array('checkbox','chkbxlst')))
|
||||||
@ -1692,12 +1699,12 @@ class ExtraFields
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return array_options array for object by extrafields value (using for data send by forms)
|
* return array_options array of data of extrafields value of object sent by a search form
|
||||||
*
|
*
|
||||||
* @param array $extralabels $array of extrafields
|
* @param array $extralabels $array of extrafields
|
||||||
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||||
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
|
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
|
||||||
* @return int 1 if array_options set / 0 if no value
|
* @return array|int array_options set or 0 if no value
|
||||||
*/
|
*/
|
||||||
function getOptionalsFromPost($extralabels,$keyprefix='',$keysuffix='')
|
function getOptionalsFromPost($extralabels,$keyprefix='',$keysuffix='')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -89,6 +89,7 @@ abstract class DoliDB implements Database
|
|||||||
*/
|
*/
|
||||||
function idate($param)
|
function idate($param)
|
||||||
{
|
{
|
||||||
|
// TODO GMT $param should be gmt, so we should add tzouptut to 'gmt'
|
||||||
return dol_print_date($param,"%Y%m%d%H%M%S");
|
return dol_print_date($param,"%Y%m%d%H%M%S");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,16 +239,16 @@ abstract class DoliDB implements Database
|
|||||||
else $return.=', ';
|
else $return.=', ';
|
||||||
|
|
||||||
$return.=preg_replace('/[^0-9a-z_\.]/i','',$val);
|
$return.=preg_replace('/[^0-9a-z_\.]/i','',$val);
|
||||||
|
|
||||||
$tmpsortorder = trim($orders[$i]);
|
$tmpsortorder = trim($orders[$i]);
|
||||||
|
|
||||||
// Only ASC and DESC values are valid SQL
|
// Only ASC and DESC values are valid SQL
|
||||||
if (strtoupper($tmpsortorder) === 'ASC') {
|
if (strtoupper($tmpsortorder) === 'ASC') {
|
||||||
$return .= ' ASC';
|
$return .= ' ASC';
|
||||||
} elseif (strtoupper($tmpsortorder) === 'DESC') {
|
} elseif (strtoupper($tmpsortorder) === 'DESC') {
|
||||||
$return .= ' DESC';
|
$return .= ' DESC';
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
@ -279,6 +280,7 @@ abstract class DoliDB implements Database
|
|||||||
*/
|
*/
|
||||||
function jdate($string, $gm=false)
|
function jdate($string, $gm=false)
|
||||||
{
|
{
|
||||||
|
// TODO GMT must set param gm to true by default
|
||||||
if ($string==0 || $string=="0000-00-00 00:00:00") return '';
|
if ($string==0 || $string=="0000-00-00 00:00:00") return '';
|
||||||
$string=preg_replace('/([^0-9])/i','',$string);
|
$string=preg_replace('/([^0-9])/i','',$string);
|
||||||
$tmp=$string.'000000';
|
$tmp=$string.'000000';
|
||||||
|
|||||||
@ -1781,11 +1781,13 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
|
|||||||
if (empty($localtz)) {
|
if (empty($localtz)) {
|
||||||
$localtz = new DateTimeZone('UTC');
|
$localtz = new DateTimeZone('UTC');
|
||||||
}
|
}
|
||||||
|
//var_dump($localtz);
|
||||||
|
//var_dump($year.'-'.$month.'-'.$day.'-'.$hour.'-'.$minute);
|
||||||
$dt = new DateTime(null,$localtz);
|
$dt = new DateTime(null,$localtz);
|
||||||
$dt->setDate($year,$month,$day);
|
$dt->setDate($year,$month,$day);
|
||||||
$dt->setTime((int) $hour, (int) $minute, (int) $second);
|
$dt->setTime((int) $hour, (int) $minute, (int) $second);
|
||||||
$date=$dt->getTimestamp(); // should include daylight saving time
|
$date=$dt->getTimestamp(); // should include daylight saving time
|
||||||
|
//var_dump($date);
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user