Blank fields retained when you choose multiple

liveoutloud2day - June 27, 2008 - 18:45
Project:Phone (CCK)
Version:6.x-2.7
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

This patch fixes the fact that empty rows are stored in the database when multi-field is chosen. If only one phone number is given, it is stored with an additional 2 blank fields. This is even more important if you include the patch to allow the user to select number of fields in the multi-field ( http://drupal.org/node/275837 ) - they could have up to nine blank fields then.

AttachmentSize
phone.module.blank_.data_.diff714 bytes

#1

Aren Cambre - March 21, 2009 - 03:14
Title:Blank data is being stored in the database when you choose multiple.» Blank fields retained when you choose multiple
Version:5.x-2.11» 6.x-2.7
Priority:normal» critical
Status:needs review» active

This is still happening in 6.x. Changing to active since new patch is needed.

"Critical" because this is causing major data nastiness and wreaks havoc on views containing nodes with Phone (CCK) fields.

#2

esezako - June 11, 2009 - 11:38

I solved the problem by changing the hook_content_is_empty

from:
function phone_content_is_empty($item, $field) {
return FALSE;
}

to:
function phone_content_is_empty($item, $field) {
if (empty($item['value'])) {
return TRUE;
}
return FALSE;
}

#3

drewish - August 2, 2009 - 17:15
Status:active» reviewed & tested by the community

esezako's suggestion is the correct solution at least as far as CCK on D6 goes. Attached is a patch with the changes.

AttachmentSize
phone_275843.patch 565 bytes

#4

thierry_gd - August 26, 2009 - 16:18
Status:reviewed & tested by the community» fixed

Taken into account in 6.2.9 version

#5

System Message - September 9, 2009 - 16:20
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.