-- CRM-15475, Added upgrade code to make Cancelled status as reserved
authorPradeep Nayak <pradpnayak@gmail.com>
Mon, 3 Nov 2014 05:57:36 +0000 (11:27 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Mon, 3 Nov 2014 06:02:32 +0000 (11:32 +0530)
----------------------------------------
* CRM-15475: Fatal error on membership page if membership status 'Cancelled' is disabled
  https://issues.civicrm.org/jira/browse/CRM-15475

CRM/Upgrade/Incremental/sql/4.5.3.mysql.tpl

index d72265052fa28674adbbade4851676c58abe647d..cee9125d6be213d7ca0effa42ad1ef99e8c04127 100644 (file)
@@ -1,2 +1,9 @@
 {* 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;
\ No newline at end of file