Kernel::WebApp::Util::PersonalPreferences

NAME

Kernel::WebApp::Util::PersonalPreferences – Personal preferences utility methods.

PUBLIC INTERFACE

SettingsForCategory

Discovers all the active preferences for the given category.

    $PerferencesUtil->SettingsForCategory(
        UserType             => '...' # required 'customer|agent'
        UserID               => '...' # required
        UserLogin            => '...' # required
        Category             => '...' # required
        ShowInUserManagement => 1|0, # optional
        AdminInterface       => 1|0, # optional
    );

Returns

    undef - in case any error occurs

    [
        Kernel::WebApp::Util::UserPreferenceType->new(...),
    ]

SettingsByCategory()

Discovers all the active customer preferences and groups them by Category (PreferenceGroup).

    $PerferencesUtil->SettingsByCategory(
        UserType             => '...' # required 'customer|agent'
        UserID               => '...' # required
        UserLogin            => '...' # required
        ShowInUserManagement => 1|0, # optional
        AdminInterface       => 1|0, # optional
    );

Returns

    undef - in case any error occurs

    {
        Order => [
            {
                ID => 'test',
                Name => 'Test',
            }
        ],

        Data => {
            'test' => [
                Kernel::WebApp::Util::UserPreferenceType->new(...),
                ...,
            ],
        },
    }

Settings()

Returns a array of all the active customer personal preference settings.

    $PreferencesUtil->Settings(
        UserType             => '...', # required 'customer|agent'
        UserID               => '...', # required
        UserLogin            => '...', # required
        ShowInUserManagement => 1|0,   # optional
        AdminInterface       => 1|0,   # optional
    );

Returns

    undef - in case any error occurs

    [
        Kernel::WebApp::Util::UserPreferenceType->new(...),
        ...,
    ],

Setting()

Returns the personal preference object.

    $PreferencesUtil->Setting(
        UserType             => '...', # required 'customer|agent'
        UserID               => '...', # required
        Name                 => '...', # required
        ShowInUserManagement => 1|0,   # optional
        AdminInterface       => 1|0,   # optional
    ),

PRIVATE INTERFACE

_LoopThroughSettings()

Loop through all the configured settings and for each one send it to the callback.

    my @Preferences = ();
    $PreferencesUtil->_LoopThroughSettings(
        ShowInUserManagement => '1|0',            # optional
        AdminInterface       => '1|0',            # optional
        UserType             => 'agent|customer', # optional
        Category             => 'category-id',    # optional
        ProcessItem          => sub {
            my $Preference = shift;
            push @Preferences, $Preference;
        }
    );

Returns

    1     - in case of success
    undef - in case any error occurs

_Categories()

Get the personal preferences categories.

    my $Categories = $PreferencesUtil->_Categories();
Scroll to Top