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
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
Added this feature, see new help texts on the page. ('')
#3
Automatically closed -- issue fixed for two weeks with no activity.
#4
The same line:
if ($text = trim($text)) {
causes the new line characters to be filtered out as well. Is that trim really necessary?
#5
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
Automatically closed -- issue fixed for 2 weeks with no activity.