function uc_order_new in Ubercart 6.2
Same name and namespace in other branches
- 5 uc_order/uc_order.module \uc_order_new()
- 7.3 uc_order/uc_order.module \uc_order_new()
Generate a new order for user $uid.
6 calls to uc_order_new()
- UbercartCartCheckoutTestCase::createOrder in uc_cart/
uc_cart.test - Creates a new order.
- UbercartCreditCardTestCase::createOrder in payment/
uc_credit/ uc_credit.test - Helper function. Creates a new order.
- UbercartOrderTestCase::ucCreateOrder in uc_order/
uc_order.test - uc_cart_checkout_form_validate in uc_cart/
uc_cart.pages.inc - Form validation for uc_cart_checkout_form().
- uc_order_create_form_submit in uc_order/
uc_order.admin.inc - Form submission handler for uc_order_create_form().
File
- uc_order/
uc_order.module, line 1099
Code
function uc_order_new($uid = 0, $state = 'in_checkout') {
$order = new UcOrder();
if ($uid > 0) {
$user = user_load(array(
'uid' => $uid,
));
$email = $user->mail;
$order->primary_email = $email;
}
$order->uid = $uid;
$order->order_status = uc_order_state_default($state);
$order->created = time();
$order->modified = time();
drupal_write_record('uc_orders', $order);
uc_order_module_invoke('new', $order, NULL);
return $order;
}