Mon 29 Mar 2004 08:27:54 AM UTC, comment #5:
Hi,
Although I don't claim this piece of code is a model of
programming, I don't quite understand the real/potential
bug you found in it.
Here is the logic:
$notif_scope holds the value of the radio button displayed
on the Administration/Email Notification Settings form
It can have three on only three values:
'global', 'category', 'both'
The variable $notif_value holds the numeric equivalent of
the radio button string value and actually is the value
which is kept in the 'tracker_name'._glnotif field of the
'groups' table.
Now for what concerns the few lines you found confusing/buggy:
if ($notif_scope != "global") {
if ($notif_scope == "category") {
$notif_value = 0;
}
if ($notif_scope == "both") {
$notif_value = 2;
}
} else {
$notif_value = 1;
}
it is just an if statement with an other two ifs in the 'if' block:
In other words:
IF $notif_scope is NOT EQUAL to 'global',
we check consecutively if is EQUAL to either 'category' or 'both'
and set $notif_value accordingly
ELSE (meaning it is EQUAL to 'global')
we set $notif value = to 1
Maybe this way of coding without using a suite of if elseif elseif
might be confusing to you. It is just that personally I am more
at ease with the way I coded it.
Now if there is a fundamental logic error in it please let me know
and we will fix it.
For what concerns checking whether a notification e-mail address is set
this is done in the function: trackers_data_get_item_notification_info
in the same file data.php when building the appropriate list of people
to be notified depending on the tracker settings and the item category.
In my opinion the type of notification to be done (global/category/both)
has to be kept separately from the fact corresponding email addresses
have been defined or not. It is the piece of code which build the
mail recipients list to check these various piece of information and
act accordingly.
I hope these few lines of explanation will help understanding.
I imagine this was triggered by observing that tracker notification
was not done properly in certain cases.
- Was this before or after the bug fix [bug #273] I uploaded in the repository?
- Was that fix put online?
Cheers,
Yves
|