Is trim() on the templates really necessary?

andremolnar - April 7, 2008 - 20:00
Project:Messaging
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Not sure if this is a bug or a feature, but if a field in the messaging_admin_message_form is empty the empty value is not saved in the database because of the conditional

if ($text = trim($text)) {

I'm sure there are cases where people would prefer nothing instead of a default value. I'd be glad to submit a patch, but I wanted to check to see what the thinking was here before doing so.

andre

#1

Jose Reyero - April 8, 2008 - 11:48

I think the feature makes sense so such patch would be welcomed.

However it is not that trivial because right now we have a fall-back system, so if you have not specified a message part for a sending method, it will default to the 'default' method's message part.

So I guess we'll need a special text like '', a checkbox or similar...

#2

Jose Reyero - April 17, 2008 - 15:05
Status:active» fixed

Added this feature, see new help texts on the page. ('')

#3

Anonymous (not verified) - May 1, 2008 - 15:12
Status:fixed» closed

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

#4

mehmeta - April 6, 2009 - 17:11
Title:Cannot unset message parts via messaging_admin_message_form» Is trim() on the templates really necessary?
Version:5.x-1.x-dev» 6.x-1.x-dev
Status:closed» active

The same line:

if ($text = trim($text)) {

causes the new line characters to be filtered out as well. Is that trim really necessary?

AttachmentSize
messagingTrimPatch.patch 720 bytes

#5

Jose Reyero - April 19, 2009 - 12:06
Status:active» fixed

Yes, you're right, we don't want to trim the submitted template
(but we want to check it is not only spaces and/or new lines)

So applied something similar

if (trim($text)) // Checks not empty but doesn't change the actual text saved.

#6

System Message - May 3, 2009 - 12:10
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.