Skip to content
Snippets Groups Projects
Commit d72a58fe authored by thidd's avatar thidd Committed by Vasyl Zaitsev
Browse files

Issue #3282930 by thidd: Fix query select from field handler to get the transaction details

parent 1c425511
No related branches found
No related tags found
No related merge requests found
......@@ -27,12 +27,15 @@ class TransactionDetails extends FieldPluginBase {
$keys = explode('__', $this->options['payment_authnet_display']);
$k = array_pop($keys);
$f = $this->tableAlias . '.' . $this->realField;
// Symbol ';' is is prohibited in Drupal Query. Replace it by hex value.
// Symbols ';' and '[]' are prohibited in Drupal Query. Replace it by hex
// value.
$uh = 'unhex(\'3B\')';
$lb = 'unhex(\'5B\')';
$rb = 'unhex(\'5D\')';
$ct = 'concat';
$is_string = "$f $r '\"$k\".s:[0-9]+'";
$is_string = "$f $r $ct('\"$k\".s:', $lb, '0-9', $rb, '+')";
$string_val = "$si($si($si($f, $ct('\"$k\"', $uh, 's:'), -1), $ct('\"', $uh), 1), ':\"', -1)";
$number_val = "$s($si($s($si($f, $ct('\"$k\"', $uh), -1), 3), $uh, 1), $f $r '\"$k\".(d|i):\-?[0-9]+')";
$number_val = "$s($si($s($si($f, $ct('\"$k\"', $uh), -1), 3), $uh, 1), $f $r $ct('\"$k\".(d|i):\-?', $lb, '0-9', $rb, '+'))";
$formula = "convert(if($is_string, $string_val, $number_val) using utf8)";
$alias = $this->tableAlias . '_authnet_' . $k;
$params = $this->options['group_type'] != 'group' ? ['function' => $this->options['group_type']] : [];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment