Notice: Undefined index: group by in quiz_views_handler_filter_quiz_nid->construct() (line 46 of ...\quiz\includes\views\handlers\quiz_views_handler_filter_quiz_nid.inc).

The group_by property is not initalized.

I try to change these codes to solve this problem:

function construct() {
    parent::construct();
    /*
     *  $this->vid_field = !empty($this->definition['vid field']) ? $this->definition['vid field'] : 'vid';
    $this->group_by = $this->definition['group by'];
    if (!empty($this->definition['secondary group by'])) {
      $this->secondary_group_by = $this->definition['secondary group by'];
    }
     */
  }

--> AND Add function :

function init(&$view, &$options) {
      parent::init($view, $options);
      $this->vid_field = !empty($this->definition['vid field']) ? $this->definition['vid field'] : 'vid';
    $this->group_by = $this->definition['group by'];
    if (!empty($this->definition['secondary group by'])) {
      $this->secondary_group_by = $this->definition['secondary group by'];
    }
  }

----------
System :
Drupal 7.16
My SQL: 5.1
PHP 5.2.8
Apache 2.2
Windows 7 Pro 64 bits.

Comments

A Romka’s picture

If you add:

<?php
if(!empty($this->definition['group by'])) {
 
$this->group_by = $this->definition['group by'];
}
?>

to quiz\includes\views\handlers\quiz_views_handler_filter_quiz_nid.inc - it'll fix that error.

tony@fabriko.co.uk’s picture

Would love to know what line to add that there code to!

Thanks!

kenyan’s picture

@A Romka, Tried to add your code at line 47 but no joy. Error persists.
Where should the code go?

kenyan’s picture

Never mind. Moved the code to line 46 and that 'sorts' the issue out.
This works for 7x-4.0-alpha12

UPDATE:
Spoke too soon, the error reappears now at line 49. So help still requested.

A Romka’s picture

you need to change:

$this->group_by = $this->definition['group by'];

to:

if(!empty($this->definition['group by'])) {
  $this->group_by = $this->definition['group by'];
}
Mohammed J. Razem’s picture

Version:7.x-4.0-alpha11» 7.x-4.x-dev
Status:Active» Needs review
StatusFileSize
new1.25 KB

Patch attached.

Mohammed J. Razem’s picture

StatusFileSize
new873 bytes

Sorry, this is the correct patch. The previous one had another patch with it.

tgolding’s picture

Thanks A Romka! Seems to be working like a charm.

devenpro’s picture

Thanks A Romka works fine +1 to #5.

kenyan’s picture

Patch #7 working good.

sivaji@knackforge.com’s picture

Status:Needs review» Fixed

Patch committed to git. Thanks.

Status:Fixed» Closed (fixed)

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

Anonymous’s picture

Issue summary:View changes

Change format code

  • Commit 784b108 on 7.x-4.x, 7.x-5.x by sivaji:
    Issue #1827880 by Mohammed J. Razem | memberall: Fixed Undefined index:...

  • Commit 784b108 on 7.x-4.x, 7.x-5.x, quiz-pages by sivaji:
    Issue #1827880 by Mohammed J. Razem | memberall: Fixed Undefined index:...

  • Commit 784b108 on 7.x-4.x, 7.x-5.x, quiz-pages, 2269219 by sivaji:
    Issue #1827880 by Mohammed J. Razem | memberall: Fixed Undefined index:...

  • Commit 784b108 on 7.x-4.x, 7.x-5.x, 2269219 by sivaji:
    Issue #1827880 by Mohammed J. Razem | memberall: Fixed Undefined index:...