Page 1 of 1
Add columns to the bug table and load with default columns
Posted: 26 Dec 2017, 19:26
by gipsea
Hi there,
first of all an apologize if my questions might sound silly but I'm limited with PHP experience altought with some programming experience
I added 3 new columns in the bug_table database and I'm struggeling finding where are defined the standar columns to load
I went down to the function
Code: Select all
/**
* Get a list of standard columns.
* @param boolean $p_enabled_columns_only Default true, if false returns all columns regardless of configuration settings.
* @return array of column names
*/
function columns_get_standard( $p_enabled_columns_only = false ) {
$t_reflection = new ReflectionClass( 'BugData' );
.
.
.
At this point I'm looking for
and where it is defined but can't find it
I might also be looking to the wrong direction so if someone has a suggestions how and where define the default columns this is welcome!
I know I can manage the columns setting in the account but if the columns I've inserted are not in the "All Available Columns" area I will receive an error
I'm working on mantis version 2.9.0 (I think unless automatic updates I'm not aware off)
thanks
Re: Add columns to the bug table and load with default colum
Posted: 27 Dec 2017, 08:33
by rkarmann
Hi there,
The BugData class is defined in the bug_api.php in the /core directory.
For the column management I'm affraid that I can't help you. Maybe admins could...
Good luck
Re: Add columns to the bug table and load with default colum
Posted: 27 Dec 2017, 09:41
by atrol
gipsea wrote:I added 3 new columns in the bug_table database
You should not touch any of the database tables that come with Mantis as you might get problems when upgrading to newer versions.
I recommend to write a plugin and create your own tables or maybe using custom fields is an option for you.
Re: Add columns to the bug table and load with default colum
Posted: 28 Dec 2017, 00:05
by gipsea
thanks.
I though about add a new table but the plug in option seams even a better idea. My limit is I'm not a developer so this might be behind my possibility.
anyway, I'd love to give it a go. @atrol, can u suggest a starting point from where I can start gather informatiin about building a plugin?
I'll also study the custom fields and how to handle
grazie
Re: Add columns to the bug table and load with default colum
Posted: 28 Dec 2017, 08:26
by atrol
I recommend to start reading the documentation, especially
https://www.mantisbt.org/docs/master/en ... ev.plugins
You can learn from existing plugins, e.g. have a look at plugins folder of your Mantis installation.
Furthermore there are a lot of open source 3rd party plugins.
There is a central place
https://github.com/mantisbt-plugins , but search also the web for some more of them.
Also worth reading
https://www.mantisbt.org/wiki/doku.php/ ... is_plugins
Re: Add columns to the bug table and load with default colum
Posted: 05 Jan 2018, 13:50
by gipsea
Hi @atrol
I took a look to your links with great interest.
So far the custom fields cover my request without manipulating the database. Great!!
Regarding the plugins I created the basic one following the Developer manual with a positive result. Now I've reached my limited experience on programming in other words:
How do I call plugins functions/page/files within the .php files of the standard installation?
In general I have 5 custom_fields, 3 numeric and required during reporting an issue, 2 calculated accordingly to the 3 reported
So far, to achieve my goal I need 2 basic steps which might work also without plugin (I think include customized *.php file and override function) but I'm happy to go for the most stable way.
These steps are:
1) in bug_report_page.php I'd like to mix standar row with the custom fields one rather than showing at the end of the page
2) customize the 'mysql insert function' (haven't studied this yet) after the submit is pressed on the bug_report_page.php calculating the 2 custom fields and insert in the custom_field_table
I'm happy to close this thread and open separated ones if considered more appropriate.
Thanks
Re: Add columns to the bug table and load with default colum
Posted: 07 Jan 2018, 13:12
by atrol
gipsea wrote:
How do I call plugins functions/page/files within the .php files of the standard installation?
You don't have to call them, they get called by the event system.
https://www.mantisbt.org/docs/master/en ... dev.events
Sorry, but I don't have time to support users in writing plugins and provide detailed information on how to do it.
Re: Add columns to the bug table and load with default colum
Posted: 07 Jan 2018, 15:54
by gipsea
atrol wrote:Sorry, but I don't have time to support users in writing plugins and provide detailed information on how to do it
@atrol,
thanks a lot for your time and efforts