@@ -556,23 +556,22 @@ public function assignToTemplate() {
556
556
557
557
$ this ->assign ('address ' , CRM_Utils_Address::getFormattedBillingAddressFieldsFromParameters ($ params ));
558
558
559
- if ($ this ->getSubmittedValue ('credit_card_number ' )) {
560
- if (isset ($ params ['credit_card_exp_date ' ])) {
561
- $ date = CRM_Utils_Date::format ($ params ['credit_card_exp_date ' ]);
562
- $ date = CRM_Utils_Date::mysqlToIso ($ date );
563
- }
564
- $ this ->assign ('credit_card_exp_date ' , $ date ?? NULL );
565
- $ this ->assign ('credit_card_number ' ,
566
- CRM_Utils_System::mungeCreditCard ($ params ['credit_card_number ' ] ?? NULL )
567
- );
568
- }
559
+ $ this ->assign ('credit_card_type ' , $ this ->getSubmittedValue ('credit_card_type ' ));
560
+ if ($ this ->getSubmittedValue ('credit_card_exp_date ' )) {
561
+ $ date = CRM_Utils_Date::format ($ this ->getSubmittedValue ('credit_card_exp_date ' ));
562
+ $ date = CRM_Utils_Date::mysqlToIso ($ date );
563
+ }
564
+ $ this ->assign ('credit_card_exp_date ' , $ date ?? NULL );
565
+ $ this ->assign ('credit_card_number ' ,
566
+ CRM_Utils_System::mungeCreditCard ($ this ->getSubmittedValue ('credit_card_number ' ) ?? '' )
567
+ );
569
568
570
569
$ this ->assign ('is_email_confirm ' , $ this ->_values ['event ' ]['is_email_confirm ' ] ?? NULL );
571
570
// assign pay later stuff
572
- $ params [ ' is_pay_later ' ] ??= FALSE ;
573
- $ this ->assign ('is_pay_later ' , $ params [ ' is_pay_later ' ] );
574
- $ this ->assign ('pay_later_text ' , $ params [ ' is_pay_later ' ] ? $ this ->getPayLaterLabel () : FALSE );
575
- $ this ->assign ('pay_later_receipt ' , $ params [ ' is_pay_later ' ] ? $ this ->_values ['event ' ]['pay_later_receipt ' ] : NULL );
571
+ $ isPayLater = empty ( $ this -> getSubmittedValue ( ' payment_processor_id ' )) ;
572
+ $ this ->assign ('is_pay_later ' , $ isPayLater );
573
+ $ this ->assign ('pay_later_text ' , $ isPayLater ? $ this ->getPayLaterLabel () : FALSE );
574
+ $ this ->assign ('pay_later_receipt ' , $ isPayLater ? $ this ->_values ['event ' ]['pay_later_receipt ' ] : NULL );
576
575
577
576
// also assign all participantIDs to the template
578
577
// useful in generating confirmation numbers if needed
@@ -1607,15 +1606,17 @@ protected function validatePriceSet(array $params, $priceSetId, $priceSetDetails
1607
1606
* @return mixed|null
1608
1607
*/
1609
1608
public function getSubmittedValue (string $ fieldName ) {
1610
- $ value = parent ::getSubmittedValue ($ fieldName );
1611
- // Check for value as well in case the field has been added to the Confirm form
1612
- // I don't quite know how that works but something Matt has worked on.
1613
- if ($ value || !in_array ($ this ->getName (), ['Confirm ' , 'ThankYou ' ], TRUE )) {
1614
- return $ value ;
1615
- }
1616
- // If we are on the Confirm or ThankYou page then the submitted values
1617
- // were on the Register Page so we return them
1618
- $ value = $ this ->controller ->exportValue ('Register ' , $ fieldName );
1609
+ if ($ this ->isShowPaymentOnConfirm () && in_array ($ this ->getName (), ['Confirm ' , 'ThankYou ' ], TRUE )) {
1610
+ $ value = $ this ->controller ->exportValue ('Confirm ' , $ fieldName );
1611
+ }
1612
+ else {
1613
+ // If we are on the Confirm or ThankYou page then the submitted values
1614
+ // were on the Register Page so we return them
1615
+ $ value = $ this ->controller ->exportValue ('Register ' , $ fieldName );
1616
+ }
1617
+ if (!isset ($ value )) {
1618
+ $ value = parent ::getSubmittedValue ($ fieldName );
1619
+ }
1619
1620
if (in_array ($ fieldName , $ this ->submittableMoneyFields , TRUE )) {
1620
1621
return CRM_Utils_Rule::cleanMoney ($ value );
1621
1622
}
0 commit comments