function uc_recurring_order_order in UC Recurring Payments and Subscriptions 6.2
Implementation of hook_order().
File
- modules/
uc_recurring_order/ uc_recurring_order.module, line 238 - Provides a way to duplicate entire orders.
Code
function uc_recurring_order_order($op, $arg1, $arg2) {
switch ($op) {
// TODO: Allow admin to create a recurring order from "create order" page.
case 'submit':
$recurring = $arg1->data['recurring_option'];
$next_renewal = strtotime('+' . $recurring);
if ($next_renewal > time() && variable_get('uc_recurring_checkout_process', TRUE)) {
if (uc_recurring_order_process_order($arg1, $recurring) === FALSE) {
return array(
array(
'pass' => FALSE,
'message' => t('Your order cannot be completed, because we could not process your recurring payment. Please review your payment details and contact us to complete your order if the problem persists.'),
),
);
}
}
break;
case 'save':
if (isset($arg1->data['recurring_option'])) {
// Only update when this is a recurring order
db_query("UPDATE {uc_recurring_users} SET fee_amount = %f WHERE order_id = %d", uc_order_get_total($arg1), $arg1->order_id);
if (db_affected_rows() !== 0) {
uc_order_comment_save($arg1->order_id, 0, t('The recurring order amount was updated.'), 'admin');
}
}
break;
}
}