Skip to content

Commit

Permalink
Merge pull request #24872 from seamuslee001/dev_core_3952
Browse files Browse the repository at this point in the history
dev/core#3952 Add in Upgrade script to fix up print labels where " wa…
  • Loading branch information
seamuslee001 authored Nov 2, 2022
2 parents e81295e + 3c62d09 commit a14f548
Show file tree
Hide file tree
Showing 28 changed files with 65 additions and 26 deletions.
14 changes: 14 additions & 0 deletions CRM/Upgrade/Incremental/php/FiveFiftyFive.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,18 @@ public function upgrade_5_55_alpha1($rev): void {
$this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
}

public function upgrade_5_55_beta2($rev): void {
$this->addTask(ts('Fix Event Badge Upgrade'), 'fix_event_badge_upgrade');
}

public static function fix_event_badge_upgrade() {
$problematic_fields = CRM_Core_DAO::executeQuery('SELECT id, data FROM civicrm_print_label WHERE data like \'%crmDate:\"%B %E%f\"%\'');
while ($problematic_fields->fetch()) {
$data = $problematic_fields->data;
$data = str_replace('crmDate:"%B %E%f"', 'crmDate:\\\"%B %E%f\\\"', $data);
CRM_Core_DAO::executeQuery("UPDATE civicrm_print_label SET data = '{$data}' WHERE id = %1", [1 => [$problematic_fields->id, 'Positive']]);
}
return TRUE;
}

}
2 changes: 1 addition & 1 deletion ext/afform/admin/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-01-09</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<develStage>beta</develStage>
<compatibility>
<ver>5.55</ver>
Expand Down
2 changes: 1 addition & 1 deletion ext/afform/core/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-01-09</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<develStage>beta</develStage>
<compatibility>
<ver>5.55</ver>
Expand Down
2 changes: 1 addition & 1 deletion ext/afform/html/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-01-09</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<develStage>alpha</develStage>
<compatibility>
<ver>5.55</ver>
Expand Down
2 changes: 1 addition & 1 deletion ext/afform/mock/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-01-09</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<tags>
<tag>mgmt:hidden</tag>
</tags>
Expand Down
2 changes: 1 addition & 1 deletion ext/authx/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2021-02-11</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<develStage>stable</develStage>
<compatibility>
<ver>5.55</ver>
Expand Down
2 changes: 1 addition & 1 deletion ext/civicrm_admin_ui/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2022-01-02</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<develStage>alpha</develStage>
<compatibility>
<ver>5.55</ver>
Expand Down
2 changes: 1 addition & 1 deletion ext/civigrant/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2021-11-11</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<develStage>stable</develStage>
<compatibility>
<ver>5.55</ver>
Expand Down
2 changes: 1 addition & 1 deletion ext/civiimport/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2022-08-11</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<develStage>alpha</develStage>
<compatibility>
<ver>5.55</ver>
Expand Down
2 changes: 1 addition & 1 deletion ext/ckeditor4/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<url desc="Licensing">https://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2021-05-23</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<develStage>stable</develStage>
<compatibility>
<ver>5.55</ver>
Expand Down
2 changes: 1 addition & 1 deletion ext/contributioncancelactions/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-10-12</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<develStage>stable</develStage>
<compatibility>
<ver>5.55</ver>
Expand Down
2 changes: 1 addition & 1 deletion ext/elavon/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2022-08-05</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<develStage>stable</develStage>
<compatibility>
<ver>5.55</ver>
Expand Down
2 changes: 1 addition & 1 deletion ext/eventcart/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-08-03</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<tags>
<tag>mgmt:hidden</tag>
</tags>
Expand Down
2 changes: 1 addition & 1 deletion ext/ewaysingle/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-10-07</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<tags>
<tag>mgmt:hidden</tag>
</tags>
Expand Down
2 changes: 1 addition & 1 deletion ext/financialacls/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-08-27</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<develStage>stable</develStage>
<compatibility>
<ver>5.55</ver>
Expand Down
2 changes: 1 addition & 1 deletion ext/flexmailer/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-08-05</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<develStage>stable</develStage>
<comments>
FlexMailer is an email delivery engine which replaces the internal guts
Expand Down
2 changes: 1 addition & 1 deletion ext/greenwich/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-07-21</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<tags>
<tag>mgmt:hidden</tag>
</tags>
Expand Down
2 changes: 1 addition & 1 deletion ext/legacycustomsearches/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2021-07-25</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<develStage>stable</develStage>
<tags>
<tag>mgmt:hidden</tag>
Expand Down
2 changes: 1 addition & 1 deletion ext/message_admin/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2021-06-12</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<develStage>alpha</develStage>
<compatibility>
<ver>5.55</ver>
Expand Down
2 changes: 1 addition & 1 deletion ext/oauth-client/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-10-23</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<develStage>stable</develStage>
<compatibility>
<ver>5.55</ver>
Expand Down
2 changes: 1 addition & 1 deletion ext/payflowpro/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2021-04-13</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<develStage>stable</develStage>
<compatibility>
<ver>5.55</ver>
Expand Down
2 changes: 1 addition & 1 deletion ext/recaptcha/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2021-04-03</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<tags>
<tag>mgmt:hidden</tag>
</tags>
Expand Down
2 changes: 1 addition & 1 deletion ext/search_kit/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2021-01-06</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<develStage>stable</develStage>
<compatibility>
<ver>5.55</ver>
Expand Down
2 changes: 1 addition & 1 deletion ext/sequentialcreditnotes/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-01-28</releaseDate>
<version>5.55.beta1</version>
<version>5.55.beta2</version>
<tags>
<tag>mgmt:hidden</tag>
</tags>
Expand Down
2 changes: 1 addition & 1 deletion sql/civicrm_generated.mysql
Original file line number Diff line number Diff line change
Expand Up @@ -3057,7 +3057,7 @@ UNLOCK TABLES;
LOCK TABLES `civicrm_domain` WRITE;
/*!40000 ALTER TABLE `civicrm_domain` DISABLE KEYS */;
INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES
(1,'Default Domain Name',NULL,'5.55.beta1',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
(1,'Default Domain Name',NULL,'5.55.beta2',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
/*!40000 ALTER TABLE `civicrm_domain` ENABLE KEYS */;
UNLOCK TABLES;

Expand Down
2 changes: 1 addition & 1 deletion sql/test_data_second_domain.mysql
Original file line number Diff line number Diff line change
Expand Up @@ -902,4 +902,4 @@ INSERT INTO civicrm_navigation
VALUES
( @domainID, CONCAT('civicrm/report/instance/', @instanceID,'&reset=1'), 'Mailing Detail Report', 'Mailing Detail Report', 'administer CiviMail', 'OR', @reportlastID, '1', NULL, @instanceID+2 );
UPDATE civicrm_report_instance SET navigation_id = LAST_INSERT_ID() WHERE id = @instanceID;
UPDATE civicrm_domain SET version = '5.55.beta1';
UPDATE civicrm_domain SET version = '5.55.beta2';
25 changes: 25 additions & 0 deletions tests/phpunit/CRM/Upgrade/Incremental/php/FiveFiftyFiveTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

require_once 'CiviTest/CiviCaseTestCase.php';

/**
* Class CRM_Upgrade_Incremental_php_FiveFiftyFiveTest
* @group headless
*/
class CRM_Upgrade_Incremental_php_FiveFiftyFiveTest extends CiviCaseTestCase {

public function testFixingPrintLabelUpgrade() {
CRM_Core_DAO::executeQuery("INSERT INTO civicrm_print_label (title, name, description, label_format_name, label_type_id, is_default, is_reserved, is_active, data) VALUES ('Annual Conference Hanging Badge (Avery 5395) Busted', 'Annual_Conference_Hanging_Badge_busted', 'For our annual conference', 'Avery 5395', 1, 1, 1, 1, '" . '{"title":"Annual Conference Hanging Badge (Avery 5395)","label_format_name":"Avery 5395","description":"For our annual conference","token":{"1":"{event.title}","2":"{contact.display_name}","3":"{contact.current_employer}","4":"{event.start_date|crmDate:\"%B %E%f\"}"},"font_name":{"1":"dejavusans","2":"dejavusans","3":"dejavusans","4":"dejavusans"},"font_size":{"1":"9","2":"20","3":"15","4":"9"},"font_style":{"1":"","2":"","3":"","4":""},"text_alignment":{"1":"L","2":"C","3":"C","4":"R"},"barcode_type":"barcode","barcode_alignment":"R","image_1":"","image_2":"","is_default":"1","is_active":"1","is_reserved":"1","_qf_default":"Layout:next","_qf_Layout_refresh":"Save and Preview"}' . "'),('Annual Conference Hanging Badge (Avery 5395) Fixed', 'Annual_Conference_Hanging_Badge_fixed', 'For our annual conference', 'Avery 5395', 1, 1, 1, 1, '" . '{"title":"Annual Conference Hanging Badge (Avery 5395)","label_format_name":"Avery 5395","description":"For our annual conference","token":{"1":"{event.title}","2":"{contact.display_name}","3":"{contact.current_employer}","4":"{event.start_date|crmDate:\\\"%B %E%f\\\"}"},"font_name":{"1":"dejavusans","2":"dejavusans","3":"dejavusans","4":"dejavusans"},"font_size":{"1":"9","2":"20","3":"15","4":"9"},"font_style":{"1":"","2":"","3":"","4":""},"text_alignment":{"1":"L","2":"C","3":"C","4":"R"},"barcode_type":"barcode","barcode_alignment":"R","image_1":"","image_2":"","is_default":"1","is_active":"1","is_reserved":"1","_qf_default":"Layout:next","_qf_Layout_refresh":"Save and Preview"}' . "')");
$this->assertEquals(1, CRM_Core_DAO::singleValueQuery("SELECT count(id) FROM civicrm_print_label WHERE data like '%" . 'crmDate:\"%B %E%f\"' . "%'"));
$originalFixed = CRM_Core_DAO::singleValueQuery("SELECT data FROM civicrm_print_label WHERE name = 'Annual_Conference_Hanging_Badge_fixed'");
$originalBusted = CRM_Core_DAO::singleValueQuery("SELECT data FROM civicrm_print_label WHERE name = 'Annual_Conference_Hanging_Badge_busted'");
$this->assertEquals(NULL, json_decode($originalBusted));
$this->assertFalse(NULL === json_decode($originalFixed));
CRM_Upgrade_Incremental_php_FiveFiftyFive::fix_event_badge_upgrade();
$fixedBusted = CRM_Core_DAO::singleValueQuery('SELECT data FROM civicrm_print_label WHERE name = \'Annual_Conference_Hanging_Badge_busted\'');
$fixedFixed = CRM_Core_DAO::singleValueQuery("SELECT data FROM civicrm_print_label WHERE name = 'Annual_Conference_Hanging_Badge_fixed'");
$this->assertEquals($originalFixed, $fixedFixed);
$this->assertFalse(NULL === json_decode($fixedBusted));
}

}
2 changes: 1 addition & 1 deletion xml/version.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<version>
<version_no>5.55.beta1</version_no>
<version_no>5.55.beta2</version_no>
</version>

0 comments on commit a14f548

Please sign in to comment.