Yaron Koren has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/252577

Change subject: Fix for de74f1f - changed removal method for null Cargo values
......................................................................

Fix for de74f1f - changed removal method for null Cargo values

Change-Id: I9f33ab9ac14940d2811b81c63b3f5d26caedcfd6
---
M includes/SF_FormPrinter.php
1 file changed, 13 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/77/252577/1

diff --git a/includes/SF_FormPrinter.php b/includes/SF_FormPrinter.php
index 46a5ec7..9459e40 100644
--- a/includes/SF_FormPrinter.php
+++ b/includes/SF_FormPrinter.php
@@ -1096,7 +1096,19 @@
                                        // values if a field and table have
                                        // been specified.
                                        if ( is_null( $possible_values ) && 
defined( 'CARGO_VERSION' ) && $cargo_table != null && $cargo_field != null ) {
-                                               $possible_values = 
SFUtils::getValuesForCargoField( $cargo_table, $cargo_field, $cargo_field . " 
IS NOT NULL" );
+                                               // We only want the non-null
+                                               // values. Ideally this could
+                                               // be done by calling
+                                               // getValuesForCargoField() with
+                                               // an "IS NOT NULL" clause, but
+                                               // unfortunately that fails
+                                               // for array/list fields.
+                                               // Instead of getting involved
+                                               // with all that, we'll just
+                                               // remove the null/blank values
+                                               // afterward.
+                                               $possible_values = 
SFUtils::getAllValuesForCargoField( $cargo_table, $cargo_field );
+                                               $possible_values = 
array_filter( $possible_values, 'strlen' );
                                        }
 
                                        if ( !is_null( $possible_values ) ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/252577
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f33ab9ac14940d2811b81c63b3f5d26caedcfd6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to