Commit 384c368e authored by bgm's avatar bgm Committed by bgm

translation#34 Fix Contact Reference option for Postal Code

parent f21e208e
......@@ -74,6 +74,7 @@ class CRM_Upgrade_Incremental_php_FiveTwentyThree extends CRM_Upgrade_Incrementa
$this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
$this->addTask('Remove Google + location option', 'removeGooglePlusOption');
$this->addTask('dev/mailing#59 Add in IMAP_XOAUTH2 protocol option for mailbox access', 'addXoauth2ProtocolOption');
$this->addTask('dev/translation#34 Fix contact-reference option for Postal Code', 'fixContactRefOptionPostalCode');
}
/**
......@@ -109,4 +110,40 @@ class CRM_Upgrade_Incremental_php_FiveTwentyThree extends CRM_Upgrade_Incrementa
return TRUE;
}
/**
* Fix the Contact Reference 'Postal Code' option.
*/
public static function fixContactRefOptionPostalCode(CRM_Queue_TaskContext $ctx) {
$optionGroup = \Civi\Api4\OptionGroup::get()
->setSelect(['id'])
->addWhere('name', '=', 'contact_reference_options')
->setCheckPermissions(FALSE)
->execute()
->first();
if (!$optionGroup) {
return TRUE;
}
$optionValue = \Civi\Api4\OptionValue::get()
->setSelect(['id', 'name'])
->addWhere('option_group_id', '=', $optionGroup['id'])
->addWhere('label', '=', ts('Postal Code'))
->setCheckPermissions(FALSE)
->execute()
->first();
if (!$optionValue || $optionValue['name'] == 'postal_code') {
return TRUE;
}
\Civi\Api4\OptionValue::update()
->addWhere('id', '=', $optionValue['id'])
->addValue('name', 'postal_code')
->setCheckPermissions(FALSE)
->execute();
return TRUE;
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -535,7 +535,7 @@ VALUES
(@option_group_id_acConRef, '{ts escape="sql"}City{/ts}' , 5, 'city' , NULL, 0, NULL, 5, NULL, 0, 0, 1, NULL, NULL, NULL),
(@option_group_id_acConRef, '{ts escape="sql"}State/Province{/ts}' , 6, 'state_province', NULL, 0, NULL, 6, NULL, 0, 0, 1, NULL, NULL, NULL),
(@option_group_id_acConRef, '{ts escape="sql"}Country{/ts}' , 7, 'country' , NULL, 0, NULL, 7, NULL, 0, 0, 1, NULL, NULL, NULL),
(@option_group_id_acConRef, '{ts escape="sql"}Postal Code{/ts}' , 8, 'country' , NULL, 0, NULL, 8, NULL, 0, 0, 1, NULL, NULL, NULL),
(@option_group_id_acConRef, '{ts escape="sql"}Postal Code{/ts}' , 8, 'postal_code' , NULL, 0, NULL, 8, NULL, 0, 0, 1, NULL, NULL, NULL),
(@option_group_id_adOpt, '{ts escape="sql"}Street Address{/ts}' , 1, 'street_address', NULL, 0, NULL, 1, NULL, 0, 0, 1, NULL, NULL, NULL),
(@option_group_id_adOpt, '{ts escape="sql"}Supplemental Address 1{/ts}' , 2, 'supplemental_address_1', NULL, 0, NULL, 2, NULL, 0, 0, 1, NULL, NULL, NULL),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment