diff --git a/includes/webform.components.inc b/includes/webform.components.inc index 833aad1..df0a711 100644 --- a/includes/webform.components.inc +++ b/includes/webform.components.inc @@ -714,7 +714,7 @@ function webform_component_insert(&$component) { ->fields(array( 'nid' => $component['nid'], 'cid' => $component['cid'], - 'pid' => $component['pid'], + 'pid' => !empty($component['pid']) ? $component['pid'] : NULL, 'form_key' => $component['form_key'], 'name' => $component['name'], 'type' => $component['type'], diff --git a/webform.install b/webform.install index 333ef4b..22c2444 100644 --- a/webform.install +++ b/webform.install @@ -136,7 +136,7 @@ function webform_schema() { 'type' => 'int', 'size' => 'small', 'unsigned' => TRUE, - 'not null' => TRUE, + 'not null' => FALSE, 'default' => 0, ), 'form_key' => array( @@ -1330,3 +1330,18 @@ function webform_update_7404() { _webform_delete_file(NULL, array($fid)); } } + +/** + * Make webform_component.pid field nillable. + */ +function webform_update_7405() { + $webform_component_pid_spec = array( + 'description' => 'If this component has a parent fieldset, the cid of that component.', + 'type' => 'int', + 'size' => 'small', + 'unsigned' => TRUE, + 'not null' => FALSE, + 'default' => 0, + ); + db_change_field('webform_component', 'pid', 'pid', $webform_component_pid_spec); +} \ No newline at end of file