Bug 7993 - saved report with hierarchies
Summary: saved report with hierarchies
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: 3.10
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Srdjan Jankovic
QA Contact: Mason James
Depends on:
Blocks: 8811
  Show dependency treegraph
Reported: 2012-04-23 09:28 UTC by delaye
Modified: 2013-12-05 20:01 UTC (History)
8 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:

bug_7993: Save reports with Group/Subgroup hierarchy (80.55 KB, patch)
2012-06-21 00:23 UTC, Srdjan Jankovic
Details | Diff | Splinter Review
Bug 7993: Save reports with Group/Subgroup hierarchy (80.61 KB, patch)
2012-07-02 18:16 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 7993: Save reports with Group/Subgroup hierarchy (82.11 KB, patch)
2012-08-17 09:55 UTC, Julian Maurice
Details | Diff | Splinter Review
bug_7993: Save reports with Group/Subgroup hierarchy (84.16 KB, patch)
2012-08-20 05:38 UTC, Srdjan Jankovic
Details | Diff | Splinter Review
Bug 7993 Follow-up (10.46 KB, patch)
2012-08-20 07:26 UTC, Julian Maurice
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 7993 Follow-up (10.53 KB, patch)
2012-08-23 11:40 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 7993: Several bug fixes (2.82 KB, patch)
2012-08-23 11:41 UTC, Julian Maurice
Details | Diff | Splinter Review
Signed off patch (2.87 KB, patch)
2012-08-23 21:33 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 7993: Save reports with Group/Subgroup hierarchy (84.52 KB, patch)
2012-09-10 01:21 UTC, Srdjan Jankovic
Details | Diff | Splinter Review
Bug 7993: Save reports with Group/Subgroup hierarchy (84.58 KB, patch)
2012-09-11 08:10 UTC, Paul Poulain
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description delaye 2012-04-23 09:28:11 UTC
1/For the customer:
  -  They wants to create themselves their topics (no freezed topics)
  -  He could move report from a hierarchy to another (modify)
  -  They need 2 level of hierarchy

Suggests to use 2 authorised value lists: "GROUP" "SUBGROUP"
When you register or modify a report, you first choose a "group" (code) and then a "subbgroup" (lib_opac wich represent the link between both).

Liste N1 : GROUP

Code lib lib_opac
CIRC Circulation PRT
CIRC Circulation RET
CAT Catalogage BIB
CAT Catalogage EX
CAT Catalogage AUT

Liste N2 : SUB_GROUP

Code lib lib_OPAC

2 / From "Summary and Statistics" when saving the report, a proposal from the list of tabs (hierarchy) to classify the report as a topic of their choice.

3 / From .../cgi-bin/koha/reports/guided_reports.pl?phase=
First show the top of hierarchies as tabs and then clicking on the opening of the hierarchy.
Reports will be provided in a table with headers that are sortable.

4 / After you save the report ( .../cgi-bin/koha/reports/guided_reports.pl ) add a link from this page 'Start the new report'.

5 / Keep the link "Reports saved" under
But adding to the table "standard" one column "Posted in" going back the way the report is filed.
Columns should also be sortable.
Comment 1 Srdjan Jankovic 2012-06-21 00:23:54 UTC Comment hidden (obsolete)
Comment 2 Jared Camins-Esakov 2012-07-02 18:16:59 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2012-07-30 08:51:06 UTC
This patch does not apply :
CONFLICT (content): Merge conflict in svc/report
CONFLICT (content): Merge conflict in opac/svc/report
CONFLICT (content): Merge conflict in installer/data/mysql/updatedatabase.pl
CONFLICT (content): Merge conflict in C4/Reports/Guided.pm
Comment 4 Julian Maurice 2012-08-17 09:55:36 UTC Comment hidden (obsolete)
Comment 5 Julian Maurice 2012-08-17 09:56:13 UTC
Patch rebased on current master and tested OK.
Comment 6 Jonathan Druart 2012-08-17 11:53:52 UTC
QA comments:
The qa tools says me the patch introduces wrong lines in a tt file:
- xt/tt_valid.t tests... FAIL
	intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt: 520, 610, 727, 828 FAIL

See Bug 8407 for more information.

Please correct this and remove some useless commented lines (in opac/svc/report : else{warn})

Marked as Failed QA
Comment 7 Srdjan Jankovic 2012-08-20 05:38:23 UTC Comment hidden (obsolete)
Comment 8 Srdjan Jankovic 2012-08-20 05:41:22 UTC
I apologise but I did not know how to make a follow-up because I had conflicts when rebasing.
Can you please either
a) obsolete the signed-off patch and sign off the new one, or
b) tell me how to produce a follow-up
Comment 9 Julian Maurice 2012-08-20 07:26:59 UTC Comment hidden (obsolete)
Comment 10 Julian Maurice 2012-08-20 07:41:46 UTC
Hello Srdjan,

I made this follow-up by applying your patch over the initial one and resolving the conflicts. Please tell me if it contains all your changes (and nothing else).

