Bug 12670 - Show materials label instead of code
Summary: Show materials label instead of code
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Julian Maurice
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-29 14:28 UTC by Julian Maurice
Modified: 2016-12-05 21:27 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 12670: Show materials label instead of code (1.99 KB, patch)
2014-07-29 14:28 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 12670: Show materials label instead of code (2.31 KB, patch)
2014-10-26 07:17 UTC, Frédéric Demians
Details | Diff | Splinter Review
Bug 12670: Show materials label instead of code (2.04 KB, patch)
2015-06-26 14:15 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 12670: Show materials label in checkin/checkout messages (2.21 KB, patch)
2015-08-25 10:20 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 12670: Show materials label in checkin/checkout messages (2.15 KB, patch)
2016-02-22 15:16 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 12670: Show materials label instead of code (2.04 KB, patch)
2016-02-22 15:16 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 12670: Show materials label in checkin/checkout messages (2.15 KB, patch)
2016-02-22 15:16 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 12670: Show materials label instead of code (2.10 KB, patch)
2016-02-22 15:35 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 12670: Show materials label in checkin/checkout messages (2.20 KB, patch)
2016-02-22 15:35 UTC, Nick Clemens
Details | Diff | Splinter Review
[PASSED QA] Bug 12670: Show materials label instead of code (2.17 KB, patch)
2016-03-24 06:27 UTC, Katrin Fischer
Details | Diff | Splinter Review
[PASSED QA] Bug 12670: Show materials label in checkin/checkout messages (2.29 KB, patch)
2016-03-24 06:28 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Maurice 2014-07-29 14:28:18 UTC
In catalogue/detail.pl, if items.materials is linked to an authorised values list, show label instead of code.
Comment 1 Julian Maurice 2014-07-29 14:28:41 UTC Comment hidden (obsolete)
Comment 2 Nick Clemens 2014-08-02 17:40:58 UTC
When testing I found that if I entered any value defined as an AV into subfield 3/materials sepcified it displayed the label whether or not the field was linked

i.e.
1 - apply patch
2 - do not link any fields
3 - enter 'CART' into subfield 3 (defined as "Book Cart" in LOC category of AV)
4 - 'Book Cart' displays on catalogue/detail.pl
Comment 3 Julian Maurice 2014-10-10 08:31:00 UTC
Hi Nick,

are you sure there is nothing linked to the subfield $3 ? In any framework ?
Does master have the same behaviour ?
Does it also happen with another subfield ?

Could you also check the "Koha to MARC mappings" page (cgi-bin/koha/admin/koha2marclinks.pl) ?

Thanks.
Comment 4 Nick Clemens 2014-10-10 11:27:29 UTC
I cannot now recreate, still had some oddness going on but I think it was me so reverting to sign off and will test again when I have a chnace
Comment 5 Frédéric Demians 2014-10-26 07:17:06 UTC Comment hidden (obsolete)
Comment 6 Katrin Fischer 2014-10-26 09:29:59 UTC
Ok, I see a problem here that keeps me from testing. I have changed my framework to link 952$3 (default for MARC21 materials) to an authorized value. But now when I edit an item, there is no pull down and no input field. I can't enter a new value?
Comment 7 Katrin Fischer 2014-10-26 09:31:31 UTC
Turns out... it was the 'collapsed' flag causing some weirdness, back to testing.
Comment 8 Katrin Fischer 2014-10-26 09:39:34 UTC
I have tested this some more and I don't feel like this is working well:

