znuny / Znuny

Znuny/Znuny LTS is a fork of the ((OTRS)) Community Edition, one of the most flexible web-based ticketing systems used for Customer Service, Help Desk, IT Service Management.
https://www.znuny.org
GNU General Public License v3.0
335 stars 82 forks source link

Fixed processing of NavBarModule for process tickets and submenus #463

Open tipue-dev opened 12 months ago

tipue-dev commented 12 months ago

Proposed change

EDIT: Extended the fix. The customer frontend in Znuny 7 changed in a way that there are no sub menus by default anymore. The processing of NavBarModule for process tickets doesn't work correctly after this change. It adds an 'empty' menu entry that is clickable and will be highlighted on mouse over. image

This problem was also the reason for the bug https://github.com/znuny/Znuny/issues/355. This bug has been fixed by hiding the wrongly created empty sub menus. My fix stops the creation of the wrong submenus, so i also reverted the fix for that problem and added some css, so that sub menus now work normally and in a small window.

image image

This all is because the entry for process tickets isn't deleted correctly and the NavBarModule-hash get's a bit scrambled up. Before the NavBarModule for process tickets is checked it looks like this:

Kernel::Output::HTML::Layout::CustomerNavigationBar Line:4613';
%NavBarModule = {
                    '0000010' => {
                                   'AccessKey' => 'o',
                                   'Block' => '',
                                   'Description' => 'Create new process ticket.',
                                   'Group' => [],
                                   'GroupRo' => [],
                                   'Link' => 'Action=CustomerTicketProcess',
                                   'LinkOption' => '',
                                   'Name' => 'Create Process Ticket',
                                   'NavBar' => 'Ticket',
                                   'Prio' => '0010',
                                   'Type' => 'Menu'
                                 },
                    '0000100' => {
                                   'AccessKey' => 'n',
                                   'Block' => '',
                                   'Description' => 'Create new Ticket.',
                                   'Group' => [],
                                   'GroupRo' => [],
                                   'Link' => 'Action=CustomerTicketMessage',
                                   'LinkOption' => '',
                                   'Name' => 'Create Ticket',
                                   'NavBar' => 'Ticket',
                                   'Prio' => 100,
                                   'Type' => 'Menu'
                                 },
                    '0000101' => {
                                   'AccessKey' => 'm',
                                   'Block' => '',
                                   'Description' => 'Tickets.',
                                   'Group' => [],
                                   'GroupRo' => [],
                                   'Link' => 'Action=CustomerTicketOverview;Subaction=MyTickets',
                                   'LinkOption' => '',
                                   'Name' => 'My Tickets',
                                   'NavBar' => 'Ticket',
                                   'Prio' => 101,
                                   'Type' => 'Menu'
                                 },
                    '0000120' => {
                                   'AccessKey' => 't',
                                   'Block' => '',
                                   'Description' => 'Company Tickets.',
                                   'Group' => [],
                                   'GroupRo' => [],
                                   'Link' => 'Action=CustomerTicketOverview;Subaction=CompanyTickets',
                                   'LinkOption' => '',
                                   'Name' => 'Company Tickets',
                                   'NavBar' => 'Ticket',
                                   'Prio' => 120,
                                   'Type' => 'Menu'
                                 },
                    '0000300' => {
                                   'AccessKey' => 's',
                                   'Block' => '',
                                   'Description' => 'Search tickets.',
                                   'Group' => [],
                                   'GroupRo' => [],
                                   'Link' => 'Action=CustomerTicketSearch',
                                   'LinkOption' => '',
                                   'Name' => 'Ticket Search',
                                   'NavBar' => 'Ticket',
                                   'Prio' => 300,
                                   'Type' => 'Menu'
                                 },
                    '0000710' => {
                                   'AccessKey' => 'x',
                                   'Block' => '',
                                   'Description' => 'FAQ Explorer',
                                   'Group' => [],
                                   'GroupRo' => [],
                                   'Link' => 'Action=CustomerFAQExplorer',
                                   'LinkOption' => '',
                                   'Name' => 'FAQ Explorer',
                                   'NavBar' => 'FAQ',
                                   'Prio' => 710,
                                   'Type' => 'Menu'
                                 },
                    '0000780' => {
                                   'AccessKey' => 'f',
                                   'Block' => '',
                                   'Description' => 'FAQ Search',
                                   'Group' => [],
                                   'GroupRo' => [],
                                   'Link' => 'Action=CustomerFAQSearch',
                                   'LinkOption' => '',
                                   'Name' => 'FAQ Search',
                                   'NavBar' => 'FAQ',
                                   'Prio' => 780,
                                   'Type' => 'Menu'
                                 }
                  };