What did you do to have conflicts with signed-off patch? It's up-to-date according to master. Maybe you tried to apply the patch on a local branch not recently updated.
To make a follow-up, just write another commit (if you are rebasing, fix your conflicts, git rebase --continue until you have finished, and then make another commit). Does it answer your question?
Comment 11 Srdjan Jankovic 2012-08-20 23:08:50 UTC
Thanks for that Julian, it looks good.

What I did was rebased my local branch that I used for the patch to the master and got conflicts. At that point I was not sure which would be the starting point for my follow-up. So what I did was pretty much what you described, just need to know where to anchor my follow-up patch.
Comment 12 Julian Maurice 2012-08-23 11:40:29 UTC Comment hidden (obsolete)
Comment 13 Julian Maurice 2012-08-23 11:41:11 UTC
This patch is ok, but I found a problem with the first patch. I will submit another follow-up.
Comment 14 Julian Maurice 2012-08-23 11:41:58 UTC Comment hidden (obsolete)
Comment 15 Chris Cormack 2012-08-23 21:33:50 UTC Comment hidden (obsolete)
Comment 16 Jonathan Druart 2012-09-07 12:22:58 UTC
Patch does not apply
CONFLICT (content): Merge conflict in reports/guided_reports.pl
CONFLICT (content): Merge conflict in installer/data/mysql/updatedatabase.pl
Comment 17 Srdjan Jankovic 2012-09-10 01:21:20 UTC Comment hidden (obsolete)
Comment 18 Paul Poulain 2012-09-11 08:10:13 UTC
Patch tested with a sandbox, by Delaye Stephane <stephane.delaye@biblibre.com>
Comment 19 Paul Poulain 2012-09-11 08:10:35 UTC
Created attachment 12126 [details] [review]
Bug 7993: Save reports with Group/Subgroup hierarchy

This should make saved reports more manageable.
Group/Subgroup hierarchy is stored in authorised_values,
categories REPORT_GROUP and REPORT_SUBGROUP, connected by
REPORT_SUBGROUP.lib_opac -> REPORT_GROUP.authorised_value

Database changes:
* authorised_values: expanded category to 16 chars
* created default set of REPORT_GROUP authorised values to match
  hardcoded report areas
* reports_dictionary: replaced area int with report_area text, converted
* saved_sql: added report_area, report_group and report_subgroup;
  report_area is not currently used, saved for the record

* Replaced Area numeric values with the mnemonic codes
* get_report_areas(): returns hardcoded areas list
* created get_report_areas(): returns full hierarchy (groups with belonging
* save_report(): changed iterface, accepts fields hashref as input
* update_sql(): changed iterface, accepts id and fields hashref as input
* get_saved_reports():]
- join to authorised_values to pick group and subgroup name
- accept group and subgroup filter params
* get_saved_report():
- changed iterface, return record hashref
- join to authorised_values to pick group and subgroup name
* build_authorised_value_list(): new sub, moved code from
* Updated interfaces in:
cronjobs/runreport.pl, svc/report, opac/svc/report: get_saved_report()
reports/dictionary.pl: get_report_areas()

* Reports list:
- added group/subgroup filter
- display area/group/subgroup for the reports
* Create report wizard:
- carry area to the end
- select group and subgroup when saving the report; group defaults to area,
  useful when report groups match areas
* Update report and Create from SQL: added group/subgroup
* Amended reports/guided_reports.pl accordingly



Signed-off-by: Delaye Stephane <stephane.delaye@biblibre.com>
Comment 20 Mason James 2012-09-16 14:31:06 UTC
(In reply to comment #19)
> Created attachment 12126 [details] [review]
> Bug 7993: Save reports with Group/Subgroup hierarchy
> > Signed-off-by: Delaye Stephane <stephane.delaye@biblibre.com>

patch looks good, passing QA…
$ koha-qa.pl  

testing 1 commit(s) (applied to commit 3f31617)
 * 4d90348 Bug 7993: Save reports with Group/Subgroup hierarchy

* C4/Reports/Guided.pm                                                     OK
* admin/authorised_values.pl                                               OK
* installer/data/mysql/updatedatabase.pl                                   OK
* misc/cronjobs/runreport.pl                                               OK
* reports/dictionary.pl                                                    OK
* reports/guided_reports.pl                                                OK
* koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tt            OK
* koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt  OK
Comment 21 Paul Poulain 2012-09-18 16:21:24 UTC
Patch pushed to master

However, a few questions/glitches:
 * the "type" and "Area" columns can't be filled when you edit an SQL directly, and can't be updated anyway. Shouldn't we do something for that ?
 * Shouldn't group/sub-group be the first columns ?
 * do we need the ID displayed ?
 * on my laptop, the "Notes" tab is really small, and would not deserve be larger (we could put subgroup in the same column as group, because it will not be used everyday
 * why are author column and date not sortable ?
Comment 22 Paul Poulain 2012-09-19 10:13:27 UTC
Jenkins complain because of an incorrect pod doc. I've pushed a follow-up to fix it.
Comment 23 Julian Maurice 2012-11-22 10:50:07 UTC
Ok in master