Skip to content
Snippets Groups Projects
Unverified Commit a80402bc authored by Eileen McNaughton's avatar Eileen McNaughton Committed by GitHub
Browse files

Merge pull request #23874 from AlainBenbassat/empty-weight-column-during-upgrade

returns weight 0 when weight column name is empty
parents f9360c2e 22082f91
Branches
Tags
No related merge requests found
......@@ -233,6 +233,11 @@ class CRM_Utils_Weight {
* @return int
*/
public static function getMax($daoName, $fieldValues = NULL, $weightField = 'weight') {
if (empty($weightField)) {
Civi::log()->warning('Missing weight field name for ' . $daoName);
return 0;
}
$selectField = "MAX(ROUND($weightField)) AS max_weight";
$weightDAO = CRM_Utils_Weight::query('SELECT', $daoName, $fieldValues, $selectField);
$weightDAO->fetch();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment