Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions application/controllers/ReportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use Exception;
use Icinga\Application\Hook;
use Icinga\Application\Modules\Module;
use Icinga\Module\Pdfexport\ProvidedHook\Pdfexport;
use Icinga\Module\Reporting\Database;
use Icinga\Module\Reporting\Model;
Expand Down Expand Up @@ -279,13 +280,17 @@ protected function assembleActions(): ActionBar
{
$reportId = $this->report->getId();

$download = (new CompatDropdown('Download'))
->addLink(
$download = new CompatDropdown('Download');

// TODO: Check against Hook::has once we have removed the dependency on the pdfexport module
if (Module::exists('pdfexport')) {
$download->addLink(
'PDF',
Url::fromPath('reporting/report/download?type=pdf', ['id' => $reportId]),
null,
['target' => '_blank']
);
}

if ($this->report->providesData()) {
$download->addLink(
Expand Down Expand Up @@ -332,15 +337,17 @@ protected function assembleActions(): ActionBar
);
}

$actions
->add($download)
->addHtml(
(new ActionLink(
$this->translate('Send'),
Url::fromPath('reporting/report/send', ['id' => $reportId]),
'forward'
))->openInModal()
);
if ($download->hasLinks()) {
Comment thread
Al2Klimov marked this conversation as resolved.
$actions
->add($download)
->addHtml(
(new ActionLink(
$this->translate('Send'),
Url::fromPath('reporting/report/send', ['id' => $reportId]),
'forward'
))->openInModal()
);
}

return $actions;
}
Expand Down
8 changes: 7 additions & 1 deletion library/Reporting/Actions/SendMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use Icinga\Application\Config;
use Icinga\Application\Logger;
use Icinga\Application\Modules\Module;
use Icinga\Module\Pdfexport\ProvidedHook\Pdfexport;
use Icinga\Module\Reporting\Hook\ActionHook;
use Icinga\Module\Reporting\Mail;
Expand Down Expand Up @@ -79,7 +80,12 @@ function ($pdf) use ($mail, $name, $recipients) {

public function initConfigForm(Form $form, Report $report)
{
$types = ['pdf' => 'PDF'];
$types = [];

// TODO: Check against Hook::has once we have removed the dependency on the pdfexport module
if (Module::exists('pdfexport')) {
$types['pdf'] = 'PDF';
}

if ($report->providesData()) {
$types['csv'] = 'CSV';
Expand Down
2 changes: 1 addition & 1 deletion module.info
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Module: Reporting
Version: 1.1.0
Requires:
Libraries: icinga-php-library (>=1.0.0), icinga-php-thirdparty (>=1.0.0)
Libraries: icinga-php-library (>=1.1.0), icinga-php-thirdparty (>=1.0.0)
Modules: pdfexport (>=0.13.0)
Comment thread
Al2Klimov marked this conversation as resolved.
Description: Reporting
Loading