Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 5.11.0-b2
-
Component/s: None
-
Labels:None
Description
Currently option values must be unique, but it would be nice to be able to disable an option and replace it with a new one with the same price to replace it while keeping current users on the old price.
In app/models/package_options.php around line 2271 change
private function validateUniqueValues($values) { $option_values = []; foreach ((array)$values as $index => $value) { if (isset($value['value']) && !isset($option_values[$value['value']])) { $option_values[$value['value']] = $value['value']; } } return count($option_values) === count((array)$values); }
To
private function validateUniqueValues($values) { $option_values = []; foreach ((array)$values as $index => $value) { if (($value['status'] ?? null) == 'inactive') { unset($values[$index]); } if (isset($value['value']) && !isset($option_values[$value['value']])) { $option_values[$value['value']] = $value['value']; } } return count($option_values) === count((array)$values); }