Skip to content

Commit

Permalink
Merge pull request #8096 from condor2/3.0.x.x_Maintenance
Browse files Browse the repository at this point in the history
[3.0.x.x maintenance] Added more fixes from Github+Timezone from Master
  • Loading branch information
danielkerr committed Jul 21, 2020
2 parents e0986ea + 541a213 commit 3cca96c
Show file tree
Hide file tree
Showing 36 changed files with 313 additions and 352 deletions.
4 changes: 0 additions & 4 deletions upload/admin/controller/extension/module/carousel.php
Expand Up @@ -125,10 +125,6 @@ public function index() {
$data['status'] = '';
}

$this->load->model('design/banner');

$data['banners'] = $this->model_design_banner->getBanners();

$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');
Expand Down
Expand Up @@ -52,7 +52,7 @@ public function index() {

$this->load->model('localisation/language');

$data['payment_bank_transfer'] = array();
$data['payment_bank_transfer_bank'] = array();

$languages = $this->model_localisation_language->getLanguages();

Expand Down
2 changes: 1 addition & 1 deletion upload/admin/controller/marketing/coupon.php
Expand Up @@ -490,7 +490,7 @@ protected function validateForm() {
$this->error['name'] = $this->language->get('error_name');
}

if ((utf8_strlen($this->request->post['code']) < 3) || (utf8_strlen($this->request->post['code']) > 10)) {
if ((utf8_strlen($this->request->post['code']) < 3) || (utf8_strlen($this->request->post['code']) > 20)) {
$this->error['code'] = $this->language->get('error_code');
}

Expand Down
8 changes: 3 additions & 5 deletions upload/admin/controller/sale/order.php
Expand Up @@ -383,7 +383,7 @@ protected function getList() {

$session->start();

$this->model_user_api->deleteApiSessionBySessonId($session->getId());
$this->model_user_api->deleteApiSessionBySessionId($session->getId());

$this->model_user_api->addApiSession($api_info['api_id'], $session->getId(), $this->request->server['REMOTE_ADDR']);

Expand Down Expand Up @@ -690,7 +690,7 @@ public function getForm() {

$session->start();

$this->model_user_api->deleteApiSessionBySessonId($session->getId());
$this->model_user_api->deleteApiSessionBySessionId($session->getId());

$this->model_user_api->addApiSession($api_info['api_id'], $session->getId(), $this->request->server['REMOTE_ADDR']);

Expand Down Expand Up @@ -990,8 +990,6 @@ public function info() {

$data['commission'] = $this->currency->format($order_info['commission'], $order_info['currency_code'], $order_info['currency_value']);

$this->load->model('customer/customer');

$data['commission_total'] = $this->model_customer_customer->getTotalTransactionsByOrderId($this->request->get['order_id']);

$this->load->model('localisation/order_status');
Expand Down Expand Up @@ -1233,7 +1231,7 @@ public function info() {

$session->start();

$this->model_user_api->deleteApiSessionBySessonId($session->getId());
$this->model_user_api->deleteApiSessionBySessionId($session->getId());

$this->model_user_api->addApiSession($api_info['api_id'], $session->getId(), $this->request->server['REMOTE_ADDR']);

Expand Down
21 changes: 10 additions & 11 deletions upload/admin/controller/sale/voucher.php
Expand Up @@ -177,7 +177,7 @@ protected function getList() {
} else {
$order_href = '';
}

$data['vouchers'][] = array(
'voucher_id' => $result['voucher_id'],
'code' => $result['code'],
Expand Down Expand Up @@ -567,6 +567,9 @@ public function send() {
}

if ($vouchers) {
$this->load->model('sale/order');
$this->load->model('sale/voucher_theme');

foreach ($vouchers as $voucher_id) {
$voucher_info = $this->model_sale_voucher->getVoucher($voucher_id);

Expand All @@ -577,8 +580,6 @@ public function send() {
$order_id = 0;
}

$this->load->model('sale/order');

$order_info = $this->model_sale_order->getOrder($order_id);

// If voucher belongs to an order
Expand All @@ -598,8 +599,6 @@ public function send() {
$data['text_redeem'] = sprintf($language->get('text_redeem'), $voucher_info['code']);
$data['text_footer'] = $language->get('text_footer');

$this->load->model('sale/voucher_theme');

$voucher_theme_info = $this->model_sale_voucher_theme->getVoucherTheme($voucher_info['voucher_theme_id']);

if ($voucher_theme_info && is_file(DIR_IMAGE . $voucher_theme_info['image'])) {
Expand Down Expand Up @@ -628,25 +627,25 @@ public function send() {
$mail->send();

// If voucher does not belong to an order
} else {
} else {
$this->language->load('mail/voucher');

$data['title'] = sprintf($this->language->get('text_subject'), $voucher_info['from_name']);

$data['text_greeting'] = sprintf($this->language->get('text_greeting'), $this->currency->format($voucher_info['amount'], $this->config->get('config_currency')));
$data['text_from'] = sprintf($this->language->get('text_from'), $voucher_info['from_name']);
$data['text_message'] = $this->language->get('text_message');
$data['text_redeem'] = sprintf($this->language->get('text_redeem'), $voucher_info['code']);
$data['text_footer'] = $this->language->get('text_footer');

$this->load->model('sale/voucher_theme');
$data['text_footer'] = $this->language->get('text_footer');

$voucher_theme_info = $this->model_sale_voucher_theme->getVoucherTheme($voucher_info['voucher_theme_id']);

if ($voucher_theme_info && is_file(DIR_IMAGE . $voucher_theme_info['image'])) {
$data['image'] = HTTP_CATALOG . 'image/' . $voucher_theme_info['image'];
} else {
$data['image'] = '';
}

$data['store_name'] = $this->config->get('config_name');
$data['store_url'] = HTTP_CATALOG;
$data['message'] = nl2br($voucher_info['message']);
Expand Down
25 changes: 25 additions & 0 deletions upload/admin/controller/setting/setting.php
Expand Up @@ -317,6 +317,31 @@ public function index() {
$data['config_zone_id'] = $this->config->get('config_zone_id');
}

if (isset($this->request->post['config_timezone'])) {
$data['config_timezone'] = $this->request->post['config_timezone'];
} elseif ($this->config->has('config_timezone')) {
$data['config_timezone'] = $this->config->get('config_timezone');
} else {
$data['config_timezone'] = 'UTC';
}
// Set Time Zone
$data['timezones'] = array();

$timestamp = time();

$timezones = timezone_identifiers_list();

foreach($timezones as $timezone) {
date_default_timezone_set($timezone);
$hour = ' (' . date('P', $timestamp) . ')';
$data['timezones'][] = array(
'text' => $timezone . $hour,
'value' => $timezone
);
}

date_default_timezone_set($this->config->get('config_timezone'));

if (isset($this->request->post['config_language'])) {
$data['config_language'] = $this->request->post['config_language'];
} else {
Expand Down
8 changes: 8 additions & 0 deletions upload/admin/controller/startup/startup.php
Expand Up @@ -12,6 +12,14 @@ public function index() {
}
}

// Set time zone
if ($this->config->get('config_timezone')) {
date_default_timezone_set($this->config->get('config_timezone'));

// Sync PHP and DB time zones.
$this->db->query("SET time_zone = '" . $this->db->escape(date('P')) . "'");
}

// Theme
$this->config->set('template_cache', $this->config->get('developer_theme'));

Expand Down
3 changes: 2 additions & 1 deletion upload/admin/language/en-gb/mail/voucher.php
Expand Up @@ -6,4 +6,5 @@
$_['text_from'] = 'This Gift Certificate has been sent to you by %s';
$_['text_message'] = 'With a message saying';
$_['text_redeem'] = 'To redeem this Gift Certificate, write down the redemption code which is <b>%s</b> then click on the the link below and purchase the product you wish to use this gift certificate on. You can enter the gift certificate code on the shopping cart page before you click checkout.';
$_['text_footer'] = 'Please reply to this email if you have any questions.';
$_['text_footer'] = 'Please reply to this email if you have any questions.';
$_['text_sent'] = 'Success: Gift Voucher e-mail has been sent!';
1 change: 0 additions & 1 deletion upload/admin/language/en-gb/sale/voucher.php
Expand Up @@ -7,7 +7,6 @@
$_['text_list'] = 'Gift Voucher List';
$_['text_add'] = 'Add Gift Voucher';
$_['text_edit'] = 'Edit Gift Voucher';
$_['text_sent'] = 'Success: Gift Voucher e-mail has been sent!';

// Column
$_['column_name'] = 'Voucher Name';
Expand Down
1 change: 1 addition & 0 deletions upload/admin/language/en-gb/setting/setting.php
Expand Up @@ -52,6 +52,7 @@
$_['entry_location'] = 'Store Location';
$_['entry_country'] = 'Country';
$_['entry_zone'] = 'Region / State';
$_['entry_timezone'] = 'Time Zone';
$_['entry_language'] = 'Language';
$_['entry_admin_language'] = 'Administration Language';
$_['entry_currency'] = 'Currency';
Expand Down
2 changes: 1 addition & 1 deletion upload/admin/model/catalog/product.php
Expand Up @@ -493,7 +493,7 @@ public function getProductAttributes($product_id) {
public function getProductOptions($product_id) {
$product_option_data = array();

$product_option_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "product_option` po LEFT JOIN `" . DB_PREFIX . "option` o ON (po.option_id = o.option_id) LEFT JOIN `" . DB_PREFIX . "option_description` od ON (o.option_id = od.option_id) WHERE po.product_id = '" . (int)$product_id . "' AND od.language_id = '" . (int)$this->config->get('config_language_id') . "'");
$product_option_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "product_option` po LEFT JOIN `" . DB_PREFIX . "option` o ON (po.option_id = o.option_id) LEFT JOIN `" . DB_PREFIX . "option_description` od ON (o.option_id = od.option_id) WHERE po.product_id = '" . (int)$product_id . "' AND od.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY o.sort_order ASC");

foreach ($product_option_query->rows as $product_option) {
$product_option_value_data = array();
Expand Down
2 changes: 1 addition & 1 deletion upload/admin/model/customer/customer.php
Expand Up @@ -231,7 +231,7 @@ public function getAddresses($customer_id) {
}

public function getTotalCustomers($data = array()) {
$sql = "SELECT COUNT(*) AS total FROM " . DB_PREFIX . "customer";
$sql = "SELECT COUNT(*) AS total FROM " . DB_PREFIX . "customer c";

$implode = array();

Expand Down
2 changes: 1 addition & 1 deletion upload/admin/model/localisation/tax_class.php
Expand Up @@ -92,7 +92,7 @@ public function getTotalTaxClasses() {
}

public function getTaxRules($tax_class_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "tax_rule WHERE tax_class_id = '" . (int)$tax_class_id . "'");
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "tax_rule WHERE tax_class_id = '" . (int)$tax_class_id . "' ORDER BY priority ASC");

return $query->rows;
}
Expand Down
7 changes: 3 additions & 4 deletions upload/admin/model/tool/backup.php
Expand Up @@ -6,10 +6,9 @@ public function getTables() {
$query = $this->db->query("SHOW TABLES FROM `" . DB_DATABASE . "`");

foreach ($query->rows as $result) {
if (utf8_substr($result['Tables_in_' . DB_DATABASE], 0, strlen(DB_PREFIX)) == DB_PREFIX) {
if (isset($result['Tables_in_' . DB_DATABASE])) {
$table_data[] = $result['Tables_in_' . DB_DATABASE];
}
$table = reset($result);
if ($table && utf8_substr($table, 0, strlen(DB_PREFIX)) == DB_PREFIX) {
$table_data[] = $table;
}
}

Expand Down
2 changes: 1 addition & 1 deletion upload/admin/model/user/api.php
Expand Up @@ -117,7 +117,7 @@ public function deleteApiSession($api_session_id) {
$this->db->query("DELETE FROM `" . DB_PREFIX . "api_session` WHERE api_session_id = '" . (int)$api_session_id . "'");
}

public function deleteApiSessionBySessonId($session_id) {
public function deleteApiSessionBySessionId($session_id) {
$this->db->query("DELETE FROM `" . DB_PREFIX . "api_session` WHERE session_id = '" . $this->db->escape($session_id) . "'");
}
}
12 changes: 3 additions & 9 deletions upload/admin/view/template/common/header.twig
Expand Up @@ -35,14 +35,8 @@
<div id="container">
<header id="header" class="navbar navbar-static-top">
<div class="container-fluid">


<div id="header-logo" class="navbar-header"><a href="{{ home }}" class="navbar-brand"><img src="view/image/logo.png" alt="{{ heading_title }}" title="{{ heading_title }}" /></a></div>
<a href="#" id="button-menu" class="hidden-md hidden-lg"><span class="fa fa-bars"></span></a>{% if logged %}




<ul class="nav navbar-nav navbar-right">
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><img src="{{ image }}" alt="{{ firstname }} {{ lastname }}" title="{{ username }}" id="user-profile" class="img-circle" />{{ firstname }} {{ lastname }} <i class="fa fa-caret-down fa-fw"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
Expand All @@ -54,12 +48,12 @@
{% endfor %}
<li role="separator" class="divider"></li>
<li class="dropdown-header">{{ text_help }}</li>
<li><a href="http://www.opencart.com" target="_blank"><i class="fa fa-opencart fa-fw"></i> {{ text_homepage }}</a></li>
<li><a href="https://www.opencart.com" target="_blank"><i class="fa fa-opencart fa-fw"></i> {{ text_homepage }}</a></li>
<li><a href="http://docs.opencart.com" target="_blank"><i class="fa fa-file-text-o fa-fw"></i> {{ text_documentation }}</a></li>
<li><a href="http://forum.opencart.com" target="_blank"><i class="fa fa-comments-o fa-fw"></i> {{ text_support }}</a></li>
<li><a href="https://forum.opencart.com" target="_blank"><i class="fa fa-comments-o fa-fw"></i> {{ text_support }}</a></li>
</ul>
</li>
<li><a href="{{ logout }}"><i class="fa fa-sign-out"></i> <span class="hidden-xs hidden-sm hidden-md">{{ text_logout }}</span></a></li>
</ul>
{% endif %} </div>
</header>
</header>
2 changes: 0 additions & 2 deletions upload/admin/view/template/common/security.twig
Expand Up @@ -130,8 +130,6 @@ $('#modal-security select[name=\'type\']').on('change', function () {
html += '<p><strong>define(\'DIR_STORAGE\', DIR_SYSTEM . \'storage/\');</strong></p>';
html += '<p>to</p>';
html += '<p><strong>define(\'DIR_STORAGE\', \'' + $('#modal-security input[name=\'path\']').val() + $('#modal-security input[name=\'directory\']').val() + '/\');</strong></p></li>';
html += '</li>';
html += '</ol>';
$('#collapse-manual .form-control').html(html);
Expand Down
2 changes: 1 addition & 1 deletion upload/admin/view/template/customer/customer_form.twig
Expand Up @@ -286,7 +286,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="input-safe">{{ entry_safe }}</label>
<label class="col-sm-2 control-label" for="input-safe"><span data-toggle="tooltip" title="{{ help_safe }}">{{ entry_safe }}</span></label>
<div class="col-sm-10">
<select name="safe" id="input-safe" class="form-control">
{% if safe %}
Expand Down
4 changes: 2 additions & 2 deletions upload/admin/view/template/customer/customer_ip.twig
Expand Up @@ -11,7 +11,7 @@
{% if ips %}
{% for ip in ips %}
<tr>
<td class="text-left"><a href="http://www.geoiptool.com/en/?IP={{ ip.ip }}" target="_blank">{{ ip.ip }}</a></td>
<td class="text-left"><a href="//whatismyipaddress.com/ip/{{ ip.ip }}" target="_blank">{{ ip.ip }}</a></td>
<td class="text-right"><a href="{{ ip.filter_ip }}" target="_blank">{{ ip.total }}</a></td>
<td class="text-left">{{ ip.date_added }}</td> </tr>
{% endfor %}
Expand All @@ -26,4 +26,4 @@
<div class="row">
<div class="col-sm-6 text-left">{{ pagination }}</div>
<div class="col-sm-6 text-right">{{ results }}</div>
</div>
</div>
2 changes: 1 addition & 1 deletion upload/admin/view/template/sale/order_form.twig
Expand Up @@ -747,7 +747,7 @@
<div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order + 3 }}">
<label class="col-sm-2 control-label" for="input-shipping-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
<div class="col-sm-10">
<input type="text" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ shipping_custom_field[custom_field.custom_field_id] ? shipping_custom_field[custom_field.custom_field_id] ? custom_field.value }}" placeholder="{{ custom_field.name }}" id="input-shipping-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
<input type="text" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ shipping_custom_field[custom_field.custom_field_id] ? shipping_custom_field[custom_field.custom_field_id] : custom_field.value }}" placeholder="{{ custom_field.name }}" id="input-shipping-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
</div>
</div>
{% endif %}
Expand Down
14 changes: 14 additions & 0 deletions upload/admin/view/template/setting/setting.twig
Expand Up @@ -217,6 +217,20 @@
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="input-timezone">{{ entry_timezone }}</label>
<div class="col-sm-10">
<select name="config_timezone" id="input-timezone" class="form-control">
{% for timezone in timezones %}
{% if timezone.value == config_timezone %}
<option value="{{ timezone.value }}" selected="selected">{{ timezone.text }}</option>
{% else %}
<option value="{{ timezone.value }}">{{ timezone.text }}</option>
{% endif %}
{% endfor %}
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="input-language">{{ entry_language }}</label>
<div class="col-sm-10">
Expand Down
4 changes: 2 additions & 2 deletions upload/catalog/controller/account/voucher.php
Expand Up @@ -13,7 +13,7 @@ public function index() {

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->session->data['vouchers'][mt_rand()] = array(
'description' => sprintf($this->language->get('text_for'), $this->currency->format($this->request->post['amount'], $this->session->data['currency']), $this->request->post['to_name']),
'description' => sprintf($this->language->get('text_for'), $this->currency->format($this->request->post['amount'], $this->session->data['currency'], 1.0), $this->request->post['to_name']),
'to_name' => $this->request->post['to_name'],
'to_email' => $this->request->post['to_email'],
'from_name' => $this->request->post['from_name'],
Expand Down Expand Up @@ -205,7 +205,7 @@ protected function validate() {
$this->error['theme'] = $this->language->get('error_theme');
}

if (($this->currency->convert($this->request->post['amount'], $this->session->data['currency'], $this->config->get('config_currency')) < $this->config->get('config_voucher_min')) || ($this->currency->convert($this->request->post['amount'], $this->session->data['currency'], $this->config->get('config_currency')) > $this->config->get('config_voucher_max'))) {
if ((!isset($this->request->post['amount'])) || (!is_numeric($this->request->post['amount'])) || ($this->currency->convert($this->request->post['amount'], $this->session->data['currency'], $this->config->get('config_currency')) < $this->config->get('config_voucher_min')) || ($this->currency->convert($this->request->post['amount'], $this->session->data['currency'], $this->config->get('config_currency')) > $this->config->get('config_voucher_max'))) {
$this->error['amount'] = sprintf($this->language->get('error_amount'), $this->currency->format($this->config->get('config_voucher_min'), $this->session->data['currency']), $this->currency->format($this->config->get('config_voucher_max'), $this->session->data['currency']));
}

Expand Down
2 changes: 1 addition & 1 deletion upload/catalog/controller/common/cart.php
Expand Up @@ -58,7 +58,7 @@ public function index() {
if ($product['image']) {
$image = $this->model_tool_image->resize($product['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_cart_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_cart_height'));
} else {
$image = '';
$image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_cart_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_cart_height'));
}

$option_data = array();
Expand Down
2 changes: 1 addition & 1 deletion upload/catalog/controller/extension/payment/eway.php
Expand Up @@ -84,7 +84,7 @@ public function index() {
$item->SKU = (string)substr($product['product_id'], 0, 12);
$item->Description = (string)substr($product['name'], 0, 26);
$item->Quantity = strval($product['quantity']);
$item->UnitCost = strval($item_price * 100);
$item->UnitCost = $this->lowestDenomination($item_price, $order_info['currency_code']);
$item->Total = $this->lowestDenomination($item_total, $order_info['currency_code']);

$request->Items[] = $item;
Expand Down

0 comments on commit 3cca96c

Please sign in to comment.