From bc5cc1ec126f4d0a176ccfc22b24101eaf5a3692 Mon Sep 17 00:00:00 2001 From: Alex Arnaud Date: Thu, 24 Jan 2019 17:35:40 +0100 Subject: [PATCH] Bug 22193: Share report comments Test plan: - apply this patches, - download a report from Mana, - you should see a "Report mistake" button when you show, edit and run this report, - click on Report mistake -> New and type a comment, - check that it appears on the list, - reload the page, check the comment is still in the list, - click on Report mistake -> your comment, - ckeck the count has been incremented, - reload the page, the counter is still the same Signed-off-by: Owen Leonard --- .../prog/en/includes/reports-toolbar.inc | 4 ++-- reports/guided_reports.pl | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc index d9aa003..99383e5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc @@ -59,8 +59,8 @@ [% c.message | html %] ([% c.nb | html %]) [% END %] - -
  • Other
  • + +
  • New
  • diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl index 80edc2a..4482e79 100755 --- a/reports/guided_reports.pl +++ b/reports/guided_reports.pl @@ -93,6 +93,18 @@ elsif ($session and not $input->param('clear_filters')) { my $op = $input->param('op') || q||; +if ( $phase eq 'Show SQL' || $phase eq 'Edit SQL' || $phase eq 'Run this report') { + + my $id = $input->param('reports'); + my $report = Koha::Reports->find($id); + if ( C4::Context->preference('Mana') == 1 && $report->mana_id ) { + my $comments = Koha::SharedContent::get_entity_comments( + 'report', $report->mana_id + ); + $template->param( 'mana_comments' => $comments ); + } +} + my @errors = (); if ( !$phase ) { $template->param( 'start' => 1 ); @@ -173,7 +185,7 @@ elsif ( $phase eq 'Delete Saved') { } elsif ( $phase eq 'Show SQL'){ - + my $id = $input->param('reports'); my $report = Koha::Reports->find($id); $template->param( @@ -182,10 +194,8 @@ elsif ( $phase eq 'Show SQL'){ 'notes' => $report->notes, 'sql' => $report->savedsql, 'showsql' => 1, - 'mana_success' => $input->param('mana_success'), 'mana_success' => scalar $input->param('mana_success'), - 'mana_id' => $report->{mana_id}, - 'mana_comments' => $report->{comments} + 'mana_id' => $report->mana_id, ); } @@ -204,8 +214,7 @@ elsif ( $phase eq 'Edit SQL'){ 'public' => $report->public, 'usecache' => $usecache, 'editsql' => 1, - 'mana_id' => $report->{mana_id}, - 'mana_comments' => $report->{comments} + 'mana_id' => $report->mana_id, ); } @@ -710,6 +719,7 @@ elsif ($phase eq 'Run this report'){ $sql = $original_sql = $report->savedsql; $name = $report->report_name; $notes = $report->notes; + $template->param( mana_id => $report->mana_id ); my @rows = (); my @allrows = (); -- 2.1.4