Dynamic list does not work in the tracker plugin when its reference field (normally an item link) is not shown in the form, with patch
- Status
- Closed
- Subject
- Dynamic list does not work in the tracker plugin when its reference field (normally an item link) is not shown in the form, with patch
- Version
- 5.x
- Category
- Consistency
- Error
- Usability
- Feature request
- Less than 30-minutes fix
- Patch
- Feature
- Trackers
- Resolution status
- Fixed or Solved
- Submitted by
- Ushindi Gedeon
- Lastmod by
- Ushindi Gedeon
- Rating
- Description
Tracker plugin:
Imagine we would like to offer modification of a dynamic list field without offering modification of its reference field. In this case, the dynamic list should fall-back to a simple list with no selectValue calls in the js.- Solution
Proposal:
trackerlib.phpCopy to clipboardfunction prepare_dynamic_items_list($field, &$fields) { $refFieldId = $field['options_array'][2]; $refFieldOnTheForm = false; $fieldIdx = 0; foreach ($fields as $i=>$ff) { // get the item link field if ($ff['fieldId'] == $refFieldId) { $refFieldOnTheForm = true; $refFieldId = $i; } if ($ff['fieldId'] == $field['fieldId']) { $fieldIdx = $i; } } if (!$refFieldOnTheForm) { // we prentend it was an item list // the $fields[$fieldIdx]['list'] is to be filled in $fields[$fieldIdx]['type'] = 'r'; // caller may use a $fields[$fieldIdx]['list'] = array('kutya','macska'); } else { // ---- FROM HERE IT IS ALL OLD CODE if (!isset($fields[$refFieldId]['http_request'])) { $fields[$refFieldId]['http_request'] = array('', '', '', '', '', '', '', '', ''); } for ($i = 0; $i < 5; $i++) { if (!empty($fields[$refFieldId]['http_request'][$i])) { $fields[$refFieldId]['http_request'][$i] .= ','; } if (!empty($field['options_array'][$i])) { $fields[$refFieldId]['http_request'][$i] .= $field['options_array'][$i]; } } $fields[$refFieldId]['http_request'][5] .= ($fields[$refFieldId]['http_request'][5] ? ",":"") . $field['fieldId']; $fields[$refFieldId]['http_request'][6] .= ($fields[$refFieldId]['http_request'][6] ? "," : "") . $field['isMandatory']; $fields[$refFieldId]['http_request'][7] .= $fields[$refFieldId]['value']; $fields[$refFieldId]['http_request'][8] .= ($fields[$refFieldId]['http_request'][8] ? "," : "") . $field['value']; } }
Furthermore, add to wikiplugin_tracker.php, ~line 835, just afterCopy to clipboardforeach ($flds['data'] as $i=>$f) { // collect additional infos if (in_array($f['fieldId'], $outf)) { ... } elseif ($f['type'] == 'w') { RIGHT HERE -> }
the followingCopy to clipboard$trklib->prepare_dynamic_items_list($f, $flds['data']); if ($flds['data'][$i]['type'] == 'r') { // we prentended it was an item link $bindingItemLinkField = $trklib->get_tracker_field($f['options_array'][2]); $bindingValueIndex = $trklib->get_item_id($bindingItemLinkField['options_array'][0], $bindingItemLinkField['options_array'][3], $bindingValue); $flds['data'][$i]['list'] = $trklib->get_filtered_item_values($f['options_array'][1], $bindingValueIndex, $f['options_array'][3]); }- Workaround
- Importance
- 8
- Easy to solve?
- 8
- Priority
- 64
- Demonstrate Bug on Tiki 19+
-
This bug has been demonstrated on show2.tiki.org
Please demonstrate your bug on show2.tiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show2.tiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Demonstrate Bug (older Tiki versions)
-
This bug has been demonstrated on show.tikiwiki.org
Please demonstrate your bug on show.tikiwiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show.tikiwiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Ticket ID
- 3113
- Created
- Tuesday 13 April, 2010 23:12:59 UTC
by Gergely - LastModif
- Tuesday 02 June, 2026 08:26:15 UTC