[*] BO : #PSFV-94 - added AdminLogsController and changed initX() functions to return their result
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{if $list}
|
||||
<fieldset>
|
||||
<legend>{l s='Severity levels'}</legend>
|
||||
<p>{l s='Meaning of severity levels:'}</p>
|
||||
<ol>
|
||||
<li style="color: green;">{l s='Informative only'}</li>
|
||||
<li style="color: orange;">{l s='Warning'}</li>
|
||||
<li style="color: orange;">{l s='Error'}</li>
|
||||
<li style="color: red;">{l s='Major issue (crash)'}</li>
|
||||
</ol>
|
||||
</fieldset>
|
||||
{/if}
|
||||
|
||||
{$list}
|
||||
<br />
|
||||
<h2>{l s='Logs by e-mail'}</h2>
|
||||
|
||||
{$options}
|
||||
+13
-15
@@ -659,8 +659,8 @@ class AdminControllerCore extends Controller
|
||||
*/
|
||||
public function displayForm($firstCall = true)
|
||||
{
|
||||
$this->initForm();
|
||||
$content = '';
|
||||
$content .= $this->initForm();
|
||||
$allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
|
||||
if ($allow_employee_form_lang && !$this->context->cookie->employee_form_lang)
|
||||
@@ -781,7 +781,6 @@ class AdminControllerCore extends Controller
|
||||
{
|
||||
$this->context->smarty->assign('display_header',$this->display_header);
|
||||
$this->context->smarty->assign('display_footer',$this->display_footer);
|
||||
$this->context->smarty->assign('content', $this->content);
|
||||
$this->context->smarty->assign('meta_title', $this->meta_title);
|
||||
|
||||
// Template override
|
||||
@@ -1030,17 +1029,18 @@ class AdminControllerCore extends Controller
|
||||
{
|
||||
if (!($this->object = $this->loadObject(true)))
|
||||
return;
|
||||
$this->initForm();
|
||||
$content .= $this->initForm();
|
||||
}
|
||||
else if ($this->display != 'view')
|
||||
{
|
||||
$this->initList();
|
||||
$this->initOptions();
|
||||
$content .= $this->initList();
|
||||
$content .= $this->initOptions();
|
||||
}
|
||||
$this->context->smarty->assign(array(
|
||||
'table' => $this->table,
|
||||
'current' => self::$currentIndex,
|
||||
'token' => $this->token,
|
||||
'content', $this->content
|
||||
));
|
||||
}
|
||||
|
||||
@@ -1073,7 +1073,8 @@ class AdminControllerCore extends Controller
|
||||
return false;
|
||||
$this->getList($this->context->language->id);
|
||||
|
||||
if (!($this->_list && is_array($this->_list)))
|
||||
// Empty list is ok
|
||||
if (!is_array($this->_list))
|
||||
return false;
|
||||
|
||||
$helper = new HelperList();
|
||||
@@ -1110,7 +1111,7 @@ class AdminControllerCore extends Controller
|
||||
|
||||
// For each action, try to add the corresponding skip elements list
|
||||
$helper->list_skip_actions = $this->list_skip_actions;
|
||||
$this->content .= $helper->generateList($this->_list, $this->fieldsDisplay);
|
||||
return $helper->generateList($this->_list, $this->fieldsDisplay);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1142,11 +1143,8 @@ class AdminControllerCore extends Controller
|
||||
$this->context->smarty->assign('back', Tools::safeOutput(Tools::getValue(self::$currentIndex.'&token='.$this->token)));
|
||||
}
|
||||
|
||||
$this->content .= $helper->generateForm($this->fields_form);
|
||||
return $helper->generateForm($this->fields_form);
|
||||
}
|
||||
// TODO delete when all forms use the helper
|
||||
// else
|
||||
// $this->content .= $this->displayForm();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1164,7 +1162,7 @@ class AdminControllerCore extends Controller
|
||||
$helper->token = $this->token;
|
||||
$helper->table = $this->table;
|
||||
$helper->currentIndex = self::$currentIndex;
|
||||
$this->content .= $helper->generateOptions($this->options);
|
||||
return $helper->generateOptions($this->options);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1792,7 +1790,7 @@ class AdminControllerCore extends Controller
|
||||
|
||||
/**
|
||||
* Returns an array with selected shops and type (group or boutique shop)
|
||||
*
|
||||
*
|
||||
* @param string $table
|
||||
* @param int $id_object
|
||||
*/
|
||||
@@ -2197,10 +2195,10 @@ EOF;
|
||||
* @param string $ids Multilingual div ids in form
|
||||
* @param string $id Current div id]
|
||||
* @param boolean $use_vars_instead_of_ids use an js vars instead of ids seperate by "¤"
|
||||
*
|
||||
*
|
||||
* @todo : delete return params :
|
||||
* @param return define the return way : false for a display, true for a return
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTranslationsFlags($languages, $default_language, $ids, $id, $return = false, $use_vars_instead_of_ids = false)
|
||||
|
||||
@@ -72,7 +72,7 @@ class AdminAddressesControllerCore extends AdminController
|
||||
foreach ($countries AS $country)
|
||||
$this->countriesArray[$country['id_country']] = $country['name'];
|
||||
|
||||
parent::initList();
|
||||
return parent::initList();
|
||||
}
|
||||
|
||||
public function initForm()
|
||||
@@ -272,7 +272,7 @@ class AdminAddressesControllerCore extends AdminController
|
||||
// merge address format with the rest of the form
|
||||
array_splice($this->fields_form['input'], 3, 0, $temp_fields);
|
||||
|
||||
parent::initForm();
|
||||
return parent::initForm();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
|
||||
@@ -89,7 +89,7 @@ class AdminAliasesControllerCore extends AdminController
|
||||
|
||||
$this->fields_value = array('alias' => $this->object->getAliases());
|
||||
|
||||
parent::initForm();
|
||||
return parent::initForm();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
|
||||
@@ -136,7 +136,7 @@ class AdminCarriersControllerCore extends AdminController
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'carrier_lang` b ON a.id_carrier = b.id_carrier';
|
||||
$this->_where = 'AND b.id_lang = '.$this->context->language->id;
|
||||
|
||||
parent::initList();
|
||||
return parent::initList();
|
||||
}
|
||||
|
||||
public function initForm()
|
||||
@@ -357,7 +357,7 @@ class AdminCarriersControllerCore extends AdminController
|
||||
'class' => 'button'
|
||||
);
|
||||
|
||||
parent::initForm();
|
||||
return parent::initForm();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
|
||||
@@ -111,7 +111,7 @@ class AdminContactsControllerCore extends AdminController
|
||||
)
|
||||
);
|
||||
|
||||
parent::initForm();
|
||||
return parent::initForm();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ class AdminCountriesControllerCore extends AdminController
|
||||
$this->_select = 'z.`name` AS zone';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'zone` z ON (z.`id_zone` = a.`id_zone`)';
|
||||
|
||||
parent::initList();
|
||||
return parent::initList();
|
||||
}
|
||||
|
||||
public function initForm()
|
||||
@@ -353,7 +353,7 @@ class AdminCountriesControllerCore extends AdminController
|
||||
'class' => 'button'
|
||||
);
|
||||
|
||||
parent::initForm();
|
||||
return parent::initForm();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
|
||||
@@ -102,7 +102,7 @@ class AdminEmployeesControllerCore extends AdminController
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'profile` p ON a.`id_profile` = p.`id_profile`
|
||||
LEFT JOIN `'._DB_PREFIX_.'profile_lang` pl ON (pl.`id_profile` = p.`id_profile` AND pl.`id_lang` = '.(int)$this->context->language->id.')';
|
||||
|
||||
parent::initList();
|
||||
return parent::initList();
|
||||
}
|
||||
|
||||
public function initForm()
|
||||
@@ -293,7 +293,7 @@ class AdminEmployeesControllerCore extends AdminController
|
||||
$this->fields_value['shop'][$row['id_shop']][] = $row[$this->identifier];
|
||||
}
|
||||
|
||||
parent::initForm();
|
||||
return parent::initForm();
|
||||
}
|
||||
|
||||
protected function _childValidation()
|
||||
|
||||
@@ -167,7 +167,7 @@ class AdminGendersController extends AdminController
|
||||
'image' => $obj->getImage()
|
||||
);
|
||||
|
||||
parent::initForm();
|
||||
return parent::initForm();
|
||||
}
|
||||
|
||||
public function displayGenderType($value, $tr)
|
||||
|
||||
@@ -172,7 +172,7 @@ class AdminGroupShopControllerCore extends AdminController
|
||||
'defaultGroup' => Shop::getInstance(Configuration::get('PS_SHOP_DEFAULT'))->getGroupID()
|
||||
));
|
||||
|
||||
parent::initForm();
|
||||
return parent::initForm();
|
||||
|
||||
$import_data = array(
|
||||
'attribute_group' => $this->l('Attribute groups'),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -25,63 +25,61 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
|
||||
|
||||
class AdminLogs extends AdminTab
|
||||
class AdminLogsControllerCore extends AdminController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'log';
|
||||
$this->className = 'Logger';
|
||||
$this->lang = false;
|
||||
$this->edit = false;
|
||||
$this->delete = true;
|
||||
$this->noLink = true;
|
||||
$this->view = false;
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_log' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'severity' => array('title' => $this->l('Severity (1-4)'), 'align' => 'center', 'width' => 50),
|
||||
'message' => array('title' => $this->l('Message'), 'width' => 377),
|
||||
'object_type' => array('title' => $this->l('Object type'), 'width' => 75),
|
||||
'object_id' => array('title' => $this->l('Object ID'), 'width' => 50),
|
||||
'error_code' => array('title' => $this->l('Error code'), 'width' => 75, 'prefix' => '0x'),
|
||||
'date_add' => array('title' => $this->l('Date'), 'width' => 35, 'align' => 'right', 'type' => 'datetime'));
|
||||
|
||||
$this->optionsList = array(
|
||||
$this->addRowAction('delete');
|
||||
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_log' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'severity' => array('title' => $this->l('Severity (1-4)'), 'align' => 'center', 'width' => 50),
|
||||
'message' => array('title' => $this->l('Message'), 'width' => 377),
|
||||
'object_type' => array('title' => $this->l('Object type'), 'width' => 75),
|
||||
'object_id' => array('title' => $this->l('Object ID'), 'width' => 50),
|
||||
'error_code' => array('title' => $this->l('Error code'), 'width' => 75, 'prefix' => '0x'),
|
||||
'date_add' => array('title' => $this->l('Date'), 'width' => 35, 'align' => 'right', 'type' => 'datetime')
|
||||
);
|
||||
|
||||
$this->options = array(
|
||||
'general' => array(
|
||||
'title' => $this->l('Logs by e-mail'),
|
||||
'fields' => array(
|
||||
'PS_LOGS_BY_EMAIL' => array(
|
||||
'title' => $this->l('Minimum severity level:'),
|
||||
'desc' => $this->l('Put "5" if you don\'t want to receive any emails.').'<br />'.$this->l('Emails will be sent to the shop owner.'),
|
||||
'cast' => 'intval',
|
||||
'type' => 'text',
|
||||
'title' => $this->l('Minimum severity level:'),
|
||||
'desc' => $this->l('Put "5" if you don\'t want to receive any emails.').'<br />'.$this->l('Emails will be sent to the shop owner.'),
|
||||
'cast' => 'intval',
|
||||
'type' => 'text',
|
||||
'size' => 5
|
||||
),
|
||||
),
|
||||
'submit' => array()
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function displayListHeader($token = NULL)
|
||||
{
|
||||
echo '
|
||||
<fieldset>
|
||||
<legend>'.$this->l('Severity levels').'</legend>
|
||||
<p>'.$this->l('Here\'s the meaning of severity levels:').'</p>
|
||||
<ol>
|
||||
<li style="color: green;">'.$this->l('Informative only').'</li>
|
||||
<li style="color: orange;">'.$this->l('Warning').'</li>
|
||||
<li style="color: orange;">'.$this->l('Error').'</li>
|
||||
<li style="color: red;">'.$this->l('Major issue (crash)').'</li>
|
||||
</ol>
|
||||
</fieldset>';
|
||||
|
||||
parent::displayListHeader();
|
||||
|
||||
/**
|
||||
* Assign smarty variables for all default views, list and form, then call other init functions
|
||||
*/
|
||||
public function initContent()
|
||||
{
|
||||
$this->context->smarty->assign(array(
|
||||
'table' => $this->table,
|
||||
'current' => self::$currentIndex,
|
||||
'token' => $this->token,
|
||||
'list' => $this->initList(),
|
||||
'options' => $this->initOptions()
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -189,7 +189,7 @@ class AdminProductsController extends AdminController
|
||||
if (Tools::isSubmit('submitAddproduct') || Tools::isSubmit('submitAddproductAndStay') || Tools::isSubmit('submitAddProductAndPreview'))
|
||||
{
|
||||
$id_product = Tools::getValue('id_product');
|
||||
if (($id_product && $this->tabAccess['edit'] === '1')
|
||||
if (($id_product && $this->tabAccess['edit'] === '1')
|
||||
|| ($this->tabAccess['add'] == 1 && Tools::isSubmit('submitAddproduct') && !$id_product)
|
||||
)
|
||||
$this->submitAddproduct($token);
|
||||
@@ -1370,50 +1370,50 @@ if (false)
|
||||
{
|
||||
$this->_errors[] = $this->l('the field').' <b>'.$this->l('expiration date').'</b> '.$this->l('is not valid');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The oos behavior MUST be "Deny orders" for virtual products
|
||||
if (Tools::getValue('out_of_stock') != 0)
|
||||
{
|
||||
$this->_errors[] = $this->l('The "when out of stock" behavior selection must be "deny order" for virtual products');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Trick's
|
||||
|
||||
// Trick's
|
||||
if ($edit == 1)
|
||||
{
|
||||
$id_product_download_attibute = ProductDownload::getIdFromIdAttribute((int) $product->id, $id_product_attribute);
|
||||
$id_product_download = ($id_product_download_attibute) ? (int) $id_product_download_attibute : (int) Tools::getValue('virtual_product_id');
|
||||
}
|
||||
|
||||
|
||||
$is_shareable = Tools::getValue('virtual_product_is_shareable');
|
||||
$virtual_product_name = Tools::getValue('virtual_product_name');
|
||||
$virtual_product_filename = Tools::getValue('virtual_product_filename');
|
||||
$virtual_product_nb_days = Tools::getValue('virtual_product_nb_days');
|
||||
$virtual_product_nb_downloable = Tools::getValue('virtual_product_nb_downloable');
|
||||
$virtual_product_expiration_date = Tools::getValue('virtual_product_expiration_date');
|
||||
|
||||
|
||||
$is_shareable_attribute = Tools::getValue('virtual_product_is_shareable_attribute');
|
||||
$virtual_product_name_attribute = Tools::getValue('virtual_product_name_attribute');
|
||||
$virtual_product_filename_attribute = Tools::getValue('virtual_product_filename_attribute');
|
||||
$virtual_product_nb_days_attribute = Tools::getValue('virtual_product_nb_days_attribute');
|
||||
$virtual_product_nb_downloable_attribute = Tools::getValue('virtual_product_nb_downloable_attribute');
|
||||
$virtual_product_expiration_date_attribute = Tools::getValue('virtual_product_expiration_date_attribute');
|
||||
|
||||
|
||||
if (!empty($is_shareable_attribute))
|
||||
$is_shareable = $is_shareable_attribute;
|
||||
|
||||
|
||||
if (!empty($virtual_product_name_attribute))
|
||||
$virtual_product_name = $virtual_product_name_attribute;
|
||||
|
||||
|
||||
if (!empty($virtual_product_nb_days_attribute))
|
||||
$virtual_product_nb_days = $virtual_product_nb_days_attribute;
|
||||
|
||||
|
||||
if (!empty($virtual_product_nb_downloable_attribute))
|
||||
$virtual_product_nb_downloable = $virtual_product_nb_downloable_attribute;
|
||||
|
||||
$virtual_product_nb_downloable = $virtual_product_nb_downloable_attribute;
|
||||
|
||||
if (!empty($virtual_product_expiration_date_attribute))
|
||||
$virtual_product_expiration_date = $virtual_product_expiration_date_attribute;
|
||||
|
||||
@@ -1423,7 +1423,7 @@ if (false)
|
||||
$filename = $virtual_product_filename;
|
||||
else
|
||||
$filename = ProductDownload::getNewFilename();
|
||||
|
||||
|
||||
$download = new ProductDownload($id_product_download);
|
||||
$download->id_product = (int) $product->id;
|
||||
$download->id_product_attribute = (int) $id_product_attribute;
|
||||
@@ -1435,7 +1435,7 @@ if (false)
|
||||
$download->nb_downloadable = (int) $virtual_product_nb_downloable;
|
||||
$download->active = 1;
|
||||
$download->is_shareable = (int) $is_shareable;
|
||||
|
||||
|
||||
if ($download->save())
|
||||
return true;
|
||||
}
|
||||
@@ -1449,7 +1449,7 @@ if (false)
|
||||
}
|
||||
else
|
||||
$id_product_download = ProductDownload::getIdFromIdProduct($product->id);
|
||||
|
||||
|
||||
if (!empty($id_product_download))
|
||||
{
|
||||
$productDownload = new ProductDownload($id_product_download);
|
||||
@@ -1460,7 +1460,7 @@ if (false)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public function deleteDownloadProduct($id_product_attribute = NULL)
|
||||
{
|
||||
if (!empty($id_product_attribute))
|
||||
@@ -1472,7 +1472,7 @@ if (false)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update product accessories
|
||||
*
|
||||
@@ -1527,7 +1527,7 @@ if (false)
|
||||
$languages = Language::getLanguages(false);
|
||||
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
|
||||
$product = new Product((int)(Tools::getValue('id_product')));
|
||||
$this->initForm();
|
||||
$content .= $this->initForm();
|
||||
return $this->{'initForm'.$this->action}($product, $languages, $defaultLanguage);
|
||||
}
|
||||
}
|
||||
@@ -1557,7 +1557,7 @@ if (false)
|
||||
{
|
||||
// $all_cats[$categ['id_parent']]
|
||||
$categ = new Category($categ['id_category'],$this->context->language->id);
|
||||
$select_child .= '<option value="'.$categ->id.'" '.($this->_category->id_category == $categ->id
|
||||
$select_child .= '<option value="'.$categ->id.'" '.($this->_category->id_category == $categ->id
|
||||
? 'selected="selected" class="selected level-depth-'.$categ->level_depth.'"'
|
||||
:'class="level-depth-'.$categ->level_depth.'"')
|
||||
.'>' . str_repeat(' - ',$categ->level_depth). $categ->name .' ('.$categ->id.')</option>';
|
||||
@@ -1581,7 +1581,7 @@ if (false)
|
||||
}
|
||||
parent::initContent();
|
||||
}
|
||||
|
||||
|
||||
public function ajaxProcessProductManufacturers()
|
||||
{
|
||||
$manufacturers = Manufacturer::getManufacturers();
|
||||
@@ -1707,7 +1707,6 @@ if (false)
|
||||
|
||||
public function initForm()
|
||||
{
|
||||
parent::initForm();
|
||||
$this->addJqueryUI('ui.datepicker');
|
||||
$this->context->smarty->assign('pos_select', (($tab = Tools::getValue('tabs')) ? $tab : '0'));
|
||||
$this->context->smarty->assign('token',$this->token);
|
||||
@@ -1719,6 +1718,7 @@ if (false)
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
throw new Exception('object not loaded');
|
||||
$this->_displayDraftWarning($obj->active);
|
||||
return parent::initForm();
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
@@ -1747,14 +1747,14 @@ if (false)
|
||||
$currency = Tools::setCurrency($this->context->cookie);
|
||||
// if ($obj->id)
|
||||
// self::$currentIndex .= '&id_product='.$obj->id;
|
||||
|
||||
|
||||
|
||||
// $this->addJqueryPlugin('tabpane');
|
||||
|
||||
$action = $this->action;
|
||||
if (empty($action) || !method_exists($this,'initForm'.$action))
|
||||
$action = 'informations';
|
||||
$this->initForm();
|
||||
$content .= $this->initForm();
|
||||
$this->{'initForm'.$action}($obj, null);
|
||||
/* Tabs */
|
||||
/*
|
||||
@@ -1767,13 +1767,13 @@ switch ($this->action)
|
||||
*/
|
||||
if (Combination::isFeatureActive())
|
||||
$smarty->assign('countAttributes', Db::getInstance()->getValue('SELECT COUNT(id_product) FROM '._DB_PREFIX_.'product_attribute WHERE id_product = '.(int)$obj->id));
|
||||
|
||||
|
||||
$smarty->assign('countAttachments', Db::getInstance()->getValue('SELECT COUNT(id_product) FROM '._DB_PREFIX_.'product_attachment WHERE id_product = '.(int)$obj->id));
|
||||
|
||||
if (Tools::getValue('id_category') > 1)
|
||||
{
|
||||
$productIndex = preg_replace('/(&id_product=[0-9]*)/', '', self::$currentIndex);
|
||||
/** @TODO
|
||||
/** @TODO
|
||||
$this->content .= '
|
||||
<br /><br />
|
||||
<a href="'.$productIndex.($this->token ? '&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id) : '').'">
|
||||
@@ -2206,7 +2206,7 @@ switch ($this->action)
|
||||
$content .= parent::displayForm();
|
||||
|
||||
$has_attribute = $obj->hasAttributes();
|
||||
// @FIXME Stock, need to use StockManagerFactory
|
||||
// @FIXME Stock, need to use StockManagerFactory
|
||||
$qty = 0;
|
||||
$cover = Product::getCover($obj->id);
|
||||
$this->_applyTaxToEcotax($obj);
|
||||
@@ -2222,18 +2222,18 @@ switch ($this->action)
|
||||
$this->displayInitInformationAndAttachment();
|
||||
if(!$productDownload->id || !$productDownload->active)
|
||||
$hidden = 'style="display:none;"';
|
||||
|
||||
|
||||
$cache_default_attribute = (int) $this->getFieldValue($obj, 'cache_default_attribute');
|
||||
$is_virtual = (int) $this->getFieldValue($obj, 'is_virtual');
|
||||
|
||||
if($is_virtual && $productDownload->active)
|
||||
if($is_virtual && $productDownload->active)
|
||||
$check = 'checked="checked"';
|
||||
|
||||
if($is_virtual)
|
||||
|
||||
if($is_virtual)
|
||||
$virtual = 1;
|
||||
else
|
||||
$virtual = 0;
|
||||
|
||||
|
||||
$preview_url = '';
|
||||
if (isset($obj->id))
|
||||
{
|
||||
@@ -2440,7 +2440,7 @@ switch ($this->action)
|
||||
}
|
||||
|
||||
$content .= '<input type="radio" value="1" id="virtual_good_file_1" name="is_virtual_file" '.$check_yes.'/>'. $this->l('Yes').'
|
||||
<input type="radio" value="0" id="virtual_good_file_2" name="is_virtual_file" '.$check_no.'/>'.$this->l('No').'<br /><br />';
|
||||
<input type="radio" value="0" id="virtual_good_file_2" name="is_virtual_file" '.$check_no.'/>'.$this->l('No').'<br /><br />';
|
||||
|
||||
if (!file_exists($exists_file) && !empty($productDownload->display_filename) && empty($cache_default_attribute))
|
||||
{
|
||||
@@ -2500,7 +2500,7 @@ switch ($this->action)
|
||||
|
||||
</div>';
|
||||
|
||||
if (!$productDownload->id || !$productDownload->active)
|
||||
if (!$productDownload->id || !$productDownload->active)
|
||||
$hidden = 'display:none;';
|
||||
|
||||
$nb_downloadable = ($productDownload->id > 0) ? $productDownload->nb_downloadable : htmlentities(Tools::getValue('virtual_product_nb_downloable'), ENT_COMPAT, 'UTF-8');
|
||||
@@ -2681,8 +2681,8 @@ switch ($this->action)
|
||||
'.($currency->format % 2 != 0 ? ' '.$currency->sign : '').' <input size="11" maxlength="14" id="priceTI" type="text" value="" onchange="noComma(\'priceTI\');" onkeyup="if (isArrowKey(event)) return; calcPriceTE();" />'.($currency->format % 2 == 0 ? ' '.$currency->sign : '').'
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
$content .= '<input size="11" maxlength="14" id="priceTI" type="hidden" value="" onchange="noComma(\'priceTI\');" onkeyup="if (isArrowKey(event)) return; calcPriceTE();" />';
|
||||
|
||||
$content .= '
|
||||
@@ -2795,7 +2795,7 @@ switch ($this->action)
|
||||
</tr>
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
$content .= '
|
||||
<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>
|
||||
<tr>
|
||||
@@ -3672,7 +3672,7 @@ switch ($this->action)
|
||||
return;
|
||||
}
|
||||
$content = '';
|
||||
|
||||
|
||||
$attributeJs = array();
|
||||
$attributes = Attribute::getAttributes($this->context->language->id, true);
|
||||
foreach ($attributes as $k => $attribute)
|
||||
@@ -3680,12 +3680,12 @@ switch ($this->action)
|
||||
$currency = $this->context->currency;
|
||||
$attributes_groups = AttributeGroup::getAttributesGroups($this->context->language->id);
|
||||
$default_country = new Country((int)Configuration::get('PS_COUNTRY_DEFAULT'));
|
||||
|
||||
|
||||
$productDownload = new ProductDownload();
|
||||
$id_product_download = (int) $productDownload->getIdFromIdProduct($this->getFieldValue($obj, 'id'));
|
||||
if (!empty($id_product_download))
|
||||
$productDownload = new ProductDownload($id_product_download);
|
||||
|
||||
$productDownload = new ProductDownload($id_product_download);
|
||||
|
||||
$images = Image::getImages($this->context->language->id, $obj->id);
|
||||
if ($obj->id)
|
||||
{
|
||||
@@ -3696,7 +3696,7 @@ switch ($this->action)
|
||||
updateMvtStatus($(this).val());
|
||||
});
|
||||
updateMvtStatus($(this).val());
|
||||
|
||||
|
||||
if ( $("input[name=is_virtual_file]:checked").val() == 1)
|
||||
{
|
||||
$("#virtual_good_attributes").show();
|
||||
@@ -3707,7 +3707,7 @@ switch ($this->action)
|
||||
$("#virtual_good_attributes").hide();
|
||||
$("#is_virtual_file_product").hide();
|
||||
}
|
||||
|
||||
|
||||
$("input[name=is_virtual_file]").live("change", function() {
|
||||
if($(this).val() == "1")
|
||||
{
|
||||
@@ -3720,7 +3720,7 @@ switch ($this->action)
|
||||
$("#is_virtual_file_product").hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<table cellpadding="5">
|
||||
<tr>
|
||||
@@ -3759,7 +3759,7 @@ switch ($this->action)
|
||||
<select id="product_att_list" name="attribute_combinaison_list[]" multiple="multiple" size="4" style="width: 320px;"></select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr><td colspan="2"><hr style="width:100%;" /></td></tr>
|
||||
<tr>
|
||||
<td style="width:150px;vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">'.$this->l('Reference:').'</td>
|
||||
@@ -3781,7 +3781,7 @@ switch ($this->action)
|
||||
<tr><td colspan="2"><hr style="width:100%;" /></td></tr>
|
||||
<table cellpadding="5" id="virtual_good_attributes" style="width:100%;display:none;">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<td colspan="2">
|
||||
<div style="padding:5px;width:50%;float:left;margin-right:20px;border-right:1px solid #E0D0B1">
|
||||
<p>'.$this->l('Your server\'s maximum upload file size is') . ': ' . ini_get('upload_max_filesize').'</p>
|
||||
<label id="virtual_product_file_attribute_label" for="virtual_product_file_attribute" class="t">'.$this->l('Upload a file').'</label>
|
||||
@@ -3790,13 +3790,13 @@ switch ($this->action)
|
||||
|
||||
$content .= '<p id="gethtmlink" style="display: none;">'.$this->l('This is the link').': '.$productDownload->getHtmlLink(false, true).'
|
||||
<a id="make_downloadable_product_attribute" onclick="return confirm(\''.addslashes($this->l('Delete this file')).'\')" href="'.$_SERVER['HTTP_REFERER'].'&deleteVirtualProductAttribute=true'.'" class="red">'.$this->l('Delete this file').'</a></p>';
|
||||
|
||||
|
||||
$content .= '</div>
|
||||
<a id="delete_downloadable_product_attribute" style="display:none;" onclick="return confirm(\''.addslashes($this->l('Delete this file')).'\')" href="'.$_SERVER['HTTP_REFERER'].'&deleteVirtualProductAttribute=true" class="red">'.$this->l('Delete this file').'</a>';
|
||||
|
||||
|
||||
if ($up_filename = strval(Tools::getValue('virtual_product_filename_attribute')))
|
||||
$content .= '<input type="hidden" id="virtual_product_filename_attribute" name="virtual_product_filename_attribute" value="'.$up_filename.'" />';
|
||||
|
||||
|
||||
$content .= '<p class="block">
|
||||
<label for="virtual_product_name" class="t">'.$this->l('Filename').'</label>
|
||||
<input id="virtual_product_name_attribute" name="virtual_product_name_attribute" style="width:200px" value="" type="text">
|
||||
@@ -3969,7 +3969,7 @@ switch ($this->action)
|
||||
<th>'.$this->l('UPC').'</th>
|
||||
<th class="center">'.$this->l('Quantity').'</th>';
|
||||
|
||||
|
||||
|
||||
if ($id_product_download && !empty($productDownload->display_filename))
|
||||
{
|
||||
$content .= '
|
||||
@@ -3978,7 +3978,7 @@ switch ($this->action)
|
||||
<th class="center virtual_header">'.$this->l('Number of days').'</th>
|
||||
<th class="center virtual_header">'.$this->l('Share').'</th>';
|
||||
}
|
||||
|
||||
|
||||
$content .= '<th class="center">'.$this->l('Actions').'</th>
|
||||
</tr>';
|
||||
if ($obj->id)
|
||||
@@ -4035,12 +4035,12 @@ switch ($this->action)
|
||||
$id_product_download = $productDownload->getIdFromIdAttribute((int) $obj->id, (int) $id_product_attribute);
|
||||
if ($id_product_download)
|
||||
$productDownload = new ProductDownload($id_product_download);
|
||||
|
||||
|
||||
$available_date_attribute = substr($productDownload->date_expiration, 0, -9);
|
||||
|
||||
|
||||
if ($available_date_attribute == '0000-00-00')
|
||||
$available_date_attribute = '';
|
||||
|
||||
$available_date_attribute = '';
|
||||
|
||||
if ($productDownload->is_shareable == 1)
|
||||
$is_shareable = $this->l('Yes');
|
||||
else
|
||||
@@ -4055,7 +4055,7 @@ switch ($this->action)
|
||||
<td class="right">'.$product_attribute['ean13'].'</td>
|
||||
<td class="right">'.$product_attribute['upc'].'</td>
|
||||
<td class="center">'.$product_attribute['quantity'].'</td>';
|
||||
|
||||
|
||||
if ($id_product_download && !empty($productDownload->display_filename))
|
||||
{
|
||||
$content .= '<td class="right">'.$productDownload->getHtmlLink(false, true).'</td>
|
||||
@@ -4063,19 +4063,19 @@ switch ($this->action)
|
||||
<td class="center">'.$productDownload->nb_downloadable.'</td>
|
||||
<td class="right">'.$is_shareable.'</td>';
|
||||
}
|
||||
|
||||
|
||||
$exists_file = realpath(_PS_DOWNLOAD_DIR_).'/'.$productDownload->filename;
|
||||
|
||||
|
||||
if ($productDownload->id && file_exists($exists_file))
|
||||
$filename = $productDownload->filename;
|
||||
else
|
||||
$filename = '';
|
||||
|
||||
|
||||
$content .= '<td class="center">
|
||||
<a style="cursor: pointer;">
|
||||
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this combination').'"
|
||||
onclick="javascript:fillCombinaison(\''.$product_attribute['wholesale_price'].'\', \''.$product_attribute['price'].'\', \''.$product_attribute['weight'].'\', \''.$product_attribute['unit_impact'].'\', \''.$product_attribute['reference'].'\', \''.$product_attribute['supplier_reference'].'\', \''.$product_attribute['ean13'].'\',
|
||||
\''.$product_attribute['quantity'].'\', \''.($attrImage ? $attrImage->id : 0).'\', Array('.$jsList.'), \''.$id_product_attribute.'\', \''.$product_attribute['default_on'].'\', \''.$product_attribute['ecotax'].'\', \''.$product_attribute['location'].'\', \''.$product_attribute['upc'].'\', \''.$product_attribute['minimal_quantity'].'\', \''.$available_date.'\',
|
||||
\''.$product_attribute['quantity'].'\', \''.($attrImage ? $attrImage->id : 0).'\', Array('.$jsList.'), \''.$id_product_attribute.'\', \''.$product_attribute['default_on'].'\', \''.$product_attribute['ecotax'].'\', \''.$product_attribute['location'].'\', \''.$product_attribute['upc'].'\', \''.$product_attribute['minimal_quantity'].'\', \''.$available_date.'\',
|
||||
\''.$productDownload->display_filename.'\', \''.$filename.'\', \''.$productDownload->nb_downloadable.'\', \''.$available_date_attribute.'\', \''.$productDownload->nb_days_accessible.'\', \''.$productDownload->is_shareable.'\'); calcImpactPriceTI();" /></a>
|
||||
'.(!$product_attribute['default_on'] ? '<a href="'.self::$currentIndex.'&defaultProductAttribute&id_product_attribute='.$id_product_attribute.'&id_product='.$obj->id.'&'.(Tools::isSubmit('id_category') ? 'id_category='.(int)(Tools::getValue('id_category')).'&' : '&').'token='.Tools::getAdminToken('AdminProducts'.(int)(Tab::getIdFromClassName('AdminProducts')).$this->context->employee->id).'">
|
||||
<img src="../img/admin/asterisk.gif" alt="'.$this->l('Make this the default combination').'" title="'.$this->l('Make this combination the default one').'"></a>' : '').'
|
||||
|
||||
@@ -63,7 +63,7 @@ class AdminShopUrlControllerCore extends AdminController
|
||||
$this->_select = 's.name AS shop_name, CONCAT(a.physical_uri, a.virtual_uri) AS uri';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'shop` s ON (s.id_shop = a.id_shop)';
|
||||
|
||||
parent::initList();
|
||||
return parent::initList();
|
||||
}
|
||||
|
||||
public function initForm()
|
||||
@@ -194,7 +194,7 @@ class AdminShopUrlControllerCore extends AdminController
|
||||
'physical_uri' => Validate::isLoadedObject($obj) ? $this->getFieldValue($obj, 'physical_uri') : $current_shop->physical_uri
|
||||
);
|
||||
|
||||
parent::initForm();
|
||||
return parent::initForm();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
|
||||
@@ -59,7 +59,7 @@ class AdminStatesControllerCore extends AdminController
|
||||
$this->_select = 'z.`name` AS zone';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'zone` z ON (z.`id_zone` = a.`id_zone`)';
|
||||
|
||||
parent::initList();
|
||||
return parent::initList();
|
||||
}
|
||||
|
||||
public function initForm()
|
||||
@@ -143,7 +143,7 @@ class AdminStatesControllerCore extends AdminController
|
||||
)
|
||||
);
|
||||
|
||||
parent::initForm();
|
||||
return parent::initForm();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
|
||||
@@ -126,7 +126,7 @@ class AdminStoresControllerCore extends AdminController
|
||||
LEFT JOIN `'._DB_PREFIX_.'state` st
|
||||
ON (st.`id_state` = a.`id_state`)';
|
||||
|
||||
parent::initList();
|
||||
return parent::initList();
|
||||
}
|
||||
|
||||
public function initForm()
|
||||
@@ -291,7 +291,7 @@ class AdminStoresControllerCore extends AdminController
|
||||
'hours' => isset($hours_unserialized) ? $hours_unserialized : false
|
||||
);
|
||||
|
||||
parent::initForm();
|
||||
return parent::initForm();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
|
||||
@@ -79,6 +79,8 @@ class AdminWarehousesControllerCore extends AdminController
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.id_employee = a.id_employee)
|
||||
LEFT JOIN `'._DB_PREFIX_.'address` ad ON (ad.id_address = a.id_address)
|
||||
LEFT JOIN `'._DB_PREFIX_.'country` c ON (c.id_country = ad.id_country)';
|
||||
|
||||
return parent::initList();
|
||||
}
|
||||
|
||||
public function initForm()
|
||||
@@ -262,6 +264,8 @@ class AdminWarehousesControllerCore extends AdminController
|
||||
'class' => 'button'
|
||||
)
|
||||
);
|
||||
|
||||
return parent::initForm();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
|
||||
Reference in New Issue
Block a user