Bug 17249 - Koha::AuthorisedValues - Remove GetKohaAuthorisedValuesFromField
Summary: Koha::AuthorisedValues - Remove GetKohaAuthorisedValuesFromField
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Jonathan Druart
QA Contact: Martin Renvoize
URL:
Keywords:
Depends on: 17094 17248
Blocks: 15799 17250 19023
  Show dependency treegraph
 
Reported: 2016-09-05 14:15 UTC by Jonathan Druart
Modified: 2018-12-03 20:04 UTC (History)
3 users (show)

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


Attachments
Bug 17249: Remove GetKohaAuthorisedValuesFromField - Add classes MarcSubfieldStructure[s] (5.57 KB, patch)
2016-09-05 15:20 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17249: Remove GetKohaAuthorisedValuesFromField - add tests (4.22 KB, patch)
2016-09-05 15:20 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17249: Remove GetKohaAuthorisedValuesFromField - Add search_by_marc_field (7.41 KB, patch)
2016-09-05 15:20 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17249: Remove GetKohaAuthorisedValuesFromField - inventory (2.88 KB, patch)
2016-09-05 15:20 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17249: Remove GetKohaAuthorisedValuesFromField - (follow-up) inventory (2.43 KB, patch)
2016-09-05 15:20 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17249: Remove GetKohaAuthorisedValuesFromField (1.89 KB, patch)
2016-09-05 15:20 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17249: GetKohaAuthorisedValuesFromField - rm GetAuthValCodeFromField (1.49 KB, patch)
2016-09-05 15:20 UTC, Jonathan Druart
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 17249: Remove GetKohaAuthorisedValuesFromField - Add classes MarcSubfieldStructure[s] (5.67 KB, patch)
2016-09-09 12:51 UTC, Owen Leonard
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 17249: Remove GetKohaAuthorisedValuesFromField - add tests (4.32 KB, patch)
2016-09-09 12:52 UTC, Owen Leonard
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 17249: Remove GetKohaAuthorisedValuesFromField - Add search_by_marc_field (7.50 KB, patch)
2016-09-09 12:52 UTC, Owen Leonard
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 17249: Remove GetKohaAuthorisedValuesFromField - inventory (2.99 KB, patch)
2016-09-09 12:52 UTC, Owen Leonard
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 17249: Remove GetKohaAuthorisedValuesFromField - (follow-up) inventory (2.53 KB, patch)
2016-09-09 12:52 UTC, Owen Leonard
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 17249: Remove GetKohaAuthorisedValuesFromField (2.00 KB, patch)
2016-09-09 12:52 UTC, Owen Leonard
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 17249: GetKohaAuthorisedValuesFromField - rm GetAuthValCodeFromField (1.59 KB, patch)
2016-09-09 12:52 UTC, Owen Leonard
Details | Diff | Splinter Review
[PASSED QA] Bug 17249: Remove GetKohaAuthorisedValuesFromField - Add classes MarcSubfieldStructure[s] (5.70 KB, patch)
2016-10-13 12:47 UTC, Martin Renvoize
Details | Diff | Splinter Review
[PASSED QA] Bug 17249: Remove GetKohaAuthorisedValuesFromField - add tests (4.34 KB, patch)
2016-10-13 12:47 UTC, Martin Renvoize
Details | Diff | Splinter Review
[PASSED QA] Bug 17249: Remove GetKohaAuthorisedValuesFromField - Add search_by_marc_field (7.52 KB, patch)
2016-10-13 12:47 UTC, Martin Renvoize
Details | Diff | Splinter Review
[PASSED QA] Bug 17249: Remove GetKohaAuthorisedValuesFromField - inventory (3.01 KB, patch)
2016-10-13 12:48 UTC, Martin Renvoize
Details | Diff | Splinter Review
[PASSED QA] Bug 17249: Remove GetKohaAuthorisedValuesFromField - (follow-up) inventory (2.56 KB, patch)
2016-10-13 12:48 UTC, Martin Renvoize
Details | Diff | Splinter Review
[PASSED QA] Bug 17249: Remove GetKohaAuthorisedValuesFromField (2.02 KB, patch)
2016-10-13 12:48 UTC, Martin Renvoize
Details | Diff | Splinter Review
[PASSED QA] Bug 17249: GetKohaAuthorisedValuesFromField - rm GetAuthValCodeFromField (1.62 KB, patch)
2016-10-13 12:48 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2016-09-05 14:15:33 UTC

    
Comment 1 Jonathan Druart 2016-09-05 15:20:38 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2016-09-05 15:20:41 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2016-09-05 15:20:44 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2016-09-05 15:20:47 UTC Comment hidden (obsolete)
Comment 5 Jonathan Druart 2016-09-05 15:20:50 UTC Comment hidden (obsolete)
Comment 6 Jonathan Druart 2016-09-05 15:20:53 UTC Comment hidden (obsolete)
Comment 7 Jonathan Druart 2016-09-05 15:20:56 UTC Comment hidden (obsolete)
Comment 8 Jonathan Druart 2016-09-08 19:49:08 UTC
(In reply to Jonathan Druart from comment #5)
> Created attachment 55180 [details] [review] [review]
> To make sure decrease this execution time to what it was before, this
> patch introduces a local to avoid the same query to be executed several
> times.

That does not mean anything...

Read:
To decrease this execution time to what it was before, this patch introduces a local cache not to execute the same query several times.
Comment 9 Claire Gravely 2016-09-09 10:39:14 UTC
patch does not apply

CONFLICT (content): Merge conflict in t/db_dependent/AuthorisedValues.t
Comment 10 Owen Leonard 2016-09-09 12:51:56 UTC
Created attachment 55428 [details] [review]
[SIGNED-OFF] Bug 17249: Remove GetKohaAuthorisedValuesFromField - Add classes MarcSubfieldStructure[s]

This patch adds the 2 Koha::Object based classes for the
marc_subfield_structure table

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 11 Owen Leonard 2016-09-09 12:52:06 UTC
Created attachment 55429 [details] [review]
[SIGNED-OFF] Bug 17249: Remove GetKohaAuthorisedValuesFromField - add tests

This patch adds a few tests to C4::Record::marcrecord2csv
The subroutine was not covered enough to validate that this patch set
won't add regressions.

Note that the patch set will fix an issue: If 2 subfields of a field are
linked to AVs and you want to display them in a CSV, they won't be
replaced with their descriptions.

Test plan:
Apply the patch, and make a copy of t/db_dependent/Record/marcrecord2csv.t
Checkout master and prove marcrecord2csv.t
Tests should fail
Checkout the branch with the whole patch set applied
The tests should pass

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 12 Owen Leonard 2016-09-09 12:52:15 UTC
Created attachment 55430 [details] [review]
[SIGNED-OFF] Bug 17249: Remove GetKohaAuthorisedValuesFromField - Add search_by_marc_field

This patch adds a new Koha::AuthorisedValues->search_by_marc_field
method.
It will permit to replace several subroutine from C4::Koha dealing with
authorised values.
It also uses this new methods to replace an occurrence of
GetKohaAuthorisedValuesFromField in C4::Record::marcrecord2csv

Test plan:
  prove t/db_dependent/AuthorisedValues.t
should return green

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 13 Owen Leonard 2016-09-09 12:52:21 UTC
Created attachment 55431 [details] [review]
[SIGNED-OFF] Bug 17249: Remove GetKohaAuthorisedValuesFromField - inventory

This patch deals with the inventory files calling
GetKohaAuthorisedValuesFromField.

Test plan:
  prove t/db_dependent/Items/GetItemsForInventory.t
should still return green

Use the inventory tool, on the result page the AV descriptions should
correctly replace the codes

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 14 Owen Leonard 2016-09-09 12:52:27 UTC
Created attachment 55432 [details] [review]
[SIGNED-OFF] Bug 17249: Remove GetKohaAuthorisedValuesFromField - (follow-up) inventory

Before this patch set, the tests in
t/db_dependent/Items/GetItemsForInventory.t were executed in 4s. But
with the previous patch, it was in 45sec(!)
To make sure decrease this execution time to what it was before, this
patch introduces a local to avoid the same query to be executed several
times.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 15 Owen Leonard 2016-09-09 12:52:33 UTC
Created attachment 55433 [details] [review]
[SIGNED-OFF] Bug 17249: Remove GetKohaAuthorisedValuesFromField

Remove the subroutine, it's no longer in used.

Test plan:
  git grep GetKohaAuthorisedValuesFromField
should not return any occurrences.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 16 Owen Leonard 2016-09-09 12:52:41 UTC
Created attachment 55434 [details] [review]
[SIGNED-OFF] Bug 17249: GetKohaAuthorisedValuesFromField - rm GetAuthValCodeFromField

The subroutine GetAuthValCodeFromField was only used from
GetKohaAuthorisedValuesFromField.

Test plan:
  git grep GetAuthValCodeFromField
should not return any occurrences.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 17 Owen Leonard 2016-09-09 12:53:51 UTC
Everything tested correctly according to the test plans. The only issue I had was that GetItemsForInventory.t was still very slow. I don't know if that was a problem with the patch or a problem with my slow VM.
Comment 18 Martin Renvoize 2016-10-13 12:47:38 UTC
Created attachment 56380 [details] [review]
[PASSED QA] Bug 17249: Remove GetKohaAuthorisedValuesFromField - Add classes MarcSubfieldStructure[s]

This patch adds the 2 Koha::Object based classes for the
marc_subfield_structure table

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 19 Martin Renvoize 2016-10-13 12:47:52 UTC
Created attachment 56381 [details] [review]
[PASSED QA] Bug 17249: Remove GetKohaAuthorisedValuesFromField - add tests

This patch adds a few tests to C4::Record::marcrecord2csv
The subroutine was not covered enough to validate that this patch set
won't add regressions.

Note that the patch set will fix an issue: If 2 subfields of a field are
linked to AVs and you want to display them in a CSV, they won't be
replaced with their descriptions.

Test plan:
Apply the patch, and make a copy of t/db_dependent/Record/marcrecord2csv.t
Checkout master and prove marcrecord2csv.t
Tests should fail
Checkout the branch with the whole patch set applied
The tests should pass

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 20 Martin Renvoize 2016-10-13 12:47:56 UTC
Created attachment 56382 [details] [review]
[PASSED QA] Bug 17249: Remove GetKohaAuthorisedValuesFromField - Add search_by_marc_field

This patch adds a new Koha::AuthorisedValues->search_by_marc_field
method.
It will permit to replace several subroutine from C4::Koha dealing with
authorised values.
It also uses this new methods to replace an occurrence of
GetKohaAuthorisedValuesFromField in C4::Record::marcrecord2csv

Test plan:
  prove t/db_dependent/AuthorisedValues.t
should return green

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 21 Martin Renvoize 2016-10-13 12:48:00 UTC
Created attachment 56383 [details] [review]
[PASSED QA] Bug 17249: Remove GetKohaAuthorisedValuesFromField - inventory

This patch deals with the inventory files calling
GetKohaAuthorisedValuesFromField.

Test plan:
  prove t/db_dependent/Items/GetItemsForInventory.t
should still return green

Use the inventory tool, on the result page the AV descriptions should
correctly replace the codes

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 22 Martin Renvoize 2016-10-13 12:48:03 UTC
Created attachment 56384 [details] [review]
[PASSED QA] Bug 17249: Remove GetKohaAuthorisedValuesFromField - (follow-up) inventory

Before this patch set, the tests in
t/db_dependent/Items/GetItemsForInventory.t were executed in 4s. But
with the previous patch, it was in 45sec(!)
To make sure decrease this execution time to what it was before, this
patch introduces a local to avoid the same query to be executed several
times.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 23 Martin Renvoize 2016-10-13 12:48:07 UTC
Created attachment 56385 [details] [review]
[PASSED QA] Bug 17249: Remove GetKohaAuthorisedValuesFromField

Remove the subroutine, it's no longer in used.

Test plan:
  git grep GetKohaAuthorisedValuesFromField
should not return any occurrences.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 24 Martin Renvoize 2016-10-13 12:48:12 UTC
Created attachment 56386 [details] [review]
[PASSED QA] Bug 17249: GetKohaAuthorisedValuesFromField - rm GetAuthValCodeFromField

The subroutine GetAuthValCodeFromField was only used from
GetKohaAuthorisedValuesFromField.

Test plan:
  git grep GetAuthValCodeFromField
should not return any occurrences.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 25 Martin Renvoize 2016-10-13 12:50:42 UTC
Good clear refactoring, much clearer code. Thanks Jonathan
Comment 26 Kyle M Hall 2016-10-21 15:20:33 UTC
Pushed to master for 16.11, thanks Jonathan!