- The check-in and check-out messages still show the code and not the description.
- The code is not specific enough. It doesn't check if the subfield is mapped to an authorized value. The translation to a description will also happen, if you haven't mapped your framework to an authorized value at all.
- It doesn't look for a specific authorized value category, so if you have the same codes in multiple categories, the display is kinda random.
Comment 9 Frédéric Demians 2014-10-26 10:22:57 UTC
(In reply to Katrin Fischer from comment #8)

> - The check-in and check-out messages still show the code and not the
> description.

Do you mean that a follow-up patch is required? I agree that if this patch is
necessary on catalogue/details.pl page, other pages displaying items.materials
should be updated.

> - The code is not specific enough. It doesn't check if the subfield is mapped
> to an authorized value. The translation to a description will also happen, if
> you haven't mapped your framework to an authorized value at all.

I don't understand. How can the translation to a description happen without AV?

> - It doesn't look for a specific authorized value category, so if you have
> the same codes in multiple categories, the display is kinda random.

I think you're wrong. The call to GetAuthValCode() returns the name of the AV
list linked to items.materials. And then, the available values for this
specific AV are retrieved by calling GetAuthorisedValues.
Comment 10 Katrin Fischer 2014-10-26 10:26:25 UTC
Hi Frederic, I was surprised as well.
I first linked it to the reports group authorized value and added ACC - it worked and translated the display to Accounts.
Then I removed the linking, it still showed Accounts.
Then I changed the code to ADDR - a code from another authorized value, and it translated it to the description given there.
Comment 11 Frédéric Demians 2014-10-26 11:00:24 UTC
(In reply to Katrin Fischer from comment #10)
> Hi Frederic, I was surprised as well.
> I first linked it to the reports group authorized value and added ACC - it
> worked and translated the display to Accounts.
> Then I removed the linking, it still showed Accounts.
> Then I changed the code to ADDR - a code from another authorized value, and
> it translated it to the description given there.

I can't reproduce that! Are you sure you're modifying the correct framework? the one used for the biblio record you test?
Comment 12 Katrin Fischer 2014-10-26 11:05:35 UTC
I was using the default framework. I have a feeling like we should test that the routine actually returns an AV, but I haven't taken a closer look.

The check-in/check-out messages could be fixed in a separate bug, but I think we should aim to make this a complete feature.
Comment 13 Frédéric Demians 2014-10-26 11:28:43 UTC
(In reply to Katrin Fischer from comment #12)
> I was using the default framework. I have a feeling like we should test that
> the routine actually returns an AV, but I haven't taken a closer look.
> 
> The check-in/check-out messages could be fixed in a separate bug, but I
> think we should aim to make this a complete feature.

Looking closely at the code (detail.pl), It seems that code refactoring should be welcome on the way all AV are decoded... For a lot of fields, GetKohaAuhtorisedValues/GetAuthValCode are called: location, ccode, copynumber, itemlost, damaged, etc. We could have a new function doing all the decoding in once:

  DecodeAuthValues( $item, $fw, qw/ items.location items. ccode / );

And in C4::Koha, authorized values are not cached... So it means that if we have to display, let say, 30 items, having each 5 AV, 150 SQL queries are sent to MySQL.
Comment 14 Julian Maurice 2015-06-26 14:15:22 UTC Comment hidden (obsolete)
Comment 15 Julian Maurice 2015-06-26 14:24:33 UTC
Katrin or Frédéric, could you be more specific about check-in and check-out messages? I don't see what you are talking about.
Comment 16 Katrin Fischer 2015-06-26 14:28:14 UTC
Julian,
when you check-in or check-out an item with materials set, there is a little dialog box showing up with the text from the field.
Comment 17 Julian Maurice 2015-08-25 10:20:41 UTC Comment hidden (obsolete)
Comment 18 Jonathan Druart 2015-12-28 11:30:19 UTC
CONFLICT (content): Merge conflict in circ/circulation.pl
Comment 19 Alex Arnaud 2016-02-22 15:16:03 UTC Comment hidden (obsolete)
Comment 20 Alex Arnaud 2016-02-22 15:16:27 UTC Comment hidden (obsolete)
Comment 21 Alex Arnaud 2016-02-22 15:16:32 UTC Comment hidden (obsolete)
Comment 22 Nick Clemens 2016-02-22 15:35:14 UTC Comment hidden (obsolete)
Comment 23 Nick Clemens 2016-02-22 15:35:19 UTC Comment hidden (obsolete)
Comment 24 Katrin Fischer 2016-03-24 06:27:38 UTC
Created attachment 49512 [details] [review]
[PASSED QA] Bug 12670: Show materials label instead of code

In catalogue/detail.pl, if items.materials is linked to an authorised
values list, show label instead of code.

Test plan:
1/ Create an authorised values list 'MATERIALS' with some values
2/ In default MARC biblio framework, link an item subfield to
'items.materials', and to the AV list 'MATERIALS'
3/ Edit an item and give a value for this subfield
4/ Go to biblio record detail page (catalogue/detail.pl)
5/ In the items table, the authorised value label should be displayed.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 25 Katrin Fischer 2016-03-24 06:28:52 UTC
Created attachment 49513 [details] [review]
[PASSED QA] Bug 12670: Show materials label in checkin/checkout messages

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 26 Katrin Fischer 2016-03-24 06:30:42 UTC
Tested checkout, checkin and detail page view with and without authorised value.
Comment 27 Brendan Gallagher 2016-03-24 17:30:53 UTC
Pushed to Master - Should be in the May 2016 release.  Thanks!