-- CRM-7445 add client to case
SELECT @option_group_id_act := max(id) from civicrm_option_group where name = 'activity_type';
SELECT @weight := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act;
-SELECT @value := MAX(value) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act;
+SELECT @value := MAX(ROUND(value)) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act;
SELECT @caseCompId := max(id) FROM civicrm_component where name = 'CiviCase';
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
-- CRM-9923 and CRM-11037
SELECT @option_group_id_batch_status := max(id) from civicrm_option_group where name = 'batch_status';
-SELECT @weight := MAX(value) FROM civicrm_option_value WHERE option_group_id = @option_group_id_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`)
{* 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(value) FROM civicrm_option_value WHERE option_group_id = @option_group_id_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),
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(value) FROM civicrm_option_value WHERE option_group_id = @option_group_id_batch_modes;
+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),
-- 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(value) 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`)
-- add batch type for pledge payments
SELECT @option_group_id := id FROM civicrm_option_group WHERE name = 'batch_type';
-SELECT @max_option_value:= max(value) FROM civicrm_option_value WHERE option_group_id = @option_group_id;
+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');