Yesterday I built a hierarchy tree in Taxonomy by selecting parents for each new term in the Parent field in the "Relations" section of the term edit form.
But today, when I went back to Taxonomy and created a new vocabulary, intending to build a hierarchy tree there as well, the "Parent" field had disappeared from the term edit form for no reason I can think of. I got the following messages:

Notice: Undefined index: parent in taxonomy_form_term_submit() (line 828 of /home/climateb/public_html/inter-ethnic.org/modules/taxonomy/taxonomy.admin.inc).
Notice: Undefined property: stdClass::$parent in taxonomy_check_vocabulary_hierarchy() (line 537 of /home/climateb/public_html/inter-ethnic.org/modules/taxonomy/taxonomy.module).

Between yesterday and today I didn't edit any code at all (and hope I won't have to do so now).

What could have gone wrong? I attach txt versions of the files mentioned in the warning message.

Thanks in advance for any support.

Comments

lennart’s picture

I can confirm this issue.

xjm’s picture

Status: Active » Postponed (maintainer needs more info)

Hi,

It would really help to have explicit steps to reproduce here, like:

  1. Install Drupal 7.x using the standard profile.
  2. Add a vocabulary.
  3. Etc.

Thanks!

lennart’s picture

I'm not sure if the error is that easy to provoke. In my case its on a site that was recently upgraded from D6 to D7. Not sure if that has anything to do with it or not.

xjm’s picture

Yeah, it's possible that the steps to reproduce might start like:

  1. Install Drupal 6.x.
  2. Do stuff...
  3. Upgrade to Drupal 7.x.
  4. Do stuff...
lennart’s picture

Indeed.

igormagic’s picture

The same thing happened to me. I experimented with different modules on my site, so I cannot tell what exactly caused this error. But I've just enabled the previously disabled Hierarchical Select module (http://drupal.org/project/hierarchical_select) and the parent field appeared again. Maybe this will be helpful.

clashar’s picture

I've got the same error with D7.12:
Notice: Undefined index: parent in taxonomy_form_term_submit() (line 828 of C:\xampp\htdocs\www.***.kz\emploi\modules\taxonomy\taxonomy.admin.inc).

Hierarchical Select was installed, but disabled.

dddave’s picture

Assigned: Hovercraft » Unassigned
Status: Postponed (maintainer needs more info) » Closed (works as designed)

I suppose recent versions aren't affected and/or this is an issue with a contributed module.

cracu’s picture

There is a bug in code...

the taxonomy_form_term form function has the following lines:

if (!variable_get('taxonomy_override_selector', FALSE)) {
    $parent = array_keys(taxonomy_get_parents($term->tid));
    $children = taxonomy_get_tree($vocabulary->vid, $term->tid);

    // A term can't be the child of itself, nor of its children.
    foreach ($children as $child) {
      $exclude[] = $child->tid;
    }
    $exclude[] = $term->tid;

    $tree = taxonomy_get_tree($vocabulary->vid);
    $options = array('<' . t('root') . '>');
    if (empty($parent)) {
      $parent = array(0);
    }
    foreach ($tree as $item) {
      if (!in_array($item->tid, $exclude)) {
        $options[$item->tid] = str_repeat('-', $item->depth) . $item->name;
      }
    }
    $form['relations']['parent'] = array(
      '#type' => 'select',
      '#title' => t('Parent terms'),
      '#options' => $options,
      '#default_value' => $parent,
      '#multiple' => TRUE,
    );

  }

That means taxonomy_override_selector set as TRUE could prevent $form['relations']['parent'] to be created...

In taxonomy_form_term_submit function we have those lines that are looking for ['parent'] data.

I set that variable as TRUE to avoid some long times needed to generate parent data in taxonomy_manager contrib module.

So... better check that variable first.