-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dev/core#4418 Add in Upgrade script to fix double json encoding #26760
dev/core#4418 Add in Upgrade script to fix double json encoding #26760
Conversation
Thank you for contributing to CiviCRM! ❤️ Here's what's next:
|
26232ea
to
36ca618
Compare
@@ -33,6 +35,7 @@ public function upgrade_5_64_alpha1($rev): void { | |||
$this->addTask('Drop unused civicrm_action_mapping table', 'dropTable', 'civicrm_action_mapping'); | |||
$this->addTask('Update post_URL/cancel_URL in logging tables', 'updateLogging'); | |||
$this->addTask('Add in Everybody ACL Role option value', 'addEveryBodyAclOptionValue'); | |||
$this->addTask(ts('Fix double json encoding of accepted_credit_cards field in payment processor table'), 'fixDoubleEscapingPaymentProcessorCreditCards'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ts
is unusual here, since it's just a one-off message for admins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is some ts usage here https://github.com/civicrm/civicrm-core/blob/master/CRM/Upgrade/Incremental/php/FiveSixtyThree.php#L40 so shrugs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are common strings repeated across upgrades, so are better candidates for ts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I'd argue they are still just for admins so shouldn't have ts either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed the ts now
36ca618
to
2b23af7
Compare
I'm getting If a pp doesn't have any selected the value is null. |
Also calling json_decode on |
…d in the upgrade script and fix upgrade scripts as per dave's comments
thanks @demeritcowboy I found some issues with my unit test which weren't pointing out those issues, I believe I have now fixed both issues you have reported and made sure the unit test covers all scenarios |
Hehe made you work for this one. Take the rest of the day off ... as per dave's comments... Works for me. |
Unfortunately, it's messier than this and this doesn't actually work to fix the values that are stored in the db for me. |
@larssandergreen they should be identical addValue v saveRecords should produce identical situations |
I also had But maybe we shouldn't be using api in the upgrade script, as has come up elsewhere. |
@demeritcowboy I think the API is safer now than earlier with regards to upgrades |
Is |
Oh it's in the ext\civi_contribute extension, which I guess isn't enabled in the upgrade test suite. |
So that might fail in real life if somebody didn't have that component enabled. |
@demeritcowboy oh probably because extension install tasks go last right so enabling the component extensions stuffs things up hmm |
ok @demeritcowboy have shifted to use executeQuery instead of the API in the upgrade should be right now right? |
OK, I just figured out how to make this work with the API version, but now I see there is a different SQL version. I'll give that a try. |
To make this work for me, I needed: |
@larssandergreen I think you were testing the initial version. There was a second version that had those. But @seamuslee001 did you want to keep the |
@demeritcowboy Oh, that's frustrating, must have missed that. Working for me now anyways. |
@demeritcowboy no i don't need that those were weeding out implicit filters that the API adds in (i.e. by default if you don't put a where in and an entity has domain_id column it will filter to the current domain and same with the is_test filtering by default to be true) |
Ah ok got it. So yes this works for me too. |
Overview
This adds in an upgrade script to fix potential double json encoding of the accepted credit cards
Before
Bad data possibly in the database
After
All good data
ping @larssandergreen @eileenmcnaughton @colemanw