I’ve found an issue with using Textarea Custom Field and Authorize.net, specifically if there are any Carriage Returns or Line Feeds. Everything works fine up until the Payment Information page;
/index.php?option=com_dtregister&task=payment&type=authorizenet&eventId=6
I’ve narrowed it down to the sendPayment function. Seems while you are building the confirmText variable when you get to the Textarea Custom Field that has a carriage return the confirmText line spans 2 different lines instead of 1 line. In the example the Special Requests field has a carriage return after “This is a test”
/// confirmText = confirmText+"Special Requests: this is a test
Another Test\n";
This causes an error in Java as the single line is now split between 2 lines which will not confirm the payment information, therefore causing the payment process not to continue.
Well I figured out a solution, not sure if it’s the correct way of doing it but it works for now. I would like to know from the experts if this is OK, or will it impact anything. I found the sendPayment function in dtregister.php and found the following.
foreach ($_SESSION['register']['billingInfo'] as $key=>$value){
if (array_search($key,$arrCustomFields)!= FALSE){$key = array_search($key,$arrCustomFields);}
?>
/// confirmText = confirmText+"<?php echo $key . ": \t" . $value; ?>\n";
<?php } ?>
I added this line.
$value = trim( preg_replace( '/\s+/', ' ', $value ) );
After this line
if (array_search($key,$arrCustomFields)!= FALSE){$key = array_search($key,$arrCustomFields);}
So it looks like this now.
foreach ($_SESSION['register']['billingInfo'] as $key=>$value){
if (array_search($key,$arrCustomFields)!= FALSE){$key = array_search($key,$arrCustomFields);}
$value = trim( preg_replace( '/\s+/', ' ', $value ) );
?>
/// confirmText = confirmText+"<?php echo $key . ": \t" . $value; ?>\n";
<?php } ?>
All this is doing, well as far as I believe as I’m not good with PHP, is removing any extra Line Feeds, Carriage Returns, and White Spaces.