Closed (fixed)
Project:
Duration
Version:
6.x-1.0-rc1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Sep 2008 at 18:21 UTC
Updated:
9 Nov 2008 at 15:11 UTC
In order when views module retrieves data using LEFT JOINS from nodes that don't use the duration module all values are set to NULL.
Regardless whether duration_create($duration_iso_string = NULL) is called using a valid parameter or not it normally creates a valid duration object.
In duration_field(..) all items are treated the same way and the object duration_create(..) returns will always be valid:
function __construct($duration_iso_string = NULL) {
// Easy way: no string given, let's just initialize a zero duration.
if (!isset($duration_iso_string)) {
$this->is_negative = FALSE;
$this->duration = array();
$this->is_valid = TRUE;
return;
}
In my opinion there shouldn't shown up a value for nodes that don't use this field. That's why I set the category to "bug report".
I thought about checking the $item['approx_seconds'] value for existence before calling duration_create(..).
Patch attached,
greetings,
sevi
| Comment | File | Size | Author |
|---|---|---|---|
| duration.module.diff | 422 bytes | sevi |
Comments
Comment #1
jpetso commentedFair enough. Fixed in CVS, although the error was somewhere else: I had forgotten to include a validity check in duration_format_hms() (duration_api.module) so even invalid Duration objects like the ones initialized from empty strings would be displayed. CCK 6.x ensures that we never get NULL as value for an item, so the 'iso8601' value for an unset duration is the empty string. (Empty vs. non-empty 'iso8601' strings is how the module can distinguish between zero and unset durations.)
Thanks for the report, I'm going to roll the 6.x-1.0 release now.
Comment #2
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.