Add columns to the bug table and load with default columns

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
gipsea
Posts: 7
Joined: 05 May 2009, 21:26

Add columns to the bug table and load with default columns

Post 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

Code: Select all

class BugData
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
rkarmann
Posts: 66
Joined: 24 Nov 2017, 10:00
Location: Lille, France

Re: Add columns to the bug table and load with default colum

Post 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
Currently working on a wiki-based plugin for MantisBT 2.X. If you'd like to test it, contact me or see the plugin section.
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Add columns to the bug table and load with default colum

Post 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.
Please use Search before posting and read the Manual
gipsea
Posts: 7
Joined: 05 May 2009, 21:26

Re: Add columns to the bug table and load with default colum

Post 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
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Add columns to the bug table and load with default colum

Post 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
Please use Search before posting and read the Manual
gipsea
Posts: 7
Joined: 05 May 2009, 21:26

Re: Add columns to the bug table and load with default colum

Post 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
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Add columns to the bug table and load with default colum

Post 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.
Please use Search before posting and read the Manual
gipsea
Posts: 7
Joined: 05 May 2009, 21:26

Re: Add columns to the bug table and load with default colum

Post 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
Post Reply