From 80a47b8767d65b283ea403f40ac2291ce89dcef4 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Fri, 29 Jul 2022 19:16:11 +0100 Subject: [PATCH] Added default invoice pdf format --- CRM/Upgrade/Incremental/php/FiveFiftyThree.php | 16 ++++++++++++++++ xml/templates/civicrm_data.tpl | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/CRM/Upgrade/Incremental/php/FiveFiftyThree.php b/CRM/Upgrade/Incremental/php/FiveFiftyThree.php index 8d952584f2..0f6d8c7fd4 100644 --- a/CRM/Upgrade/Incremental/php/FiveFiftyThree.php +++ b/CRM/Upgrade/Incremental/php/FiveFiftyThree.php @@ -57,6 +57,22 @@ class CRM_Upgrade_Incremental_php_FiveFiftyThree extends CRM_Upgrade_Incremental public function upgrade_5_53_alpha1($rev): void { $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev); $this->addTask('Replace %A specifier in date settings.', 'replacePercentA'); + $this->addTask('Add invoice pdf format', 'addInvoicePDFFormat'); + } + + /** + * @param CRM_Queue_TaskContext $ctx + * @return bool + */ + public static function addInvoicePDFFormat(CRM_Queue_TaskContext $ctx) { + \CRM_Core_BAO_OptionValue::ensureOptionValueExists([ + 'value' => '{"metric":"px","margin_top":10,"margin_bottom":0,"margin_left":65,"margin_right":0}', + 'name' => 'default_invoice_pdf_format', + 'label' => ts('Invoice PDF Format'), + 'is_reserved' => TRUE, + 'option_group_id' => 'pdf_format', + ]); + return TRUE; } public static function replacePercentA($ctx): bool { diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index 88954b1727..dc537763df 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -287,6 +287,7 @@ SELECT @option_group_id_crs := max(id) from civicrm_option_group where name = SELECT @option_group_id_env := max(id) from civicrm_option_group where name = 'environment'; SELECT @option_group_id_default_assignee := max(id) from civicrm_option_group where name = 'activity_default_assignee'; SELECT @option_group_id_entity_batch_extends := max(id) from civicrm_option_group where name = 'entity_batch_extends'; +SELECT @option_group_id_pdf_format := max(id) from civicrm_option_group where name = 'pdf_format'; SELECT @contributeCompId := max(id) FROM civicrm_component where name = 'CiviContribute'; SELECT @eventCompId := max(id) FROM civicrm_component where name = 'CiviEvent'; @@ -856,6 +857,9 @@ VALUES (@option_group_id_aco, '{ts escape="sql"}Activity Source{/ts}', 2, 'Activity Source', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL), (@option_group_id_aco, '{ts escape="sql"}Activity Targets{/ts}', 3, 'Activity Targets', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL), +-- pdf_format + (@option_group_id_pdf_format, '{ts escape="sql"}Invoice PDF Format{/ts}', '{literal}{"metric":"px","margin_top":10,"margin_bottom":0,"margin_left":65,"margin_right":0}{/literal}', 'default_invoice_pdf_format', NULL, 0, 0, 1, NULL, 0, 1, 1, NULL, NULL, NULL), + -- financial_account_type -- grouping field is specific to Quickbooks for mapping to .iif format (@option_group_id_fat, '{ts escape="sql"}Asset{/ts}', 1, 'Asset', NULL, 0, 0, 1, 'Things you own', 0, 1, 1, 2, NULL, NULL), -- 2.25.1