-
-
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#2153 #REF Remove outdated updateCustomValues function #18959
Conversation
(Standard links)
|
CRM/Custom/Form/Option.php
Outdated
@@ -397,7 +397,7 @@ public function postProcess() { | |||
$oldWeight = NULL; | |||
if ($this->_id) { | |||
$customOption->id = $this->_id; | |||
CRM_Core_BAO_CustomOption::updateCustomValues($params); | |||
CRM_Core_BAO_CustomOption::updateValue($customOption->id, $customOption->value); |
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.
Note this is just shifting the updateValue call from L487 to here to match how the code was originally
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'm thinking that was buggy before and having it down below is maybe better. For example suppose line 472 changes $customOption->value
. Then if the update is here you've already updated existing ones to something that is different from what gets saved in civicrm_option_value.
Having it at the bottom as it is right now calls the function even on new fields, but could wrap in if ($customOption->id)
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.
ok have moved it back now @demeritcowboy
Did you guys discuss the cleanMoney part - updateValue doesn't clean the money - not sure if that really matters anywhere. |
@demeritcowboy we felt that cleanMoney is only really needed on the form layer |
8990f80
to
6fe5c7f
Compare
|
For the monies, I see it's because the custom db column is created as decimal(20,2), so if you have an option value of 10, with no decimals, the option value stores it as 10, but the custom table stores it as 10.00, so it doesn't match when it goes to update. So that's a separate issue - I'll make a ticket. |
CRM/Core/BAO/CustomOption.php
Outdated
@@ -198,7 +198,7 @@ public static function del($optionId) { | |||
'value' => $value, | |||
]; | |||
// delete this value from the tables | |||
self::updateCustomValues($params); | |||
self::updateValue($dao->id, $value); |
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 think this should be self::updateValue($optionId, $value);
@demeritcowboy is this currently mergeable? |
I don't think so. It doesn't pass the correct id for deletions, and calling it for new option values is dangerous unless updateValue is changed to ignore null ids. But can ignore the money stuff for now. |
OK - in your court then @seamuslee001 |
Move function call back to where it was under cividesk Fix delete and ensure updateValue is only called on update
6fe5c7f
to
53c38f5
Compare
@demeritcowboy should be sorted now can you check |
Looks good to me. |
@seamuslee001 looks good, thanks! |
Overview
As per #18912 (comment) This removes the outdated updateCustomValues function and replaces its current usage with updateValue
Before
Outdated function called from a couple of places
After
Outdated function removed
ping @yashodha @demeritcowboy @eileenmcnaughton @colemanw