After the NavBarModule for process tickets tries to delete the entry for process tickets:

Kernel::Output::HTML::Layout::CustomerNavigationBar Line:4643';
%NavBarModule = {
                    '0000010' => {
                                   '0000010' => {
                                                  'AccessKey' => 'o',
                                                  'Block' => '',
                                                  'Description' => 'Create new process ticket.',
                                                  'Group' => [],
                                                  'GroupRo' => [],
                                                  'Link' => 'Action=CustomerTicketProcess',
                                                  'LinkOption' => '',
                                                  'Name' => 'Create Process Ticket',
                                                  'NavBar' => 'Ticket',
                                                  'Prio' => '0010',
                                                  'Type' => 'Menu'
                                                },
                                   '0000100' => {
                                                  'AccessKey' => 'n',
                                                  'Block' => '',
                                                  'Description' => 'Create new Ticket.',
                                                  'Group' => [],
                                                  'GroupRo' => [],
                                                  'Link' => 'Action=CustomerTicketMessage',
                                                  'LinkOption' => '',
                                                  'Name' => 'Create Ticket',
                                                  'NavBar' => 'Ticket',
                                                  'Prio' => 100,
                                                  'Type' => 'Menu'
                                                },
                                   '0000101' => {
                                                  'AccessKey' => 'm',
                                                  'Block' => '',
                                                  'Description' => 'Tickets.',
                                                  'Group' => [],
                                                  'GroupRo' => [],
                                                  'Link' => 'Action=CustomerTicketOverview;Subaction=MyTickets',
                                                  'LinkOption' => '',
                                                  'Name' => 'My Tickets',
                                                  'NavBar' => 'Ticket',
                                                  'Prio' => 101,
                                                  'Type' => 'Menu'
                                                },
                                   '0000120' => {
                                                  'AccessKey' => 't',
                                                  'Block' => '',
                                                  'Description' => 'Company Tickets.',
                                                  'Group' => [],
                                                  'GroupRo' => [],
                                                  'Link' => 'Action=CustomerTicketOverview;Subaction=CompanyTickets',
                                                  'LinkOption' => '',
                                                  'Name' => 'Company Tickets',
                                                  'NavBar' => 'Ticket',
                                                  'Prio' => 120,
                                                  'Type' => 'Menu'
                                                },
                                   '0000300' => {
                                                  'AccessKey' => 's',
                                                  'Block' => '',
                                                  'Description' => 'Search tickets.',
                                                  'Group' => [],
                                                  'GroupRo' => [],
                                                  'Link' => 'Action=CustomerTicketSearch',
                                                  'LinkOption' => '',
                                                  'Name' => 'Ticket Search',
                                                  'NavBar' => 'Ticket',
                                                  'Prio' => 300,
                                                  'Type' => 'Menu'
                                                },
                                   '0000710' => {
                                                  'AccessKey' => 'x',
                                                  'Block' => '',
                                                  'Description' => 'FAQ Explorer',
                                                  'Group' => [],
                                                  'GroupRo' => [],
                                                  'Link' => 'Action=CustomerFAQExplorer',
                                                  'LinkOption' => '',
                                                  'Name' => 'FAQ Explorer',
                                                  'NavBar' => 'FAQ',
                                                  'Prio' => 710,
                                                  'Type' => 'Menu'
                                                },
                                   '0000780' => {
                                                  'AccessKey' => 'f',
                                                  'Block' => '',
                                                  'Description' => 'FAQ Search',
                                                  'Group' => [],
                                                  'GroupRo' => [],
                                                  'Link' => 'Action=CustomerFAQSearch',
                                                  'LinkOption' => '',
                                                  'Name' => 'FAQ Search',
                                                  'NavBar' => 'FAQ',
                                                  'Prio' => 780,
                                                  'Type' => 'Menu'
                                                },
                                   'Ticket' => {}
                                 },
%NavBarModule->{'0000010'}{'0000100'},
%NavBarModule->{'0000010'}{'0000101'},
%NavBarModule->{'0000010'}{'0000120'},
%NavBarModule->{'0000010'}{'0000300'},
%NavBarModule->{'0000010'}{'0000710'},
%NavBarModule->{'0000010'}{'0000780'},
%NavBarModule->{'0000010'}=> $
                  };

