Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F726877
D163.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jan 6, 2:18 AM
Size
1 KB
Mime Type
text/x-diff
Expires
Tue, Jan 7, 2:18 AM (2 d, 20 h ago)
Engine
blob
Format
Raw Data
Handle
536966
Attached To
D163: INP-1512 - Each "kDBBase::SetDefaultValues" call should respect "#NOW#" default value
D163.diff
View Options
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
Log In to Comment