Skip to content

Commit

Permalink
Use VERSION_xxx constants for $p_released param
Browse files Browse the repository at this point in the history
When calling version_get_all_rows(), use defined constants instead of
relying on true, false or null.

Issue #25661
  • Loading branch information
dregad committed Apr 18, 2019
1 parent acdadb8 commit ca5545c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions api/soap/mc_project_api.php
Expand Up @@ -834,9 +834,9 @@ function mci_custom_field_type_name( $p_type_id ) {
* @return array The project versions.
*/
function mci_project_versions( $p_project_id ) {
# use null, true as the fastest way (no additional where clause in query)
# use VERSION_ALL, true as the fastest way (no additional where clause in query)
# to get all released / non-released and obsolete / non-obsolete versions
$t_versions = version_get_all_rows( $p_project_id, null, true );
$t_versions = version_get_all_rows( $p_project_id, VERSION_ALL, true );
$t_results = array();

foreach( $t_versions as $t_version ) {
Expand Down
2 changes: 1 addition & 1 deletion changelog_page.php
Expand Up @@ -245,7 +245,7 @@ function print_project_header_changelog( $p_project_name ) {
$t_resolved = config_get( 'bug_resolved_status_threshold' );

# grab versions info for later use, excluding obsolete ones
$t_version_rows = version_get_all_rows( $t_project_id, null, false );
$t_version_rows = version_get_all_rows( $t_project_id, VERSION_ALL, false );

# cache category info, but ignore the results for now
category_get_all_rows( $t_project_id );
Expand Down
8 changes: 5 additions & 3 deletions core/print_api.php
Expand Up @@ -852,11 +852,13 @@ function print_os_build_option_list( $p_os_build, $p_user_id = null ) {
*
* @param string $p_version The currently selected version.
* @param integer|array|null $p_project_ids A project id, or array of ids, or null to use current project.
* @param integer $p_released Null to get all, 1: only released, 0: only future versions.
* @param boolean $p_leading_blank Allow selection of no version.
* @param integer $p_released One of VERSION_ALL, VERSION_FUTURE or VERSION_RELEASED
* to define which versions to include in the list (defaults to ALL).
* @param boolean $p_leading_blank Allow selection of no version.
*
* @return void
*/
function print_version_option_list( $p_version = '', $p_project_ids = null, $p_released = null, $p_leading_blank = true ) {
function print_version_option_list( $p_version = '', $p_project_ids = null, $p_released = VERSION_ALL, $p_leading_blank = true ) {
if( null === $p_project_ids ) {
$p_project_ids = helper_get_current_project();
}
Expand Down
2 changes: 1 addition & 1 deletion core/version_api.php
Expand Up @@ -577,7 +577,7 @@ function version_get_id( $p_version, $p_project_id = null, $p_inherit = null ) {
$c_project_id = (int)$p_project_id;
}

$t_versions = version_get_all_rows( $c_project_id, null /* released: any */, true /* incl. obsolete */ , $p_inherit );
$t_versions = version_get_all_rows( $c_project_id, VERSION_ALL, true /* incl. obsolete */ , $p_inherit );
foreach( $t_versions as $t_version ) {
if( $t_version['version'] === $p_version ) {
return $t_version['id'];
Expand Down
2 changes: 1 addition & 1 deletion manage_proj_edit_page.php
Expand Up @@ -492,7 +492,7 @@
<div class="widget-body">
<div class="widget-main no-padding">
<?php
$t_versions = version_get_all_rows( $f_project_id, null, true );
$t_versions = version_get_all_rows( $f_project_id, VERSION_ALL, true );
if( count( $t_versions ) > 0 ) { ?>
<div class="table-responsive">
<table id="versions" class="table table-striped table-bordered table-condensed">
Expand Down

0 comments on commit ca5545c

Please sign in to comment.