With this fix, the entry get's deleted correctly:

Kernel::Output::HTML::Layout::CustomerNavigationBar Line:4640';
%NavBarModule = {
                    '0000100' => {
                                   'AccessKey' => 'n',
                                   'Block' => '',
                                   'Description' => 'Create new Ticket.',
                                   'Group' => [],
                                   'GroupRo' => [],
                                   'Link' => 'Action=CustomerTicketMessage',
                                   'LinkOption' => '',
                                   'Name' => 'Create Ticket',
                                   'NavBar' => 'Ticket',
                                   'Prio' => 100,
                                   'Type' => 'Menu'
                                 },
                    '0000101' => {
                                   'AccessKey' => 'm',
                                   'Block' => '',
                                   'Description' => 'Tickets.',
                                   'Group' => [],
                                   'GroupRo' => [],
                                   'Link' => 'Action=CustomerTicketOverview;Subaction=MyTickets',
                                   'LinkOption' => '',
                                   'Name' => 'My Tickets',
                                   'NavBar' => 'Ticket',
                                   'Prio' => 101,
                                   'Type' => 'Menu'
                                 },
                    '0000120' => {
                                   'AccessKey' => 't',
                                   'Block' => '',
                                   'Description' => 'Company Tickets.',
                                   'Group' => [],
                                   'GroupRo' => [],
                                   'Link' => 'Action=CustomerTicketOverview;Subaction=CompanyTickets',
                                   'LinkOption' => '',
                                   'Name' => 'Company Tickets',
                                   'NavBar' => 'Ticket',
                                   'Prio' => 120,
                                   'Type' => 'Menu'
                                 },
                    '0000300' => {
                                   'AccessKey' => 's',
                                   'Block' => '',
                                   'Description' => 'Search tickets.',
                                   'Group' => [],
                                   'GroupRo' => [],
                                   'Link' => 'Action=CustomerTicketSearch',
                                   'LinkOption' => '',
                                   'Name' => 'Ticket Search',
                                   'NavBar' => 'Ticket',
                                   'Prio' => 300,
                                   'Type' => 'Menu'
                                 },
                    '0000710' => {
                                   'AccessKey' => 'x',
                                   'Block' => '',
                                   'Description' => 'FAQ Explorer',
                                   'Group' => [],
                                   'GroupRo' => [],
                                   'Link' => 'Action=CustomerFAQExplorer',
                                   'LinkOption' => '',
                                   'Name' => 'FAQ Explorer',
                                   'NavBar' => 'FAQ',
                                   'Prio' => 710,
                                   'Type' => 'Menu'
                                 },
                    '0000780' => {
                                   'AccessKey' => 'f',
                                   'Block' => '',
                                   'Description' => 'FAQ Search',
                                   'Group' => [],
                                   'GroupRo' => [],
                                   'Link' => 'Action=CustomerFAQSearch',
                                   'LinkOption' => '',
                                   'Name' => 'FAQ Search',
                                   'NavBar' => 'FAQ',
                                   'Prio' => 780,
                                   'Type' => 'Menu'
                                 }
                  };

1 - 🐞 bug 🐞

Breaking change

I removed the return of the menu entries, since they are passed as a reference anyways. This might be a breaking change if there are NavBarModule in use that i don't know about, but they would likely also create ghost entries and would have to be changed.

Checklist

NiklasSchmitt commented 5 days ago

The changes in sub CustomerNavigationBar may affects also other NavBar modules of the znuny framework and also Znuny packages like FAQ and similar packages (also by third-party developers). These packages needs to get checked/fixed when approving and merging this changes and requires a big note on developer documentation.