You are here

function uc_payment_delete_confirm_form in Ubercart 6.2

Same name and namespace in other branches
  1. 5 payment/uc_payment/uc_payment.module \uc_payment_delete_confirm_form()
  2. 7.3 payment/uc_payment/uc_payment.admin.inc \uc_payment_delete_confirm_form()

Confirmation form to delete a payment from an order.

See also

uc_payment_delete_confirm_form_submit()

1 string reference to 'uc_payment_delete_confirm_form'
uc_payment_menu in payment/uc_payment/uc_payment.module
Implements hook_menu().

File

payment/uc_payment/uc_payment.admin.inc, line 509
Payment administration menu items.

Code

function uc_payment_delete_confirm_form($form_state, $order, $payment) {

  // Make sure the payment is for the specified order.
  if ($payment->order_id != $order->order_id) {
    drupal_set_message(t('An error loading the payment information occurred.'));
    drupal_goto('admin/store/orders/' . $order->order_id . '/payments');
  }
  $context = array(
    'revision' => 'formatted',
    'type' => 'payment',
    'subject' => array(
      'payment' => $payment,
    ),
  );
  $desc = '<strong>' . t('Payment information:') . '</strong> ' . t('@method payment of @amount received on @date.', array(
    '@method' => $payment->method,
    '@amount' => uc_price($payment->amount, $context),
    '@date' => format_date($payment->received, 'short'),
  ));
  $form['order_id'] = array(
    '#type' => 'value',
    '#value' => $order->order_id,
  );
  $form['receipt_id'] = array(
    '#type' => 'value',
    '#value' => $payment->receipt_id,
  );
  return confirm_form($form, t('Are you sure you want to delete this payment?'), 'admin/store/orders/' . $order->order_id . '/payments', $desc, t('Delete'));
}