Tweaks to refunds, study groups, travel emails

This commit is contained in:
2014-05-06 14:51:06 +10:00
parent eb3fa7e7bf
commit 5e8e1bd22d
7 changed files with 204 additions and 61 deletions

View File

@@ -160,8 +160,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#title' => t('Welfare Required?'),
'#description' => t('Select to mark this attendee as requiring special financial consideration'),
'#default_value' => (!empty($data->booking_welfare_required) && $data->booking_welfare_required == 'Y') ? 1 : 0
);
);
} //end inserting check for booking status
//tshirts
@@ -314,7 +313,21 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#required' => FALSE,
'#default_value' => !empty($data->booking_total_pay_reqd) ? $data->booking_total_pay_reqd : '0.00'
);
//refund info
$form['your-details']['booking_refund_processed'] = array(
'#type' => 'checkbox',
'#title' => t('Refund Processed?'),
'#description' => t('Select to mark the processing of any applicable refund as complete'),
'#default_value' => (!empty($data->booking_refund_processed) && $data->booking_refund_processed == 'Y') ? 1 : 0
);
$form['your-details']['booking_refund_due'] = array(
'#type' => 'textfield',
'#title' => t('Refund Amount Due'),
'#maxlength' => 10,
'#required' => FALSE,
'#default_value' => !empty($data->booking_refund_due) ? $data->booking_refund_due : '0.00'
);
$form['your-details']['booking_barcode'] = array(
'#type' => 'textfield',
'#title' => t('Barcode'),
@@ -943,6 +956,8 @@ function booking_form_submit($form, &$form_state) {
//fields that may or may not have been present in the initial form
$node->booking_welfare_required = empty($values['booking_welfare_required']) ? 'N' : ($values['booking_welfare_required'] == 1 ? 'Y' : 'N');
$node->booking_refund_processed = empty($values['booking_refund_processed']) ? 'N' : ($values['booking_refund_processed'] == 1 ? 'Y' : 'N');
$node->booking_refund_due = empty($values['booking_refund_due']) ? '' : $values['booking_refund_due'];
$node->booking_help_music = empty($values['booking_help_music']) ? '' : $values['booking_help_music'];
$node->booking_help_meditations = empty($values['booking_help_meditations']) ? '' : $values['booking_help_meditations'];
$node->booking_help_praying = empty($values['booking_help_praying']) ? '' : $values['booking_help_praying'];
@@ -1201,6 +1216,8 @@ function _booking_insert($node) {
'booking_skills_other_details' => $node->booking_skills_other_details,
'booking_status' => $node->booking_status,
'booking_welfare_required' => $node->booking_welfare_required,
'booking_refund_due' => $node->booking_refund_due,
'booking_refund_processed' => $node->booking_refund_processed,
))
->execute();
}
@@ -1259,7 +1276,8 @@ function _booking_update($node) {
'booking_tempid' => $node->booking_tempid,
'booking_payment_id' => $node->booking_payment_id,
'booking_total_pay_reqd' => $node->booking_total_pay_reqd,
'booking_amount_paid' => $node->booking_amount_paid,
'booking_amount_paid' => $node->booking_amount_paid,
'booking_refund_due' => $node->booking_refund_due,
'booking_guardian_name' => $node->booking_guardian_name,
'booking_guardian_type' => $node->booking_guardian_type,
'booking_guardian_phone' => $node->booking_guardian_phone,
@@ -1280,14 +1298,15 @@ function _booking_update($node) {
'booking_skills_language_details' => $node->booking_skills_language_details,
'booking_skills_other' => ($node->booking_skills_other == 1 ? 'Y' : 'N'),
'booking_skills_other_details' => $node->booking_skills_other_details,
'booking_welfare_required' => ($node->booking_welfare_required == 1 ? 'Y' : 'N'),
'booking_welfare_required' => ($node->booking_welfare_required == 1 ? 'Y' : 'N'),
'booking_refund_processed' => ($node->booking_refund_processed == 1 ? 'Y' : 'N'),
'booking_status' => $node->booking_status,
))
->condition('nid', $node->nid)
->execute();
//now process some post-update triggers
//***now process some post-update triggers***
//if booking_partner_id is set, make sure the nid it refers to has this node as its booking_partner_id
if ($node->booking_partner_id != 0)
@@ -1321,6 +1340,9 @@ function _booking_update($node) {
$refund = _booking_process_refund($node);
drupal_set_message(t('Refund calculated for !first !last is $!refund.',
array('!first' => $node->booking_firstname, '!last' => $node->booking_lastname, '!refund' => $refund)));
//Remove from any study groups
_booking_studygroups_cleanup($node->nid);
//check if there is room on the booked-in list
if (_booking_check_bookings_full() == False)
@@ -1352,6 +1374,9 @@ function _booking_update($node) {
$refund = _booking_process_refund($node);
drupal_set_message(t('Refund calculated for !first !last is $!refund.',
array('!first' => $node->booking_firstname, '!last' => $node->booking_lastname, '!refund' => $refund)));
//Remove from any study groups
_booking_studygroups_cleanup($node->nid);
}
//if we're not automatically sending emails on registration
//and someone moved from not-paid to booked-in (ie, manual payment process)
@@ -1512,6 +1537,9 @@ function booking_view($node, $view_mode) {
$rows[] = array(t('Payment Type Selected:'), t('!amount_paid', array('!amount_paid' => $payment_type)));
$rows[] = array(t('Amount Paid:'), t('!amount_paid', array('!amount_paid' => $node->booking_amount_paid)));
$rows[] = array(t('Total Amount Due:'), t('!amount_paid', array('!amount_paid' => $node->booking_total_pay_reqd)));
$rows[] = array(t('Refund Due:'), t('!amount_due', array('!amount_due' => $node->booking_refund_due)));
$rows[] = array(t('Refund Processed:'), t('!ans', array('!ans' => ($node->booking_refund_processed == 'Y' ? 'Yes' : 'No'))));
$rows[] = array(t('Reading Group:'), t('!group', array('!group' => $node->booking_readinggroup)));
if (variable_get('booking_enable_tshirts', 0) == 1)