You are here

function uc_quote_order in Ubercart 6.2

Same name and namespace in other branches
  1. 5 shipping/uc_quote/uc_quote.module \uc_quote_order()

Implements hook_order().

File

shipping/uc_quote/uc_quote.module, line 532
The controller module for fulfillment modules that process physical goods.

Code

function uc_quote_order($op, $order, $arg2) {
  switch ($op) {
    case 'submit':
      unset($_SESSION['quote']);
      break;
    case 'save':
      if (isset($order->quote['method'])) {
        if (!isset($order->quote['rate'])) {
          $order->quote['rate'] = 0;
        }
        if (!isset($order->quote['quote_form'])) {
          $order->quote['quote_form'] = NULL;
        }
        db_query("DELETE FROM {uc_order_quotes} WHERE order_id = %d", $order->order_id);
        db_query("INSERT INTO {uc_order_quotes} (order_id, method, accessorials, rate, quote_form) VALUES (%d, '%s', '%s', %f, '%s')", $order->order_id, $order->quote['method'], $order->quote['accessorials'], $order->quote['rate'], $order->quote['quote_form']);
      }
      break;
    case 'load':
      $quote = db_fetch_array(db_query("SELECT method, accessorials, rate, quote_form FROM {uc_order_quotes} WHERE order_id = %d", $order->order_id));
      $order->quote = $quote;
      $order->quote['accessorials'] = strval($quote['accessorials']);
      break;
    case 'delete':
      db_query("DELETE FROM {uc_order_quotes} WHERE order_id = %d", $order->order_id);
      break;
  }
}