diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2d885e07e7..643b7e14c0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/inc/order.class.php b/inc/order.class.php
index cac30237da..589a70a9b1 100644
--- a/inc/order.class.php
+++ b/inc/order.class.php
@@ -988,9 +988,17 @@ public function showForm($ID, $options = [])
echo "
";
$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());
diff --git a/inc/orderstate.class.php b/inc/orderstate.class.php
index 4b4b3d1a20..3cc963dad4 100644
--- a/inc/orderstate.class.php
+++ b/inc/orderstate.class.php
@@ -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])) {
@@ -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']],
+ );
+ }
}
|