function uc_paypal_ec_review_form_submit in Ubercart 6.2
Same name and namespace in other branches
- 5 payment/uc_paypal/uc_paypal.module \uc_paypal_ec_review_form_submit()
- 7.3 payment/uc_paypal/uc_paypal.pages.inc \uc_paypal_ec_review_form_submit()
File
- payment/
uc_paypal/ uc_paypal.pages.inc, line 346 - Paypal administration menu items.
Code
function uc_paypal_ec_review_form_submit($form, &$form_state) {
$order = uc_order_load($_SESSION['cart_order']);
if ($form_state['values']['shippable'] == 'true') {
$method_accessorials = split("---", isset($_POST['quote-option']) ? strval($_POST['quote-option']) : 0);
$order->quote['method'] = $method_accessorials[0];
$order->quote['accessorials'] = $method_accessorials[1];
$order->quote['rate'] = $_POST['rate'][isset($_POST['quote-option']) ? strval($_POST['quote-option']) : 0];
$order->quote['quote_form'] = rawurldecode($_POST['quote-form']);
$methods = module_invoke_all('shipping_method');
$method = $methods[$order->quote['method']];
$label = is_null($_POST['quote-option']) ? t('Error calculating shipping') : $method['quote']['accessorials'][$order->quote['accessorials']];
$result = db_query("SELECT line_item_id FROM {uc_order_line_items} WHERE order_id = %d AND type = 'shipping'", $order->order_id);
if ($lid = db_result($result)) {
uc_order_update_line_item($lid, $label, $order->quote['rate']);
}
else {
uc_order_line_item_add($order->order_id, 'shipping', $label, $order->quote['rate']);
}
}
if (variable_get('uc_paypal_ec_review_company', TRUE)) {
$order->delivery_company = $form_state['values']['delivery_company'];
}
if (variable_get('uc_paypal_ec_review_phone', TRUE)) {
$order->delivery_phone = $form_state['values']['delivery_phone'];
}
if (variable_get('uc_paypal_ec_review_comment', TRUE)) {
db_query("DELETE FROM {uc_order_comments} WHERE order_id = %d", $order->order_id);
uc_order_comment_save($order->order_id, 0, $form_state['values']['order_comments'], 'order');
}
uc_order_save($order);
$form_state['redirect'] = 'cart/echeckout/submit';
}