Skip to content

Commit

Permalink
Support 31818 (#376)
Browse files Browse the repository at this point in the history
* fix few error messages

* search option

* changelog
  • Loading branch information
Rom1-B authored Feb 29, 2024
1 parent c391303 commit 2148024
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed

- Fix error message during plugin update
- Fix few errors messages in debug mode


## [2.10.5] - 2024-02-23
Expand Down
2 changes: 1 addition & 1 deletion inc/order.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ public function rawSearchOptions()
];

$tab[] = [
'id' => 30,
'id' => 31,
'table' => self::getTable(),
'field' => 'id',
'name' => __('ID'),
Expand Down
18 changes: 15 additions & 3 deletions inc/order_item.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,10 @@ public function prepareInputForAdd($input)
unset($input['id']);
unset($input['withtemplate']);
} else {
if (empty($input["plugin_order_references_id"])) {
Session::addMessageAfterRedirect(__("You must select a reference", "order"), false, ERROR);
return [];
}
if (
$config->isAnalyticNatureDisplayed()
&& $config->isAnalyticNatureMandatory()
Expand Down Expand Up @@ -949,8 +953,12 @@ public function getItems($rand, $data_ref, $plugin_order_orders_id, $numref, $ca
echo "</td>";

/* type */
$item = new $data_ref["itemtype"]();
echo "<td align='center'>" . $item->getTypeName() . "</td>";
if (!is_null($data_ref["itemtype"]) && class_exists($data_ref["itemtype"])) {
$item = new $data_ref["itemtype"]();
echo "<td align='center'>" . $item->getTypeName() . "</td>";
} else {
echo "<td align='center'></td>";
}
/* manufacturer */
echo "<td align='center'>" . Dropdown::getDropdownName(
"glpi_manufacturers",
Expand Down Expand Up @@ -2204,13 +2212,17 @@ protected function getManufacturersReference($reference_id)
/** @var \DBmysql $DB */
global $DB;

if (empty($reference_id)) {
return '';
}

$result = $DB->request([
'SELECT' => 'manufacturers_reference',
'FROM' => 'glpi_plugin_order_references',
'WHERE' => ['id' => $reference_id]
]);

$data = $result->current();
return $data['manufacturers_reference'];
return $data['manufacturers_reference'] ?? '';
}
}

0 comments on commit 2148024

Please sign in to comment.