function ajax_agile_getcustomers()
{
    ${${"GLOBALS"}["jjszcyoinwyy"]} = explode(" ", Tools::getValue("customer_search"));
    ${"GLOBALS"}["btkmsumgqi"] = "customers";
    $lwjbynsy = "searches";
    $mfzpveyc = "to_return";
    $bmwjhsn = "customers";
    ${"GLOBALS"}["mcqemkddxvk"] = "searches";
    $cccuivsxp = "to_return";
    ${${"GLOBALS"}["kglmxvwgfexa"]} = array();
    ${${"GLOBALS"}["mcqemkddxvk"]} = array_unique(${$lwjbynsy});
    foreach (${${"GLOBALS"}["jjszcyoinwyy"]} as ${${"GLOBALS"}["dotono"]}) {
        $mimdxaoxdl = "results";
        if (!empty(${${"GLOBALS"}["dotono"]}) && (${$mimdxaoxdl} = Customer::searchByName(${${"GLOBALS"}["dotono"]}))) {
            foreach (${${"GLOBALS"}["itmfakpwu"]} as ${${"GLOBALS"}["dbgjiec"]}) {
                ${"GLOBALS"}["cgwtffyvk"] = "result";
                ${${"GLOBALS"}["kglmxvwgfexa"]}[${${"GLOBALS"}["dbgjiec"]}["id_customer"]] = ${${"GLOBALS"}["cgwtffyvk"]};
            }
        }
    }
    if (count(${${"GLOBALS"}["btkmsumgqi"]})) {
        ${$cccuivsxp} = array("customers" => ${$bmwjhsn}, "found" => true);
    } else {
        ${$mfzpveyc} = array("found" => false);
    }
    return Tools::jsonEncode(${${"GLOBALS"}["nduihox"]});
}
 /**
  * Method called when an ajax request is made
  * @see AdminController::postProcess()
  */
 public function ajaxProcess()
 {
     if (Tools::isSubmit('email')) {
         $email = pSQL(Tools::getValue('email'));
         $customer = Customer::searchByName($email);
         if (!empty($customer)) {
             $customer = $customer['0'];
             echo Tools::jsonEncode(array('infos' => pSQL($customer['firstname']) . '_' . pSQL($customer['lastname']) . '_' . pSQL($customer['company'])));
         }
     }
     die;
 }
 /**
  * Search a specific name in the customers
  *
  * @params string $query String to find in the catalog
  */
 public function searchCustomer()
 {
     $this->_list['customers'] = Customer::searchByName($this->query);
 }
 /**
  * add to $this->content the result of Customer::SearchByName
  * (encoded in json)
  *
  * @return void
  */
 public function ajaxProcessSearchCustomers()
 {
     $searches = explode(' ', Tools::getValue('customer_search'));
     $customers = array();
     $searches = array_unique($searches);
     foreach ($searches as $search) {
         if (!empty($search) && ($results = Customer::searchByName($search, 50))) {
             foreach ($results as $result) {
                 if ($result['active']) {
                     $customers[$result['id_customer']] = $result;
                 }
             }
         }
     }
     if (count($customers)) {
         $to_return = array('customers' => $customers, 'found' => true);
     } else {
         $to_return = array('found' => false);
     }
     $this->content = Tools::jsonEncode($to_return);
 }
 public function ajaxProcessSearchCustomers()
 {
     if ($customers = Customer::searchByName(pSQL(Tools::getValue('customer_search')))) {
         $to_return = array('customers' => $customers, 'found' => true);
     } else {
         $to_return = array('found' => false);
     }
     $this->content = Tools::jsonEncode($to_return);
 }
 /**
  * add to $this->content the result of Customer::SearchByName
  * (encoded in json)
  *
  * @return void
  */
 public function ajaxProcessSearchCustomers()
 {
     $searches = explode(' ', Tools::getValue('customer_search'));
     $customers = array();
     $searches = array_unique($searches);
     foreach ($searches as $search) {
         if (!empty($search) && ($results = Customer::searchByName($search, 50))) {
             foreach ($results as $result) {
                 if ($result['active']) {
                     $result['fullname_and_email'] = $result['firstname'] . ' ' . $result['lastname'] . ' - ' . $result['email'];
                     $customers[$result['id_customer']] = $result;
                 }
             }
         }
     }
     if (count($customers) && Tools::getValue('sf2')) {
         $to_return = $customers;
     } elseif (count($customers) && !Tools::getValue('sf2')) {
         $to_return = array('customers' => $customers, 'found' => true);
     } else {
         $to_return = Tools::getValue('sf2') ? array() : array('found' => false);
     }
     $this->content = json_encode($to_return);
 }
 /**
  * Search a specific name in the customers
  *
  * @params string $query String to find in the catalog
  */
 public function searchCustomer($query)
 {
     $this->_list['customers'] = Customer::searchByName(trim($query));
 }