function uc_payment_method_other in Ubercart 7.3
Same name and namespace in other branches
- 5 payment/uc_payment_pack/uc_payment_pack.module \uc_payment_method_other()
- 6.2 payment/uc_payment_pack/uc_payment_pack.module \uc_payment_method_other()
Payment method callback for the generic payment method "Other".
1 string reference to 'uc_payment_method_other'
- uc_payment_pack_uc_payment_method in payment/
uc_payment_pack/ uc_payment_pack.module - Implements hook_uc_payment_method().
File
- payment/
uc_payment_pack/ uc_payment_pack.module, line 62 - Provides the Check/Money Order, COD, and "Other" payment methods.
Code
function uc_payment_method_other($op, &$order) {
switch ($op) {
case 'order-view':
case 'customer-view':
// Fetch the description for the payment entered by the administrator.
if ($description = db_query('SELECT description FROM {uc_payment_other} WHERE order_id = :id', array(
':id' => $order->order_id,
))
->fetchField()) {
return array(
'#markup' => t('Description: @desc', array(
'@desc' => $description,
)),
);
}
break;
case 'order-details':
$form['pm_other_description'] = array(
'#type' => 'textfield',
'#title' => t('Description'),
'#default_value' => isset($order->payment_details['description']) ? $order->payment_details['description'] : '',
'#size' => 32,
'#maxlength' => 64,
);
return $form;
case 'order-load':
$description = db_query('SELECT description FROM {uc_payment_other} WHERE order_id = :id', array(
':id' => $order->order_id,
))
->fetchField();
if (isset($description)) {
$order->payment_details['description'] = $description;
}
break;
case 'order-save':
if (empty($order->payment_details['pm_other_description'])) {
db_delete('uc_payment_other')
->condition('order_id', $order->order_id)
->execute();
}
else {
db_merge('uc_payment_other')
->key(array(
'order_id' => $order->order_id,
))
->fields(array(
'description' => $order->payment_details['pm_other_description'],
))
->execute();
}
break;
}
}