View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0011615 | mantisbt | plug-ins | public | 2010-03-05 04:52 | 2017-04-01 00:13 |
Reporter | cas | Assigned To | dregad | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | closed | Resolution | no change required | ||
Product Version | 1.2.0 | ||||
Summary | 0011615: Select reporter while adding an issue | ||||
Description | We use Mantis on the Helpdesk so needed to have the option to allow our helpdesk to select the original reporter while for example on the phone. Next we needed changes in the following 2 scripts: | ||||
Additional Information | in bug_report: $t_bug_data->project_id = gpc_get_int( 'project_id' ); And in bug_report_page (around line 245 or other position if you please): | ||||
Tags | No tags attached. | ||||
Attached Files | CustomReporterPlugin.php (1,724 bytes)
<?php class CustomReporterPlugin extends MantisPlugin { function register() { $this->name = 'CustomReporterPlugin'; # Proper name of plugin $this->description = ''; # Short description of the plugin $this->page = ''; # Default plugin page $this->version = '1.0'; # Plugin version string $this->requires = array( # Plugin dependencies, array of basename => version pairs 'MantisCore' => '1.2.0', # Should always depend on an appropriate version of MantisBT ); $this->author = 'carlos proensa'; # Author/team name $this->contact = ''; # Author/team e-mail address $this->url = ''; # Support webpage } function hooks() { return array( 'EVENT_REPORT_BUG_FORM_TOP' => 'reportBugFormTop', 'EVENT_REPORT_BUG' => 'reportBug' ); } function reportBugFormTop ( $p_event, $p_project_id){ # #/ allow to change reporter_id (if access level is higher than reporter) # $user_id= auth_get_current_user_id(); $access_level= user_get_access_level( $user_id, $p_project_id ); if ($access_level > REPORTER) { echo '<tr><td>'; echo 'Reporter: '; echo '<select '.helper_get_tab_index().' name="user_id">'; print_reporter_option_list( $user_id, $p_new_bug->project_id ); echo '</select>'; echo ' <input type="checkbox" value="'.$user_id.'" name="user_monitor" />Monitor this bug'; } echo '</td></tr>'; } function reportBug($p_event, $p_bug_data, $p_bug_id) { // this custom input was created on bug_report page event $t_add_user= gpc_get_int('user_monitor',0); if ($t_add_user!=0){ bug_monitor($p_bug_id, $t_add_user); } } } ?> allow-changing-the-reporter-upon-cloning.patch (4,462 bytes)
From 3dfe846b0878e702a88844a084a02ffcc610a0e8 Mon Sep 17 00:00:00 2001 From: Vincent Sels <vincent_sels@hotmail.com> Date: Thu, 12 Jan 2012 23:02:52 +0100 Subject: [PATCH] Added features to allow changing the reporter upon cloning a bug --- bug_report.php | 2 +- bug_report_page.php | 35 +++++++++++++++++++++++++++++++++-- config_defaults_inc.php | 13 +++++++++++++ 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/bug_report.php b/bug_report.php index 32e86f2..586ab44 100644 --- a/bug_report.php +++ b/bug_report.php @@ -94,7 +94,7 @@ $t_bug_data->project_id = $t_project_id; - $t_bug_data->reporter_id = auth_get_current_user_id(); + $t_bug_data->reporter_id = gpc_get_int( 'reporter_id', auth_get_current_user_id() ); $t_bug_data->summary = trim( $t_bug_data->summary ); diff --git a/bug_report_page.php b/bug_report_page.php index 06b2e77..a0d7e1b 100644 --- a/bug_report_page.php +++ b/bug_report_page.php @@ -33,10 +33,12 @@ require_once( 'file_api.php' ); require_once( 'custom_field_api.php' ); require_once( 'last_visited_api.php' ); + require_once( 'ajax_api.php' ); require_once( 'projax_api.php' ); require_once( 'collapse_api.php' ); - $f_master_bug_id = gpc_get_int( 'm_id', 0 ); + $f_master_bug_id = gpc_get_int( 'm_id', 0 ); + $f_reporter_id = auth_get_current_user_id(); # this page is invalid for the 'All Project' selection except if this is a clone if ( ( ALL_PROJECTS == helper_get_current_project() ) && ( 0 == $f_master_bug_id ) ) { @@ -93,6 +95,10 @@ $f_due_date = $t_bug->due_date; $t_project_id = $t_bug->project_id; + + if ( config_get( 'keep_original_reporter_on_clone' ) == ON ) { + $f_reporter_id = $t_bug->reporter_id; + } } else { access_ensure_project_level( config_get( 'report_bug_threshold' ) ); @@ -153,7 +159,11 @@ $tpl_show_due_date = in_array( 'due_date', $t_fields ) && access_has_project_level( config_get( 'due_date_update_threshold' ), helper_get_current_project(), auth_get_current_user_id() ); $tpl_show_attachments = in_array( 'attachments', $t_fields ) && file_allow_bug_upload(); $tpl_show_view_state = in_array( 'view_state', $t_fields ) && access_has_project_level( config_get( 'set_view_status_threshold' ) ); - + + if ( $f_master_bug_id > 0 && config_get( 'show_reporter_on_clone' ) == ON ) { + $tpl_show_reporter = true; + } + # don't index bug report page html_robots_noindex(); @@ -165,6 +175,7 @@ <div align="center"> <form name="report_bug_form" method="post" <?php if ( $tpl_show_attachments ) { echo 'enctype="multipart/form-data"'; } ?> action="bug_report.php"> <?php echo form_security_field( 'bug_report' ) ?> +<input type="hidden" name="reporter_id" value="<?php echo $f_reporter_id ?>" /> <table class="width90" cellspacing="1"> <tr> <td class="form-title" colspan="2"> @@ -175,6 +186,26 @@ </tr> <?php event_signal( 'EVENT_REPORT_BUG_FORM_TOP', array( $t_project_id ) ); + + if ( $tpl_show_reporter ) { +?> + <tr <?php echo helper_alternate_class() ?>> + <td class="category"> + <?php echo lang_get( 'reporter' ) ?> + </td> + <td> + <?php + if ( ON == config_get( 'use_javascript' ) ) { + echo ajax_click_to_edit( prepare_user_name( $f_reporter_id ), 'reporter_id', 'entrypoint=issue_reporter_combobox&issue_id=' . $t_bug->id ); + } else { + ?> + <select <?php echo helper_get_tab_index() ?> name="reporter_id"> + <?php print_reporter_option_list( $f_reporter_id, $t_project_id ); ?> + </select> + <?php } ?> + </td> + </tr> +<?php } if ( $tpl_show_category ) { ?> diff --git a/config_defaults_inc.php b/config_defaults_inc.php index 7087dab..13ba6b4 100644 --- a/config_defaults_inc.php +++ b/config_defaults_inc.php @@ -2722,6 +2722,19 @@ * @global int $g_set_configuration_threshold */ $g_set_configuration_threshold = ADMINISTRATOR; + + /** + * Upon cloning a bug, allows a user with sufficient privileges to change the reporter. + * @global int $g_show_reporter_on_clone + */ + $g_show_reporter_on_clone = OFF; + + /** + * Specify whether upon cloning a bug, the reporter should be kept the same as the original (ON) + * or the reporter should become the person cloning the ticket (OFF). + * @global int $g_keep_original_reporter_on_clone + */ + $g_keep_original_reporter_on_clone = OFF; /************************************ * MantisBT Look and Feel Variables * -- 1.7.6.msysgit.0 | ||||
has duplicate | 0012412 | closed | dregad | "Reporter" should be editable by access level |
has duplicate | 0010449 | closed | vboctor | Report issue for an other reporter |
has duplicate | 0005212 | closed | atrol | Add an issue on behalf of someone else ? |
has duplicate | 0007450 | closed | atrol | Filing bugs on behalf of another user |
related to | 0007630 | closed | dregad | Override reporter_id |
I suppose this is not something the use of a new field, "original reporter", could solve? Or the idea was to change the one reported as having entered the issue into mantisbt? |
|
You mean a customfield? No, the idea is that the original reporter is kept up to date through the email function. |
|
Cas, I was looking for this. In about 75% of our issues I had to change Reporter. ( Taking calls at the HelpDesk ) Thanks a lot, and I hope it will be in the next release. ( I updated 1.1.8 in stead of 1.2.0, but als works ). Thanks a lot!! |
|
you can do this in a cleaner way with a plugin, as we did: capture the EVENT_REPORT_BUG_FORM_TOP event if ($access_level > REPORTER) { Actually any posted field with name="user_id" will provide the reporter numerical id for the new bug |
|
moreso: you can extend the report form with the EVENT_REPORT_BUG_FORM_TOP, adding any additional input then, do your stuff on the event EVENT_REPORT_BUG once the bug is created to modify it. or: |
|
Even better, where can i find the plugin? |
|
there you have a sketch, should work if not for any syntax miss. that sets a selection of reporters form that project and a check to include yourself in the monitor list |
|
It does work but looks awfull as such. Will see if I can improve it a bit to fit standard layout. |
|
sure, a sketch, i told you ;) |
|
Attached the plugin which now looks ok aswell. |
|
Hi Cas, I tried your plugin, as I was looking for such functionality as well. Thanks for your work. I think there is an issue with the threshold, which apparently checks only the global access level, and not the project specific (I tested with an account with global Developer access, Manager for the project and set the threshold to Manager; the selection list did not appear, but came up when I change the threshold down to Developer) Also, if I may pick nits:
Damien |
|
ouch, you are precise. |
|
You fixed the cosmetic changes, but not the functional problem with the access level. I have found the root cause, you're testing current access level > threshold, instead of >=. I also found a few inconsistencies in the code around the use of strings. If you don't mind, I'll provide later on a version 1.02 including my fix, as well as some changes to the code to generalize use of strings instead of hardcoded text, some cosmetic improvements and reformatting the code to follow the MantisBT guidelines. |
|
Here it goes... Tell me what you think ! |
|
Looks fine: found a typo however in strings_english.txt: $s_plugin_customceporter_config = "Configuration"; should be $s_plugin_customreporter_config = "Configuration"; |
|
Hi Tom Which version did you download & test ? I corrected this in the 1.02 I uploaded yesterday. To Cas and other potential contributors - I created a repository to track the source code on github - git://github.com/dregad/CustomReporter.git Damien |
|
Hi Damien, I downloaded 1.02. And was comparing with 1.01. Perhaps I was not looking to well into the code. I downloaded 1.02 again, and now the code is looking fine. |
|
Great! Let me know if you have any more feedback or suggestions for improvement. |
|
Released new version 1.03 including fix from vboctor (Thanks!) |
|
How come this shows as updated while nothing seems to bechanged? |
|
cas, good catch. |
|
I populated the wiki page for the plugin (Thanks Victor for creating the page for me) |
|
I have moved the git repository to the new mantisbt-plugins organization on github |
|
Hm, should have checked here before writing a solution myself :) |
|
Since this plugin is supported at https://github.com/mantisbt-plugins/CustomReporter, there is really no point in keeping this issue open. |
|