Okay, well, I'm not knowledgable enough to create a patch file, but here's the issue. The $options variable is NULL when there is nothing in the {referralsources} table. Not an issue if you have at least one option, but for completeness I'm providing a correction. Pretty easy to fix this. Here's the entire referralsources_select_options() function. The correction begins on line 362 with the "if($options !== null) {" statement.
<?php
/**
* Returns array of referral source options for select lists
*/
function referralsources_select_options($flat = FALSE) {
static $options;
static $options_flat;
if (empty(
$options)) {
// Get referral sources from DB
$result = db_query("SELECT rid, title, grouping FROM {referralsources} ORDER BY weight asc");
while ($row = db_fetch_object($result)) {
// Create a grouped list of referral sources
if (!empty($row->grouping)) {
$options[$row->grouping][$row->rid] = $row->title;
}
else {
$options['Other'][$row->rid] = $row->title;
}
}
}
if (
$flat) {
// Remove grouping from options, reduce to key/value pairs (return array of valid options).
if (empty($options_flat)) {
foreach ($options as $k => $v) {
if (is_array($v)) {
foreach ($v as $k => $v) {
$options_flat[$k] = $v;
}
}
else {
$options_flat[$k] = $v;
}
}
}
$result = $options_flat;
}
else {
if ($options !== null) {
// Return grouped array of options for select list.
$result = $options;
// Add "Please select one..." option to beginning of select list.
$result = array_merge(array('' => array('' => t('Please select one...'))), $result);
// Add "Other" option to end of select list.
$result['Other']['OTHER'] = t('Other (please specify below)');
} else {
$result = array();
}
}
return
$result;
}
?>Hope this helps someone.
