public function upgrade_4_7_alpha1($rev) {
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev);
$this->addTask(ts('Add Getting Started dashlet to %1: SQL', array(1 => $rev)), 'addGettingStartedDashlet', $rev);
+ $this->addTask(ts('Migrate \'on behalf of\' information to module_data'), 'migrateOnBehalfOfInfo');
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'task_4_7_x_runSql', $rev);
}
/**
return TRUE;
}
+ /**
+ * Migrate on-behalf information to uf_join.module_data as on-behalf columns will be dropped
+ * on DB upgrade
+ *
+ * @param CRM_Queue_TaskContext $ctx
+ *
+ * @return bool
+ * TRUE for success
+ */
+ public static function migrateOnBehalfOfInfo(CRM_Queue_TaskContext $ctx) {
+
+ $ufGroupDAO = new CRM_Core_DAO_UFJoin();
+ $ufGroupDAO->module = 'OnBehalf';
+ $ufGroupDAO->find(TRUE);
+
+ $query = "SELECT cp.*, uj.id as join_id
+ FROM civicrm_contribution_page cp
+ INNER JOIN civicrm_uf_join uj ON uj.entity_id = cp.id AND uj.module = 'OnBehalf'";
+ $dao = CRM_Core_DAO::executeQuery($query);
+
+ if ($dao->N) {
+ $domain = new CRM_Core_DAO_Domain();
+ $domain->find(TRUE);
+ while ($dao->fetch()) {
+ $onBehalfParams['on_behalf'] = array('is_for_organization' => $dao->is_for_organization);
+ if ($domain->locales) {
+ $locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales);
+ foreach ($locales as $locale) {
+ $for_organization = "for_organization_{$locale}";
+ $onBehalfParams['on_behalf'] += array(
+ $locale => array(
+ 'for_organization' => $dao->$for_organization,
+ ),
+ );
+ }
+ }
+ else {
+ $onBehalfParams['on_behalf'] += array(
+ 'default' => array(
+ 'for_organization' => $dao->for_organization,
+ ),
+ );
+ }
+ $ufJoinParam = array(
+ 'id' => $dao->join_id,
+ 'module' => 'on_behalf',
+ 'module_data' => json_encode($onBehalfParams),
+ );
+ CRM_Core_BAO_UFJoin::create($ufJoinParam);
+ }
+ }
+
+ return TRUE;
+ }
}
-- CRM-17005
UPDATE civicrm_country SET name = 'PALESTINIAN TERRITORY' WHERE name = 'PALESTINIAN TERRITORY, OCCUPIED';
-
-- CRM-17145 update Activity detail data type
ALTER TABLE `civicrm_activity` CHANGE `details` `details` LONGTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Details about the activity (agenda, notes, etc).';
(@option_group_id_date_filter, '{ts escape="sql"}Next Quarter{/ts}', 'next.quarter', 'next.quarter', NULL, NULL, NULL,57, NULL, 0, 0, 1, NULL, NULL),
(@option_group_id_date_filter, '{ts escape="sql"}Next Fiscal Year{/ts}', 'next.fiscal_year', 'next.fiscal_year', NULL, NULL, NULL,58, NULL, 0, 0, 1, NULL, NULL),
(@option_group_id_date_filter, '{ts escape="sql"}Next Year{/ts}', 'next.year', 'next.year', NULL, NULL, NULL,59, NULL, 0, 0, 1, NULL, NULL);
+
+-- CRM-16873
+{if $multilingual}
+ {foreach from=$locales item=loc}
+ ALTER TABLE civicrm_contribution_page DROP for_organization_{$loc};
+ {/foreach}
+{else}
+ ALTER TABLE civicrm_contribution_page DROP for_organization;
+{/if}
+ALTER TABLE civicrm_contribution_page DROP is_for_organization;