Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit eae2a50

Browse files
committedApr 7, 2013
Allow helper_get_columns_to_view to specify project id for which we want a column list.
1 parent cc89f12 commit eae2a50

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed
 

‎core/custom_function_api.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,15 @@ function custom_function_default_auth_can_change_password() {
269269
*
270270
* @param int $p_columns_target see COLUMNS_TARGET_* in constant_inc.php
271271
* @param int $p_user_id The user id or null for current logged in user.
272+
* @param int $p_project_id The project id or null for current project.
272273
* @return array
273274
*/
274-
function custom_function_default_get_columns_to_view( $p_columns_target = COLUMNS_TARGET_VIEW_PAGE, $p_user_id = null ) {
275-
$t_project_id = helper_get_current_project();
275+
function custom_function_default_get_columns_to_view( $p_columns_target = COLUMNS_TARGET_VIEW_PAGE, $p_user_id = null, $p_project_id = null ) {
276+
if( $p_project_id === null ) {
277+
$t_project_id = helper_get_current_project();
278+
} else {
279+
$t_project_id = $p_project_id;
280+
}
276281

277282
if( $p_columns_target == COLUMNS_TARGET_EXPORT_PAGE ) {
278283
$t_columns = config_get( 'export_columns', columns_get_default( 'export' ), $p_user_id, $t_project_id );

‎core/helper_api.php

+11-7
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,11 @@ function helper_project_specific_where( $p_project_id, $p_user_id = null ) {
430430
* @param int $p_columns_target
431431
* @param bool $p_viewable_only
432432
* @param int $p_user_id
433+
* @param int $p_project_id
433434
* @return array
434435
*/
435-
function helper_get_columns_to_view( $p_columns_target = COLUMNS_TARGET_VIEW_PAGE, $p_viewable_only = true, $p_user_id = null ) {
436-
$t_columns = helper_call_custom_function( 'get_columns_to_view', array( $p_columns_target, $p_user_id ) );
436+
function helper_get_columns_to_view( $p_columns_target = COLUMNS_TARGET_VIEW_PAGE, $p_viewable_only = true, $p_user_id = null, $p_project_id = null ) {
437+
$t_columns = helper_call_custom_function( 'get_columns_to_view', array( $p_columns_target, $p_user_id, $p_project_id ) );
437438

438439
if( !$p_viewable_only ) {
439440
return $t_columns;
@@ -449,17 +450,20 @@ function helper_get_columns_to_view( $p_columns_target = COLUMNS_TARGET_VIEW_PAG
449450
$t_keys_to_remove[] = 'overdue';
450451
}
451452

452-
if( $p_columns_target == COLUMNS_TARGET_EXPORT_PAGE || OFF == config_get( 'show_attachment_indicator' ) ) {
453+
if( $p_project_id === null ) {
454+
$t_current_project_id = helper_get_current_project();
455+
} else {
456+
$t_current_project_id = $p_project_id;
457+
}
458+
if( $p_columns_target == COLUMNS_TARGET_EXPORT_PAGE || OFF == config_get( 'show_attachment_indicator', null, $p_user_id, $t_current_project_id ) ) {
453459
$t_keys_to_remove[] = 'attachment';
454460
}
455461

456-
$t_current_project_id = helper_get_current_project();
457-
458-
if( $t_current_project_id != ALL_PROJECTS && !access_has_project_level( config_get( 'view_handler_threshold' ), $t_current_project_id ) ) {
462+
if( $t_current_project_id != ALL_PROJECTS && !access_has_project_level( config_get( 'view_handler_threshold', null, $p_user_id, $t_current_project_id ), $t_current_project_id ) ) {
459463
$t_keys_to_remove[] = 'handler_id';
460464
}
461465

462-
if( $t_current_project_id != ALL_PROJECTS && !access_has_project_level( config_get( 'roadmap_view_threshold' ), $t_current_project_id ) ) {
466+
if( $t_current_project_id != ALL_PROJECTS && !access_has_project_level( config_get( 'roadmap_view_threshold', null, $p_user_id, $t_current_project_id ), $t_current_project_id ) ) {
463467
$t_keys_to_remove[] = 'target_version';
464468
}
465469

0 commit comments

Comments
 (0)
Please sign in to comment.