Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
name: "Generate CI matrix"
uses: "glpi-project/plugin-ci-workflows/.github/workflows/generate-ci-matrix.yml@v1"
with:
glpi-version: "11.0.x"
glpi-version: "12.0.x"
ci:
name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}"
needs: "generate-ci-matrix"
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

- Broken display in PDF since TCPDF 7
- Dependencies conflicts with core
- Internal server error when generating appliance asset pdf
- CI: fix Psalm cache directory, declare a unique composer autoloader suffix

## [4.1.5] - 2026-09-01

### Added

- GLPI 12 compatibility

### Fixed

- Fix PDF Generation involving a Network port with multiple IPs
Expand Down
2 changes: 1 addition & 1 deletion inc/appliance.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginPdfAppliance extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

/**
* @param $obj (defult NULL)
Expand Down
7 changes: 2 additions & 5 deletions inc/cartridge.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginPdfCartridge extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

/**
* @param $obj (defult NULL)
Expand Down Expand Up @@ -366,10 +366,7 @@ public static function pdfForCartridgeItem(PluginPdfSimplePDF $pdf, CartridgeIte
- mktime(0, 0, 0, (int) $tmp_dbeg[1], (int) $tmp_dbeg[2], (int) $tmp_dbeg[0]);
$use_time += $use_time_tmp;

// Get initial counter page
if (!isset($pages[$printer])) {
$pages[$printer] = $data['init_pages_counter'];
}
$pages[$printer] ??= $data['init_pages_counter'];
if ($pages[$printer] < $data['pages']) {
$pages_printed += $data['pages'] - $pages[$printer];
$nb_pages_printed++;
Expand Down
2 changes: 1 addition & 1 deletion inc/cartridgeitem.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginPdfCartridgeItem extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

public function __construct(?CommonGLPI $obj = null)
{
Expand Down
2 changes: 1 addition & 1 deletion inc/change.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginPdfChange extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

public function __construct(?CommonGLPI $obj = null)
{
Expand Down
27 changes: 14 additions & 13 deletions inc/change_item.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginPdfChange_Item extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

public function __construct(?CommonGLPI $obj = null)
{
Expand Down Expand Up @@ -161,34 +161,35 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr

$dbu = new DbUtils();

$restrict = '';
$restrict = [];
$order = '';

switch ($item->getType()) {
case 'User':
$restrict = "(`glpi_changes_users`.`users_id` = '" . $item->getID() . "')";
$restrict = ['glpi_changes_users.users_id' => $item->getID()];
$order = '`glpi_changes`.`date_mod` DESC';
break;

case 'Supplier':
$restrict = "(`glpi_changes_suppliers`.`suppliers_id` = '" . $item->getID() . "')";
$restrict = ['glpi_changes_suppliers.suppliers_id' => $item->getID()];
$order = '`glpi_changes`.`date_mod` DESC';
break;

case 'Group':
if ($tree) {
$restrict = 'IN (' . implode(',', $dbu->getSonsOf('glpi_groups', $item->getID())) . ')';
$restrict = ['glpi_changes_groups.groups_id' => $dbu->getSonsOf('glpi_groups', $item->getID())];
} else {
$restrict = "='" . $item->getID() . "'";
$restrict = ['glpi_changes_groups.groups_id' => $item->getID()];
}
$restrict = "(`glpi_changes_groups`.`groups_id` $restrict
AND `glpi_changes_groups`.`type` = " . CommonITILActor::REQUESTER . ')';
$restrict['glpi_changes_groups.type'] = CommonITILActor::REQUESTER;
$order = '`glpi_changes`.`date_mod` DESC';
break;

default:
$restrict = "(`items_id` = '" . $item->getID() . "'
AND `itemtype` = '" . $item->getType() . "')";
$restrict = [
'glpi_changes_items.items_id' => $item->getID(),
'glpi_changes_items.itemtype' => $item->getType(),
];
$order = '`glpi_changes`.`date_mod` DESC';
break;
}
Expand Down Expand Up @@ -225,7 +226,7 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr
'DISTINCT' => true,
'FROM' => 'glpi_changes',
'LEFT JOIN' => $LEFT_JOIN,
'WHERE' => [$restrict] + $dbu->getEntitiesRestrictCriteria('glpi_changes'),
'WHERE' => $restrict + $dbu->getEntitiesRestrictCriteria('glpi_changes'),
'ORDER' => $order,
'LIMIT' => (int) $_SESSION['glpilist_limit'],
];
Expand Down Expand Up @@ -384,7 +385,7 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr
$first = false;
}
}
if ($col) {
if ($col !== '' && $col !== '0') {
$texte = '<b><i>' . sprintf(__s('%1$s: %2$s'), __s('Requester') . '</i></b>', '');
$pdf->displayText($texte, $col, 1);
}
Expand Down Expand Up @@ -425,7 +426,7 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tr
$first = false;
}
}
if ($col) {
if ($col !== '' && $col !== '0') {
$texte = '<b><i>' . sprintf(__s('%1$s: %2$s') . '</i></b>', __s('Assigned to'), '');
$pdf->displayText($texte, $col, 1);
}
Expand Down
10 changes: 5 additions & 5 deletions inc/change_problem.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginPdfChange_Problem extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

public function __construct(?CommonGLPI $obj = null)
{
Expand Down Expand Up @@ -225,7 +225,7 @@ public static function pdfForChange(PluginPdfSimplePDF $pdf, Change $change)
$first = false;
}
}
if ($col) {
if ($col !== '' && $col !== '0') {
$texte = '<b><i>' . sprintf(__s('%1$s: %2$s'), __s('Requester') . '</i></b>', '');
$pdf->displayText($texte, $col, 1);
}
Expand Down Expand Up @@ -266,7 +266,7 @@ public static function pdfForChange(PluginPdfSimplePDF $pdf, Change $change)
$first = false;
}
}
if ($col) {
if ($col !== '' && $col !== '0') {
$texte = '<b><i>' . sprintf(__s('%1$s: %2$s') . '</i></b>', ('Assigned to'), '');
$pdf->displayText($texte, $col, 1);
}
Expand Down Expand Up @@ -452,7 +452,7 @@ public static function pdfForProblem(PluginPdfSimplePDF $pdf, Problem $problem)
$first = false;
}
}
if ($col) {
if ($col !== '' && $col !== '0') {
$texte = '<b><i>' . sprintf(__s('%1$s: %2$s'), __s('Requester') . '</i></b>', '');
$pdf->displayText($texte, $col, 1);
}
Expand Down Expand Up @@ -493,7 +493,7 @@ public static function pdfForProblem(PluginPdfSimplePDF $pdf, Problem $problem)
$first = false;
}
}
if ($col) {
if ($col !== '' && $col !== '0') {
$texte = '<b><i>' . sprintf(__s('%1$s: %2$s') . '</i></b>', __s('Assigned to'), '');
$pdf->displayText($texte, $col, 1);
}
Expand Down
10 changes: 5 additions & 5 deletions inc/change_ticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginPdfChange_Ticket extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

public function __construct(?CommonGLPI $obj = null)
{
Expand Down Expand Up @@ -226,7 +226,7 @@ public static function pdfForChange(PluginPdfSimplePDF $pdf, Change $change)
$first = false;
}
}
if ($col) {
if ($col !== '' && $col !== '0') {
$texte = '<b><i>' . sprintf(__s('%1$s: %2$s'), __s('Requester') . '</i></b>', '');
$pdf->displayText($texte, $col, 1);
}
Expand Down Expand Up @@ -267,7 +267,7 @@ public static function pdfForChange(PluginPdfSimplePDF $pdf, Change $change)
$first = false;
}
}
if ($col) {
if ($col !== '' && $col !== '0') {
$texte = '<b><i>' . sprintf(__s('%1$s: %2$s') . '</i></b>', __s('Assigned to'), '');
$pdf->displayText($texte, $col, 1);
}
Expand Down Expand Up @@ -483,7 +483,7 @@ public static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $ticket)
$first = false;
}
}
if ($col) {
if ($col !== '' && $col !== '0') {
$texte = '<b><i>' . sprintf(__s('%1$s: %2$s'), __s('Requester') . '</i></b>', '');
$pdf->displayText($texte, $col, 1);
}
Expand Down Expand Up @@ -524,7 +524,7 @@ public static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $ticket)
$first = false;
}
}
if ($col) {
if ($col !== '' && $col !== '0') {
$texte = '<b><i>' . sprintf(__s('%1$s: %2$s') . '</i></b>', __s('Assigned to'), '');
$pdf->displayText($texte, $col, 1);
}
Expand Down
2 changes: 1 addition & 1 deletion inc/changetask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginPdfChangeTask extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

public function __construct(?CommonGLPI $obj = null)
{
Expand Down
2 changes: 1 addition & 1 deletion inc/changevalidation.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginPdfChangeValidation extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

public function __construct(?CommonGLPI $obj = null)
{
Expand Down
2 changes: 1 addition & 1 deletion inc/common.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ abstract class PluginPdfCommon extends CommonGLPI
protected $obj = null;
protected $pdf = null;

public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

/**
* Constructor, should intialize $this->obj property
Expand Down
2 changes: 1 addition & 1 deletion inc/commonitilcost.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginPdfCommonItilCost extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

public function __construct(?CommonGLPI $obj = null)
{
Expand Down
2 changes: 1 addition & 1 deletion inc/computer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

class PluginPdfComputer extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

public function __construct(?CommonGLPI $obj = null)
{
Expand Down
2 changes: 1 addition & 1 deletion inc/computer_item.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

class PluginPdfComputer_Item extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

public function __construct(?CommonGLPI $obj = null)
{
Expand Down
2 changes: 1 addition & 1 deletion inc/computer_softwarelicense.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
*/
class PluginPdfComputer_SoftwareLicense extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

public function __construct(?CommonGLPI $obj = null)
{
Expand Down
2 changes: 1 addition & 1 deletion inc/computer_softwareversion.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
*/
class PluginPdfComputer_SoftwareVersion extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

public function __construct(?CommonGLPI $obj = null)
{
Expand Down
2 changes: 1 addition & 1 deletion inc/config.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
class PluginPdfConfig extends CommonDBTM
{
private static $_instance = null;
public static $rightname = 'config';
public static string $rightname = 'config';

public static function canCreate(): bool
{
Expand Down
4 changes: 2 additions & 2 deletions inc/consumableitem.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginPdfConsumableItem extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

public function __construct(?CommonGLPI $obj = null)
{
Expand Down Expand Up @@ -165,7 +165,7 @@ public static function pdfForConsumableItem(PluginPdfSimplePDF $pdf, ConsumableI
'ORDER' => $order],
);

if (!$number) {
if ($number === 0) {
$pdf->setColumnsSize(100);
$pdf->displayTitle(__s('No consumable'));
} else {
Expand Down
2 changes: 1 addition & 1 deletion inc/contract.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginPdfContract extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

public function __construct(?CommonGLPI $obj = null)
{
Expand Down
2 changes: 1 addition & 1 deletion inc/contract_item.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginPdfContract_Item extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

public function __construct(?CommonGLPI $obj = null)
{
Expand Down
4 changes: 2 additions & 2 deletions inc/document.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginPdfDocument extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

public function __construct(?CommonGLPI $obj = null)
{
Expand Down Expand Up @@ -77,7 +77,7 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item)
}
$pdf->displayTitle($title);

$pdf->setColumnsSize(20, 15, 10, 10, 10, 8, 20, 7);
$pdf->setColumnsSize(18, 14, 9, 9, 9, 13, 17, 11);
$pdf->displayTitle(
__s('Name'),
__s('Entity'),
Expand Down
2 changes: 1 addition & 1 deletion inc/domain_item.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginPdfDomain_Item extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

public function __construct(?CommonGLPI $obj = null)
{
Expand Down
2 changes: 1 addition & 1 deletion inc/group.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginPdfGroup extends PluginPdfCommon
{
public static $rightname = 'plugin_pdf';
public static string $rightname = 'plugin_pdf';

public function __construct(?CommonGLPI $obj = null)
{
Expand Down
Loading
Loading