Bug 31465: (follow-up) Link to preference tabs directly
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 16 Sep 2022 11:33:31 +0000 (12:33 +0100)
committerArthur Suzuki <arthur.suzuki@biblibre.com>
Tue, 15 Nov 2022 17:08:58 +0000 (18:08 +0100)
This patch enhances the mapping system for the help button to allow for
each tab of preferences to link directly to the relevent section of the
manual.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 6d82b66a277caa879a5a7b0c8f05a84f795beb4d)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 78a2c2220689fde6ed1c2c88043889064aa76e4e)
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Koha/Manual.pm

index f1d012d..46641f8 100644 (file)
@@ -90,6 +90,23 @@ our $mapping = {
     'admin/oai_sets'                           => '/administration.html#oai-sets-configuration',
     'admin/patron-attr-types'                  => '/administration.html#patron-attribute-types',
     'admin/preferences'                        => '/globalpreferences.html',
+    'admin/preferences#accounting'             => '/accountspreferences.html',
+    'admin/preferences#acquisitions'           => '/acquisitionspreferences.html',
+    'admin/preferences#admin'                  => '/administrationpreferences.html',
+    'admin/preferences#authorities'            => '/authoritiespreferences.html',
+    'admin/preferences#cataloguing'            => '/catalogingpreferences.html',
+    'admin/preferences#circulation'            => '/circulationpreferences.html',
+    'admin/preferences#enhanced_content'       => '/enhancedcontentpreferences.html',
+    'admin/preferences#i18n_l10n'              => '/i18npreferences.html',
+    'admin/preferences#logs'                   => '/logspreferences.html',
+    'admin/preferences#opac'                   => '/opacpreferences.html',
+    'admin/preferences#patrons'                => '/patronspreferences.html',
+    'admin/preferences#searching'              => '/searchingpreferences.html',
+    'admin/preferences#serials'                => '/serialspreferences.html',
+    'admin/preferences#staff_interface'        => '/staffclientpreferences.html',
+    'admin/preferences#staff_interface'        => '/staffclientpreferences.html',
+    'admin/preferences#tools'                  => '/toolspreferences.html',
+    'admin/preferences#web_services'           => '/webservicespreferences.html',
     'admin/smart-rules'                        => '/administration.html#circulation-and-fine-rules',
     'admin/sms_providers'                      => '/administration.html#sms-cellular-providers',
     'admin/systempreferences'                  => '/localusepreferences.html',
@@ -242,8 +259,18 @@ sub get_url {
     }
     $file =~ s/[^a-zA-Z0-9_\-\/]*//g;
 
+    my $view;
+    if ($url =~ /(?:\?|\&)tab=(?<value>[\w+,.-]*)/) {
+        $view = $file . '#' . $+{value};
+    }
+
     my $base_url = _get_base_url( $preferred_language );
-    return $base_url . ( exists $mapping->{$file} ? $mapping->{$file} : $mapping->{mainpage} );
+    return $base_url
+      . (
+          exists $mapping->{$view} ? $mapping->{$view}
+        : exists $mapping->{$file} ? $mapping->{$file}
+        :                            $mapping->{mainpage}
+      );
 }
 
 1;