First commit

This commit is contained in:
Theodotos Andreou 2018-01-14 13:10:16 +00:00
commit c6e2478c40
13918 changed files with 2303184 additions and 0 deletions

View file

@ -0,0 +1,8 @@
{if $multilingual}
{foreach from=$locales item=locale}
ALTER TABLE civicrm_pcp_block ADD link_text_{$locale} varchar(255);
UPDATE civicrm_pcp_block SET link_text_{$locale} = link_text;
{/foreach}
ALTER TABLE civicrm_pcp_block DROP link_text;
{/if}

View file

@ -0,0 +1,20 @@
-- CRM-9699
{if $addDedupeEmail}
ALTER TABLE `civicrm_mailing` ADD `dedupe_email` TINYINT( 4 ) NULL DEFAULT '0' COMMENT 'Remove duplicate emails?';
{/if}
{if $worldRegionEmpty}
INSERT INTO `civicrm_worldregion` (`id`, `name`) VALUES
(1, 'Europe and Central Asia'),
(2, 'America South, Central, North and Caribbean'),
(3, 'Middle East and North Africa'),
(4, 'Asia-Pacific'),
(5, 'Africa West, East, Central and Southern'),
(99, 'unassigned');
{/if}
SELECT @region_id := max(id) from civicrm_worldregion where name = "Africa West, East, Central and Southern";
INSERT INTO `civicrm_country` (`name`, `iso_code`, `country_code`, `idd_prefix`, `ndd_prefix`, `region_id`, `is_province_abbreviated`, `address_format_id`) VALUES ('South Sudan', 'SS', NULL, NULL, NULL, @region_id, 0, NULL) ON DUPLICATE KEY UPDATE iso_code='SS';

View file

@ -0,0 +1,22 @@
-- CRM-9795 (fix duplicate option values)
SELECT @option_group_id_act := max(id) from civicrm_option_group where name = 'activity_type';
SELECT @maxValue := MAX(ROUND(value)) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act;
SELECT @clientCaseValue := value FROM civicrm_option_value WHERE name = 'Add Client To Case' AND option_group_id = @option_group_id_act;
UPDATE civicrm_option_value SET value = @maxValue + 1 WHERE name = 'Add Client To Case' AND option_group_id = @option_group_id_act;
UPDATE civicrm_activity
INNER JOIN civicrm_case_activity ON civicrm_activity.id = civicrm_case_activity.activity_id
SET civicrm_activity.activity_type_id = @maxValue + 1
WHERE civicrm_activity.activity_type_id = @clientCaseValue;
-- CRM-9868 Force disable jobs that should only be run manually
UPDATE civicrm_job
SET is_active = 0
WHERE api_action IN ('process_membership_reminder_date','update_greeting');
UPDATE civicrm_job
SET description = '{ts escape="sql"}Sets membership renewal reminder dates for current membership records where reminder date is null. This job should never be run automatically as it will cause members to get renewal reminders repeatedly.{/ts}'
WHERE api_action = 'process_membership_reminder_date';

View file

@ -0,0 +1,5 @@
-- CRM-10264
INSERT INTO `civicrm_job`
( domain_id, run_frequency, last_run, name, description, api_prefix, api_entity, api_action, parameters, is_active )
VALUES
( {$domainID}, 'Hourly', NULL, '{ts escape="sql" skip="true"}Clean-up Temporary Data and Files{/ts}','{ts escape="sql" skip="true"}Removes temporary data and files, and clears old data from cache tables. Recommend running this job every hour to help prevent database and file system bloat.{/ts}','civicrm_api3', 'job', 'cleanup', NULL, 0);

View file

@ -0,0 +1,529 @@
{include file='../CRM/Upgrade/4.1.alpha1.msg_template/civicrm_msg_template.tpl'}
-- get domain id
SELECT @domainID := min(id) FROM civicrm_domain;
-- CRM-8356
-- Add filter column 'filter' for 'civicrm_custom_field'
ALTER TABLE `civicrm_custom_field` ADD `filter` VARCHAR(255) NULL COMMENT 'Stores Contact Get API params contact reference custom fields. May be used for other filters in the future.';
-- CRM-8062
ALTER TABLE `civicrm_subscription_history` CHANGE `status` `status` ENUM( 'Added', 'Removed', 'Pending', 'Deleted' ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'The state of the contact within the group';
-- CRM-8510
ALTER TABLE civicrm_currency
ADD UNIQUE INDEX UI_name ( name );
-- CRM-8616
DELETE FROM civicrm_currency WHERE name = 'EEK';
-- CRM-8769
INSERT IGNORE INTO civicrm_state_province
(`name`, `abbreviation`, `country_id`)
VALUES
('Metropolitan Manila' , 'MNL', '1170');
-- CRM-8902
UPDATE civicrm_navigation SET permission ='add cases,access all cases and activities', permission_operator = 'OR'
WHERE civicrm_navigation.name= 'New Case';
-- CRM-8780
-- add the settings table
CREATE TABLE `civicrm_setting` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`group_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'group name for setting element, useful in caching setting elements',
`name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Unique name for setting',
`value` text COLLATE utf8_unicode_ci COMMENT 'data associated with this group / name combo',
`domain_id` int(10) unsigned NOT NULL COMMENT 'Which Domain is this menu item for',
`contact_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to Contact ID if the setting is localized to a contact',
`is_domain` tinyint(4) DEFAULT NULL COMMENT 'Is this setting a contact specific or site wide setting?',
`component_id` int(10) unsigned DEFAULT NULL COMMENT 'Component that this menu item belongs to',
`created_date` datetime DEFAULT NULL COMMENT 'When was the setting created',
`created_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to civicrm_contact, who created this setting',
PRIMARY KEY (`id`),
KEY `index_group_name` (`group_name`,`name`),
KEY `FK_civicrm_setting_domain_id` (`domain_id`),
KEY `FK_civicrm_setting_contact_id` (`contact_id`),
KEY `FK_civicrm_setting_component_id` (`component_id`),
KEY `FK_civicrm_setting_created_id` (`created_id`),
CONSTRAINT `FK_civicrm_setting_domain_id` FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain` (`id`) ON DELETE CASCADE,
CONSTRAINT `FK_civicrm_setting_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE,
CONSTRAINT `FK_civicrm_setting_component_id` FOREIGN KEY (`component_id`) REFERENCES `civicrm_component` (`id`),
CONSTRAINT `FK_civicrm_setting_created_id` FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-- CRM-8508
SELECT @caseCompId := id FROM `civicrm_component` where `name` like 'CiviCase';
SELECT @option_group_id_activity_type := max(id) from civicrm_option_group where name = 'activity_type';
SELECT @max_val := MAX(ROUND(op.value)) FROM civicrm_option_value op WHERE op.option_group_id = @option_group_id_activity_type;
SELECT @max_wt := max(weight) from civicrm_option_value where option_group_id=@option_group_id_activity_type;
INSERT INTO civicrm_option_value
(option_group_id, {localize field='label'}label{/localize}, {localize field='description'}description{/localize}, value, name, weight, filter, component_id)
VALUES
(@option_group_id_activity_type, {localize}'Change Custom Data'{/localize},{localize}''{/localize}, (SELECT @max_val := @max_val+1), 'Change Custom Data', (SELECT @max_wt := @max_wt+1), 0, @caseCompId);
-- CRM-8739
Update civicrm_menu set title = 'Cleanup Caches and Update Paths' where path = 'civicrm/admin/setting/updateConfigBackend';
-- CRM-8855
SELECT @option_group_id_udOpt := max(id) from civicrm_option_group where name = 'user_dashboard_options';
SELECT @max_val := MAX(ROUND(op.value)) FROM civicrm_option_value op WHERE op.option_group_id = @option_group_id_udOpt;
SELECT @max_wt := max(weight) from civicrm_option_value where option_group_id=@option_group_id_udOpt;
INSERT INTO civicrm_option_value
(option_group_id, {localize field='label'}label{/localize}, value, name, weight, filter, is_default, component_id)
VALUES
(@option_group_id_udOpt, {localize}'Assigned Activities'{/localize}, (SELECT @max_val := @max_val+1), 'Assigned Activities', (SELECT @max_wt := @max_wt+1), 0, NULL, NULL);
-- CRM-8737
ALTER TABLE `civicrm_event` ADD `is_share` TINYINT( 4 ) NULL DEFAULT '1' COMMENT 'Can people share the event through social media?';
ALTER TABLE `civicrm_contribution_page` ADD `is_share` TINYINT(4) NULL DEFAULT '1' COMMENT 'Can people share the contribution page through social media?';
-- CRM-8357
ALTER TABLE `civicrm_contact` CHANGE `contact_sub_type` `contact_sub_type` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'May be used to over-ride contact view and edit templates.';
UPDATE civicrm_contact SET contact_sub_type = CONCAT('', contact_sub_type, '');
-- CRM-6811
INSERT INTO `civicrm_dashboard`
( `domain_id`, {localize field='label'}`label`{/localize}, `url`, `permission`, `permission_operator`, `column_no`, `is_minimized`, `is_active`, `weight`, `fullscreen_url`, `is_fullscreen`, `is_reserved`)
VALUES
( @domainID, {localize}'Case Dashboard Dashlet'{/localize}, 'civicrm/dashlet/casedashboard&reset=1&snippet=4', 'access CiviCase', NULL , 0, 0, 1, 4, 'civicrm/dashlet/casedashboard&reset=1&snippet=4&context=dashletFullscreen', 1, 1);
-- CRM-9059 Admin menu rebuild
SELECT @domainID := min(id) FROM civicrm_domain;
SELECT @adminlastID := id FROM civicrm_navigation where name = 'Administer' AND domain_id = @domainID;
SELECT @customizeOld := id FROM civicrm_navigation where name = 'Customize' AND domain_id = @domainID;
SELECT @configureOld := id FROM civicrm_navigation where name = 'Configure' AND domain_id = @domainID;
SELECT @globalOld := id FROM civicrm_navigation where name = 'Global Settings' AND domain_id = @domainID;
SELECT @manageOld := id FROM civicrm_navigation where name = 'Manage' AND domain_id = @domainID;
SELECT @optionsOld := id FROM civicrm_navigation where name = 'Option Lists' AND domain_id = @domainID;
SELECT @customizeOld := id FROM civicrm_navigation where name = 'Customize' AND domain_id = @domainID;
DELETE from civicrm_navigation WHERE parent_id = @globalOld;
DELETE from civicrm_navigation WHERE parent_id IN (@customizeOld, @configureOld, @manageOld, @optionsOld);
DELETE from civicrm_navigation WHERE id IN (@customizeOld, @configureOld, @manageOld, @optionsOld);
UPDATE civicrm_navigation SET weight = 9 WHERE name = 'CiviCampaign' AND parent_id = @adminlastID;
UPDATE civicrm_navigation SET weight = 10 WHERE name = 'CiviCase' AND parent_id = @adminlastID;
UPDATE civicrm_navigation SET weight = 11 WHERE name = 'CiviContribute' AND parent_id = @adminlastID;
UPDATE civicrm_navigation SET weight = 12 WHERE name = 'CiviEvent' AND parent_id = @adminlastID;
UPDATE civicrm_navigation SET weight = 13 WHERE name = 'CiviGrant' AND parent_id = @adminlastID;
UPDATE civicrm_navigation SET weight = 14 WHERE name = 'CiviMail' AND parent_id = @adminlastID;
UPDATE civicrm_navigation SET weight = 15 WHERE name = 'CiviMember' AND parent_id = @adminlastID;
UPDATE civicrm_navigation SET weight = 16 WHERE name = 'CiviReport' AND parent_id = @adminlastID;
DELETE FROM civicrm_navigation WHERE name = 'Administration Console';
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( @domainID, 'civicrm/admin&reset=1', '{ts escape="sql" skip="true"}Administration Console{/ts}', 'Administration Console', 'administer CiviCRM', '', @adminlastID, '1', NULL, 1 );
SET @adminConsolelastID:=LAST_INSERT_ID();
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( @domainID, 'civicrm/admin/configtask&reset=1', '{ts escape="sql" skip="true"}Configuration Checklist{/ts}', 'Configuration Checklist', 'administer CiviCRM', '', @adminConsolelastID, '1', NULL, 1 );
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( @domainID, NULL, '{ts escape="sql" skip="true"}Customize Data and Screens{/ts}', 'Customize Data and Screens', 'administer CiviCRM', '', @adminlastID, '1', NULL, 3 );
SET @CustomizelastID:=LAST_INSERT_ID();
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( @domainID, 'civicrm/admin/custom/group&reset=1', '{ts escape="sql" skip="true"}Custom Fields{/ts}', 'Custom Fields', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 1 ),
( @domainID, 'civicrm/admin/uf/group&reset=1', '{ts escape="sql" skip="true"}Profiles{/ts}', 'Profiles', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 2 ),
( @domainID, 'civicrm/admin/tag&reset=1', '{ts escape="sql" skip="true"}Tags (Categories){/ts}', 'Tags (Categories)', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 3 ),
( @domainID, 'civicrm/admin/options/activity_type&reset=1&group=activity_type', '{ts escape="sql" skip="true"}Activity Types{/ts}', 'Activity Types', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 4 ),
( @domainID, 'civicrm/admin/reltype&reset=1', '{ts escape="sql" skip="true"}Relationship Types{/ts}', 'Relationship Types', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 5 ),
( @domainID, 'civicrm/admin/options/subtype&reset=1', '{ts escape="sql" skip="true"}Contact Types{/ts}','Contact Types', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 6 ),
( @domainID, 'civicrm/admin/setting/preferences/display&reset=1', '{ts escape="sql" skip="true"}Display Preferences{/ts}', 'Display Preferences', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 9 ),
( @domainID, 'civicrm/admin/setting/search&reset=1', '{ts escape="sql" skip="true"}Search Preferences{/ts}', 'Search Preferences', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 10 ),
( @domainID, 'civicrm/admin/menu&reset=1', '{ts escape="sql" skip="true"}Navigation Menu{/ts}', 'Navigation Menu', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 11 ),
( @domainID, 'civicrm/admin/options/wordreplacements&reset=1','{ts escape="sql" skip="true"}Word Replacements{/ts}','Word Replacements', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 12 ),
( @domainID, 'civicrm/admin/options/custom_search&reset=1&group=custom_search', '{ts escape="sql" skip="true"}Manage Custom Searches{/ts}', 'Manage Custom Searches', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 13 ),
( @domainID, 'civicrm/admin/extensions&reset=1', '{ts escape="sql" skip="true"}Manage Extensions{/ts}', 'Manage Extensions', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 14 );
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( @domainID, NULL, '{ts escape="sql" skip="true"}Dropdown Options{/ts}', 'Dropdown Options', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 8 );
SET @optionListlastID:=LAST_INSERT_ID();
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( @domainID, 'civicrm/admin/options/gender&reset=1&group=gender', '{ts escape="sql" skip="true"}Gender Options{/ts}', 'Gender Options', 'administer CiviCRM', '', @optionListlastID, '1', NULL, 1 ),
( @domainID, 'civicrm/admin/options/individual_prefix&group=individual_prefix&reset=1', '{ts escape="sql" skip="true"}Individual Prefixes (Ms, Mr...){/ts}', 'Individual Prefixes (Ms, Mr...)', 'administer CiviCRM', '', @optionListlastID, '1', NULL, 2 ),
( @domainID, 'civicrm/admin/options/individual_suffix&group=individual_suffix&reset=1', '{ts escape="sql" skip="true"}Individual Suffixes (Jr, Sr...){/ts}', 'Individual Suffixes (Jr, Sr...)', 'administer CiviCRM', '', @optionListlastID, '1', NULL, 3 ),
( @domainID, 'civicrm/admin/options/instant_messenger_service&group=instant_messenger_service&reset=1', '{ts escape="sql" skip="true"}Instant Messenger Services{/ts}', 'Instant Messenger Services', 'administer CiviCRM', '', @optionListlastID, '1', NULL, 4 ),
( @domainID, 'civicrm/admin/locationType&reset=1', '{ts escape="sql" skip="true"}Location Types (Home, Work...){/ts}', 'Location Types (Home, Work...)', 'administer CiviCRM', '', @optionListlastID, '1', NULL, 5 ),
( @domainID, 'civicrm/admin/options/mobile_provider&group=mobile_provider&reset=1', '{ts escape="sql" skip="true"}Mobile Phone Providers{/ts}', 'Mobile Phone Providers', 'administer CiviCRM', '', @optionListlastID, '1', NULL, 6 ),
( @domainID, 'civicrm/admin/options/phone_type&group=phone_type&reset=1', '{ts escape="sql" skip="true"}Phone Types{/ts}', 'Phone Types', 'administer CiviCRM', '', @optionListlastID, '1', NULL, 7 ),
( @domainID, 'civicrm/admin/options/website_type&group=website_type&reset=1', '{ts escape="sql" skip="true"}Website Types{/ts}', 'Website Types', 'administer CiviCRM', '', @optionListlastID, '1', NULL, 8 );
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( @domainID, NULL, '{ts escape="sql" skip="true"}Communications{/ts}', 'Communications', 'administer CiviCRM', '', @adminlastID, '1', NULL, 4 );
SET @communicationslastID:=LAST_INSERT_ID();
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( @domainID, 'civicrm/admin/domain&action=update&reset=1', '{ts escape="sql" skip="true"}Organization Address and Contact Info{/ts}', 'Organization Address and Contact Info', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 1 ),
( @domainID, 'civicrm/admin/options/from_email_address&group=from_email_address&reset=1', '{ts escape="sql" skip="true"}FROM Email Addresses{/ts}', 'FROM Email Addresses', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 2 ),
( @domainID, 'civicrm/admin/messageTemplates&reset=1', '{ts escape="sql" skip="true"}Message Templates{/ts}', 'Message Templates', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 3 ),
( @domainID, 'civicrm/admin/scheduleReminders&reset=1', '{ts escape="sql" skip="true"}Schedule Reminders{/ts}', 'Schedule Reminders', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 4 ),
( @domainID, 'civicrm/admin/options/preferred_communication_method&group=preferred_communication_method&reset=1', '{ts escape="sql" skip="true"}Preferred Communication Methods{/ts}', 'Preferred Communication Methods', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 5 ),
( @domainID, 'civicrm/admin/labelFormats&reset=1', '{ts escape="sql" skip="true"}Label Formats{/ts}', 'Label Formats', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 6 ),
( @domainID, 'civicrm/admin/pdfFormats&reset=1', '{ts escape="sql" skip="true"}Print Page (PDF) Formats{/ts}', 'Print Page (PDF) Formats', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 7 ),
( @domainID, 'civicrm/admin/options/email_greeting&group=email_greeting&reset=1', '{ts escape="sql" skip="true"}Email Greeting Formats{/ts}', 'Email Greeting Formats', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 8 ),
( @domainID, 'civicrm/admin/options/postal_greeting&group=postal_greeting&reset=1', '{ts escape="sql" skip="true"}Postal Greeting Formats{/ts}', 'Postal Greeting Formats', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 9 ),
( @domainID, 'civicrm/admin/options/addressee&group=addressee&reset=1', '{ts escape="sql" skip="true"}Addressee Formats{/ts}', 'Addressee Formats', 'administer CiviCRM', '', @communicationslastID, '1', NULL, 10 );
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( @domainID, NULL, '{ts escape="sql" skip="true"}Localization{/ts}', 'Localization', 'administer CiviCRM', '', @adminlastID, '1', NULL, 6 );
SET @locallastID:=LAST_INSERT_ID();
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( @domainID, 'civicrm/admin/setting/localization&reset=1', '{ts escape="sql" skip="true"}Languages, Currency, Locations{/ts}', 'Languages, Currency, Locations', 'administer CiviCRM', '', @locallastID, '1', NULL, 1 ),
( @domainID, 'civicrm/admin/setting/preferences/address&reset=1', '{ts escape="sql" skip="true"}Address Settings{/ts}', 'Address Settings', 'administer CiviCRM', '', @locallastID, '1', NULL, 2 ),
( @domainID, 'civicrm/admin/setting/date&reset=1', '{ts escape="sql" skip="true"}Date Format{/ts}', 'Date Formats', 'administer CiviCRM', '', @locallastID, '1', NULL, 3 ),
( @domainID, 'civicrm/admin/options/languages&group=languages&reset=1', '{ts escape="sql" skip="true"}Preferred Language Options{/ts}', 'Preferred Language Options', 'administer CiviCRM', '', @locallastID, '1', NULL, 4 );
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( @domainID, NULL, '{ts escape="sql" skip="true"}Users and Permissions{/ts}', 'Users and Permissions', 'administer CiviCRM', '', @adminlastID, '1', NULL, 7 );
SET @usersPermslastID:=LAST_INSERT_ID();
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( @domainID, 'civicrm/admin/access&reset=1', '{ts escape="sql" skip="true"}Permissions (Access Control){/ts}', 'Permissions (Access Control)', 'administer CiviCRM', '', @usersPermslastID, '1', NULL, 1 ),
( @domainID, 'civicrm/admin/synchUser&reset=1', '{ts escape="sql" skip="true"}Synchronize Users to Contacts{/ts}', 'Synchronize Users to Contacts', 'administer CiviCRM', '', @usersPermslastID, '1', NULL, 2 );
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( @domainID, NULL, '{ts escape="sql" skip="true"}System Settings{/ts}', 'System Settings', 'administer CiviCRM', '', @adminlastID, '1', NULL, 8 );
SET @systemSettingslastID:=LAST_INSERT_ID();
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( @domainID, 'civicrm/admin/setting/component&reset=1', '{ts escape="sql" skip="true"}Enable CiviCRM Components{/ts}', 'Enable Components', 'administer CiviCRM', '', @systemSettingslastID, '1', NULL, 1 ),
( @domainID, 'civicrm/admin/setting/smtp&reset=1', '{ts escape="sql" skip="true"}Outbound Email (SMTP/Sendmail){/ts}', 'Outbound Email', 'administer CiviCRM', '', @systemSettingslastID, '1', NULL, 2 ),
( @domainID, 'civicrm/admin/paymentProcessor&reset=1', '{ts escape="sql" skip="true"}Payment Processors{/ts}', 'Payment Processors', 'administer CiviCRM', '', @systemSettingslastID, '1', NULL, 3 ),
( @domainID, 'civicrm/admin/setting/mapping&reset=1', '{ts escape="sql" skip="true"}Mapping and Geocoding{/ts}', 'Mapping and Geocoding', 'administer CiviCRM', '', @systemSettingslastID, '1', NULL, 4 ),
( @domainID, 'civicrm/admin/setting/misc&reset=1', '{ts escape="sql" skip="true"}Undelete, Logging and ReCAPTCHA{/ts}', 'Undelete, Logging and ReCAPTCHA', 'administer CiviCRM', '', @systemSettingslastID, '1', NULL, 5 ),
( @domainID, 'civicrm/admin/setting/path&reset=1', '{ts escape="sql" skip="true"}Directories{/ts}', 'Directories', 'administer CiviCRM', '', @systemSettingslastID, '1', NULL, 6 ),
( @domainID, 'civicrm/admin/setting/url&reset=1', '{ts escape="sql" skip="true"}Resource URLs{/ts}', 'Resource URLs', 'administer CiviCRM', '', @systemSettingslastID, '1', NULL, 7 ),
( @domainID, 'civicrm/admin/setting/updateConfigBackend&reset=1', '{ts escape="sql" skip="true"}Cleanup Caches and Update Paths{/ts}', 'Cleanup Caches and Update Paths', 'administer CiviCRM', '', @systemSettingslastID, '1', NULL, 8 ),
( @domainID, 'civicrm/admin/setting/uf&reset=1', '{ts escape="sql" skip="true"}CMS Database Integration{/ts}', 'CMS Integration', 'administer CiviCRM', '', @systemSettingslastID, '1', NULL, 9 ),
( @domainID, 'civicrm/admin/options/safe_file_extension&group=safe_file_extension&reset=1', '{ts escape="sql" skip="true"}Safe File Extensions{/ts}', 'Safe File Extensions','administer CiviCRM', '',@systemSettingslastID, '1', NULL, 10 ),
( @domainID, 'civicrm/admin/options?reset=1', '{ts escape="sql" skip="true"}Option Groups{/ts}', 'Option Groups', 'administer CiviCRM', '', @systemSettingslastID, '1', NULL, 11 ),
( @domainID, 'civicrm/admin/mapping&reset=1', '{ts escape="sql" skip="true"}Import/Export Mappings{/ts}', 'Import/Export Mappings', 'administer CiviCRM', '', @systemSettingslastID, '1', NULL, 12 ),
( @domainID, 'civicrm/admin/setting/debug&reset=1', '{ts escape="sql" skip="true"}Debugging and Error Handling{/ts}','Debugging and Error Handling', 'administer CiviCRM', '', @systemSettingslastID, '1', NULL, 13 ),
( @domainID, 'civicrm/admin/setting/preferences/multisite&reset=1', '{ts escape="sql" skip="true"}Multi Site Settings{/ts}', 'Multi Site Settings', 'administer CiviCRM', '', @systemSettingslastID, '1', NULL, 14 );
SELECT @campaignAdminID := id FROM civicrm_navigation where name = 'CiviCampaign' AND parent_id = @adminlastID;
SELECT @eventAdminID := id FROM civicrm_navigation where name = 'CiviEvent' AND parent_id = @adminlastID;
SELECT @mailAdminID := id FROM civicrm_navigation where name = 'CiviMail' AND parent_id = @adminlastID;
SELECT @memberAdminID := id FROM civicrm_navigation where name = 'CiviMember' AND parent_id = @adminlastID;
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( @domainID, 'civicrm/admin/setting/preferences/campaign&reset=1', '{ts escape="sql" skip="true"}CiviCampaign Component Settings{/ts}', 'CiviCampaign Component Settings','administer CiviCampaign', '', @campaignAdminID, '1', NULL, 5 ),
( @domainID, 'civicrm/admin/setting/preferences/event&reset=1', '{ts escape="sql" skip="true"}CiviEvent Component Settings{/ts}', 'CiviEvent Component Settings','access CiviEvent,administer CiviCRM', 'AND', @eventAdminID, '1', NULL, 13 ),
( @domainID, 'civicrm/admin/setting/preferences/mailing&reset=1', '{ts escape="sql" skip="true"}CiviMail Component Settings{/ts}', 'CiviMail Component Settings','access CiviMail,administer CiviCRM', 'AND', @mailAdminID, '1', NULL, 6 ),
( @domainID, 'civicrm/admin/setting/preferences/member&reset=1', '{ts escape="sql" skip="true"}CiviMember Component Settings{/ts}', 'CiviMember Component Settings','access CiviMember,administer CiviCRM', 'AND', @memberAdminID, '1', NULL, 5 ),
( @domainID, 'civicrm/admin/options/event_badge&group=event_badge&reset=1', '{ts escape="sql" skip="true"}Event Badge Formats{/ts}', 'Event Badge Formats', 'access CiviEvent,administer CiviCRM', 'AND', @eventAdminID, '1', NULL, 11 );
-- CRM-9113
ALTER TABLE `civicrm_report_instance` ADD `grouprole` VARCHAR( 1024 ) NULL AFTER `permission`;
-- CRM-8762 Fix option_group table
ALTER TABLE civicrm_option_group CHANGE `is_reserved` `is_reserved` TINYINT DEFAULT 1;
UPDATE civicrm_option_group SET `is_reserved` = 1;
{if $multilingual}
{foreach from=$locales item=locale}
UPDATE civicrm_option_group SET label_{$locale} = description_{$locale} WHERE label_{$locale} IS NULL;
{/foreach}
{else}
UPDATE civicrm_option_group SET `label` = `description` WHERE `label` IS NULL;
{/if}
-- CRM-9112
ALTER TABLE `civicrm_dedupe_rule_group` ADD `title` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Label of the rule group';
ALTER TABLE `civicrm_dedupe_rule_group` ADD `is_reserved` TINYINT( 4 ) NULL DEFAULT NULL COMMENT 'Is this a reserved rule - a rule group that has been optimized and cannot be changed by the admin';
UPDATE `civicrm_dedupe_rule_group` SET `name` = CONCAT( REPLACE( `name`, '-', '' ), '-', id );
-- the fuzzy default dedupe rules
INSERT INTO civicrm_dedupe_rule_group (contact_type, threshold, level, is_default, name, title, is_reserved)
VALUES ('Individual', 20, 'Fuzzy', 1, 'IndividualFuzzy', 'Individual Fuzzy In-built', 1);
SELECT @drgid := MAX(id) FROM civicrm_dedupe_rule_group;
INSERT INTO civicrm_dedupe_rule (dedupe_rule_group_id, rule_table, rule_field, rule_weight)
VALUES (@drgid, 'civicrm_contact', 'first_name', 5),
(@drgid, 'civicrm_contact', 'last_name', 7),
(@drgid, 'civicrm_email' , 'email', 10);
-- the strict dedupe rules
INSERT INTO civicrm_dedupe_rule_group (contact_type, threshold, level, is_default, name, title, is_reserved)
VALUES ('Individual', 10, 'Strict', 1, 'IndividualStrict', 'Individual Strict In-built', 1);
SELECT @drgid := MAX(id) FROM civicrm_dedupe_rule_group;
INSERT INTO civicrm_dedupe_rule (dedupe_rule_group_id, rule_table, rule_field, rule_weight)
VALUES (@drgid, 'civicrm_email', 'email', 10);
INSERT INTO civicrm_dedupe_rule_group (contact_type, threshold, level, is_default, name, title, is_reserved)
VALUES ('Individual', 15, 'Strict', 0, 'IndividualComplete', 'Individual Complete Inbuilt', 1);
SELECT @drgid := MAX(id) FROM civicrm_dedupe_rule_group;
INSERT INTO civicrm_dedupe_rule (dedupe_rule_group_id, rule_table, rule_field, rule_weight)
VALUES (@drgid, 'civicrm_contact', 'first_name', '5'),
(@drgid, 'civicrm_contact', 'last_name', '5'),
(@drgid, 'civicrm_address', 'street_address', '5'),
(@drgid, 'civicrm_contact', 'middle_name', '1'),
(@drgid, 'civicrm_contact', 'suffix_id', '1');
-- CRM-9120
{if $multilingual}
{foreach from=$locales item=locale}
ALTER TABLE `civicrm_location_type` ADD display_name_{$locale} VARCHAR( 64 ) DEFAULT NULL COMMENT 'Location Type Display Name.' AFTER `name`;
UPDATE `civicrm_location_type` SET display_name_{$locale} = `name`;
{/foreach}
{else}
ALTER TABLE `civicrm_location_type` ADD `display_name` VARCHAR( 64 ) DEFAULT NULL COMMENT 'Location Type Display Name.' AFTER `name`;
UPDATE `civicrm_location_type` SET `display_name` = `name`;
{/if}
-- CRM-9125
ALTER TABLE `civicrm_contribution_recur` ADD `contribution_type_id` int(10) unsigned NULL COMMENT 'FK to Contribution Type';
ALTER TABLE `civicrm_contribution_recur` ADD CONSTRAINT `FK_civicrm_contribution_recur_contribution_type_id` FOREIGN KEY (`contribution_type_id`) REFERENCES `civicrm_contribution_type` (`id`) ON DELETE SET NULL;
ALTER TABLE `civicrm_contribution_recur` ADD `payment_instrument_id` int(10) unsigned NULL COMMENT 'FK to Payment Instrument';
ALTER TABLE `civicrm_contribution_recur` ADD INDEX UI_contribution_recur_payment_instrument_id ( payment_instrument_id );
ALTER TABLE `civicrm_contribution_recur` ADD `campaign_id` int(10) unsigned NULL COMMENT 'The campaign for which this contribution has been triggered.';
ALTER TABLE `civicrm_contribution_recur` ADD CONSTRAINT `FK_civicrm_contribution_recur_campaign_id` FOREIGN KEY (`campaign_id`) REFERENCES `civicrm_campaign` (`id`) ON DELETE SET NULL;
UPDATE `civicrm_contribution_recur` ccr INNER JOIN `civicrm_contribution` cc ON ccr.id = cc.contribution_recur_id SET ccr.campaign_id = cc.campaign_id, ccr.payment_instrument_id = cc.payment_instrument_id, ccr.contribution_type_id = cc.contribution_type_id;
-- CRM-8962
INSERT INTO civicrm_action_mapping ( entity, entity_value, entity_value_label, entity_status, entity_status_label, entity_date_start, entity_date_end, entity_recipient )
VALUES
('civicrm_participant', 'event_type', 'Event Type', 'civicrm_participant_status_type', 'Participant Status', 'event_start_date', 'event_end_date', 'event_contacts'),
('civicrm_participant', 'civicrm_event', 'Event Name', 'civicrm_participant_status_type', 'Participant Status', 'event_start_date', 'event_end_date', 'event_contacts');
INSERT INTO civicrm_option_group
(name, {localize field='label'}label{/localize}, {localize field='description'}description{/localize}, is_reserved, is_active)
VALUES
('event_contacts', {localize}'{ts escape="sql"}Event Recipients{/ts}'{/localize}, {localize}'{ts escape="sql"}Event Recipients{/ts}'{/localize}, 1, 1),
('contact_reference_options', {localize}'{ts escape="sql"}Contact Reference Autocomplete Options{/ts}'{/localize}, {localize}'{ts escape="sql"}Contact Reference Autocomplete Options{/ts}'{/localize}, 1, 1);
SELECT @option_group_id_ere := max(id) from civicrm_option_group where name = 'event_contacts';
INSERT INTO civicrm_option_value
(option_group_id, {localize field='label'}label{/localize}, value, name, filter, weight, is_active )
VALUES
(@option_group_id_ere, {localize}'{ts escape="sql"}Participant Role{/ts}'{/localize}, 1, 'participant_role', 0, 1, 1 );
ALTER TABLE civicrm_action_schedule ADD `absolute_date` date DEFAULT NULL COMMENT 'Date on which the reminder be sent.';
ALTER TABLE civicrm_action_schedule ADD `recipient_listing` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'listing based on recipient field.';
-- CRM-8534
ALTER TABLE civicrm_pcp_block
DROP FOREIGN KEY FK_civicrm_pcp_block_entity_id,
DROP INDEX FK_civicrm_pcp_block_entity_id;
ALTER TABLE civicrm_pcp
DROP FOREIGN KEY FK_civicrm_pcp_contribution_page_id,
DROP INDEX FK_civicrm_pcp_contribution_page_id;
ALTER TABLE `civicrm_pcp`
ADD `page_type` VARCHAR( 64 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'contribute' AFTER `contribution_page_id`;
ALTER TABLE `civicrm_pcp`
CHANGE `contribution_page_id` `page_id` INT( 10 ) UNSIGNED NOT NULL COMMENT 'The Page which triggered this pcp';
ALTER TABLE `civicrm_pcp`
ADD `pcp_block_id` int(10) unsigned NOT NULL COMMENT 'The pcp block that this pcp page was created from' AFTER `page_type`;
UPDATE `civicrm_pcp`
SET `page_type` = 'contribute' WHERE `page_type` = '' OR `page_type` IS NULL;
UPDATE `civicrm_pcp` `pcp`
SET `pcp_block_id` = (SELECT `id` FROM `civicrm_pcp_block` `pb` WHERE `pb`.`entity_id` = `pcp`.`page_id`);
ALTER TABLE `civicrm_pcp_block`
ADD `target_entity_type` VARCHAR( 64 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'contribute' AFTER `entity_id`;
ALTER TABLE `civicrm_pcp_block`
ADD `target_entity_id` int(10) unsigned NOT NULL COMMENT 'The entity that this pcp targets' AFTER `target_entity_type`;
UPDATE `civicrm_pcp_block`
SET `target_entity_id` = `entity_id` WHERE `target_entity_id` = '' OR `target_entity_id` IS NULL;
ALTER TABLE `civicrm_pcp` DROP COLUMN `referer`;
UPDATE civicrm_navigation SET url = 'civicrm/admin/pcp?reset=1&page_type=contribute' WHERE url = 'civicrm/admin/pcp&reset=1';
SELECT @lastEventId := MAX(id) FROM civicrm_navigation where name = 'Events' AND domain_id = @domainID;
SELECT @adminEventId := MAX(id) FROM civicrm_navigation where name = 'CiviEvent' AND domain_id = @domainID;
SELECT @lastEventIdWeight := MAX(weight)+1 FROM civicrm_navigation where parent_id = @lastEventId;
SELECT @adminEventIdWeight := MAX(weight)+1 FROM civicrm_navigation where parent_id = @adminEventId;
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( @domainID, 'civicrm/admin/pcp?reset=1&page_type=event', '{ts escape="sql" skip="true"}Personal Campaign Pages{/ts}', 'Personal Campaign Pages', 'access CiviEvent,administer CiviCRM', 'AND', @lastEventId, '1', 1, @lastEventIdWeight ),
( @domainID, 'civicrm/admin/pcp?reset=1&page_type=event', '{ts escape="sql" skip="true"}Personal Campaign Pages{/ts}', 'Personal Campaign Pages', 'access CiviEvent,administer CiviCRM', 'AND', @adminEventId, '1', 1, @adminEventIdWeight );
-- CRM-8358 - consolidated cron jobs
CREATE TABLE `civicrm_job` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Job Id',
`domain_id` int(10) unsigned NOT NULL COMMENT 'Which Domain is this scheduled job for',
`run_frequency` enum('Hourly','Daily','Always') COLLATE utf8_unicode_ci DEFAULT 'Daily' COMMENT 'Scheduled job run frequency.',
`last_run` datetime DEFAULT NULL COMMENT 'When was this cron entry last run',
`name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Title of the job',
`description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Description of the job',
`api_prefix` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Prefix of the job api call',
`api_entity` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Entity of the job api call',
`api_action` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Action of the job api call',
`parameters` text COLLATE utf8_unicode_ci COMMENT 'List of parameters to the command.',
`is_active` tinyint(4) DEFAULT NULL COMMENT 'Is this job active?',
PRIMARY KEY (`id`),
KEY `FK_civicrm_job_domain_id` (`domain_id`),
CONSTRAINT `FK_civicrm_job_domain_id` FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `civicrm_job_log` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Job log entry Id',
`domain_id` int(10) unsigned NOT NULL COMMENT 'Which Domain is this scheduled job for',
`run_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Log entry date',
`job_id` int(10) unsigned DEFAULT NULL COMMENT 'Pointer to job id - not a FK though, just for logging purposes',
`name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Title of the job',
`command` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Full path to file containing job script',
`description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Title line of log entry',
`data` text COLLATE utf8_unicode_ci COMMENT 'Potential extended data for specific job run (e.g. tracebacks).',
PRIMARY KEY (`id`),
KEY `FK_civicrm_job_log_domain_id` (`domain_id`),
CONSTRAINT `FK_civicrm_job_log_domain_id` FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `civicrm_job`
( domain_id, run_frequency, last_run, name, description, api_prefix, api_entity, api_action, parameters, is_active )
VALUES
( @domainID, 'Hourly' , NULL, '{ts escape="sql" skip="true"}Mailings scheduler{/ts}', '{ts escape="sql" skip="true"}Sends out scheduled mailings{/ts}', 'civicrm_api3', 'job', 'process_mailing', 'user=USERNAME\r\npassword=PASSWORD\r\nkey=SITE_KEY', 0),
( @domainID, 'Hourly' , NULL, '{ts escape="sql" skip="true"}Bounces fetcher{/ts}', '{ts escape="sql" skip="true"}Fetches bounces from mailings and writes them to mailing statistics{/ts}', 'civicrm_api3', 'job', 'fetch_bounces', 'user=USERNAME\r\npassword=PASSWORD\r\nkey=SITE_KEY', 0),
( @domainID, 'Hourly' , NULL, '{ts escape="sql" skip="true"}Activity processor{/ts}', '{ts escape="sql" skip="true"}{/ts}', 'civicrm_api3', 'job', 'fetch_activities', 'user=USERNAME\r\npassword=PASSWORD\r\nkey=SITE_KEY', 0),
( @domainID, 'Daily' , NULL, '{ts escape="sql" skip="true"}Pledge record processor{/ts}', '{ts escape="sql" skip="true"}Updates pledge records and sends out reminders{/ts}', 'civicrm_api3', 'job', 'process_pledge', 'version=3\r\n', 0),
( @domainID, 'Daily' , NULL, '{ts escape="sql" skip="true"}Address geocoder{/ts}', '{ts escape="sql" skip="true"}Goes through addresses and geocodes them (requires Geocoding API on){/ts}', 'civicrm_api3', 'job', 'geocode', 'version=3\r\n', 0),
( @domainID, 'Daily' , NULL, '{ts escape="sql" skip="true"}Greeting updater{/ts}', '{ts escape="sql" skip="true"}Goes through contact records and updates greeting settings{/ts}', 'civicrm_api3', 'job', 'update_greeting', 'version=3\r\n', 0),
( @domainID, 'Daily' , NULL, '{ts escape="sql" skip="true"}Report sender{/ts}', '{ts escape="sql" skip="true"}Generates and sends out reports via email{/ts}', 'civicrm_api3', 'job', 'mail_reports', 'version=3\r\n', 0),
( @domainID, 'Daily' , NULL, '{ts escape="sql" skip="true"}Scheduled reminders sender{/ts}', '{ts escape="sql" skip="true"}Sends out scheduled reminders via email.{/ts}', 'civicrm_api3', 'job', 'send_reminder', 'version=3\r\n', 0),
( @domainID, 'Always' , NULL, '{ts escape="sql" skip="true"}Participant status processor{/ts}','{ts escape="sql" skip="true"}Adjusts event participant statuses based on time{/ts}', 'civicrm_api3', 'job', 'process_participant', 'version=3\r\n', 0),
( @domainID, 'Always' , NULL, '{ts escape="sql" skip="true"}Membership status processor{/ts}', '{ts escape="sql" skip="true"}Adjusts event membership statuses based on time{/ts}', 'civicrm_api3', 'job', 'process_membership', 'version=3\r\n', 0),
( @domainID, 'Always' , NULL, '{ts escape="sql" skip="true"}Membership reminder date processor{/ts}','{ts escape="sql" skip="true"}Adjusts membership reminder dates based on time{/ts}', 'civicrm_api3', 'job', 'process_process_membership_reminder_date', 'version=3\r\n', 0);
--CRM 9135
ALTER TABLE civicrm_contribution_recur
ADD is_email_receipt TINYINT (4) COMMENT 'if true, receipt is automatically emailed to contact on each successful payment' AFTER payment_processor_id;
-- /***** Civicrm Multi-Event Registration ***********/
CREATE TABLE civicrm_event_carts (
id int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Cart Id',
user_id int unsigned COMMENT 'FK to civicrm_contact who created this cart',
coupon_code varchar(255) DEFAULT NULL,
completed tinyint DEFAULT 0,
PRIMARY KEY ( id ),
CONSTRAINT FK_civicrm_event_carts_user_id FOREIGN KEY (user_id)
REFERENCES civicrm_contact(id) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
CREATE TABLE civicrm_events_in_carts (
id int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Event In Cart Id',
event_id int unsigned COMMENT 'FK to Event ID',
event_cart_id int unsigned COMMENT 'FK to Event Cart ID',
PRIMARY KEY ( id ),
CONSTRAINT FK_civicrm_events_in_carts_event_id FOREIGN KEY (event_id)
REFERENCES civicrm_event(id) ON DELETE CASCADE,
CONSTRAINT FK_civicrm_events_in_carts_event_cart_id FOREIGN KEY
(event_cart_id) REFERENCES civicrm_event_carts(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
ALTER TABLE civicrm_participant
ADD discount_amount int unsigned DEFAULT 0 COMMENT 'Discount Amount';
ALTER TABLE civicrm_participant
ADD cart_id int unsigned DEFAULT NULL COMMENT 'FK to civicrm_event_carts';
ALTER TABLE civicrm_participant
ADD CONSTRAINT FK_civicrm_participant_cart_id FOREIGN KEY (cart_id)
REFERENCES civicrm_event_carts(id) ON DELETE SET NULL;
-- XXX a hint to the payment form. Can someone make this go away?
ALTER TABLE civicrm_participant
ADD must_wait TINYINT DEFAULT 0 COMMENT 'On Waiting List';
SELECT @pending_id := MAX(id) + 1 FROM civicrm_participant_status_type;
INSERT INTO civicrm_participant_status_type
(id, name, {localize field='label'}label{/localize}, class, is_reserved, is_active, is_counted, weight, visibility_id)
VALUES
(@pending_id, 'Pending in cart', {localize}'{ts escape="sql"}Pending in cart{/ts}'{/localize}, 'Pending', 1, 1, 0, @pending_id, 2 );
ALTER TABLE civicrm_event
ADD parent_event_id int unsigned DEFAULT NULL COMMENT 'Implicit FK to civicrm_event: parent event';
ALTER TABLE civicrm_event
ADD slot_label_id int unsigned DEFAULT NULL COMMENT 'Subevent slot label. Implicit FK to civicrm_option_value where option_group = conference_slot.';
INSERT INTO
`civicrm_option_group` (`name`, {localize field='label'}`label`{/localize}, {localize field='description'}`description`{/localize}, `is_reserved`, `is_active`)
VALUES
('conference_slot' , {localize}'{ts escape="sql"}Conference Slot{/ts}'{/localize}, {localize}'{ts escape="sql"}Conference Slot{/ts}'{/localize} , 1, 1);
SELECT @option_group_id_conference_slot := max(id) from civicrm_option_group where name = 'conference_slot';
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, {localize field='description'}`description`{/localize}, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
(@option_group_id_conference_slot, {localize}'{ts escape="sql"}Morning Sessions{/ts}'{/localize}, 1, '{ts escape="sql"}Morning Sessions{/ts}', NULL, 0, NULL, 1, {localize}'{ts escape="sql"}NULL{/ts}'{/localize}, 0, 0, 1, NULL, NULL),
(@option_group_id_conference_slot, {localize}'{ts escape="sql"}Evening Sessions{/ts}'{/localize}, 2, '{ts escape="sql"}Evening Sessions{/ts}', NULL, 0, NULL, 2, {localize}'{ts escape="sql"}NULL{/ts}'{/localize}, 0, 0, 1, NULL, NULL);
SELECT @msg_tpl_workflow_event := MAX(id) FROM civicrm_option_group WHERE name = 'msg_tpl_workflow_event';
SELECT @weight := MAX(weight) + 1 FROM civicrm_option_value WHERE option_group_id = @msg_tpl_workflow_event;
INSERT INTO civicrm_option_value
(option_group_id, name, {localize field='label'}label{/localize}, value, weight)
VALUES
(@msg_tpl_workflow_event, 'event_registration_receipt', {localize}'{ts escape="sql"}Events - Receipt only{/ts}'{/localize}, @weight, @weight);
{* SELECT @tpl_ovid_$vName := MAX(id) FROM civicrm_option_value WHERE option_group_id = @tpl_ogid_$gName AND name = '$vName'; *}
{* INSERT INTO civicrm_msg_template *}
-- CRM-8532
UPDATE `civicrm_dashboard` SET url = REPLACE( url, 'snippet=4', 'snippet=5' ), fullscreen_url = REPLACE( fullscreen_url, 'snippet=4', 'snippet=5' );
{if $multilingual}
{foreach from=$locales item=locale}
ALTER TABLE civicrm_option_group CHANGE label_{$locale} title_{$locale} varchar(255);
{/foreach}
{else}
ALTER TABLE civicrm_option_group CHANGE label title varchar(255);
{/if}

View file

@ -0,0 +1,12 @@
-- CRM-8356 added missing option values
SELECT @option_group_id_acConRef := max(id) from civicrm_option_group where name = 'contact_reference_options';
INSERT INTO civicrm_option_value
(option_group_id, {localize field='label'}label{/localize}, value, name, filter, weight, is_active )
VALUES
(@option_group_id_acConRef, {localize}'{ts escape="sql"}Email Address{/ts}'{/localize} , 2, 'email' , 0, 2, 1 ),
(@option_group_id_acConRef, {localize}'{ts escape="sql"}Phone{/ts}'{/localize} , 3, 'phone' , 0, 3, 1 ),
(@option_group_id_acConRef, {localize}'{ts escape="sql"}Street Address{/ts}'{/localize} , 4, 'street_address', 0, 4, 1 ),
(@option_group_id_acConRef, {localize}'{ts escape="sql"}City{/ts}'{/localize} , 5, 'city' , 0, 5, 1 ),
(@option_group_id_acConRef, {localize}'{ts escape="sql"}State/Province{/ts}'{/localize} , 6, 'state_province', 0, 6, 1 ),
(@option_group_id_acConRef, {localize}'{ts escape="sql"}Country{/ts}'{/localize} , 7, 'country' , 0, 7, 1 );

View file

@ -0,0 +1,11 @@
{if $addWightForActivity}
ALTER TABLE `civicrm_activity` ADD weight INT( 11 ) NULL DEFAULT NULL;
{/if}
-- CRM-8508
SELECT @option_group_id_cgeo := max(id) from civicrm_option_group where name = 'cg_extend_objects';
INSERT INTO civicrm_option_value
(option_group_id, {localize field='label'}label{/localize}, value, name, grouping, filter, is_default, weight, {localize field='description'}description{/localize}, is_optgroup, is_reserved, is_active, component_id, visibility_id)
VALUES
(@option_group_id_cgeo, {localize}'{ts escape="sql"}Cases{/ts}'{/localize}, 'Case', 'civicrm_case', NULL, 0, NULL, 2, {localize}'CRM_Case_PseudoConstant::caseType;'{/localize}, 0, 0, 1, NULL, NULL);

View file

@ -0,0 +1,119 @@
-- CRM-9384 Add sample CiviMail Newsletter Message Template
INSERT INTO civicrm_msg_template
(msg_title, msg_subject, msg_text, msg_html, workflow_id, is_default, is_reserved)
VALUES
('Sample CiviMail Newsletter Template', 'Sample CiviMail Newsletter', '', '<table width=612 cellpadding=0 cellspacing=0 bgcolor="#f4fff4">
<tr>
<td colspan="2" bgcolor="#ffffff" valign="middle" >
<table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td>
<a href="http://www.YOUR-SITE.org"><img src="http://drupal.demo.civicrm.org/files/garland_logo.png" border=0 alt="Replace this logo with the URL to your own"></a>
</td>
<td>&nbsp; &nbsp;</td>
<td>
<a href="http://www.YOUR-SITE.org" style="text-decoration: none;"><font size=5 face="Arial, Verdana, sans-serif" color="#8bc539">Your Newsletter Title</font></a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<!-- left column -->
<table cellpadding="10" cellspacing="0" border="0">
<tr>
<td style="font-family: Arial, Verdana, sans-serif; font-size: 12px;" >
<font face="Arial, Verdana, sans-serif" size="2" >
Greetings {literal}{contact.display_name}{/literal},
<br /><br />
This is a sample template designed to help you get started creating and sending your own CiviMail messages. This template uses an HTML layout that is generally compatible with the wide variety of email clients that your recipients might be using (e.g. Gmail, Outlook, Yahoo, etc.).
<br /><br />You can select this "Sample CiviMail Newsletter Template" from the "Use Template" drop-down in Step 3 of creating a mailing, and customize it to your needs. Then check the "Save as New Template" box on the bottom the page to save your customized version for use in future mailings.
<br /><br />The logo you use must be uploaded to your server. Copy and paste the URL path to the logo into the &lt;img src= tag in the HTML at the top. Click "Source" or the Image button if you are using the text editor.
<br /><br />
Edit the color of the links and headers using the color button or by editing the HTML.
<br /><br />
Your newsletter message and donation appeal can go here. Click the link button to <a href="#">create links</a> - remember to use a fully qualified URL starting with http:// in all your links!
<br /><br />
To use CiviMail:
<ul>
<li><a href="http://book.civicrm.org/user/initial-set-up/email-system-configuration">Configure your Email System</a>.</li>
<li>Make sure your web hosting provider allows outgoing bulk mail, and see if they have a restriction on quantity. If they don\'t allow bulk mail, consider <a href="http://wiki.civicrm.org/confluence/display/CRM/Hosting+provider+information">finding a new host</a>.</li>
</ul>
Sincerely,
<br /><br />
Your Team
</font>
</td>
</tr>
</table>
</td>
<td valign="top" bgcolor="#f3f3ff" >
<!-- right column -->
<table width=180 cellpadding=10 cellspacing=0 border=0>
<tr>
<td style="color: #000; font-family: Arial, Verdana, sans-serif; font-size: 12px;" >
<font face="Arial, Verdana, sans-serif" size="2" >
<font color="#003399"><strong>Featured Events</strong> </font><br />
Fundraising Dinner<br />
Training Meeting<br />
Board of Directors Annual Meeting<br />
<br /><br />
<font color="#003399"><strong>Community Events</strong></font><br />
Bake Sale<br />
Charity Auction<br />
Art Exhibit<br />
<br /><br />
<font color="#003399"><strong>Important Dates</strong></font><br />
Tuesday August 27<br />
Wednesday September 8<br />
Thursday September 29<br />
Saturday October 1<br />
Sunday October 20<br />
</font>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table cellpadding="10" cellspacing="0" border="0">
<tr>
<td>
<font face="Arial, Verdana, sans-serif" size="2" >
<font color="#8bc539"><strong>Helpful Tips</strong></font>
<br /><br />
<font color="#3b5187">Tokens</font><br />
Click "Insert Tokens" to dynamically insert names, addresses, and other contact data of your recipients.
<br /><br />
<font color="#3b5187">Plain Text Version</font><br />
Some people refuse HTML emails altogether. We recommend sending a plain-text version of your important communications to accommodate them. Luckily, CiviCRM accommodates for this! Just click "Plain Text" and copy and paste in some text. Line breaks (carriage returns) and fully qualified URLs like http://www.example.com are all you get, no HTML here!
<br /><br />
<font color="#3b5187">Play by the Rules</font><br />
The address of the sender is required by the Can Spam Act law. This is an available token called domain.address. An unsubscribe or opt-out link is also required. There are several available tokens for this. <em>{literal}{action.optOutUrl}{/literal}</em> creates a link for recipients to click if they want to opt out of receiving emails from your organization. <em>{literal}{action.unsubscribeUrl}{/literal}</em> creates a link to unsubscribe from the specific mailing list used to send this message. Click on "Insert Tokens" to find these and look for tokens named "Domain" or "Unsubscribe". This sample template includes both required tokens at the bottom of the message. You can also configure a default Mailing Footer containing these tokens.
<br /><br />
<font color="#3b5187">Composing Offline</font><br />
If you prefer to compose an HTML email offline in your own text editor, you can upload this HTML content into CiviMail or simply click "Source" and then copy and paste the HTML in.
<br /><br />
<font color="#3b5187">Images</font><br />
Most email clients these days (Outlook, Gmail, etc) block image loading by default. This is to protect their users from annoying or harmful email. Not much we can do about this, so encourage recipients to add you to their contacts or "whitelist". Also use images sparingly, do not rely on images to convey vital information, and always use HTML "alt" tags which describe the image content.
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" style="color: #000; font-family: Arial, Verdana, sans-serif; font-size: 10px;">
<font face="Arial, Verdana, sans-serif" size="2" >
<hr>
<a href="{literal}{action.unsubscribeUrl}{/literal}" title="click to unsubscribe">Click here</a> to unsubscribe from this mailing list.<br /><br />
Our mailing address is:<br />
{literal}{domain.address}{/literal}
</td>
</tr>
</table>', NULL, 1, 0);

View file

@ -0,0 +1,33 @@
-- Fix invalid api actions in Job table and insert missing job
UPDATE `civicrm_job`
SET api_action = 'process_membership_reminder_date' WHERE api_action = 'process_process_membership_reminder_date';
UPDATE `civicrm_job`
SET api_action = 'mail_report' WHERE api_action = 'mail_reports';
SELECT @domainID := min(id) FROM civicrm_domain;
INSERT INTO `civicrm_job`
( domain_id, run_frequency, last_run, name, description, api_prefix, api_entity, api_action, parameters, is_active )
VALUES
( @domainID, 'Always' , NULL, '{ts escape="sql" skip="true"}Process Survey Respondents{/ts}', '{ts escape="sql" skip="true"}Releases reserved survey respondents when they have been reserved for longer than the Release Frequency days specified for that survey.{/ts}','civicrm_api3', 'job', 'process_respondent','version=3\r\n', 0);
-- Job table was initially delivered with invalid and not-used parameters. Clearing them out. Most jobs do not need any parameters.
UPDATE `civicrm_job`
SET parameters = NULL;
-- Insert Schedule Jobs admin menu item
SELECT @systemSettingsID := id FROM civicrm_navigation where name = 'System Settings' AND domain_id = @domainID;
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( @domainID, 'civicrm/admin/job&reset=1', '{ts escape="sql" skip="true"}Scheduled Jobs{/ts}', 'Scheduled Jobs', 'administer CiviCRM', '', @systemSettingsID, '1', NULL, 15 );
-- CRM-9468
-- update Serbia/Montenegro provinces
UPDATE civicrm_state_province SET country_id = 1243 WHERE id = 5112;
UPDATE civicrm_state_province SET country_id = 1242 WHERE id = 5113;
UPDATE civicrm_state_province SET country_id = 1242 WHERE id = 5114;
UPDATE civicrm_state_province SET country_id = 1242 WHERE id = 5115;
-- CRM-9523
ALTER TABLE `civicrm_note` MODIFY `privacy` VARCHAR(255) COMMENT 'Foreign Key to Note Privacy Level (which is an option value pair and hence an implicit FK)';

View file

@ -0,0 +1,34 @@
-- CRM-10641 (fix duplicate option values)
SELECT @option_group_id_act := max(id) from civicrm_option_group where name = 'activity_type';
SELECT @maxValue := MAX(ROUND(value)) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act;
SELECT @clientSMSValue := value FROM civicrm_option_value WHERE name = 'BULK SMS' AND option_group_id = @option_group_id_act;
SELECT @smsVal := value FROM civicrm_option_value WHERE option_group_id = @option_group_id_act GROUP BY value
HAVING count(value) > 1 AND value = @clientSMSValue;
UPDATE civicrm_option_value
SET value = @maxValue + 1
WHERE value = @smsVal
AND name = 'BULK SMS' AND option_group_id = @option_group_id_act;
SELECT @newClientSMSValue := value FROM civicrm_option_value WHERE name = 'BULK SMS' AND option_group_id = @option_group_id_act;
UPDATE civicrm_activity
INNER JOIN civicrm_mailing ON civicrm_activity.source_record_id = civicrm_mailing.id
SET civicrm_activity.activity_type_id = @newClientSMSValue
WHERE civicrm_activity.activity_type_id = @clientSMSValue;
-- CRM-10671 remove incomplete price set reports (inserted in 4.2 alpha 1)
SELECT @option_group_id_report := MAX(id) FROM civicrm_option_group WHERE name = 'report_template';
DELETE from civicrm_option_value
WHERE name = 'CRM_Report_Form_Price_Lineitem' AND
option_group_id = @option_group_id_report;
DELETE from civicrm_option_value
WHERE name = 'CRM_Report_Form_Price_Contributionbased' AND
option_group_id = @option_group_id_report;
DELETE from civicrm_option_value
WHERE name = 'CRM_Report_Form_Price_Lineitemparticipant' AND
option_group_id = @option_group_id_report;

View file

@ -0,0 +1,4 @@
-- CRM-10794
DELETE FROM civicrm_payment_processor_type WHERE name = 'ClickAndPledge';
DELETE FROM civicrm_payment_processor WHERE payment_processor_type = 'ClickAndPledge';

View file

@ -0,0 +1,21 @@
-- CRM-10810
SELECT @max_strict := max(id), @cnt_strict := count(*) FROM `civicrm_dedupe_rule_group` WHERE `contact_type` = 'Individual' AND `level` = 'Strict' AND `is_default` = 1;
UPDATE `civicrm_dedupe_rule_group` SET `is_default` = 0 WHERE @cnt_strict > 1 AND id = @max_strict;
SELECT @max_fuzzy := max(id), @cnt_fuzzy := count(*) FROM `civicrm_dedupe_rule_group` WHERE `contact_type` = 'Individual' AND `level` = 'Fuzzy' AND `is_default` = 1;
UPDATE `civicrm_dedupe_rule_group` SET `is_default` = 0 WHERE @cnt_fuzzy > 1 AND id = @max_fuzzy;
-- Insert line items for contribution for api/import
SELECT @fieldID := cpf.id, @fieldValueID := cpfv.id FROM civicrm_price_set cps
LEFT JOIN civicrm_price_field cpf ON cps.id = cpf.price_set_id
LEFT JOIN civicrm_price_field_value cpfv ON cpf.id = cpfv.price_field_id
WHERE cps.name = 'default_contribution_amount';
INSERT INTO civicrm_line_item ( entity_table, entity_id, price_field_id,label, qty, unit_price, line_total, participant_count, price_field_value_id )
SELECT 'civicrm_contribution', cc.id, @fieldID, 'Contribution Amount', 1, total_amount, total_amount , 0, @fieldValueID
FROM `civicrm_contribution` cc
LEFT JOIN civicrm_line_item cli ON cc.id=cli.entity_id and cli.entity_table = 'civicrm_contribution'
LEFT JOIN civicrm_membership_payment cmp ON cc.id = cmp.contribution_id
LEFT JOIN civicrm_participant_payment cpp ON cc.id = cpp.contribution_id
WHERE cli.entity_id IS NULL AND cc.contribution_page_id IS NULL AND cmp.contribution_id IS NULL AND cpp.contribution_id IS NULL
GROUP BY cc.id;

View file

@ -0,0 +1,49 @@
-- CRM-10969
SELECT @mailingsID := MAX(id) FROM civicrm_navigation WHERE name = 'Mailings' AND domain_id = {$domainID};
SELECT @navWeight := MAX(id) FROM civicrm_navigation WHERE name = 'New SMS' AND parent_id = @mailingsID;
UPDATE civicrm_navigation SET has_separator = NULL
WHERE name = 'New SMS' AND parent_id = @mailingsID AND has_separator = 1;
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/mailing/browse?reset=1&sms=1', '{ts escape="sql" skip="true"}Find Mass SMS{/ts}', 'Find Mass SMS', 'administer CiviCRM', NULL, @mailingsID, '1', 1, @navWeight+1 );
-- CRM-10980 and CRM-11014
SELECT @optionID := max(id) FROM civicrm_option_value WHERE name = 'BULK SMS';
{if $multilingual}
{foreach from=$locales item=locale}
UPDATE `civicrm_option_value` SET label_{$locale} = '{ts escape="sql"}Mass SMS{/ts}',name = 'Mass SMS',description_{$locale} = '{ts escape="sql"}Mass SMS{/ts}' WHERE id = @optionID;
ALTER TABLE `civicrm_price_field_value` CHANGE name name VARCHAR(255) NULL DEFAULT NULL, CHANGE label_{$locale} label_{$locale} VARCHAR(255) NULL DEFAULT NULL;
{/foreach}
{else}
UPDATE `civicrm_option_value` SET label = '{ts escape="sql"}Mass SMS{/ts}',name = 'Mass SMS',description = '{ts escape="sql"}Mass SMS{/ts}' WHERE name = 'BULK SMS';
ALTER TABLE `civicrm_price_field_value` CHANGE `name` `name` VARCHAR(255) NULL DEFAULT NULL, CHANGE `label` `label` VARCHAR(255) NULL DEFAULT NULL;
{/if}
-- CRM-11014
ALTER TABLE `civicrm_line_item` CHANGE `label` `label` VARCHAR(255) NULL DEFAULT NULL;
-- CRM-10986: Rename Batches UI elements to Bulk Data Entry
-- update reserved profile titles
{if $multilingual}
{foreach from=$locales item=locale}
UPDATE `civicrm_uf_group` SET title_{$locale} = '{ts escape="sql"}Contribution Bulk Entry{/ts}' WHERE name = 'contribution_batch_entry';
UPDATE `civicrm_uf_group` SET title_{$locale} = '{ts escape="sql"}Membership Bulk Entry{/ts}' WHERE name = 'membership_batch_entry';
{/foreach}
{else}
UPDATE `civicrm_uf_group` SET title = '{ts escape="sql"}Contribution Bulk Entry{/ts}' WHERE name = 'contribution_batch_entry';
UPDATE `civicrm_uf_group` SET title = '{ts escape="sql"}Membership Bulk Entry{/ts}' WHERE name = 'membership_batch_entry';
{/if}
-- update navigation menu items and fix typo in permission column
UPDATE `civicrm_navigation` SET label = '{ts escape="sql"}Bulk Data Entry{/ts}', name = 'Bulk Data Entry',
permission = 'access CiviMember, access CiviContribute'
WHERE url = 'civicrm/batch&reset=1';
-- CRM-11018
ALTER TABLE civicrm_discount DROP FOREIGN KEY FK_civicrm_discount_option_group_id;
ALTER TABLE `civicrm_discount`
ADD CONSTRAINT `FK_civicrm_discount_option_group_id` FOREIGN KEY (`option_group_id`) REFERENCES `civicrm_price_set` (`id`) ON DELETE CASCADE;
ALTER TABLE `civicrm_discount` CHANGE `option_group_id` `option_group_id` int(10) unsigned NOT NULL COMMENT 'FK to civicrm_price_set';

View file

@ -0,0 +1,10 @@
-- Placeholder which ensures that PHP upgrade tasks are executed
-- Get domain id
SELECT @domainID := min(id) FROM civicrm_domain;
-- CRM-11060
INSERT INTO `civicrm_job`
( domain_id, run_frequency, last_run, name, description, api_prefix, api_entity, api_action, parameters, is_active )
VALUES
( @domainID, 'Always' , NULL, '{ts escape="sql" skip="true"}Send Scheduled SMS{/ts}', '{ts escape="sql" skip="true"}Sends out scheduled SMS{/ts}', 'civicrm_api3', 'job', 'process_sms', NULL, 0);

View file

@ -0,0 +1,2 @@
-- Placeholder which ensures that PHP upgrade tasks are executed

View file

@ -0,0 +1,15 @@
-- CRM-11354 Fix empty permissions for report instances
UPDATE civicrm_report_instance SET permission = 'access CiviReport'
WHERE report_id = 'survey/detail' and permission = '';
UPDATE civicrm_report_instance SET permission = 'access CiviMail'
WHERE report_id = 'mailing/detail' and permission = '';
UPDATE civicrm_report_instance SET permission = 'access CiviMember'
WHERE report_id = 'member/contributionDetail' and permission = '';
UPDATE civicrm_report_instance SET permission = 'access CiviGrant'
WHERE report_id = 'grant/statistics' and permission = '';
UPDATE civicrm_report_instance SET permission = 'access CiviReport'
WHERE permission = '0' OR permission = '' OR permission IS NULL;

View file

@ -0,0 +1,2 @@
-- Placeholder which ensures that PHP upgrade tasks are executed

View file

@ -0,0 +1,2 @@
-- Placeholder which ensures that PHP upgrade tasks are executed

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,9 @@
{include file='../CRM/Upgrade/4.2.alpha2.msg_template/civicrm_msg_template.tpl'}
-- CRM-10326
DELETE FROM `civicrm_price_set_entity` WHERE entity_table = "civicrm_contribution" or entity_table = "civicrm_participant";
-- When deleting saved searches, null-out references from groups
ALTER TABLE civicrm_group ADD CONSTRAINT `FK_civicrm_group_saved_search_id`
FOREIGN KEY (`saved_search_id`) REFERENCES `civicrm_saved_search` (`id`)
ON DELETE SET NULL;

View file

@ -0,0 +1,2 @@
{include file='../CRM/Upgrade/4.2.alpha3.msg_template/civicrm_msg_template.tpl'}

View file

@ -0,0 +1,37 @@
-- /*******************************************************
-- * CRM-10477 - Extensions updates
-- *******************************************************/
CREATE TABLE `civicrm_extension` (
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Local Extension ID',
`type` enum('payment', 'search', 'report', 'module') NOT NULL ,
`full_name` varchar(255) NOT NULL COMMENT 'Fully qualified extension name',
`name` varchar(255) COMMENT 'Short name',
`label` varchar(255) COMMENT 'Short, printable name',
`file` varchar(255) COMMENT 'Primary PHP file',
`schema_version` varchar(63) COMMENT 'Revision code of the database schema; the format is module-defined',
`is_active` tinyint DEFAULT 1 COMMENT 'Is this extension active?' ,
PRIMARY KEY ( `id` ) ,
UNIQUE INDEX `UI_extension_full_name`(
`full_name`
),
INDEX `UI_extension_name`(
`name`
)
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
-- assuming first value of array $locales is always en_US
{if $multilingual}
INSERT INTO civicrm_extension (label, full_name, name, type, file, is_active)
SELECT ov.label_{$locales.0}, ov.value, ov.name, ov.grouping, ov.description_{$locales.0}, ov.is_active
FROM civicrm_option_group og
INNER JOIN civicrm_option_value ov ON og.id = ov.option_group_id
WHERE og.name = "system_extensions";
{else}
INSERT INTO civicrm_extension (label, full_name, name, type, file, is_active)
SELECT ov.label, ov.value, ov.name, ov.grouping, ov.description, ov.is_active
FROM civicrm_option_group og
INNER JOIN civicrm_option_value ov ON og.id = ov.option_group_id
WHERE og.name = "system_extensions";
{/if}
DELETE FROM civicrm_option_group WHERE name = "system_extensions";
-- Note: Deletion cascades to civicrm_option_value

View file

@ -0,0 +1 @@
-- Placeholder which ensures that PHP upgrade tasks are executed

View file

@ -0,0 +1,2 @@
{include file='../CRM/Upgrade/4.2.beta3.msg_template/civicrm_msg_template.tpl'}

View file

@ -0,0 +1 @@
-- Placeholder which ensures that PHP upgrade tasks are executed

View file

@ -0,0 +1,23 @@
-- FIXME: the final release version is uncertain -- could 4.2.0 or 4.2.1; make sure this fixed before merging
-- CRM-10660
CREATE TABLE `civicrm_managed` (
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Surrogate Key',
`module` varchar(127) NOT NULL COMMENT 'Name of the module which declared this object',
`name` varchar(127) COMMENT 'Symbolic name used by the module to identify the object',
`entity_type` varchar(64) NOT NULL COMMENT 'API entity type',
`entity_id` int unsigned NOT NULL COMMENT 'Foreign key to the referenced item.',
PRIMARY KEY ( `id` )
, INDEX `UI_managed_module_name`(
`module`
, `name`
)
, INDEX `UI_managed_entity`(
`entity_type`
, `entity_id`
)
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ;

View file

@ -0,0 +1,2 @@
-- CRM-12290
UPDATE civicrm_currency SET symbol = 'N$' WHERE name = 'NAD';

View file

@ -0,0 +1,21 @@
-- CRM-12351
UPDATE civicrm_dedupe_rule_group SET title = name WHERE title IS NULL;
-- CRM-12373
SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Dns';
INSERT INTO civicrm_mailing_bounce_pattern (bounce_type_id, pattern)
VALUES
(@bounceTypeID, 'Host or domain name not found');
SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Host';
INSERT INTO civicrm_mailing_bounce_pattern (bounce_type_id, pattern)
VALUES
(@bounceTypeID, 'lost connection'),
(@bounceTypeID, 'conversation with [^ ]* timed out while');
SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Relay';
INSERT INTO civicrm_mailing_bounce_pattern (bounce_type_id, pattern)
VALUES
(@bounceTypeID, 'No route to host'),
(@bounceTypeID, 'Network is unreachable');

View file

@ -0,0 +1 @@
{* placeholder file for upgrade*}

View file

@ -0,0 +1,2 @@
-- CRM-12501
ALTER TABLE civicrm_financial_account CHANGE `tax_rate` `tax_rate` DECIMAL( 10, 8 ) NULL DEFAULT NULL COMMENT 'The percentage of the total_amount that is due for this tax.';

View file

@ -0,0 +1,109 @@
{* file to handle db changes in 4.3.4 during upgrade*}
-- CRM-12466
INSERT INTO
civicrm_option_group (name, {localize field='title'}title{/localize}, is_reserved, is_active)
VALUES
('contact_smart_group_display', {localize}'{ts escape="sql"}Contact Smart Group View Options{/ts}'{/localize}, 1, 1);
SELECT @option_group_id_csgOpt := max(id) FROM civicrm_option_group WHERE name = 'contact_smart_group_display';
INSERT INTO
civicrm_option_value (option_group_id, {localize field='label'}label{/localize}, value, name, grouping, filter,
is_default, weight)
VALUES
(@option_group_id_csgOpt, {localize}'Show Smart Groups on Demand'{/localize}, 1, 'showondemand', NULL, 0, 0, 1),
(@option_group_id_csgOpt, {localize}'Always Show Smart Groups'{/localize}, 2, 'alwaysshow', NULL, 0, 0, 2),
(@option_group_id_csgOpt, {localize}'Hide Smart Groups'{/localize}, 3, 'hide' , NULL, 0, 0, 3);
INSERT INTO civicrm_setting
(domain_id, contact_id, is_domain, group_name, name, value)
VALUES
({$domainID}, NULL, 1, 'CiviCRM Preferences', 'contact_smart_group_display', '{serialize}1{/serialize}');
-- CRM-12665 remove options groups
DELETE cov, cog FROM civicrm_option_group cog
INNER JOIN civicrm_option_value cov ON cov.option_group_id = cog.id
WHERE cog.name IN ('grant_program_status', 'allocation_algorithm');
-- CRM-12470
UPDATE civicrm_financial_account
SET is_default = 1
WHERE name IN ('Premiums', 'Banking Fees', 'Accounts Payable', 'Donation');
SELECT @option_group_id_arel := max(id) from civicrm_option_group where name = 'account_relationship';
SELECT @option_group_id_fat := max(id) from civicrm_option_group where name = 'financial_account_type';
SELECT @domainContactId := contact_id from civicrm_domain where id = {$domainID};
-- for Accounts Receivable Account is
SELECT @option_value_rel_id_ar := value FROM civicrm_option_value WHERE option_group_id = @option_group_id_arel AND name = 'Accounts Receivable Account is';
SELECT @arAccount := id FROM civicrm_financial_account WHERE name = 'accounts receivable';
SELECT @arAccountEntity := financial_account_id FROM civicrm_entity_financial_account
WHERE account_relationship = @option_value_rel_id_ar AND entity_table = 'civicrm_financial_type' LIMIT 1;
INSERT INTO civicrm_entity_financial_account(entity_table, entity_id, account_relationship, financial_account_id)
SELECT 'civicrm_financial_type', cft.id, @option_value_rel_id_ar, IFNULL(@arAccount, @arAccountEntity)
FROM civicrm_financial_type cft
LEFT JOIN civicrm_entity_financial_account ceft
ON ceft.entity_id = cft.id AND ceft.account_relationship = @option_value_rel_id_ar AND ceft.entity_table = 'civicrm_financial_type'
WHERE ceft.entity_id IS NULL;
-- for income account is
SELECT @option_value_rel_id := value FROM civicrm_option_value WHERE option_group_id = @option_group_id_arel AND name = 'Income Account is';
SELECT @opval := value FROM civicrm_option_value WHERE name = 'Revenue' and option_group_id = @option_group_id_fat;
-- create FA if not exists with same name as financial type
INSERT INTO civicrm_financial_account (name, contact_id, financial_account_type_id, description, account_type_code, is_active)
SELECT cft.name, @domainContactId, @opval, cft.name as description, 'INC', 1
FROM civicrm_financial_type cft
LEFT JOIN civicrm_entity_financial_account ceft
ON ceft.entity_id = cft.id AND ceft.account_relationship = @option_value_rel_id AND ceft.entity_table = 'civicrm_financial_type'
LEFT JOIN civicrm_financial_account ca ON ca.name = cft.name
WHERE ceft.entity_id IS NULL AND ca.id IS NULL;
INSERT INTO civicrm_entity_financial_account(entity_table, entity_id, account_relationship, financial_account_id)
SELECT 'civicrm_financial_type', cft.id, @option_value_rel_id, ca.id
FROM civicrm_financial_type cft
LEFT JOIN civicrm_entity_financial_account ceft
ON ceft.entity_id = cft.id AND ceft.account_relationship = @option_value_rel_id AND ceft.entity_table = 'civicrm_financial_type'
LEFT JOIN civicrm_financial_account ca ON ca.name = cft.name
WHERE ceft.entity_id IS NULL;
-- for cost of sales
SELECT @option_value_rel_id_cg := value FROM civicrm_option_value WHERE option_group_id = @option_group_id_arel AND name = 'Cost of Sales Account is';
SELECT @opCost := value FROM civicrm_option_value WHERE name = 'Cost of Sales' and option_group_id = @option_group_id_fat;
SELECT @financialAccountId := id FROM civicrm_financial_account WHERE is_default = 1 and financial_account_type_id = @opCost;
-- CRM-13231
INSERT IGNORE INTO civicrm_financial_account (id, name, contact_id, financial_account_type_id, description, account_type_code, accounting_code, is_active, is_default)
VALUES (@financialAccountId, 'Premiums', @domainContactId, @opCost, 'Account to record cost of premiums provided to payors', 'COGS', '5100', 1, 1);
SELECT @financialAccountId := id FROM civicrm_financial_account WHERE is_default = 1 and financial_account_type_id = @opCost;
INSERT INTO civicrm_entity_financial_account(entity_table, entity_id, account_relationship, financial_account_id)
SELECT 'civicrm_financial_type', cft.id, @option_value_rel_id_cg, @financialAccountId
FROM civicrm_financial_type cft
LEFT JOIN civicrm_entity_financial_account ceft
ON ceft.entity_id = cft.id AND ceft.account_relationship = @option_value_rel_id_cg AND ceft.entity_table = 'civicrm_financial_type'
WHERE ceft.entity_id IS NULL;
-- for Expense Account is
SELECT @option_value_rel_id_exp := value FROM civicrm_option_value WHERE option_group_id = @option_group_id_arel AND name = 'Expense Account is';
SELECT @opexp := value FROM civicrm_option_value WHERE name = 'Expenses' and option_group_id = @option_group_id_fat;
SET @financialAccountId := '';
SELECT @financialAccountId := id FROM civicrm_financial_account WHERE is_default = 1 and financial_account_type_id = @opexp;
-- CRM-13231
INSERT IGNORE INTO civicrm_financial_account (id, name, contact_id, financial_account_type_id, description, account_type_code, accounting_code, is_active, is_default)
VALUES (@financialAccountId, 'Banking Fees', @domainContactId, @opexp, 'Payment processor fees and manually recorded banking fees', 'EXP', '5200', 1, 1);
SELECT @financialAccountId := id FROM civicrm_financial_account WHERE is_default = 1 and financial_account_type_id = @opexp;
INSERT INTO civicrm_entity_financial_account(entity_table, entity_id, account_relationship, financial_account_id)
SELECT 'civicrm_financial_type', cft.id, @option_value_rel_id_exp, @financialAccountId
FROM civicrm_financial_type cft
LEFT JOIN civicrm_entity_financial_account ceft
ON ceft.entity_id = cft.id AND ceft.account_relationship = @option_value_rel_id_exp AND ceft.entity_table = 'civicrm_financial_type'
WHERE ceft.entity_id IS NULL;

View file

@ -0,0 +1,11 @@
{* file to handle db changes in 4.3.5 during upgrade*}
{include file='../CRM/Upgrade/4.3.5.msg_template/civicrm_msg_template.tpl'}
-- CRM-12799
DROP TABLE IF EXISTS civicrm_payment;
-- CRM-12929
INSERT INTO civicrm_setting
(domain_id, contact_id, is_domain, group_name, name, value)
VALUES
({$domainID}, NULL, 1, 'CiviCRM Preferences', 'allowPermDeleteFinancial', '{serialize}0{/serialize}');

View file

@ -0,0 +1,96 @@
{* file to handle db changes in 4.3.6 during upgrade *}
-- CRM-13060
UPDATE civicrm_price_set_entity cpse
LEFT JOIN civicrm_price_set cps ON cps.id = cpse.price_set_id
LEFT JOIN civicrm_price_field cpf ON cps.id = cpf.price_set_id
LEFT JOIN civicrm_price_field_value cpfv ON cpf.id = cpfv.price_field_id
LEFT JOIN civicrm_event ce ON cpse.entity_id = ce.id AND cpse.entity_table = 'civicrm_event'
LEFT JOIN civicrm_contribution_page ccg ON cpse.entity_id = ccg.id AND cpse.entity_table = 'civicrm_contribution_page'
SET cpfv.financial_type_id = CASE
WHEN ce.id IS NOT NULL
THEN ce.financial_type_id
WHEN ccg.id IS NOT NULL
THEN ccg.financial_type_id
END,
cps.financial_type_id = CASE
WHEN ce.id IS NOT NULL
THEN ce.financial_type_id
WHEN ccg.id IS NOT NULL
THEN ccg.financial_type_id
END
WHERE cps.is_quick_config = 1;
-- CRM-12844
-- DELETE bad data
DELETE cli FROM `civicrm_contribution` cc
LEFT JOIN civicrm_line_item cli ON cli.entity_id = cc.id
LEFT JOIN civicrm_financial_item cfi ON cfi.entity_id = cli.id AND cfi.entity_table = 'civicrm_line_item'
LEFT JOIN civicrm_price_field cpf ON cpf.id = cli.price_field_id
LEFT JOIN civicrm_price_set cps ON cps.id = cpf.price_set_id
WHERE cc.contribution_recur_id IS NOT NULL
AND cli.entity_table = 'civicrm_contribution' AND cfi.id IS NULL
AND cps.is_quick_config = 1;
-- Set from_financial_account_id to null
UPDATE `civicrm_contribution` cc
LEFT JOIN civicrm_entity_financial_trxn ceft ON ceft.entity_id = cc.id
LEFT JOIN civicrm_financial_trxn cft ON cft.id = ceft.financial_trxn_id
LEFT JOIN civicrm_entity_financial_trxn ceft1 ON ceft1.financial_trxn_id = ceft.financial_trxn_id
LEFT JOIN civicrm_financial_item cfi ON cfi.id = ceft1.entity_id
LEFT JOIN civicrm_entity_financial_account cefa ON cefa.entity_id = cft.payment_processor_id
SET cft.from_financial_account_id = NULL
WHERE ceft.entity_table = 'civicrm_contribution' AND cc.contribution_recur_id IS NOT NULL
AND ceft1.entity_table = 'civicrm_financial_item' AND cft.id IS NOT NULL AND cft.payment_instrument_id = 1 AND cfi.entity_table = 'civicrm_line_item' AND cft.from_financial_account_id IS NOT NULL
AND cefa.entity_table = 'civicrm_payment_processor' AND cefa.financial_account_id = cft.to_financial_account_id;
-- CRM-13096
DROP TABLE IF EXISTS civicrm_official_receipt;
-- CRM-13231
SELECT @option_group_id_arel := max(id) from civicrm_option_group where name = 'account_relationship';
SELECT @option_group_id_fat := max(id) from civicrm_option_group where name = 'financial_account_type';
SELECT @opexp := value FROM civicrm_option_value WHERE name = 'Expenses' and option_group_id = @option_group_id_fat;
SELECT @financialAccountId := id FROM civicrm_financial_account WHERE is_default = 1 and financial_account_type_id = @opexp;
SELECT @domainContactId := contact_id from civicrm_domain where id = {$domainID};
SELECT @option_value_rel_id_exp := value FROM civicrm_option_value WHERE option_group_id = @option_group_id_arel AND name = 'Expense Account is';
INSERT IGNORE INTO civicrm_financial_account (id, name, contact_id, financial_account_type_id, description, account_type_code, accounting_code, is_active, is_default)
VALUES (@financialAccountId, 'Banking Fees', @domainContactId, @opexp, 'Payment processor fees and manually recorded banking fees', 'EXP', '5200', 1, 1);
SELECT @financialAccountId := id FROM civicrm_financial_account WHERE is_default = 1 and financial_account_type_id = @opexp;
INSERT INTO civicrm_entity_financial_account(entity_table, entity_id, account_relationship, financial_account_id)
SELECT 'civicrm_financial_type', cft.id, @option_value_rel_id_exp, @financialAccountId
FROM civicrm_financial_type cft
LEFT JOIN civicrm_entity_financial_account ceft
ON ceft.entity_id = cft.id AND ceft.account_relationship = @option_value_rel_id_exp AND ceft.entity_table = 'civicrm_financial_type'
WHERE ceft.entity_id IS NULL;
UPDATE civicrm_financial_trxn cft
INNER JOIN civicrm_entity_financial_trxn ceft ON ceft.financial_trxn_id = cft .id
INNER JOIN civicrm_entity_financial_trxn ceft1 ON ceft1.financial_trxn_id = cft .id
INNER JOIN civicrm_financial_item cfi ON cfi.id = ceft1.entity_id
INNER JOIN civicrm_contribution cc ON cc.id = ceft.entity_id
INNER JOIN civicrm_entity_financial_account cefa ON cefa.entity_id = cc.financial_type_id
SET cft.to_financial_account_id = cefa.financial_account_id
WHERE ceft.entity_table = 'civicrm_contribution' AND ceft1.entity_table = 'civicrm_financial_item' AND cfi.entity_table = 'civicrm_financial_trxn' AND cft.to_financial_account_id IS NULL AND cefa.entity_table = 'civicrm_financial_type' AND cefa.account_relationship = @option_value_rel_id_exp;
-- Add COGS account relationship
SELECT @option_value_rel_id_cg := value FROM civicrm_option_value WHERE option_group_id = @option_group_id_arel AND name = 'Cost of Sales Account is';
SELECT @opCost := value FROM civicrm_option_value WHERE name = 'Cost of Sales' and option_group_id = @option_group_id_fat;
SET @financialAccountId := '';
SELECT @financialAccountId := id FROM civicrm_financial_account WHERE is_default = 1 and financial_account_type_id = @opCost;
-- CRM-13231
INSERT IGNORE INTO civicrm_financial_account (id, name, contact_id, financial_account_type_id, description, account_type_code, accounting_code, is_active, is_default)
VALUES (@financialAccountId, 'Premiums', @domainContactId, @opCost, 'Account to record cost of premiums provided to payors', 'COGS', '5100', 1, 1);
SELECT @financialAccountId := id FROM civicrm_financial_account WHERE is_default = 1 and financial_account_type_id = @opCost;
INSERT INTO civicrm_entity_financial_account(entity_table, entity_id, account_relationship, financial_account_id)
SELECT 'civicrm_financial_type', cft.id, @option_value_rel_id_cg, @financialAccountId
FROM civicrm_financial_type cft
LEFT JOIN civicrm_entity_financial_account ceft
ON ceft.entity_id = cft.id AND ceft.account_relationship = @option_value_rel_id_cg AND ceft.entity_table = 'civicrm_financial_type'
WHERE ceft.entity_id IS NULL;

View file

@ -0,0 +1 @@
{* file to handle db changes in 4.3.7 during upgrade *}

View file

@ -0,0 +1 @@
{* file to handle db changes in 4.3.8 during upgrade *}

View file

@ -0,0 +1 @@
{* file to handle db changes in 4.3.9 during upgrade *}

View file

@ -0,0 +1,876 @@
{include file='../CRM/Upgrade/4.3.alpha1.msg_template/civicrm_msg_template.tpl'}
-- CRM-10999
ALTER TABLE `civicrm_premiums`
ADD COLUMN `premiums_nothankyou_position` int(10) unsigned DEFAULT '1';
-- CRM-11514 if contribution type name is null, assign it a name
UPDATE civicrm_contribution_type
SET name = CONCAT('Unknown_', id)
WHERE name IS NULL OR TRIM(name) = '';
-- CRM-8507
ALTER TABLE civicrm_custom_field
ADD UNIQUE INDEX `UI_name_custom_group_id` (`name`, `custom_group_id`);
--CRM-10473 Added Missing Provinces of Ningxia Autonomous Region of China
INSERT INTO `civicrm_state_province`(`country_id`, `abbreviation`, `name`) VALUES
(1045, 'YN', 'Yinchuan'),
(1045, 'SZ', 'Shizuishan'),
(1045, 'WZ', 'Wuzhong'),
(1045, 'GY', 'Guyuan'),
(1045, 'ZW', 'Zhongwei');
-- CRM-10553
ALTER TABLE civicrm_contact
ADD COLUMN `created_date` timestamp NULL DEFAULT NULL
COMMENT 'When was the contact was created.';
ALTER TABLE civicrm_contact
ADD COLUMN `modified_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
COMMENT 'When was the contact (or closely related entity) was created or modified or deleted.';
-- CRM-10296
DELETE FROM civicrm_job WHERE `api_action` = 'process_membership_reminder_date';
ALTER TABLE civicrm_membership DROP COLUMN reminder_date;
ALTER TABLE civicrm_membership_log DROP COLUMN renewal_reminder_date;
ALTER TABLE civicrm_membership_type
DROP COLUMN renewal_reminder_day,
DROP FOREIGN KEY FK_civicrm_membership_type_renewal_msg_id,
DROP INDEX FK_civicrm_membership_type_renewal_msg_id,
DROP COLUMN renewal_msg_id,
DROP COLUMN autorenewal_msg_id;
-- CRM-10738
ALTER TABLE civicrm_msg_template
CHANGE msg_text msg_text LONGTEXT NULL COMMENT 'Text formatted message',
CHANGE msg_html msg_html LONGTEXT NULL COMMENT 'HTML formatted message';
-- CRM-10860
ALTER TABLE civicrm_contribution_page ADD COLUMN is_recur_installments tinyint(4) DEFAULT '0';
UPDATE civicrm_contribution_page SET is_recur_installments='1';
-- CRM-10863
SELECT @country_id := id from civicrm_country where name = 'Luxembourg' AND iso_code = 'LU';
INSERT IGNORE INTO `civicrm_state_province`(`country_id`, `abbreviation`, `name`) VALUES
(@country_id, 'L', 'Luxembourg');
-- CRM-10899 and CRM-10999
{if $multilingual}
{foreach from=$locales item=locale}
UPDATE civicrm_option_group SET title_{$locale} = '{ts escape="sql"}Currencies Enabled{/ts}' WHERE name = "currencies_enabled";
ALTER TABLE `civicrm_premiums`
ADD COLUMN premiums_nothankyou_label_{$locale} varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Label displayed for No Thank-you option in premiums block (e.g. No thank you)';
{/foreach}
{else}
UPDATE civicrm_option_group SET title = '{ts escape="sql"}Currencies Enabled{/ts}' WHERE name = "currencies_enabled";
{/if}
-- CRM-11047
ALTER TABLE civicrm_job DROP COLUMN api_prefix;
-- CRM-11068, CRM-10678, CRM-11759
ALTER TABLE civicrm_group
ADD refresh_date datetime default NULL COMMENT 'Date and time when we need to refresh the cache next.' AFTER `cache_date`,
ADD COLUMN `created_id` INT(10) unsigned DEFAULT NULL COMMENT 'FK to contact table, creator of the group.';
-- CRM-11759
ALTER TABLE civicrm_group
ADD CONSTRAINT `FK_civicrm_group_created_id` FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL;
INSERT INTO `civicrm_job`
( domain_id, run_frequency, last_run, name, description, api_entity, api_action, parameters, is_active )
VALUES
( {$domainID}, 'Always' , NULL, '{ts escape="sql" skip="true"}Rebuild Smart Group Cache{/ts}', '{ts escape="sql" skip="true"}Rebuilds the smart group cache.{/ts}', 'job', 'group_rebuild', '{ts escape="sql" skip="true"}limit=Number optional-Limit the number of smart groups rebuild{/ts}', 0),
( {$domainID}, 'Daily' , NULL, '{ts escape="sql" skip="true"}Validate Email Address from Mailings.{/ts}', '{ts escape="sql" skip="true"}Updates the reset_date on an email address to indicate that there was a valid delivery to this email address.{/ts}', 'mailing', 'update_email_resetdate', '{ts escape="sql" skip="true"}minDays, maxDays=Consider mailings that have completed between minDays and maxDays{/ts}', 0);
-- CRM-11117
INSERT IGNORE INTO `civicrm_setting` (`group_name`, `name`, `value`, `domain_id`, `is_domain`) VALUES ('CiviCRM Preferences', 'activity_assignee_notification_ics', 's:1:"0";', {$domainID}, '1');
-- CRM-10885
ALTER TABLE civicrm_dedupe_rule_group
ADD used enum('Unsupervised','Supervised','General') COLLATE utf8_unicode_ci NOT NULL COMMENT 'Whether the rule should be used for cases where usage is Unsupervised, Supervised OR General(programatically)' AFTER threshold;
UPDATE civicrm_dedupe_rule_group
SET used = 'General' WHERE is_default = 0;
UPDATE civicrm_dedupe_rule_group
SET used = CASE level
WHEN 'Fuzzy' THEN 'Supervised'
WHEN 'Strict' THEN 'Unsupervised'
END
WHERE is_default = 1;
UPDATE civicrm_dedupe_rule_group
SET name = CONCAT_WS('', `contact_type`, `used`)
WHERE is_default = 1 OR is_reserved = 1;
UPDATE civicrm_dedupe_rule_group
SET title = 'Name and Email'
WHERE contact_type IN ('Organization', 'Household') AND used IN ('Unsupervised', 'Supervised');
UPDATE civicrm_dedupe_rule_group
SET title = CASE used
WHEN 'Supervised' THEN 'Name and Email (reserved)'
WHEN 'Unsupervised' THEN 'Email (reserved)'
WHEN 'General' THEN 'Name and Address (reserved)'
END
WHERE contact_type = 'Individual' AND is_reserved = 1;
ALTER TABLE civicrm_dedupe_rule_group DROP COLUMN level;
-- CRM-10771
ALTER TABLE civicrm_uf_field
ADD `is_multi_summary` tinyint(4) DEFAULT '0' COMMENT 'Include in multi-record listing?';
-- CRM-1115
-- note that country names are not translated in the DB
SELECT @region_id := max(id) from civicrm_worldregion where name = "Europe and Central Asia";
INSERT IGNORE INTO civicrm_country (name,iso_code,region_id,is_province_abbreviated) VALUES("Kosovo", "XK", @region_id, 0);
UPDATE civicrm_country SET name = 'Libya' WHERE name LIKE 'Libyan%';
UPDATE civicrm_country SET name = 'Congo, Republic of the' WHERE name = 'Congo';
-- CRM-10621 Add component report links to reports menu for upgrade
SELECT @reportlastID := MAX(id) FROM civicrm_navigation where name = 'Reports' AND domain_id = {$domainID};
SELECT @max_weight := MAX(ROUND(weight)) from civicrm_navigation WHERE parent_id = @reportlastID;
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/report/list&compid=99&reset=1', '{ts escape="sql" skip="true"}Contact Reports{/ts}', 'Contact Reports', 'administer CiviCRM', '', @reportlastID, '1', 0, (SELECT @max_weight := @max_weight+1) );
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/report/list&compid=2&reset=1', '{ts escape="sql" skip="true"}Contribution Reports{/ts}', 'Contribution Reports', 'access CiviContribute', '', @reportlastID, '1', 0, (SELECT @max_weight := @max_weight+1) );
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/report/list&compid=6&reset=1', '{ts escape="sql" skip="true"}Pledge Reports{/ts}', 'Pledge Reports', 'access CiviPledge', '', @reportlastID, '1', 0, (SELECT @max_weight := @max_weight+1) );
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/report/list&compid=1&reset=1', '{ts escape="sql" skip="true"}Event Reports{/ts}', 'Event Reports', 'access CiviEvent', '', @reportlastID, '1', 0, (SELECT @max_weight := @max_weight+1));
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/report/list&compid=4&reset=1', '{ts escape="sql" skip="true"}Mailing Reports{/ts}', 'Mailing Reports', 'access CiviMail', '', @reportlastID, '1', 0, (SELECT @max_weight := @max_weight+1));
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/report/list&compid=3&reset=1', '{ts escape="sql" skip="true"}Membership Reports{/ts}', 'Membership Reports', 'access CiviMember', '', @reportlastID, '1', 0, (SELECT @max_weight := @max_weight+1));
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/report/list&compid=9&reset=1', '{ts escape="sql" skip="true"}Campaign Reports{/ts}', 'Campaign Reports', 'interview campaign contacts,release campaign contacts,reserve campaign contacts,manage campaign,administer CiviCampaign,gotv campaign contacts', 'OR', @reportlastID, '1', 0, (SELECT @max_weight := @max_weight+1));
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/report/list&compid=7&reset=1', '{ts escape="sql" skip="true"}Case Reports{/ts}', 'Case Reports', 'access my cases and activities,access all cases and activities,administer CiviCase', 'OR', @reportlastID, '1', 0, (SELECT @max_weight := @max_weight+1) );
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/report/list&compid=5&reset=1', '{ts escape="sql" skip="true"}Grant Reports{/ts}', 'Grant Reports', 'access CiviGrant', '', @reportlastID, '1', 0, (SELECT @max_weight := @max_weight+1) );
-- CRM-11148 Multiple terms membership signup and renewal via price set
ALTER TABLE `civicrm_price_field_value` ADD COLUMN `membership_num_terms` INT(10) NULL DEFAULT NULL COMMENT 'Maximum number of related memberships.' AFTER `membership_type_id`;
-- CRM-11070
SELECT @option_group_id_tuf := max(id) from civicrm_option_group where name = 'tag_used_for';
SELECT @weight := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_tuf;
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}label{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`)
VALUES
(@option_group_id_tuf, {localize}'Attachments'{/localize}, 'civicrm_file', 'Attachments', NULL, 0, 0, @weight = @weight + 1);
ALTER TABLE civicrm_extension MODIFY COLUMN type ENUM( 'payment', 'search', 'report', 'module','sms') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ;
-- CRM-9914
SELECT @option_group_id_sms_provider_name := max(id) from civicrm_option_group where name = 'sms_provider_name';
DELETE FROM civicrm_option_value WHERE option_group_id = @option_group_id_sms_provider_name AND name = 'Clickatell';
-- CRM-11292
ALTER TABLE `civicrm_phone`
ADD `phone_numeric` varchar(32)
COMMENT 'Phone number stripped of all whitespace, letters, and punctuation.'
AFTER `phone_ext`,
ADD INDEX phone_numeric_index(`phone_numeric`);
-- civiaccounts upgrade
-- ADD fields w.r.t 10.6 mwb
ALTER TABLE `civicrm_financial_account`
CHANGE `account_type_id` financial_account_type_id int(10) unsigned NOT NULL DEFAULT '3' COMMENT 'Version identifier of financial_type',
ADD `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Financial Type Description.',
ADD `parent_id` int(10) unsigned DEFAULT NULL COMMENT 'Parent ID in account hierarchy',
ADD `is_header_account` tinyint(4) DEFAULT NULL COMMENT 'Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?',
ADD `accounting_code` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Optional value for mapping monies owed and received to accounting system codes.',
ADD `account_type_code` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).',
ADD `is_deductible` tinyint(4) DEFAULT '1' COMMENT 'Is this account tax-deductible?',
ADD `is_tax` tinyint(4) DEFAULT '0' COMMENT 'Is this account for taxes?',
ADD `tax_rate` decimal(9,8) DEFAULT '0.00' COMMENT 'The percentage of the total_amount that is due for this tax.',
ADD `is_reserved` tinyint(4) DEFAULT NULL COMMENT 'Is this a predefined system object?',
ADD `is_active` tinyint(4) DEFAULT NULL COMMENT 'Is this property active?',
ADD `is_default` tinyint(4) DEFAULT NULL COMMENT 'Is this account the default one (or default tax one) for its financial_account_type?',
ADD CONSTRAINT `UI_name` UNIQUE INDEX (`name`),
ADD CONSTRAINT `FK_civicrm_financial_account_parent_id` FOREIGN KEY (`parent_id`) REFERENCES `civicrm_financial_account`(id);
-- CRM-8425
-- Rename table civicrm_contribution_type to civicrm_financial_type
RENAME TABLE `civicrm_contribution_type` TO `civicrm_financial_type`;
ALTER TABLE `civicrm_financial_type`
CHANGE `name` `name` varchar(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Financial Type Name.',
ADD CONSTRAINT `UI_id` UNIQUE INDEX(id),
DROP INDEX UI_name;
CREATE TABLE IF NOT EXISTS `civicrm_entity_financial_account` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`entity_table` varchar(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Links to an entity_table like civicrm_financial_type',
`entity_id` int(10) unsigned NOT NULL COMMENT 'Links to an id in the entity_table, such as vid in civicrm_financial_type',
`account_relationship` int(10) unsigned NOT NULL COMMENT 'FK to a new civicrm_option_value (account_relationship)',
`financial_account_id` int(10) unsigned NOT NULL COMMENT 'FK to the financial_account_id',
PRIMARY KEY (`id`),
KEY `FK_civicrm_entity_financial_account_financial_account_id` (`financial_account_id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Constraints for table `civicrm_entity_financial_account`
ALTER TABLE `civicrm_entity_financial_account`
ADD CONSTRAINT `FK_civicrm_entity_financial_account_financial_account_id` FOREIGN KEY (`financial_account_id`) REFERENCES `civicrm_financial_account` (`id`);
-- CRM-9730 Table structure for table `civicrm_financial_item`
--
CREATE TABLE IF NOT EXISTS `civicrm_financial_item` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`created_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Date and time the item was created',
`transaction_date` datetime NOT NULL COMMENT 'Date and time of the source transaction',
`contact_id` int(10) unsigned NOT NULL COMMENT 'FK to Contact ID of contact the item is from',
`description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Human readable description of this item, to ease display without lookup of source item.',
`amount` decimal(20,2) NOT NULL DEFAULT '0.00' COMMENT 'Total amount of this item',
`currency` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Currency for the amount',
`financial_account_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to civicrm_financial_account',
`status_id` int(10) unsigned DEFAULT NULL COMMENT 'Payment status: test, paid, part_paid, unpaid (if empty assume unpaid)',
`entity_table` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The table providing the source of this item such as civicrm_line_item',
`entity_id` int(10) unsigned DEFAULT NULL COMMENT 'The specific source item that is responsible for the creation of this financial_item',
PRIMARY KEY (`id`),
UNIQUE KEY `UI_id` (`id`),
KEY `IX_created_date` (`created_date`),
KEY `IX_transaction_date` (`transaction_date`),
KEY `IX_entity` (`entity_table`,`entity_id`),
KEY `FK_civicrm_financial_item_contact_id` (`contact_id`),
KEY `FK_civicrm_financial_item_financial_account_id` (`financial_account_id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
ALTER TABLE `civicrm_batch`
ADD `payment_instrument_id` int(10) unsigned DEFAULT NULL COMMENT 'fk to Payment Instrument options in civicrm_option_values',
ADD `exported_date` datetime DEFAULT NULL;
ALTER TABLE `civicrm_financial_item`
ADD CONSTRAINT `FK_civicrm_financial_item_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`),
ADD CONSTRAINT `FK_civicrm_financial_item_financial_account_id` FOREIGN KEY (`financial_account_id`) REFERENCES `civicrm_financial_account` (`id`);
ALTER TABLE `civicrm_entity_financial_trxn`
DROP currency;
-- CRM-12312
UPDATE civicrm_event SET contribution_type_id = NULL WHERE contribution_type_id = 0;
-- CRM-9189 and CRM-8425 change fk's to financial_account.id in our branch that will need to be changed to an fk to financial_type.id
ALTER TABLE `civicrm_pledge`
DROP FOREIGN KEY FK_civicrm_pledge_contribution_type_id,
DROP INDEX FK_civicrm_pledge_contribution_type_id;
ALTER TABLE `civicrm_pledge`
CHANGE `contribution_type_id` `financial_type_id` int unsigned COMMENT 'FK to Financial Type';
ALTER TABLE `civicrm_pledge`
ADD CONSTRAINT FK_civicrm_pledge_financial_type_id FOREIGN KEY (`financial_type_id`) REFERENCES civicrm_financial_type (id);
ALTER TABLE `civicrm_membership_type`
DROP FOREIGN KEY FK_civicrm_membership_type_contribution_type_id,
DROP INDEX FK_civicrm_membership_type_contribution_type_id;
ALTER TABLE `civicrm_membership_type`
CHANGE `contribution_type_id` `financial_type_id` int unsigned NOT NULL COMMENT 'If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id';
ALTER TABLE `civicrm_membership_type`
ADD CONSTRAINT FK_civicrm_membership_type_financial_type_id FOREIGN KEY (`financial_type_id`) REFERENCES civicrm_financial_type (id);
ALTER TABLE `civicrm_price_set`
DROP FOREIGN KEY FK_civicrm_price_set_contribution_type_id,
DROP INDEX FK_civicrm_price_set_contribution_type_id;
ALTER TABLE `civicrm_price_set`
CHANGE `contribution_type_id` `financial_type_id` int unsigned COMMENT 'If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id';
ALTER TABLE `civicrm_price_set`
ADD CONSTRAINT FK_civicrm_price_set_financial_type_id FOREIGN KEY (`financial_type_id`) REFERENCES civicrm_financial_type (id);
ALTER TABLE `civicrm_event`
CHANGE `contribution_type_id` `financial_type_id` int unsigned COMMENT 'Financial type assigned to paid event registrations for this event. Required if is_monetary is true.';
ALTER TABLE `civicrm_contribution`
DROP FOREIGN KEY FK_civicrm_contribution_contribution_type_id,
DROP INDEX FK_civicrm_contribution_contribution_type_id;
ALTER TABLE `civicrm_contribution`
CHANGE `contribution_type_id` `financial_type_id` int unsigned COMMENT 'FK to Financial Type for (total_amount - non_deductible_amount).';
ALTER TABLE `civicrm_contribution`
ADD CONSTRAINT FK_civicrm_contribution_financial_type_id FOREIGN KEY (`financial_type_id`) REFERENCES civicrm_financial_type (id);
ALTER TABLE `civicrm_contribution_page`
DROP FOREIGN KEY FK_civicrm_contribution_page_contribution_type_id,
DROP INDEX FK_civicrm_contribution_page_contribution_type_id;
ALTER TABLE `civicrm_contribution_page`
CHANGE `contribution_type_id` `financial_type_id` int unsigned DEFAULT NULL COMMENT 'default financial type assigned to contributions submitted via this page, e.g. Contribution, Campaign Contribution',
ADD `is_partial_payment` tinyint(4) DEFAULT '0' COMMENT 'is partial payment enabled for this event',
ADD `min_initial_amount` decimal(20,2) DEFAULT NULL COMMENT 'Minimum initial amount for partial payment';
{if $multilingual}
{foreach from=$locales item=loc}
ALTER TABLE `civicrm_contribution_page`
ADD `initial_amount_label_{$loc}` varchar(255) COLLATE utf8_unicode_ci COMMENT 'Initial amount label for partial payment',
ADD `initial_amount_help_text_{$loc}` text COLLATE utf8_unicode_ci COMMENT 'Initial amount help text for partial payment';
{/foreach}
{else}
ALTER TABLE `civicrm_contribution_page`
ADD `initial_amount_label` varchar(255) COLLATE utf8_unicode_ci COMMENT 'Initial amount label for partial payment',
ADD `initial_amount_help_text` text COLLATE utf8_unicode_ci COMMENT 'Initial amount help text for partial payment';
{/if}
ALTER TABLE `civicrm_contribution_page`
ADD CONSTRAINT FK_civicrm_contribution_page_financial_type_id FOREIGN KEY (`financial_type_id`) REFERENCES civicrm_financial_type (id);
ALTER TABLE `civicrm_contribution_recur`
CHANGE `contribution_type_id` `financial_type_id` int unsigned COMMENT 'FK to Financial Type';
ALTER TABLE `civicrm_contribution_recur`
ADD CONSTRAINT FK_civicrm_contribution_recur_financial_type_id FOREIGN KEY (`financial_type_id`) REFERENCES civicrm_financial_type (id);
-- CRM-9083
ALTER TABLE `civicrm_financial_trxn` CHANGE `to_account_id` `to_financial_account_id` int unsigned COMMENT 'FK to financial_financial_account table.',
CHANGE `from_account_id` `from_financial_account_id` int unsigned COMMENT 'FK to financial_account table.',
ADD `status_id` int(10) unsigned DEFAULT NULL,
CHANGE `trxn_id` trxn_id varchar(255) COMMENT 'unique processor transaction id, bank id + trans id,... depending on payment_method',
CHANGE `trxn_date` trxn_date datetime DEFAULT NULL,
ADD `payment_instrument_id` int unsigned DEFAULT NULL COMMENT 'FK to payment_instrument option group values',
ADD `check_number` VARCHAR( 255 ) NULL DEFAULT NULL,
ADD INDEX `UI_ftrxn_check_number` (`check_number`),
ADD INDEX `UI_ftrxn_payment_instrument_id` (`payment_instrument_id`);
ALTER TABLE `civicrm_financial_trxn`
ADD CONSTRAINT FK_civicrm_financial_trxn_to_financial_account_id FOREIGN KEY (`to_financial_account_id`) REFERENCES civicrm_financial_account (id),
ADD CONSTRAINT FK_civicrm_financial_trxn_from_financial_account_id FOREIGN KEY (`from_financial_account_id`) REFERENCES civicrm_financial_account (id);
ALTER TABLE `civicrm_financial_trxn` ADD `payment_processor_id` int unsigned COMMENT 'Payment Processor for this contribution Page';
-- Fill in the payment_processor_id based on a lookup using the payment_processor field
UPDATE `civicrm_payment_processor` cppt, `civicrm_financial_trxn` cft
SET cft.`payment_processor_id` = cppt.`id`
WHERE cft.`payment_processor` = cppt.`payment_processor_type` and `is_test` = 0;
-- remove payment_processor field
ALTER TABLE `civicrm_financial_trxn` DROP `payment_processor`;
ALTER TABLE `civicrm_financial_trxn`
ADD CONSTRAINT `FK_civicrm_financial_trxn_payment_processor_id` FOREIGN KEY (`payment_processor_id`) REFERENCES `civicrm_payment_processor` (`id`) ON DELETE SET NULL;
-- Drop index for civicrm_financial_trxn.trxn_id and set default to null
ALTER TABLE `civicrm_financial_trxn` CHANGE `trxn_id` `trxn_id` varchar( 255 ) DEFAULT NULL ;
ALTER TABLE `civicrm_financial_trxn` DROP INDEX UI_ft_trxn_id;
-- remove trxn_type field
ALTER TABLE `civicrm_financial_trxn` DROP `trxn_type`;
-- CRM-9731
ALTER TABLE `civicrm_payment_processor` ADD `payment_processor_type_id` int(10) unsigned NULL AFTER `description`,
ADD CONSTRAINT `FK_civicrm_payment_processor_payment_processor_type_id` FOREIGN KEY (`payment_processor_type_id`) REFERENCES `civicrm_payment_processor_type` (`id`);
UPDATE `civicrm_payment_processor` , `civicrm_payment_processor_type`
SET payment_processor_type_id = `civicrm_payment_processor_type`.id
WHERE payment_processor_type = `civicrm_payment_processor_type`.name;
ALTER TABLE `civicrm_payment_processor` DROP `payment_processor_type`;
-- CRM-9730
ALTER TABLE `civicrm_price_field_value` ADD `deductible_amount` DECIMAL( 20, 2 ) NOT NULL DEFAULT '0.00' COMMENT 'Tax-deductible portion of the amount';
ALTER TABLE `civicrm_line_item` ADD `deductible_amount` DECIMAL( 20, 2 ) NOT NULL DEFAULT '0.00' COMMENT 'Tax-deductible portion of the amount';
ALTER TABLE `civicrm_price_field_value` ADD
`financial_type_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to Financial Type.',
ADD CONSTRAINT `FK_civicrm_price_field_value_financial_type_id` FOREIGN KEY (`financial_type_id`) REFERENCES `civicrm_financial_type` (`id`);
ALTER TABLE `civicrm_line_item` ADD
`financial_type_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to Financial Type.',
ADD CONSTRAINT `FK_civicrm_line_item_financial_type_id` FOREIGN KEY (`financial_type_id`) REFERENCES `civicrm_financial_type` (`id`);
ALTER TABLE `civicrm_grant` ADD
`financial_type_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to Financial Type.',
ADD CONSTRAINT `FK_civicrm_grant_financial_type_id` FOREIGN KEY (`financial_type_id`) REFERENCES `civicrm_financial_type` (`id`);
ALTER TABLE `civicrm_product` ADD
`financial_type_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to Financial Type.',
ADD CONSTRAINT `FK_civicrm_product_financial_type_id` FOREIGN KEY (`financial_type_id`) REFERENCES `civicrm_financial_type` (`id`);
ALTER TABLE `civicrm_premiums_product` ADD
`financial_type_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to Financial Type.',
ADD CONSTRAINT `FK_civicrm_premiums_product_financial_type_id` FOREIGN KEY (`financial_type_id`) REFERENCES `civicrm_financial_type` (`id`);
ALTER TABLE `civicrm_contribution_product` ADD
`financial_type_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to Financial Type.',
ADD CONSTRAINT `FK_civicrm_contribution_product_financial_type_id` FOREIGN KEY (`financial_type_id`) REFERENCES `civicrm_financial_type` (`id`);
-- CRM-11122
ALTER TABLE `civicrm_discount`
DROP FOREIGN KEY FK_civicrm_discount_option_group_id,
DROP INDEX FK_civicrm_discount_option_group_id;
ALTER TABLE `civicrm_discount` CHANGE `option_group_id` `price_set_id` INT( 10 ) UNSIGNED NOT NULL COMMENT 'FK to civicrm_price_set';
ALTER TABLE `civicrm_discount`
ADD CONSTRAINT `FK_civicrm_discount_price_set_id` FOREIGN KEY (`price_set_id`) REFERENCES `civicrm_price_set` (`id`) ON DELETE CASCADE;
-- CRM-8425
UPDATE civicrm_navigation SET `label` = 'Financial Types', `name` = 'Financial Types', `url` = 'civicrm/admin/financial/financialType?reset=1' WHERE `name` = 'Contribution Types';
-- CRM-9199
-- Insert menu item at Administer > CiviContribute, below the section break below Premiums (Thank-you Gifts), just below Financial Account.
SELECT @parent_id := id from `civicrm_navigation` where name = 'CiviContribute' AND domain_id = {$domainID};
SELECT @add_weight_id := weight from `civicrm_navigation` where `name` = 'Financial Types' and `parent_id` = @parent_id;
UPDATE `civicrm_navigation`
SET `weight` = `weight`+1
WHERE `parent_id` = @parent_id
AND `weight` > @add_weight_id;
INSERT INTO `civicrm_navigation`
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/admin/financial/financialAccount&reset=1', '{ts escape="sql" skip="true"}Financial Account{/ts}', 'Financial Account', 'access CiviContribute,administer CiviCRM', 'AND', @parent_id, '1', NULL, @add_weight_id + 1 );
-- CRM-10944
SELECT @contributionlastID := max(id) from civicrm_navigation where name = 'Contributions' AND domain_id = {$domainID};
SELECT @pledgeWeight := weight from civicrm_navigation where name = 'Pledges' and parent_id = @contributionlastID;
UPDATE `civicrm_navigation`
SET `weight` = `weight`+1
WHERE `parent_id` = @contributionlastID
AND `weight` > @pledgeWeight;
INSERT INTO civicrm_navigation
(domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight)
VALUES
({$domainID}, NULL, '{ts escape="sql" skip="true"}Accounting Batches{/ts}', 'Accounting Batches', 'access CiviContribute', '', @contributionlastID, '1', 1, @pledgeWeight+1);
SET @financialTransactionID:=LAST_INSERT_ID();
INSERT INTO civicrm_navigation
(domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
({$domainID}, 'civicrm/financial/batch&reset=1&action=add', '{ts escape="sql" skip="true"}New Batch{/ts}', 'New Batch', 'access CiviContribute', 'AND', @financialTransactionID, '1', NULL, 1),
({$domainID}, 'civicrm/financial/financialbatches?reset=1&batchStatus=1', '{ts escape="sql" skip="true"}Open Batches{/ts}', 'Open Batches', 'access CiviContribute', 'AND', @financialTransactionID, '1', NULL, 2),
({$domainID}, 'civicrm/financial/financialbatches?reset=1&batchStatus=2', '{ts escape="sql" skip="true"}Closed Batches{/ts}', 'Closed Batches', 'access CiviContribute', 'AND', @financialTransactionID, '1', NULL, 3),
({$domainID}, 'civicrm/financial/financialbatches?reset=1&batchStatus=5', '{ts escape="sql" skip="true"}Exported Batches{/ts}', 'Exported Batches', 'access CiviContribute', 'AND', @financialTransactionID, '1', NULL, 4);
-- Insert an entry for financial_account_type in civicrm_option_group and for the the following financial account types in civicrm_option_value as per CRM-8425
INSERT INTO
`civicrm_option_group` (`name`, {localize field='title'}title{/localize}, `is_reserved`, `is_active`)
VALUES
('financial_account_type', {localize}'{ts escape="sql"}Financial Account Type{/ts}'{/localize}, 1, 1),
('account_relationship', {localize}'{ts escape="sql"}Account Relationship{/ts}'{/localize}, 1, 1),
('financial_item_status', {localize}'{ts escape="sql"}Financial Item Status{/ts}'{/localize}, 1, 1),
('batch_mode', {localize}'{ts escape="sql"}Batch Mode{/ts}'{/localize}, 1, 1);
SELECT @option_group_id_fat := max(id) from civicrm_option_group where name = 'financial_account_type';
SELECT @option_group_id_arel := max(id) from civicrm_option_group where name = 'account_relationship';
SELECT @option_group_id_financial_item_status := max(id) from civicrm_option_group where name = 'financial_item_status';
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}label{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, {localize field='description'}`description`{/localize}, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
(@option_group_id_fat, {localize}'{ts escape="sql"}Asset{/ts}'{/localize}, 1, 'Asset', NULL, 0, 0, 1, {localize}'Things you own'{/localize}, 0, 1, 1, 2, NULL),
(@option_group_id_fat, {localize}'{ts escape="sql"}Liability{/ts}'{/localize}, 2, 'Liability', NULL, 0, 0, 2, {localize}'Things you own, like a grant still to be disbursed'{/localize}, 0, 1, 1, 2, NULL),
(@option_group_id_fat, {localize}'{ts escape="sql"}Revenue{/ts}'{/localize}, 3, 'Revenue', NULL, 0, 1, 3, {localize}'Income from contributions and sales of tickets and memberships'{/localize}, 0, 1, 1, 2, NULL),
(@option_group_id_fat, {localize}'{ts escape="sql"}Cost of Sales{/ts}'{/localize}, 4, 'Cost of Sales', NULL, 0, 0, 4, {localize}'Costs incurred to get revenue, e.g. premiums for donations, dinner for a fundraising dinner ticket'{/localize}, 0, 1, 1, 2, NULL),
(@option_group_id_fat, {localize}'{ts escape="sql"}Expenses{/ts}'{/localize}, 5, 'Expenses', NULL, 0, 0, 5, {localize}'Things that are paid for that are consumable, e.g. grants disbursed'{/localize}, 0, 1, 1, 2, NULL),
-- Financial account relationship
(@option_group_id_arel, {localize}'{ts escape="sql"}Income Account is{/ts}'{/localize}, 1, 'Income Account is', NULL, 0, 1, 1, {localize}'Income Account is'{/localize}, 0, 1, 1, 2, NULL),
(@option_group_id_arel, {localize}'{ts escape="sql"}Credit/Contra Account is{/ts}'{/localize}, 2, 'Credit/Contra Account is', NULL, 0, 0, 2, {localize}'Credit/Contra Account is'{/localize}, 0, 1, 0, 2, NULL),
(@option_group_id_arel, {localize}'{ts escape="sql"}Accounts Receivable Account is{/ts}'{/localize}, 3, 'Accounts Receivable Account is', NULL, 0, 0, 3, {localize}'Accounts Receivable Account is'{/localize}, 0, 1, 1, 2, NULL),
(@option_group_id_arel, {localize}'{ts escape="sql"}Credit Liability Account is{/ts}'{/localize}, 4, 'Credit Liability Account is', NULL, 0, 0, 4, {localize}'Credit Liability Account is'{/localize}, 0, 1, 0, 2, NULL),
(@option_group_id_arel, {localize}'{ts escape="sql"}Expense Account is{/ts}'{/localize}, 5, 'Expense Account is', NULL, 0, 0, 5, {localize}'Expense Account is'{/localize}, 0, 1, 1, 2, NULL),
(@option_group_id_arel, {localize}'{ts escape="sql"}Asset Account is{/ts}'{/localize}, 6, 'Asset Account is', NULL, 0, 0, 6, {localize}'Asset Account is'{/localize}, 0, 1, 1, 2, NULL),
(@option_group_id_arel, {localize}'{ts escape="sql"}Cost of Sales Account is{/ts}'{/localize}, 7, 'Cost of Sales Account is', NULL, 0, 0, 7, {localize}'Cost of Sales Account is'{/localize}, 0, 1, 1, 2, NULL),
(@option_group_id_arel, {localize}'{ts escape="sql"}Premiums Inventory Account is{/ts}'{/localize}, 8, 'Premiums Inventory Account is', NULL, 0, 0, 8, {localize}'Premiums Inventory Account is'{/localize}, 0, 1, 1, 2, NULL),
(@option_group_id_arel, {localize}'{ts escape="sql"}Discounts Account is{/ts}'{/localize}, 9, 'Discounts Account is', NULL, 0, 0, 9, {localize}'Discounts Account is'{/localize}, 0, 1, 1, 2, NULL),
-- Financial Item Status
(@option_group_id_financial_item_status, {localize}'{ts escape="sql"}Paid{/ts}'{/localize}, 1, 'Paid', NULL, 0, 0, 1, {localize}'Paid'{/localize}, 0, 1, 1, 2, NULL),
(@option_group_id_financial_item_status, {localize}'{ts escape="sql"}Partially paid{/ts}'{/localize}, 2, 'Partially paid', NULL, 0, 0, 2, {localize}'Partially paid'{/localize}, 0, 1, 1, 2, NULL),
(@option_group_id_financial_item_status, {localize}'{ts escape="sql"}Unpaid{/ts}'{/localize}, 3, 'Unpaid', NULL, 0, 0, 1, {localize}'Unpaid'{/localize}, 0, 1, 1, 2, NULL);
-- Data migration from civicrm_contibution_type to civicrm_financial_account, civicrm_financial_type, civicrm_entity_financial_account
SELECT @opval := value FROM civicrm_option_value WHERE name = 'Revenue' and option_group_id = @option_group_id_fat;
SELECT @domainContactId := contact_id from civicrm_domain where id = {$domainID};
INSERT INTO `civicrm_financial_account`
(`id`, `name`, `description`, `is_deductible`, `is_reserved`, `is_active`, `financial_account_type_id`, `contact_id`, accounting_code)
SELECT id, name, CONCAT('Default account for ', name), is_deductible, is_reserved, is_active, @opval, @domainContactId, accounting_code
FROM `civicrm_financial_type`;
-- CRM-9306 and CRM-11657
UPDATE `civicrm_financial_account` SET `is_default` = 0, `account_type_code` = 'INC';
SELECT @option_value_rel_id := value FROM `civicrm_option_value` WHERE `option_group_id` = @option_group_id_arel AND `name` = 'Income Account is';
SELECT @opexp := value FROM civicrm_option_value WHERE name = 'Expenses' and option_group_id = @option_group_id_fat;
SELECT @opAsset := value FROM civicrm_option_value WHERE name = 'Asset' and option_group_id = @option_group_id_fat;
SELECT @opLiability := value FROM civicrm_option_value WHERE name = 'Liability' and option_group_id = @option_group_id_fat;
SELECT @opCost := value FROM civicrm_option_value WHERE name = 'Cost of Sales' and option_group_id = @option_group_id_fat;
-- CRM-11522 drop accounting_code after coping its values into financial_account
ALTER TABLE civicrm_financial_type DROP accounting_code;
INSERT INTO
`civicrm_financial_account` (`name`, `contact_id`, `financial_account_type_id`, `description`, `accounting_code`, `account_type_code`, `is_reserved`, `is_active`, `is_deductible`, `is_default`)
VALUES
('Banking Fees' , @domainContactId, @opexp, 'Payment processor fees and manually recorded banking fees', '5200', 'EXP', 0, 1, 0, 0),
('Deposit Bank Account' , @domainContactId, @opAsset, 'All manually recorded cash and cheques go to this account', '1100', 'BANK', 0, 1, 0, 1),
('Accounts Receivable' , @domainContactId, @opAsset, 'Amounts to be received later (eg pay later event revenues)', '1200', 'AR', 0, 1, 0, 0),
('Accounts Payable' , @domainContactId, @opLiability, 'Amounts to be paid out such as grants and refunds', '2200', 'AP', 0, 1, 0, 0),
('Premiums' , @domainContactId, @opCost, 'Account to record cost of premiums provided to payors', '5100', 'COGS', 0, 1, 0, 0),
('Premiums Inventory' , @domainContactId, @opAsset, 'Account representing value of premiums inventory', '1375', 'OCASSET', 0, 1, 0, 0),
('Discounts' , @domainContactId, @opval, 'Contra-revenue account for amounts discounted from sales', '4900', 'INC', 0, 1, 0, 0),
('Payment Processor Account', @domainContactId, @opAsset, 'Account to record payments into a payment processor merchant account', '1150', 'BANK', 0, 1, 0, 0);
-- CRM-10926
SELECT @option_value_rel_id_exp := value FROM `civicrm_option_value` WHERE `option_group_id` = @option_group_id_arel AND `name` = 'Expense Account is';
SELECT @option_value_rel_id_ar := value FROM `civicrm_option_value` WHERE `option_group_id` = @option_group_id_arel AND `name` = 'Accounts Receivable Account is';
SELECT @option_value_rel_id_as := value FROM `civicrm_option_value` WHERE `option_group_id` = @option_group_id_arel AND `name` = 'Asset Account is';
SELECT @financial_account_id_bf := max(id) FROM `civicrm_financial_account` WHERE `name` = 'Banking Fees';
SELECT @financial_account_id_ap := max(id) FROM `civicrm_financial_account` WHERE `name` = 'Accounts Receivable';
INSERT INTO `civicrm_entity_financial_account`
( entity_table, entity_id, account_relationship, financial_account_id )
SELECT 'civicrm_financial_type', ft.id, @option_value_rel_id, fa.id
FROM `civicrm_financial_type` as ft LEFT JOIN `civicrm_financial_account` as fa ON ft.id = fa.id;
-- Banking Fees
INSERT INTO `civicrm_entity_financial_account`
( entity_table, entity_id, account_relationship, financial_account_id )
SELECT 'civicrm_financial_type', ft.id, @option_value_rel_id_exp, @financial_account_id_bf
FROM `civicrm_financial_type` as ft;
-- Accounts Receivable
INSERT INTO `civicrm_entity_financial_account`
( entity_table, entity_id, account_relationship, financial_account_id )
SELECT 'civicrm_financial_type', ft.id, @option_value_rel_id_ar, @financial_account_id_ap
FROM `civicrm_financial_type` as ft;
-- CRM-11516
SELECT @financial_account_id_ar := max(id) FROM `civicrm_financial_account` WHERE `name` = 'Deposit Bank Account';
SELECT @financial_account_id_pp := max(id) FROM `civicrm_financial_account` WHERE `name` = 'Payment Processor Account';
INSERT INTO civicrm_entity_financial_account (entity_table, entity_id, account_relationship, financial_account_id)
SELECT 'civicrm_option_value', cov.id, @option_value_rel_id_as, @financial_account_id_ar FROM `civicrm_option_group` cog
LEFT JOIN civicrm_option_value cov ON cog.id = cov.option_group_id
WHERE cog.name = 'payment_instrument' AND cov.name NOT IN ('Credit Card', 'Debit Card');
INSERT INTO civicrm_entity_financial_account (entity_table, entity_id, account_relationship, financial_account_id)
SELECT 'civicrm_option_value', cov.id, @option_value_rel_id_as, @financial_account_id_pp FROM `civicrm_option_group` cog
LEFT JOIN civicrm_option_value cov ON cog.id = cov.option_group_id
WHERE cog.name = 'payment_instrument' AND cov.name IN ('Credit Card', 'Debit Card');
-- CRM-11515
SELECT @financial_account_id_ppa := max(id) FROM `civicrm_financial_account` WHERE `name` = 'Payment Processor Account';
INSERT INTO civicrm_entity_financial_account (`entity_table`, `entity_id`, `account_relationship`, `financial_account_id`)
SELECT 'civicrm_payment_processor', id, @option_value_rel_id_as, @financial_account_id_ppa FROM `civicrm_payment_processor`;
-- CRM-9923 and CRM-11037
SELECT @option_group_id_batch_status := max(id) from civicrm_option_group where name = 'batch_status';
SELECT @weight := MAX(ROUND(value)) FROM civicrm_option_value WHERE option_group_id = @option_group_id_batch_status;
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}label{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`)
VALUES
(@option_group_id_batch_status, {localize}'Data Entry'{/localize}, @weight + 1, 'Data Entry', NULL, 0, 0, @weight + 1),
(@option_group_id_batch_status, {localize}'Reopened'{/localize}, @weight + 2, 'Reopened', NULL, 0, 0, @weight + 2),
(@option_group_id_batch_status, {localize}'Exported'{/localize}, @weight + 3, 'Exported' , NULL, 0, 0, @weight + 3);
-- Insert Batch Modes.
SELECT @option_group_id_batch_modes := max(id) from civicrm_option_group where name = 'batch_mode';
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}label{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`)
VALUES
(@option_group_id_batch_modes, {localize}'Manual Batch'{/localize}, 1, 'Manual Batch', NULL, 0, 0, 1),
(@option_group_id_batch_modes, {localize}'Automatic Batch'{/localize}, 2, 'Automatic Batch' , NULL, 0, 0, 2);
-- End of civiaccounts upgrade
-- CRM-10933
ALTER TABLE `civicrm_report_instance`
ADD COLUMN `drilldown_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to instance ID drilldown to',
ADD CONSTRAINT `FK_civicrm_report_instance_drilldown_id` FOREIGN KEY (`drilldown_id`) REFERENCES `civicrm_report_instance` (`id`) ON DELETE SET NULL;
-- CRM-10012
ALTER TABLE `civicrm_membership_type`
ADD COLUMN `max_related` INT(10) unsigned DEFAULT NULL COMMENT 'Maximum number of related memberships.' AFTER `relationship_direction`;
ALTER TABLE `civicrm_membership`
ADD COLUMN `max_related` INT(10) unsigned DEFAULT NULL COMMENT 'Maximum number of related memberships (membership_type override).' AFTER `owner_membership_id`;
ALTER TABLE `civicrm_membership_log`
ADD COLUMN `max_related` INT(10) unsigned DEFAULT NULL COMMENT 'Maximum number of related memberships.' AFTER `membership_type_id`;
-- CRM-11358
DELETE FROM civicrm_dashboard_contact WHERE contact_id NOT IN (SELECT id FROM civicrm_contact);
INSERT INTO `civicrm_dashboard`
(`domain_id`, {localize field='label'}`label`{/localize}, `url`, `permission`, `permission_operator`, `column_no`, `is_minimized`, `is_active`, `weight`, `fullscreen_url`, `is_fullscreen`, `is_reserved`)
SELECT id, {localize}'{ts escape="sql"}CiviCRM News{/ts}'{/localize}, 'civicrm/dashlet/blog&reset=1&snippet=5', 'access CiviCRM', NULL, 0, 0, 1, 0, 'civicrm/dashlet/blog&reset=1&snippet=5&context=dashletFullscreen', 1, 1
FROM `civicrm_domain`;
INSERT INTO `civicrm_dashboard_contact` (dashboard_id, contact_id, column_no, is_active)
SELECT (SELECT MAX(id) FROM `civicrm_dashboard`), contact_id, 1, IF (SUM(is_active) > 0, 0, 1)
FROM `civicrm_dashboard_contact` WHERE 1 GROUP BY contact_id;
-- CRM-11387
ALTER TABLE `civicrm_event`
ADD `is_partial_payment` tinyint(4) DEFAULT '0' COMMENT 'is partial payment enabled for this event',
ADD `min_initial_amount` decimal(20,2) DEFAULT NULL COMMENT 'Minimum initial amount for partial payment';
{if $multilingual}
{foreach from=$locales item=loc}
ALTER TABLE `civicrm_event`
ADD `initial_amount_label_{$loc}` varchar(255) COLLATE utf8_unicode_ci COMMENT 'Initial amount label for partial payment',
ADD `initial_amount_help_text_{$loc}` text COLLATE utf8_unicode_ci COMMENT 'Initial amount help text for partial payment';
{/foreach}
{else}
ALTER TABLE `civicrm_event`
ADD `initial_amount_label` varchar(255) COLLATE utf8_unicode_ci COMMENT 'Initial amount label for partial payment',
ADD `initial_amount_help_text` text COLLATE utf8_unicode_ci COMMENT 'Initial amount help text for partial payment';
{/if}
-- CRM-11347
UPDATE `civicrm_option_value` SET is_reserved = 0
WHERE name = 'Urgent' AND option_group_id = (SELECT id FROM `civicrm_option_group` WHERE name = 'case_status');
-- CRM-11400
UPDATE `civicrm_state_province` SET name = 'Distrito Federal' WHERE name = 'Diatrito Federal';
-- CRM-9379 and CRM-11539
SELECT @option_group_id_act := MAX(id) FROM civicrm_option_group WHERE name = 'activity_type';
SELECT @max_val := MAX(ROUND(op.value)) FROM civicrm_option_value op WHERE op.option_group_id = @option_group_id_act;
SELECT @max_wt := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act;
SELECT @CompId := MAX(id) FROM civicrm_component where name = 'CiviContribute';
INSERT INTO civicrm_option_value
(option_group_id, {localize field='label'}label{/localize}, value, name, weight, {localize field='description'}description{/localize}, is_active, is_reserved, component_id, filter)
VALUES
(@option_group_id_act, {localize field='label'}'Export Accounting Batch'{/localize}, @max_val+1, 'Export Accounting Batch', @max_wt+1, {localize field='description'}'Export Accounting Batch'{/localize}, 1, 1, @CompId, 1),
(@option_group_id_act, {localize field='label'}'Create Batch'{/localize}, @max_val+2, 'Create Batch', @max_wt+2, {localize field='description'}'Create Batch'{/localize}, 1, 1, @CompId, 1),
(@option_group_id_act, {localize field='label'}'Edit Batch'{/localize}, @max_val+3, 'Edit Batch', @max_wt+3, {localize field='description'}'Edit Batch'{/localize}, 1, 1, @CompId, 1);
-- CRM-11341
INSERT INTO
`civicrm_job` (domain_id, run_frequency, last_run, name, description, api_entity, api_action, parameters, is_active)
SELECT
id, 'Daily' , NULL, '{ts escape="sql" skip="true"}Disable expired relationships{/ts}', '{ts escape="sql" skip="true"}Disables relationships that have expired (ie. those relationships whose end date is in the past).{/ts}', 'job', 'disable_expired_relationships', NULL, 0
FROM `civicrm_domain`;
-- CRM-11367
SELECT @country_id := max(id) from civicrm_country where name = 'Latvia';
DELETE FROM civicrm_state_province WHERE name IN ('Ventspils Apripkis', 'Aizkraukles Apripkis', 'Alkanes Apripkis', 'Balvu Apripkis', 'Bauskas Apripkis', 'Cesu Aprikis', 'Daugavpile Apripkis', 'Dobeles Apripkis', 'Gulbenes Aprlpkis', 'Jelgavas Apripkis', 'Jekabpils Apripkis', 'Kraslavas Apripkis', 'Kuldlgas Apripkis', 'Limbazu Apripkis', 'Liepajas Apripkis', 'Ludzas Apripkis', 'Madonas Apripkis', 'Ogres Apripkis', 'Preilu Apripkis', 'Rezaknes Apripkis', 'Rigas Apripkis', 'Saldus Apripkis', 'Talsu Apripkis', 'Tukuma Apriplcis', 'Valkas Apripkis', 'Valmieras Apripkis');
INSERT IGNORE INTO civicrm_state_province (country_id, abbreviation, name) VALUES
(@country_id, '002', 'Aizkraukles novads'),
(@country_id, '038', 'Jaunjelgavas novads'),
(@country_id, '072', 'Pļaviņu novads'),
(@country_id, '046', 'Kokneses novads'),
(@country_id, '065', 'Neretas novads'),
(@country_id, '092', 'Skrīveru novads'),
(@country_id, '007', 'Alūksnes novads'),
(@country_id, '009', 'Apes novads'),
(@country_id, '015', 'Balvu novads'),
(@country_id, '108', 'Viļakas novads'),
(@country_id, '014', 'Baltinavas novads'),
(@country_id, '082', 'RugÄ<67>ju novads'),
(@country_id, '016', 'Bauskas novads'),
(@country_id, '034', 'Iecavas novads'),
(@country_id, '083', 'RundÄ<64>les novads'),
(@country_id, '105', 'Vecumnieku novads'),
(@country_id, '022', 'Cēsu novads'),
(@country_id, '055', 'Līgatnes novads'),
(@country_id, '008', 'Amatas novads'),
(@country_id, '039', 'Jaunpiebalgas novads'),
(@country_id, '075', 'Priekuļu novads'),
(@country_id, '070', 'PÄ<50>rgaujas novads'),
(@country_id, '076', 'Raunas novads'),
(@country_id, '104', 'Vecpiebalgas novads'),
(@country_id, '025', 'Daugavpils novads'),
(@country_id, '036', 'Ilūkstes novads'),
(@country_id, '026', 'Dobeles novads'),
(@country_id, '010', 'Auces novads'),
(@country_id, '098', 'Tērvetes novads'),
(@country_id, '033', 'Gulbenes novads'),
(@country_id, '041', 'Jelgavas novads'),
(@country_id, '069', 'Ozolnieku novads'),
(@country_id, '042', 'Jēkabpils novads'),
(@country_id, '004', 'Aknīstes novads'),
(@country_id, '107', 'Viesītes novads'),
(@country_id, '049', 'Krustpils novads'),
(@country_id, '085', 'Salas novads'),
(@country_id, '047', 'KrÄ<72>slavas novads'),
(@country_id, '024', 'Dagdas novads'),
(@country_id, '001', 'Aglonas novads'),
(@country_id, '050', 'Kuldīgas novads'),
(@country_id, '093', 'Skrundas novads'),
(@country_id, '006', 'Alsungas novads'),
(@country_id, '003', 'Aizputes novads'),
(@country_id, '028', 'Durbes novads'),
(@country_id, '032', 'Grobiņas novads'),
(@country_id, '071', 'PÄ<50>vilostas novads'),
(@country_id, '074', 'Priekules novads'),
(@country_id, '066', 'Nīcas novads'),
(@country_id, '081', 'Rucavas novads'),
(@country_id, '100', 'Vaiņodes novads'),
(@country_id, '054', 'Limbažu novads'),
(@country_id, '005', 'Alojas novads'),
(@country_id, '086', 'Salacgrīvas novads'),
(@country_id, '058', 'Ludzas novads'),
(@country_id, '044', 'KÄ<4B>rsavas novads'),
(@country_id, '110', 'Zilupes novads'),
(@country_id, '023', 'Ciblas novads'),
(@country_id, '059', 'Madonas novads'),
(@country_id, '021', 'Cesvaines novads'),
(@country_id, '057', 'LubÄ<62>nas novads'),
(@country_id, '102', 'VarakļÄ<C2BC>nu novads'),
(@country_id, '030', 'Ärgļu novads'),
(@country_id, '067', 'Ogres novads'),
(@country_id, '035', 'Ikšķiles novads'),
(@country_id, '051', 'Ķeguma novads'),
(@country_id, '053', 'LielvÄ<76>rdes novads'),
(@country_id, '073', 'Preiļu novads'),
(@country_id, '056', 'LÄ«vÄ<76>nu novads'),
(@country_id, '078', 'Riebiņu novads'),
(@country_id, '103', 'VÄ<56>rkavas novads'),
(@country_id, '077', 'Rēzeknes novads'),
(@country_id, '109', 'ViļÄ<C2BC>nu novads'),
(@country_id, '013', 'Baldones novads'),
(@country_id, '052', 'Ķekavas novads'),
(@country_id, '068', 'Olaines novads'),
(@country_id, '087', 'Salaspils novads'),
(@country_id, '089', 'Saulkrastu novads'),
(@country_id, '091', 'Siguldas novads'),
(@country_id, '037', 'InÄ<6E>ukalna novads'),
(@country_id, '011', 'Ādažu novads'),
(@country_id, '012', 'Babītes novads'),
(@country_id, '020', 'Carnikavas novads'),
(@country_id, '031', 'Garkalnes novads'),
(@country_id, '048', 'Krimuldas novads'),
(@country_id, '061', 'MÄ<4D>lpils novads'),
(@country_id, '062', 'MÄ<4D>rupes novads'),
(@country_id, '080', 'Ropažu novads'),
(@country_id, '090', 'Sējas novads'),
(@country_id, '095', 'Stopiņu novads'),
(@country_id, '088', 'Saldus novads'),
(@country_id, '018', 'Brocēnu novads'),
(@country_id, '097', 'Talsu novads'),
(@country_id, '027', 'Dundagas novads'),
(@country_id, '063', 'Mērsraga novads'),
(@country_id, '079', 'Rojas novads'),
(@country_id, '099', 'Tukuma novads'),
(@country_id, '043', 'Kandavas novads'),
(@country_id, '029', 'Engures novads'),
(@country_id, '040', 'Jaunpils novads'),
(@country_id, '101', 'Valkas novads'),
(@country_id, '094', 'Smiltenes novads'),
(@country_id, '096', 'StrenÄ<6E>u novads'),
(@country_id, '045', 'Kocēnu novads'),
(@country_id, '060', 'Mazsalacas novads'),
(@country_id, '084', 'Rūjienas novads'),
(@country_id, '017', 'Beverīnas novads'),
(@country_id, '019', 'Burtnieku novads'),
(@country_id, '064', 'Naukšēnu novads'),
(@country_id, '106', 'Ventspils novads'),
(@country_id, 'JKB', 'Jēkabpils'),
(@country_id, 'VMR', 'Valmiera');
-- CRM-11507
ALTER TABLE `civicrm_batch` CHANGE `type_id` `type_id` INT( 10 ) UNSIGNED NULL COMMENT 'fk to Batch Type options in civicrm_option_values';
UPDATE `civicrm_batch` SET `mode_id` = '1';
-- add Refunded in contribution status
SELECT @option_group_id_cs := MAX(id) FROM civicrm_option_group WHERE name = 'contribution_status';
SELECT @max_weight := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_cs;
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}label{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
(@option_group_id_cs, {localize}'{ts escape="sql"}Refunded{/ts}'{/localize}, @max_weight + 1, 'Refunded', NULL, 0, NULL, @max_weight + 1, 0, 1, 1, NULL, NULL);
-- Payprocs from extensions may have long titles
ALTER TABLE civicrm_payment_processor_type MODIFY COLUMN title varchar(127);
-- CRM-11665
ALTER TABLE `civicrm_address`
ADD COLUMN manual_geo_code tinyint(4) DEFAULT '0' COMMENT 'Is this a manually entered geo code.';
-- CRM-11761
UPDATE `civicrm_setting` SET `group_name` = 'Personal Preferences' WHERE `group_name` = 'Navigation Menu';
-- CRM-11779
INSERT INTO civicrm_action_mapping ( entity, entity_value, entity_value_label, entity_status, entity_status_label, entity_date_start, entity_date_end, entity_recipient )
VALUES
( 'civicrm_participant', 'event_template', 'Event Template', 'civicrm_participant_status_type', 'Participant Status', 'event_start_date', 'event_end_date', 'event_contacts');
-- CRM-11802 Fix ON DELETE CASCADE constraint for line_item.price_field_id
ALTER TABLE `civicrm_line_item`
DROP FOREIGN KEY `FK_civicrm_line_item_price_field_id`,
CHANGE `price_field_id` `price_field_id` INT( 10 ) UNSIGNED DEFAULT NULL;
ALTER TABLE `civicrm_line_item`
ADD CONSTRAINT `FK_civicrm_line_item_price_field_id` FOREIGN KEY (`price_field_id`) REFERENCES `civicrm_price_field`(id) ON DELETE SET NULL;
-- CRM-11821
-- update all location info of domain
-- like address, email, phone etc.
UPDATE civicrm_domain cd
LEFT JOIN civicrm_loc_block clb ON cd.loc_block_id = clb.id
LEFT JOIN civicrm_address ca ON clb.address_id = ca.id
LEFT JOIN civicrm_phone cp ON cp.id = clb.phone_id
LEFT JOIN civicrm_email ce ON ce.id = clb.email_id
SET
ca.contact_id = cd.contact_id, cp.contact_id = cd.contact_id, ce.contact_id = cd.contact_id;
-- Delete rows from civicrm_loc_block used for civicrm_domain
DELETE clb.* FROM civicrm_domain cd
LEFT JOIN civicrm_loc_block clb ON clb.id = cd.loc_block_id;
-- Delete loc_block_id from civicrm_domain
ALTER TABLE `civicrm_domain` DROP loc_block_id;
-- CRM11818
-- pledge payments should not be cancelled if the contribution was
-- compledged but the pledge is cancelled
UPDATE
civicrm_pledge_payment pp
INNER JOIN civicrm_contribution c ON
c.id = pp.contribution_id AND pp.status_id =3
AND contribution_status_id = 1
SET pp.status_id = contribution_status_id

View file

@ -0,0 +1,40 @@
-- CRM-11847
UPDATE `civicrm_dedupe_rule_group`
SET name = 'IndividualGeneral'
WHERE name = 'IndividualComplete';
-- CRM-11791
INSERT IGNORE INTO `civicrm_relationship_type` ( name_a_b,label_a_b, name_b_a,label_b_a, description, contact_type_a, contact_type_b, is_reserved )
VALUES
( 'Partner of', '{ts escape="sql"}Partner of{/ts}', 'Partner of', '{ts escape="sql"}Partner of{/ts}', '{ts escape="sql"}Partner relationship.{/ts}', 'Individual', 'Individual', 0 );
-- CRM-11886
UPDATE `civicrm_navigation`
SET permission = 'view own manual batches,view all manual batches'
WHERE
name = 'Open Batches' OR
name = 'Closed Batches' OR
name = 'Exported Batches' OR
name = 'Accounting Batches';
UPDATE `civicrm_navigation`
SET permission = 'create manual batch'
WHERE
name = 'Accounting Batches';
-- CRM-11891
SELECT @contributionlastID := max(id) from civicrm_navigation where name = 'Contributions' AND domain_id = {$domainID};
SELECT @importWeight := weight from civicrm_navigation where name = 'Import Contributions' and parent_id = @contributionlastID;
-- since 'Bulk Data Entry' was renamed to 'Batch Data Entry'
UPDATE `civicrm_navigation` SET label = '{ts escape="sql"}Batch Data Entry{/ts}', name = 'Batch Data Entry'
WHERE url = 'civicrm/batch&reset=1';
UPDATE `civicrm_navigation`
SET `weight` = `weight`+2
WHERE `parent_id` = @contributionlastID
AND (`weight` > @importWeight OR `name` = 'Accounting Batches');
UPDATE `civicrm_navigation`
SET `weight` = @importWeight+1
WHERE `name` = 'Batch Data Entry';

View file

@ -0,0 +1,4 @@
{include file='../CRM/Upgrade/4.3.alpha3.msg_template/civicrm_msg_template.tpl'}
-- CRM-11906
ALTER TABLE `civicrm_batch` CHANGE `item_count` `item_count` INT( 10 ) UNSIGNED NULL DEFAULT NULL COMMENT 'Number of items in a batch.';

View file

@ -0,0 +1 @@
{include file='../CRM/Upgrade/4.3.beta1.msg_template/civicrm_msg_template.tpl'}

View file

@ -0,0 +1 @@
{include file='../CRM/Upgrade/4.3.beta2.msg_template/civicrm_msg_template.tpl'}

View file

@ -0,0 +1,31 @@
{include file='../CRM/Upgrade/4.3.beta3.msg_template/civicrm_msg_template.tpl'}
-- CRM-12077
DELETE cog, cov FROM `civicrm_option_group` cog
LEFT JOIN civicrm_option_value cov ON cov.option_group_id = cog.id
WHERE cog.name = 'account_type';
{if $multilingual}
UPDATE civicrm_uf_field
SET field_name = 'financial_type'
WHERE field_name LIKE 'contribution_type';
{foreach from=$locales item=locale}
UPDATE civicrm_uf_field
SET label_{$locale} = 'Financial Type'
WHERE field_name = 'financial_type' AND label_{$locale} = 'Contribution Type';
{/foreach}
{else}
UPDATE civicrm_uf_field
SET field_name = 'financial_type',
label = CASE
WHEN label = 'Contribution Type'
THEN 'Financial Type'
ELSE label
END
WHERE field_name = 'contribution_type';
{/if}
-- CRM-12065
UPDATE `civicrm_mapping_field`
SET name = replace(name, 'contribution_type', 'financial_type')
where name LIKE '%contribution_type%';

View file

@ -0,0 +1,25 @@
-- CRM-12151
ALTER TABLE civicrm_option_value
DROP INDEX index_option_group_id_value,
ADD INDEX index_option_group_id_value (value(128), option_group_id),
DROP INDEX index_option_group_id_name,
ADD INDEX index_option_group_id_name (option_group_id, name(128));
-- CRM-12127
UPDATE civicrm_membership_type cmt
LEFT JOIN civicrm_price_field_value cpfv ON cpfv.membership_type_id = cmt.id
LEFT JOIN civicrm_price_field cpf ON cpf.id = cpfv.price_field_id
LEFT JOIN civicrm_price_set cps ON cps.id = cpf.price_set_id
SET
cpfv.financial_type_id = cmt.financial_type_id,
{if !$multilingual}
cpfv.label = cmt.name,
cpfv.description = cmt.description,
{else}
{foreach from=$locales item=locale}
cpfv.label_{$locale} = cmt.name_{$locale},
cpfv.description_{$locale} = cmt.description_{$locale},
{/foreach}
{/if}
cpfv.amount = IFNULL(cmt.minimum_fee, 0.00)
WHERE cps.is_quick_config = 1 AND cpfv.membership_type_id IS NOT NULL;

View file

@ -0,0 +1,9 @@
-- CRM-12142
-- Populate default text for premiums_nothankyou_label
UPDATE `civicrm_premiums` SET {localize field="premiums_nothankyou_label"}premiums_nothankyou_label = '{ts escape="sql"}No thank-you{/ts}'{/localize};
-- CRM-12233 Fix price field label for quick config membership signup field
UPDATE `civicrm_price_field` cpf
LEFT JOIN `civicrm_price_set` cps ON cps.id = cpf.price_set_id
SET {localize field="label"}cpf.label = '{ts escape="sql"}Membership{/ts}'{/localize}
WHERE cps.is_quick_config = 1 AND cpf.name = 'membership_amount';

View file

@ -0,0 +1,9 @@
{* file to handle db changes in 4.4.0 during upgrade *}
-- CRM-13571
UPDATE civicrm_state_province SET name = 'Møre og Romsdal' WHERE name = 'Møre ag Romsdal';
-- CRM-13604
UPDATE civicrm_state_province SET name = 'Alta Verapaz' WHERE name = 'Alta Verapez';
UPDATE civicrm_state_province SET name = 'Baja Verapaz' WHERE name = 'Baja Verapez';
UPDATE civicrm_state_province SET name = 'Retalhuleu' WHERE name = 'Reta.thuleu';
UPDATE civicrm_state_province SET name = 'Sololá' WHERE name = 'Solol6';

View file

@ -0,0 +1,12 @@
{* file to handle db changes in 4.4.1 during upgrade *}
-- CRM-13327
SELECT @option_group_id_name_badge := max(id) from civicrm_option_group where name = 'name_badge';
UPDATE civicrm_option_value
SET value = '{literal}{"name":"Avery 5395","paper-size":"a4","metric":"mm","lMargin":15,"tMargin":26,"NX":2,"NY":4,"SpaceX":10,"SpaceY":5,"width":83,"height":57,"font-size":12,"orientation":"portrait","font-name":"helvetica","font-style":"","lPadding":3,"tPadding":3}{/literal}'
WHERE option_group_id = @option_group_id_name_badge AND name = 'Avery 5395';
-- CRM-13669
{literal}
UPDATE civicrm_option_value SET name = 'Dear {contact.household_name}'
WHERE name = 'Dear {contact.househols_name}';
{/literal}

View file

@ -0,0 +1,5 @@
{* file to handle db changes in 4.4.2 during upgrade *}
-- CRM-13758
UPDATE civicrm_uf_field SET field_name = 'gender_id' WHERE field_name = 'gender';
UPDATE civicrm_uf_field SET field_name = 'prefix_id' WHERE field_name = 'individual_prefix';
UPDATE civicrm_uf_field SET field_name = 'suffix_id' WHERE field_name = 'individual_suffix';

View file

@ -0,0 +1,8 @@
{* file to handle db changes in 4.4.3 during upgrade *}
{include file='../CRM/Upgrade/4.4.3.msg_template/civicrm_msg_template.tpl'}
-- CRM-13420
UPDATE civicrm_option_value
INNER JOIN civicrm_option_group ON civicrm_option_value.option_group_id = civicrm_option_group.id
SET civicrm_option_value.is_default = 1
WHERE civicrm_option_group.name = 'payment_instrument' AND civicrm_option_value.name = 'Check';

View file

@ -0,0 +1,28 @@
{* file to handle db changes in 4.4.4 during upgrade *}
{* update comment for civicrm_report_instance.grouprole *}
ALTER TABLE civicrm_report_instance MODIFY grouprole varchar(1024) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'role required to be able to run this instance';
{* CRM-14117 *}
UPDATE civicrm_navigation SET url = 'http://civicrm.org/what/whatiscivicrm' WHERE name = 'About';
-- CRM-13968
SELECT @inprogressstatus := value FROM civicrm_option_value cov
LEFT JOIN civicrm_option_group cg ON cov.option_group_id = cg.id
WHERE cg.name = 'contribution_status' AND cov.name = 'In Progress';
SELECT @financialstatus := value FROM civicrm_option_value cov
LEFT JOIN civicrm_option_group cg ON cov.option_group_id = cg.id
WHERE cg.name = 'financial_item_status' AND cov.name = 'Unpaid';
SELECT @accountrecievable := id FROM `civicrm_financial_account` WHERE `name` LIKE 'Accounts Receivable';
UPDATE civicrm_financial_trxn cft
LEFT JOIN civicrm_entity_financial_trxn ceft ON ceft.financial_trxn_id = cft.id
LEFT JOIN civicrm_entity_financial_trxn ceft_financial_item ON ceft_financial_item.financial_trxn_id = cft.id
LEFT JOIN civicrm_financial_item cfi ON cfi.id = ceft_financial_item.entity_id
SET to_financial_account_id = @accountrecievable, cfi.status_id = @financialstatus
WHERE ceft.entity_table = 'civicrm_contribution' AND ceft_financial_item.entity_table = 'civicrm_financial_item' AND cft.status_id = @inprogressstatus AND cfi.status_id IS NULL;
{* CRM-14167 *}
ALTER TABLE civicrm_activity_contact ADD INDEX index_record_type ( activity_id, record_type_id );

View file

@ -0,0 +1,36 @@
{* file to handle db changes in 4.4.5 during upgrade *}
-- CRM-14191
SELECT @option_group_id_batch_status := max(id) from civicrm_option_group where name = 'batch_status';
SELECT @weight := MAX(ROUND(value)) FROM civicrm_option_value WHERE option_group_id = @option_group_id_batch_status;
UPDATE civicrm_option_value
SET value = (Select @weight := @weight +1),
weight = @weight
WHERE option_group_id = @option_group_id_batch_status AND name IN ('Data Entry', 'Reopened', 'Exported') AND value = 0 ORDER BY id;
SELECT @option_group_id_batch_modes := max(id) from civicrm_option_group where name = 'batch_mode';
SELECT @weights := MAX(ROUND(value)) FROM civicrm_option_value WHERE option_group_id = @option_group_id_batch_modes;
UPDATE civicrm_option_value
SET value = (Select @weights := @weights +1),
weight = @weights
WHERE option_group_id = @option_group_id_batch_modes AND name IN ('Manual Batch', 'Automatic Batch') AND value = 0;
SELECT @manual_mode_id := MAX(value) FROM civicrm_option_value WHERE option_group_id = @option_group_id_batch_modes AND name = 'Manual Batch';
UPDATE civicrm_batch SET mode_id = @manual_mode_id WHERE (mode_id IS NULL OR mode_id = 0) AND type_id IS NULL;
SELECT @data_entry_status_id := MAX(value) FROM civicrm_option_value WHERE option_group_id = @option_group_id_batch_status AND name = 'Data Entry';
UPDATE civicrm_batch SET status_id = @data_entry_status_id WHERE status_id = 3 AND type_id IS NOT NULL;
SELECT @exported_status_id := MAX(value) FROM civicrm_option_value WHERE option_group_id = @option_group_id_batch_status AND name = 'Exported';
UPDATE civicrm_navigation SET url = CONCAT('civicrm/financial/financialbatches?reset=1&batchStatus=', @exported_status_id) WHERE name = 'Exported Batches';
-- update status_id to Exported
SELECT @export_activity_type := max(value) FROM civicrm_option_value cov
INNER JOIN civicrm_option_group cog ON cog.id = cov.option_group_id
WHERE cog.name = 'activity_type' AND cov.name = 'Export Accounting Batch';
UPDATE civicrm_batch cb
INNER JOIN civicrm_activity ca ON ca.source_record_id = cb.id
SET cb.status_id = @exported_status_id
WHERE cb.status_id = 0 AND ca.activity_type_id = @export_activity_type;

View file

@ -0,0 +1,5 @@
{* CRM-16846 - This file is never run, but it doesn't matter because the below query is undone by another alteration to the same column in 4.5.alpha1 *}
-- CRM-14903
ALTER TABLE `civicrm_mapping_field`
CHANGE COLUMN `operator` `operator` ENUM('=','!=','>','<','>=','<=','IN','NOT IN','LIKE','NOT LIKE','IS NULL','IS NOT NULL', 'IS EMPTY', 'IS NOT EMPTY', 'RLIKE');

View file

@ -0,0 +1,6 @@
{* file to handle db changes in 4.4.7 during upgrade *}
-- CRM-13571
UPDATE civicrm_state_province SET name = 'Møre og Romsdal' WHERE name = 'M<>re og Romsdal';
-- CRM-13604
UPDATE civicrm_state_province SET name = 'Sololá' WHERE name = 'Solol<6F>';

View file

@ -0,0 +1,161 @@
{include file='../CRM/Upgrade/4.4.alpha1.msg_template/civicrm_msg_template.tpl'}
-- CRM-12357
SELECT @option_group_id_cvOpt := max(id) FROM civicrm_option_group WHERE name = 'contact_view_options';
SELECT @max_val := MAX(ROUND(op.value)) FROM civicrm_option_value op WHERE op.option_group_id = @option_group_id_cvOpt;
SELECT @max_wt := MAX(ROUND(val.weight)) FROM civicrm_option_value val WHERE val.option_group_id = @option_group_id_cvOpt;
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
(@option_group_id_cvOpt, {localize}'{ts escape="sql"}Mailings{/ts}'{/localize}, @max_val+1, 'CiviMail', NULL, 0, NULL, @max_wt+1, 0, 0, 1, NULL, NULL);
INSERT INTO civicrm_setting
(domain_id, contact_id, is_domain, group_name, name, value)
VALUES
({$domainID}, NULL, 1, 'Mailing Preferences', 'write_activity_record', '{serialize}1{/serialize}');
-- CRM-12580
ALTER TABLE civicrm_contact ADD INDEX index_is_deleted_sort_name(is_deleted, sort_name, id);
ALTER TABLE civicrm_contact DROP INDEX index_is_deleted;
-- CRM-12495
DROP TABLE IF EXISTS `civicrm_task_status`;
DROP TABLE IF EXISTS `civicrm_task`;
DROP TABLE IF EXISTS `civicrm_project`;
-- CRM-12425
SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Spam';
INSERT INTO civicrm_mailing_bounce_pattern (bounce_type_id, pattern)
VALUES (@bounceTypeID, 'X-HmXmrOriginalRecipient');
-- CRM-12716
UPDATE civicrm_custom_field SET text_length = NULL WHERE html_type = 'TextArea' AND text_length = 255;
-- CRM-12288
SELECT @option_group_id_activity_type := max(id) from civicrm_option_group where name = 'activity_type';
SELECT @max_val := MAX(ROUND(op.value)) FROM civicrm_option_value op WHERE op.option_group_id = @option_group_id_activity_type;
SELECT @max_wt := max(weight) from civicrm_option_value where option_group_id=@option_group_id_activity_type;
INSERT INTO civicrm_option_value
(option_group_id, {localize field='label'}label{/localize}, {localize field='description'}description{/localize}, value, name, weight, filter, component_id)
VALUES
(@option_group_id_activity_type, {localize}'Inbound SMS'{/localize},{localize}'Inbound SMS'{/localize}, (SELECT @max_val := @max_val+1), 'Inbound SMS', (SELECT @max_wt := @max_wt+1), 1, NULL),
(@option_group_id_activity_type, {localize}'SMS delivery'{/localize},{localize}'SMS delivery'{/localize}, (SELECT @max_val := @max_val+1), 'SMS delivery', (SELECT @max_wt := @max_wt+1), 1, NULL);
-- CRM-13015 replaced if $multilingual w/ localize method
UPDATE `civicrm_option_value` SET {localize field="label"}label = '{ts escape="sql"}Outbound SMS{/ts}'{/localize}
WHERE name = 'SMS' and option_group_id = @option_group_id_activity_type;
-- CRM-12689
ALTER TABLE civicrm_action_schedule
ADD COLUMN limit_to tinyint(4) DEFAULT '1' COMMENT 'Is this the recipient criteria limited to OR in addition to?' AFTER recipient;
-- CRM-12653
SELECT @uf_group_contribution_batch_entry := max(id) FROM civicrm_uf_group WHERE name = 'contribution_batch_entry';
SELECT @uf_group_membership_batch_entry := max(id) FROM civicrm_uf_group WHERE name = 'membership_batch_entry';
INSERT INTO civicrm_uf_field
( uf_group_id, field_name, is_required, is_reserved, weight, visibility, in_selector, is_searchable, location_type_id, {localize field='label'}label{/localize}, field_type)
VALUES
( @uf_group_contribution_batch_entry, 'soft_credit', 0, 0, 10, 'User and User Admin Only', 0, 0, NULL, {localize}'Soft Credit'{/localize}, 'Contribution'),
( @uf_group_membership_batch_entry, 'soft_credit', 0, 0, 13, 'User and User Admin Only', 0, 0, NULL, {localize}'Soft Credit'{/localize}, 'Membership');
-- CRM-12809
ALTER TABLE `civicrm_custom_group`
ADD COLUMN `is_reserved` tinyint(4) DEFAULT '0' COMMENT 'Is this a reserved Custom Group?';
--CRM-12986 fix event_id & contact_id to NOT NULL fields on participant table
SET foreign_key_checks = 0;
ALTER TABLE `civicrm_participant`
CHANGE COLUMN `event_id` `event_id` INT(10) UNSIGNED NOT NULL,
CHANGE COLUMN `contact_id` `contact_id` INT(10) UNSIGNED NOT NULL;
SET foreign_key_checks = 1;
-- CRM-12964 civicrm_print_label table creation
CREATE TABLE IF NOT EXISTS `civicrm_print_label` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'User title for for this label layout',
`name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'variable name/programmatic handle for this field.',
`description` text COLLATE utf8_unicode_ci COMMENT 'Description of this label layout',
`label_format_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'This refers to name column of civicrm_option_value row in name_badge option group',
`label_type_id` int(10) unsigned DEFAULT NULL COMMENT 'Implicit FK to civicrm_option_value row in NEW label_type option group',
`data` longtext COLLATE utf8_unicode_ci COMMENT 'contains json encode configurations options',
`is_default` tinyint(4) DEFAULT '1' COMMENT 'Is this default?',
`is_active` tinyint(4) DEFAULT '1' COMMENT 'Is this option active?',
`is_reserved` tinyint(4) DEFAULT '1' COMMENT 'Is this reserved label?',
`created_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to civicrm_contact, who created this label layout',
PRIMARY KEY (`id`),
KEY `FK_civicrm_print_label_created_id` (`created_id`),
CONSTRAINT `FK_civicrm_print_label_created_id` FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
-- CRM-12964 adding meta-data
INSERT INTO
`civicrm_option_group` (`name`, {localize field='title'}`title`{/localize}, `is_reserved`, `is_active`)
VALUES
('label_type', {localize}'{ts escape="sql"}Label Type{/ts}'{/localize}, 1, 1),
('name_badge', {localize}'{ts escape="sql"}Name Badge Format{/ts}'{/localize}, 1, 1);
SELECT @option_group_id_label_type := max(id) from civicrm_option_group where name = 'label_type';
SELECT @option_group_id_name_badge := max(id) from civicrm_option_group where name = 'name_badge';
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
(@option_group_id_label_type, {localize}'{ts escape="sql"}Event Badge{/ts}'{/localize}, 1, 'Event Badge', NULL, 0, NULL, 1, 0, 0, 1, NULL, NULL),
(@option_group_id_name_badge, {localize}'{ts escape="sql"}Avery 5395{/ts}'{/localize}, '{literal}{"name":"Avery 5395","paper-size":"a4","metric":"mm","lMargin":13.5,"tMargin":3,"NX":2,"NY":4,"SpaceX":15,"SpaceY":8.5,"width":85.7,"height":59.2,"font-size":12,"orientation":"portrait","font-name":"helvetica","font-style":"","lPadding":0,"tPadding":0}{/literal}', 'Avery 5395', NULL, 0, NULL, 1, 0, 0, 1, NULL, NULL);
-- CRM-12964 adding navigation
UPDATE civicrm_navigation
SET url = 'civicrm/admin/badgelayout&reset=1',
name = 'Event Name Badge Layouts',
label= '{ts escape="sql" skip="true"}Event Name Badge Layouts{/ts}'
WHERE name = 'Event Badge Formats';
--CRM-12539 change 'Greater London' to 'London'
UPDATE `civicrm_state_province` SET `name` = 'London' WHERE `name` = 'Greater London';
UPDATE `civicrm_premiums` SET {localize field="premiums_nothankyou_label"}premiums_nothankyou_label = '{ts escape="sql"}No thank-you{/ts}'{/localize};
-- CRM-13015 Change address option labels from Additional Address to Supplemental Address
SELECT @option_group_id_addroptions := max(id) from civicrm_option_group where name = 'address_options';
UPDATE civicrm_option_value
SET {localize field="label"}label = '{ts escape="sql"}Supplemental Address 1{/ts}'{/localize}
WHERE name = 'supplemental_address_1' AND option_group_id = @option_group_id_addroptions;
UPDATE civicrm_option_value
SET {localize field="label"}label = '{ts escape="sql"}Supplemental Address 2{/ts}'{/localize}
WHERE name = 'supplemental_address_2' AND option_group_id = @option_group_id_addroptions;
-- CRM-12717
UPDATE `civicrm_navigation` SET label = '{ts escape="sql"}Misc (Undelete, PDFs, Limits, Logging, Captcha, etc.){/ts}', name = 'Misc (Undelete, PDFs, Limits, Logging, Captcha, etc.)'
WHERE url = 'civicrm/admin/setting/misc&reset=1';
-- CRM-13112
ALTER TABLE civicrm_survey
ADD is_share TINYINT( 4 ) NULL DEFAULT '1' COMMENT 'Can people share the petition through social media?';
-- CRM-12439
{if $multilingual}
ALTER TABLE `civicrm_uf_group`
ADD `description` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Optional verbose description of the profile.' AFTER `group_type`;
{else}
ALTER TABLE `civicrm_uf_group`
ADD `description` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Optional verbose description of the profile.' AFTER `title`;
{/if}
--CRM-13142
UPDATE
civicrm_uf_field uf
INNER JOIN
civicrm_uf_group ug ON uf.uf_group_id = ug.id AND ug.is_reserved = 1 AND name = 'membership_batch_entry'
SET uf.is_reserved = 0
WHERE uf.field_name IN ('join_date', 'membership_start_date', 'membership_end_date');
--CRM-13155 - Add searching for recurring contribution data to search has been successfully created.
ALTER TABLE `civicrm_contribution_recur`
CHANGE COLUMN `next_sched_contribution` `next_sched_contribution_date` DATETIME NULL DEFAULT NULL COMMENT 'At Groundspring this was used by the cron job which triggered payments. If we\'re not doing that but we know about payments, it might still be useful to store for display to org andor contributors.' AFTER `cycle_day`;

View file

@ -0,0 +1,9 @@
{* file to handle db changes in 4.4.beta1 during upgrade *}
-- CRM-13314 Added States for Uruguay
INSERT IGNORE INTO civicrm_state_province (id, country_id, abbreviation, name) VALUES
(NULL, 1229, "FL", "Florida"),
(NULL, 1229, "RN", "Rio Negro"),
(NULL, 1229, "SJ", "San Jose");
ALTER TABLE civicrm_email
MODIFY email VARCHAR(254);

View file

@ -0,0 +1,11 @@
{* file to handle db changes in 4.5.0 during upgrade *}
{include file='../CRM/Upgrade/4.5.0.msg_template/civicrm_msg_template.tpl'}
ALTER TABLE `civicrm_action_schedule`
ADD COLUMN `sms_template_id` int(10) unsigned DEFAULT NULL COMMENT 'SMS Reminder Template. FK to id in civicrm_msg_template.' AFTER `msg_template_id`,
ADD COLUMN `sms_body_text` longtext COLLATE utf8_unicode_ci COMMENT 'Body of the mailing in html format.' AFTER `body_html`,
ADD CONSTRAINT `FK_civicrm_action_schedule_sms_template_id` FOREIGN KEY (`sms_template_id`) REFERENCES civicrm_msg_template(`id`) ON DELETE SET NULL;
ALTER TABLE `civicrm_msg_template`
ADD COLUMN `is_sms` tinyint(4) DEFAULT '0' COMMENT 'Is this message template used for sms?';

View file

@ -0,0 +1 @@
{* file to handle db changes in 4.5.1 during upgrade *}

View file

@ -0,0 +1,5 @@
{* file to handle db changes in 4.5.2 during upgrade *}
-- CRM-15467 Also fix group_type for Honoree Profile
UPDATE civicrm_uf_group SET group_type = 'Individual,Contact' WHERE name = 'honoree_individual';

View file

@ -0,0 +1,12 @@
{* file to handle db changes in 4.5.3 during upgrade *}
-- CRM-15475
SELECT @membershipStatusId := id FROM civicrm_membership_status WHERE name = 'Cancelled';
SELECT @membershipStatusWeight := max(weight) + 1 FROM civicrm_membership_status;
INSERT INTO civicrm_membership_status (id, name, {localize field='label'}label{/localize}, start_event, start_event_adjust_unit, start_event_adjust_interval, end_event, end_event_adjust_unit, end_event_adjust_interval, is_current_member, is_admin, weight, is_default, is_active, is_reserved)
VALUES (@membershipStatusId, 'Cancelled', {localize}'{ts escape="sql"}Cancelled{/ts}'{/localize}, 'join_date', null, null, 'join_date', null, null, 0, 0, @membershipStatusWeight, 0, 0, 1)
ON DUPLICATE KEY UPDATE is_reserved = 1;
-- CRM-15558
ALTER TABLE `civicrm_mailing_bounce_type` CHANGE `name` `name` VARCHAR( 24 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'Type of bounce';

View file

@ -0,0 +1 @@
{* file to handle db changes in 4.5.4 during upgrade *}

View file

@ -0,0 +1,5 @@
{* file to handle db changes in 4.5.5 during upgrade *}
-- https://issues.civicrm.org/jira/browse/CRM-15630
UPDATE civicrm_msg_template SET msg_html = REPLACE(msg_html, 'email=true', 'emailMode=true') WHERE msg_title = 'Petition - signature added';

View file

@ -0,0 +1,4 @@
{* file to handle db changes in 4.5.6 during upgrade *}
-- CRM-15760
ALTER TABLE `civicrm_action_schedule` CHANGE `entity_value` `entity_value` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Entity value';

View file

@ -0,0 +1,6 @@
{* file to handle db changes in 4.5.7 during upgrade *}
-- CRM-15931
UPDATE civicrm_mailing_group SET group_type = 'Include' WHERE group_type = 'include';
UPDATE civicrm_mailing_group SET group_type = 'Exclude' WHERE group_type = 'exclude';
UPDATE civicrm_mailing_group SET group_type = 'Base' WHERE group_type = 'base';

View file

@ -0,0 +1 @@
{* file to handle db changes in 4.5.8 during upgrade *}

View file

@ -0,0 +1 @@
{* CRM-16846 - This file is never run, but it doesn't matter because it's empty *}

View file

@ -0,0 +1,541 @@
{* file to handle db changes in 4.5.alpha1 during upgrade *}
{include file='../CRM/Upgrade/4.5.alpha1.msg_template/civicrm_msg_template.tpl'}
ALTER TABLE `civicrm_contact`
ADD COLUMN `formal_title` varchar(64) COMMENT 'Formal (academic or similar) title in front of name. (Prof., Dr. etc.)' AFTER `suffix_id`;
ALTER TABLE `civicrm_contact`
ADD COLUMN `communication_style_id` int(10) unsigned COMMENT 'Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.' AFTER `formal_title`,
ADD INDEX `index_communication_style_id` (`communication_style_id`);
INSERT INTO
`civicrm_option_group` (`name`, {localize field='title'}`title`{/localize}, `is_reserved`, `is_active`)
VALUES
('communication_style', {localize}'{ts escape="sql"}Communication Style{/ts}'{/localize}, 1, 1);
SELECT @option_group_id_communication_style := max(id) from civicrm_option_group where name = 'communication_style';
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
(@option_group_id_communication_style, {localize}'{ts escape="sql"}Formal{/ts}'{/localize}, 1, 'formal' , NULL, 0, 1, 1, 0, 0, 1, NULL, NULL),
(@option_group_id_communication_style, {localize}'{ts escape="sql"}Familiar{/ts}'{/localize}, 2, 'familiar', NULL, 0, 0, 2, 0, 0, 1, NULL, NULL);
-- Insert menu item at Administer > Communications, above the various Greeting Formats
SELECT @parent_id := `id` FROM `civicrm_navigation` WHERE `name` = 'Communications' AND `domain_id` = {$domainID};
SELECT @add_weight := MIN(`weight`) FROM `civicrm_navigation` WHERE `name` IN('Email Greeting Formats', 'Postal Greeting Formats', 'Addressee Formats') AND `parent_id` = @parent_id;
UPDATE `civicrm_navigation`
SET `weight` = `weight`+1
WHERE `parent_id` = @parent_id
AND `weight` >= @add_weight;
INSERT INTO `civicrm_navigation`
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/admin/options/communication_style&group=communication_style&reset=1', '{ts escape="sql" skip="true"}Communication Style Options{/ts}', 'Communication Style Options', 'administer CiviCRM', '', @parent_id, '1', NULL, @add_weight );
-- CRM-9988 Change world region of Panama country to America South, Central, North and Caribbean
UPDATE `civicrm_country` SET `region_id` = 2 WHERE `id` = 1166;
SELECT @option_group_id_contact_edit_options := max(id) from civicrm_option_group where name = 'contact_edit_options';
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
(@option_group_id_contact_edit_options, {localize}'{ts escape="sql"}Prefix{/ts}'{/localize} , 12, 'Prefix' , NULL, 2, NULL, 12, 0, 0, 1, NULL, NULL),
(@option_group_id_contact_edit_options, {localize}'{ts escape="sql"}Formal Title{/ts}'{/localize}, 13, 'Formal Title', NULL, 2, NULL, 13, 0, 0, 1, NULL, NULL),
(@option_group_id_contact_edit_options, {localize}'{ts escape="sql"}First Name{/ts}'{/localize} , 14, 'First Name' , NULL, 2, NULL, 14, 0, 0, 1, NULL, NULL),
(@option_group_id_contact_edit_options, {localize}'{ts escape="sql"}Middle Name{/ts}'{/localize} , 15, 'Middle Name' , NULL, 2, NULL, 15, 0, 0, 1, NULL, NULL),
(@option_group_id_contact_edit_options, {localize}'{ts escape="sql"}Last Name{/ts}'{/localize} , 16, 'Last Name' , NULL, 2, NULL, 16, 0, 0, 1, NULL, NULL),
(@option_group_id_contact_edit_options, {localize}'{ts escape="sql"}Suffix{/ts}'{/localize} , 17, 'Suffix' , NULL, 2, NULL, 17, 0, 0, 1, NULL, NULL);
-- CRM-13857
ALTER TABLE civicrm_group
ADD COLUMN `modified_id` INT(10) unsigned DEFAULT NULL COMMENT 'FK to contact table, modifier of the group.',
ADD CONSTRAINT `FK_civicrm_group_modified_id` FOREIGN KEY (`modified_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL;
-- CRM-13913
ALTER TABLE civicrm_word_replacement
ALTER COLUMN `is_active` SET DEFAULT 1;
--CRM-13833 Implement Soft Credit Type for Contribution
INSERT INTO civicrm_option_group
(name, {localize field='title'}title{/localize}, is_reserved, is_active) VALUES ('soft_credit_type', {localize}'{ts escape="sql"}Soft Credit Types{/ts}'{/localize}, 1, 1);
SELECT @option_group_id_soft_credit_type := max(id) from civicrm_option_group where name = 'soft_credit_type';
INSERT INTO `civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `weight`, `is_default`, `is_active`, `is_reserved`)
VALUES
(@option_group_id_soft_credit_type , {localize}'{ts escape="sql"}In Honor of{/ts}'{/localize}, 1, 'in_honor_of', 1, 0, 1, 1),
(@option_group_id_soft_credit_type , {localize}'{ts escape="sql"}In Memory of{/ts}'{/localize}, 2, 'in_memory_of', 2, 0, 1, 1),
(@option_group_id_soft_credit_type , {localize}'{ts escape="sql"}Solicited{/ts}'{/localize}, 3, 'solicited', 3, 0, 1, 1),
(@option_group_id_soft_credit_type , {localize}'{ts escape="sql"}Household{/ts}'{/localize}, 4, 'household', 4, 0, 1, 0),
(@option_group_id_soft_credit_type , {localize}'{ts escape="sql"}Workplace Giving{/ts}'{/localize}, 5, 'workplace', 5, 0, 1, 0),
(@option_group_id_soft_credit_type , {localize}'{ts escape="sql"}Foundation Affiliate{/ts}'{/localize}, 6, 'foundation_affiliate', 6, 0, 1, 0),
(@option_group_id_soft_credit_type , {localize}'{ts escape="sql"}3rd-party Service{/ts}'{/localize}, 7, '3rd-party_service', 7, 0, 1, 0),
(@option_group_id_soft_credit_type , {localize}'{ts escape="sql"}Donor-advised Fund{/ts}'{/localize}, 8, 'donor-advised_fund', 8, 0, 1, 0),
(@option_group_id_soft_credit_type , {localize}'{ts escape="sql"}Matched Gift{/ts}'{/localize}, 9, 'matched_gift', 9, 0, 1, 0),
(@option_group_id_soft_credit_type , {localize}'{ts escape="sql"}Personal Campaign Page{/ts}'{/localize}, 10, 'pcp', 10, 0, 1, 1),
(@option_group_id_soft_credit_type , {localize}'{ts escape="sql"}Gift{/ts}'{/localize}, 11, 'gift', 11, 0, 1, 1);
ALTER TABLE `civicrm_contribution_soft`
ADD COLUMN `soft_credit_type_id` int(10) unsigned COMMENT 'Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.';
INSERT INTO civicrm_contribution_soft(contribution_id, contact_id, amount, currency, soft_credit_type_id)
SELECT id, honor_contact_id, total_amount, currency, honor_type_id
FROM civicrm_contribution
WHERE honor_contact_id IS NOT NULL;
SELECT @sct_pcp_id := value from civicrm_option_value where name = 'pcp' and option_group_id = @option_group_id_soft_credit_type;
UPDATE `civicrm_contribution_soft`
SET soft_credit_type_id = @sct_pcp_id
WHERE pcp_id IS NOT NULL;
--CRM-13734 make basic Case Activity Types reserved
SELECT @option_group_id_activity_type := id from civicrm_option_group where name = 'activity_type';
SELECT @caseCompId := id FROM `civicrm_component` where `name` like 'CiviCase';
UPDATE `civicrm_option_value`
SET is_reserved = 1
WHERE is_reserved = 0 AND option_group_id = @option_group_id_activity_type AND component_id = @caseCompId;
-- CRM-13912
ALTER TABLE civicrm_action_schedule
ADD COLUMN `mode` varchar(128) COLLATE utf8_unicode_ci DEFAULT 'Email' COMMENT 'Send the message as email or sms or both.';
INSERT INTO
civicrm_option_group (name, {localize field='title'}title{/localize}, is_reserved, is_active)
VALUES
('msg_mode', {localize}'{ts escape="sql"}Message Mode{/ts}'{/localize}, 1, 1);
SELECT @option_group_id_msg_mode := max(id) from civicrm_option_group where name = 'msg_mode';
INSERT INTO
civicrm_option_value (option_group_id, {localize field='label'}`label`{/localize}, value, name, is_default, weight, is_reserved, is_active)
VALUES
(@option_group_id_msg_mode, {localize}'{ts escape="sql"}Email{/ts}'{/localize}, 'Email', 'Email', 1, 1, 1, 1),
(@option_group_id_msg_mode, {localize}'{ts escape="sql"}SMS{/ts}'{/localize},'SMS', 'SMS', 0, 2, 1, 1),
(@option_group_id_msg_mode, {localize}'{ts escape="sql"}User Preference{/ts}'{/localize}, 'User_Preference', 'User Preference', 0, 3, 1, 1);
ALTER TABLE civicrm_action_schedule ADD sms_provider_id int(10) unsigned NULL COMMENT 'FK to civicrm_sms_provider id ';
ALTER TABLE civicrm_action_schedule ADD CONSTRAINT FK_civicrm_action_schedule_sms_provider_id FOREIGN KEY (`sms_provider_id`) REFERENCES `civicrm_sms_provider` (`id`) ON DELETE SET NULL;
--CRM-13981 migrate 'In Honor of' to Soft Credits
INSERT INTO `civicrm_uf_group`
(`name`, `group_type`, {localize field='title'}`title`{/localize}, `is_cms_user`, `is_reserved`)
VALUES
('honoree_individual', 'Individual,Contact', {localize}'{ts escape="sql"}Honoree Individual{/ts}'{/localize}, 0, 1);
SELECT @uf_group_id_honoree_individual := id from civicrm_uf_group where name = 'honoree_individual';
SELECT @primaryLocation := id FROM civicrm_location_type WHERE is_default = 1;
INSERT INTO `civicrm_uf_field`
(`uf_group_id`, `field_name`, `is_required`, `is_reserved`, `weight`, `visibility`, `in_selector`, `is_searchable`, `location_type_id`, {localize field='label'}`label`{/localize}, field_type)
VALUES
(@uf_group_id_honoree_individual, 'prefix_id', 0, 1, 1, 'User and User Admin Only', 0, 1, NULL, {localize}'{ts escape="sql"}Individual Prefix{/ts}'{/localize}, 'Individual'),
(@uf_group_id_honoree_individual, 'first_name', 0, 1, 2, 'User and User Admin Only', 0, 1, NULL, {localize}'{ts escape="sql"}First Name{/ts}'{/localize}, 'Individual'),
(@uf_group_id_honoree_individual, 'last_name', 0, 1, 3, 'User and User Admin Only', 0, 1, NULL, {localize}'{ts escape="sql"}Last Name{/ts}'{/localize}, 'Individual'),
(@uf_group_id_honoree_individual, 'email', 0, 1, 4, 'User and User Admin Only', 0, 1, @primaryLocation, {localize}'{ts escape="sql"}Email Address{/ts}'{/localize}, 'Individual');
UPDATE civicrm_uf_join SET uf_group_id = @uf_group_id_honoree_individual WHERE module = 'soft_credit';
{if $multilingual}
{foreach from=$locales item=loc}
ALTER TABLE civicrm_contribution_page DROP honor_block_title_{$loc};
ALTER TABLE civicrm_contribution_page DROP honor_block_text_{$loc};
{/foreach}
{else}
ALTER TABLE civicrm_contribution_page DROP honor_block_title;
ALTER TABLE civicrm_contribution_page DROP honor_block_text;
{/if}
ALTER TABLE civicrm_contribution_page DROP honor_block_is_active;
ALTER TABLE civicrm_contribution DROP FOREIGN KEY `FK_civicrm_contribution_honor_contact_id`;
ALTER TABLE civicrm_contribution DROP honor_contact_id;
ALTER TABLE civicrm_contribution DROP honor_type_id;
ALTER TABLE civicrm_pledge DROP FOREIGN KEY `FK_civicrm_pledge_honor_contact_id`;
ALTER TABLE civicrm_pledge DROP honor_contact_id;
ALTER TABLE civicrm_pledge DROP honor_type_id;
-- CRM-13964 and CRM-13965
SELECT @option_group_id_cs := max(id) from civicrm_option_group where name = 'contribution_status';
SELECT @option_val_id_cs_wt := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_cs;
SELECT @option_val_id_cs_val := MAX(ROUND(value)) FROM civicrm_option_value WHERE option_group_id = @option_group_id_cs;
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}label{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
(@option_group_id_cs, {localize}'{ts escape="sql"}Partially paid{/ts}'{/localize}, @option_val_id_cs_val+1, 'Partially paid', NULL, 0, NULL, @option_val_id_cs_wt+1, 0, 1, 1, NULL, NULL),
(@option_group_id_cs, {localize}'{ts escape="sql"}Pending refund{/ts}'{/localize}, @option_val_id_cs_val+2, 'Pending refund', NULL, 0, NULL, @option_val_id_cs_wt+2, 0, 1, 1, NULL, NULL);
-- participant status adding
SELECT @participant_status_wt := max(id) from civicrm_participant_status_type;
INSERT INTO civicrm_participant_status_type (name, {localize field='label'}label{/localize}, class, is_reserved, is_active, is_counted, weight, visibility_id)
VALUES
('Partially paid', {localize}'{ts escape="sql"}Partially paid{/ts}'{/localize}, 'Positive', 1, 1, 1, @participant_status_wt+1, 2),
('Pending refund', {localize}'{ts escape="sql"}Pending refund{/ts}'{/localize}, 'Positive', 1, 1, 1, @participant_status_wt+2, 2);
-- new activity types required for partial payments
SELECT @option_group_id_act := max(id) from civicrm_option_group where name = 'activity_type';
SELECT @option_group_id_act_wt := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act;
SELECT @option_group_id_act_val := MAX(ROUND(value)) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act;
SELECT @contributeCompId := max(id) FROM civicrm_component where name = 'CiviContribute';
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, {localize field='description'}`description`{/localize}, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
(@option_group_id_act, {localize}'{ts escape="sql"}Payment{/ts}'{/localize}, @option_group_id_act_val+1, 'Payment', NULL, 1, NULL, @option_group_id_act_wt+1, {localize}'{ts escape="sql"}Additional payment recorded for event or membership fee.{/ts}'{/localize}, 0, 1, 1, @contributeCompId, NULL),
(@option_group_id_act, {localize}'{ts escape="sql"}Refund{/ts}'{/localize}, @option_group_id_act_val+2, 'Refund', NULL, 1, NULL, @option_group_id_act_wt+2, {localize}'{ts escape="sql"}Refund recorded for event or membership fee.{/ts}'{/localize}, 0, 1, 1, @contributeCompId, NULL),
(@option_group_id_act, {localize}'{ts escape="sql"}Change Registration{/ts}'{/localize}, @option_group_id_act_val+3, 'Change Registration', NULL, 1, NULL, @option_group_id_act_wt+3, {localize}'{ts escape="sql"}Changes to an existing event registration.{/ts}'{/localize}, 0, 1, 1, @eventCompId, NULL);
-- CRM-13970
UPDATE civicrm_navigation set url = 'civicrm/admin/options/from_email_address&reset=1' WHERE url LIKE 'civicrm/admin/options/from_email%';
UPDATE civicrm_navigation set url = CONCAT(SUBSTRING_INDEX(url, '&', 1), '&reset=1') WHERE url LIKE 'civicrm/admin/options/%';
-- CRM-14181
ALTER TABLE civicrm_acl CHANGE operation operation VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'What operation does this ACL entry control?';
ALTER TABLE civicrm_campaign_group CHANGE group_type group_type VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Type of Group.';
ALTER TABLE `civicrm_acl_contact_cache` CHANGE `operation` `operation` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'What operation does this user have permission on?';
ALTER TABLE `civicrm_price_field` CHANGE `html_type` `html_type` VARCHAR( 12 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
ALTER TABLE `civicrm_pledge` CHANGE `frequency_unit` `frequency_unit` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT 'month' COMMENT 'Time units for recurrence of pledge payments.';
ALTER TABLE `civicrm_membership_type` CHANGE `duration_unit` `duration_unit` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Unit in which membership period is expressed.';
ALTER TABLE `civicrm_membership_type` CHANGE `period_type` `period_type` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.';
ALTER TABLE `civicrm_membership_status` CHANGE `start_event` `start_event` VARCHAR( 12 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Event when this status starts.';
ALTER TABLE `civicrm_membership_status` CHANGE `start_event_adjust_unit` `start_event_adjust_unit` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Unit used for adjusting from start_event.';
ALTER TABLE `civicrm_membership_status` CHANGE `end_event` `end_event` VARCHAR( 12 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Event after which this status ends.';
ALTER TABLE `civicrm_membership_status` CHANGE `end_event_adjust_unit` `end_event_adjust_unit` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Unit used for adjusting from the ending event.';
ALTER TABLE `civicrm_mailing_job` CHANGE `status` `status` VARCHAR( 12 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'The state of this job';
ALTER TABLE `civicrm_mailing_group` CHANGE `group_type` `group_type` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Are the members of the group included or excluded?.';
ALTER TABLE `civicrm_mailing` CHANGE `visibility` `visibility` VARCHAR( 40 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT 'User and User Admin Only' COMMENT 'In what context(s) is the mailing contents visible (online viewing)';
ALTER TABLE `civicrm_mailing_component` CHANGE `component_type` `component_type` VARCHAR( 12 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Type of Component.';
ALTER TABLE `civicrm_mailing_bounce_type` CHANGE `name` `name` VARCHAR( 24 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'Type of bounce';
ALTER TABLE `civicrm_participant_status_type` CHANGE `class` `class` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'the general group of status type this one belongs to';
ALTER TABLE `civicrm_dedupe_rule_group` CHANGE `contact_type` `contact_type` VARCHAR( 12 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'The type of contacts this group applies to';
ALTER TABLE `civicrm_dedupe_rule_group` CHANGE `used` `used` VARCHAR( 12 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'Whether the rule should be used for cases where usage is Unsupervised, Supervised OR General(programatically)';
ALTER TABLE `civicrm_word_replacement` CHANGE `match_type` `match_type` VARCHAR( 16 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT 'wildcardMatch';
ALTER TABLE `civicrm_uf_field` CHANGE `visibility` `visibility` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT 'User and User Admin Only' COMMENT 'In what context(s) is this field visible.';
ALTER TABLE `civicrm_mapping_field` CHANGE `operator` `operator` VARCHAR( 16 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'SQL WHERE operator for search-builder mapping fields (search criteria).';
ALTER TABLE `civicrm_job` CHANGE `run_frequency` `run_frequency` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT 'Daily' COMMENT 'Scheduled job run frequency.';
ALTER TABLE `civicrm_extension` CHANGE `type` `type` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
ALTER TABLE `civicrm_custom_group` CHANGE `style` `style` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Visual relationship between this form and its parent.';
ALTER TABLE `civicrm_custom_field` CHANGE `data_type` `data_type` VARCHAR( 16 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'Controls location of data storage in extended_data table.';
ALTER TABLE `civicrm_custom_field` CHANGE `html_type` `html_type` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'HTML types plus several built-in extended types.';
ALTER TABLE `civicrm_action_schedule` CHANGE `start_action_unit` `start_action_unit` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Time units for reminder.';
ALTER TABLE `civicrm_action_schedule` CHANGE `repetition_frequency_unit` `repetition_frequency_unit` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Time units for repetition of reminder.';
ALTER TABLE `civicrm_action_schedule` CHANGE `end_frequency_unit` `end_frequency_unit` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Time units till repetition of reminder.';
ALTER TABLE `civicrm_product` CHANGE `period_type` `period_type` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT 'rolling' COMMENT 'Rolling means we set start/end based on current day, fixed means we set start/end for current year or month(e.g. 1 year + fixed -> we would set start/end for 1/1/06 thru 12/31/06 for any premium chosen in 2006) ';
ALTER TABLE `civicrm_product` CHANGE `duration_unit` `duration_unit` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT 'year';
ALTER TABLE `civicrm_product` CHANGE `frequency_unit` `frequency_unit` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT 'month' COMMENT 'Frequency unit and interval allow option to store actual delivery frequency for a subscription or service.';
ALTER TABLE `civicrm_contribution_recur` CHANGE `frequency_unit` `frequency_unit` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT 'month' COMMENT 'Time units for recurrence of payment.';
ALTER TABLE `civicrm_subscription_history` CHANGE `method` `method` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'How the (un)subscription was triggered';
ALTER TABLE `civicrm_subscription_history` CHANGE `status` `status` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'The state of the contact within the group';
ALTER TABLE `civicrm_relationship_type` CHANGE `contact_type_a` `contact_type_a` VARCHAR( 12 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'If defined, contact_a in a relationship of this type must be a specific contact_type.';
ALTER TABLE `civicrm_relationship_type` CHANGE `contact_type_b` `contact_type_b` VARCHAR( 12 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'If defined, contact_b in a relationship of this type must be a specific contact_type.';
ALTER TABLE `civicrm_group_contact` CHANGE `status` `status` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'status of contact relative to membership in group';
ALTER TABLE `civicrm_group` CHANGE `visibility` `visibility` VARCHAR( 24 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT 'User and User Admin Only' COMMENT 'In what context(s) is this field visible.';
ALTER TABLE `civicrm_contact` CHANGE `preferred_mail_format` `preferred_mail_format` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT 'Both' COMMENT 'What is the preferred mode of sending an email.';
-- CRM-14183
INSERT IGNORE INTO civicrm_state_province (country_id, abbreviation, name) VALUES (1157, "PL", "Plateau");
UPDATE civicrm_state_province SET name = "Abuja Federal Capital Territory" WHERE name = "Abuja Capital Territory";
-- CRM-13992
ALTER TABLE `civicrm_custom_field`
ADD COLUMN `in_selector` tinyint(4) DEFAULT '0' COMMENT 'Should the multi-record custom field values be displayed in tab table listing';
UPDATE civicrm_custom_field cf
LEFT JOIN civicrm_custom_group cg
ON cf.custom_group_id = cg.id
SET cf.in_selector = 1
WHERE cg.is_multiple = 1 AND cf.html_type != 'TextArea';
ALTER TABLE `civicrm_custom_group`
CHANGE COLUMN `style` `style` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Visual relationship between this form and its parent.';
-- Add "developer" help menu
SELECT @parent_id := `id` FROM `civicrm_navigation` WHERE `name` = 'Help' AND `domain_id` = {$domainID};
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, NULL, '{ts escape="sql" skip="true"}Developer{/ts}', 'Developer', 'administer CiviCRM', '', @parent_id, '1', NULL, 5 );
SET @devellastID:=LAST_INSERT_ID();
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/api', '{ts escape="sql" skip="true"}API Explorer{/ts}','API Explorer', 'administer CiviCRM', '', @devellastID, '1', NULL, 1 ),
( {$domainID}, 'http://wiki.civicrm.org/confluence/display/CRMDOC/Develop', '{ts escape="sql" skip="true"}Developer Docs{/ts}', 'Developer Docs', 'administer CiviCRM', '', @devellastID, '1', NULL, 3 );
-- CRM-14435
ALTER TABLE `civicrm_mail_settings`
ADD CONSTRAINT `FK_civicrm_mail_settings_domain_id` FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain` (`id`) ON DELETE CASCADE;
-- CRM-14436
ALTER TABLE `civicrm_mailing`
ADD COLUMN `hash` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Key for validating requests related to this mailing.',
ADD INDEX `index_hash` (`hash`);
-- CRM-14300
UPDATE `civicrm_event` SET is_template = 0 WHERE is_template IS NULL;
ALTER TABLE `civicrm_event`
CHANGE is_template is_template tinyint(4) DEFAULT '0' COMMENT 'whether the event has template';
-- CRM-14493
INSERT IGNORE INTO civicrm_state_province (country_id, abbreviation, name) VALUES (1085, "61", "Pieria");
-- CRM-14445
ALTER TABLE `civicrm_option_group`
ADD COLUMN `is_locked` int(1) DEFAULT 0 COMMENT 'A lock to remove the ability to add new options via the UI';
UPDATE `civicrm_option_group` SET is_locked = 1 WHERE name IN ('contribution_status','activity_contacts','advanced_search_options','auto_renew_options','contact_autocomplete_options','batch_status','batch_type','batch_mode','contact_edit_options','contact_reference_options','contact_smart_group_display','contact_view_options','financial_item_status','mapping_type','pcp_status','user_dashboard_options','tag_used_for');
-- CRM-14449
CREATE TABLE IF NOT EXISTS `civicrm_system_log` (
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'Primary Key: ID.',
`message` VARCHAR(128) NOT NULL COMMENT 'Standardized message',
`context` LONGTEXT NULL COMMENT 'JSON encoded data',
`level` VARCHAR(9) NOT NULL DEFAULT 'info' COMMENT 'error level per PSR3',
`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp of when event occurred.',
`contact_id` INT(11) NULL DEFAULT NULL COMMENT 'Optional Contact ID that created the log. Not an FK as we keep this regardless',
hostname VARCHAR(128) NOT NULL COMMENT 'Optional Name of logging host',
PRIMARY KEY (`id`),
INDEX `message` (`message`),
INDEX `contact_id` (`contact_id`),
INDEX `level` (`level`)
)
COMMENT='Table that contains logs of all system events.'
COLLATE='utf8_general_ci';
-- CRM-14473 civicrm_case_type table creation and migration
CREATE TABLE IF NOT EXISTS `civicrm_case_type` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Autoincremented type id',
`name` varchar(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Machine name for Case Type',
{localize field='title'}title varchar(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Natural language name for Case Type'{/localize},
{localize field='description'}description varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Description of the Case Type'{/localize},
`is_active` tinyint(4) DEFAULT NULL COMMENT 'Is this entry active?',
`is_reserved` tinyint(4) DEFAULT NULL COMMENT 'Is this case type a predefined system type?',
`weight` int(11) NOT NULL DEFAULT '1' COMMENT 'Ordering of the case types',
`definition` blob COMMENT 'xml definition of case type',
PRIMARY KEY (`id`),
UNIQUE KEY `case_type_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
SELECT @option_group_id_case_type := max(id) from civicrm_option_group where name = 'case_type';
INSERT IGNORE INTO civicrm_case_type
(id, name, {localize field='title'}title{/localize}, {localize field='description'}description{/localize}, is_active, is_reserved, weight)
SELECT
value,
name,
{localize field='label'}label{/localize},
{localize field='description'}description{/localize},
is_active,
is_reserved,
weight
FROM civicrm_option_value
WHERE
option_group_id = @option_group_id_case_type;
-- Remove the special character, earlier used as a separator and reference to civicrm_case_type.id
UPDATE civicrm_case SET case_type_id = replace(case_type_id, 0x01, '');
ALTER TABLE civicrm_case
MODIFY case_type_id int(10) unsigned COLLATE utf8_unicode_ci NULL COMMENT 'FK to civicrm_case_type.id',
ADD CONSTRAINT FK_civicrm_case_case_type_id FOREIGN KEY (case_type_id) REFERENCES civicrm_case_type (id) ON DELETE SET NULL;
-- CRM-15343 set the auto increment civicrm_case_type.id start point to max id to avoid conflict in future insertion
SELECT @max_case_type_id := max(id) from civicrm_case_type;
SET @query = CONCAT("ALTER TABLE civicrm_case_type AUTO_INCREMENT = ", IFNULL(@max_case_type_id,1));
PREPARE alter_case_type_auto_inc FROM @query;
EXECUTE alter_case_type_auto_inc;
DEALLOCATE PREPARE alter_case_type_auto_inc;
DELETE FROM civicrm_option_value WHERE option_group_id = @option_group_id_case_type;
DELETE FROM civicrm_option_group WHERE id = @option_group_id_case_type;
-- CRM-14611
{if $multilingual}
{foreach from=$locales item=locale}
ALTER TABLE civicrm_survey ADD title_{$locale} varchar(255);
UPDATE civicrm_survey SET title_{$locale} = title;
ALTER TABLE civicrm_survey ADD instructions_{$locale} TEXT;
UPDATE civicrm_survey SET instructions_{$locale} = instructions;
{/foreach}
ALTER TABLE civicrm_survey DROP title;
ALTER TABLE civicrm_survey DROP instructions;
{/if}
-- CRM-11182 -- Make event confirmation page optional
ALTER TABLE civicrm_event
ADD COLUMN is_confirm_enabled tinyint(4) DEFAULT '1';
UPDATE civicrm_event
SET is_confirm_enabled = 1
WHERE is_monetary = 1;
UPDATE civicrm_event
SET is_confirm_enabled = 0
WHERE is_monetary = 0;
-- CRM-11182
ALTER TABLE civicrm_event
ADD COLUMN dedupe_rule_group_id int(10) unsigned DEFAULT NULL COMMENT 'Rule to use when matching registrations for this event',
ADD CONSTRAINT `FK_civicrm_event_dedupe_rule_group_id` FOREIGN KEY (`dedupe_rule_group_id`) REFERENCES `civicrm_dedupe_rule_group` (`id`);
-- CRM-9288
SELECT @option_web_id := id FROM civicrm_option_group WHERE name = 'website_type';
SELECT @website_default := value FROM civicrm_option_value WHERE option_group_id = @option_web_id and is_default = 1;
SELECT @website_work := value FROM civicrm_option_value WHERE option_group_id = @option_web_id and name= 'Work';
UPDATE civicrm_option_value
SET is_default = 1 WHERE option_group_id = @option_web_id and value = IFNULL(@website_default , @website_work);
SELECT @website_default := value FROM civicrm_option_value WHERE option_group_id = @option_web_id and is_default = 1;
ALTER TABLE civicrm_uf_field
ADD COLUMN `website_type_id` int(10) unsigned DEFAULT NULL COMMENT 'Website Type Id, if required' AFTER phone_type_id,
ADD INDEX `IX_website_type_id` (`website_type_id`);
UPDATE civicrm_uf_field
SET website_type_id = @website_default,
field_name = 'url' WHERE field_name LIKE 'url%';
SELECT @website_value := max(cast(value as UNSIGNED)) FROM civicrm_option_value WHERE option_group_id = @option_web_id;
SELECT @website_weight := max(weight) FROM civicrm_option_value WHERE option_group_id = @option_web_id;
INSERT INTO civicrm_option_value(option_group_id, {localize field='label'}label{/localize}, name, value, weight)
SELECT @option_web_id, {localize}website{/localize}, website, (@website_value := @website_value + 1), (@website_weight := @website_weight + 1) FROM (
SELECT 'Google+' AS website
UNION ALL
SELECT 'Instagram' AS website
UNION ALL
SELECT 'LinkedIn' AS website
UNION ALL
SELECT 'Pinterest' AS website
UNION ALL
SELECT 'Tumblr' AS website
UNION ALL
SELECT 'SnapChat' AS website
UNION ALL
SELECT 'Vine' AS website
) AS temp
LEFT JOIN civicrm_option_value co ON co.name = temp.website
AND option_group_id = @option_web_id
WHERE co.id IS NULL;
-- CRM-14627 civicrm navigation inconsistent
UPDATE civicrm_navigation
SET civicrm_navigation.url = CONCAT(SUBSTRING(url FROM 1 FOR LOCATE('&', url) - 1), '?', SUBSTRING(url FROM LOCATE('&', url) + 1))
WHERE civicrm_navigation.url LIKE "%&%" AND civicrm_navigation.url NOT LIKE "%?%";
-- CRM-14478 Add a "cleanup" policy for managed entities
ALTER TABLE `civicrm_managed`
ADD COLUMN `cleanup` varchar(32) COMMENT 'Policy on when to cleanup entity (always, never, unused)';
-- CRM-14639
SELECT @option_grant_status := id FROM civicrm_option_group WHERE name = 'grant_status';
UPDATE civicrm_option_value
SET
{if !$multilingual}
label =
CASE
WHEN lower(name) = 'granted'
THEN 'Paid'
WHEN lower(name) = 'approved'
THEN 'Eligible'
WHEN lower(name) = 'rejected'
THEN 'Ineligible'
ELSE 'Submitted'
END,
{else}
{foreach from=$locales item=locale}
label_{$locale} =
CASE
WHEN lower(name) = 'granted'
THEN 'Paid'
WHEN lower(name) = 'approved'
THEN 'Eligible'
WHEN lower(name) = 'rejected'
THEN 'Ineligible'
ELSE 'Submitted'
END,
{/foreach}
{/if}
name =
CASE
WHEN lower(name) = 'granted'
THEN 'Paid'
WHEN lower(name) = 'approved'
THEN 'Eligible'
WHEN lower(name) = 'rejected'
THEN 'Ineligible'
ELSE 'Submitted'
END
WHERE option_group_id = @option_grant_status and name IN ('granted', 'pending', 'approved', 'rejected');
SELECT @grant_value := max(cast(value as UNSIGNED)) FROM civicrm_option_value WHERE option_group_id = @option_grant_status;
SELECT @grant_weight := max(weight) FROM civicrm_option_value WHERE option_group_id = @option_grant_status;
INSERT INTO civicrm_option_value(option_group_id, {localize field='label'}label{/localize}, name, value, weight)
SELECT @option_grant_status, {localize}grantstatus{/localize}, grantstatus, @grant_value := @grant_value + 1, @grant_weight := @grant_weight + 1 FROM (
SELECT 'Submitted' AS grantstatus
UNION ALL
SELECT 'Approved for Payment' AS grantstatus
UNION ALL
SELECT 'Eligible' AS grantstatus
UNION ALL
SELECT 'Awaiting Information' AS grantstatus
UNION ALL
SELECT 'Withdrawn' AS grantstatus
) AS temp
LEFT JOIN civicrm_option_value co ON co.name = temp.grantstatus
AND option_group_id = @option_grant_status
WHERE co.id IS NULL;
-- Fix trailing single quote in grant status label
{if !$multilingual}
UPDATE civicrm_option_value v
INNER JOIN civicrm_option_group g
ON v.option_group_id = g.id AND g.name = 'grant_status'
SET label = 'Awaiting Information'
WHERE v.label = 'Awaiting Information\'' and v.name = 'Awaiting Information';
{else}
UPDATE civicrm_option_value v
INNER JOIN civicrm_option_group g
ON v.option_group_id = g.id AND g.name = 'grant_status'
SET
{foreach from=$locales item=locale}
v.label_{$locale} = CASE
WHEN v.label_{$locale} = 'Awaiting Information\'' THEN 'Awaiting Information'
ELSE v.label_{$locale}
END,
{/foreach}
v.name = v.name
WHERE v.name = 'Awaiting Information';
{/if}
-- CRM-14197 Add contribution_id to civicrm_line_item
ALTER TABLE civicrm_line_item ADD contribution_id INT(10) unsigned COMMENT 'Contribution ID' NULL AFTER entity_id;
-- FK to civicrm_contribution
ALTER TABLE civicrm_line_item
ADD CONSTRAINT `FK_civicrm_contribution_id` FOREIGN KEY (`contribution_id`) REFERENCES civicrm_contribution (`id`) ON DELETE SET NULL;
ALTER TABLE `civicrm_line_item`
DROP INDEX `UI_line_item_value`,
ADD UNIQUE INDEX `UI_line_item_value` (`entity_table`, `entity_id`, `contribution_id`, `price_field_value_id`, `price_field_id`);
-- update case type menu
UPDATE civicrm_navigation set url = 'civicrm/a/#/caseType' WHERE url LIKE 'civicrm/admin/options/case_type%';

View file

@ -0,0 +1,35 @@
UPDATE civicrm_dashboard
SET civicrm_dashboard.url = CONCAT(SUBSTRING(url FROM 1 FOR LOCATE('&', url) - 1), '?', SUBSTRING(url FROM LOCATE('&', url) + 1))
WHERE civicrm_dashboard.url LIKE "%&%" AND civicrm_dashboard.url NOT LIKE "%?%";
UPDATE civicrm_dashboard
SET civicrm_dashboard.fullscreen_url = CONCAT(SUBSTRING(fullscreen_url FROM 1 FOR LOCATE('&', fullscreen_url) - 1), '?', SUBSTRING(fullscreen_url FROM LOCATE('&', fullscreen_url) + 1))
WHERE civicrm_dashboard.fullscreen_url LIKE "%&%" AND civicrm_dashboard.fullscreen_url NOT LIKE "%?%";
-- CRM-14843 Added States for Chile and Modify Santiago Metropolitan for consistency
INSERT IGNORE INTO civicrm_state_province (id, country_id, abbreviation, name) VALUES
(NULL, 1044, "LR", "Los Rios"),
(NULL, 1044, "AP", "Arica y Parinacota"),
(NULL, 1169, "AMA", "Amazonas");
UPDATE civicrm_state_province
SET name = "Santiago Metropolitan", abbreviation = "SM"
WHERE name = "Region Metropolitana de Santiago" AND abbreviation = "RM";
-- CRM-14879 contact fields for scheduled reminders
INSERT INTO civicrm_action_mapping
(entity, entity_value, entity_value_label, entity_status, entity_status_label, entity_date_start, entity_date_end, entity_recipient)
VALUES
( 'civicrm_contact', 'civicrm_contact', 'Date Field', 'contact_date_reminder_options', 'Annual Options', 'date_field', NULL, NULL);
INSERT INTO `civicrm_option_group` (`name`, {localize field='title'}`title`{/localize}, `is_reserved`, `is_active`, `is_locked`)
VALUES
('contact_date_reminder_options', {localize}'{ts escape="sql"}Contact Date Reminder Options{/ts}'{/localize}, 1, 1, 1);
SELECT @option_group_id_contactDateMode := max(id) from civicrm_option_group where name = 'contact_date_reminder_options';
INSERT INTO `civicrm_option_value`
(`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
(@option_group_id_contactDateMode, {localize}'{ts escape="sql"}Actual date only{/ts}'{/localize}, '1', 'Actual date only', NULL, NULL, 0, 1, 0, 1, 1, NULL, NULL),
(@option_group_id_contactDateMode, {localize}'{ts escape="sql"}Each anniversary{/ts}'{/localize}, '2', 'Each anniversary', NULL, NULL, 0, 2, 0, 1, 1, NULL, NULL);

View file

@ -0,0 +1,6 @@
{* file to handle db changes in 4.5.beta1 during upgrade *}
-- CRM-14807
ALTER TABLE `civicrm_action_schedule`
ADD COLUMN `from_name` varchar(255) AFTER `absolute_date`;
ALTER TABLE `civicrm_action_schedule`
ADD COLUMN `from_email` varchar(255) AFTER `from_name`;

View file

@ -0,0 +1,13 @@
{* file to handle db changes in 4.5.beta2 during upgrade *}
{include file='../CRM/Upgrade/4.5.beta2.msg_template/civicrm_msg_template.tpl'}
--CRM-14948 To delete list of outdated Russian provinance
DELETE FROM `civicrm_state_province` WHERE `name` IN ('Komi-Permyatskiy avtonomnyy okrug','Taymyrskiy (Dolgano-Nenetskiy)','Evenkiyskiy avtonomnyy okrug','Koryakskiy avtonomnyy okrug','Ust\'-Ordynskiy Buryatskiy','Aginskiy Buryatskiy avtonomnyy');
--CRM-14948 To update new list of new Russian provinance
UPDATE `civicrm_state_province` SET `name`='Perm krai',`abbreviation`='PEK',`country_id`= 1177 WHERE `id` = 4270;
UPDATE `civicrm_state_province` SET `name`='Kamchatka Krai',`country_id`= 1177 WHERE `id` = 4252;
UPDATE `civicrm_state_province` SET `name`='Zabaykalsky Krai',`abbreviation`='ZSK',`country_id`= 1177 WHERE `id` = 4247;

View file

@ -0,0 +1,4 @@
{* file to handle db changes in 4.5.beta3 during upgrade *}
--CRM-15009
ALTER TABLE `civicrm_payment_processor`
CHANGE COLUMN `signature` `signature` LONGTEXT NULL DEFAULT NULL;

View file

@ -0,0 +1 @@
{* file to handle db changes in 4.5.beta4 during upgrade *}

View file

@ -0,0 +1 @@
{* file to handle db changes in 4.5.beta5 during upgrade *}

View file

@ -0,0 +1 @@
{* file to handle db changes in 4.5.beta6 during upgrade *}

View file

@ -0,0 +1,2 @@
{* file to handle db changes in 4.5.beta7 during upgrade *}
UPDATE civicrm_contribution SET net_amount = total_amount - fee_amount WHERE net_amount = 0 OR net_amount IS NULL;

View file

@ -0,0 +1,18 @@
{* file to handle db changes in 4.5.beta8 during upgrade *}
-- CRM-15143 Add Postal Code to contact reference and quick search options
SELECT @option_group_id_cao := max(id) from civicrm_option_group where name = 'contact_autocomplete_options';
SELECT @option_val_id_cao_wt := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_cao;
SELECT @option_val_id_cao_val := MAX(ROUND(value)) FROM civicrm_option_value WHERE option_group_id = @option_group_id_cao;
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}label{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
(@option_group_id_cao, {localize}'{ts escape="sql"}Postal Code{/ts}'{/localize}, @option_val_id_cao_val+1, 'postal_code', NULL, 0, NULL, @option_val_id_cao_wt+1, 0, 1, 1, NULL, NULL);
SELECT @option_group_id_cro := max(id) from civicrm_option_group where name = 'contact_reference_options';
SELECT @option_val_id_cro_wt := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_cro;
SELECT @option_val_id_cro_val := MAX(ROUND(value)) FROM civicrm_option_value WHERE option_group_id = @option_group_id_cro;
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}label{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
(@option_group_id_cro, {localize}'{ts escape="sql"}Postal Code{/ts}'{/localize}, @option_val_id_cro_val+1, 'postal_code', NULL, 0, NULL, @option_val_id_cro_wt+1, 0, 1, 1, NULL, NULL);

View file

@ -0,0 +1,36 @@
{* file to handle db changes in 4.5.beta9 during upgrade *}
-- CRM-15211
UPDATE `civicrm_dashboard` SET `permission` = 'access my cases and activities,access all cases and activities', `permission_operator` = 'OR' WHERE `name` = 'casedashboard';
-- CRM-15218
UPDATE `civicrm_uf_group` SET name = LOWER(name) WHERE name IN ("New_Individual", "New_Organization", "New_Household");
-- CRM-15220
UPDATE `civicrm_navigation` SET url = 'civicrm/admin/options/grant_type?reset=1' WHERE url = 'civicrm/admin/options/grant_type&reset=1';
SELECT @parent_id := `id` FROM `civicrm_navigation` WHERE `name` = 'CiviGrant' AND `domain_id` = {$domainID};
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/admin/options/grant_status?reset=1', '{ts escape="sql" skip="true"}Grant Status{/ts}', 'Grant Status', 'access CiviGrant,administer CiviCRM', 'AND', @parent_id, '1', NULL, 2 );
-- CRM-14853
UPDATE civicrm_financial_trxn cft
INNER JOIN ( SELECT max(cft.id) trxn_id, ceft.entity_id contribution_id
FROM civicrm_financial_trxn cft
LEFT JOIN civicrm_entity_financial_trxn ceft ON ceft.financial_trxn_id = cft.id
WHERE ceft.entity_table = 'civicrm_contribution'
GROUP BY ceft.entity_id ) as temp ON temp.trxn_id = cft.id
INNER JOIN civicrm_contribution cc ON cc.id = temp.contribution_id
AND cc.payment_instrument_id <> cft.payment_instrument_id
SET cft.payment_instrument_id = cc.payment_instrument_id;
--CRM-15086
SELECT @option_group_id_batch_status := id FROM civicrm_option_group WHERE name = 'batch_status';
UPDATE civicrm_option_value SET name = 'Open' WHERE value = 1 AND option_group_id = @option_group_id_batch_status;
UPDATE civicrm_option_value SET name = 'Closed' WHERE value = 2 AND option_group_id = @option_group_id_batch_status;
UPDATE civicrm_option_value SET name = 'Data Entry' WHERE value = 3 AND option_group_id = @option_group_id_batch_status;
UPDATE civicrm_option_value SET name = 'Reopened' WHERE value = 4 AND option_group_id = @option_group_id_batch_status;
UPDATE civicrm_option_value SET name = 'Exported' WHERE value = 5 AND option_group_id = @option_group_id_batch_status;

View file

@ -0,0 +1,46 @@
{* file to handle db changes in 4.6.0 during upgrade *}
--CRM-16148 add missing option names
SELECT @option_group_id_pcm := max(id) from civicrm_option_group where name = 'preferred_communication_method';
SELECT @option_group_id_notePrivacy := max(id) from civicrm_option_group where name = 'note_privacy';
UPDATE civicrm_option_value
SET name = 'Phone'
WHERE option_group_id = @option_group_id_pcm AND value = 1;
UPDATE civicrm_option_value
SET name = 'Email'
WHERE option_group_id = @option_group_id_pcm AND value = 2;
UPDATE civicrm_option_value
SET name = 'Postal Mail'
WHERE option_group_id = @option_group_id_pcm AND value = 3;
UPDATE civicrm_option_value
SET name = 'SMS'
WHERE option_group_id = @option_group_id_pcm AND value = 4;
UPDATE civicrm_option_value
SET name = 'Fax'
WHERE option_group_id = @option_group_id_pcm AND value = 5;
UPDATE civicrm_option_value
SET name = 'None'
WHERE option_group_id = @option_group_id_notePrivacy AND value = 0;
UPDATE civicrm_option_value
SET name = 'Author Only'
WHERE option_group_id = @option_group_id_notePrivacy AND value = 1;
--These labels were never translated so just copy them over as names
{if $multilingual}
UPDATE civicrm_option_value v, civicrm_option_group g
SET v.name = v.label_{$locales.0}
WHERE g.id = v.option_group_id AND g.name IN
('group_type', 'safe_file_extension', 'wysiwyg_editor');
{else}
UPDATE civicrm_option_value v, civicrm_option_group g
SET v.name = v.label
WHERE g.id = v.option_group_id AND g.name IN
('group_type', 'safe_file_extension', 'wysiwyg_editor');
{/if}
--This one is weird. What the heck is this anyway?
UPDATE civicrm_option_value v, civicrm_option_group g
SET v.name = v.value
WHERE g.id = v.option_group_id AND g.name = 'redaction_rule';

View file

@ -0,0 +1 @@
{* CRM-16846 - This file is never run, but it doesn't matter because it's empty *}

View file

@ -0,0 +1,13 @@
{* file to handle db changes in 4.6.10 during upgrade *}
-- CRM-17384 - remove duplicate support menu which may have been added in 4.6.9
DELETE n1
FROM civicrm_navigation n1, civicrm_navigation n2
WHERE n1.name = 'Support' AND n1.domain_id = {$domainID} AND n2.name = 'Support' AND n2.domain_id = {$domainID} AND n1.id < n2.id;
-- CRM-17384 - re-add sid in case the site admin deleted the new support menu after upgrading to 4.6.9
UPDATE civicrm_navigation SET url = 'https://civicrm.org/register-your-site?src=iam&sid={ldelim}sid{rdelim}' WHERE name = 'Register your site';
UPDATE civicrm_navigation SET url = 'https://civicrm.org/become-a-member?src=iam&sid={ldelim}sid{rdelim}' WHERE name = 'Join CiviCRM';
--CRM-17357 PHP fatal error during creation of receipt PDF
{include file='../CRM/Upgrade/4.6.10.msg_template/civicrm_msg_template.tpl'}

View file

@ -0,0 +1 @@
{* file to handle db changes in 4.6.11 during upgrade *}

View file

@ -0,0 +1,13 @@
{* file to handle db changes in 4.6.12 during upgrade *}
-- CRM-16173, CRM-16831
SELECT @parent_id := id from `civicrm_navigation` where name = 'System Settings' AND domain_id = {$domainID};
SELECT @add_weight_id := weight from `civicrm_navigation` where `name` = 'Manage Extensions' and `parent_id` = @parent_id;
UPDATE `civicrm_navigation`
SET `weight` = `weight`+1
WHERE `parent_id` = @parent_id
AND `weight` > @add_weight_id;
INSERT INTO `civicrm_navigation`
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/a/#/cxn', '{ts escape="sql" skip="true"}Connections{/ts}', 'Connections', 'administer CiviCRM', '', @parent_id , '1', NULL, @add_weight_id + 1 );

View file

@ -0,0 +1 @@
{* file to handle db changes in 4.6.2 during upgrade *}

View file

@ -0,0 +1,73 @@
{* file to handle db changes in 4.6.3 during upgrade *}
-- CRM-16307 fix CRM-15578 typo - Require access CiviMail permission for A/B Testing feature
UPDATE civicrm_navigation
SET permission = 'access CiviMail', permission_operator = ''
WHERE name = 'New A/B Test' OR name = 'Manage A/B Tests';
--CRM-16320
{include file='../CRM/Upgrade/4.6.3.msg_template/civicrm_msg_template.tpl'}
-- CRM-16452 Missing administrative divisions for Georgia
SELECT @country_id := id from civicrm_country where name = 'Georgia' AND iso_code = 'GE';
INSERT INTO civicrm_state_province (country_id, abbreviation, name)
VALUES
(@country_id, "AB", "Abkhazia"),
(@country_id, "AJ", "Adjara"),
(@country_id, "TB", "Tbilisi"),
(@country_id, "GU", "Guria"),
(@country_id, "IM", "Imereti"),
(@country_id, "KA", "Kakheti"),
(@country_id, "KK", "Kvemo Kartli"),
(@country_id, "MM", "Mtskheta-Mtianeti"),
(@country_id, "RL", "Racha-Lechkhumi and Kvemo Svaneti"),
(@country_id, "SZ", "Samegrelo-Zemo Svaneti"),
(@country_id, "SJ", "Samtskhe-Javakheti"),
(@country_id, "SK", "Shida Kartli");
--CRM-16391 and CRM-16392
UPDATE civicrm_uf_field
SET {localize field="label"}label = '{ts escape="sql"}Financial Type{/ts}'{/localize}
WHERE field_type = 'Contribution' AND field_name='financial_type';
UPDATE civicrm_uf_field
SET {localize field="label"}label = '{ts escape="sql"}Membership Type{/ts}'{/localize}
WHERE field_type = 'Membership' AND field_name='membership_type';
-- CRM-16367: adding the shared payment token table
CREATE TABLE IF NOT EXISTS `civicrm_payment_token` (
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Payment Token ID',
`contact_id` int unsigned NOT NULL COMMENT 'FK to Contact ID for the owner of the token',
`payment_processor_id` int unsigned NOT NULL ,
`token` varchar(255) NOT NULL COMMENT 'Externally provided token string',
`created_date` timestamp DEFAULT CURRENT_TIMESTAMP COMMENT 'Date created',
`created_id` int unsigned COMMENT 'Contact ID of token creator',
`expiry_date` datetime COMMENT 'Date this token expires',
`email` varchar(255) COMMENT 'Email at the time of token creation. Useful for fraud forensics',
`billing_first_name` varchar(255) COMMENT 'Billing first name at the time of token creation. Useful for fraud forensics',
`billing_middle_name` varchar(255) COMMENT 'Billing middle name at the time of token creation. Useful for fraud forensics',
`billing_last_name` varchar(255) COMMENT 'Billing last name at the time of token creation. Useful for fraud forensics',
`masked_account_number` varchar(255) COMMENT 'Holds the part of the card number or account details that may be retained or displayed',
`ip_address` varchar(255) COMMENT 'IP used when creating the token. Useful for fraud forensics' ,
PRIMARY KEY ( `id` ),
CONSTRAINT FK_civicrm_payment_token_contact_id FOREIGN KEY (`contact_id`)
REFERENCES `civicrm_contact`(`id`) ON DELETE CASCADE,
CONSTRAINT FK_civicrm_payment_token_payment_processor_id FOREIGN KEY (`payment_processor_id`)
REFERENCES `civicrm_payment_processor`(`id`) ON DELETE RESTRICT,
CONSTRAINT FK_civicrm_payment_token_created_id FOREIGN KEY (`created_id`)
REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL
)
ENGINE=InnoDB DEFAULT
CHARACTER SET utf8
COLLATE utf8_unicode_ci;
-- CRM-16367: adding a reference to the token table to the recurring contributions table.
ALTER TABLE civicrm_contribution_recur
ADD COLUMN `payment_token_id` int(10) unsigned DEFAULT NULL COMMENT 'Optionally used to store a link to a payment token used for this recurring contribution.',
ADD CONSTRAINT `FK_civicrm_contribution_recur_payment_token_id` FOREIGN KEY (`payment_token_id`) REFERENCES `civicrm_payment_token` (`id`) ON DELETE SET NULL;
--CRM-16480: set total_amount and financial_type fields 'is_required' to null
SELECT @uf_group_id_contribution := max(id) from civicrm_uf_group where name = 'contribution_batch_entry';
SELECT @uf_group_id_membership := max(id) from civicrm_uf_group where name = 'membership_batch_entry';
UPDATE civicrm_uf_field
SET is_required = 0 WHERE uf_group_id IN (@uf_group_id_contribution, @uf_group_id_membership) AND field_name IN ('financial_type', 'total_amount');

View file

@ -0,0 +1,2 @@
{* file to handle db changes in 4.6.4 during upgrade *}
UPDATE civicrm_uf_group SET group_type = 'Contact,Organization' WHERE civicrm_uf_group.name = 'on_behalf_organization' AND group_type <> 'Contact,Organization';

View file

@ -0,0 +1,35 @@
{* file to handle db changes in 4.6.5 during upgrade *}
-- CRM-16173
CREATE TABLE IF NOT EXISTS `civicrm_cxn` (
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Connection ID',
`app_guid` varchar(128) COMMENT 'Application GUID',
`app_meta` text COMMENT 'Application Metadata (JSON)',
`cxn_guid` varchar(128) COMMENT 'Connection GUID',
`secret` text COMMENT 'Shared secret',
`perm` text COMMENT 'Permissions approved for the service (JSON)',
`options` text COMMENT 'Options for the service (JSON)',
`is_active` tinyint DEFAULT 1 COMMENT 'Is connection currently enabled?',
`created_date` timestamp NULL DEFAULT NULL COMMENT 'When was the connection was created.',
`modified_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'When the connection was created or modified.',
`fetched_date` timestamp NULL DEFAULT NULL COMMENT 'The last time the application metadata was fetched.' ,
PRIMARY KEY ( `id` )
, UNIQUE INDEX `UI_appid`(
app_guid
)
, UNIQUE INDEX `UI_keypair_cxnid`(
cxn_guid
)
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
-- CRM-16417 add failed payment activity type
SELECT @option_group_id_act := max(id) from civicrm_option_group where name = 'activity_type';
SELECT @option_group_id_act_wt := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act;
SELECT @option_group_id_act_val := MAX(ROUND(value)) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act;
SELECT @contributeCompId := max(id) FROM civicrm_component where name = 'CiviContribute';
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, {localize field='description'}`description`{/localize}, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
(@option_group_id_act, {localize}'{ts escape="sql"}Failed Payment{/ts}'{/localize}, @option_group_id_act_val+1,
'Failed Payment', NULL, 1, NULL, @option_group_id_act_wt+1, {localize}'{ts escape="sql"}Failed payment.{/ts}'{/localize}, 0, 1, 1, @contributeCompId, NULL);

View file

@ -0,0 +1,11 @@
{* file to handle db changes in 4.6.6 during upgrade *}
-- CRM-16846 - This upgrade may have been previously skipped so moving it to 4.6.6
-- update permission for editing message templates (CRM-15819)
SELECT @messages_menu_id := id FROM civicrm_navigation WHERE name = 'Mailings';
UPDATE `civicrm_navigation`
SET `permission` = 'edit message templates'
WHERE `parent_id` = @messages_menu_id
AND name = 'Message Templates';

View file

@ -0,0 +1,5 @@
{* file to handle db changes in 4.6.7 during upgrade *}
-- CRM-17016 State list for Fiji incomplete
SELECT @country_id := id from civicrm_country where name = 'Fiji' AND iso_code = 'FJ';
INSERT INTO civicrm_state_province (country_id, abbreviation, name) VALUES (@country_id, "C", "Central");

View file

@ -0,0 +1 @@
{* file to handle db changes in 4.6.8 during upgrade *}

View file

@ -0,0 +1,59 @@
{* file to handle db changes in 4.6.9 during upgrade *}
-- CRM-17112 - Add Missing countries Saint Barthélemy and Saint Martin
INSERT INTO civicrm_country (name,iso_code,region_id,is_province_abbreviated) VALUES("Saint Barthélemy", "BL", "2", "0");
INSERT INTO civicrm_country (name,iso_code,region_id,is_province_abbreviated) VALUES("Saint Martin (French part)", "MF", "2", "0");
-- CRM-17039 - Add credit note for cancelled payments
{include file='../CRM/Upgrade/4.6.9.msg_template/civicrm_msg_template.tpl'}
-- CRM-17258 - Add created id, owner_id to report instances.
ALTER TABLE civicrm_report_instance
ADD COLUMN `created_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to contact table.',
ADD COLUMN `owner_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to contact table.',
ADD CONSTRAINT `FK_civicrm_report_instance_created_id` FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `FK_civicrm_report_instance_owner_id` FOREIGN KEY (`owner_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE SET NULL;
-- CRM-16907
SELECT @navMaxWeight := MAX(ROUND(weight)) from civicrm_navigation WHERE parent_id IS NULL;
-- Add "support" menu if it's not there already
INSERT INTO civicrm_navigation (domain_id, label, name, is_active, weight)
SELECT * FROM (SELECT {$domainID} as domain_id, 'Support' as label, 'Help' as name, 1 as is_active, @navMaxWeight + 1 as weight) AS tmp
WHERE NOT EXISTS (
SELECT name FROM civicrm_navigation WHERE name = 'Help' AND domain_id = {$domainID}
) LIMIT 1;
SELECT @adminHelplastID := id FROM civicrm_navigation WHERE name = 'Help' AND domain_id = {$domainID};
UPDATE civicrm_navigation
SET name = 'Support', label = '{ts escape="sql" skip="true"}Support{/ts}'
WHERE id = @adminHelplastID;
DELETE FROM civicrm_navigation where parent_id = @adminHelplastID AND (name = 'Developer' OR url LIKE "http://civicrm.org%");
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'https://civicrm.org/get-started?src=iam', '{ts escape="sql" skip="true"}Get started{/ts}', 'Get started', NULL, 'AND', @adminHelplastID, '1', NULL, 1 ),
( {$domainID}, 'https://civicrm.org/documentation?src=iam', '{ts escape="sql" skip="true"}Documentation{/ts}', 'Documentation', NULL, 'AND', @adminHelplastID, '1', NULL, 2 ),
( {$domainID}, 'https://civicrm.org/ask-a-question?src=iam', '{ts escape="sql" skip="true"}Ask a question{/ts}', 'Ask a question', NULL, 'AND', @adminHelplastID, '1', NULL, 3 ),
( {$domainID}, 'https://civicrm.org/experts?src=iam', '{ts escape="sql" skip="true"}Get expert help{/ts}', 'Get expert help', NULL, 'AND', @adminHelplastID, '1', NULL, 4 ),
( {$domainID}, 'https://civicrm.org/about?src=iam', '{ts escape="sql" skip="true"}About CiviCRM{/ts}', 'About CiviCRM', NULL, 'AND', @adminHelplastID, '1', 1, 5 ),
( {$domainID}, 'https://civicrm.org/register-your-site?src=iam&sid={ldelim}sid{rdelim}', '{ts escape="sql" skip="true"}Register your site{/ts}', 'Register your site', NULL, 'AND', @adminHelplastID, '1', NULL, 6 ),
( {$domainID}, 'https://civicrm.org/become-a-member?src=iam&sid={ldelim}sid{rdelim}', '{ts escape="sql" skip="true"}Join CiviCRM{/ts}', 'Join CiviCRM', NULL, 'AND', @adminHelplastID, '1', NULL, 7 );
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, NULL, '{ts escape="sql" skip="true"}Developer{/ts}', 'Developer', 'administer CiviCRM', '', @adminHelplastID, '1', 1, 8 );
SET @devellastID:=LAST_INSERT_ID();
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/api', '{ts escape="sql" skip="true"}API Explorer{/ts}','API Explorer', 'administer CiviCRM', '', @devellastID, '1', NULL, 1 ),
( {$domainID}, 'https://civicrm.org/developer-documentation?src=iam', '{ts escape="sql" skip="true"}Developer Docs{/ts}', 'Developer Docs', 'administer CiviCRM', '', @devellastID, '1', NULL, 3 );
-- Set CiviCRM URLs to https
UPDATE civicrm_navigation SET url = REPLACE(url, 'http://civicrm.org', 'https://civicrm.org');

View file

@ -0,0 +1,155 @@
{* file to handle db changes in 4.6.alpha1 during upgrade *}
{include file='../CRM/Upgrade/4.6.alpha1.msg_template/civicrm_msg_template.tpl'}
-- Financial account relationship
SELECT @option_group_id_arel := max(id) from civicrm_option_group where name = 'account_relationship';
SELECT @option_group_id_arel_wt := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_arel;
SELECT @option_group_id_arel_val := MAX(CAST( `value` AS UNSIGNED )) FROM civicrm_option_value WHERE option_group_id = @option_group_id_arel;
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}label{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, {localize field='description'}`description`{/localize}, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
(@option_group_id_arel, {localize}'{ts escape="sql"}Sales Tax Account is{/ts}'{/localize}, @option_group_id_arel_val+1, 'Sales Tax Account is', NULL, 0, 0, @option_group_id_arel_wt+1, {localize}'Sales Tax Account is'{/localize}, 0, 1, 1, 2, NULL);
-- Add new column tax_amount in contribution and lineitem table
ALTER TABLE `civicrm_contribution` ADD `tax_amount` DECIMAL( 20, 2 ) DEFAULT NULL COMMENT 'Total tax amount of this contribution.';
ALTER TABLE `civicrm_line_item` ADD `tax_amount` DECIMAL( 20, 2 ) DEFAULT NULL COMMENT 'tax of each item';
-- Insert menu item at Administer > CiviContribute, below the Payment Processors.
SELECT @parent_id := id from `civicrm_navigation` where name = 'CiviContribute' AND domain_id = {$domainID};
SELECT @add_weight_id := weight from `civicrm_navigation` where `name` = 'Payment Processors' and `parent_id` = @parent_id;
UPDATE `civicrm_navigation`
SET `weight` = `weight`+1
WHERE `parent_id` = @parent_id
AND `weight` > @add_weight_id;
INSERT INTO `civicrm_navigation`
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/admin/setting/preferences/contribute', '{ts escape="sql" skip="true"}CiviContribute Component Settings{/ts}', 'CiviContribute Component Settings', 'administer CiviCRM', '', @parent_id, '1', NULL, @add_weight_id + 1 );
CREATE TABLE IF NOT EXISTS `civicrm_mailing_abtest` (
`id` int unsigned NOT NULL AUTO_INCREMENT ,
`name` varchar(128) COMMENT 'Name of the A/B test',
`status` varchar(32) COMMENT 'Status',
`mailing_id_a` int unsigned COMMENT 'The first experimental mailing (\"A\" condition)',
`mailing_id_b` int unsigned COMMENT 'The second experimental mailing (\"B\" condition)',
`mailing_id_c` int unsigned COMMENT 'The final, general mailing (derived from A or B)',
`domain_id` int unsigned COMMENT 'Which site is this mailing for',
`testing_criteria_id` int unsigned ,
`winner_criteria_id` int unsigned ,
`specific_url` varchar(255) COMMENT 'What specific url to track',
`declare_winning_time` datetime COMMENT 'In how much time to declare winner',
`group_percentage` int unsigned
,
PRIMARY KEY ( `id` )
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
-- Insert menu items under "Mailings" for A/B Tests
SELECT @parent_id := id from `civicrm_navigation` where name = 'Mailings' AND domain_id = {$domainID};
SELECT @add_weight_id := weight from `civicrm_navigation` where `name` = 'Find Mass SMS' and `parent_id` = @parent_id;
UPDATE `civicrm_navigation`
SET `weight` = `weight`+2
WHERE `parent_id` = @parent_id
AND `weight` > @add_weight_id;
INSERT INTO `civicrm_navigation`
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/a/#/abtest/new', '{ts escape="sql" skip="true"}New A/B Test{/ts}', 'New A/B Test', 'access CiviMail,create mailings', 'OR', @parent_id , '1', NULL, @add_weight_id + 1 ),
( {$domainID}, 'civicrm/a/#/abtest', '{ts escape="sql" skip="true"}Manage A/B Tests{/ts}', 'Manage A/B Tests', 'access CiviMail,create mailings', 'OR', @parent_id, '1', 1, @add_weight_id + 2 );
-- New activity types required for Print and Email Invoice
SELECT @option_group_id_act := max(id) from civicrm_option_group where name = 'activity_type';
SELECT @option_group_id_act_wt := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act;
SELECT @option_group_id_act_val := MAX(CAST( `value` AS UNSIGNED )) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act;
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, {localize field='description'}`description`{/localize}, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
(@option_group_id_act, {localize}'{ts escape="sql"}Downloaded Invoice{/ts}'{/localize}, @option_group_id_act_val+1, 'Downloaded Invoice', NULL, 1, NULL, @option_group_id_act_wt+1, {localize}'{ts escape="sql"}Downloaded Invoice.{/ts}'{/localize}, 0, 1, 1, NULL, NULL),
(@option_group_id_act, {localize}'{ts escape="sql"}Emailed Invoice{/ts}'{/localize}, @option_group_id_act_val+2, 'Emailed Invoice', NULL, 1, NULL, @option_group_id_act_wt+2, {localize}'{ts escape="sql"}Emailed Invoice.{/ts}'{/localize}, 0, 1, 1, NULL, NULL);
-- New option for Contact Dashboard
SELECT @option_group_id_udOpt := max(id) from civicrm_option_group where name = 'user_dashboard_options';
SELECT @option_group_id_udOpt_wt := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_udOpt;
SELECT @option_group_id_udOpt_val := MAX(CAST( `value` AS UNSIGNED )) FROM civicrm_option_value WHERE option_group_id = @option_group_id_udOpt;
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
(@option_group_id_udOpt, {localize}'{ts escape="sql"}Invoices / Credit Notes{/ts}'{/localize}, @option_group_id_udOpt_val+1, 'Invoices / Credit Notes', NULL, 0, NULL, @option_group_id_udOpt_wt+1, 0, 0, 1, NULL, NULL);
-- Add new column creditnote_id in contribution table
ALTER TABLE `civicrm_contribution` ADD `creditnote_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'unique credit note id, system generated or passed in';
-- Add new column is_billing_required in contribution_page and event table
ALTER TABLE `civicrm_event` ADD COLUMN `is_billing_required` tinyint(4) DEFAULT '0' COMMENT 'Billing block required for Event';
ALTER TABLE `civicrm_contribution_page` ADD COLUMN `is_billing_required` tinyint(4) DEFAULT '0' COMMENT 'Billing block required for Contribution Page';
-- CRM-15256
ALTER TABLE civicrm_action_schedule ADD used_for VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Used for repeating entity' AFTER sms_provider_id;
CREATE TABLE IF NOT EXISTS `civicrm_recurring_entity` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`parent_id` int(10) unsigned NOT NULL COMMENT 'recurring entity parent id',
`entity_id` int(10) unsigned DEFAULT NULL COMMENT 'recurring entity child id',
`entity_table` varchar(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'physical tablename for entity, e.g. civicrm_event',
`mode` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1-this entity, 2-this and the following entities, 3-all the entities',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=87 ;
-- add batch type for pledge payments
SELECT @option_group_id := id FROM civicrm_option_group WHERE name = 'batch_type';
SELECT @max_option_value:= max(ROUND(value)) FROM civicrm_option_value WHERE option_group_id = @option_group_id;
INSERT INTO civicrm_option_value(option_group_id, {localize field='label'}`label`{/localize}, value, name,weight)
VALUES (@option_group_id, {localize}'{ts escape="sql"}Pledge Payment{/ts}'{/localize}, @max_option_value+1, 'Pledge Payment','3');
--CRM-12281: To update name of Latvian provinces.
UPDATE `civicrm_state_province` SET `name` = (N'Jūrmala') where `id` = 3552;
UPDATE `civicrm_state_province` SET `name` = (N'Liepāja') WHERE `id` = 3553;
UPDATE `civicrm_state_province` SET `name` = (N'Rēzekne') WHERE `id` = 3554;
UPDATE `civicrm_state_province` SET `name` = (N'Rīga') WHERE `id` = 3555;
--CRM-15361: Allow selection of location type when sending bulk email
ALTER TABLE civicrm_mailing ADD COLUMN location_type_id INT(10) unsigned DEFAULT 0 COMMENT 'With email_selection_method, determines which email address to use';
ALTER TABLE civicrm_mailing ADD COLUMN email_selection_method varchar(20) DEFAULT 'automatic' COMMENT 'With location_type_id, determine how to choose the email address to use.';
-- CRM-15500 fix
ALTER TABLE `civicrm_action_schedule` CHANGE `limit_to` `limit_to` TINYINT( 4 ) NULL DEFAULT NULL;
-- CRM-15453 Recurring Contributions report template AND instance
SELECT @option_group_id_report := MAX(id) FROM civicrm_option_group WHERE name = 'report_template';
SELECT @weight := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_report;
SELECT @contribCompId := MAX(id) FROM civicrm_component where name = 'CiviContribute';
INSERT INTO civicrm_option_value
(option_group_id, {localize field='label'}label{/localize}, value, name, weight, {localize field='description'}description{/localize}, is_active, component_id) VALUES
(@option_group_id_report, {localize}'Recurring Contributions Report'{/localize}, 'contribute/recur', 'CRM_Report_Form_Contribute_Recur', @weight := @weight + 1, {localize}'Shows information about the status of recurring contributions'{/localize}, 1, @contribCompId);
INSERT INTO `civicrm_report_instance`
( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`)
VALUES
( {$domainID}, 'Pending Recurring Contributions', 'contribute/recur', 'Shows all pending recurring contributions', 'access CiviContribute', '{literal}a:39:{s:6:"fields";a:7:{s:9:"sort_name";s:1:"1";s:6:"amount";s:1:"1";s:22:"contribution_status_id";s:1:"1";s:18:"frequency_interval";s:1:"1";s:14:"frequency_unit";s:1:"1";s:12:"installments";s:1:"1";s:8:"end_date";s:1:"1";}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:1:{i:0;s:1:"5";}s:11:"currency_op";s:2:"in";s:14:"currency_value";a:0:{}s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:17:"frequency_unit_op";s:2:"in";s:20:"frequency_unit_value";a:0:{}s:22:"frequency_interval_min";s:0:"";s:22:"frequency_interval_max";s:0:"";s:21:"frequency_interval_op";s:3:"lte";s:24:"frequency_interval_value";s:0:"";s:16:"installments_min";s:0:"";s:16:"installments_max";s:0:"";s:15:"installments_op";s:3:"lte";s:18:"installments_value";s:0:"";s:19:"start_date_relative";s:0:"";s:15:"start_date_from";s:0:"";s:13:"start_date_to";s:0:"";s:37:"next_sched_contribution_date_relative";s:0:"";s:33:"next_sched_contribution_date_from";s:0:"";s:31:"next_sched_contribution_date_to";s:0:"";s:17:"end_date_relative";s:0:"";s:13:"end_date_from";s:0:"";s:11:"end_date_to";s:0:"";s:28:"calculated_end_date_relative";s:0:"";s:24:"calculated_end_date_from";s:0:"";s:22:"calculated_end_date_to";s:0:"";s:9:"order_bys";a:1:{i:1;a:1:{s:6:"column";s:1:"-";}}s:11:"description";s:41:"Shows all pending recurring contributions";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:9:"row_count";s:0:"";s:14:"addToDashboard";s:1:"1";s:10:"permission";s:21:"access CiviContribute";s:9:"parent_id";s:0:"";s:11:"instance_id";N;}{/literal}');
-- CRM-15557--
ALTER TABLE civicrm_line_item MODIFY COLUMN qty decimal(20,2);
-- CRM-15740
ALTER TABLE `civicrm_mailing_trackable_url` CHANGE `url` `url` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'The URL to be tracked.';
-- CRM-15765 missing Indonesian provinces and revise outdated names
INSERT INTO `civicrm_state_province` (`id`, `country_id`, `abbreviation`, `name`)
VALUES (NULL, 1102, "SR", "Sulawesi Barat"), (NULL, 1102, "KT", "Kalimantan Tengah"), (NULL, 1102, "KU", "Kalimantan Utara");
UPDATE `civicrm_state_province` SET `name`='Kepulauan Bangka Belitung' WHERE `id` = 3056;
UPDATE `civicrm_state_province` SET `name`='Papua Barat', `abbreviation`='PB' WHERE `id` = 3060;
UPDATE `civicrm_state_province` SET `name`='DKI Jakarta' WHERE `id` = 3083;
UPDATE `civicrm_state_province` SET `name`='DI Yogyakarta' WHERE `id` = 3085;
UPDATE `civicrm_state_province` SET `abbreviation`='KI' WHERE `id` = 3066;
-- CRM-15203 Handle MembershipPayment records while upgrade
INSERT INTO civicrm_membership_payment (contribution_id, membership_id) select cc.id, cm.id FROM civicrm_contribution cc LEFT JOIN civicrm_membership_payment cmp ON cc.id = cmp.contribution_id LEFT JOIN civicrm_membership cm ON cc.contribution_recur_id = cm.contribution_recur_id WHERE cc.contribution_recur_id IS NOT NULL AND cmp.id IS NULL AND cm.id IS NOT NULL;

View file

@ -0,0 +1 @@
{* file to handle db changes in 4.6.alpha2 during upgrade *}

View file

@ -0,0 +1,126 @@
{* CRM-16846 - This file may have been accidentally skipped and so is conditionally re-run during 4.6.6 upgrade *}
-- Use proper names for Slovenian municipalities
UPDATE `civicrm_state_province` SET `name` = (N'Ajdovščina') WHERE `id` = 4383;
UPDATE `civicrm_state_province` SET `name` = (N'Braslovče') WHERE `id` = 4392;
UPDATE `civicrm_state_province` SET `name` = (N'Brežice') WHERE `id` = 4395;
UPDATE `civicrm_state_province` SET `name` = (N'Črenšovci') WHERE `id` = 4402;
UPDATE `civicrm_state_province` SET `name` = (N'Črna na Koroškem') WHERE `id` = 4403;
UPDATE `civicrm_state_province` SET `name` = (N'Črnomelj') WHERE `id` = 4404;
UPDATE `civicrm_state_province` SET `name` = (N'Divača') WHERE `id` = 4406;
UPDATE `civicrm_state_province` SET `name` = (N'Domžale') WHERE `id` = 4414;
UPDATE `civicrm_state_province` SET `name` = (N'Gorišnica') WHERE `id` = 4419;
UPDATE `civicrm_state_province` SET `name` = (N'Hoče-Slivnica') WHERE `id` = 4426;
UPDATE `civicrm_state_province` SET `name` = (N'Hodoš') WHERE `id` = 4427;
UPDATE `civicrm_state_province` SET `name` = (N'Horjul') WHERE `id` = 4428;
UPDATE `civicrm_state_province` SET `name` = (N'Ilirska Bistrica') WHERE `id` = 4433;
UPDATE `civicrm_state_province` SET `name` = (N'Ivančna Gorica') WHERE `id` = 4434;
UPDATE `civicrm_state_province` SET `name` = (N'Juršinci') WHERE `id` = 4438;
UPDATE `civicrm_state_province` SET `name` = (N'Kidričevo') WHERE `id` = 4441;
UPDATE `civicrm_state_province` SET `name` = (N'Kočevje') WHERE `id` = 4444;
UPDATE `civicrm_state_province` SET `name` = (N'Križevci') WHERE `id` = 4452;
UPDATE `civicrm_state_province` SET `name` = (N'Krško') WHERE `id` = 4453;
UPDATE `civicrm_state_province` SET `name` = (N'Laško') WHERE `id` = 4456;
UPDATE `civicrm_state_province` SET `name` = (N'Loška dolina') WHERE `id` = 4464;
UPDATE `civicrm_state_province` SET `name` = (N'Loški Potok') WHERE `id` = 4465;
UPDATE `civicrm_state_province` SET `name` = (N'Luče') WHERE `id` = 4467;
UPDATE `civicrm_state_province` SET `name` = (N'Majšperk') WHERE `id` = 4469;
UPDATE `civicrm_state_province` SET `name` = (N'Mengeš') WHERE `id` = 4473;
UPDATE `civicrm_state_province` SET `name` = (N'Mežica') WHERE `id` = 4475;
UPDATE `civicrm_state_province` SET `name` = (N'Miklavž na Dravskem polju') WHERE `id` = 4476;
UPDATE `civicrm_state_province` SET `name` = (N'Mirna Peč') WHERE `id` = 4478;
UPDATE `civicrm_state_province` SET `name` = (N'Moravče') WHERE `id` = 4480;
UPDATE `civicrm_state_province` SET `name` = (N'Novo mesto') WHERE `id` = 4488;
UPDATE `civicrm_state_province` SET `name` = (N'Sveti Andraž v Slovenskih goricah') WHERE `id` = 4490;
UPDATE `civicrm_state_province` SET `name` = (N'Šalovci') WHERE `id` = 4492;
UPDATE `civicrm_state_province` SET `name` = (N'Šempeter-Vrtojba') WHERE `id` = 4493;
UPDATE `civicrm_state_province` SET `name` = (N'Šenčur') WHERE `id` = 4494;
UPDATE `civicrm_state_province` SET `name` = (N'Šentilj') WHERE `id` = 4495;
UPDATE `civicrm_state_province` SET `name` = (N'Šentjernej') WHERE `id` = 4496;
UPDATE `civicrm_state_province` SET `name` = (N'Šentjur') WHERE `id` = 4497;
UPDATE `civicrm_state_province` SET `name` = (N'Škocjan') WHERE `id` = 4498;
UPDATE `civicrm_state_province` SET `name` = (N'Škofja Loka') WHERE `id` = 4499;
UPDATE `civicrm_state_province` SET `name` = (N'Škofljica') WHERE `id` = 4500;
UPDATE `civicrm_state_province` SET `name` = (N'Šmarje pri Jelšah') WHERE `id` = 4501;
UPDATE `civicrm_state_province` SET `name` = (N'Šmartno ob Paki') WHERE `id` = 4502;
UPDATE `civicrm_state_province` SET `name` = (N'Šmartno pri Litiji') WHERE `id` = 4503;
UPDATE `civicrm_state_province` SET `name` = (N'Šoštanj') WHERE `id` = 4504;
UPDATE `civicrm_state_province` SET `name` = (N'Štore') WHERE `id` = 4505;
UPDATE `civicrm_state_province` SET `name` = (N'Tišina') WHERE `id` = 4507;
UPDATE `civicrm_state_province` SET `name` = (N'Trbovlje') WHERE `id` = 4509;
UPDATE `civicrm_state_province` SET `name` = (N'Tržič') WHERE `id` = 4512;
UPDATE `civicrm_state_province` SET `name` = (N'Turnišče') WHERE `id` = 4514;
UPDATE `civicrm_state_province` SET `name` = (N'Velike Lašče') WHERE `id` = 4517;
UPDATE `civicrm_state_province` SET `name` = (N'Veržej') WHERE `id` = 4518;
UPDATE `civicrm_state_province` SET `name` = (N'Zavrč') WHERE `id` = 4527;
UPDATE `civicrm_state_province` SET `name` = (N'Zreče') WHERE `id` = 4528;
UPDATE `civicrm_state_province` SET `name` = (N'Žalec') WHERE `id` = 4529;
UPDATE `civicrm_state_province` SET `name` = (N'Železniki') WHERE `id` = 4530;
UPDATE `civicrm_state_province` SET `name` = (N'Žetale') WHERE `id` = 4531;
UPDATE `civicrm_state_province` SET `name` = (N'Žiri') WHERE `id` = 4532;
UPDATE `civicrm_state_province` SET `name` = (N'Žirovnica') WHERE `id` = 4533;
UPDATE `civicrm_state_province` SET `name` = (N'Žužemberk') WHERE `id` = 4534;
-- Add missing Slovenian municipalities
INSERT INTO civicrm_state_province (country_id, abbreviation, name)
VALUES
(1193, "86", "Ankaran"),
(1193, "87", "Apače"),
(1193, "88", "Cirkulane"),
(1193, "89", "Gorje"),
(1193, "90", "Kostanjevica na Krki"),
(1193, "91", "Log-Dragomer"),
(1193, "92", "Makole"),
(1193, "93", "Mirna"),
(1193, "94", "Mokronog-Trebelno"),
(1193, "95", "Odranci"),
(1193, "96", "Oplotnica"),
(1193, "97", "Ormož"),
(1193, "98", "Osilnica"),
(1193, "99", "Pesnica"),
(1193, "100", "Piran"),
(1193, "101", "Pivka"),
(1193, "102", "Podčetrtek"),
(1193, "103", "Podlehnik"),
(1193, "104", "Podvelka"),
(1193, "105", "Poljčane"),
(1193, "106", "Polzela"),
(1193, "107", "Postojna"),
(1193, "108", "Prebold"),
(1193, "109", "Preddvor"),
(1193, "110", "Prevalje"),
(1193, "111", "Ptuj"),
(1193, "112", "Puconci"),
(1193, "113", "Rače-Fram"),
(1193, "114", "Radeče"),
(1193, "115", "Radenci"),
(1193, "139", "Radlje ob Dravi"),
(1193, "145", "Radovljica"),
(1193, "171", "Ravne na Koroškem"),
(1193, "172", "Razkrižje"),
(1193, "173", "Rečica ob Savinji"),
(1193, "174", "Renče-Vogrsko"),
(1193, "175", "Ribnica"),
(1193, "176", "Ribnica na Pohorju"),
(1193, "177", "Rogaška Slatina"),
(1193, "178", "Rogašovci"),
(1193, "179", "Rogatec"),
(1193, "180", "Ruše"),
(1193, "195", "Selnica ob Dravi"),
(1193, "196", "Semič"),
(1193, "197", "Šentrupert"),
(1193, "198", "Sevnica"),
(1193, "199", "Sežana"),
(1193, "200", "Slovenj Gradec"),
(1193, "201", "Slovenska Bistrica"),
(1193, "202", "Slovenske Konjice"),
(1193, "203", "Šmarješke Toplice"),
(1193, "204", "Sodražica"),
(1193, "205", "Solčava"),
(1193, "206", "Središče ob Dravi"),
(1193, "207", "Starše"),
(1193, "208", "Straža"),
(1193, "209", "Sveta Trojica v Slovenskih goricah"),
(1193, "210", "Sveti Jurij v Slovenskih goricah"),
(1193, "211", "Sveti Tomaž"),
(1193, "212", "Vodice");

View file

@ -0,0 +1,21 @@
{* file to handle db changes in 4.6.alpha4 during upgrade *}
--CRM-15821 PCP Owner Notification
{include file='../CRM/Upgrade/4.6.alpha4.msg_template/civicrm_msg_template.tpl'}
-- Add new column owner_notify_id in pcp block table
ALTER TABLE `civicrm_pcp_block` ADD `owner_notify_id` INT NULL DEFAULT NULL COMMENT 'FK to option_value where option_group = pcp_owner_notification';
-- Add new column is_notify in pcp table
ALTER TABLE `civicrm_pcp` ADD `is_notify` INT NOT NULL DEFAULT '0';
--Add PCP owner notification option group
INSERT INTO `civicrm_option_group` ( `name`, {localize field='title'}`title`{/localize}, `is_active` ) VALUES ('pcp_owner_notify', {localize}'{ts escape="sql"}PCP owner notifications{/ts}'{/localize}, 1);
SELECT @ogid_pcp_owner := MAX(id) FROM `civicrm_option_group`;
INSERT INTO `civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `is_default`, `weight`) VALUES (@ogid_pcp_owner, {localize}'{ts escape="sql"}Owner chooses whether to receive notifications{/ts}'{/localize}, '1', 'owner_chooses', 1, 1), (@ogid_pcp_owner, {localize}'{ts escape="sql"}Notifications are sent to ALL owners{/ts}'{/localize}, '2', 'all_owners', 0, 2),(@ogid_pcp_owner, {localize}'{ts escape="sql"}Notifications are NOT available{/ts}'{/localize}, '3', 'no_notifications', 0, 3);
UPDATE `civicrm_pcp_block` SET `owner_notify_id` = 3;
UPDATE `civicrm_pcp` SET `is_notify` = 0;

View file

@ -0,0 +1,5 @@
{* file to handle db changes in 4.6.alpha5 during upgrade *}
-- CRM-15910
ALTER TABLE `civicrm_contact`
CHANGE COLUMN `external_identifier` `external_identifier` VARCHAR(64) DEFAULT NULL;

View file

@ -0,0 +1,8 @@
{* file to handle db changes in 4.6.alpha6 during upgrade *}
UPDATE `civicrm_navigation` SET url = 'civicrm/api' WHERE url = 'civicrm/api/explorer';
-- CRM-15931
UPDATE civicrm_mailing_group SET group_type = 'Include' WHERE group_type = 'include';
UPDATE civicrm_mailing_group SET group_type = 'Exclude' WHERE group_type = 'exclude';
UPDATE civicrm_mailing_group SET group_type = 'Base' WHERE group_type = 'base';

View file

@ -0,0 +1,25 @@
{* file to handle db changes in 4.6.alpha7 during upgrade *}
-- location_type_id should have default NULL, not invalid id 0
ALTER TABLE civicrm_mailing CHANGE `location_type_id` `location_type_id` int(10) unsigned DEFAULT NULL COMMENT 'With email_selection_method, determines which email address to use';
-- CRM-15970 - Track authorship of of A/B tests
ALTER TABLE civicrm_mailing_abtest
ADD COLUMN `created_id` int unsigned COMMENT 'FK to Contact ID',
ADD COLUMN `created_date` datetime COMMENT 'When was this item created',
ADD COLUMN `testing_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
ADD COLUMN `winner_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
ADD CONSTRAINT FK_civicrm_mailing_abtest_created_id FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL;
-- Move A/B test option-values into code
DELETE FROM civicrm_option_group WHERE name IN ('mailing_ab_status', 'mailing_ab_testing_criteria', 'mailing_ab_winner_criteria');
UPDATE civicrm_mailing_abtest SET testing_criteria = 'subject' WHERE testing_criteria_id = 1;
UPDATE civicrm_mailing_abtest SET testing_criteria = 'from' WHERE testing_criteria_id = 2;
UPDATE civicrm_mailing_abtest SET testing_criteria = 'full_email' WHERE testing_criteria_id = 3;
UPDATE civicrm_mailing_abtest SET winner_criteria = 'open' WHERE winner_criteria_id = 1;
UPDATE civicrm_mailing_abtest SET winner_criteria = 'unique_click' WHERE winner_criteria_id = 2;
UPDATE civicrm_mailing_abtest SET winner_criteria = 'link_click' WHERE winner_criteria_id = 3;
ALTER TABLE civicrm_mailing_abtest
DROP COLUMN `testing_criteria_id`,
DROP COLUMN `winner_criteria_id`;

View file

@ -0,0 +1,99 @@
{* file to handle db changes in 4.6.beta1 during upgrade *}
-- See https://issues.civicrm.org/jira/browse/CRM-15361
UPDATE civicrm_mailing SET location_type_id = NULL WHERE location_type_id = 0;
ALTER TABLE civicrm_mailing ADD CONSTRAINT FK_civicrm_mailing_location_type_id FOREIGN KEY FK_civicrm_mailing_location_type_id(`location_type_id`) REFERENCES `civicrm_location_type`(`id`) ON DELETE SET NULL;
SELECT @parent_id := id from `civicrm_navigation` where name = 'Customize Data and Screens' AND domain_id = {$domainID};
SELECT @add_weight_id := weight from `civicrm_navigation` where `name` = 'Search Preferences' and `parent_id` = @parent_id;
UPDATE `civicrm_navigation`
SET `weight` = `weight`+1
WHERE `parent_id` = @parent_id
AND `weight` > @add_weight_id;
INSERT INTO `civicrm_navigation`
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( {$domainID}, 'civicrm/admin/setting/preferences/date?reset=1', '{ts escape="sql" skip="true"}Date Preferences{/ts}', 'Date Preferences', 'administer CiviCRM', '', @parent_id , '1', NULL, @add_weight_id + 1 );
-- CRM-15934
SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Quota';
INSERT INTO civicrm_mailing_bounce_pattern (bounce_type_id, pattern)
VALUES
(@bounceTypeID, 'doesn.t have enough disk space left'),
(@bounceTypeID, 'exceeded storage allocation'),
(@bounceTypeID, 'running out of disk space');
UPDATE `civicrm_mailing_bounce_pattern` SET `pattern` = '(disk(space)?|over the allowed|exceed(ed|s)?|storage) quota' WHERE `pattern` = '(disk|over the allowed|exceed(ed|s)?|storage) quota';
UPDATE `civicrm_mailing_bounce_pattern` SET `pattern` = '(mail|in)(box|folder) ((for user \\w+ )?is )?full' WHERE `pattern` = 'mailbox ((for user w+ )?is )?full';
UPDATE `civicrm_mailing_bounce_pattern` SET `pattern` = 'mailbox (has exceeded|is over) the limit' WHERE `pattern` = 'mailbox has exceeded the limit';
UPDATE `civicrm_mailing_bounce_pattern` SET `pattern` = 'quota ?(usage|violation|exceeded)' WHERE `pattern` = 'quota (usage|violation|exceeded)';
SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Inactive';
INSERT INTO civicrm_mailing_bounce_pattern (bounce_type_id, pattern)
VALUES
(@bounceTypeID, 'account that you tried to reach is disabled'),
(@bounceTypeID, 'User banned');
UPDATE `civicrm_mailing_bounce_pattern` SET `pattern` = 'not accepting (mail|messages)' WHERE `pattern` = 'not accepting mail';
SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Loop';
UPDATE `civicrm_mailing_bounce_pattern` SET `pattern` = '(mail( forwarding)?|routing).loop' WHERE `pattern` = '(mail|routing) loop';
UPDATE `civicrm_mailing_bounce_pattern` SET `pattern` = 'too many (hops|recursive forwards)' WHERE `pattern` = 'too many hops';
SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Relay';
INSERT INTO civicrm_mailing_bounce_pattern (bounce_type_id, pattern)
VALUES
(@bounceTypeID, 'unrouteable address'),
(@bounceTypeID, 'We don.t handle mail for'),
(@bounceTypeID, 'we do not relay'),
(@bounceTypeID, 'Rejected by next-hop'),
(@bounceTypeID, 'not permitted to( *550)? relay through this server');
UPDATE `civicrm_mailing_bounce_pattern` SET `pattern` = 'relay(ing)? (not permitted|(access )?denied)' WHERE `pattern` = 'relay (not permitted|access denied)';
SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Host';
INSERT INTO civicrm_mailing_bounce_pattern (bounce_type_id, pattern)
VALUES
(@bounceTypeID, 'server requires authentication'),
(@bounceTypeID, 'authentication (is )?required');
UPDATE `civicrm_mailing_bounce_pattern` SET `pattern` = 'server is (down or unreachable|not responding)' WHERE `pattern` = 'server is down or unreachable';
SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Invalid';
INSERT INTO civicrm_mailing_bounce_pattern (bounce_type_id, pattern)
VALUES
(@bounceTypeID, '5.1.0 Address rejected'),
(@bounceTypeID, 'no valid recipients?'),
(@bounceTypeID, 'RecipNotFound'),
(@bounceTypeID, 'no one at this address'),
(@bounceTypeID, 'misconfigured forwarding address'),
(@bounceTypeID, 'account is not allowed'),
(@bounceTypeID, 'Address .<[^>]*>. not known here'),
(@bounceTypeID, '{literal}Recipient address rejected: ([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}{/literal}'),
(@bounceTypeID, 'Non sono riuscito a trovare l.indirizzo e-mail'),
(@bounceTypeID, 'nadie con esta direcci..?n'),
(@bounceTypeID, 'ni bilo mogo..?e najti prejemnikovega e-po..?tnega naslova'),
(@bounceTypeID, 'Elektronski naslov (je ukinjen|ne obstaja)'),
(@bounceTypeID, 'nepravilno nastavljen predal');
UPDATE `civicrm_mailing_bounce_pattern` SET `pattern` = 'address(es)?( you (entered|specified))? (could|was)( not|n.t)( be)? found' WHERE `pattern` = 'address(es)? could not be found';
UPDATE `civicrm_mailing_bounce_pattern` SET `pattern` = 'address(ee)? (unknown|invalid)' WHERE `pattern` = 'addressee unknown';
UPDATE `civicrm_mailing_bounce_pattern` SET `pattern` = '(mail )?delivery (to this user )?is not allowed' WHERE `pattern` = 'mail delivery to this user is not allowed';
UPDATE `civicrm_mailing_bounce_pattern` SET `pattern` = 'no such (mail drop|mailbox( \\w+)?|(e-?mail )?address|recipient|(local )?user|person)( here)?' WHERE `pattern` = 'no such (mail drop|mailbox( w+)?|(e-?mail )?address|recipient|(local )?user)( here)?';
UPDATE `civicrm_mailing_bounce_pattern` SET `pattern` = 'no mailbox (here )?by that name' WHERE `pattern` = 'no mailbox here by that name';
UPDATE `civicrm_mailing_bounce_pattern` SET `pattern` = 'recipient (does not exist|(is )?unknown|rejected|denied|not found)' WHERE `pattern` = 'recipient (does not exist|(is )?unknown)';
UPDATE `civicrm_mailing_bounce_pattern` SET `pattern` = 'unknown (local( |-)part|recipient|address error)' WHERE `pattern` = 'unknown (local( |-)part|recipient)';
SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Spam';
INSERT INTO civicrm_mailing_bounce_pattern (bounce_type_id, pattern)
VALUES
(@bounceTypeID, 'Client host .[^ ]*. blocked'),
(@bounceTypeID, 'automatic(ally-generated)? messages are not accepted'),
(@bounceTypeID, 'denied by policy'),
(@bounceTypeID, 'has no corresponding reverse \\(PTR\\) address'),
(@bounceTypeID, 'has a policy that( [^ ]*)? prohibited the mail that you sent'),
(@bounceTypeID, 'is likely unsolicited mail'),
(@bounceTypeID, 'Local Policy Violation'),
(@bounceTypeID, 'ni bilo mogo..?e dostaviti zaradi varnostnega pravilnika');
UPDATE `civicrm_mailing_bounce_pattern` SET `pattern` = '(detected|rejected) as spam' WHERE `pattern` = 'detected as spam';

View file

@ -0,0 +1,8 @@
{* file to handle db changes in 4.6.beta2 during upgrade *}
-- CRM-16018
ALTER TABLE `civicrm_membership_block` CHANGE `membership_types` `membership_types` VARCHAR( 1024 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci COMMENT 'Membership types to be exposed by this block.';
-- CRM-15578 Require access CiviMail permission for A/B Testing feature
UPDATE civicrm_navigation
SET permission = 'access CivMail', permission_operator = ''
WHERE name = 'New A/B Test' OR name = 'Manage A/B Tests';

View file

@ -0,0 +1,27 @@
{* file to handle db changes in 4.6.beta3 during upgrade *}
{*--CRM-15979 - differentiate between standalone mailings, A/B tests, and A/B final-winner *}
ALTER TABLE `civicrm_mailing` ADD mailing_type varchar(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci COMMENT 'differentiate between standalone mailings, A/B tests, and A/B final-winner';
UPDATE `civicrm_mailing`cm
LEFT JOIN civicrm_mailing_abtest ab
ON cm.id = ab.mailing_id_a
OR cm.id = ab.mailing_id_b
OR cm.id = ab.mailing_id_c
SET `mailing_type` = CASE
WHEN cm.id IN (ab.mailing_id_a,ab.mailing_id_b) THEN 'experiment'
WHEN cm.id IN (ab.mailing_id_c) THEN 'winner'
ELSE 'standalone'
END
WHERE cm.id IS NOT NULL;
-- CRM-16059
UPDATE civicrm_state_province SET name = 'Dobrich' WHERE name = 'Dobric';
UPDATE civicrm_state_province SET name = 'Yambol' WHERE name = 'Jambol';
UPDATE civicrm_state_province SET name = 'Kardzhali' WHERE name = 'Kardzali';
UPDATE civicrm_state_province SET name = 'Kyustendil' WHERE name = 'Kjstendil';
UPDATE civicrm_state_province SET name = 'Lovech' WHERE name = 'Lovec';
UPDATE civicrm_state_province SET name = 'Smolyan' WHERE name = 'Smoljan';
UPDATE civicrm_state_province SET name = 'Shumen' WHERE name = 'Sumen';
UPDATE civicrm_state_province SET name = 'Targovishte' WHERE name = 'Targoviste';
UPDATE civicrm_state_province SET name = 'Vratsa' WHERE name = 'Vraca';

View file

@ -0,0 +1,10 @@
{* file to handle db changes in 4.6.beta4 during upgrade *}
-- CRM-14792
SELECT @option_group_id_act := max(id) from civicrm_option_group where name = 'activity_type';
SELECT @option_group_id_act_wt := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act;
SELECT @option_group_id_act_val := MAX(CAST( `value` AS UNSIGNED )) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act;
INSERT INTO
`civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, {localize field='description'}`description`{/localize}, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
VALUES
(@option_group_id_act, {localize}'{ts escape="sql"}Contact Merged{/ts}'{/localize}, @option_group_id_act_val+1, 'Contact Merged', NULL, 1, NULL, @option_group_id_act_wt+1, {localize}'{ts escape="sql"}Contact Merged{/ts}'{/localize}, 0, 1, 1, NULL, NULL);

View file

@ -0,0 +1 @@
{* file to handle db changes in 4.6.beta5 during upgrade *}

Some files were not shown because too many files have changed in this diff Show more