[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [FIX] ItemLink and multi-title rendering in tracker main fields
"Camile \(@camilevahviraki\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6994f30adc3f7_3be18ad44617d@gitlab-sidekiq-low-urgency-cpu-bound-v2-7d966bcdff-hl45x.mail> |
Camile pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki
Commits:
4dccc470 by Camile at 2026-02-17T22:52:39+00:00
[FIX] ItemLink and multi-title rendering in tracker main fields
---
* [FIX] ItemLink and multi-title rendering in tracker main fields
---
* [FIX] Tests by Adding defensive array checks in Tracker_Field_Category_renderInnerOutput
* [FIX] PHPUnit NoTestCaseObjectOnCallStackException in TrackerMultiLevelSortingTest
* [FIX] teh failing category test
* [FIX] ItemLink and multi-title rendering in tracker main fields
See merge request tikiwiki/tiki!9131
See merge request tikiwiki/tiki!9591
- - - - -
2 changed files:
- lib/core/Tracker/Field/Category.php
- lib/trackers/trackerlib.php
Changes:
=====================================
lib/core/Tracker/Field/Category.php
=====================================
@@ -298,11 +298,17 @@ class Tracker_Field_Category extends \Tracker\Field\AbstractItemField implements
{
$selected_categories = $this->getConfiguration('selected_categories');
$categories = $this->getConfiguration('list');
+ if (! is_array($selected_categories)) {
+ $selected_categories = [];
+ }
+ if (! is_array($categories)) {
+ $categories = [];
+ }
$ret = [];
$rendered = empty($context['list_mode']) || $context['list_mode'] !== 'csv';
foreach ($selected_categories as $categId) {
foreach ($categories as $category) {
- if ($category['categId'] == $categId) {
+ if (isset($category['categId']) && $category['categId'] == $categId) {
if ($this->getOption('descendants') == 2) {
$str = $category['relativePathString'];
} else {
=====================================
lib/trackers/trackerlib.php
=====================================
@@ -4195,12 +4195,14 @@ class TrackerLib extends TikiLib
}
/**
- * Get's the rendered value of the field that is used as the name of
+ * Compute the rendered value of the field that is used as the name of
* the tracker item. Usually used as the item's title in a list,
* the search index, etc.
*
- * @param [type] $trackerId, optionnal (will be retrieved from itemId if missing)
- * @param [type] $itemId
+ * @param int|null $trackerId Optional tracker ID (will be retrieved from itemId if missing)
+ * @param int $itemId Tracker item ID
+ * @param bool $use_cache Whether to use caching for performance (default: false)
+ * @return string The rendered main title value of the tracker item
*/
public function get_isMain_value($trackerId, $itemId, $use_cache = false): string
{
@@ -4211,7 +4213,7 @@ class TrackerLib extends TikiLib
return $cache[$cacheKey];
}
}
- $query = "SELECT tif.`value`, tf.`type`
+ $query = "SELECT tif.`value`, tf.`type`, tf.`fieldId`, i.`trackerId`
FROM `tiki_tracker_item_fields` tif
JOIN `tiki_tracker_items` i ON i.`itemId` = tif.`itemId`
JOIN `tiki_tracker_fields` tf ON tf.`fieldId` = tif.`fieldId`
@@ -4219,11 +4221,22 @@ class TrackerLib extends TikiLib
ORDER BY tf.`position`";
$queryResult = $this->fetchAll($query, [(int) $itemId, "y"]);
- $titles = [];
+ if (! $trackerId) {
+ $trackerId = $queryResult[0]['trackerId'];
+ }
+
$item = $this->get_tracker_item($itemId);
+ $titles = [];
+
foreach ($queryResult as $row) {
$value = $row['value'];
- $field = ['type' => $row['type'], 'value' => $value];
+ $field = [
+ 'fieldId' => $row['fieldId'],
+ 'trackerId' => $trackerId,
+ 'type' => $row['type'],
+ 'value' => $value
+ ];
+
$handler = $this->get_field_handler($field, $item);
if ($handler) {
@@ -4234,6 +4247,7 @@ class TrackerLib extends TikiLib
$titles[] = $value;
}
}
+
$result = implode(' ', $titles);
if ($use_cache) {
if (TikiLib::lib('tiki')->isMemoryLow()) {
@@ -5644,14 +5658,13 @@ class TrackerLib extends TikiLib
/**
* Get a field handler for a specific fieldtype. The handler comes initialized with the field / item data passed.
* @deprecated This is just a proxy to $definition->getFieldFactory()->getHandler() with a different calling convention.
- * @param array $field.
- * <pre>
- * $field = array(
- * // required
- * 'trackerId' => 1 // trackerId
- * );
- * </pre
- * @param array $item - array('itemId1' => value1, 'itemid2' => value2)
+ * @param array $field - $field definition array, must contain at least: [
+ * 'trackerId' => 1,
+ * 'fieldId' => 42,
+ * 'type' => 'r',
+ * 'value' => 'foo'
+ * ];
+ * @param array|null $item - array('itemId1' => value1, 'itemid2' => value2)
* @return \Tracker\Field\AbstractItemField $tracker_field_handler - i.e. Tracker_Field_Text
*/
public function get_field_handler(array $field, $item = null): \Tracker\Field\AbstractItemField|false
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/4dccc47053a924fd2301ceb7317a9a0d5de071ae
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/4dccc47053a924fd2301ceb7317a9a0d5de071ae
You're receiving this email because of your account on gitlab.com.
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs