Bug 43313: Fix catalogue detail shelving location display

During the tidying up of Bug 41566, av_loc was accidentally changed to
map descriptions to codes, rather than vice-versa. This broke the
formatting of item permanent locations.

Test plan (for KTD):
1.  Navigate to an catalogue detail page, for example
    http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=262
2.  Run the following SQL, replacing 262 with the biblionumber of your
    chosen page:
      UPDATE items SET location='CHILD' SET permanent_location='GEN' WHERE biblionumber=262;
3.  Refresh the page and verify the items' shelving locations display
    "(Children's area)" only.
4.  Apply patch and force refresh.
5.  Verify the shelving location now correctly displays "General
    stacks" and "(Children's area)" on separate lines.

Sponsored-by: Open Fifth
Signed-off-by: John Vinke <jvinke@austinseminary.edu>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Olivia Reynolds 2026-08-18 15:02:27 +00:00 committed by Pedro Amorim
parent bad9bb47ae
commit dd7777c8b9
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 2 additions and 2 deletions

View File

@ -111,7 +111,7 @@
const can_edit_items_from = [% To.json(can_edit_items_from || []) | $raw %];
const item_type_image_locations = [% To.json(item_type_image_locations) | $raw %];
const av_loc = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.location' })) | $raw %].map( av => [av.lib, av.authorised_value]));
const av_loc = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.location' })) | $raw %].map( av => [av.authorised_value, av.lib]));
const av_lost = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.itemlost' })) | $raw %].map( av => [av.authorised_value, av.lib]));
const av_withdrawn = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.withdrawn' })) | $raw %].map( av => [av.authorised_value, av.lib]));
const av_damaged = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.damaged' })) | $raw %].map( av => [av.authorised_value, av.lib]));
@ -505,7 +505,7 @@
let loc_str = row._strings.location ? row._strings.location.str : row.location;
if (row.permanent_location && row.permanent_location != row.location) {
let permanent_loc_str = av_loc.get(row.permanent_location);
nodes += "%s (%s)".format(escape_str(permanent_loc_str), escape_str(loc_str));
nodes += "%s<br/>(%s)".format(escape_str(permanent_loc_str), escape_str(loc_str));
} else {
nodes += escape_str(loc_str);
}