public static function wf_crm_admin_component::checkBillingPagination in Webform CiviCRM Integration 7.4
Same name and namespace in other branches
- 7.5 includes/wf_crm_admin_component.inc \wf_crm_admin_component::checkBillingPagination()
Ensure billing fields are not on same page as event/member amounts
Parameters
stdClass $node:
1 call to wf_crm_admin_component::checkBillingPagination()
- webform_civicrm_form_alter in ./
webform_civicrm.module - Implements hook_form_alter().
File
- includes/
wf_crm_admin_component.inc, line 596
Class
Code
public static function checkBillingPagination($node) {
civicrm_initialize();
$enabled = wf_crm_enabled_fields($node);
$field_ids = array(
'membership_membership_type_id',
'membership_num_terms',
'membership_fee_amount',
'participant_fee_amount',
'participant_event_id',
);
foreach ($node->webform['components'] as $cid => $component) {
if (in_array($cid, $enabled)) {
list(, , , , $key) = explode('_', $component['form_key'], 5);
if (in_array($key, $field_ids)) {
$payment_fields[$cid] = $component;
}
elseif ($key == 'contribution_contribution_page_id') {
$contribution_page_page = $component['page_num'];
}
}
}
// Warning if payment fields are on same page as billing fields
$message = '';
if (isset($contribution_page_page) && !empty($payment_fields)) {
foreach ($payment_fields as $component) {
if ($component['page_num'] >= $contribution_page_page) {
$message .= '<li>' . $component['name'] . '</li>';
}
}
}
if ($message) {
$message = t('In order for line-items to be displayed correctly to the user, it is recommended to add a page break in-between Contribution Billing Fields and the following:') . '<ul>' . $message . '</ul>';
drupal_set_message($message, 'warning', FALSE);
}
}