Uploaded image for project: 'Blesta Core'
  1. Blesta Core
  2. CORE-5288

Allow package option values to be non-unique for inactive values

    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);
          }
      

        Activity

        jonathan Jonathan Reissmueller created issue -
        jonathan Jonathan Reissmueller made changes -
        Field Original Value New Value
        Sprint 5.11.0 Sprint 7 [ 207 ]
        jonathan Jonathan Reissmueller made changes -
        Rank Ranked higher
        jonathan Jonathan Reissmueller made changes -
        Rank Ranked lower
        abdy Abdy Franco made changes -
        Assignee Abdy Franco [ abdy ]
        abdy Abdy Franco made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        abdy Abdy Franco made changes -
        Remaining Estimate 0 minutes [ 0 ]
        Time Spent 12 minutes [ 720 ]
        Worklog Id 17492 [ 17492 ]
        abdy Abdy Franco made changes -
        Status In Progress [ 3 ] In Review [ 5 ]
        Resolution Fixed [ 1 ]
        jonathan Jonathan Reissmueller made changes -
        Status In Review [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            abdy Abdy Franco
            Reporter:
            jonathan Jonathan Reissmueller
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 12 minutes
              12m

                Agile