diff --git a/docroot/sites/all/modules/contrib/views/includes/handlers.inc b/docroot/sites/all/modules/contrib/views/includes/handlers.inc
index b1ce1a315..680a54de7 100644
--- a/docroot/sites/all/modules/contrib/views/includes/handlers.inc
+++ b/docroot/sites/all/modules/contrib/views/includes/handlers.inc
@@ -1544,10 +1544,9 @@ class views_join {
 
     // Tack on the extra.
     if (isset($this->extra)) {
-      $extras = array();
-      foreach ($this->extra as $info) {
-        if (is_array($info)) {
-          $extra = '';
+      if (is_array($this->extra)) {
+        $extras = array();
+        foreach ($this->extra as $info) {
           // Figure out the table name. Remember, only use aliases provided
           // if at all possible.
           $join_table = '';
@@ -1565,49 +1564,76 @@ class views_join {
             }
           }
 
-          // Convert a single-valued array of values to the single-value case,
-          // and transform from IN() notation to = notation
-          if (is_array($info['value']) && count($info['value']) == 1) {
-            if (empty($info['operator'])) {
-              $operator = '=';
+          // If left_field is set use it for a field-to-field condition.
+          if (!empty($info['left_field'])) {
+            $operator = !empty($info['operator']) ? $info['operator'] : '=';
+            $left_table = (isset($info['left_table'])) ? $info['left_table'] : $left['alias'];
+            $extras[] = "$join_table$info[field] $operator $left_table.$info[left_field]";
+          }
+          // Else if formula is set, us it for a flexible on clause.
+          elseif (!empty($info['formula'])) {
+            // If a field is given, we build a "$field $op $formula".
+            // Without it would only be "$formula".
+            $extra = '';
+            if (isset($info['field'])) {
+              // With a single value, the '=' operator is implicit.
+              $operator = !empty($info['operator']) ? $info['operator'] : '=';
+              $extra .= "$join_table$info[field] $operator ";
             }
-            else {
-              $operator = $info['operator'] == 'NOT IN' ? '!=' : '=';
+            $extra .= $info['formula'];
+            // Add placeholder arguments.
+            if (isset($info['formula_arguments']) && is_array($info['formula_arguments'])) {
+              $arguments = array_merge($arguments, $info['formula_arguments']);
             }
-            $info['value'] = array_shift($info['value']);
+            $extras[] = $extra;
           }
+          // Otherwise - and if we have a value - use it for a field-to-value condition.
+          elseif (isset($info['value'])) {
+            // Convert a single-valued array of values to the single-value case,
+            // and transform from IN() notation to = notation
+            if (is_array($info['value']) && count($info['value']) == 1) {
+              if (empty($info['operator'])) {
+                $operator = '=';
+              }
+              else {
+                $operator = $info['operator'] == 'NOT IN' ? '!=' : '=';
+              }
+              $info['value'] = array_shift($info['value']);
+            }
 
-          if (is_array($info['value'])) {
-            // With an array of values, we need multiple placeholders and the
-            // 'IN' operator is implicit.
-            foreach ($info['value'] as $value) {
-              $placeholder_i = $view_query->placeholder('views_join_condition_');
-              $arguments[$placeholder_i] = $value;
+            if (is_array($info['value'])) {
+              // With an array of values, we need multiple placeholders and the
+              // 'IN' operator is implicit.
+              foreach ($info['value'] as $value) {
+                $placeholder_i = ':views_join_condition_' . $select_query->nextPlaceholder();
+                $arguments[$placeholder_i] = $value;
+              }
+
+              $operator = !empty($info['operator']) ? $info['operator'] : 'IN';
+              $placeholder = '( ' . implode(', ', array_keys($arguments)) . ' )';
+            }
+            else {
+              // With a single value, the '=' operator is implicit.
+              $operator = !empty($info['operator']) ? $info['operator'] : '=';
+              $placeholder = ':views_join_condition_' . $select_query->nextPlaceholder();
+              $arguments[$placeholder] = $info['value'];
             }
 
-            $operator = !empty($info['operator']) ? $info['operator'] : 'IN';
-            $placeholder = '( ' . implode(', ', array_keys($arguments)) . ' )';
+            $extras[] = "$join_table$info[field] $operator $placeholder";
+          }
+        }
+
+        if ($extras) {
+          if (count($extras) == 1) {
+            $condition .= ' AND ' . array_shift($extras);
           }
           else {
-            // With a single value, the '=' operator is implicit.
-            $operator = !empty($info['operator']) ? $info['operator'] : '=';
-            $placeholder = $view_query->placeholder('views_join_condition_');
-            $arguments[$placeholder] = $info['value'];
+            $condition .= ' AND (' . implode(' ' . $this->extra_type . ' ', $extras) . ')';
           }
-          $extras[] = "$join_table$info[field] $operator $placeholder";
-        }
-        elseif (is_string($info)) {
-          $extras[] = $info;
         }
       }
-
-      if ($extras) {
-        if (count($extras) == 1) {
-          $condition .= ' AND ' . array_shift($extras);
-        }
-        else {
-          $condition .= ' AND (' . implode(' ' . $this->extra_type . ' ', $extras) . ')';
-        }
+      elseif ($this->extra && is_string($this->extra)) {
+        $condition .= " AND ($this->extra)";
       }
     }
 
@@ -1655,13 +1681,11 @@ class views_join_subquery extends views_join {
     $arguments = array();
 
     // Tack on the extra.
-    // This is just copied verbatim from the parent class, which itself has a
-    // bug: http://drupal.org/node/1118100
+    // This is just copied verbatim from the parent class, which itself has a bug: http://drupal.org/node/1118100
     if (isset($this->extra)) {
-      $extras = array();
-      foreach ($this->extra as $info) {
-        if (is_array($info)) {
-          $extra = '';
+      if (is_array($this->extra)) {
+        $extras = array();
+        foreach ($this->extra as $info) {
           // Figure out the table name. Remember, only use aliases provided
           // if at all possible.
           $join_table = '';
@@ -1689,19 +1713,19 @@ class views_join_subquery extends views_join {
           $extras[] = "$join_table$info[field] $operator $placeholder";
           $arguments[$placeholder] = $info['value'];
         }
-        elseif (is_string($info)) {
-          $extras[] = $info;
-        }
-      }
 
-      if ($extras) {
-        if (count($extras) == 1) {
-          $condition .= ' AND ' . array_shift($extras);
-        }
-        else {
-          $condition .= ' AND (' . implode(' ' . $this->extra_type . ' ', $extras) . ')';
+        if ($extras) {
+          if (count($extras) == 1) {
+            $condition .= ' AND ' . array_shift($extras);
+          }
+          else {
+            $condition .= ' AND (' . implode(' ' . $this->extra_type . ' ', $extras) . ')';
+          }
         }
       }
+      elseif ($this->extra && is_string($this->extra)) {
+        $condition .= " AND ($this->extra)";
+      }
     }
 
     $select_query->addJoin($this->type, $right_table, $table['alias'], $condition, $arguments);
