Skip to content

Commit 20cb1ed

Browse files
authored
Merge pull request #11 from RomainLvr/fix/replace-next-by-current
Replace next() by current() to access first row
2 parents e4d1022 + efb76e2 commit 20cb1ed

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

inc/appliance.class.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,12 @@ public static function showList_PDF($pdf, $ID, $appliancesID)
395395

396396
$opts = [];
397397
for ($i = 1 ; $i <= $number_champs ; $i++) {
398-
if ($data_opt = $result_app_opt->next()) {
398+
if ($data_opt = $result_app_opt->current()) {
399399
$query_val = $DB->request(['SELECT' => 'vvalue',
400400
'FROM' => 'glpi_plugin_appliances_optvalues_items',
401401
'WHERE' => ['plugin_appliances_optvalues_id' => $data_opt['id'],
402402
'items_id' => $ID]]);
403-
$data_val = $query_val->next();
403+
$data_val = $query_val->current();
404404
$vvalue = ($data_val ? $data_val['vvalue'] : '');
405405
if (empty($vvalue) && !empty($data_opt['ddefault'])) {
406406
$vvalue = $data_opt['ddefault'];
@@ -463,7 +463,7 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonGLPI $item)
463463
$pdf->displayTitle('<b><i>' . __('Name'), __('Group'), __('Type') . '</i></b>');
464464
}
465465

466-
while ($data = $result->next()) {
466+
while ($data = $result->current()) {
467467
$appliancesID = $data['id'];
468468
if (Session::isMultiEntitiesMode()) {
469469
$pdf->setColumnsSize(30, 30, 20, 20);
@@ -498,6 +498,7 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonGLPI $item)
498498
}
499499
PluginAppliancesRelation::showList_PDF($pdf, $data['relationtype'], $data['entID']);
500500
PluginAppliancesOptvalue_Item::showList_PDF($pdf, $ID, $appliancesID);
501+
$result->next();
501502
}
502503
}
503504
$pdf->displaySpace();

0 commit comments

Comments
 (0)