From 7cd6ec23f4ec1b72aeffc892846250d607d98742 Mon Sep 17 00:00:00 2001 From: Aidan Saunders Date: Fri, 14 Apr 2017 21:49:32 +0100 Subject: [PATCH] CRM-19464 sql upgrade --- CRM/Upgrade/Incremental/sql/4.7.19.mysql.tpl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CRM/Upgrade/Incremental/sql/4.7.19.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.7.19.mysql.tpl index c0c90d2888..038c5699dd 100644 --- a/CRM/Upgrade/Incremental/sql/4.7.19.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.7.19.mysql.tpl @@ -28,3 +28,13 @@ WHERE price_field.price_field_id IS NULL; -- CRM-20402 Improve dectection of spam bounces SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Spam'; UPDATE civicrm_mailing_bounce_pattern SET pattern = '(detected|rejected) (as|due to) spam' WHERE bounce_type_id = @bounceTypeID AND pattern = '(detected|rejected) as spam'; + +-- CRM-19464 add 'Supplemental Address 3', increment weights after supplemental_address_2 to slot in this new one +SELECT @option_group_id_adOpt := max(id) from civicrm_option_group where name = 'address_options'; +SELECT @max_val := MAX(ROUND(op.value)) FROM civicrm_option_value op WHERE op.option_group_id = @option_group_id_adOpt; +SELECT @supp2_wt := weight FROM civicrm_option_value WHERE name = 'supplemental_address_2'; +UPDATE civicrm_option_value SET weight = weight + 1 WHERE option_group_id = @option_group_id_adOpt AND weight > @supp2_wt; +INSERT INTO + `civicrm_option_value` (`option_group_id`, {localize field='label'}label{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`, `icon`) +VALUES + (@option_group_id_adOpt, {localize}'{ts escape="sql"}Supplemental Address 3{/ts}'{/localize}, (SELECT @max_val := @max_val + 1), 'supplemental_address_3', NULL, 0, NULL, (SELECT @supp2_wt := @supp2_wt + 1), NULL, 0, 0, 1, NULL, NULL, NULL); -- 2.25.1