Bug 23590: Batch update manager for suggestions
[koha.git] / Koha / Manual.pm
blob3c1e45f206bd5297ec303fe4002ebbde3b723377
1 package Koha::Manual;
3 use Modern::Perl;
5 use C4::Context;
7 sub _get_help_version {
8 my $help_version = C4::Context->preference("Version");
9 if ( $help_version =~ m|^(\d+)\.(\d{2}).*$| ) {
10 my $version = $1;
11 my $major = $2;
12 unless ( $major % 2 ) { $major-- };
13 $major = sprintf("%02d", $major);
14 $help_version = "$version.$major";
16 return $help_version;
19 sub _get_base_url {
20 my ( $preferred_language ) = @_;
22 my @available_languages = qw( en ar cs es fr it pt_BR tz zh_TW );
24 my ( $language ) = grep {
25 my $preferred_short = substr $preferred_language, 0, 2;
26 my $avail_short = substr $_, 0, 2;
27 $preferred_short eq $avail_short ? $_ : ()
28 } @available_languages;
30 my $KohaManualLanguage = $language || C4::Context->preference('KohaManualLanguage') || 'en';
31 my $KohaManualBaseURL = C4::Context->preference('KohaManualBaseURL') || 'https://koha-community.org/manual';
32 if ( $KohaManualBaseURL =~ m|^/| ) {
33 $KohaManualBaseURL = C4::Context->preference('staffClientBaseURL') . $KohaManualBaseURL;
35 return $KohaManualBaseURL . '/' . _get_help_version . '/' . $KohaManualLanguage . '/html'; # TODO html could be a KohaManualFormat with pdf, html, epub
38 our $mapping = {
39 'about' => '/plugins.html#about-koha',
40 'acqui/acqui-home' => '/acquisitions.html',
41 'acqui/addorderiso2709' => '/acquisitions.html#create-a-basket',
42 'acqui/basket' => '/acquisitions.html#create-a-basket',
43 'acqui/basketgroup' => '/acquisitions.html#create-a-basket-group',
44 'acqui/basketheader' => '/acquisitions.html#create-a-basket',
45 'acqui/booksellers' => '/acquisitions.html#acquisition-searches',
46 'acqui/edifactmsgs' => '/acquisitions.html#edifact-messages',
47 'acqui/histsearch' => '/acquisitions.html#acquisition-searches',
48 'acqui/invoice' => '/acquisitions.html#invoices',
49 'acqui/invoices' => '/acquisitions.html#invoices',
50 'acqui/lateorders' => '/acquisitions.html#claims-late-orders',
51 'acqui/neworderbiblio' => '/acquisitions.html#create-a-basket',
52 'acqui/neworderempty' => '/acquisitions.html#create-a-basket',
53 'acqui/newordersubscription' => '/acquisitions.html#create-a-basket',
54 'acqui/newordersuggestion' => '/acquisitions.html#create-a-basket',
55 'acqui/orderreceive' => '/acquisitions.html#receiving-orders',
56 'acqui/parcel' => '/acquisitions.html#receiving-orders',
57 'acqui/parcels' => '/acquisitions.html#receiving-orders',
58 'acqui/supplier' => '/acquisitions.html#vendors',
59 'acqui/uncertainprice' => '/acquisitions.html#create-a-basket',
60 'acqui/z3950_search' => '/acquisitions.html#create-a-basket',
61 'admin/admin-home' => '/administration.html',
62 'admin/aqbudgetperiods' => '/administration.html#budgets',
63 'admin/aqbudgets' => '/administration.html#funds',
64 'admin/aqcontract' => '/acquisitions.html#vendor-contracts',
65 'admin/aqplan' => '/administration.html#budget-planning',
66 'admin/auth_subfields_structure' => '/administration.html#authority-types',
67 'admin/auth_tag_structure' => '/administration.html#authority-types',
68 'admin/authorised_values' => '/administration.html#authorized-values',
69 'admin/authtypes' => '/administration.html#authority-types',
70 'admin/biblio_framework' => '/administration.html#marc-bibliographic-frameworks',
71 'admin/branch_transfer_limits' => '/administration.html#library-transfer-limits',
72 'admin/branches' => '/administration.html#libraries-&-groups',
73 'admin/categories' => '/administration.html#patron-categories',
74 'admin/checkmarc' => '/administration.html#marc-bibliographic-framework-test',
75 'admin/cities' => '/administration.html#cities-and-towns',
76 'admin/classsources' => '/administration.html#classification-sources',
77 'admin/columns_settings' => '/administration.html#column-settings',
78 'admin/currency' => '/administration.html#currencies-and-exchange-rates',
79 'admin/didyoumean' => '/administration.html#did-you-mean?',
80 'admin/edi_accounts' => '/administration.html#edi-accounts',
81 'admin/edi_ean_accounts' => '/administration.html#library-eans',
82 'admin/item_circulation_alerts' => '/administration.html#item-circulation-alerts',
83 'admin/items_search_fields' => '/administration.html#item-search-fields',
84 'admin/itemtypes' => '/administration.html#item-types',
85 'admin/koha2marclinks' => '/administration.html#koha-to-marc-mapping',
86 'admin/marc_subfields_structure' => '/administration.html#marc-bibliographic-frameworks',
87 'admin/marctagstructure' => '/administration.html#marc-bibliographic-frameworks',
88 'admin/matching-rules' => '/administration.html#record-matching-rules',
89 'admin/oai_set_mappings' => '/administration.html#oai-sets-configuration',
90 'admin/oai_sets' => '/administration.html#oai-sets-configuration',
91 'admin/patron-attr-types' => '/administration.html#patron-attribute-types',
92 'admin/preferences' => '/systempreferences.html',
93 'admin/smart-rules' => '/administration.html#circulation-and-fine-rules',
94 'admin/sms_providers' => '/administration.html#sms-cellular-providers',
95 'admin/systempreferences' => '/systempreferences.html#local-use',
96 'admin/transport-cost-matrix' => '/administration.html#transport-cost-matrix',
97 'admin/z3950servers' => '/administration.html#z39.50/sru-servers',
98 'authorities/authorities-home' => '/cataloging.html#authorities',
99 'authorities/authorities' => '/cataloging.html#authorities',
100 'authorities/detail' => '/cataloging.html#authorities',
101 'authorities/merge' => '/cataloging.html#merging-authorities',
102 'catalogue/detail' => '/cataloging.html#bibliographic-records',
103 'catalogue/issuehistory' => '/cataloging.html#item-specific-circulation-history',
104 'catalogue/itemsearch' => '/searching.html#item-searching',
105 'catalogue/moredetail' => '/cataloging.html#item-records',
106 'catalogue/search-history' => '/plugins.html#search-history',
107 'catalogue/search' => '/searching.html',
108 'cataloguing/addbiblio' => '/cataloging.html#bibliographic-records',
109 'cataloguing/addbooks' => '/cataloging.html',
110 'cataloguing/additem' => '/cataloging.html#item-records',
111 'cataloguing/linkitem' => '/cataloging.html#adding-analytic-records',
112 'cataloguing/merge' => '/cataloging.html#merging-records',
113 'cataloguing/moveitem' => '/cataloging.html#moving-items',
114 'circ/article-requests' => '/circulation.html#article-requests',
115 'circ/branchoverdues' => '/circulation.html#overdues-with-fines',
116 'circ/branchtransfers' => '/circulation.html#transfers',
117 'circ/circulation-home' => '/circulation.html',
118 'circ/circulation' => '/circulation.html#check-out-(issuing)',
119 'circ/offline' => '/circulation.html#offline-circulation-in-koha',
120 'circ/on-site_checkouts' => '/circulation.html#pending-on-site-checkouts',
121 'circ/overdue' => '/circulation.html#overdues',
122 'circ/pendingreserves' => '/circulation.html#holds-to-pull',
123 'circ/renew' => '/circulation.html#renewing',
124 'circ/reserveratios' => '/circulation.html#hold-ratios',
125 'circ/returns' => '/circulation.html#check-in-returning',
126 'circ/set-library' => '/circulation.html#set-library',
127 'circ/transferstoreceive' => '/circulation.html#transfers-to-receive',
128 'circ/view_holdsqueue' => '/circulation.html#holds-queue',
129 'circ/waitingreserves' => '/circulation.html#holds-awaiting-pickup',
130 'course_reserves/add_items' => '/course_reserves.html',
131 'course_reserves/course-details' => '/course_reserves.html',
132 'course_reserves/course-reserves' => '/course_reserves.html',
133 'course_reserves/course' => '/course_reserves.html#adding-courses',
134 'labels/label-edit-batch' => '/tools.html#label-batches-label',
135 'labels/label-edit-layout' => '/tools.html#label-layouts-label',
136 'labels/label-edit-profile' => '/tools.html#label-profiles-label',
137 'labels/label-edit-range' => '/tools.html#label-creator-label', #FIXME Add when documented
138 'labels/label-edit-template' => '/tools.html#label-templates-label',
139 'labels/label-home' => '/tools.html#label-creator-label',
140 'labels/label-manage' => '/tools.html#label-creator-label',
141 'labels/spinelabel-home' => '/tools.html#quick-spine-label-creator',
142 'mainpage' => '/',
143 'members/apikeys' => '/webservices.html#api-key-management-interface-for-patrons',
144 'members/boraccount' => '/patrons.html#fines',
145 'members/discharge' => '/patrons.html#patron-discharges',
146 'members/files' => '/patrons.html#files',
147 'members/mancredit' => '/patrons.html#creating-manual-credits',
148 'members/maninvoice' => '/patrons.html#creating-manual-invoices',
149 'members/member-flags' => '/patrons.html#patron-permissions',
150 'members/member-password' => '/patrons.html#editing-patrons',
151 'members/member' => '/patrons.html#patron-search',
152 'members/memberentry' => '/patrons.html#add-a-new-patron',
153 'members/members-home' => '/patrons.html',
154 'members/members-update' => '/patrons.html#managing-patron-self-edits',
155 'members/moremember' => '/patrons.html#patron-information',
156 'members/notices' => '/patrons.html#notices',
157 'members/pay' => '/patrons.html#pay/reverse-fines',
158 'members/paycollect' => '/patrons.html#pay/reverse-fines',
159 'members/purchase-suggestions' => '/patrons.html#purchase-suggestions',
160 'members/readingrec' => '/patrons.html#circulation-history',
161 'members/routing-lists' => '/patrons.html#routing-lists',
162 'members/statistics' => '/patrons.html#statistics',
163 'offline_circ/list' => '/circulation.html#offline-circulation-utilities',
164 'offline_circ/process_koc' => '/circulation.html#upload-offline-circ-file',
165 'patron_lists/lists' => '/tools.html#patron-lists',
166 'patroncards/edit-batch' => '/tools.html#batches',
167 'patroncards/edit-layout' => '/tools.html#layouts',
168 'patroncards/edit-profile' => '/tools.html#profiles',
169 'patroncards/edit-template' => '/tools.html#templates',
170 'patroncards/home' => '/tools.html#patron-card-creator',
171 'patroncards/image-manage' => '/tools.html#manage-images',
172 'patroncards/manage' => '/tools.html#patron-card-creator',
173 'plugins/plugins-home' => '/plugins.html',
174 'plugins/plugins-upload' => '/plugins.html',
175 'reports/acquisitions_stats' => '/reports.html#acquisitions-statistics',
176 'reports/bor_issues_top' => '/reports.html#patrons-with-the-most-checkouts',
177 'reports/borrowers_out' => '/reports.html#patrons-with-no-checkouts',
178 'reports/borrowers_stats' => '/reports.html#patron-statistics',
179 'reports/cat_issues_top' => '/reports.html#most-circulated-items',
180 'reports/catalogue_out' => '/reports.html#items-with-no-checkouts',
181 'reports/catalogue_stats' => '/reports.html#catalog-statistics',
182 'reports/dictionary' => '/reports.html#report-dictionary',
183 'reports/guided_reports' => '/reports.html#custom-reports',
184 'reports/issues_avg_stats' => '/reports.html#average-loan-time',
185 'reports/issues_stats' => '/reports.html#circulation-statistics',
186 'reports/itemslost' => '/reports.html#lost-items',
187 'reports/manager' => '/reports.html#catalog-by-item-type',
188 'reports/reports-home' => '/reports.html',
189 'reports/reserves_stats' => '/reports.html#holds-statistics',
190 'reports/serials_stats' => '/reports.html#serials-statistics',
191 'reserve/request' => '/circulation.html#holds',
192 'reviews/reviewswaiting' => '/tools.html#comments',
193 'rotating_collections/rotatingCollections' => '/tools.html#rotating-collections',
194 'serials/checkexpiration' => '/serials.html#check-serial-expiration',
195 'serials/claims' => '/serials.html#claim-late-serials',
196 'serials/routing' => '/serials.html#create-a-routing-list',
197 'serials/serials-collection' => '/serials.html',
198 'serials/serials-edit' => '/serials.html#receive-issues',
199 'serials/serials-home' => '/serials.html',
200 'serials/subscription-add' => '/serials.html#add-a-subscription',
201 'serials/subscription-detail' => '/serials.html',
202 'serials/subscription-frequencies' => '/serials.html#manage-serial-frequencies',
203 'serials/subscription-numberpatterns' => '/serials.html#manage-serial-numbering-patterns',
204 'suggestion/suggestion' => '/acquisitions.html#managing-suggestions',
205 'tags/list' => '/tools.html#tag-moderation',
206 'tags/review' => '/tools.html#tag-moderation',
207 'tools/batchMod' => '/tools.html#batch-item-deletion',
208 'tools/batch_delete_records' => '/tools.html#batch-record-deletion',
209 'tools/batch_record_modification' => '/tools.html#batch-record-modification',
210 'tools/cleanborrowers' => '/tools.html#patrons-anonymize-bulk-delete',
211 'tools/csv-profiles' => '/tools.html#csv-profiles',
212 'tools/export' => '/tools.html#export-bibliographic-records',
213 'tools/holidays' => '/tools.html#calendar',
214 'tools/import_borrowers' => '/tools.html#patron-import',
215 'tools/inventory' => '/tools.html#inventory-stocktaking',
216 'tools/koha-news' => '/tools.html#news',
217 'tools/letter' => '/tools.html#notices-slips',
218 'tools/manage-marc-import' => '/tools.html#staged-marc-record-management',
219 'tools/marc_modification_templates' => '/tools.html#marc-modification-templates',
220 'tools/modborrowers' => '/tools.html#batch-patron-modification',
221 'tools/overduerules' => '/tools.html#overdue-notice-status-triggers',
222 'tools/picture-upload' => '/tools.html#upload-patron-images',
223 'tools/quotes-upload' => '/tools.html#import-quotes',
224 'tools/quotes' => '/tools.html#quote-of-the-day-(qotd)-editor',
225 'tools/scheduler' => '/tools.html#task-scheduler',
226 'tools/stage-marc-import' => '/tools.html#stage-marc-records-for-import',
227 'tools/tools-home' => '/tools.html',
228 'tools/upload-cover-image' => '/tools.html#upload-local-cover-image',
229 'tools/viewlog' => '/tools.html#log-viewer',
230 'virtualshelves/shelves' => '/lists.html#lists',
233 sub get_url {
234 my ( $url, $preferred_language ) = @_;
235 my $file;
236 if ($url =~ /koha\/(.*)\.pl/) {
237 $file = $1;
238 } else {
239 $file = 'mainpage';
241 $file =~ s/[^a-zA-Z0-9_\-\/]*//g;
243 my $base_url = _get_base_url( $preferred_language );
244 return $base_url . ( exists $mapping->{$file} ? $mapping->{$file} : $mapping->{mainpage} );