Summary customization
Posted: 27 Oct 2023, 12:27
Hi everyone,
on 'View Issue Details' I want to customize summary field : I mean I would like to remove the id number of the ticket and instead use another custom field.
I wrote a plugin, but it's not working ;
class AtrAcpPlugin extends MantisPlugin
{
function register()
{
$this->name = 'AtrAcp';
$this->description = 'A plugin to show ATR/ACP Number on summary field';
$this->page = '';
$this->version = '0.0.1';
$this->requires = array(
"MantisCore" => "2.0.0",
);
}
function hooks()
{
return array(
"EVENT_VIEW_BUG_DETAILS" => 'custom_summary_display',
);
}
/*function custom_summary_display($p_event, $p_bug_id)
{
$custom_field_value = custom_field_get_value(55, $p_bug_id); // Recupera il valore del campo personalizzato con ID 59.
$summary = "L'ATR è " . $custom_field_value; // Costruisci il nuovo valore del campo "Summary".
echo '<div class="widget-box">';
echo '<div class="widget-title">Summary</div>';
echo '<div class="widget-content">' . $summary . '</div>';
echo '</div>';
}*/
function custom_summary_display($p_event, $p_bug_id) {
$custom_field_value = custom_field_get_value(55, $p_bug_id);
echo '<script type="text/javascript">';
echo 'document.addEventListener("DOMContentLoaded", function() {';
echo ' var summaryElement = document.querySelector(".widget-content");';
echo ' if (summaryElement) {';
echo ' var customSummary = "L\'ATR è ' . $custom_field_value . '";';
echo ' summaryElement.innerHTML = customSummary;';
echo ' }';
echo '});';
echo '</script>';
}
}
Do you know why? Do you have a plugin that does something similar?
Thank you very much,
Sara
on 'View Issue Details' I want to customize summary field : I mean I would like to remove the id number of the ticket and instead use another custom field.
I wrote a plugin, but it's not working ;
class AtrAcpPlugin extends MantisPlugin
{
function register()
{
$this->name = 'AtrAcp';
$this->description = 'A plugin to show ATR/ACP Number on summary field';
$this->page = '';
$this->version = '0.0.1';
$this->requires = array(
"MantisCore" => "2.0.0",
);
}
function hooks()
{
return array(
"EVENT_VIEW_BUG_DETAILS" => 'custom_summary_display',
);
}
/*function custom_summary_display($p_event, $p_bug_id)
{
$custom_field_value = custom_field_get_value(55, $p_bug_id); // Recupera il valore del campo personalizzato con ID 59.
$summary = "L'ATR è " . $custom_field_value; // Costruisci il nuovo valore del campo "Summary".
echo '<div class="widget-box">';
echo '<div class="widget-title">Summary</div>';
echo '<div class="widget-content">' . $summary . '</div>';
echo '</div>';
}*/
function custom_summary_display($p_event, $p_bug_id) {
$custom_field_value = custom_field_get_value(55, $p_bug_id);
echo '<script type="text/javascript">';
echo 'document.addEventListener("DOMContentLoaded", function() {';
echo ' var summaryElement = document.querySelector(".widget-content");';
echo ' if (summaryElement) {';
echo ' var customSummary = "L\'ATR è ' . $custom_field_value . '";';
echo ' summaryElement.innerHTML = customSummary;';
echo ' }';
echo '});';
echo '</script>';
}
}
Do you know why? Do you have a plugin that does something similar?
Thank you very much,
Sara