solved smarty_function_jrTracker_status_select no longer processes the classes parameter

SteveX
SteveX
@ultrajam
last year
2,589 posts
Classes are passed in in the item_detail template, but the function no longer checks for them.


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)

updated by @ultrajam: 09/11/25 07:11:21PM
michael
@michael
last year
7,839 posts
What are you seeing, it should do.

the smarty function is defined as:
function smarty_function_jrTracker_status_select($params, $smarty)
then its called as:
{jrTracker_status_select item_id=$item._item_id status=$item.tracker_status type=$item.tracker_type class="form_select status_section_`$class_status`"}

All the ???= should be in the $params as $params['class'] or $params['whatever']
michael
@michael
last year
7,839 posts
Got some setup steps to look at, I'll try to debug.
michael
@michael
last year
7,839 posts
I see it. Back in 2022 the $class was added in. I'll get it added back in.
michael
@michael
last year
7,839 posts
Fixed in Version 2.5.0
SteveX
SteveX
@ultrajam
last year
2,589 posts
Great, thanks Michael!


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
michael
@michael
last year
7,839 posts
here's the full function in case you don't want to wait for it to pass testing:
function smarty_function_jrTracker_status_select($params, $smarty)
{
    if (!isset($params['item_id']) || !jrCore_checktype($params['item_id'], 'number_nz')) {
        return jrCore_smarty_invalid_error('item_id');
    }
    if (empty($params['status'])) {
        return jrCore_smarty_missing_error('status');
    }
    if (empty($params['type'])) {
        return jrCore_smarty_missing_error('type');
    }
    $stt = $params['status'];
    $_as = jrTracker_get_tracker_statuses();
    if (!isset($_as[$stt])) {
        return jrCore_smarty_invalid_error('item_id');
    }

    $cls = '';
    if (!empty($params['class'])) {
        $cls = $params['class'];
    }

    $iid = (int) $params['item_id'];
    $out = '<select id="tracker-status-sel" class="status_section status_section_' . str_replace(' ', '_', $stt) . ' ' . $cls . '" onchange="var v=$(this).val(); jrTracker_set_status(' . $iid . ', v)">';
    $out .= '<option value="' . $stt . '" selected="selected">' . $_as[$stt] . '</option>';
    $out .= '<optgroup label="Change Status To:">';
    foreach ($_as as $k => $v) {
        if ($k == $stt) {
            continue;
        }
        // If our tracker is not a FEATURE REQUEST turn off "complete"
        if ($params['type'] != 'feature' && $k == 'completed') {
            continue;
        }
        $out .= "\n<option value=\"{$k}\">&raquo; {$v}</option>";
    }
    $out .= '</optgroup></select>';
    if (!empty($params['assign'])) {
        /** @noinspection PhpUndefinedMethodInspection */
        $smarty->assign($params['assign'], $out);
        return '';
    }
    return $out;
}

Tags