Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-10298

upgrade failure to 4.2 - deleted events+ pricesets

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.2.0
    • Fix Version/s: 4.2.0
    • Component/s: CiviEvent
    • Labels:
      None

      Description

      CiviCRM doesn't (or if it does, it hasn't always) deleted fee option groups when the event is deleted.

      ie event 75 no longer exists but this line does::

      INSERT INTO `civicrm_option_group` (`name`, `title`, `description`, `is_reserved`, `is_active`) VALUES ( 'civicrm_event.amount.75', NULL, NULL, 1, 1);

      I believe that the patch below should fix this - but am still unable to get upgrade to complete - for unrelated reasons (class loader) so can't fully confirm

      Index: CRM/Upgrade/Incremental/php/FourTwo.php
      ===================================================================
      — CRM/Upgrade/Incremental/php/FourTwo.php (revision 40744)
      +++ CRM/Upgrade/Incremental/php/FourTwo.php (working copy)
      @@ -128,17 +134,21 @@
      return TRUE;
      }

      • +
        /**

      • *
        + *
      • Function to create price sets
        */
        static function creatPriceSet($daoName, $addTo, $options = array()) {
      • +
        $setParams['title'] = CRM_Core_DAO::getFieldValue($daoName[$addTo[0]][0], $addTo[2], 'title');
        $pageTitle = strtolower(CRM_Utils_String::munge($setParams['title'], '_', 245));

      • + if(empty($pageTitle))

        { + // an event that has been deleted leaves a option group behind - (this may be fixed in later versions?) + // we should probably delete the option group - but at least early exit here as the next line will fatal + return; + }

        if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Set', $pageTitle, 'id', 'name', true))

        { $setParams['name'] = $pageTitle; }

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              eileen Eileen McNaughton
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: