Esempio n. 1
0
 /**
  * @param $rev
  */
 public function upgrade_4_2_5($rev)
 {
     $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.2.5')), 'task_4_2_x_runSql', $rev);
     //CRM-11077
     $sql = " SELECT cpse.entity_id, cpse.price_set_id\nFROM `civicrm_price_set_entity` cpse\nLEFT JOIN civicrm_price_set cps ON cps.id = cpse.price_set_id\nLEFT JOIN civicrm_price_set_entity cpse1 ON cpse1.price_set_id = cpse.price_set_id\nWHERE cpse.entity_table = 'civicrm_event'  AND cps.is_quick_config = 1\nGROUP BY cpse.id\nHAVING COUNT(cpse.price_set_id) > 1 AND MIN(cpse1.id) <> cpse.id ";
     $dao = CRM_Core_DAO::executeQuery($sql);
     while ($dao->fetch()) {
         if ($dao->price_set_id) {
             $copyPriceSet =& CRM_Upgrade_Snapshot_V4p2_Price_BAO_Set::copy($dao->price_set_id);
             CRM_Upgrade_Snapshot_V4p2_Price_BAO_Set::addTo('civicrm_event', $dao->entity_id, $copyPriceSet->id);
         }
     }
 }