projects
/
civicrm-core.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0311312
)
returns weight 0 when weight column name is empty
author
Alain Benbassat
<alain@businessandcode.eu>
Thu, 23 Jun 2022 21:00:47 +0000
(23:00 +0200)
committer
Coleman Watts
<coleman@civicrm.org>
Thu, 23 Jun 2022 22:11:35 +0000
(18:11 -0400)
CRM/Utils/Weight.php
patch
|
blob
|
blame
|
history
diff --git
a/CRM/Utils/Weight.php
b/CRM/Utils/Weight.php
index 843115bff3c698d2389839200408333e1bd9dd2a..fe8b716d3e842662c667d406d5e50bf0403722b3 100644
(file)
--- 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();