X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FWeight.php;h=fe8b716d3e842662c667d406d5e50bf0403722b3;hb=f8307138bf292130a628e68f346535b398ae9b63;hp=843115bff3c698d2389839200408333e1bd9dd2a;hpb=ad2b59cfcbf72bf03e3b5fc90d5eeb5e7f921c36;p=civicrm-core.git diff --git a/CRM/Utils/Weight.php b/CRM/Utils/Weight.php index 843115bff3..fe8b716d3e 100644 --- a/CRM/Utils/Weight.php +++ b/CRM/Utils/Weight.php @@ -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();