Skip to content

Commit d395f24

Browse files
committed
Use phpspreadsheet to generate PDF as well
AbstractSearchOutput::displayData is no longer static
1 parent 2489ae6 commit d395f24

13 files changed

+211
-602
lines changed

src/GLPIPDF.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class GLPIPDF extends TCPDF
6060
];
6161
private array $config = [];
6262

63-
public function __construct(array $config = [], int $count = null, string $title = null)
63+
public function __construct(array $config = [], int $count = null, string $title = null, bool $addpage = true)
6464
{
6565
$config += self::$default_config;
6666
$this->config = $config;
@@ -95,7 +95,9 @@ public function __construct(array $config = [], int $count = null, string $title
9595

9696
//set auto page breaks
9797
$this->SetAutoPageBreak(true, $config['margin_bottom']);
98-
$this->AddPage();
98+
if ($addpage === true) {
99+
$this->AddPage();
100+
}
99101
}
100102

101103
/**

src/Search.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ public static function displayData(array $data, array $params = [])
342342
{
343343
/** @var HTMLSearchOutput $output */
344344
$output = SearchEngine::getOutputForLegacyKey($data['display_type'], $data);
345-
return $output::displayData($data, $params);
345+
return $output->displayData($data, $params);
346346
}
347347

348348
/**

src/Search/Output/AbstractSearchOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public static function showPreSearchDisplay(string $itemtype): void
7474
*
7575
* @return void|false
7676
**/
77-
abstract public static function displayData(array $data, array $params = []);
77+
abstract public function displayData(array $data, array $params = []);
7878

7979
/**
8080
* Print generic normal Item Cell

src/Search/Output/ExportSearchOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public static function displayConfigItem($itemtype, $ID, $data = [])
183183
return $out;
184184
}
185185

186-
public static function displayData(array $data, array $params = [])
186+
public function displayData(array $data, array $params = [])
187187
{
188188
/** @var array $CFG_GLPI */
189189
global $CFG_GLPI;

src/Search/Output/HTMLSearchOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static function showPreSearchDisplay(string $itemtype): void
6060
}
6161
}
6262

63-
public static function displayData(array $data, array $params = [])
63+
public function displayData(array $data, array $params = [])
6464
{
6565
/** @var array $CFG_GLPI */
6666
global $CFG_GLPI;

src/Search/Output/MapSearchOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public static function prepareInputParams(string $itemtype, array $params): arra
7474
return $params;
7575
}
7676

77-
public static function displayData(array $data, array $params = []): void
77+
public function displayData(array $data, array $params = []): void
7878
{
7979
/** @var array $CFG_GLPI */
8080
global $CFG_GLPI;

src/Search/Output/PDFLandscapeSearchOutput.php

Lines changed: 0 additions & 70 deletions
This file was deleted.

src/Search/Output/PDFPortraitSearchOutput.php

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)