Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1025507
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
Thu, Jun 12, 7:22 PM
Size
1 KB
Mime Type
text/x-diff
Expires
Fri, Jun 13, 7:22 PM (3 m, 35 s)
Engine
blob
Format
Raw Data
Handle
661268
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