Skip to content
Draft
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Added

<<<<<<< HEAD
- Add Transifex translations link to README
=======
- Faster order form, reception, bills and budget tabs on large volumes (missing indexes, budget check and prices read in one query)
- An order can no longer be locked by picking, from its form, a status that only the validation workflow should set
- Default order status labels are no longer stored HTML-escaped
>>>>>>> 6c8a4b1 (Fix: prevent order lockout from the status dropdown (#633))

## [2.13.0] - 2026-10-06

Expand Down
12 changes: 10 additions & 2 deletions inc/order.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -988,9 +988,17 @@ public function showForm($ID, $options = [])
echo "<td>";
$state = $this->getID() ? $this->fields["plugin_order_orderstates_id"] : $config->getDraftState();
if ($canedit) {
// Other states lock the order and must only be reached through the validation workflow
$editable_states = [$config->getDraftState()];
if ($config->useValidation()) {
$editable_states[] = $config->getWaitingForApprovalState();
}

PluginOrderOrderState::Dropdown([
'name' => "plugin_order_orderstates_id",
'value' => $state,
'name' => "plugin_order_orderstates_id",
'value' => $state,
'display_emptychoice' => false,
'condition' => ['id' => $editable_states],
]);
} else {
echo Dropdown::getDropdownName("glpi_plugin_order_orderstates", $this->getState());
Expand Down
31 changes: 24 additions & 7 deletions inc/orderstate.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ public static function install(Migration $migration)
$state = new self();
foreach (
[
1 => __s("Draft", "order"),
2 => __s("Waiting for approval", "order"),
3 => __s("Validated", "order"),
4 => __s("Being delivered", "order"),
5 => __s("Delivered", "order"),
6 => __s("Canceled", "order"),
7 => __s("Paid", "order"),
1 => __("Draft", "order"),
2 => __("Waiting for approval", "order"),
3 => __("Validated", "order"),
4 => __("Being delivered", "order"),
5 => __("Delivered", "order"),
6 => __("Canceled", "order"),
7 => __("Paid", "order"),
] as $id => $label
) {
if (!countElementsInTable($table, ['id' => $id])) {
Expand All @@ -118,6 +118,23 @@ public static function install(Migration $migration)
]);
}
}

// Default labels used to be stored HTML-escaped
$escaped_states = $DB->request([
'SELECT' => ['id', 'name'],
'FROM' => $table,
'WHERE' => [
'id' => range(self::DRAFT, self::PAID),
'name' => ['LIKE', '%&%'],
],
]);
foreach ($escaped_states as $data) {
$DB->update(
$table,
['name' => htmlspecialchars_decode($data['name'], ENT_QUOTES)],
['id' => $data['id']],
);
}
}


Expand Down