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
Summary customization
Moderators: Developer, Contributor
Re: Summary customization
Hi Sara,
you say you need to have custom field with ID = 59 but you are retrieving field with ID = 55.
In addition you are only saying it is not working but what is not working? Are there any java errors reported or is the new field not showing everything?
you say you need to have custom field with ID = 59 but you are retrieving field with ID = 55.
In addition you are only saying it is not working but what is not working? Are there any java errors reported or is the new field not showing everything?
-
sara.rossi
- Posts: 9
- Joined: 01 Feb 2023, 11:01
Re: Summary customization
I m using a custom field with id 55 but this is not the error because where I wrote 59 it's just a comment. Anyway I don't get any problem, it's just the new summary field is not shown.. Thank you very much for your helpcas wrote: 27 Oct 2023, 13:39 Hi Sara,
you say you need to have custom field with ID = 59 but you are retrieving field with ID = 55.
In addition you are only saying it is not working but what is not working? Are there any java errors reported or is the new field not showing everything?
Re: Summary customization
I would start without any java, just include a simple php script that retrieves the data and displays it. Like always Keep it Simple. 