View Issue Details

IDProjectCategoryView StatusLast Update
0008069mantisbtbugtrackerpublic2012-09-16 17:21
Reportermarc Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionduplicate 
Product Version1.0.7 
Summary0008069: "saved filter popup" always resets itself
Description

The popup which lets you select saved filters always jumps back to "Reset Filter". It should show the selected filter.

Patch attached. I compate the encoded filter string from the cookie with the one from the database, and select the corresponding option.

Additional Information

--- mantis-1.0.7/core/filter_api.php 2006-05-06 05:01:07.000000000 +0200
+++ mantis-1.0.7_mine/core/filter_api.php 2007-06-15 17:22:42.000000000 +0200
@@ -2009,7 +2009,7 @@
<td class="right" colspan="4">
<?php
$t_stored_queries_arr = array();

  • $t_stored_queries_arr = filter_db_get_available_queries();

  • $t_stored_queries_arr = filter_db_get_available_queries(null, null, true);

                    if ( count( $t_stored_queries_arr ) > 0 ) {
                            ?>

    @@ -2023,10 +2023,17 @@
    }
    ?>
    <option value="-1"><?php PRINT '[' . lang_get( 'reset_query' ) . ']' ?></option>

  • <option value="-1"></option>

  • <option value="-1">------</option>
    <?php

  • $t_current_encoded_query = filter_db_get_filter( gpc_get_cookie( config_get( 'view_all_cookie' ), '' ) );
    foreach( $t_stored_queries_arr as $t_query_id => $t_query_name ) {

  • PRINT '<option value="' . $t_query_id . '">' . $t_query_name . '</option>';

  • if (strpos($t_queryid, 'encoded') === false) {

  • $t_query_is_selected = "";

  • if ($t_current_encoded_query == $t_stored_queriesarr['encoded'.$t_query_id]) {

  • $t_query_is_selected = " selected";

  • }

  • PRINT '<option value="' . $t_query_id . '"' . $t_query_is_selected . '>' . $t_query_name . '</option>';

  • }
    }
    ?>
    </select>
    @@ -2281,7 +2288,7 @@
    $result = db_query( $query );
    }

  • function filter_db_get_available_queries( $p_project_id = null, $p_user_id = null ) {

  • function filter_db_get_available_queries( $p_project_id = null, $p_user_id = null, $p_include_encoded_strings = false ) {
    $t_filters_table = config_get( 'mantis_filters_table' );
    $t_overall_query_arr = array();

@@ -2317,6 +2324,9 @@
$row = db_fetch_array( $result );
if ( ( $row['user_id'] == $t_user_id ) || db_prepare_bool( $row['is_public'] ) ) {
$t_overall_query_arr[$row['id']] = $row['name'];

  • if ($p_include_encoded_strings) {
  • $t_overall_queryarr['encoded'.$row['id']] = $row['filter_string'];
  • }
    }
    }
Tagspatch

Relationships

duplicate of 0006491 closeddaryn After applying a filter, the name of the applied filter is replaced by [Reset filter], which leads to misinterpretation 
has duplicate 0013119 closedatrol Currently selected filter 

Activities

dregad

dregad

2012-08-26 17:38

developer   ~0032681

Thanks for the patch.

I have updated it to apply on current 1.2.x branch, and made a few improvements
https://github.com/dregad/mantisbt/tree/fix-8069

Testing and feedback welcome

dregad

dregad

2012-09-03 12:30

developer   ~0032771

It turns out that this is a duplicate of 0006491, and the issue was already resolved in a more elegant way in 1.3 so I'll backport the fix.