Bug 15800 - Koha::AuthorisedValues - Remove C4::Koha::IsAuthorisedValueCategory
Summary: Koha::AuthorisedValues - Remove C4::Koha::IsAuthorisedValueCategory
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)
Target Milestone: ---
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on: 15769 15783
Blocks: 15799
  Show dependency treegraph
 
Reported: 2016-02-11 14:13 UTC by Jonathan Druart
Modified: 2017-06-14 22:10 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 15800: Koha::AuthorisedValues - Remove C4::Koha::IsAuthorisedValueCategory (6.80 KB, patch)
2016-02-11 14:24 UTC, Jonathan Druart
Details | Diff | Splinter Review
[SIGNED-OFF]Bug 15800: Koha::AuthorisedValues - Remove C4::Koha::IsAuthorisedValueCategory (6.91 KB, patch)
2016-02-11 15:39 UTC, Héctor Eduardo Castro Avalos
Details | Diff | Splinter Review
Bug 15800: Koha::AuthorisedValues - Remove C4::Koha::IsAuthorisedValueCategory (6.94 KB, patch)
2016-02-12 19:33 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 15800: Koha::AuthorisedValues - Remove C4::Koha::IsAuthorisedValueCategory (7.39 KB, patch)
2016-02-29 11:19 UTC, Jonathan Druart
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-02-11 14:13:01 UTC
C4::Koha::IsAuthorisedValueCategory contains only 2 useful calls, from C4::Reports::Guided and reports/guided_reports.pl
It can be replaced with
  Koha::AuthorisedValues->search({ category => $authorised_value })->count
Comment 1 Jonathan Druart 2016-02-11 14:24:41 UTC Comment hidden (obsolete)
Comment 2 Héctor Eduardo Castro Avalos 2016-02-11 15:39:12 UTC Comment hidden (obsolete)
Comment 3 Kyle M Hall 2016-02-12 19:33:54 UTC Comment hidden (obsolete)
Comment 4 Brendan Gallagher 2016-02-24 03:42:43 UTC
Didn't Apply for me - Didn't take a look at why at this point.  (I'll leave an @later for khall)
Comment 5 Kyle M Hall 2016-02-26 14:41:45 UTC
Patch no longer applies, please rebase and reset to "Passed QA". Thanks!
Comment 6 Jonathan Druart 2016-02-29 11:19:35 UTC
Created attachment 48443 [details] [review]
Bug 15800: Koha::AuthorisedValues - Remove C4::Koha::IsAuthorisedValueCategory

C4::Koha::IsAuthorisedValueCategory contains only 2 useful calls, from
C4::Reports::Guided and reports/guided_reports.pl
It can be replaced with
  Koha::AuthorisedValues->search({ category => $authorised_value})->count

Test plan:
1/ Create a sql report using an authorised value category, something
like:
  SELECT COUNT(*) FROM items where itemlost=<<lost|LOST>>
2/ Execute the report and confirm that everything works fine.
3/ Create a sql report using a nonexistent authorised value categor,
something like:
  SELECT COUNT(*) FROM items where itemlost=<<lost|NONEXIST>>
4/ When saving the report, you should get a warning message
  "lost: The authorized value category (NONEXIST) you selected does not exist."
5/ Save anyway and execute the report, you should get the same warning
message.

QA:
  git grep IsAuthorisedValueCategory
should not return any results
  prove t/db_dependent/ReportsGuided.t
should return green

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as described

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 7 Brendan Gallagher 2016-03-02 04:01:12 UTC
Pushed to Master - Should be in the May 2016 Release.  Thanks!