'allowed_levels' in 'editability' not working properly when 'enforce_deepest' is enabled

boneless - October 7, 2009 - 01:41
Project:Hierarchical Select
Version:6.x-3.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I noticed the 'allowed_levels' values do not work properly in the API.
When activating 'editability' all levels (but the root level 0) are always able to be extended.
This seems to be due to checking _hierarchical_select_create_new_item_is_allowed() only for the max_depth level.
(hierarchical_select.module line 1776)
(Possible) Solution:
replace line 1782:
$hierarchy->levels[$depth] = array('create_new_item' => $option) + $hierarchy->levels[$depth];
with:

        if(_hierarchical_select_create_new_item_is_allowed($config, $depth)){
          $hierarchy->levels[$depth] = array('create_new_item' => $option) + $hierarchy->levels[$depth];
        }

(sorry not much of a patcher myself)

This seems to fix the problem for me with $enforce_deepest = TRUE.
Hope this helps.

#1

Wim Leers - October 31, 2009 - 01:33
Title:'allowed_levels' in 'editability' not working properly -> possible solution» 'allowed_levels' in 'editability' not working properly when 'enforce_deepest' is enabled
Status:needs review» fixed

Great catch, thanks!

- D6: http://drupal.org/cvs?commit=281994
- D5: http://drupal.org/cvs?commit=281996

#2

System Message - November 14, 2009 - 01:40
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.