I got this error after creating a view with multiple blocks. I was trying to create a quick tab news section using these blocks. Everything works fine but this error shows up on every single page of my site.

Notice: Undefined variable: value in views_many_to_one_helper->add_filter() (line 868 of C:\xampp\htdocs\wacom\sites\all\modules

Please look at the attached screen shot.
If anyone knows any tips to solve this would so grateful.
Thanks is advance.

CommentFileSizeAuthor
#20 views-1023794.patch603 bytesturek
views-error.png4.78 KBBright Web Design

Comments

Bright Web Design’s picture

Status: Active » Closed (fixed)

Sorry for the trouble. I fixed the issue.

Bright Web Design’s picture

Priority: Major » Critical
Status: Closed (fixed) » Active

Please help,
I thought this was fixed by myself but this same error comes up again.
Notice: Undefined variable: value in views_many_to_one_helper->add_filter() (line 868 of C:\xampp\htdocs\wacom\sites\all\modules\views\includes\handlers.inc).
Please see the above comment and screen shot.

Thanks in advance.

LaurenH’s picture

Notice: Undefined variable: value in views_many_to_one_helper->add_filter() (line 868 of /sites/all/modules/views/includes/handlers.inc).

I get this error as well... two instances (I suppose because I use a couple of view blocks). My site also appears to be functioning without issue, but obviously I do not want these notices popping up and would like to figure out what's going on. :-/

dawehner’s picture

Priority: Critical » Normal

Move this issue to "normal".

A notice is not an warning and not an error. For example in drupal6 notices weren't displayed at all.

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

Is this still the case for the dev version of views?

Bright Web Design’s picture

It happens with all versions of views. This happens only if you have multiple blocks from a same view.
First I thought it was a quick tab issue. because in quick tab version 7 maximum number of tabs are 3 and if I wanna more tabs first we have to save and then add another tab again. (I know it's a bug on Quick Tabs).

I always test all most important and most used modules, in different conditions to make sure it's perfect in all conditions.

Best wishes for your development works.

dawehner’s picture

So can someone provide a way to reproduce the problem?

It's hard to fix problems if you don't know when they exist.

Bright Web Design’s picture

This is how I got this error message

Step One

  • Created a Custom Content Type called "News"
  • Created Taxonomy Vocabulary called "News Category"
  • Created 4 Taxonomy terms
  • Created "Image filed"
  • Created Taxonomy Term field
  • Finally Created many nodes for News with each taxonomy term

Step Two

  • Created a new view called "News"
  • Created Four block displays, each block filtered with each taxonomy term and content type
  • Finally Saved the View

Step Three

  • Created a new Quicktab
  • Created Three Quicktab blocks forth one couldn't created, so just saved once and created one more quick tab block
  • Finally Enabled the Quick tab block
  • First look everything fine no errors
  • After a refresh boom there comes ERROR!!!

I don't remember whether I have done anything more to produce this error.

Hope this info helps you.

Best Wishes

Hans Vanpee’s picture

I have the same problem when creating a view with page display and a filter on taxonomy (term id, 'is all of', selected two terms in the list).
I tried this on two different sites (Drupal 7) and I get the same warning.

DeweyOxberger’s picture

I'm getting it too:

Notice: Undefined variable: value in views_many_to_one_helper->add_filter() (line 868 of /home/develop/public_html/sites/all/modules/views/includes/handlers.inc).

I started with a clean install, defined three vocabularies (Status, Product, Assignee) with about six terms each.
Then built the view following this great help: http://drupal.org/node/1043784#comment-4027132
It creates a view with Arguments-Taxonomy ID, Taxonomy ID and , and +, multiple allowed.
Makes a page.
Then added two fields to the view (one for Node Title, one for Taxonomy: All Terms).

When I do a /test/14+27 url I get no error.
When I do a /test/14,27 I get the error.

DeweyOxberger’s picture

Bug - but since I'm a noob I have no idea what the correct answer is here:

Note that in the failing cases $forumla = "and" and the logic nevers sets a value for $value in that case.

  function add_filter() {
    ...
    if ($operator == 'not') {
      $value = NULL;
      ...
    }
    elseif ($operator == 'or' && empty($options['reduce_duplicates'])) {
      if (count($this->handler->value) > 1) {
        $value = $this->handler->value;
        ...
      }
      else {
        $value = is_array($this->handler->value) ? array_pop($this->handler->value) : $this->handler->value;
        ...
      }
    }
       <----  what about $operator = "and"?
dawehner’s picture


    $value = $this->handler->value;

I guess this should be set.

DeweyOxberger’s picture

Here is a hack that seems to work - but I know next to nothing about SQL.

THIS NEEDS REVIEW BY A SMART PERSON!

Modify handlers.inc to be:

    $add_condition = TRUE;   <--- line 836, shown for reference
    if ($operator == 'not') {
        ... loads of stuff
    }                                 <--- line 852  
    elseif ($operator == 'and') {                // add these lines
      $value = $this->handler->value;        //
      $operator = 'IN';                             //
    }                                                   //

It all comes down to a WHERE in the sql. This code will produce SQL like:

SELECT COUNT(*) AS expression FROM 
(SELECT 1 AS expression FROM {node} node INNER JOIN {taxonomy_index} taxonomy_index_value_0 
ON node.nid = taxonomy_index_value_0.nid AND taxonomy_index_value_0.tid = :views_join_condition_0 
INNER JOIN {taxonomy_index} taxonomy_index_value_1 ON node.nid = taxonomy_index_value_1.nid AND taxonomy_index_value_1.tid = :views_join_condition_1 

---> this WHERE gets hacked to use WHERE x IN a, b --->
WHERE (( (taxonomy_index_value_0.tid IN :db_condition_placeholder_0_0, :db_condition_placeholder_0_1) 

AND( (taxonomy_index_value_0.tid IN (:db_condition_placeholder_1, :db_condition_placeholder_2)) 
AND (taxonomy_index_value_1.tid IN (:db_condition_placeholder_3, :db_condition_placeholder_4)) )))) 
subquery; Array ( [:db_condition_placeholder_1] => 14 
[:db_condition_placeholder_2] => 31 
[:db_condition_placeholder_3] => 14 
[:db_condition_placeholder_4] => 31 
[:views_join_condition_0] => 14 
[:views_join_condition_1] => 31 
[:db_condition_placeholder_0_0] => 14 
[:db_condition_placeholder_0_1] => 31 ) 

This might not work in every case.

santini’s picture

Thanks jonb_cirris - it works for me (#13) :-)

DeweyOxberger’s picture

Status: Postponed (maintainer needs more info) » Needs review
dawehner’s picture

Status: Needs review » Needs work

Please post a patch.

hexabinaer’s picture

In case this finding can be of any help:

I have a users view with 2 filters:
- User: Roles = custom_role1
- User: Active Yes

Originally I selected 2 roles and checked "Reduce duplicates". Later I deselected the second role but oversaw the "duplicate" checkbox. That was where the notice mentioned above came in.
Unchecking "duplicated" made the notice disappear.

anselm.marie’s picture

It seems like the issue is fixed in views-7.x-3.x-dev.

DeweyOxberger’s picture

I did a get from cvs, traced through it and it appears to work now. The fix is not what was listed above.

turek’s picture

Component: Code » Miscellaneous
Status: Needs work » Needs review
StatusFileSize
new603 bytes

If you still working on alpha1, here is a patch.

dawehner’s picture

Status: Needs review » Fixed

Commited to the dev version.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.