Skip to content

Commit

Permalink
Released version 2.1.2
Browse files Browse the repository at this point in the history
This version contains smaller changes when editing a Product Backlog /
showing Links in agileMantis components and minor bugfixes regarding
custom fields, plugin behavior and wrong group-by clauses.
  • Loading branch information
jako87 committed Jul 8, 2015
1 parent 94fbf80 commit 5154c93
Show file tree
Hide file tree
Showing 31 changed files with 545 additions and 493 deletions.
232 changes: 150 additions & 82 deletions agileMantis.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
# agileMantis plugin class
class agileMantisPlugin extends MantisPlugin {

var $version;

/**
* Plugin registration information, some will be shown on plugin overview.
*
Expand All @@ -37,7 +39,7 @@ function register() {
$this->name = "agileMantis";
$this->description = "Enables Scrum on your MantisBT-Installation";
$this->page = "info";
$this->version = "2.1.1";
$this->version = "2.1.2";
$this->requires = array( "MantisCore" => "1.2.5" );
$this->author = "gadiv GmbH";
$this->contact = "[email protected]";
Expand Down Expand Up @@ -561,6 +563,8 @@ function install() {
// Install site key
plugin_config_set('gadiv_sitekey', md5(uniqid(rand(), true)));

$this->installConfigurationParams();

// Create custom fields
$this->create_custom_field( 'ProductBacklog',
array( 'possible_values' => '', 'type' => '6' ) ); // List
Expand Down Expand Up @@ -641,7 +645,9 @@ function getDBVersion() {
*/
function upgrade() {

plugin_config_set( 'gadiv_agilemantis_version', $this->version = "2.1.0" );
plugin_config_set( 'gadiv_agilemantis_version', $this->version = "2.1.2" );

$this->installConfigurationParams();

return ( TRUE );
}
Expand Down Expand Up @@ -987,9 +993,15 @@ function event_report_bug( $p_bug_event, $p_bug_data ) {
# add agileMantis plugin functions after sending bug data to database when a bug is updated
# - adding custom field values to mantis and agilemantis tables
function event_update_bug( $p_bug_event, $p_bug_data, $p_bug_id ) {
global $agilemantis_pb;
global $agilemantis_pb;
global $agilemantis_commonlib;

$t_product_owner = "";
$t_handler_id = 0;
$t_product_backlog_id = 0;
$t_team_id = 0;
$f_bug_id = 0;

// Only projects with agilMantis backlog
if( !$agilemantis_commonlib->projectHasBacklogs( helper_get_current_project() ) ) {
return;
Expand All @@ -1005,33 +1017,27 @@ function event_update_bug( $p_bug_event, $p_bug_data, $p_bug_id ) {
|| isset( $_POST['technical'] ) || isset( $_POST['presentable'] )
|| isset( $_POST['inReleaseDocu'] ) || isset( $_POST['sprint'] ) ) {

$f_bug_id = $_POST['bug_id'];
$f_bug_id = (int) $_POST['bug_id'];
$agilemantis_pb->setCustomFieldValues( $f_bug_id );

# change Product Backlog
if( $_POST['old_product_backlog']
!= $_POST['backlog']
&& $_POST['backlog'] != "" ) {

if( $_POST['old_product_backlog'] != $_POST['backlog'] && $_POST['backlog'] != "" ) {
$p_bug_data->handler_id = $_SESSION['tracker_handler'];
$p_bug_data->status = 50;
}

# change back to Team User if no Product Backlog is selected
if( $_POST['old_product_backlog']
!= $_POST['backlog']
&& $_POST['backlog'] == "" ) {

$product_backlog_id = $agilemantis_pb->get_product_backlog_id(
$_POST['old_product_backlog'] );
$handler_id = 0;
if( $agilemantis_pb->count_productbacklog_teams( $product_backlog_id ) > 0 ) {
$team_id = $agilemantis_pb->getTeamIdByBacklog( $product_backlog_id );
$product_owner = $agilemantis_pb->getProductOwner( $team_id );
$handler_id = $agilemantis_pb->getUserIdByName( $product_owner );
if( $_POST['old_product_backlog'] != $_POST['backlog'] && $_POST['backlog'] == "" ) {

$t_product_backlog_id = $agilemantis_pb->get_product_backlog_id( $_POST['old_product_backlog'] );

if( $agilemantis_pb->count_productbacklog_teams( $t_product_backlog_id ) > 0 ) {
$t_team_id = $agilemantis_pb->getTeamIdByBacklog( $t_product_backlog_id );
$t_product_owner = $agilemantis_pb->getProductOwner( $t_team_id );
$t_handler_id = user_get_id_by_name( $t_product_owner );
}

$p_bug_data->handler_id = $handler_id;
$p_bug_data->handler_id = $t_handler_id;
}
}
}
Expand Down Expand Up @@ -1110,87 +1116,85 @@ function event_bug_action ( $p_event, $p_action, $p_bug_id ) {

$t_custom_field_id = $_SESSION['custom_field_id'];

# restore values from selected bug list if necessary
foreach( $_POST['bug_arr'] AS $num => $row ) {
$pb_id = $agilemantis_commonlib->getProductBacklogIDByBugId( $p_bug_id );
$list_sprints = $agilemantis_commonlib->getSprintsByBacklogId( $pb_id );
$current_sprint = $agilemantis_commonlib->getSprintByBugId( $p_bug_id );

$pb_id = $agilemantis_commonlib->getProductBacklogIDByBugId( $row );
$list_sprints = $agilemantis_commonlib->getSprintsByBacklogId( $pb_id );
$current_sprint = $agilemantis_commonlib->getSprintByBugId( $row );
$t_custom_field_value = $_SESSION['custom_field'][$p_bug_id];
if( !$t_custom_field_value ) {
$t_custom_field_value = '';
}

$t_custom_field_value = $_SESSION['custom_field'][$row];
if( !$t_custom_field_value ) {
$t_custom_field_value = '';
}
$t_status = bug_get_field( $p_bug_id, 'status' );

# restore story points value
if( $t_custom_field_id == $agilemantis_commonlib->sp ) {
if( $current_sprint[0]['status'] > 0 || $pb_id == 0 ) {
$agilemantis_commonlib->restoreCustomFieldValue(
$row, $t_custom_field_id, $t_custom_field_value );
}
# restore story points value
if( $t_custom_field_id == $agilemantis_commonlib->sp ) {
if( $current_sprint[0]['status'] > 1 || $pb_id == 0 || $t_status >= 80) {
$agilemantis_commonlib->restoreCustomFieldValue($p_bug_id, $t_custom_field_id, $t_custom_field_value );
}
}

# restore product backlog value
if( $t_custom_field_id == $agilemantis_commonlib->pb ) {
$pbl = $agilemantis_commonlib->getProjectProductBacklogs(
helper_get_current_project() );
$do_not_reset = false;
if( !empty( $pbl ) ) {
foreach( $pbl AS $key => $value ) {
if( $value['pb_id'] == $pb_id ) {
$do_not_reset = true;
}
# restore product backlog value
if( $t_custom_field_id == $agilemantis_commonlib->pb ) {
$pbl = $agilemantis_commonlib->getProjectProductBacklogs(
helper_get_current_project() );
$do_not_reset = false;
if( !empty( $pbl ) ) {
foreach( $pbl AS $key => $value ) {
if( $value['pb_id'] == $pb_id ) {
$do_not_reset = true;
}
}
}

$value_resettet = false;
if( $current_sprint[0]['name'] != ''
|| $pb_id == 0
|| empty($pbl)
|| $do_not_reset == false ) {

$agilemantis_commonlib->restoreCustomFieldValue(
$row,
$t_custom_field_id,
$t_custom_field_value );
$value_resettet = false;
if( $current_sprint[0]['name'] != ''
|| $pb_id == 0
|| empty($pbl)
|| $do_not_reset == false ) {

$value_resettet = true;
}
$agilemantis_commonlib->restoreCustomFieldValue(
$p_bug_id,
$t_custom_field_id,
$t_custom_field_value );

if( empty( $t_custom_field_value ) && $value_resettet == false ) {
$agilemantis_commonlib->setTrackerStatus( $row, 50 );
$agilemantis_commonlib->id = $pb_id;
$backlog = $agilemantis_commonlib->getSelectedProductBacklog();
$agilemantis_commonlib->updateTrackerHandler(
$row , $backlog[0]['user_id'] , $pb_id );
}
$value_resettet = true;
}

if( empty( $t_custom_field_value ) && $value_resettet == false ) {
$agilemantis_commonlib->setTrackerStatus( $p_bug_id, 50 );
$agilemantis_commonlib->id = $pb_id;
$backlog = $agilemantis_commonlib->getSelectedProductBacklog();
$agilemantis_commonlib->updateTrackerHandler(
$p_bug_id , $backlog[0]['user_id'] , $pb_id );
}

if( $t_custom_field_id == $agilemantis_commonlib->spr ) {
if( empty( $list_sprints ) ) {
$agilemantis_commonlib->restoreCustomFieldValue(
$row, $t_custom_field_id, $t_custom_field_value );
}
}

# old sprint information
$agilemantis_commonlib->sprint_id = $t_custom_field_value;
$sprintInfo = $agilemantis_sprint->getSprintById();
if( $t_custom_field_id == $agilemantis_commonlib->spr ) {
if( empty( $list_sprints ) ) {
$agilemantis_commonlib->restoreCustomFieldValue(
$p_bug_id, $t_custom_field_id, $t_custom_field_value );
}

if( $current_sprint[0]['pb_id'] != $pb_id ) {
$agilemantis_commonlib->restoreCustomFieldValue(
$row, $t_custom_field_id, $t_custom_field_value );
}
# old sprint information
$agilemantis_commonlib->sprint_id = $t_custom_field_value;
$sprintInfo = $agilemantis_sprint->getSprintById();

if( $sprintInfo['status'] > 0 || $pb_id == 0 ) {
$agilemantis_commonlib->restoreCustomFieldValue(
$row, $t_custom_field_id, $t_custom_field_value );
}
if( $current_sprint[0]['pb_id'] != $pb_id ) {
$agilemantis_commonlib->restoreCustomFieldValue(
$p_bug_id, $t_custom_field_id, $t_custom_field_value );
}

# update bug date
bug_update_date( $p_bug_id );
if( $current_sprint[0]['status'] > 1 || $pb_id == 0 || $t_status >= 80 ) {
$agilemantis_commonlib->restoreCustomFieldValue(
$p_bug_id, $t_custom_field_id, $t_custom_field_value );
}
}

# update bug date
bug_update_date( $p_bug_id );

}

# add menu items to mantis main menu between "Summary" and "Manage"
Expand Down Expand Up @@ -1278,6 +1282,7 @@ function event_layout_content_end() {
}

function event_layout_resources() {

echo '<link rel="stylesheet" href="'.AGILEMANTIS_PLUGIN_URL.'css/agileMantis.css">';
echo '<link rel="stylesheet" href="'.AGILEMANTIS_PLUGIN_URL.'css/jquery-ui.css">';
echo '<script src="' . AGILEMANTIS_PLUGIN_URL . 'js/jquery-1.9.1.js"></script>';
Expand Down Expand Up @@ -1311,5 +1316,68 @@ function create_custom_field( $p_field_name, $p_def_array ) {
}
}

function installConfigurationParams(){

if( !config_is_set( 'plugin_agileMantis_gadiv_workday_in_hours' ) ) {
config_set( 'plugin_agileMantis_gadiv_workday_in_hours', 8 );
}

if( !config_is_set( 'plugin_agileMantis_gadiv_sprint_length' ) ) {
config_set( 'plugin_agileMantis_gadiv_sprint_length', 28 );
}

if( !config_is_set( 'plugin_agileMantis_gadiv_storypoint_mode' ) ) {
config_set( 'plugin_agileMantis_gadiv_storypoint_mode', 0 );
}

if( !config_is_set( 'plugin_agileMantis_gadiv_fibonacci_length' ) ) {
config_set( 'plugin_agileMantis_gadiv_fibonacci_length', 10 );
}

if( !config_is_set( 'plugin_agileMantis_gadiv_show_storypoints' ) ) {
config_set( 'plugin_agileMantis_gadiv_show_storypoints', 0 );
}

if( !config_is_set( 'plugin_agileMantis_gadiv_task_unit_mode' ) ) {
config_set( 'plugin_agileMantis_gadiv_task_unit_mode', 'h' );
}

if( !config_is_set( 'plugin_agileMantis_gadiv_userstory_unit_mode' ) ) {
config_set( 'plugin_agileMantis_gadiv_userstory_unit_mode', 'h' );
}

if( !config_is_set( 'plugin_agileMantis_gadiv_taskboard' ) ) {
config_set( 'plugin_agileMantis_gadiv_taskboard', 0 );
}

if( !config_is_set( 'plugin_agileMantis_gadiv_daily_scrum' ) ) {
config_set( 'plugin_agileMantis_gadiv_daily_scrum', 0 );
}

if( !config_is_set( 'plugin_agileMantis_gadiv_ranking_order' ) ) {
config_set( 'plugin_agileMantis_gadiv_ranking_order', 0 );
}

if( !config_is_set( 'plugin_agileMantis_gadiv_show_rankingorder' ) ) {
config_set( 'plugin_agileMantis_gadiv_show_rankingorder', 0 );
}

if( !config_is_set( 'plugin_agileMantis_gadiv_presentable' ) ) {
config_set( 'plugin_agileMantis_gadiv_presentable', 0 );
}

if( !config_is_set( 'plugin_agileMantis_gadiv_release_documentation' ) ) {
config_set( 'plugin_agileMantis_gadiv_release_documentation', 0 );
}

if( !config_is_set( 'plugin_agileMantis_gadiv_technical' ) ) {
config_set( 'plugin_agileMantis_gadiv_technical', 0 );
}

if( !config_is_set( 'plugin_agileMantis_gadiv_tracker_planned_costs' ) ) {
config_set( 'gadiv_tracker_planned_costs', 0 );
}
}

}
?>
10 changes: 5 additions & 5 deletions core/agile_mantis_custom_fields_inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<tr '.helper_alternate_class().'>
<td style="background-color:#B3B3CC;font-weight:bold;color:#000;">Story Points</td>
<td>';
if( plugin_config_get('gadiv_storypoint_mode') == 1 ) {
if( plugin_config_get( 'gadiv_storypoint_mode' ) == 1 ) {
echo '<input type="text" name="storypoints" value="'.
$story['storypoints'].'" '.$readonly.' '.$disable_storypoints.'>';
} else {
Expand All @@ -101,7 +101,7 @@
}
echo '</td>
';
if( plugin_config_get('gadiv_tracker_planned_costs') == '1'
if( plugin_config_get( 'gadiv_tracker_planned_costs' ) == '1'
&& $agilemantis_sprint->customFieldIsInProject( "PlannedWork" ) == true ) {
echo '
<td style="background-color:#B3B3CC;font-weight:bold;color:#000;">'.
Expand Down Expand Up @@ -136,7 +136,7 @@
if( $row['name'] == $story['name'] ) {
echo 'selected';
}?>><?php
echo string_display_links($row['name'])?></option>
echo string_display($row['name'])?></option>
<?php }?>
<?php echo '
</select>
Expand Down Expand Up @@ -172,8 +172,8 @@
<?php if( $row['sname'] == $story['sprint'] ) {
echo 'selected';
$selected = true;
}?>><?php
echo string_display_links($row['sname'])?></option>
}?>><?php
echo string_display( $row['sname'] )?></option>
<?php }}?>
<?php if($agilemantis_sprint->getUserStoryStatus( $p_project_id ) >= 80
&& !empty( $story['sprint'] ) && $selected == false ) {?>
Expand Down
7 changes: 4 additions & 3 deletions core/chart/generate_velocity_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@
$SprintAvarageKid += $row['total_developer_capacity'] / $row['workday_length'];
$SprintAvarageWes += $row['work_performed'] / $row['workday_length'];
$SprintAvarageWorkPerformed += $row['work_performed'] / $row['workday_length'];
}else{
echo $agilemantis_commonlib->createAgManWarning( plugin_lang_get('warning_1').'workday_lenght of Sprint'.plugin_lang_get('warning_2') );
} else {
echo $agilemantis_commonlib->createAgManWarning( plugin_lang_get('warning_1', 'agileMantis').'workday_length of Sprint'.plugin_lang_get('warning_2', 'agileMantis') );
}
}
}
Expand All @@ -202,9 +202,10 @@
if( $previous[0]['workday_length'] != 0 ){
$kidpre = $previous[0]['total_developer_capacity'] / $previous[0]['workday_length'];
$wespre = ($previous[0]['work_performed'] / $previous[0]['workday_length']);
} else {
} else if( $previous != 0 ) {
echo $agilemantis_commonlib->createAgManWarning('workday_lenght of previous Sprint');
}

#if(false){
if( $referenced[0]['workday_length'] != 0 ){
$kidref = $referenced[0]['total_developer_capacity'] / $referenced[0]['workday_length'];
Expand Down
Loading

0 comments on commit 5154c93

Please sign in to comment.