Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into bootstrap
This commit is contained in:
@@ -153,35 +153,32 @@ class AdminAccessControllerCore extends AdminController
|
||||
$join = 'LEFT JOIN `'._DB_PREFIX_.'tab` t ON (t.`id_tab` = a.`id_tab`)';
|
||||
}
|
||||
|
||||
if ($id_tab == -1 && $perm == 'all' && $enabled == 0)
|
||||
$sql = '
|
||||
UPDATE `'._DB_PREFIX_.'access` a
|
||||
SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
|
||||
WHERE `id_profile` = '.(int)$id_profile.' AND `id_tab` != '.(int)$this->id_tab_access;
|
||||
else if ($id_tab == -1 && $perm == 'all')
|
||||
$sql = '
|
||||
if ($id_tab == -1)
|
||||
{
|
||||
if ($perm == 'all')
|
||||
$sql = '
|
||||
UPDATE `'._DB_PREFIX_.'access` a
|
||||
SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
|
||||
WHERE `id_profile` = '.(int)$id_profile;
|
||||
else if ($id_tab == -1)
|
||||
$sql = '
|
||||
else
|
||||
$sql = '
|
||||
UPDATE `'._DB_PREFIX_.'access` a
|
||||
SET `'.bqSQL($perm).'` = '.(int)$enabled.'
|
||||
WHERE `id_profile` = '.(int)$id_profile;
|
||||
else if ($perm == 'all')
|
||||
$sql = '
|
||||
UPDATE `'._DB_PREFIX_.'access` a
|
||||
'.$join.'
|
||||
SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
|
||||
WHERE '.$where.' = '.(int)$id_tab.'
|
||||
AND `id_profile` = '.(int)$id_profile;
|
||||
}
|
||||
else
|
||||
$sql = '
|
||||
UPDATE `'._DB_PREFIX_.'access` a
|
||||
'.$join.'
|
||||
{
|
||||
if ($perm == 'all')
|
||||
$sql = '
|
||||
UPDATE `'._DB_PREFIX_.'access` a '.$join.'
|
||||
SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
|
||||
WHERE '.$where.' = '.(int)$id_tab.' AND `id_profile` = '.(int)$id_profile;
|
||||
else
|
||||
$sql = '
|
||||
UPDATE `'._DB_PREFIX_.'access` a '.$join.'
|
||||
SET `'.bqSQL($perm).'` = '.(int)$enabled.'
|
||||
WHERE '.$where.' = '.(int)$id_tab.'
|
||||
AND `id_profile` = '.(int)$id_profile;
|
||||
WHERE '.$where.' = '.(int)$id_tab.' AND `id_profile` = '.(int)$id_profile;
|
||||
}
|
||||
|
||||
$res = Db::getInstance()->execute($sql) ? 'ok' : 'error';
|
||||
|
||||
|
||||
@@ -273,15 +273,15 @@ class AdminCartsControllerCore extends AdminController
|
||||
$field_id = 'customization_'.$id_product.'_'.$customization_field['id_customization_field'];
|
||||
if ($customization_field['type'] == Product::CUSTOMIZE_TEXTFIELD)
|
||||
{
|
||||
if (!isset($_POST[$field_id]) || empty($_POST[$field_id]))
|
||||
if (!Tools::getValue($field_id))
|
||||
{
|
||||
if ($customization_field['required'])
|
||||
$errors[] = Tools::displayError('Please fill in all the required fields.');
|
||||
continue;
|
||||
}
|
||||
if (!Validate::isMessage($_POST[$field_id]) || empty($_POST[$field_id]))
|
||||
if (!Validate::isMessage(Tools::getValue($field_id)))
|
||||
$errors[] = Tools::displayError('Invalid message');
|
||||
$this->context->cart->addTextFieldToProduct((int)$product->id, (int)$customization_field['id_customization_field'], Product::CUSTOMIZE_TEXTFIELD, $_POST[$field_id]);
|
||||
$this->context->cart->addTextFieldToProduct((int)$product->id, (int)$customization_field['id_customization_field'], Product::CUSTOMIZE_TEXTFIELD, Tools::getValue($field_id));
|
||||
}
|
||||
elseif ($customization_field['type'] == Product::CUSTOMIZE_FILE)
|
||||
{
|
||||
|
||||
@@ -549,7 +549,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
|
||||
$orders_ok[] = $order;
|
||||
$total_ok += $order['total_paid_real'];
|
||||
}
|
||||
$orders[$key]['date_add'] = Tools::displayDate($order['date_add'], $this->context->language->id);
|
||||
$orders[$key]['date_add'] = Tools::displayDate($order['date_add']);
|
||||
$orders[$key]['total_paid_real'] = Tools::displayPrice($order['total_paid_real'], new Currency((int)$order['id_currency']));
|
||||
}
|
||||
}
|
||||
@@ -557,7 +557,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
|
||||
$products = $customer->getBoughtProducts();
|
||||
if ($products && count($products))
|
||||
foreach ($products as $key => $product)
|
||||
$products[$key]['date_add'] = Tools::displayDate($product['date_add'],null , true);
|
||||
$products[$key]['date_add'] = Tools::displayDate($product['date_add'], null, true);
|
||||
}
|
||||
|
||||
foreach ($messages as $key => $message)
|
||||
@@ -595,7 +595,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
|
||||
if (!empty($message['id_product']) && empty($message['employee_name']))
|
||||
$id_order_product = Order::getIdOrderProduct((int)$message['id_customer'], (int)$message['id_product']);
|
||||
}
|
||||
$message['date_add'] = Tools::displayDate($message['date_add'],null , true);
|
||||
$message['date_add'] = Tools::displayDate($message['date_add'], null, true);
|
||||
$message['user_agent'] = strip_tags($message['user_agent']);
|
||||
$message['message'] = preg_replace(
|
||||
'/(https?:\/\/[a-z0-9#%&_=\(\)\.\? \+\-@\/]{6,1000})([\s\n<])/Uui',
|
||||
|
||||
@@ -165,6 +165,15 @@ class AdminEmailsControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
|
||||
public function updateOptionPsMailPasswd($value)
|
||||
{
|
||||
if (Tools::getValue('PS_MAIL_PASSWD') == '' && Configuration::get('PS_MAIL_PASSWD'))
|
||||
return true;
|
||||
else
|
||||
Configuration::updateValue('PS_MAIL_PASSWD', Tools::getValue('PS_MAIL_PASSWD'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* AdminController::initContent() override
|
||||
* @see AdminController::initContent()
|
||||
|
||||
@@ -297,7 +297,7 @@ class AdminEmployeesControllerCore extends AdminController
|
||||
}
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Profile:'),
|
||||
'label' => $this->l('Profile Permission:'),
|
||||
'name' => 'id_profile',
|
||||
'required' => true,
|
||||
'options' => array(
|
||||
|
||||
@@ -53,7 +53,7 @@ class AdminImagesControllerCore extends AdminController
|
||||
);
|
||||
|
||||
// No need to display the old image system if the install has been made later than 2013-03-26
|
||||
$this->display_move = (defined('_PS_CREATION_DATE_') && strtotime(_PS_CREATION_DATE_) > strtotime('2013-03-26')) ? false : true;
|
||||
$this->display_move = (!Configuration::get('PS_LEGACY_IMAGES') && defined('_PS_CREATION_DATE_') && strtotime(_PS_CREATION_DATE_) > strtotime('2013-03-26')) ? false : true;
|
||||
|
||||
$this->fields_options = array(
|
||||
'images' => array(
|
||||
@@ -62,7 +62,7 @@ class AdminImagesControllerCore extends AdminController
|
||||
'top' => '',
|
||||
'bottom' => '',
|
||||
'description' => $this->l('JPEG images have a small file size and standard quality. PNG images have a larger file size, a higher quality and support transparency. Note that in all cases the image files will have the .jpg extension.').'
|
||||
<br /><br />'.$this->l('WARNING: This feature may not be compatible with your theme, or with some of your modules. In particular, PNG mode is not compatible with the Watermark module. If you encounter any issues, turn it off by selecting "Use JPEG".'),
|
||||
<br /><br />'.$this->l('WARNING: This feature may not be compatible with your theme, or with some of your modules. In particular, PNG mode is not compatible with the Watermark module. If you encounter any issues, turn it off by selecting "Use JPEG".'),
|
||||
'fields' => array(
|
||||
'PS_IMAGE_QUALITY' => array(
|
||||
'title' => $this->l('Image quality'),
|
||||
|
||||
@@ -440,6 +440,7 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Zip Code/Postal Code'),
|
||||
'name' => 'postcode',
|
||||
'required' => true,
|
||||
'size' => 33,
|
||||
'required' => false,
|
||||
);
|
||||
|
||||
@@ -1048,16 +1048,17 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
$cart_rules = array();
|
||||
$discount_value = (float)str_replace(',', '.', Tools::getValue('discount_value'));
|
||||
switch (Tools::getValue('discount_type'))
|
||||
{
|
||||
// Percent type
|
||||
case 1:
|
||||
if (Tools::getValue('discount_value') < 100)
|
||||
if ($discount_value < 100)
|
||||
{
|
||||
if (isset($order_invoice))
|
||||
{
|
||||
$cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round($order_invoice->total_paid_tax_incl * Tools::getValue('discount_value') / 100, 2);
|
||||
$cart_rules[$order_invoice->id]['value_tax_excl'] = Tools::ps_round($order_invoice->total_paid_tax_excl * Tools::getValue('discount_value') / 100, 2);
|
||||
$cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round($order_invoice->total_paid_tax_incl * $discount_value / 100, 2);
|
||||
$cart_rules[$order_invoice->id]['value_tax_excl'] = Tools::ps_round($order_invoice->total_paid_tax_excl * $discount_value / 100, 2);
|
||||
|
||||
// Update OrderInvoice
|
||||
$this->applyDiscountOnInvoice($order_invoice, $cart_rules[$order_invoice->id]['value_tax_incl'], $cart_rules[$order_invoice->id]['value_tax_excl']);
|
||||
@@ -1067,8 +1068,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$order_invoices_collection = $order->getInvoicesCollection();
|
||||
foreach ($order_invoices_collection as $order_invoice)
|
||||
{
|
||||
$cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round($order_invoice->total_paid_tax_incl * Tools::getValue('discount_value') / 100, 2);
|
||||
$cart_rules[$order_invoice->id]['value_tax_excl'] = Tools::ps_round($order_invoice->total_paid_tax_excl * Tools::getValue('discount_value') / 100, 2);
|
||||
$cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round($order_invoice->total_paid_tax_incl * $discount_value / 100, 2);
|
||||
$cart_rules[$order_invoice->id]['value_tax_excl'] = Tools::ps_round($order_invoice->total_paid_tax_excl * $discount_value / 100, 2);
|
||||
|
||||
// Update OrderInvoice
|
||||
$this->applyDiscountOnInvoice($order_invoice, $cart_rules[$order_invoice->id]['value_tax_incl'], $cart_rules[$order_invoice->id]['value_tax_excl']);
|
||||
@@ -1076,8 +1077,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
else
|
||||
{
|
||||
$cart_rules[0]['value_tax_incl'] = Tools::ps_round($order->total_paid_tax_incl * Tools::getValue('discount_value') / 100, 2);
|
||||
$cart_rules[0]['value_tax_excl'] = Tools::ps_round($order->total_paid_tax_excl * Tools::getValue('discount_value') / 100, 2);
|
||||
$cart_rules[0]['value_tax_incl'] = Tools::ps_round($order->total_paid_tax_incl * $discount_value / 100, 2);
|
||||
$cart_rules[0]['value_tax_excl'] = Tools::ps_round($order->total_paid_tax_excl * $discount_value / 100, 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1087,12 +1088,12 @@ class AdminOrdersControllerCore extends AdminController
|
||||
case 2:
|
||||
if (isset($order_invoice))
|
||||
{
|
||||
if (Tools::getValue('discount_value') > $order_invoice->total_paid_tax_incl)
|
||||
if ($discount_value > $order_invoice->total_paid_tax_incl)
|
||||
$this->errors[] = Tools::displayError('The discount value is greater than the order invoice total.');
|
||||
else
|
||||
{
|
||||
$cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round(Tools::getValue('discount_value'), 2);
|
||||
$cart_rules[$order_invoice->id]['value_tax_excl'] = Tools::ps_round(Tools::getValue('discount_value') / (1 + ($order->getTaxesAverageUsed() / 100)), 2);
|
||||
$cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round($discount_value, 2);
|
||||
$cart_rules[$order_invoice->id]['value_tax_excl'] = Tools::ps_round($discount_value / (1 + ($order->getTaxesAverageUsed() / 100)), 2);
|
||||
|
||||
// Update OrderInvoice
|
||||
$this->applyDiscountOnInvoice($order_invoice, $cart_rules[$order_invoice->id]['value_tax_incl'], $cart_rules[$order_invoice->id]['value_tax_excl']);
|
||||
@@ -1103,12 +1104,12 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$order_invoices_collection = $order->getInvoicesCollection();
|
||||
foreach ($order_invoices_collection as $order_invoice)
|
||||
{
|
||||
if (Tools::getValue('discount_value') > $order_invoice->total_paid_tax_incl)
|
||||
if ($discount_value > $order_invoice->total_paid_tax_incl)
|
||||
$this->errors[] = Tools::displayError('The discount value is greater than the order invoice total.').$order_invoice->getInvoiceNumberFormatted(Context::getContext()->language->id, (int)$order->id_shop).')';
|
||||
else
|
||||
{
|
||||
$cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round(Tools::getValue('discount_value'), 2);
|
||||
$cart_rules[$order_invoice->id]['value_tax_excl'] = Tools::ps_round(Tools::getValue('discount_value') / (1 + ($order->getTaxesAverageUsed() / 100)), 2);
|
||||
$cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round($discount_value, 2);
|
||||
$cart_rules[$order_invoice->id]['value_tax_excl'] = Tools::ps_round($discount_value / (1 + ($order->getTaxesAverageUsed() / 100)), 2);
|
||||
|
||||
// Update OrderInvoice
|
||||
$this->applyDiscountOnInvoice($order_invoice, $cart_rules[$order_invoice->id]['value_tax_incl'], $cart_rules[$order_invoice->id]['value_tax_excl']);
|
||||
@@ -1117,12 +1118,12 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Tools::getValue('discount_value') > $order->total_paid_tax_incl)
|
||||
if ($discount_value > $order->total_paid_tax_incl)
|
||||
$this->errors[] = Tools::displayError('The discount value is greater than the order total.');
|
||||
else
|
||||
{
|
||||
$cart_rules[0]['value_tax_incl'] = Tools::ps_round(Tools::getValue('discount_value'), 2);
|
||||
$cart_rules[0]['value_tax_excl'] = Tools::ps_round(Tools::getValue('discount_value') / (1 + ($order->getTaxesAverageUsed() / 100)), 2);
|
||||
$cart_rules[0]['value_tax_incl'] = Tools::ps_round($discount_value, 2);
|
||||
$cart_rules[0]['value_tax_excl'] = Tools::ps_round($discount_value / (1 + ($order->getTaxesAverageUsed() / 100)), 2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1173,7 +1174,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$cartRuleObj->quantity = 0;
|
||||
$cartRuleObj->quantity_per_user = 1;
|
||||
if (Tools::getValue('discount_type') == 1)
|
||||
$cartRuleObj->reduction_percent = Tools::getValue('discount_value');
|
||||
$cartRuleObj->reduction_percent = $discount_value;
|
||||
elseif (Tools::getValue('discount_type') == 2)
|
||||
$cartRuleObj->reduction_amount = $cart_rule['value_tax_excl'];
|
||||
elseif (Tools::getValue('discount_type') == 3)
|
||||
|
||||
@@ -52,6 +52,9 @@ class AdminTrackingControllerCore extends AdminController
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
if ($id_category = Tools::getValue('id_category') && Tools::getIsset('viewcategory'))
|
||||
Tools::redirectAdmin($this->context->link->getAdminLink('AdminProducts').'&id_category='.(int)$id_category.'&viewcategory');
|
||||
|
||||
$this->_helper_list = new HelperList();
|
||||
|
||||
if (!Configuration::get('PS_STOCK_MANAGEMENT'))
|
||||
@@ -151,8 +154,6 @@ class AdminTrackingControllerCore extends AdminController
|
||||
|
||||
$this->tpl_list_vars = array('sub_title' => $this->l('List of products with attributes but without available quantities for sale:'));
|
||||
|
||||
|
||||
|
||||
return $this->renderList();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user