Bug 15800

Summary: Koha::AuthorisedValues - Remove C4::Koha::IsAuthorisedValueCategory
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: brendan, hector.hecaxmmx, kyle
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 15769, 15783    
Bug Blocks: 15799    
Attachments: Bug 15800: Koha::AuthorisedValues - Remove C4::Koha::IsAuthorisedValueCategory
[SIGNED-OFF]Bug 15800: Koha::AuthorisedValues - Remove C4::Koha::IsAuthorisedValueCategory
Bug 15800: Koha::AuthorisedValues - Remove C4::Koha::IsAuthorisedValueCategory
Bug 15800: Koha::AuthorisedValues - Remove C4::Koha::IsAuthorisedValueCategory

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!