diff --git a/booking.manual_payment.inc b/booking.manual_payment.inc index 4215b7c..2238282 100644 --- a/booking.manual_payment.inc +++ b/booking.manual_payment.inc @@ -34,7 +34,7 @@ function booking_manual_payment_admin($nid) } //any html to put at the start of the form - $prefix = t("

Manually enter payment details.

"); + $prefix = t("

Create manual payment records

Enter the amount below, select the people making the payment, then click the Update button at the bottom of the page

"); $form['booking_earlybird'] = array ( '#type' => 'hidden', @@ -43,7 +43,8 @@ function booking_manual_payment_admin($nid) $form['payment-type'] = array( '#type' => 'select', '#title' => t('Payment Type'), - '#required' => TRUE, + '#description' => t('Either select one of the built-in payment amounts, or enter a custom dollar amount in the next field.'), + '#required' => FALSE, '#default_value' => '0', '#options' => $payment_type_options, ); @@ -64,7 +65,7 @@ function booking_manual_payment_admin($nid) 'A total payment will replace the person\'s total payment with the value entered above.'), '#options' => $payment_balance_options, '#default_value' => 1, - '#required' => TRUE + '#required' => FALSE, ); $header = array ( @@ -122,7 +123,7 @@ function booking_manual_payment_admin_submit($form, &$form_state) { $fully_paid = 'N'; $payment_date = REQUEST_TIME; $checkboxes = $form_state['values']['table']; //$values['booking_price_active']; - watchdog('booking', 'Formstate when setting buttons: @info', array ('@info' => var_export($form_state['values'], TRUE))); + //watchdog('booking', 'Formstate when setting buttons: @info', array ('@info' => var_export($form_state['values'], TRUE))); //watchdog('booking', 'Checkboxes when setting buttons: @info', array ('@info' => var_export($checkboxes, TRUE))); //watchdog('booking', 'Manual payment form contents: @info', array('@info' => var_export($form_state['values'], TRUE))); @@ -176,8 +177,10 @@ function booking_manual_payment_admin_submit($form, &$form_state) { $total_paid = $price; //change $price so that we add the correct dollar amount in the payment record //the actual amount newly paid is the price entered in the form, subtracting what they had previously paid - watchdog('booking', 'Changing price for payment record from $!price to !newprice.', array('!price' => $price, '!newprice' => ($price - $person->booking_amount_paid))); - $price = $price - $person->booking_amount_paid; + //use the function so it takes care of paypal transaction fees etc + $newprice = $price - _booking_amount_paid($key, $person); + watchdog('booking', 'Changing price for payment record from $!price to !newprice.', array('!price' => $price, '!newprice' => $newprice)); + $price = $newprice; } //check if they have now fully paid