Page MenuHomeIn-Portal Phabricator

D163.diff
No OneTemporary

File Metadata

Created
Mon, Jan 6, 2:18 AM

D163.diff

Index: branches/5.2.x/core/kernel/kbase.php
===================================================================
--- branches/5.2.x/core/kernel/kbase.php
+++ branches/5.2.x/core/kernel/kbase.php
@@ -207,6 +207,13 @@
protected $Fields = Array ();
/**
+ * Fields, that have current time as their default value.
+ *
+ * @var array
+ */
+ protected $currentTimeFields = array();
+
+ /**
* Mapping between unit custom field IDs and their names
*
* @var Array
@@ -757,9 +764,15 @@
*/
protected function SetDefaultValues()
{
- foreach ($this->Fields as $field => $options) {
- if ( array_key_exists('default', $options) && $options['default'] === '#NOW#' ) {
- $this->Fields[$field]['default'] = adodb_mktime();
+ foreach ( $this->Fields as $field => $options ) {
+ if ( array_key_exists('default', $options) ) {
+ if ( $options['default'] === '#NOW#' ) {
+ $this->currentTimeFields[] = $field;
+ }
+
+ if ( in_array($field, $this->currentTimeFields) ) {
+ $this->Fields[$field]['default'] = adodb_mktime();
+ }
}
}
}

Event Timeline