@@ -, +, @@ results table to report/subscription detail page + code refactoring --- C4/Reports/Guided.pm | 11 +++- C4/Serials.pm | 6 ++ Koha/SharedContent.pm | 12 +++- koha-tmpl/intranet-tmpl/prog/en/includes/mana.inc | 44 +++++++++++++++ .../en/includes/mana/mana-report-search-result.inc | 27 +-------- .../mana/mana-subscription-search-result.inc | 13 +---- .../prog/en/includes/reports-toolbar.inc | 66 ++++++++++++---------- .../prog/en/includes/serials-toolbar.inc | 35 ++++++++++++ .../en/modules/reports/guided_reports_start.tt | 20 ------- .../intranet-tmpl/prog/js/subscription-add.js | 45 --------------- reports/guided_reports.pl | 4 ++ serials/subscription-detail.pl | 1 + svc/mana/share | 2 +- 13 files changed, 147 insertions(+), 139 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/mana.inc --- a/C4/Reports/Guided.pm +++ a/C4/Reports/Guided.pm @@ -33,6 +33,7 @@ use C4::Log; use Koha::AuthorisedValues; use Koha::Patron::Categories; +use Koha::SharedContent; BEGIN { require Exporter; @@ -715,7 +716,15 @@ sub get_saved_report { } else { return; } - return $dbh->selectrow_hashref($query, undef, $report_arg); + my $report = $dbh->selectrow_hashref($query, undef, $report_arg); + + if ( my $mana_id = $report->{mana_id} ) { + my $mana_report = Koha::SharedContent::manaGetRequestWithId( + 'report', $mana_id, {usecomments => 1}); + $report->{comments} = $mana_report->{data}->{comments}; + } + + return $report; } =head2 create_compound($masterID,$subreportID) --- a/C4/Serials.pm +++ a/C4/Serials.pm @@ -300,6 +300,12 @@ sub GetSubscription { }); $subscription->{additional_fields} = $additional_field_values->{$subscriptionid}; + if ( my $mana_id = $subscription->{mana_id} ) { + my $mana_subscription = Koha::SharedContent::manaGetRequestWithId( + 'subscription', $mana_id, {usecomments => 1}); + $subscription->{comments} = $mana_subscription->{data}->{comments}; + } + return $subscription; } --- a/Koha/SharedContent.pm +++ a/Koha/SharedContent.pm @@ -78,9 +78,11 @@ sub manaIncrementRequest { =cut sub manaPostRequest { - my ($lang, $loggedinuser, $resourceid, $resourcetype) = @_; + my ($lang, $loggedinuser, $resourceid, $resourcetype, $content) = @_; - my $content = prepareSharedData($lang, $loggedinuser, $resourceid, $resourcetype); + unless ( $content ) { + $content = prepareSharedData($lang, $loggedinuser, $resourceid, $resourcetype); + } my $result = manaRequest(buildRequest('post', $resourcetype, $content)); @@ -161,8 +163,12 @@ sub buildRequest { if ( $type eq 'getwithid' ) { my $id = shift; + my $params = shift; + $params = join '&', + map { defined $params->{$_} ? $_ . "=" . $params->{$_} : () } + keys %$params; - my $url = "$MANA_IP/$resource/$id.json"; + my $url = "$MANA_IP/$resource/$id.json?$params"; return HTTP::Request->new( GET => $url ); } --- a/koha-tmpl/intranet-tmpl/prog/en/includes/mana.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/mana.inc @@ -0,0 +1,44 @@ + --- a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-report-search-result.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-report-search-result.inc @@ -24,6 +24,7 @@ $(document).ready(function() { }); //]]> +[% INCLUDE 'mana.inc' %] [% IF statuscode == "200" AND reports %]
- - | [% END %] @@ -86,21 +79,3 @@ $(document).ready(function() { [% ELSE %]