Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions TimeTracking/TimeTracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function config() {
function init() {
$t_path = config_get_global('plugin_path' ). plugin_get_current() . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR;
set_include_path(get_include_path() . PATH_SEPARATOR . $t_path);
plugin_require_api( 'core/timetracking_api.php' );
}


Expand Down
12 changes: 6 additions & 6 deletions TimeTracking/core/timetracking_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ function plugin_TimeTracking_stats_get_project_array( $p_project_id, $p_from, $p
$t_project_table = db_get_table( 'mantis_project_table' );

$t_query = 'SELECT u.username, p.name as project_name, bug_id, expenditure_date, hours, timestamp, category, info
FROM '.$t_timereport_table.' tr
LEFT JOIN '.$t_bug_table.' b ON tr.bug_id=b.id
LEFT JOIN '.$t_user_table.' u ON tr.user=u.id
LEFT JOIN '.$t_project_table.' p ON p.id = b.project_id
WHERE 1=1 ';
FROM '.$t_timereport_table.' tr
LEFT JOIN {bug} b ON tr.bug_id=b.id
LEFT JOIN {user} u ON tr.user=u.id
LEFT JOIN {project} p ON p.id = b.project_id
WHERE 1=1 ';

db_param_push();
$t_query_parameters = array();

Expand Down
7 changes: 2 additions & 5 deletions TimeTracking/pages/add_record.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
2005 by Elmar Schumacher - GAMBIT Consulting GmbH
http://www.mantisbt.org/forums/viewtopic.php?f=4&t=589
*/
require_once( 'timetracking_api.php' );
require_once( 'timetracking_api.php' );
form_security_validate( 'plugin_TimeTracking_add_record' );

$f_bug_id = gpc_get_int( 'bug_id' );
Expand All @@ -29,7 +29,6 @@
$f_month = gpc_get_int( 'month' );
$f_day = gpc_get_int( 'day' );


access_ensure_bug_level( plugin_config_get( 'admin_own_threshold' ), $f_bug_id );

# Current UserID
Expand All @@ -41,7 +40,7 @@

# Trigger in case of non-evaluable entry
if ( $t_time_value == 0 ) {
trigger_error( plugin_lang_get( 'value_error' ), ERROR );
trigger_error( plugin_lang_get( 'value_error' ), ERROR );
}

# Write Post-Data to DB
Expand All @@ -63,5 +62,3 @@
$t_url = string_get_bug_view_url( $f_bug_id, auth_get_current_user_id() );

print_successful_redirect( $t_url . "#timerecord" );

?>
14 changes: 6 additions & 8 deletions TimeTracking/pages/delete_record.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
2005 by Elmar Schumacher - GAMBIT Consulting GmbH
http://www.mantisbt.org/forums/viewtopic.php?f=4&t=589
*/

form_security_validate( 'plugin_TimeTracking_delete_record' );

$f_bug_id = gpc_get_int( 'bug_id' );
Expand All @@ -27,7 +27,7 @@
$t_table = plugin_table('data', 'TimeTracking');
db_param_push();
$t_query_pull_timerecords = 'SELECT * FROM '.$t_table.' WHERE id = '.db_param().' ORDER BY timestamp DESC';
$t_result_pull_timerecords = db_query($t_query_pull_timerecords, array($f_delete_id));
$t_result_pull_timerecords = db_query( $t_query_pull_timerecords, array( $f_delete_id ) );
$t_row = db_fetch_array( $t_result_pull_timerecords );

$t_user_id = auth_get_current_user_id();
Expand All @@ -36,17 +36,15 @@
} else {
access_ensure_bug_level( plugin_config_get( 'admin_threshold' ), $f_bug_id );
}

db_param_push();
$query_delete = 'DELETE FROM '.$t_table.' WHERE id = '.db_param();
db_query($query_delete, array($f_delete_id));
$query_delete = 'DELETE FROM '.$t_table.' WHERE id = '.db_param();
db_query( $query_delete, array( $f_delete_id ) );

history_log_event_direct( $f_bug_id, plugin_lang_get( 'history' ). " " . plugin_lang_get('deleted'), date( config_get("short_date_format"), strtotime($t_row["expenditure_date"])) . ": " . number_format($t_row["hours"], 2, ',', '.') . " h.", "deleted", $t_user_id );

form_security_purge( 'plugin_TimeTracking_delete_record');

$t_url = string_get_bug_view_url( $f_bug_id, auth_get_current_user_id() );

print_successful_redirect( $t_url . "#timerecord" );

?>
6 changes: 3 additions & 3 deletions TimeTracking/pages/show_report.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php
require_once( 'core.php' );
require_once( 'core/bug_api.php' );
require_once( 'timetracking_api.php' );
require_once( 'timetracking_api.php' );

layout_page_header( plugin_lang_get( 'title' ) );
layout_page_begin( plugin_page( 'show_report' ) );

Expand Down Expand Up @@ -274,7 +275,7 @@
</div>
</div>
</div>

<div class="space-10"></div>

<div id="result-issue" class="widget-box widget-color-blue2 <?php echo $t_block_css ?>">
Expand Down Expand Up @@ -324,4 +325,3 @@
</div>
<?php
layout_page_end();
?>