// Merge -> revision 8059

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8062 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-08-16 09:10:40 +00:00
parent bbb8acc0de
commit 21ca4d15d7
31 changed files with 188 additions and 84 deletions
+23 -5
View File
@@ -28,6 +28,19 @@
class AdminSearch extends AdminTab
{
public function searchIP($query)
{
if (!ip2long(trim($query)))
return;
$this->_list['customers'] = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT DISTINCT c.*
FROM `'._DB_PREFIX_.'customer` c
LEFT JOIN `'._DB_PREFIX_.'guest` g ON g.id_customer = c.id_customer
LEFT JOIN `'._DB_PREFIX_.'connections` co ON g.id_guest = co.id_guest
WHERE co.`ip_address` = \''.ip2long(trim($query)).'\'');
}
/**
* Search a specific string in the products and categories
*
@@ -120,9 +133,7 @@ class AdminSearch extends AdminTab
'reference' => array('title' => $this->l('Reference')),
'name' => array('title' => $this->l('Name')),
'price' => array('title' => $this->l('Price')),
'tax' => array('title' => $this->l('Tax')),
'stock' => array('title' => $this->l('Stock')),
'weight' => array('title' => $this->l('Weight')),
'status' => array('title' => $this->l('Status')),
'action' => array('title' => $this->l('Actions'))
));
@@ -137,7 +148,7 @@ class AdminSearch extends AdminTab
}
/* Customer */
if (!$searchType OR $searchType == 2)
if (!$searchType OR $searchType == 2 OR $searchType == 6)
{
$this->fieldsDisplay['customers'] = (array(
'ID' => array('title' => $this->l('ID')),
@@ -151,6 +162,8 @@ class AdminSearch extends AdminTab
'actions' => array('title' => $this->l('Actions'))
));
if (!$searchType OR $searchType == 2)
{
/* Handle customer ID */
if ($searchType AND (int)$query AND Validate::isUnsignedInt((int)$query))
if ($customer = new Customer((int)$query) AND Validate::isLoadedObject($customer))
@@ -160,6 +173,10 @@ class AdminSearch extends AdminTab
$this->searchCustomer($query);
}
if ($searchType == 6)
$this->searchIP($query);
}
/* Order */
if ($searchType == 3)
{
@@ -183,6 +200,9 @@ class AdminSearch extends AdminTab
Tools::redirectAdmin('index.php?tab=AdminCarts&id_cart='.(int)($cart->id).'&viewcart'.'&token='.Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)$this->context->employee->id));
$this->_errors[] = Tools::displayError('No cart found with this ID:').' '.Tools::htmlentitiesUTF8($query);
}
/* IP */
// 6 - but it is included in the customer block
}
}
@@ -222,9 +242,7 @@ class AdminSearch extends AdminTab
<td>'.$product['reference'].'</td>
<td><a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'">'.stripslashes($product['nameh']).'</a></td>
<td>'.Tools::displayPrice($product['price'], $this->context->currency).'</td>
<td>'.stripslashes($product['tax_name']).'</td>
<td align="center">'.$product['quantity'].'</td>
<td align="center">'.$product['weight'].' '.Configuration::get('PS_WEIGHT_UNIT').'</td>
<td align="center"><a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'">
<img src="../img/admin/'.($product['active'] ? 'enabled.gif' : 'forbbiden.gif').'" alt="" /></a></td>
<td>