Yaron Koren has uploaded a new change for review.

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

Change subject: Fixed apparent redundancy in handling 'mapping template', added 
trim() calls
......................................................................

Fixed apparent redundancy in handling 'mapping template', added trim() calls

Change-Id: I04b46be355c692c5e3115ebfb0fea059e2adfe3f
---
M includes/SF_FormPrinter.php
1 file changed, 13 insertions(+), 11 deletions(-)


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

diff --git a/includes/SF_FormPrinter.php b/includes/SF_FormPrinter.php
index 8e5bfb4..2c14f5a 100644
--- a/includes/SF_FormPrinter.php
+++ b/includes/SF_FormPrinter.php
@@ -1039,22 +1039,24 @@
                                                        }
                                                        if ( is_array( 
$field_query_val ) ) {
                                                                $cur_values = 
array();
-                                                               foreach ( 
$field_query_val as $key => $value ) {
-                                                                       if ( 
!is_null( $mapping_template ) && !is_null( $possible_values ) ) {
-                                                                               
$cur_values = array();
-                                                                               
foreach ( $field_query_val as $key => $val ) {
-                                                                               
        if ( $key === 'is_list' ) {
-                                                                               
                $cur_values[$key] = $val;
-                                                                               
        } else {
-                                                                               
                $cur_values[] = SFUtils::labelToValue( $val, $possible_values, 
$mapping_template );
-                                                                               
        }
+                                                               if ( !is_null( 
$mapping_template ) && !is_null( $possible_values ) ) {
+                                                                       
$cur_values = array();
+                                                                       foreach 
( $field_query_val as $key => $val ) {
+                                                                               
$val = trim( $val );
+                                                                               
if ( $key === 'is_list' ) {
+                                                                               
        $cur_values[$key] = $val;
+                                                                               
} else {
+                                                                               
        $cur_values[] = SFUtils::labelToValue( $val, $possible_values, 
$mapping_template );
                                                                                
}
-                                                                       } else {
-                                                                               
$cur_values[$key] = $value;
+                                                                       }
+                                                               } else {
+                                                                       foreach 
( $field_query_val as $key => $val ) {
+                                                                               
$cur_values[$key] = $val;
                                                                        }
                                                                }
                                                                $cur_value = 
$this->getStringFromPassedInArray( $cur_values, $delimiter );
                                                        } else {
+                                                               
$field_query_val = trim( $field_query_val );
                                                                if ( !is_null( 
$mapping_template ) && !is_null( $possible_values ) ) {
                                                                        
$cur_value = SFUtils::labelToValue( $field_query_val, $possible_values, 
$mapping_template );
                                                                } else {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I04b46be355c692c5e3115ebfb0fea059e2adfe3f
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