[Koha-bugs] [Bug 33484] Generalise table saveState for all tables

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Jul 7 16:58:02 CEST 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33484

Emily Lamancusa <emily.lamancusa at montgomerycountymd.gov> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Patch doesn't apply         |Failed QA

--- Comment #32 from Emily Lamancusa <emily.lamancusa at montgomerycountymd.gov> ---
Taking another stab at testing this. I'm still getting a few tables (holds to
pull and saved SQL reports, at least) that will continue to save the local
configuration indefinitely if a local save state was ever created, even if it
was later disabled in the configuration. I couldn't figure out why it happens
with some tables and not others, but it did clear up when I tried moving the
block that clears the local save state (if configured not to save) to occur
before trying to load the local save state:

Lines ~21-53 (columns_settings.inc):

+        if ( table_settings.hasOwnProperty('default_save_state') &&
table_settings['default_save_state'] === 0 ) {
+            localStorage.removeItem(table_key);
+        }
+        
        // enable stateSave
        dt_parameters['stateSave']         = true;
        dt_parameters['stateSaveCallback'] = function( settings, data ) {
            localStorage.setItem( table_key, JSON.stringify(data) )
        }
        dt_parameters['stateLoadCallback'] = function(settings) {
            return JSON.parse( localStorage.getItem(table_key) )
        }

        // merge stateSave for column settings
        var local_settings = localStorage.getItem(table_key);
        var system_settings = table_settings['columns'];
        var columns_settings = get_columns_saved_state(local_settings,
system_settings);

        $(columns_settings).each( function() {
            var named_id = $( 'thead th[data-colname="' + this.columnname +
'"]', selector ).index( selector + ' th' );
            var used_id = dt_parameters.bKohaColumnsUseNames ? named_id :
counter;
            if ( used_id == -1 ) return;

            if ( this['is_hidden'] == "1" ) {
                hidden_ids.push( used_id );
            }
            if ( this['cannot_be_toggled'] == "0" ) {
                included_ids.push( used_id );
            }
            counter++;
        });

-        if ( table_settings.hasOwnProperty('default_save_state') &&
table_settings['default_save_state'] === 0 ) {
-            localStorage.removeItem(table_key);
-        }

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list