// Context part 11

This commit is contained in:
tDidierjean
2011-07-18 15:50:58 +00:00
parent 4b7dee58b7
commit 6551a3ece7
60 changed files with 378 additions and 520 deletions
+11 -15
View File
@@ -29,13 +29,12 @@ class AdminReturn extends AdminTab
{
public function __construct()
{
global $cookie;
$context = Context::getContext();
$this->table = 'order_return';
$this->className = 'OrderReturn';
$this->colorOnBackground = true;
$this->_select = 'orsl.`name`';
$this->_join = 'LEFT JOIN '._DB_PREFIX_.'order_return_state_lang orsl ON (orsl.`id_order_return_state` = a.`state` AND orsl.`id_lang` = '.(int)($cookie->id_lang).')';
$this->_join = 'LEFT JOIN '._DB_PREFIX_.'order_return_state_lang orsl ON (orsl.`id_order_return_state` = a.`state` AND orsl.`id_lang` = '.(int)$context->language->id.')';
$this->fieldsDisplay = array(
'id_order_return' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
@@ -54,8 +53,7 @@ class AdminReturn extends AdminTab
public function postProcess()
{
global $currentIndex, $cookie;
$context = Context::getContext();
if (Tools::isSubmit('deleteorder_return_detail'))
{
if ($this->tabAccess['delete'] === '1')
@@ -103,7 +101,7 @@ class AdminReturn extends AdminTab
'{firstname}' => $customer->firstname,
'{id_order_return}' => $id_order_return,
'{state_order_return}' => $orderReturnState->name[(int)(Configuration::get('PS_LANG_DEFAULT'))]);
Mail::Send((int)($cookie->id_lang), 'order_return_state', Mail::l('Your order return state has changed'), $vars, $customer->email, $customer->firstname.' '.$customer->lastname);
Mail::Send(clan, 'order_return_state', Mail::l('Your order return state has changed'), $vars, $customer->email, $customer->firstname.' '.$customer->lastname);
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
}
}
@@ -118,8 +116,7 @@ class AdminReturn extends AdminTab
public function display()
{
global $currentIndex, $cookie;
$context = Context::getContext();
// Include current tab
if (isset($_GET['update'.$this->table]))
{
@@ -133,7 +130,7 @@ class AdminReturn extends AdminTab
}
else
{
$this->getList((int)($cookie->id_lang), !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
$this->getList($context->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
$this->displayList();
$this->displayOptionsList();
$this->includeSubTab('display');
@@ -143,7 +140,6 @@ class AdminReturn extends AdminTab
public function displayListContent($token = NULL)
{
global $currentIndex, $cookie;
$irow = 0;
if ($this->_list)
foreach ($this->_list AS $tr)
@@ -159,7 +155,7 @@ class AdminReturn extends AdminTab
public function displayForm($isMainTab = true)
{
global $currentIndex, $cookie;
$context = Context::getContext();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
@@ -175,12 +171,12 @@ class AdminReturn extends AdminTab
$customer = new Customer((int)($obj->id_customer));
echo '
<div class="margin-form">'.$customer->firstname.' '.$customer->lastname.'
<p style="clear: both"><a href="index.php?tab=AdminCustomers&id_customer='.$customer->id.'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'">'.$this->l('View details on customer page').'</a></p>
<p style="clear: both"><a href="index.php?tab=AdminCustomers&id_customer='.$customer->id.'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id).'">'.$this->l('View details on customer page').'</a></p>
</div>
<label>'.$this->l('Order:').' </label>';
$order = new Order((int)($obj->id_order));
echo ' <div class="margin-form">'.$this->l('Order #').sprintf('%06d', $order->id).' '.$this->l('from').' '.Tools::displayDate($order->date_upd, $order->id_lang).'
<p style="clear: both"><a href="index.php?tab=AdminOrders&id_order='.$order->id.'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'">'.$this->l('View details on order page').'</a></p>
<p style="clear: both"><a href="index.php?tab=AdminOrders&id_order='.$order->id.'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id).'">'.$this->l('View details on order page').'</a></p>
</div>
<label>'.$this->l('Customer explanation:').' </label>
<div class="margin-form">'.$obj->question.'</div>
@@ -188,7 +184,7 @@ class AdminReturn extends AdminTab
<label>'.$this->l('Status:').' </label>
<div class="margin-form">
<select name=\'state\'>';
$states = OrderReturnState::getOrderReturnStates($cookie->id_lang);
$states = OrderReturnState::getOrderReturnStates($context->language->id);
foreach ($states as $state)
echo '<option value="'.$state['id_order_return_state'].'"'.($obj->state == $state['id_order_return_state'] ? ' selected="selected"' : '').'>'.$state['name'].'</option>';
echo ' </select>
@@ -197,7 +193,7 @@ class AdminReturn extends AdminTab
if ($obj->state >= 3)
echo ' <label>'.$this->l('Slip:').' </label>
<div class="margin-form">'.$this->l('Generate a new slip from the customer order').'
<p style="clear: both"><a href="index.php?tab=AdminOrders&id_order='.$order->id.'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'#products">'.$this->l('More information on order page').'</a></p>
<p style="clear: both"><a href="index.php?tab=AdminOrders&id_order='.$order->id.'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id).'#products">'.$this->l('More information on order page').'</a></p>
</div>';
echo ' <label>'.$this->l('Products:').' </label>
<div class="margin-form">';
-1
View File
@@ -47,7 +47,6 @@ class AdminReturnStates extends AdminTab
public function displayForm($isMainTab = true)
{
global $currentIndex;
parent::displayForm();
if (!($obj = $this->loadObject(true)))
+3 -3
View File
@@ -125,7 +125,7 @@ class AdminScenes extends AdminTab
public function displayForm($isMainTab = true)
{
global $currentIndex, $cookie;
$context = Context::getContext();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
@@ -139,7 +139,7 @@ class AdminScenes extends AdminTab
echo 'startingData = new Array();'."\n";
foreach ($obj->getProducts() as $key => $product)
{
$productObj = new Product((int)($product['id_product']), true, (int)($cookie->id_lang));
$productObj = new Product($product['id_product'], true, $context->language->id);
echo 'startingData['.$key.'] = new Array(\''.$productObj->name.'\', '.$product['id_product'].', '.$product['x_axis'].', '.$product['y_axis'].', '.$product['zone_width'].', '.$product['zone_height'].');';
}
@@ -235,7 +235,7 @@ class AdminScenes extends AdminTab
<th>'.$this->l('ID').'</th>
<th>'.$this->l('Image map name:').'</th>
</tr>';
$categories = Category::getCategories((int)($cookie->id_lang), false);
$categories = Category::getCategories($context->language->id, false);
$done = array();
$index = array();
if (Tools::isSubmit('categories'))
+20 -22
View File
@@ -35,14 +35,13 @@ class AdminSearch extends AdminTab
*/
public function searchCatalog($query)
{
global $cookie;
$this->_list['products'] = Product::searchByName((int)$cookie->id_lang, $query);
$context = Context::getContext();
$this->_list['products'] = Product::searchByName($context->language->id, $query);
if (!empty($this->_list['products']))
for ($i = 0; $i < count($this->_list['products']); $i++)
$this->_list['products'][$i]['nameh'] = str_ireplace($query, '<span class="highlight">'.Tools::htmlentitiesUTF8($query).'</span>', $this->_list['products'][$i]['name']);
$this->_list['categories'] = Category::searchByName((int)$cookie->id_lang, $query);
$this->_list['categories'] = Category::searchByName($context->language->id, $query);
}
/**
@@ -57,8 +56,7 @@ class AdminSearch extends AdminTab
function postProcess()
{
global $cookie;
$context = Context::getContext();
$query = trim(Tools::getValue('bo_query'));
$searchType = (int)Tools::getValue('bo_search_type');
@@ -73,7 +71,7 @@ class AdminSearch extends AdminTab
{
global $_LANGADM;
$tabs = array();
$result = Db::getInstance()->ExecuteS('SELECT class_name, name FROM '._DB_PREFIX_.'tab t INNER JOIN '._DB_PREFIX_.'tab_lang tl ON t.id_tab = tl.id_tab AND tl.id_lang = '.(int)$cookie->id_lang);
$result = Db::getInstance()->ExecuteS('SELECT class_name, name FROM '._DB_PREFIX_.'tab t INNER JOIN '._DB_PREFIX_.'tab_lang tl ON t.id_tab = tl.id_tab AND tl.id_lang = '.(int)$context->language->id);
foreach ($result as $row)
$tabs[$row['class_name']] = $row['name'];
foreach (AdminTab::$tabParenting as $key => $value)
@@ -132,7 +130,7 @@ class AdminSearch extends AdminTab
/* Handle product ID */
if ($searchType == 1 AND (int)$query AND Validate::isUnsignedInt((int)$query))
if ($product = new Product((int)$query) AND Validate::isLoadedObject($product))
Tools::redirectAdmin('index.php?tab=AdminCatalog&id_product='.(int)($product->id).'&addproduct'.'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)));
Tools::redirectAdmin('index.php?tab=AdminCatalog&id_product='.(int)($product->id).'&addproduct'.'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id));
/* Normal catalog search */
$this->searchCatalog($query);
@@ -156,7 +154,7 @@ class AdminSearch extends AdminTab
/* Handle customer ID */
if ($searchType AND (int)$query AND Validate::isUnsignedInt((int)$query))
if ($customer = new Customer((int)$query) AND Validate::isLoadedObject($customer))
Tools::redirectAdmin('index.php?tab=AdminCustomers&id_customer='.(int)($customer->id).'&viewcustomer'.'&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)));
Tools::redirectAdmin('index.php?tab=AdminCustomers&id_customer='.(int)($customer->id).'&viewcustomer'.'&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id));
/* Normal customer search */
$this->searchCustomer($query);
@@ -166,7 +164,7 @@ class AdminSearch extends AdminTab
if ($searchType == 3)
{
if ((int)$query AND Validate::isUnsignedInt((int)$query) AND $order = new Order((int)$query) AND Validate::isLoadedObject($order))
Tools::redirectAdmin('index.php?tab=AdminOrders&id_order='.(int)($order->id).'&vieworder'.'&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)));
Tools::redirectAdmin('index.php?tab=AdminOrders&id_order='.(int)($order->id).'&vieworder'.'&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id));
$this->_errors[] = Tools::displayError('No order found with this ID:').' '.Tools::htmlentitiesUTF8($query);
}
@@ -182,7 +180,7 @@ class AdminSearch extends AdminTab
if ($searchType == 5)
{
if ((int)$query AND Validate::isUnsignedInt((int)$query) AND $cart = new Cart((int)$query) AND Validate::isLoadedObject($cart))
Tools::redirectAdmin('index.php?tab=AdminCarts&id_cart='.(int)($cart->id).'&viewcart'.'&token='.Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)($cookie->id_employee)));
Tools::redirectAdmin('index.php?tab=AdminCarts&id_cart='.(int)($cart->id).'&viewcart'.'&token='.Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)$context->employee->id));
$this->_errors[] = Tools::displayError('No cart found with this ID:').' '.Tools::htmlentitiesUTF8($query);
}
}
@@ -190,8 +188,8 @@ class AdminSearch extends AdminTab
public function display()
{
global $cookie;
$currentIndex = 'index.php';
$context = Context::getContext();
self::$currentIndex = 'index.php';
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$query = trim(Tools::getValue('bo_query'));
$nbCategories = $nbProducts = $nbCustomers = 0;
@@ -224,17 +222,17 @@ class AdminSearch extends AdminTab
<td>'.$product['id_product'].'</td>
<td align="center">'.($product['manufacturer_name'] != NULL ? stripslashes($product['manufacturer_name']) : '--').'</td>
<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)($cookie->id_employee)).'">'.stripslashes($product['nameh']).'</a></td>
<td><a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">'.stripslashes($product['nameh']).'</a></td>
<td>'.Tools::displayPrice($product['price'], $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)($cookie->id_employee)).'">
<td align="center"><a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">
<img src="../img/admin/'.($product['active'] ? 'enabled.gif' : 'forbbiden.gif').'" alt="" /></a></td>
<td>
<a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'">
<a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this product').'" /></a>&nbsp;
<a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'"
<a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'"
onclick="return confirm(\''.$this->l('Do you want to delete this product?', __CLASS__, true, false).' ('.addslashes($product['name']).')\');">
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this product').'" /></a>
</td>
@@ -263,16 +261,16 @@ class AdminSearch extends AdminTab
<td class="center">'.$imgGender.'</td>
<td>'.stripslashes($customer['lastname']).' '.stripslashes($customer['firstname']).'</td>
<td>'.stripslashes($customer['email']).'<a href="mailto:'.stripslashes($customer['email']).'"> <img src="../img/admin/email_edit.gif" alt="'.$this->l('Write to this customer').'" /></a></td>
<td>'.Tools::displayDate($customer['birthday'], (int)($cookie->id_lang)).'</td>
<td>'.Tools::displayDate($customer['date_add'], (int)($cookie->id_lang)).'</td>
<td>'.Tools::displayDate($customer['birthday'], $context->language->id).'</td>
<td>'.Tools::displayDate($customer['date_add'], $context->language->id).'</td>
<td>'.Order::getCustomerNbOrders($customer['id_customer']).'</td>
<td class="center"><img src="../img/admin/'.($customer['active'] ? 'enabled.gif' : 'forbbiden.gif').'" alt="" /></td>
<td class="center" width="60px">
<a href="'.self::$currentIndex.'?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'">
<a href="'.self::$currentIndex.'?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id).'">
<img src="../img/admin/details.gif" alt="'.$this->l('View orders').'" /></a>
<a href="'.self::$currentIndex.'?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&addcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'">
<a href="'.self::$currentIndex.'?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&addcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id).'">
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this customer').'" /></a>
<a href="'.self::$currentIndex.'?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&deletecustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');">
<a href="'.self::$currentIndex.'?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&deletecustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id).'" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');">
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this customer').'" /></a>
</td>
</tr>';
-2
View File
@@ -31,8 +31,6 @@ class AdminSearchConf extends AdminPreferences
{
public function __construct()
{
global $cookie;
$this->className = 'Configuration';
$this->table = 'configuration';
-1
View File
@@ -45,7 +45,6 @@ class AdminSearchEngines extends AdminTab
public function displayForm($isMainTab = true)
{
global $currentIndex;
parent::displayForm();
if (!($obj = $this->loadObject(true)))
-6
View File
@@ -46,8 +46,6 @@ class AdminShipping extends AdminTab
public function postProcess()
{
global $currentIndex;
/* Handling settings */
if (isset($_POST['submitHandling'.$this->table]))
{
@@ -138,8 +136,6 @@ class AdminShipping extends AdminTab
public function displayFormHandling()
{
global $currentIndex;
$confKeys = $this->_fieldsHandling;
foreach ($confKeys AS $key => $confKey)
$getConf[] = $key;
@@ -195,8 +191,6 @@ class AdminShipping extends AdminTab
public function displayFormFees()
{
global $currentIndex;
$carrierArray = array();
$id_carrier = Tools::getValue('id_carrier');
$carriers = Carrier::getCarriers((int)(Configuration::get('PS_LANG_DEFAULT')), true , false,false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
+4 -4
View File
@@ -30,7 +30,7 @@ class AdminShop extends AdminTab
{
public function __construct()
{
global $cookie;
$context = Context::getContext();
$this->table = 'shop';
$this->className = 'Shop';
@@ -40,7 +40,7 @@ class AdminShop extends AdminTab
$this->_select = 'gs.name group_shop_name, cl.name category_name';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'group_shop` gs ON (a.id_group_shop = gs.id_group_shop)
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (a.id_category = cl.id_category AND cl.id_lang='.(int)$cookie->id_lang.')';
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (a.id_category = cl.id_category AND cl.id_lang='.(int)$context->language->id.')';
$this->_group = 'GROUP BY id_shop';
$this->fieldsDisplay = array(
@@ -80,7 +80,7 @@ class AdminShop extends AdminTab
public function displayForm($isMainTab = true)
{
global $currentIndex, $cookie;
$context = Context::getContext();
parent::displayForm($isMainTab);
if (!($obj = $this->loadObject(true)))
@@ -111,7 +111,7 @@ class AdminShop extends AdminTab
echo '<label for="id_category">'.$this->l('Category root').'</label>
<div class="margin-form">
<select id="id_category" name="id_category">';
$categories = Category::getCategories((int)$cookie->id_lang, false);
$categories = Category::getCategories($context->language->id, false);
Category::recurseCategory($categories, $categories[0][1], 1, $obj->id_category);
echo '
-1
View File
@@ -86,7 +86,6 @@ class AdminShopUrl extends AdminTab
public function displayForm($isMainTab = true)
{
global $currentIndex;
parent::displayForm($isMainTab = true);
if (!($obj = $this->loadObject(true)))
+2 -4
View File
@@ -66,10 +66,9 @@ class AdminSlip extends AdminTab
public function display()
{
global $cookie, $currentIndex;
$context = Context::getContext();
echo '<div style="float:left;width:600px">';
$this->getList((int)($cookie->id_lang), !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
$this->getList($context->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
$this->displayList();
echo '</div>';
@@ -95,7 +94,6 @@ class AdminSlip extends AdminTab
public function displayListContent($token = NULL)
{
global $currentIndex, $cookie;
$irow = 0;
if ($this->_list)
foreach ($this->_list AS $tr)
+2 -4
View File
@@ -52,8 +52,6 @@ class AdminStates extends AdminTab
/* Delete object */
if (isset($_GET['delete'.$this->table]))
{
global $currentIndex;
// set token
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
@@ -100,7 +98,7 @@ class AdminStates extends AdminTab
public function displayForm($isMainTab = true)
{
global $currentIndex, $cookie;
$context = Context::getContext();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
@@ -123,7 +121,7 @@ class AdminStates extends AdminTab
<label>'.$this->l('Country:').' </label>
<div class="margin-form">
<select name="id_country">';
$countries = Country::getCountries((int)($cookie->id_lang), false, true);
$countries = Country::getCountries($context->language->id, false, true);
foreach ($countries AS $country)
echo '<option value="'.(int)($country['id_country']).'"'.(($this->getFieldValue($obj, 'id_country') == $country['id_country']) ? ' selected="selected"' : '').'>'.$country['name'].'</option>';
echo '
-2
View File
@@ -52,8 +52,6 @@ class AdminStatsConf extends AdminPreferences
public function display()
{
global $currentIndex, $cookie;
$graphEngine = Configuration::get('PS_STATS_RENDER');
$gridEngine = Configuration::get('PS_STATS_GRID_RENDER');
$autoclean = Configuration::get('PS_STATS_OLD_CONNECT_AUTO_CLEAN');
+12 -19
View File
@@ -40,8 +40,7 @@ abstract class AdminStatsTab extends AdminPreferences
public function postProcess()
{
global $cookie, $currentIndex;
$context = Context::getContext();
if (Tools::isSubmit('submitDatePicker'))
{
if (!Validate::isDate($from = Tools::getValue('datepickerFrom')) OR !Validate::isDate($to = Tools::getValue('datepickerTo')))
@@ -82,17 +81,16 @@ abstract class AdminStatsTab extends AdminPreferences
}
if (isset($from) AND isset($to) AND !sizeof($this->_errors))
{
$employee = new Employee($cookie->id_employee);
$employee->stats_date_from = $from;
$employee->stats_date_to = $to;
$employee->update();
$context->employee->stats_date_from = $from;
$context->employee->stats_date_to = $to;
$context->employee->update();
Tools::redirectAdmin($_SERVER['REQUEST_URI']);
}
if (Tools::getValue('submitSettings'))
{
if ($this->tabAccess['edit'] === '1')
{
$currentIndex .= '&module='.Tools::getValue('module');
self::$currentIndex .= '&module='.Tools::getValue('module');
$this->_postConfig($this->_fieldsSettings);
}
else
@@ -104,8 +102,6 @@ abstract class AdminStatsTab extends AdminPreferences
protected function displayEngines()
{
global $currentIndex, $cookie;
$graphEngine = Configuration::get('PS_STATS_RENDER');
$gridEngine = Configuration::get('PS_STATS_GRID_RENDER');
$arrayGraphEngines = ModuleGraphEngine::getGraphEngines();
@@ -141,10 +137,10 @@ abstract class AdminStatsTab extends AdminPreferences
protected function getDate()
{
global $cookie;
$year = isset($cookie->stats_year) ? $cookie->stats_year : date('Y');
$month = isset($cookie->stats_month) ? sprintf('%02d', $cookie->stats_month) : '%';
$day = isset($cookie->stats_day) ? sprintf('%02d', $cookie->stats_day) : '%';
$context = Context::getContext();
$year = isset($context->cookie->stats_year) ? $context->cookie->stats_year : date('Y');
$month = isset($context->cookie->stats_month) ? sprintf('%02d', $context->cookie->stats_month) : '%';
$day = isset($context->cookie->stats_day) ? sprintf('%02d', $context->cookie->stats_day) : '%';
return $year.'-'.$month.'-'.$day;
}
@@ -161,9 +157,7 @@ abstract class AdminStatsTab extends AdminPreferences
public static function displayCalendarStatic($translations)
{
global $cookie;
$employee = new Employee($cookie->id_employee);
$context = Context::getContext();
includeDatepicker(array('datepickerFrom', 'datepickerTo'));
return '
<fieldset style="width: 200px; font-size:13px;"><legend><img src="../img/admin/date.png" /> '.$translations['Calendar'].'</legend>
@@ -175,8 +169,8 @@ abstract class AdminStatsTab extends AdminPreferences
<input type="submit" name="submitDateDayPrev" class="button" value="'.$translations['Day'].'-1" style="margin-top:2px">
<input type="submit" name="submitDateMonthPrev" class="button" value="'.$translations['Month'].'-1" style="margin-top:2px">
<input type="submit" name="submitDateYearPrev" class="button" value="'.$translations['Year'].'-1" style="margin-top:2px">
<p>'.(isset($translations['From']) ? $translations['From'] : 'From:').' <input type="text" name="datepickerFrom" id="datepickerFrom" value="'.Tools::getValue('datepickerFrom', $employee->stats_date_from).'"></p>
<p>'.(isset($translations['To']) ? $translations['To'] : 'To:').' <input type="text" name="datepickerTo" id="datepickerTo" value="'.Tools::getValue('datepickerTo', $employee->stats_date_to).'"></p>
<p>'.(isset($translations['From']) ? $translations['From'] : 'From:').' <input type="text" name="datepickerFrom" id="datepickerFrom" value="'.Tools::getValue('datepickerFrom', $context->employee->stats_date_from).'"></p>
<p>'.(isset($translations['To']) ? $translations['To'] : 'To:').' <input type="text" name="datepickerTo" id="datepickerTo" value="'.Tools::getValue('datepickerTo', $context->employee->stats_date_to).'"></p>
<input type="submit" name="submitDatePicker" class="button" value="'.(isset($translations['Save']) ? $translations['Save'] : ' Save ').'" />
</form>
</div>
@@ -207,7 +201,6 @@ abstract class AdminStatsTab extends AdminPreferences
public function displayMenu()
{
global $currentIndex, $cookie;
$modules = $this->getModules();
echo '<fieldset style="width: 200px"><legend><img src="../img/admin/navigation.png" /> '.$this->l('Navigation', 'AdminStatsTab').'</legend>';
-2
View File
@@ -67,8 +67,6 @@ class AdminStatuses extends AdminTab
public function display()
{
global $currentIndex;
if (!Tools::isSubmit('updateorder_return_state') AND !Tools::isSubmit('submitAddorder_return_state'))
{
echo '<h2>'.$this->l('Order statuses').'</h2>';
+5 -6
View File
@@ -34,8 +34,7 @@ class AdminStores extends AdminTab
public function __construct()
{
global $cookie;
$context = Context::getContext();
$this->table = 'store';
$this->className = 'Store';
$this->lang = false;
@@ -46,10 +45,10 @@ class AdminStores extends AdminTab
$this->_select = 'cl.`name` country, st.`name` state';
$this->_join = '
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)($cookie->id_lang).')
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'state` st ON (st.`id_state` = a.`id_state`)';
$countries = Country::getCountries((int)($cookie->id_lang));
$countries = Country::getCountries($context->language->id);
foreach ($countries AS $country)
$this->countriesArray[$country['id_country']] = $country['name'];
@@ -146,7 +145,7 @@ class AdminStores extends AdminTab
public function displayForm($isMainTab = true)
{
global $currentIndex, $cookie;
$context = Context::getContext();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
@@ -260,7 +259,7 @@ class AdminStores extends AdminTab
<input type="file" name="image" />
<p class="clear">'.$this->l('Store window picture').'</p>';
echo $this->displayImage($obj->id, _PS_STORE_IMG_DIR_.'/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminStores'.(int)(Tab::getIdFromClassName('AdminStores')).(int)($cookie->id_employee)), true);
echo $this->displayImage($obj->id, _PS_STORE_IMG_DIR_.'/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminStores'.(int)(Tab::getIdFromClassName('AdminStores')).(int)$context->employee->id), true);
echo '</div>
<table cellpadding="2" cellspacing="2" style="padding: 10px; margin-top: 15px; border: 1px solid #BBB;">
-1
View File
@@ -49,7 +49,6 @@ class AdminSubDomains extends AdminTab
public function displayForm($isMainTab = true)
{
global $currentIndex;
parent::displayForm();
if (!($obj = $this->loadObject(true)))
+6 -7
View File
@@ -55,23 +55,23 @@ class AdminSuppliers extends AdminTab
public function viewsupplier()
{
global $cookie;
$context = Context::getContext();
if (!($supplier = $this->loadObject()))
return;
echo '<h2>'.$supplier->name.'</h2>';
$products = $supplier->getProductsLite((int)($cookie->id_lang));
$products = $supplier->getProductsLite($context->language->id);
echo '<h3>'.$this->l('Total products:').' '.sizeof($products).'</h3>';
foreach ($products AS $product)
{
$product = new Product($product['id_product'], false, (int)($cookie->id_lang));
$product = new Product($product['id_product'], false, $context->language->id);
echo '<hr />';
if (!$product->hasAttributes())
{
echo '
<table border="0" cellpadding="0" cellspacing="0" class="table width3">
<tr>
<th><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" target="_blank">'.$product->name.'</a></th>
<th><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" target="_blank">'.$product->name.'</a></th>
'.(!empty($product->reference) ? '<th width="150">'.$this->l('Ref:').' '.$product->reference.'</th>' : '').'
'.(!empty($product->ean13) ? '<th width="120">'.$this->l('EAN13:').' '.$product->ean13.'</th>' : '').'
'.(!empty($product->upc) ? '<th width="120">'.$this->l('UPC:').' '.$product->upc.'</th>' : '').'
@@ -82,7 +82,7 @@ class AdminSuppliers extends AdminTab
else
{
echo '
<h3><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" target="_blank">'.$product->name.'</a></h3>
<h3><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" target="_blank">'.$product->name.'</a></h3>
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width: 600px;">
<tr>
<th>'.$this->l('Attribute name').'</th>
@@ -92,7 +92,7 @@ class AdminSuppliers extends AdminTab
'.(Configuration::get('PS_STOCK_MANAGEMENT') ? '<th class="right" width="40">'.$this->l('Quantity').'</th>' : '').'
</tr>';
/* Build attributes combinaisons */
$combinaisons = $product->getAttributeCombinaisons((int)($cookie->id_lang));
$combinaisons = $product->getAttributeCombinaisons($context->language->id);
foreach ($combinaisons AS $k => $combinaison)
{
$combArray[$combinaison['id_product_attribute']]['reference'] = $combinaison['reference'];
@@ -125,7 +125,6 @@ class AdminSuppliers extends AdminTab
public function displayForm($isMainTab = true)
{
global $currentIndex;
parent::displayForm();
if (!($supplier = $this->loadObject(true)))
+8 -13
View File
@@ -29,20 +29,19 @@ class AdminTabs extends AdminTab
{
public function __construct()
{
global $cookie;
$context = Context::getContext();
$this->table = 'tab';
$this->className = 'Tab';
$this->lang = true;
$this->edit = true;
$this->delete = true;
$this->_select = '(SELECT stl.`name` FROM `'._DB_PREFIX_.'tab_lang` stl WHERE stl.`id_tab` = a.`id_parent` AND stl.`id_lang` = '.(int)($cookie->id_lang).' LIMIT 1) AS parent';
$this->_select = '(SELECT stl.`name` FROM `'._DB_PREFIX_.'tab_lang` stl WHERE stl.`id_tab` = a.`id_parent` AND stl.`id_lang` = '.(int)$context->language->id.' LIMIT 1) AS parent';
$this->fieldImageSettings = array('name' => 'icon', 'dir' => 't');
$this->imageType = 'gif';
$tabs = array(0 => $this->l('Home'));
foreach (Tab::getTabs((int)$cookie->id_lang, 0) AS $tab)
foreach (Tab::getTabs($context->language->id, 0) AS $tab)
$tabs[$tab['id_tab']] = $tab['name'];
$this->fieldsDisplay = array(
'id_tab' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
@@ -58,7 +57,6 @@ class AdminTabs extends AdminTab
{
if (($id_tab = (int)(Tools::getValue('id_tab'))) AND ($direction = Tools::getValue('move')) AND Validate::isLoadedObject($tab = new Tab($id_tab)))
{
global $currentIndex;
if ($tab->move($direction))
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
}
@@ -72,8 +70,6 @@ class AdminTabs extends AdminTab
private function _posTabs($name, $arrayTabs)
{
global $currentIndex;
if (sizeof($arrayTabs) > 1)
{
echo '
@@ -96,22 +92,21 @@ class AdminTabs extends AdminTab
public function displayList()
{
global $cookie, $currentIndex;
$context = Context::getContext();
parent::displayList();
$tabs = Tab::getTabs((int)$cookie->id_lang, 0);
$tabs = Tab::getTabs($context->language->id, 0);
echo '<br /><h2>'.$this->l('Positions').'</h2>
<h3>'.$this->l('Level').' 1</h3>';
$this->_posTabs($this->l('Main'), $tabs);
echo '<h3>'.$this->l('Level').' 2</h3>';
foreach ($tabs AS $t)
$this->_posTabs(stripslashes($t['name']), Tab::getTabs((int)$cookie->id_lang, $t['id_tab']));
$this->_posTabs(stripslashes($t['name']), Tab::getTabs($context->language->id, $t['id_tab']));
}
public function displayForm($isMainTab = true)
{
global $currentIndex, $cookie;
$context = Context::getContext();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
@@ -156,7 +151,7 @@ class AdminTabs extends AdminTab
<select name="id_parent">
<option value="-1" '.(($this->getFieldValue($obj, 'id_parent') == -1) ? 'selected="selected"' : '').'>'.$this->l('None').'</option>
<option value="0" '.(($this->getFieldValue($obj, 'id_parent') == 0) ? 'selected="selected"' : '').'>'.$this->l('Home').'</option>';
foreach (Tab::getTabs((int)$cookie->id_lang, 0) AS $tab)
foreach (Tab::getTabs($context->language->id, 0) AS $tab)
echo ' <option value="'.$tab['id_tab'].'" '.($tab['id_tab'] == $this->getFieldValue($obj, 'id_parent') ? 'selected="selected"' : '').'>'.$tab['name'].'</option>';
echo ' </select>
</div>
-3
View File
@@ -29,8 +29,6 @@ class AdminTags extends AdminTab
{
public function __construct()
{
global $cookie;
$this->table = 'tag';
$this->className = 'Tag';
$this->edit = true;
@@ -61,7 +59,6 @@ class AdminTags extends AdminTab
public function displayForm($isMainTab = true)
{
global $currentIndex, $cookie;
parent::displayForm();
if (!($obj = $this->loadObject(true)))
+9 -11
View File
@@ -30,7 +30,6 @@ class AdminTaxRulesGroup extends AdminTab
{
public function __construct()
{
global $cookie;
$this->table = 'tax_rules_group';
$this->className = 'TaxRulesGroup';
$this->edit = true;
@@ -70,7 +69,7 @@ class AdminTaxRulesGroup extends AdminTab
public function displayForm($isMainTab = true)
{
global $cookie, $currentIndex;
$context = Context::getContext();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
return;
@@ -182,7 +181,7 @@ class AdminTaxRulesGroup extends AdminTab
<script type="text/javascript">
var tabPane1 = new WebFXTabPane( document.getElementById( "tab-pane-1" ) );
</script>
<link type="text/css" rel="stylesheet" href="../css/tabpane.css" />'.$this->renderZones($tax_rules, (int)$cookie->id_lang);
<link type="text/css" rel="stylesheet" href="../css/tabpane.css" />'.$this->renderZones($tax_rules, $context->language->id);
echo '
<div class="margin-form" style="margin-top: 10px">
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />&nbsp;&nbsp;
@@ -383,12 +382,11 @@ class AdminTaxRulesGroup extends AdminTab
protected function afterUpdate($object)
{
global $cookie;
$context = Context::getContext();
TaxRule::deleteByGroupId($object->id);
foreach(Country::getCountries($cookie->id_lang, true) AS $country)
foreach(Country::getCountries($context->language->id, true) AS $country)
{
$id_tax = (int)Tools::getValue('tax_'.$country['id_country'].'_0');
@@ -456,9 +454,9 @@ class AdminTaxRulesGroup extends AdminTab
public function postProcess()
{
global $currentIndex, $cookie;
if (!isset($this->table))
$context = Context::getContext();
if (!isset($this->table))
return false;
// set token
@@ -523,7 +521,7 @@ class AdminTaxRulesGroup extends AdminTab
// Default behavior (save and back)
$id_product = (int)Tools::getValue('id_product');
if ($id_product)
Tools::redirectAdmin('?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)));
Tools::redirectAdmin('?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id));
Tools::redirectAdmin(self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$token);
}
@@ -555,7 +553,7 @@ class AdminTaxRulesGroup extends AdminTab
$this->updateAssoGroupShop($object->id);
$id_product = (int)Tools::getValue('id_product');
if ($id_product)
Tools::redirectAdmin('?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)));
Tools::redirectAdmin('?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id));
Tools::redirectAdmin(self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$token);
// Default behavior (save and back)
+2 -9
View File
@@ -29,7 +29,6 @@ class AdminTaxes extends AdminTab
{
public function __construct()
{
global $cookie;
$this->table = 'tax';
$this->className = 'Tax';
$this->lang = true;
@@ -59,13 +58,13 @@ class AdminTaxes extends AdminTab
public function displayForm($isMainTab = true)
{
global $currentIndex, $cookie;
$context = Context::getContext();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
return;
$zones = Zone::getZones(true);
$states = State::getStates((int)$cookie->id_lang);
$states = State::getStates($context->language->id);
echo '
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post">
@@ -104,8 +103,6 @@ class AdminTaxes extends AdminTab
public function postProcess()
{
global $currentIndex;
if(Tools::getValue('submitAdd'.$this->table))
{
/* Checking fields validity */
@@ -164,8 +161,6 @@ class AdminTaxes extends AdminTab
protected function _displayDeleteLink($token = NULL, $id)
{
global $currentIndex;
$_cacheLang['Delete'] = $this->l('Delete', __CLASS__, TRUE, FALSE);
$_cacheLang['DeleteItem'] = $this->l('Delete item #', __CLASS__, TRUE, FALSE).$id.' ?)';
@@ -179,8 +174,6 @@ class AdminTaxes extends AdminTab
protected function _displayEnableLink($token, $id, $value, $active, $id_category = NULL, $id_product = NULL)
{
global $currentIndex;
$confirm = ($value AND TaxRule::isTaxInUse($id)) ? 'onclick="return confirm(\''. $this->l('This tax is currently in use in a tax rule. If you continue this tax will be removed from the tax rule, are you sure?').'\')"' : '';
echo '<a href="'.self::$currentIndex.'&'.$this->identifier.'='.$id.'&'.$active.
-3
View File
@@ -112,8 +112,6 @@ class AdminThemes extends AdminPreferences
public function display()
{
global $currentIndex;
if (file_exists(_PS_IMG_DIR_.'logo.jpg'))
{
list($width, $height, $type, $attr) = getimagesize(_PS_IMG_DIR_.'logo.jpg');
@@ -161,7 +159,6 @@ class AdminThemes extends AdminPreferences
*/
private function _isThemeCompatible($theme_dir)
{
global $cookie;
$all_errors='';
$return=true;
$check_version=AdminThemes::$check_features_version;
+15 -21
View File
@@ -37,8 +37,6 @@ class AdminTracking extends AdminTab
public function display()
{
global $currentIndex;
echo '<h2 class="space">'.$this->l('Catalog tracking').'</h2>';
$this->getObjects('categories_empty');
$this->displayCategories();
@@ -52,8 +50,7 @@ class AdminTracking extends AdminTab
public function getObjects($type)
{
global $cookie;
$context = Context::getContext();
switch ($type)
{
case 'categories_empty':
@@ -99,10 +96,10 @@ class AdminTracking extends AdminTab
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group`
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)($cookie->id_lang).')
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)($cookie->id_lang).')
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = pa.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)($cookie->id_lang).')
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer` = m.`id_manufacturer`)
WHERE pa.quantity <= 0
ORDER BY pa.`id_product_attribute`
@@ -115,8 +112,6 @@ class AdminTracking extends AdminTab
public function displayCategories()
{
global $currentIndex;
if (isset($this->_list['obj']))
{
$nbCategories = sizeof($this->_list['obj']);
@@ -135,8 +130,7 @@ class AdminTracking extends AdminTab
public function displayProducts()
{
global $currentIndex, $cookie;
$context = Context::getContext();
if (isset($this->_list['obj']))
{
$nbProducts = sizeof($this->_list['obj']);
@@ -166,7 +160,7 @@ class AdminTracking extends AdminTab
foreach ($this->_list['obj'] AS $k => $prod)
{
$product = new Product((int)($prod['id_product']));
$product->name = $product->name[(int)($cookie->id_lang)];
$product->name = $product->name[(int)$context->language->id];
$taxrate = Tax::getProductTaxRate($product->id);
echo '
@@ -174,16 +168,16 @@ class AdminTracking extends AdminTab
<td>'.$product->id.'</td>
<td align="center">'.($product->manufacturer_name != NULL ? stripslashes($product->manufacturer_name) : '--').'</td>
<td>'.$product->reference.'</td>
<td><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'">'.stripslashes($product->name).'</a></td>
<td><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">'.stripslashes($product->name).'</a></td>
<td>'.Tools::displayPrice($product->getPrice(), $currency).'</td>
<td>'.(float)$taxrate.'% </td>
<td align="center">'.$product->quantity.'</td>
<td align="center">'.$product->weight.' '.Configuration::get('PS_WEIGHT_UNIT').'</td>
<td align="center"><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'"><img src="../img/admin/'.($product->active ? 'enabled.gif' : 'disabled.gif').'" alt="" /></a></td>
<td align="center"><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'"><img src="../img/admin/'.($product->active ? 'enabled.gif' : 'disabled.gif').'" alt="" /></a></td>
<td>
<a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'">
<a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this product').'" /></a>&nbsp;
<a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" onclick="return confirm(\''.addslashes($this->l('Do you want to delete').' '.str_replace('"', ' ', $product->name)).' ?\');">
<a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" onclick="return confirm(\''.addslashes($this->l('Do you want to delete').' '.str_replace('"', ' ', $product->name)).' ?\');">
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this product').'" /></a>
</td>
</tr>';
@@ -194,7 +188,7 @@ class AdminTracking extends AdminTab
public function displayAttributes()
{
global $currentIndex, $cookie;
$context = Context::getContext();
if (isset($this->_list['obj']))
{
@@ -246,16 +240,16 @@ class AdminTracking extends AdminTab
<td>'.$prod['id_product'].'</td>
<td align="center">'.($prod['manufacturer_name'] != NULL ? stripslashes($prod['manufacturer_name']) : '--').'</td>
<td>'.$prod['reference'].'</td>
<td><a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'">'.stripslashes($prod['name']).' ('.$prod['combination_name'].')'.'</a></td>
<td><a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">'.stripslashes($prod['name']).' ('.$prod['combination_name'].')'.'</a></td>
<td>'.Tools::displayPrice(Product::getPriceStatic((int)($prod['id_product']), true, $prod['id_product_attribute']), $currency).'</td>
<td>'.(float)$taxrate.'% </td>
<td align="center">'.$prod['quantity'].'</td>
<td align="center">'.($prod['weight'] + $prod['product_weight']).' '.Configuration::get('PS_WEIGHT_UNIT').'</td>
<td align="center"><a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'"><img src="../img/admin/'.($prod['active'] ? 'enabled.gif' : 'disabled.gif').'" alt="" /></a></td>
<td align="center"><a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'"><img src="../img/admin/'.($prod['active'] ? 'enabled.gif' : 'disabled.gif').'" alt="" /></a></td>
<td>
<a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'">
<a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this product').'" /></a>&nbsp;
<a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" onclick="return confirm(\''.addslashes($this->l('Do you want to delete').' '.$prod['name']).' ?\');">
<a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" onclick="return confirm(\''.addslashes($this->l('Do you want to delete').' '.$prod['name']).' ?\');">
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this product').'" /></a>
</td>
</tr>';
+3 -27
View File
@@ -110,8 +110,6 @@ class AdminTranslations extends AdminTab
protected function writeTranslationFile($type, $path, $mark = false, $fullmark = false)
{
global $currentIndex;
if ($fd = fopen($path, 'w'))
{
unset($_POST['submitTranslations'.$type], $_POST['lang']);
@@ -135,8 +133,6 @@ class AdminTranslations extends AdminTab
public function submitCopyLang()
{
global $currentIndex;
if (!($fromLang = strval(Tools::getValue('fromLang'))) OR !($toLang = strval(Tools::getValue('toLang'))))
$this->_errors[] = $this->l('you must select 2 languages in order to copy data from one to another');
elseif (!($fromTheme = strval(Tools::getValue('fromTheme'))) OR !($toTheme = strval(Tools::getValue('toTheme'))))
@@ -191,8 +187,6 @@ class AdminTranslations extends AdminTab
}
public function submitExportLang()
{
global $currentIndex;
$lang = strtolower(Tools::getValue('iso_code'));
$theme = strval(Tools::getValue('theme'));
if ($lang AND $theme)
@@ -229,8 +223,6 @@ class AdminTranslations extends AdminTab
}
public function submitImportLang()
{
global $currentIndex;
if (!isset($_FILES['file']['tmp_name']) OR !$_FILES['file']['tmp_name'])
$this->_errors[] = Tools::displayError('No file selected');
else
@@ -254,8 +246,6 @@ class AdminTranslations extends AdminTab
public function submitAddLang()
{
global $currentIndex;
$arr_import_lang = explode('|', Tools::getValue('params_import_language')); /* 0 = Language ISO code, 1 = PS version */
if (Validate::isLangIsoCode($arr_import_lang[0]))
{
@@ -428,8 +418,6 @@ class AdminTranslations extends AdminTab
public function postProcess()
{
global $currentIndex;
if (Tools::isSubmit('submitCopyLang'))
{
if ($this->tabAccess['add'] === '1')
@@ -582,7 +570,6 @@ class AdminTranslations extends AdminTab
*/
protected function submitTranslationsMails ($id_lang)
{
global $currentIndex;
$obj_lang = new Language($id_lang);
$params_redirect = (Tools::isSubmit('submitTranslationsMailsAndStay') ? '&lang='.Tools::getValue('lang').'&type='.Tools::getValue('type') : '');
@@ -684,8 +671,7 @@ class AdminTranslations extends AdminTab
}
public function display()
{
global $currentIndex, $cookie;
$context = Context::getContext();
$translations = array(
'front' => $this->l('Front Office translations'),
'back' => $this->l('Back Office translations'),
@@ -794,7 +780,7 @@ class AdminTranslations extends AdminTab
<fieldset class="width3"><legend><img src="../img/admin/copy_files.gif" />'.$this->l('Copy').'</legend>
<p>'.$this->l('Copies data from one language to another.').'<br />'.
$this->l('Be careful, as it will replace all existing data for the destination language!').'<br />'.
$this->l('If necessary').', <b><a href="index.php?tab=AdminLanguages&addlang&token='.Tools::getAdminToken('AdminLanguages'.(int)(Tab::getIdFromClassName('AdminLanguages')).(int)($cookie->id_employee)).'">'.$this->l('first create a new language').'</a></b>.</p>
$this->l('If necessary').', <b><a href="index.php?tab=AdminLanguages&addlang&token='.Tools::getAdminToken('AdminLanguages'.(int)(Tab::getIdFromClassName('AdminLanguages')).(int)$context->employee->id).'">'.$this->l('first create a new language').'</a></b>.</p>
<div style="float:left;">
<p>
<div style="width:75px; font-weight:bold; float:left;">'.$this->l('From:').'</div>
@@ -951,7 +937,6 @@ class AdminTranslations extends AdminTab
public function displayFormFront($lang)
{
global $currentIndex;
$_LANG = $this->fileExists(_PS_THEME_DIR_.'lang', Tools::strtolower($lang).'.php', '_LANG');
$str_output = '';
@@ -1034,7 +1019,6 @@ class AdminTranslations extends AdminTab
public function displayFormBack($lang)
{
global $currentIndex;
$_LANGADM = $this->fileExists(_PS_TRANSLATIONS_DIR_.$lang, 'admin.php', '_LANGADM');
$str_output = '';
/* List templates to parse */
@@ -1108,7 +1092,6 @@ class AdminTranslations extends AdminTab
public function displayFormErrors($lang)
{
global $currentIndex;
$_ERRORS = $this->fileExists(_PS_TRANSLATIONS_DIR_.$lang, 'errors.php', '_ERRORS');
$str_output = '';
@@ -1167,7 +1150,6 @@ class AdminTranslations extends AdminTab
public function displayFormFields($lang)
{
global $currentIndex;
$_FIELDS = $this->fileExists(_PS_TRANSLATIONS_DIR_.$lang, 'fields.php', '_FIELDS');
$str_output = '';
@@ -1487,8 +1469,6 @@ class AdminTranslations extends AdminTab
}
public function displayFormMails($lang, $noDisplay = false)
{
global $cookie, $currentIndex;
$core_mails = array();
$module_mails = array();
$theme_mails = array();
@@ -1662,8 +1642,6 @@ class AdminTranslations extends AdminTab
protected function writeSubjectTranslationFile($sub, $path, $mark = false, $fullmark = false)
{
global $currentIndex;
if ($fd = @fopen($path, 'w'))
{
//$tab = ($fullmark ? Tools::strtoupper($fullmark) : 'LANG').($mark ? Tools::strtoupper($mark) : '');
@@ -1746,7 +1724,7 @@ class AdminTranslations extends AdminTab
}
public function displayFormModules($lang)
{
global $currentIndex, $_MODULES;
global $_MODULES;
$array_lang_src = Language::getLanguages(false);
$str_output = '';
@@ -1837,8 +1815,6 @@ class AdminTranslations extends AdminTab
public function displayFormPDF()
{
global $currentIndex;
$lang = Tools::strtolower(Tools::getValue('lang'));
$_LANG = array();
$str_output = '';
+3 -5
View File
@@ -97,7 +97,6 @@ class AdminWebservice extends AdminTab
public function displayForm($isMainTab = true)
{
global $currentIndex;
parent::displayForm();
if (!($obj = $this->loadObject(true)))
return;
@@ -227,8 +226,7 @@ echo '
public function display()
{
global $currentIndex, $cookie;
$context = Context::getContext();
// Include other tab in current tab
if ($this->includeSubTab('display', array('submitAdd2', 'add', 'update', 'view'))){}
@@ -246,7 +244,7 @@ echo '
}
elseif (isset($_GET['update'.$this->table]))
{
if ($this->tabAccess['edit'] === '1' OR ($this->table == 'employee' AND $cookie->id_employee == Tools::getValue('id_employee')))
if ($this->tabAccess['edit'] === '1' OR ($this->table == 'employee' AND $context->employee->id == Tools::getValue('id_employee')))
{
$this->displayForm();
if ($this->tabAccess['view'])
@@ -262,7 +260,7 @@ echo '
{
$this->checkForWarning();
$this->getList((int)$cookie->id_lang);
$this->getList($context->language->id);
$this->displayList();
$this->displayRequiredFields();
-1
View File
@@ -48,7 +48,6 @@ class AdminZones extends AdminTab
public function displayForm($isMainTab = true)
{
global $currentIndex, $cookie;
parent::displayForm();
if (!($obj = $this->loadObject(true)))