function uc_payment_by_order_form in Ubercart 5
Same name and namespace in other branches
- 6.2 payment/uc_payment/uc_payment.admin.inc \uc_payment_by_order_form()
- 7.3 payment/uc_payment/uc_payment.admin.inc \uc_payment_by_order_form()
1 string reference to 'uc_payment_by_order_form'
- uc_payment_menu in payment/
uc_payment/ uc_payment.module - Implementation of hook_menu().
File
- payment/
uc_payment/ uc_payment.module, line 590
Code
function uc_payment_by_order_form($order_id) {
$order = uc_order_load($order_id);
if ($order === FALSE) {
drupal_set_message(t('Order %id does not exist.', array(
'%id' => $order_id,
)));
drupal_goto('admin/store/orders');
}
$total = $order->order_total;
$payments = uc_payment_load_payments($order_id);
$form['order_total'] = array(
'#value' => uc_currency_format($total),
);
$form['payments'] = array(
'#tree' => TRUE,
);
if ($payments !== FALSE) {
foreach ($payments as $payment) {
$form['payments'][$payment->receipt_id]['received'] = array(
'#value' => format_date($payment->received, 'custom', variable_get('uc_date_format_default', 'm/d/Y') . '<b\\r>H:i:s'),
);
$form['payments'][$payment->receipt_id]['user'] = array(
'#value' => uc_get_initials($payment->uid),
);
$form['payments'][$payment->receipt_id]['method'] = array(
'#value' => $payment->method == '' ? t('Unknown') : $payment->method,
);
$form['payments'][$payment->receipt_id]['amount'] = array(
'#value' => uc_currency_format($payment->amount),
);
$total -= $payment->amount;
$form['payments'][$payment->receipt_id]['balance'] = array(
'#value' => uc_currency_format($total),
);
$form['payments'][$payment->receipt_id]['comment'] = array(
'#value' => $payment->comment == '' ? '-' : filter_xss_admin($payment->comment),
);
if (variable_get('uc_payment_deleting', TRUE) && user_access('delete payments')) {
$action_value = l(t('Delete'), 'admin/store/orders/' . $order_id . '/payments/' . $payment->receipt_id . '/delete');
}
else {
$action_value = '-';
}
$form['payments'][$payment->receipt_id]['action'] = array(
'#value' => $action_value,
);
}
}
$form['balance'] = array(
'#value' => uc_currency_format($total),
);
$form['order_id'] = array(
'#type' => 'hidden',
'#value' => $order_id,
);
if (user_access('manual payments')) {
$form['payments']['new']['received'] = array(
'#value' => '-',
);
$form['payments']['new']['user'] = array(
'#value' => '-',
);
$methods = _payment_method_list();
foreach ($methods as $method) {
$options[$method['id']] = $method['name'];
}
$form['payments']['new']['method'] = array(
'#type' => 'select',
'#options' => $options,
);
$form['payments']['new']['amount'] = array(
'#type' => 'textfield',
'#size' => 6,
);
$form['payments']['new']['balance'] = array(
'#value' => '-',
);
$form['payments']['new']['comment'] = array(
'#type' => 'textfield',
'#size' => 32,
'#maxlength' => 256,
);
$form['payments']['new']['action'] = array(
'#type' => 'submit',
'#value' => t('Enter'),
);
}
return $form;
}