You are here

function uc_order_search_form_submit in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_order/uc_order.module \uc_order_search_form_submit()

See also

uc_order_search_form()

File

uc_order/uc_order.module, line 1015

Code

function uc_order_search_form_submit($form, &$form_state) {
  $args = array();
  $keys = array(
    'billing_first_name',
    'billing_last_name',
    'billing_company',
    'shipping_first_name',
    'shipping_last_name',
    'shipping_company',
  );
  foreach ($keys as $key) {
    if (strlen(trim($form_state['values'][$key])) == 0) {
      $args[] = '0';
    }
    else {
      $args[] = strtolower(trim($form_state['values'][$key]));
    }
  }
  if ($form_state['values']['use_dates']) {
    $args[] = mktime(0, 0, 0, $form_state['values']['start_date']['month'], $form_state['values']['start_date']['day'], $form_state['values']['start_date']['year']);
    $args[] = mktime(23, 59, 59, $form_state['values']['end_date']['month'], $form_state['values']['end_date']['day'], $form_state['values']['end_date']['year']);
  }
  else {
    $args[] = '0';
    $args[] = '0';
  }
  drupal_goto('admin/store/orders/search/results/' . implode('/', $args));
}