Hello,

When I select in PM Gantt View to enable possibility for adding or editing Tasks, soon a lot of new cross or plus sign are added, but they are are all in error when using.

• Notice: Undefined index: #language in views_gantt_prepopulate_field() (line 436 of /home/devel/drupal-7.50/sites/all/modules/views_gantt/views_gantt.module).
• Notice: Undefined index: nid in views_gantt_prepopulate_field() (line 437 of /home/devel/drupal-7.50/sites/all/modules/views_gantt/views_gantt.module).

Drupal core 7.50
Drupal PM 7.x-2.2
Pm Gantt 7.x-2.0-beta1
Views 7.x-3.14
Views_gantt 7.x-2.0-rc1
Ctools 7.x-1.10
Date 7.x-2.10-rc1
...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vcouver created an issue. See original summary.

vcouver’s picture

vcouver’s picture

vcouver’s picture

vcouver’s picture

same errors.
• Notice: Undefined index: #language in views_gantt_prepopulate_field() (line 436 of .../drupal-7.53/sites/all/modules/views_gantt/views_gantt.module).
• Notice: Undefined index: nid in views_gantt_prepopulate_field() (line 437 of .../drupal-7.53/sites/all/modules/views_gantt/views_gantt.module).

with
drupal 7.53
pm 7.x-2.2
pmgantt 7.x-2.0-beta1
views 7.x-3.14
views_gantt 7.x-2.0-rc1
dhtmlxGantt 4

vcouver’s picture

Hello,

To avoid the "Undefined index" error message, coming from the two lines 436 and 437.
436 $language = $form[$field_name]['#language'];
437 $type = $form_state['field'][$field_name][$language]['field']['type'];

You can by example, use a ternary operator :
436 $language = (isset($form[$field_name]['#language'])) ? $form[$field_name]['#language'] : LANGUAGE_NONE;
437 $type = isset($form_state['field'][$field_name][$language]['field']['type']) ?
438 $form_state['field'][$field_name][$language]['field']['type'] : '';

What do you think about these modifications ? :

kekkis’s picture

Adding a patch which IMO better adheres to coding style.

Additionally it removes the unused $type assignment.

kekkis’s picture

Status: Active » Needs review

  • alexshipilov committed 5275475 on 7.x-2.x authored by kekkis
    Issue #2788717 by kekkis, vcouver: •Notice: Undefined index: #language...
alexshipilov’s picture

Status: Needs review » Fixed
Issue tags: -

Thanks kekkis and vcouver

alexshipilov’s picture

Status: Fixed » Closed (fixed)