Skip to content
Snippets Groups Projects
Commit 2cefe76c authored by Timofey Denisov's avatar Timofey Denisov
Browse files

Issue 2036829 by MChittenden, JustBlackBird, gilsbert, ofry: Allowed...

Issue 2036829 by MChittenden, JustBlackBird, gilsbert, ofry: Allowed replacement variables in fields "This value", "Then" and "Or", possibly (!) fixed compares with dates issue.

Signed-off-by: default avatarDenisov Timofey <tim4job@bmail.ru>
parent a2c65978
No related branches found
No related tags found
No related merge requests found
...@@ -195,29 +195,39 @@ class ViewsConditionalHandler extends views_handler_field { ...@@ -195,29 +195,39 @@ class ViewsConditionalHandler extends views_handler_field {
// Search through field information for possible replacement variables. // Search through field information for possible replacement variables.
foreach ($this->view->display_handler->get_field_labels() as $key => $var) { foreach ($this->view->display_handler->get_field_labels() as $key => $var) {
// If we find a replacement variable, replace it. // If we find a replacement variable, replace it.
if (strpos($equalto, "[$key]") !== FALSE) {
$field = $this->clean_var($fields[$key]);
$equalto = str_replace("[$key]", $field, $equalto);
}
if (strpos($then, "[$key]") !== FALSE) { if (strpos($then, "[$key]") !== FALSE) {
$field = $this->clean_var($fields[$key]); $field = $this->clean_var($fields[$key]);
$then = str_replace("[$key]", $field, $then); $then = str_replace("[$key]", $field, $then);
} }
elseif (strpos($or, "[$key]") !== FALSE) { if (strpos($or, "[$key]") !== FALSE) {
$field = $this->clean_var($fields[$key]); $field = $this->clean_var($fields[$key]);
$or = str_replace("[$key]", $field, $or); $or = str_replace("[$key]", $field, $or);
} }
} }
// If we find a date stamp replacement, replace that. // If we find a date stamp replacement, replace that.
if (strpos($equalto, 'DATE_STAMP') !== FALSE) {
$equalto = str_replace('DATE_STAMP', format_date(REQUEST_TIME), $equalto);
}
if (strpos($then, 'DATE_STAMP') !== FALSE) { if (strpos($then, 'DATE_STAMP') !== FALSE) {
$then = str_replace('DATE_STAMP', format_date(REQUEST_TIME), $then); $then = str_replace('DATE_STAMP', format_date(REQUEST_TIME), $then);
} }
elseif (strpos($then, 'DATE_STAMP') !== FALSE) { if (strpos($or, 'DATE_STAMP') !== FALSE) {
$or = str_replace('DATE_STAMP', format_date(REQUEST_TIME), $or); $or = str_replace('DATE_STAMP', format_date(REQUEST_TIME), $or);
} }
// If we find a unix date stamp replacement, replace that. // If we find a unix date stamp replacement, replace that.
if (strpos($equalto, 'DATE_UNIX') !== FALSE) {
$equalto = str_replace('DATE_UNIX', REQUEST_TIME, $equalto);
}
if (strpos($then, 'DATE_UNIX') !== FALSE) { if (strpos($then, 'DATE_UNIX') !== FALSE) {
$then = str_replace('DATE_UNIX', REQUEST_TIME, $then); $then = str_replace('DATE_UNIX', REQUEST_TIME, $then);
} }
elseif (strpos($or, 'DATE_UNIX') !== FALSE) { if (strpos($or, 'DATE_UNIX') !== FALSE) {
$or = str_replace('DATE_UNIX', REQUEST_TIME, $or); $or = str_replace('DATE_UNIX', REQUEST_TIME, $or);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment