Skip to content

Commit

Permalink
Merge pull request #11 from RomainLvr/fix/replace-next-by-current
Browse files Browse the repository at this point in the history
Replace next() by current() to access first row
  • Loading branch information
Rom1-B authored Jan 15, 2025
2 parents e4d1022 + efb76e2 commit 20cb1ed
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions inc/appliance.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,12 @@ public static function showList_PDF($pdf, $ID, $appliancesID)

$opts = [];
for ($i = 1 ; $i <= $number_champs ; $i++) {
if ($data_opt = $result_app_opt->next()) {
if ($data_opt = $result_app_opt->current()) {
$query_val = $DB->request(['SELECT' => 'vvalue',
'FROM' => 'glpi_plugin_appliances_optvalues_items',
'WHERE' => ['plugin_appliances_optvalues_id' => $data_opt['id'],
'items_id' => $ID]]);
$data_val = $query_val->next();
$data_val = $query_val->current();
$vvalue = ($data_val ? $data_val['vvalue'] : '');
if (empty($vvalue) && !empty($data_opt['ddefault'])) {
$vvalue = $data_opt['ddefault'];
Expand Down Expand Up @@ -463,7 +463,7 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonGLPI $item)
$pdf->displayTitle('<b><i>' . __('Name'), __('Group'), __('Type') . '</i></b>');
}

while ($data = $result->next()) {
while ($data = $result->current()) {
$appliancesID = $data['id'];
if (Session::isMultiEntitiesMode()) {
$pdf->setColumnsSize(30, 30, 20, 20);
Expand Down Expand Up @@ -498,6 +498,7 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonGLPI $item)
}
PluginAppliancesRelation::showList_PDF($pdf, $data['relationtype'], $data['entID']);
PluginAppliancesOptvalue_Item::showList_PDF($pdf, $ID, $appliancesID);
$result->next();
}
}
$pdf->displaySpace();
Expand Down

0 comments on commit 20cb1ed

Please sign in to comment.