Bug 29351

Summary: Add missing cn_source parameter to reports parameter menu
Product: Koha Reporter: Owen Leonard <oleonard>
Component: ReportsAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: andrew, flyingendpaper, jrobb, koha-bugs, kyle, testopia
Version: MainKeywords: Manual
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This patch adds a link for the previously-hidden option of using a runtime parameter for selecting "Source of classification or shelving scheme." Now when composing an SQL report you can click the "Insert runtime parameter" button to see a menu that includes this option.
Version(s) released in:
21.11.00
Circulation function:
Bug Depends on: 17600, 27644, 29352    
Bug Blocks:    
Attachments: Bug 29351: Add missing cn_source parameter to reports parameter menu
Bug 29351: Add missing cn_source parameter to reports parameter menu
Bug 29351: Add missing cn_source parameter to reports parameter menu

Description Owen Leonard 2021-10-28 13:40:07 UTC
There has always been a cn_source ("Source of classification or shelving scheme") runtime parameter available to SQL reports, although it isn't mentioned in the wiki.
Comment 1 Andrew Fuerste-Henry 2021-10-28 14:38:18 UTC
I didn't know this was an option! Good catch!
Comment 2 Owen Leonard 2021-10-28 15:17:51 UTC
Created attachment 127063 [details] [review]
Bug 29351: Add missing cn_source parameter to reports parameter menu

This patch adds an option to insert "Source of classification or
shelving scheme" as a runtime parameter in SQL reports. The ability to
use cn_source as a parameter seems to have always been part of this
feature but wasn't documented.

To test, apply the patch and go to Reports -> Create from SQL.

 - Click the "Insert runtime parameter" button and select
   "Classification source."
 - Customize the parameter label if you wish and click "Insert
   parameter."
 - The parameter should be inserted like this:

   <<Source of classification or shelving scheme|cn_source>>

 - Use it to create a valid SQL report, for example:

   SELECT * FROM items WHERE cn_source = <<Source of classification or
   shelving scheme|cn_source>> LIMIT 10

 - Confirm that upon running the report you are prompted to select a
   classification source.
 - Confirm that the report runs correctly.
Comment 3 Andrew Fuerste-Henry 2021-10-28 17:07:30 UTC
I'm getting this error when trying to run my report: 
Undefined subroutine &CGI::Compile::ROOT::kohadevbox_koha_reports_guided_reports_2epl::GetClassSources called at /kohadevbox/koha/reports/guided_reports.pl line 761
Comment 4 Owen Leonard 2021-10-28 17:35:23 UTC
Sorry, I should have put this in the test plan: There is a followup on Bug 17600 which is required for GetClassSources to work: See comment 148 on that bug.
Comment 5 Andrew Fuerste-Henry 2021-10-28 17:45:19 UTC
Created attachment 127069 [details] [review]
Bug 29351: Add missing cn_source parameter to reports parameter menu

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 6 Andrew Fuerste-Henry 2021-10-28 17:46:07 UTC
Thanks! I Was able to test successfully after I applied your patch from 17600.
Comment 7 Katrin Fischer 2021-10-31 00:20:57 UTC
Created attachment 127116 [details] [review]
Bug 29351: Add missing cn_source parameter to reports parameter menu

This patch adds an option to insert "Source of classification or
shelving scheme" as a runtime parameter in SQL reports. The ability to
use cn_source as a parameter seems to have always been part of this
feature but wasn't documented.

To test, apply the patch and go to Reports -> Create from SQL.

 - Click the "Insert runtime parameter" button and select
   "Classification source."
 - Customize the parameter label if you wish and click "Insert
   parameter."
 - The parameter should be inserted like this:

   <<Source of classification or shelving scheme|cn_source>>

 - Use it to create a valid SQL report, for example:

   SELECT * FROM items WHERE cn_source = <<Source of classification or
   shelving scheme|cn_source>> LIMIT 10

 - Confirm that upon running the report you are prompted to select a
   classification source.
 - Confirm that the report runs correctly.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Jonathan Druart 2021-11-02 15:54:35 UTC
Pushed to master for 21.11, thanks to everybody involved!