Move connections plugin, fix export issues

This commit is contained in:
Abhishek Kumar
2022-11-08 17:20:21 +05:30
parent b8d1504868
commit 7609530951
9 changed files with 74 additions and 18 deletions

View File

@@ -51,8 +51,7 @@
let dateTo = $('form#calendar_form .datepicker#datepickerTo').val().trim();
if (dateFrom >= dateTo) {
let dateFromSplit = dateFrom.split('-');
let objDateFrom = new Date(dateFromSplit[0], dateFromSplit[1] - 1, dateFromSplit[2]);
let objDateFrom = $.datepicker.parseDate('yy-mm-dd', dateFrom);
let objDateToMin = objDateFrom;
objDateToMin.setDate(objDateToMin.getDate() + 1);
@@ -71,8 +70,7 @@
let dateFrom = $('form#calendar_form .datepicker#datepickerFrom').val().trim();
if (typeof dateFrom != 'undefined' && dateFrom != '') {
let dateFromSplit = dateFrom.split('-');
let objDateFrom = new Date(dateFromSplit[0], dateFromSplit[1] - 1, dateFromSplit[2]);
let objDateFrom = $.datepicker.parseDate('yy-mm-dd', dateFrom);
let objDateToMin = objDateFrom;
objDateToMin.setDate(objDateToMin.getDate() + 1);

View File

@@ -0,0 +1,20 @@
Copyright (c) David Császár (Diamond/Musclesoft Crew)
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,29 @@
<?php
/**
* 2010-2022 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through LICENSE.txt file inside our module
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please refer to CustomizationPolicy.txt file inside our module for more information.
*
* @author Webkul IN
* @copyright 2010-2022 Webkul IN
* @license LICENSE.txt
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -1,3 +1,5 @@
/* jQuery Connections v1.0.1 https://github.com/musclesoft/jquery-connections */
(function($) {
$.fn.connections = function(options) {
if (options === "update") {

View File

@@ -237,7 +237,9 @@ class StatsBestCategories extends ModuleGrid
$this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()');
foreach ($values as &$value) {
$value['hotel_name'] = '<a href="'.$this->context->link->getAdminLink('AdminAddHotel').'&id='.$value['id'].'&updatehtl_branch_info" target="_blank">'.$value['hotel_name'].'</a>';
if (Tools::getValue('export') == false) {
$value['hotel_name'] = '<a href="'.$this->context->link->getAdminLink('AdminAddHotel').'&id='.$value['id'].'&updatehtl_branch_info" target="_blank">'.$value['hotel_name'].'</a>';
}
$value['totalMargin'] = 0;
if (((float) $value['totalRevenue']) > 0 && ((float) $value['totalOperatingCost']) > 0) {

View File

@@ -190,7 +190,9 @@ class StatsBestCustomers extends ModuleGrid
$this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()');
foreach ($values as &$value) {
$value['email'] = '<a href="'.$this->context->link->getAdminLink('AdminCustomers').'&id_customer='.$value['id_customer'].'&updatecustomer" target="_blank">'.$value['email'].'</a>';
if (Tools::getValue('export') == false) {
$value['email'] = '<a href="'.$this->context->link->getAdminLink('AdminCustomers').'&id_customer='.$value['id_customer'].'&updatecustomer" target="_blank">'.$value['email'].'</a>';
}
$value['totalMoneySpent'] = Tools::displayPrice($value['totalMoneySpent'], $currency);
}

View File

@@ -157,8 +157,8 @@ class StatsBestProducts extends ModuleGrid
$array_date_between = explode(' AND ', $date_between);
$id_lang = $this->getLang();
$this->query = 'SELECT p.`id_product`, pl.`name` AS room_type_name,
p.`active`, hrt.`id_hotel`, hbil.`hotel_name`,
$this->query = 'SELECT p.`id_product`, pl.`name` AS roomTypeName,
p.`active`, hrt.`id_hotel`, hbil.`hotel_name` AS hotelName,
(
SELECT IFNULL(SUM(DATEDIFF(LEAST(hbd.`date_to`, "'.pSQL($date_to).'"), GREATEST(hbd.`date_from`, "'.pSQL($date_from).'"))), 0)
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
@@ -224,8 +224,10 @@ class StatsBestProducts extends ModuleGrid
$objHotelBookingDetail = new HotelBookingDetail();
$numberOfDays = $objHotelBookingDetail->getNumberOfDays($date_from, $date_to);
foreach ($values as &$value) {
$value['roomTypeName'] = '<a href="'.$this->context->link->getAdminLink('AdminProducts').'&id_product='.$value['id_product'].'&updateproduct" target="_blank">'.$value['room_type_name'].'</a>';
$value['hotelName'] = '<a href="'.$this->context->link->getAdminLink('AdminAddHotel').'&id='.$value['id_hotel'].'&updatehtl_branch_info" target="_blank">'.$value['hotel_name'].'</a>';
if (Tools::getValue('export') == false) {
$value['roomTypeName'] = '<a href="'.$this->context->link->getAdminLink('AdminProducts').'&id_product='.$value['id_product'].'&updateproduct" target="_blank">'.$value['roomTypeName'].'</a>';
$value['hotelName'] = '<a href="'.$this->context->link->getAdminLink('AdminAddHotel').'&id='.$value['id_hotel'].'&updatehtl_branch_info" target="_blank">'.$value['hotelName'].'</a>';
}
$value['totalRoomsBooked'] = (int) $value['totalRoomsBooked'];
$value['availableRooms'] = max($value['totalRooms'] - $value['totalRoomsBooked'], 0); // availableRooms can be negative if more rooms are disabled than available for booking
$value['bookingsPerDay'] = sprintf('%0.2f', ($numberOfDays ? $value['totalRoomsBooked'] / $numberOfDays : 0));

View File

@@ -144,8 +144,10 @@ class StatsBestVouchers extends ModuleGrid
$values = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->query);
$this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()');
foreach ($values as &$value) {
$value['code'] = '<a href="'.$this->context->link->getAdminLink('AdminCartRules').'&id_cart_rule='.$value['id_cart_rule'].'&updatecart_rule" target="_blank">'.$value['code'].'</a>';
$value['name'] = '<a href="'.$this->context->link->getAdminLink('AdminCartRules').'&id_cart_rule='.$value['id_cart_rule'].'&updatecart_rule" target="_blank">'.$value['name'].'</a>';
if (Tools::getValue('export') == false) {
$value['code'] = '<a href="'.$this->context->link->getAdminLink('AdminCartRules').'&id_cart_rule='.$value['id_cart_rule'].'&updatecart_rule" target="_blank">'.$value['code'].'</a>';
$value['name'] = '<a href="'.$this->context->link->getAdminLink('AdminCartRules').'&id_cart_rule='.$value['id_cart_rule'].'&updatecart_rule" target="_blank">'.$value['name'].'</a>';
}
$value['ca'] = Tools::displayPrice($value['ca'], $currency);
}

View File

@@ -380,9 +380,9 @@ class StatsProduct extends ModuleGraph
break;
case 42:
$this->_titles['main'][1] = $this->l('Reference');
$this->_titles['main'][2] = $this->l('Name');
$this->_titles['main'][3] = $this->l('Stock');
$this->_titles['main'][0] = $this->l('ID');
$this->_titles['main'][1] = $this->l('Room type name');
$this->_titles['main'][2] = $this->l('Total Rooms');
break;
}
}
@@ -403,9 +403,8 @@ class StatsProduct extends ModuleGraph
if ($this->option == 42) {
$products = $this->getProducts();
foreach ($products as $product) {
$this->_values[0][] = $product['reference'];
$this->_values[1][] = $product['name'];
$this->_values[2][] = $product['quantity'];
$this->_values[0][] = $product['name'];
$this->_values[1][] = $product['total_rooms'];
$this->_legend[] = $product['id_product'];
}
} elseif ($this->option != 3) {