You are here

function uc_payment_method_other in Ubercart 6.2

Same name and namespace in other branches
  1. 5 payment/uc_payment_pack/uc_payment_pack.module \uc_payment_method_other()
  2. 7.3 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_payment_method in payment/uc_payment_pack/uc_payment_pack.module
Implements hook_payment_method().

File

payment/uc_payment_pack/uc_payment_pack.module, line 89
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_result(db_query("SELECT description FROM {uc_payment_other} WHERE order_id = %d", $order->order_id))) {
        return t('Description: @desc', array(
          '@desc' => $description,
        ));
      }
      break;
    case 'order-details':
      $details = drupal_get_form('uc_payment_method_other_form', $order);
      return uc_strip_form($details);
    case 'edit-process':
      $changes['payment_details']['pm_other_description'] = check_plain($_POST['pm_other_description']);
      return $changes;
    case 'order-load':
      if ($description = db_result(db_query("SELECT description FROM {uc_payment_other} WHERE order_id = %d", $order->order_id))) {
        $order->payment_details['description'] = $description;
      }
      break;
    case 'order-save':
      db_query("DELETE FROM {uc_payment_other} WHERE order_id = %d", $order->order_id);
      if (!empty($order->payment_details['pm_other_description'])) {
        db_query("INSERT INTO {uc_payment_other} (order_id, description) VALUES (%d, '%s')", $order->order_id, $order->payment_details['pm_other_description']);
      }
      break;
  }
}