diff --git a/uc_order/uc_order.admin.inc b/uc_order/uc_order.admin.inc index c82e685..b068310 100644 --- a/uc_order/uc_order.admin.inc +++ b/uc_order/uc_order.admin.inc @@ -583,7 +583,10 @@ function uc_order_create_form_create_submit($form, &$form_state) { $uid = 0; } - $order = uc_order_new($uid, 'post_checkout'); + $order = uc_order_new($uid, 'in_checkout'); + $order->order_status = 'admin_in_checkout'; + uc_order_save($order); + uc_order_comment_save($order->order_id, $user->uid, t('Order created by the administration.'), 'admin'); $form_state['redirect'] = 'admin/store/orders/' . $order->order_id . '/edit'; @@ -595,7 +598,10 @@ function uc_order_create_form_create_submit($form, &$form_state) { function uc_order_create_for_user($account) { global $user; - $order = uc_order_new($account->uid, 'post_checkout'); + $order = uc_order_new($uid, 'in_checkout'); + $order->order_status = 'admin_in_checkout'; + uc_order_save($order); + uc_order_comment_save($order->order_id, $user->uid, t('Order created by the administration.'), 'admin'); drupal_goto('admin/store/orders/' . $order->order_id . '/edit'); diff --git a/uc_order/uc_order.install b/uc_order/uc_order.install index 98a9b47..5aa1507 100644 --- a/uc_order/uc_order.install +++ b/uc_order/uc_order.install @@ -664,6 +664,13 @@ function uc_order_install() { 'locked' => 1, ), array( + 'order_status_id' => 'admin_in_checkout', + 'title' => $t('Admin - in checkout'), + 'state' => 'in_checkout', + 'weight' => -10, + 'locked' => 1, + ), + array( 'order_status_id' => 'pending', 'title' => $t('Pending'), 'state' => 'post_checkout', @@ -920,3 +927,29 @@ function uc_order_update_7302() { ->condition('name', 'uc_order_pane_%', 'LIKE') ->execute(); } + +/** + * Add a new "Admin - in checkout" status for admin created orders. + */ +function uc_order_update_7303() { + $t = get_t(); + + $query = db_insert('uc_order_statuses') + ->fields(array( + 'order_status_id', + 'title', + 'state', + 'weight', + 'locked', + )); + + $values = array( + 'order_status_id' => 'admin_in_checkout', + 'title' => $t('Admin - in checkout'), + 'state' => 'in_checkout', + 'weight' => -10, + 'locked' => 1, + ); + $query->values($values); + $query->execute(); +} diff --git a/uc_order/views/uc_order_handler_filter_order_status.inc b/uc_order/views/uc_order_handler_filter_order_status.inc index f2b82ab..0cb1f0f 100644 --- a/uc_order/views/uc_order_handler_filter_order_status.inc +++ b/uc_order/views/uc_order_handler_filter_order_status.inc @@ -30,7 +30,7 @@ class uc_order_handler_filter_order_status extends views_handler_filter_in_opera */ function query() { if (is_array($this->value) && in_array('_active', $this->value)) { - $this->value = array_merge($this->value, array_values(uc_order_status_list('general', TRUE))); + $this->value = array_merge($this->value, array('admin_in_checkout'), array_values(uc_order_status_list('general', TRUE))); } parent::query();