diff --git a/controllers/admin/AdminCustomerThreadsController.php b/controllers/admin/AdminCustomerThreadsController.php index 3f2c52268..0deca4f1a 100644 --- a/controllers/admin/AdminCustomerThreadsController.php +++ b/controllers/admin/AdminCustomerThreadsController.php @@ -515,7 +515,6 @@ class AdminCustomerThreadsControllerCore extends AdminController $helper->id = 'box-pending-messages'; $helper->icon = 'icon-envelope'; $helper->color = 'color1'; - $helper->href = $this->context->link->getAdminLink('AdminCustomerThreads'); $helper->title = $this->l('Pending Discussion Threads', null, null, false); if (ConfigurationKPI::get('PENDING_MESSAGES') !== false) { $helper->value = ConfigurationKPI::get('PENDING_MESSAGES'); diff --git a/controllers/admin/AdminModulesController.php b/controllers/admin/AdminModulesController.php index 2e9a2e165..80048335a 100644 --- a/controllers/admin/AdminModulesController.php +++ b/controllers/admin/AdminModulesController.php @@ -1331,7 +1331,7 @@ class AdminModulesControllerCore extends AdminController $helper->id = 'box-update-modules'; $helper->icon = 'icon-refresh'; $helper->color = 'color3'; - $helper->title = $this->l('Modules to update', null, null, false); + $helper->title = $this->l('Modules to Update', null, null, false); if (ConfigurationKPI::get('UPDATE_MODULES') !== false && ConfigurationKPI::get('UPDATE_MODULES') != '') { $helper->value = ConfigurationKPI::get('UPDATE_MODULES'); } diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 8a558d516..9b38ed5c7 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2741,7 +2741,7 @@ class AdminProductsControllerCore extends AdminController $helper->id = 'box-8020-sales-catalog'; $helper->icon = 'icon-beaker'; $helper->color = 'color3'; - $helper->title = $this->l('Purchased references', null, null, false); + $helper->title = $this->l('Purchased References', null, null, false); $helper->subtitle = $this->l('30 days', null, null, false); if (ConfigurationKPI::get('8020_SALES_CATALOG') !== false) { $helper->value = ConfigurationKPI::get('8020_SALES_CATALOG'); diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 5e69b81d3..60a066d4d 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -29,11 +29,10 @@ class AdminStatsControllerCore extends AdminStatsTabController public static function getVisits($unique = false, $date_from, $date_to, $granularity = false) { $visits = ($granularity == false) ? 0 : array(); - /** @var Gapi $gapi */ - $gapi = Module::isInstalled('gapi') ? Module::getInstanceByName('gapi') : false; - if (Validate::isLoadedObject($gapi) && $gapi->isConfigured()) { + $objQGA = Module::isEnabled('qlogoogleanalytics') ? Module::getInstanceByName('qlogoogleanalytics') : false; + if (Validate::isLoadedObject($objQGA) && $objQGA->isConfigured()) { $metric = $unique ? 'visitors' : 'visits'; - if ($result = $gapi->requestReportData($granularity ? 'ga:date' : '', 'ga:'.$metric, $date_from, $date_to, null, null, 1, 5000)) { + if ($result = $objQGA->requestReportData($granularity ? 'ga:date' : '', 'ga:'.$metric, $date_from, $date_to, null, null, 1, 5000)) { foreach ($result as $row) { if ($granularity == 'day') { $visits[strtotime(preg_replace('/^([0-9]{4})([0-9]{2})([0-9]{2})$/', '$1-$2-$3', $row['dimensions']['date']))] = $row['metrics'][$metric]; @@ -199,43 +198,59 @@ class AdminStatsControllerCore extends AdminStatsTabController { if ($granularity == 'day') { $sales = array(); - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' - SELECT LEFT(`invoice_date`, 10) as date, SUM(total_paid_tax_excl / o.conversion_rate) as sales - FROM `'._DB_PREFIX_.'orders` o - LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state - LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id_order` = o.`id_order`) - WHERE `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1 - '.Shop::addSqlRestriction(false, 'o') - .HotelBranchInformation::addHotelRestriction($id_hotel, 'hbd').' - GROUP BY LEFT(`invoice_date`, 10)'); + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS( + 'SELECT LEFT(`invoice_date`, 10) AS date, SUM(total_paid_tax_excl / o.conversion_rate) AS sales, + ( + SELECT hbd.`id_hotel` + FROM`'._DB_PREFIX_.'htl_booking_detail` hbd + WHERE hbd.`id_order` = o.`id_order` LIMIT 1 + ) AS id_hotel + FROM `'._DB_PREFIX_.'orders` o + LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state + WHERE `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1 + GROUP BY LEFT(`invoice_date`, 10) + HAVING 1 '.HotelBranchInformation::addHotelRestriction($id_hotel) + ); + foreach ($result as $row) { $sales[strtotime($row['date'])] = $row['sales']; } + return $sales; } elseif ($granularity == 'month') { $sales = array(); - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' - SELECT LEFT(`invoice_date`, 7) as date, SUM(total_paid_tax_excl / o.conversion_rate) as sales - FROM `'._DB_PREFIX_.'orders` o - LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state - LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id_order` = o.`id_order`) - WHERE `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1 - '.Shop::addSqlRestriction(false, 'o') - .HotelBranchInformation::addHotelRestriction($id_hotel, 'hbd').' - GROUP BY LEFT(`invoice_date`, 7)'); + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS( + 'SELECT LEFT(`invoice_date`, 7) AS date, SUM(total_paid_tax_excl / o.conversion_rate) AS sales, + ( + SELECT hbd.`id_hotel` + FROM`'._DB_PREFIX_.'htl_booking_detail` hbd + WHERE hbd.`id_order` = o.`id_order` LIMIT 1 + ) AS id_hotel + FROM `'._DB_PREFIX_.'orders` o + LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state + WHERE `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1 + GROUP BY LEFT(`invoice_date`, 7) + HAVING 1 '.HotelBranchInformation::addHotelRestriction($id_hotel) + ); + foreach ($result as $row) { $sales[strtotime($row['date'].'-01')] = $row['sales']; } + return $sales; } else { - return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' - SELECT SUM(total_paid_tax_excl / o.conversion_rate) - FROM `'._DB_PREFIX_.'orders` o - LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state - LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id_order` = o.`id_order`) - WHERE `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1 - '.Shop::addSqlRestriction(false, 'o') - .HotelBranchInformation::addHotelRestriction($id_hotel, 'hbd')); + return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue( + 'SELECT SUM(total_paid_tax_excl / o.conversion_rate), + ( + SELECT hbd.`id_hotel` + FROM`'._DB_PREFIX_.'htl_booking_detail` hbd + WHERE hbd.`id_order` = o.`id_order` LIMIT 1 + ) AS id_hotel + FROM `'._DB_PREFIX_.'orders` o + LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state + WHERE `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1 + HAVING 1 '.HotelBranchInformation::addHotelRestriction($id_hotel) + ); } } @@ -258,7 +273,7 @@ class AdminStatsControllerCore extends AdminStatsTabController if ($granularity == 'day') { $orders = array(); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' - SELECT LEFT(`invoice_date`, 10) as date, COUNT(*) as orders + SELECT LEFT(`invoice_date`, 10) as date, COUNT(DISTINCT o.`id_order`) as orders FROM `'._DB_PREFIX_.'orders` o LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id_order` = o.`id_order`) @@ -273,7 +288,7 @@ class AdminStatsControllerCore extends AdminStatsTabController } elseif ($granularity == 'month') { $orders = array(); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' - SELECT LEFT(`invoice_date`, 7) as date, COUNT(*) as orders + SELECT LEFT(`invoice_date`, 7) as date, COUNT(DISTINCT o.`id_order`) as orders FROM `'._DB_PREFIX_.'orders` o LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id_order` = o.`id_order`) @@ -287,7 +302,7 @@ class AdminStatsControllerCore extends AdminStatsTabController return $orders; } else { $orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' - SELECT COUNT(*) as orders + SELECT COUNT(DISTINCT o.`id_order`) as orders FROM `'._DB_PREFIX_.'orders` o LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id_order` = o.`id_order`) @@ -391,7 +406,7 @@ class AdminStatsControllerCore extends AdminStatsTabController return CustomerThread::getTotalCustomerThreads('status LIKE "%pending%" OR status = "open"'.Shop::addSqlRestriction()); } - public static function getAverageMessageResponseTime($date_from, $date_to) + public static function getAverageMessageResponseTime($date_from, $date_to, $return_seconds = false) { $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT MIN(cm1.date_add) as question, MIN(cm2.date_add) as reply @@ -411,7 +426,10 @@ class AdminStatsControllerCore extends AdminStatsTabController if (!$threads) { return 0; } - return round(($total_replies - $total_questions) / $threads / 3600, 1); + + $seconds = ($total_replies - $total_questions) / $threads; + + return $return_seconds ? $seconds : Tools::ps_round($seconds / 3600, 1); } public static function getMessagesPerThread($date_from, $date_to) @@ -546,7 +564,7 @@ class AdminStatsControllerCore extends AdminStatsTabController $visits_sum = $visitors; //array_sum($visitors); $orders_sum = $orders; //array_sum($orders); if ($visits_sum) { - $value = round(100 * $orders_sum / $visits_sum, 2); + $value = sprintf('%0.2f', 100 * $orders_sum / $visits_sum); } elseif ($orders_sum) { $value = '∞'; } else { @@ -615,7 +633,7 @@ class AdminStatsControllerCore extends AdminStatsTabController case '8020_sales_catalog': $value = AdminStatsController::get8020SalesCatalog(date('Y-m-d', strtotime('-30 days')), date('Y-m-d')); - $value = sprintf($this->l('%d%% of your Catalog'), $value); + $value = sprintf($this->l('%d%% of your catalog'), $value); ConfigurationKPI::updateValue('8020_SALES_CATALOG', $value); ConfigurationKPI::updateValue('8020_SALES_CATALOG_EXPIRE', strtotime('+12 hour')); break; @@ -632,11 +650,11 @@ class AdminStatsControllerCore extends AdminStatsTabController if ($value === false) { $value = $this->l('No customers', null, null, false); } elseif ($value['type'] == 'female') { - $value = sprintf($this->l('%d%% Female Customers', null, null, false), $value['value']); + $value = sprintf($this->l('%d%% Female customers', null, null, false), $value['value']); } elseif ($value['type'] == 'male') { - $value = sprintf($this->l('%d%% Male Customers', null, null, false), $value['value']); + $value = sprintf($this->l('%d%% Male customers', null, null, false), $value['value']); } else { - $value = sprintf($this->l('%d%% Neutral Customers', null, null, false), $value['value']); + $value = sprintf($this->l('%d%% Neutral customers', null, null, false), $value['value']); } ConfigurationKPI::updateValue('CUSTOMER_MAIN_GENDER', array($this->context->language->id => $value)); @@ -656,7 +674,18 @@ class AdminStatsControllerCore extends AdminStatsTabController break; case 'avg_msg_response_time': - $value = sprintf($this->l('%.1f hours', null, null, false), AdminStatsController::getAverageMessageResponseTime(date('Y-m-d', strtotime('-31 day')), date('Y-m-d', strtotime('-1 day')))); + $value = AdminStatsController::getAverageMessageResponseTime(date('Y-m-d', strtotime('-31 day')), date('Y-m-d', strtotime('-1 day')), true); + + if ($value <= 0) { + $value = '--'; + } elseif ($value < 60) { + $value = sprintf($this->l('%d seconds', null, null, false), $value); + } elseif ($value < 3600) { + $value = sprintf($this->l('%d minutes', null, null, false), (int) $value / 60); + } else { + $value = sprintf($this->l('%.1f hours', null, null, false), $value / 3600); + } + ConfigurationKPI::updateValue('AVG_MSG_RESPONSE_TIME', $value); ConfigurationKPI::updateValue('AVG_MSG_RESPONSE_TIME_EXPIRE', strtotime('+4 hour')); break; @@ -699,8 +728,8 @@ class AdminStatsControllerCore extends AdminStatsTabController /** @var Theme $theme */ foreach ($languages as $language) { $kpi_key = substr(strtoupper($theme->name.'_'.$language['iso_code']), 0, 16); - $total += ConfigurationKPI::get('TRANSLATE_TOTAL_'.$kpi_key); - $translated += ConfigurationKPI::get('TRANSLATE_DONE_'.$kpi_key); + $total += ConfigurationKPI::get('FRONTOFFICE_TRANSLATE_TOTAL_'.$kpi_key); + $translated += ConfigurationKPI::get('FRONTOFFICE_TRANSLATE_DONE_'.$kpi_key); } } $value = 0; @@ -712,6 +741,23 @@ class AdminStatsControllerCore extends AdminStatsTabController ConfigurationKPI::updateValue('FRONTOFFICE_TRANSLATIONS_EXPIRE', strtotime('+2 min')); break; + case 'backoffice_translations': + $languages = Language::getLanguages(); + $total = $translated = 0; + foreach ($languages as $language) { + $kpi_key = substr(strtoupper($language['iso_code']), 0, 16); + $total += ConfigurationKPI::get('BACKOFFICE_TRANSLATE_TOTAL_'.$kpi_key); + $translated += ConfigurationKPI::get('BACKOFFICE_TRANSLATE_DONE_'.$kpi_key); + } + $value = 0; + if ($translated) { + $value = round(100 * $translated / $total, 1); + } + $value .= '%'; + ConfigurationKPI::updateValue('BACKOFFICE_TRANSLATIONS', $value); + ConfigurationKPI::updateValue('BACKOFFICE_TRANSLATIONS_EXPIRE', strtotime('+2 min')); + break; + case 'main_country': if (!($row = AdminStatsController::getMainCountry(date('Y-m-d', strtotime('-30 day')), date('Y-m-d')))) { $value = $this->l('No orders', null, null, false); @@ -746,10 +792,11 @@ class AdminStatsControllerCore extends AdminStatsTabController case 'average_order_value': $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' SELECT - COUNT(`id_order`) as orders, - SUM(`total_paid_tax_excl` / `conversion_rate`) as total_paid_tax_excl - FROM `'._DB_PREFIX_.'orders` - WHERE `invoice_date` BETWEEN "'.pSQL(date('Y-m-d', strtotime('-31 day'))).' 00:00:00" AND "'.pSQL(date('Y-m-d', strtotime('-1 day'))).' 23:59:59" + COUNT(o.`id_order`) as orders, + SUM(o.`total_paid_tax_excl` / o.`conversion_rate`) as total_paid_tax_excl + FROM `'._DB_PREFIX_.'orders` o + LEFT JOIN `'._DB_PREFIX_.'order_state` os ON os.`id_order_state` = o.`current_state` + WHERE o.`invoice_date` BETWEEN "'.pSQL(date('Y-m-d', strtotime('-31 day'))).' 00:00:00" AND "'.pSQL(date('Y-m-d', strtotime('-1 day'))).' 23:59:59" AND os.`logable` = 1 '.Shop::addSqlRestriction()); $value = Tools::displayPrice($row['orders'] ? $row['total_paid_tax_excl'] / $row['orders'] : 0, $currency); ConfigurationKPI::updateValue('AVG_ORDER_VALUE', $value); @@ -879,12 +926,15 @@ class AdminStatsControllerCore extends AdminStatsTabController public static function getCancelledBookingsByDate($date, $idHotel = false) { return Db::getInstance()->getValue( - 'SELECT COUNT(o.`id_order`) + 'SELECT COUNT(DISTINCT o.`id_order`) FROM `'._DB_PREFIX_.'orders` o LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = o.`current_state`) LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id_order` = o.`id_order`) WHERE o.`date_upd` BETWEEN "'.pSQL($date).' 00:00:00" AND "'.pSQL($date).' 23:59:59" - AND o.`current_state` = '.(int) Configuration::get('PS_OS_CANCELED'). + AND o.`current_state` IN ('.implode(',', array( + (int) Configuration::get('PS_OS_CANCELED'), + (int) Configuration::get('PS_OS_REFUND')) + ).')'. HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') ); } @@ -970,80 +1020,79 @@ class AdminStatsControllerCore extends AdminStatsTabController return $occupancyData; } - public static function getAvailBarChartData($days, $dateFrom, $idHotel = null) + public static function getAvailabilityLineChartData($days, $dateFrom, $idHotel = null) // $dateFrom is inclusive { - - $availability_data = array(); - $from = date('Y-m-d' ,strtotime($dateFrom." 00:00:00")); - $to = date('Y-m-d' ,strtotime($dateFrom."+".$days." day 23:59:59")); - - for ($date = $from; $date < $to; $date = date('Y-m-d', strtotime('+1 day', strtotime($date)))) { - $bookedRoomSql = 'SELECT hri.`id` FROM `'._DB_PREFIX_.'htl_booking_detail` hbd - LEFT JOIN `'._DB_PREFIX_.'htl_room_information` hri ON hbd.`id_room` = hri.`id` - WHERE hbd.`date_from` <= "'.pSQL($date).' 00:00:00" - AND hbd.`date_to` >= "'.pSQL(date('Y-m-d ', strtotime('+1 day', strtotime($date)))).' 00:00:00" - AND hbd.`is_refunded` = 0 AND hbd.`is_back_order` = 0'. - (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); - - $tempBookedRoomIds = Db::getInstance()->ExecuteS($bookedRoomSql); - $bookedRoomIds = array(); - if (count($tempBookedRoomIds)) { - foreach ($tempBookedRoomIds as $value) { - if ($value['id']) { - $bookedRoomIds[] = $value['id']; - } - } - } else { - $bookedRoomIds[] = "0"; - } - - $availRoomSql = 'SELECT COUNT("id") FROM `'._DB_PREFIX_.'htl_room_information` hri - WHERE hri.`id` NOT IN ('.implode(',', $bookedRoomIds).') - AND hri.`id_status` != '.(int) HotelRoomInformation::STATUS_INACTIVE.' - AND hri.`id_status` != '.(int) HotelRoomInformation::STATUS_TEMPORARY_INACTIVE. - (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : ''); - $availRoomIds = Db::getInstance()->getValue($availRoomSql); - - $availability_data["values"][] = array(strtotime($date), sprintf("%02d", $availRoomIds)); + if ($days == 0) { + return array(); } - return $availability_data; + $dateTo = date('Y-m-d', strtotime($dateFrom.'+'.$days.' days')); + $availableRoomsDiscrete = self::getAvailableRoomsForDiscreteDates($dateFrom, $dateTo, $idHotel); + $availabilityData = array(); + if ($availableRoomsDiscrete) { + foreach ($availableRoomsDiscrete as $timestamp => $availableRoom) { + $availabilityData['values'][] = array( + $timestamp, + sprintf('%02d', $availableRoom) + ); + } + } + + return $availabilityData; } - public static function getAverageDailyRate($dateFrom, $dateTo, $idHotel = false) + public static function getAverageDailyRate($dateFrom, $dateTo, $idHotel = null) { - $result = Db::getInstance()->getRow( - 'SELECT - SUM(hbd.`total_price_tax_excl`) AS `rooms_revenue`, - COUNT(hbd.`id_room`) AS `room_sold` - FROM `'._DB_PREFIX_.'htl_booking_detail` hbd - WHERE hbd.`is_refunded` = 0 AND hbd.`is_back_order` = 0 - AND hbd.`date_add` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59"'. - HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') - ); - return Tools::displayPrice($result['rooms_revenue'] ? $result['rooms_revenue'] / $result['room_sold'] : 0); + if ($dateFrom == $dateTo) { + $dateTo = date('Y-m-d', strtotime('+1 day', strtotime($dateTo))); + } + + $occupiedRooms = self::getOccupiedRoomsForDiscreteDates($dateFrom, $dateTo, $idHotel); + $roomsRevenues = self::getRoomsRevenuesForDiscreteDates($dateFrom, $dateTo, $idHotel); + + if (count($occupiedRooms) != count($roomsRevenues)) { + return false; + } + + $divisor = 0; + $sumADRs = 0; + foreach ($occupiedRooms as $key => $occupiedRoom) { + if ($occupiedRoom == 0) { + unset($occupiedRooms[$key]); + unset($roomsRevenues[$key]); + continue; + } + + $sumADRs += ($occupiedRoom ? ($roomsRevenues[$key] / $occupiedRoom) : 0); + $divisor++; + } + + return Tools::displayPrice($divisor ? ($sumADRs / $divisor) : 0); } public static function getCancellationRate($dateFrom, $dateTo, $idHotel = false) { $numAllOrders = Db::getInstance()->getValue( - 'SELECT COUNT(o.`id_order`) FROM `'._DB_PREFIX_.'orders` o + 'SELECT COUNT(DISTINCT o.`id_order`) FROM `'._DB_PREFIX_.'orders` o LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id_order` = o.`id_order`) WHERE o.`date_add` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59"'. HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') ); $numCancelledOrders = Db::getInstance()->getValue( - 'SELECT COUNT(o.`id_order`) FROM `'._DB_PREFIX_.'orders` o + 'SELECT COUNT(DISTINCT o.`id_order`) FROM `'._DB_PREFIX_.'orders` o LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = o.`current_state`) LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id_order` = o.`id_order`) WHERE o.`date_add` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59" - AND o.`current_state` = '.(int)Configuration::get('PS_OS_CANCELED'). + AND o.`current_state` IN ('.implode(',', array( + (int) Configuration::get('PS_OS_CANCELED'), + (int) Configuration::get('PS_OS_REFUND')) + ).')'. HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') ); - if ($numCancelledOrders != 0) { - return round(($numCancelledOrders / $numAllOrders) * 100, 2).'%'; + if ($numAllOrders != 0) { + return Tools::ps_round(($numCancelledOrders / $numAllOrders) * 100, 2).'%'; } else { return '0.00%'; } @@ -1052,12 +1101,20 @@ class AdminStatsControllerCore extends AdminStatsTabController public static function getRevenue($dateFrom, $dateTo, $idHotel = false) { $result = Db::getInstance()->getValue( - 'SELECT (SUM(o.`total_paid_tax_excl` / o.`conversion_rate`) - SUM(orr.`refunded_amount`)) - FROM `'._DB_PREFIX_.'orders` o - LEFT JOIN `' ._DB_PREFIX_.'order_return` orr ON orr.`id_order` = o.`id_order` - LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id_order` = o.`id_order`) - WHERE o.`invoice_date` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59"'. - HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') + 'SELECT SUM(total_paid_tax_excl - refunded_amount) + FROM ( + SELECT o.`total_paid_tax_excl` / o.`conversion_rate` AS total_paid_tax_excl, + IFNULL(orr.`refunded_amount`, 0) AS refunded_amount, + ( + SELECT hbd.`id_hotel` + FROM`'._DB_PREFIX_.'htl_booking_detail` hbd + WHERE hbd.`id_order` = o.`id_order` LIMIT 1 + ) AS id_hotel + FROM `'._DB_PREFIX_.'orders` o + LEFT JOIN `' ._DB_PREFIX_.'order_return` orr ON orr.`id_order` = o.`id_order` + WHERE o.`invoice_date` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59" + HAVING 1 '.HotelBranchInformation::addHotelRestriction($idHotel).' + ) AS t' ); return Tools::displayPrice($result ? $result : 0); @@ -1101,4 +1158,163 @@ class AdminStatsControllerCore extends AdminStatsTabController ((int) $limit ? ' LIMIT 0, '.(int) $limit : '') ); } + + public static function getOccupiedRoomsForDiscreteDates($dateFrom, $dateTo = null, $idHotel = null, $useCache = true) + { + $dateTo = !$dateTo ? date('Y-m-d', strtotime('+1 day', strtotime($dateFrom))) : $dateTo; + + $discreteDates = array(); + $date = $dateFrom; + while ($date < $dateTo) { + $dateNext = date('Y-m-d', strtotime('+1 day', strtotime($date))); + $discreteDates[] = array( + 'date_from' => $date, + 'date_to' => $dateNext, + 'timestamp_from' => strtotime($date), + ); + $date = $dateNext; + }; + + $result = array(); + foreach ($discreteDates as $discreteDate) { + $cacheKey = 'AdminStats::getOccupiedRoomsForDiscreteDates_'.(int) $discreteDate['timestamp_from'].'_'. + (!is_array($idHotel) ? (int) $idHotel : implode('_', $idHotel)); + if (!Cache::isStored($cacheKey) || !$useCache) { + $sql = 'SELECT COUNT(DISTINCT hbd.`id_room`) + FROM `'._DB_PREFIX_.'htl_booking_detail` hbd + LEFT JOIN `'._DB_PREFIX_.'htl_room_information` hri + ON (hri.`id` = hbd.`id_room`) + LEFT JOIN `'._DB_PREFIX_.'product` p + ON (p.`id_product` = hri.`id_product`) + WHERE p.`active` = 1 + AND hbd.`is_refunded` = 0 + AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'. + (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); + + $value = Db::getInstance()->getValue($sql); + Cache::store($cacheKey, $value); + } + + $result[$discreteDate['timestamp_from']] = Cache::retrieve($cacheKey); + } + + return $result; + } + + public static function getRoomsRevenuesForDiscreteDates($dateFrom, $dateTo = null, $idHotel = null, $useCache = true) + { + $dateTo = !$dateTo ? date('Y-m-d', strtotime('+1 day', strtotime($dateFrom))) : $dateTo; + + $discreteDates = array(); + $date = $dateFrom; + while ($date < $dateTo) { + $dateNext = date('Y-m-d', strtotime('+1 day', strtotime($date))); + $discreteDates[] = array( + 'date_from' => $date, + 'date_to' => $dateNext, + 'timestamp_from' => strtotime($date), + ); + $date = $dateNext; + }; + + $result = array(); + foreach ($discreteDates as $discreteDate) { + $cacheKey = 'AdminStats::getRoomsRevenuesForDiscreteDates'.(int) $discreteDate['timestamp_from'].'_'. + (!is_array($idHotel) ? (int) $idHotel : implode('_', $idHotel)); + if (!Cache::isStored($cacheKey) || !$useCache) { + $sql = 'SELECT IFNULL(SUM(hbd.`total_price_tax_excl` / DATEDIFF(hbd.`date_to`, hbd.`date_from`)), 0) + FROM `'._DB_PREFIX_.'htl_booking_detail` hbd + LEFT JOIN `'._DB_PREFIX_.'htl_room_information` hri + ON (hri.`id` = hbd.`id_room`) + LEFT JOIN `'._DB_PREFIX_.'product` p + ON (p.`id_product` = hri.`id_product`) + WHERE p.`active` = 1 + AND hbd.`is_refunded` = 0 + AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'. + (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); + + $value = Db::getInstance()->getValue($sql); + Cache::store($cacheKey, $value); + } + + $result[$discreteDate['timestamp_from']] = Cache::retrieve($cacheKey); + } + + return $result; + } + + public static function getAvailableRoomsForDiscreteDates($dateFrom, $dateTo = null, $idHotel = null, $useCache = true) + { + $dateTo = !$dateTo ? date('Y-m-d', strtotime('+1 day', strtotime($dateFrom))) : $dateTo; + $discreteDates = array(); + $date = $dateFrom; + while ($date < $dateTo) { + $dateNext = date('Y-m-d', strtotime('+1 day', strtotime($date))); + $discreteDates[] = array( + 'date_from' => $date, + 'date_to' => $dateNext, + 'timestamp_from' => strtotime($date), + ); + $date = $dateNext; + }; + + $result = array(); + foreach ($discreteDates as $discreteDate) { + $cacheKey = 'AdminStats::getAvailableRoomsForDiscreteDates'.(int) $discreteDate['timestamp_from'].'_'. + (!is_array($idHotel) ? (int) $idHotel : implode('_', $idHotel)); + if (!Cache::isStored($cacheKey) || !$useCache) { + $sql = 'SELECT (num_total - num_booked - num_inactive - num_temporarily_inactive) AS num_available + FROM ( + SELECT ( + SELECT IFNULL(COUNT(hri.`id`), 0) + FROM `'._DB_PREFIX_.'htl_room_information` hri + LEFT JOIN `'._DB_PREFIX_.'product` p + ON (p.`id_product` = hri.`id_product`) + WHERE p.`active` = 1'. + (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '').' + ) AS num_total, + ( + SELECT COUNT(DISTINCT hbd.`id_room`) + FROM `'._DB_PREFIX_.'htl_booking_detail` hbd + LEFT JOIN `'._DB_PREFIX_.'htl_room_information` hri + ON (hri.`id` = hbd.`id_room`) + LEFT JOIN `'._DB_PREFIX_.'product` p + ON (p.`id_product` = hri.`id_product`) + WHERE p.`active` = 1 + AND hbd.`is_refunded` = 0 + AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'. + (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '').' + ) AS num_booked, + ( + SELECT IFNULL(COUNT(hri.`id`), 0) + FROM `'._DB_PREFIX_.'htl_room_information` hri + LEFT JOIN `'._DB_PREFIX_.'product` p + ON (p.`id_product` = hri.`id_product`) + WHERE hri.`id_status` = '.(int) HotelRoomInformation::STATUS_INACTIVE.' + AND p.`active` = 1'. + (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '').' + ) AS num_inactive, + ( + SELECT IFNULL(COUNT(hri.`id`), 0) + FROM `'._DB_PREFIX_.'htl_room_information` hri + LEFT JOIN `'._DB_PREFIX_.'htl_room_disable_dates` hrdd + ON (hrdd.`id_room` = hri.`id`) + LEFT JOIN `'._DB_PREFIX_.'product` p + ON (p.`id_product` = hri.`id_product`) + WHERE hri.`id_status` = '.(int) HotelRoomInformation::STATUS_TEMPORARY_INACTIVE.' + AND ("'.pSQL($discreteDate['date_from']).'" >= hrdd.`date_from` AND "'.pSQL($discreteDate['date_from']).'" < hrdd.`date_to`) + AND p.`active` = 1'. + (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '').' + ) AS num_temporarily_inactive + ) AS t'; + + $value = Db::getInstance()->getValue($sql); + Cache::store($cacheKey, $value); + } + + $result[$discreteDate['timestamp_from']] = Cache::retrieve($cacheKey); + } + + return $result; + } } diff --git a/controllers/admin/AdminStatsTabController.php b/controllers/admin/AdminStatsTabController.php index 54b1682fb..72c2b2e85 100644 --- a/controllers/admin/AdminStatsTabController.php +++ b/controllers/admin/AdminStatsTabController.php @@ -150,8 +150,13 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor $tpl = $this->createTemplate('menu.tpl'); $modules = $this->getModules(); + $key_statsforecast = null; $module_instance = array(); foreach ($modules as $m => $module) { + if ($module['name'] == 'statsforecast') { + $key_statsforecast = $m; + } + if ($module_instance[$module['name']] = Module::getInstanceByName($module['name'])) { $modules[$m]['displayName'] = $module_instance[$module['name']]->displayName; } else { @@ -161,6 +166,9 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor } uasort($modules, array($this, 'checkModulesNames')); + if (!is_null($key_statsforecast)) { + $modules = array($key_statsforecast => $modules[$key_statsforecast]) + $modules; + } $tpl->assign(array( 'current' => self::$currentIndex, diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php index d2024c057..87f8e3f5e 100644 --- a/controllers/admin/AdminTranslationsController.php +++ b/controllers/admin/AdminTranslationsController.php @@ -295,9 +295,6 @@ class AdminTranslationsControllerCore extends AdminController } } - $thm_name = str_replace('.', '', Tools::getValue('theme')); - $kpi_key = substr(strtoupper($thm_name.'_'.Tools::getValue('lang')), 0, 16); - if ($fd = fopen($file_path, 'w')) { // Get value of button save and stay $save_and_stay = Tools::isSubmit('submitTranslations'.$type.'AndStay'); @@ -323,9 +320,22 @@ class AdminTranslationsControllerCore extends AdminController } } - ConfigurationKPI::updateValue('FRONTOFFICE_TRANSLATIONS_EXPIRE', time()); - ConfigurationKPI::updateValue('TRANSLATE_TOTAL_'.$kpi_key, count($_POST)); - ConfigurationKPI::updateValue('TRANSLATE_DONE_'.$kpi_key, count($to_insert)); + if (in_array($this->type_selected, array('front', 'back'))) { + if ($this->type_selected == 'front') { + $thm_name = str_replace('.', '', Tools::getValue('theme')); + $kpi_key = substr(strtoupper($thm_name.'_'.Tools::getValue('lang')), 0, 16); + + ConfigurationKPI::updateValue('FRONTOFFICE_TRANSLATIONS_EXPIRE', time()); + ConfigurationKPI::updateValue('FRONTOFFICE_TRANSLATE_TOTAL_'.$kpi_key, count($_POST)); + ConfigurationKPI::updateValue('FRONTOFFICE_TRANSLATE_DONE_'.$kpi_key, count($to_insert)); + } else { + $kpi_key = substr(strtoupper(Tools::getValue('lang')), 0, 16); + + ConfigurationKPI::updateValue('BACKOFFICE_TRANSLATIONS_EXPIRE', time()); + ConfigurationKPI::updateValue('BACKOFFICE_TRANSLATE_TOTAL_'.$kpi_key, count($_POST)); + ConfigurationKPI::updateValue('BACKOFFICE_TRANSLATE_DONE_'.$kpi_key, count($to_insert)); + } + } // translations array is ordered by key (easy merge) ksort($to_insert); @@ -1426,20 +1436,7 @@ class AdminTranslationsControllerCore extends AdminController $kpis[] = $helper->generate(); $helper = new HelperKpi(); - $helper->id = 'box-country'; - $helper->icon = 'icon-home'; - $helper->color = 'color2'; - $helper->title = $this->l('Main Country', null, null, false); - $helper->subtitle = $this->l('30 Days', null, null, false); - if (ConfigurationKPI::get('MAIN_COUNTRY', $this->context->language->id) !== false) { - $helper->value = ConfigurationKPI::get('MAIN_COUNTRY', $this->context->language->id); - } - $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=main_country'; - $helper->refresh = (bool)(ConfigurationKPI::get('MAIN_COUNTRY_EXPIRE', $this->context->language->id) < $time); - $kpis[] = $helper->generate(); - - $helper = new HelperKpi(); - $helper->id = 'box-translations'; + $helper->id = 'box-fo-translations'; $helper->icon = 'icon-list'; $helper->color = 'color3'; $helper->title = $this->l('Front office Translations', null, null, false); @@ -1450,6 +1447,18 @@ class AdminTranslationsControllerCore extends AdminController $helper->refresh = (bool)(ConfigurationKPI::get('FRONTOFFICE_TRANSLATIONS_EXPIRE') < $time); $kpis[] = $helper->generate(); + $helper = new HelperKpi(); + $helper->id = 'box-bo-translations'; + $helper->icon = 'icon-list'; + $helper->color = 'color4'; + $helper->title = $this->l('Back office Translations', null, null, false); + if (ConfigurationKPI::get('BACKOFFICE_TRANSLATIONS') !== false) { + $helper->value = ConfigurationKPI::get('BACKOFFICE_TRANSLATIONS'); + } + $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=backoffice_translations'; + $helper->refresh = (bool)(ConfigurationKPI::get('BACKOFFICE_TRANSLATIONS_EXPIRE') < $time); + $kpis[] = $helper->generate(); + $helper = new HelperKpiRow(); $helper->kpis = $kpis; return $helper->generate(); diff --git a/js/admin/dashboard.js b/js/admin/dashboard.js index 8757970b7..8bba6525b 100644 --- a/js/admin/dashboard.js +++ b/js/admin/dashboard.js @@ -109,15 +109,6 @@ function data_value(widget_name, data) { } } -function data_avail_pie_chart(widget_name, data) { - if (data) { - $("#pie_occupied_text").text(data.count_occupied + '/' + data.count_total); - $("#pie_avail_text").text(data.count_available); - $("#pie_inactive_text").text(data.count_unavailable); - generateAvailablityPieChart(data.chart_data); - } -} - function data_trends(widget_name, data) { for (var data_id in data) { this.el = $('#' + data_id); diff --git a/modules/dashactivity/dashactivity.php b/modules/dashactivity/dashactivity.php index 284b75071..9530d987b 100644 --- a/modules/dashactivity/dashactivity.php +++ b/modules/dashactivity/dashactivity.php @@ -86,17 +86,9 @@ class Dashactivity extends Module public function hookDashboardZoneOne($params) { - $gapi_mode = 'configure'; - if (!Module::isInstalled('gapi')) { - $gapi_mode = 'install'; - } elseif (($gapi = Module::getInstanceByName('gapi')) && Validate::isLoadedObject($gapi) && $gapi->isConfigured()) { - $gapi_mode = false; - } - $this->context->smarty->assign($this->getConfigFieldsValues()); $this->context->smarty->assign( array( - 'gapi_mode' => $gapi_mode, 'dashactivity_config_form' => $this->renderConfigForm(), 'date_subtitle' => $this->l('(from %s to %s)'), 'date_format' => $this->context->language->date_format_lite, @@ -160,26 +152,23 @@ class Dashactivity extends Module ); } - $gapi = Module::isInstalled('gapi') ? Module::getInstanceByName('gapi') : false; - if (Validate::isLoadedObject($gapi) && $gapi->isConfigured()) { + $objQGA = Module::isEnabled('qlogoogleanalytics') ? Module::getInstanceByName('qlogoogleanalytics') : false; + if (Validate::isLoadedObject($objQGA) && $objQGA->isConfigured()) { $visits = $unique_visitors = $online_visitor = 0; - if ($result = $gapi->requestReportData('', 'ga:visits,ga:visitors', Tools::substr($params['date_from'], 0, 10), Tools::substr($params['date_to'], 0, 10), null, null, 1, 1)) { + if ($result = $objQGA->requestReportData('', 'ga:visits,ga:visitors', Tools::substr($params['date_from'], 0, 10), Tools::substr($params['date_to'], 0, 10), null, null, 1, 1)) { $visits = $result[0]['metrics']['visits']; $unique_visitors = $result[0]['metrics']['visitors']; } } else { - $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' - SELECT COUNT(*) as visits, COUNT(DISTINCT `id_guest`) as unique_visitors - FROM `'._DB_PREFIX_.'connections` - WHERE `date_add` BETWEEN "'.pSQL($params['date_from']).'" AND "'.pSQL($params['date_to']).'" - '.Shop::addSqlRestriction(false) - ); + $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow( + 'SELECT COUNT(*) AS visits, COUNT(DISTINCT `id_guest`) AS unique_visitors + FROM `'._DB_PREFIX_.'connections` + WHERE `date_add` BETWEEN "'.pSQL($params['date_from']).'" AND "'.pSQL($params['date_to']).'" + '.Shop::addSqlRestriction(false) + ); extract($row); } - // Online visitors is only available with Analytics Real Time still in private beta at this time (October 18th, 2013). - // if ($result = $gapi->requestReportData('', 'ga:activeVisitors', null, null, null, null, 1, 1)) - // $online_visitor = $result[0]['metrics']['activeVisitors']; if ($maintenance_ips = Configuration::get('PS_MAINTENANCE_IP')) { $maintenance_ips = implode(',', array_map('ip2long', array_map('trim', explode(',', $maintenance_ips)))); } @@ -358,10 +347,10 @@ class Dashactivity extends Module protected function getReferer($date_from, $date_to, $limit = 3) { - $gapi = Module::isInstalled('gapi') ? Module::getInstanceByName('gapi') : false; - if (Validate::isLoadedObject($gapi) && $gapi->isConfigured()) { + $objQGA = Module::isEnabled('qlogoogleanalytics') ? Module::getInstanceByName('qlogoogleanalytics') : false; + if (Validate::isLoadedObject($objQGA) && $objQGA->isConfigured()) { $websites = array(); - if ($result = $gapi->requestReportData( + if ($result = $objQGA->requestReportData( 'ga:source', 'ga:visitors', Tools::substr($date_from, 0, 10), diff --git a/modules/dashactivity/views/js/dashactivity.js b/modules/dashactivity/views/js/dashactivity.js index 49bffb2ad..96ee7ad9f 100644 --- a/modules/dashactivity/views/js/dashactivity.js +++ b/modules/dashactivity/views/js/dashactivity.js @@ -40,11 +40,11 @@ function pie_chart_trends(widget_name, chart_details) .datum(chart_details.data) .transition().duration(1200) .call(chart); - + nv.utils.windowResize(chart.update); return chart; - }); + }); } //TODO unify this with other function in calenda.js and replace date.js functions @@ -151,7 +151,7 @@ $(document).ready(function() { $('#date-end').change(function() { start = Date.parseDate($('#date-start').val(), 'Y-m-d'); end = Date.parseDate($('#date-end').val(), 'Y-m-d'); - + $('#customers-newsletters-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format))); $('#traffic-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format))); }); diff --git a/modules/dashavailability/dashavailability.php b/modules/dashavailability/dashavailability.php index 65f2a8614..092646a15 100644 --- a/modules/dashavailability/dashavailability.php +++ b/modules/dashavailability/dashavailability.php @@ -92,7 +92,7 @@ class DashAvailability extends Module $availability_data['values'][] = array($date, round(rand(0, 20))); } } else { - $availability_data = AdminStatsController::getAvailBarChartData($days, $dateFrom, $params['id_hotel']); + $availability_data = AdminStatsController::getAvailabilityLineChartData($days, $dateFrom, $params['id_hotel']); } $availability_data = array_merge( @@ -111,8 +111,9 @@ class DashAvailability extends Module 'date_format' => $this->context->language->date_format_lite, 'data' => $data ); + return array( - 'data_chart' => array('availableBarChart' => $data), + 'data_chart' => array('availability_line_chart1' => $data), ); } } diff --git a/modules/dashavailability/views/js/dashavailability.js b/modules/dashavailability/views/js/dashavailability.js index 001a40cc8..44b6a0f30 100644 --- a/modules/dashavailability/views/js/dashavailability.js +++ b/modules/dashavailability/views/js/dashavailability.js @@ -44,7 +44,7 @@ function line_chart_availability(widget_name, chart_details) { dashavailability_data = chart_details.data; dashavailability_chart = chart; - d3.select('#availableBarChart svg') + d3.select('#availability_line_chart1 svg') .datum(dashavailability_data) .call(chart); nv.utils.windowResize(chart.update); diff --git a/modules/dashavailability/views/templates/hook/dashboard_zone_two.tpl b/modules/dashavailability/views/templates/hook/dashboard_zone_two.tpl index ef9c0bbe1..6385a4eaf 100644 --- a/modules/dashavailability/views/templates/hook/dashboard_zone_two.tpl +++ b/modules/dashavailability/views/templates/hook/dashboard_zone_two.tpl @@ -59,7 +59,7 @@ -
+
diff --git a/modules/dashoccupancy/dashoccupancy.php b/modules/dashoccupancy/dashoccupancy.php index 472f7b446..e7aadc99f 100644 --- a/modules/dashoccupancy/dashoccupancy.php +++ b/modules/dashoccupancy/dashoccupancy.php @@ -57,19 +57,9 @@ class DashOccupancy extends Module } } - public function hookDashboardZoneOne($params) + public function hookDashboardZoneOne() { - $occupancyData = AdminStatsController::getOccupancyData( - $params['date_from'], - $params['date_to'], - $params['id_hotel'] - ); - $this->context->smarty->assign(array( - 'count_total' => sprintf('%02d', $occupancyData['count_total']), - 'count_occupied' => sprintf('%02d', $occupancyData['count_occupied']), - 'count_available' => sprintf('%02d', $occupancyData['count_available']), - 'count_unavailable' => sprintf('%02d', $occupancyData['count_unavailable']), 'date_occupancy_range' => $this->l('(from %s to %s)'), 'date_occupancy_avail_format' => $this->context->language->date_format_lite, )); @@ -79,7 +69,6 @@ class DashOccupancy extends Module public function hookDashboardData($params) { - $data = array(); if (Configuration::get('PS_DASHBOARD_SIMULATION')) { $occupancyData = array(); $occupancyData['count_total'] = sprintf('%02d', rand(0, 1000)); @@ -97,7 +86,14 @@ class DashOccupancy extends Module ); } - $chartData = array( + $dataValue = array( + 'do_count_total' => sprintf('%02d', $occupancyData['count_total']), + 'do_count_occupied' => sprintf('%02d', $occupancyData['count_occupied']), + 'do_count_available' => sprintf('%02d', $occupancyData['count_available']), + 'do_count_unavailable' => sprintf('%02d', $occupancyData['count_unavailable']), + ); + + $dataPieChartBig = array( array( 'label' => $this->l('Occupied'), 'value' => $occupancyData['count_total'] @@ -118,12 +114,14 @@ class DashOccupancy extends Module ), ); - $data['count_total'] = sprintf('%02d', $occupancyData['count_total']); - $data['count_occupied'] = sprintf('%02d', $occupancyData['count_occupied']); - $data['count_available'] = sprintf('%02d', $occupancyData['count_available']); - $data['count_unavailable'] = sprintf('%02d', $occupancyData['count_unavailable']); - $data['chart_data'] = $chartData; - - return array('data_avail_pie_chart' => $data); + return array( + 'data_value' => $dataValue, + 'data_chart' => array( + 'dash_occupancy_chart1' => array( + 'chart_type' => 'pie_chart_occupancy', + 'data' => $dataPieChartBig, + ), + ), + ); } } diff --git a/modules/dashoccupancy/views/js/dashoccupancy.js b/modules/dashoccupancy/views/js/dashoccupancy.js index 516502741..22f1d3919 100644 --- a/modules/dashoccupancy/views/js/dashoccupancy.js +++ b/modules/dashoccupancy/views/js/dashoccupancy.js @@ -17,8 +17,7 @@ * @license LICENSE.txt */ -// PIE CHART CODE -function generateAvailablityPieChart(chartData) { +function pie_chart_occupancy(widget_name, chart_details) { nv.addGraph(function() { var chart = nv.models.pieChart() .x(function(d) { return d.label }) @@ -26,26 +25,29 @@ function generateAvailablityPieChart(chartData) { .showLabels(true) .showLegend(false) .labelThreshold(.01) - .labelType("percent") + .labelType('percent') .donut(true) .donutRatio(0.35) - .color(["#A569DF", "#56CE56", "#FF655C"]); + .color(['#A569DF', '#56CE56', '#FF655C']); - d3.select("#availablePieChart svg") - .datum(chartData) + d3.select('#availablePieChart svg') + .datum(chart_details.data) .transition().duration(350) .call(chart); nv.utils.windowResize(chart.update); + return chart; }); } $(document).ready(function() { - if (typeof date_occupancy_range === "undefined") + if (typeof date_occupancy_range === 'undefined') { var date_occupancy_range = '(from %s to %s)'; + } - if (typeof date_occupancy_avail_format === "undefined") + if (typeof date_occupancy_avail_format === 'undefined') { var date_occupancy_avail_format = 'Y-mm-dd'; + } $('#date-start').change(function() { start = Date.parseDate($('#date-start').val(), 'Y-m-d'); @@ -59,4 +61,4 @@ $(document).ready(function() { $('#dashoccupancy_date_range').html(sprintf(date_occupancy_range, start.format(date_occupancy_avail_format), end.format(date_occupancy_avail_format))); }); -}); \ No newline at end of file +}); diff --git a/modules/dashoccupancy/views/templates/hook/dashboard_zone_one.tpl b/modules/dashoccupancy/views/templates/hook/dashboard_zone_one.tpl index 9d289a61f..480eba249 100644 --- a/modules/dashoccupancy/views/templates/hook/dashboard_zone_one.tpl +++ b/modules/dashoccupancy/views/templates/hook/dashboard_zone_one.tpl @@ -39,8 +39,8 @@ {l s='Occupied' mod='dashoccupancy'}

-

- {$count_occupied|escape:'htmlall':'UTF-8'}/{$count_total|escape:'htmlall':'UTF-8'} +

+ /

@@ -56,7 +56,7 @@

- {$count_available|escape:'htmlall':'UTF-8'} +

@@ -72,7 +72,7 @@

- {$count_unavailable|escape:'htmlall':'UTF-8'} +

diff --git a/modules/dashperformance/views/css/dashperformance.css b/modules/dashperformance/views/css/dashperformance.css index c52b803a6..5d8873915 100644 --- a/modules/dashperformance/views/css/dashperformance.css +++ b/modules/dashperformance/views/css/dashperformance.css @@ -24,6 +24,10 @@ font-weight: 500; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); margin-bottom: 25px; + transition: 0.25s; +} +.preformance-index-wrapper:hover { + transform: translate(0, -3px); } .preformance-index-wrapper .value-wrapper { font-size: 18px; diff --git a/modules/dashproducts/dashproducts.php b/modules/dashproducts/dashproducts.php index f40a124ef..a87379cae 100644 --- a/modules/dashproducts/dashproducts.php +++ b/modules/dashproducts/dashproducts.php @@ -398,7 +398,7 @@ class DashProducts extends Module } } else { $link = $this->context->link->getAdminLink('AdminModules').'&configure=statsdata'; - $body = '
'.$this->l('You must enable the "Save global page views" option from ').'Data mining for statistics'.$this->l(' module in order to display the most viewed room types, or use the Google Analytics module.').'
'; + $body = '
'.$this->l('You must enable the "Save global page views" option from ').'Data mining for statistics'.$this->l(' module in order to display the most viewed room types, or use the QloApps Google Analytics module.').'
'; } return array('header' => $header, 'body' => $body); } @@ -444,6 +444,7 @@ class DashProducts extends Module if (is_array($hotels) && count($hotels)) foreach ($hotels as $hotel) { $objHBI = new HotelBranchInformation($hotel['id_hotel'], $this->context->language->id); + $addressInfo = $objHBI->getAddress($hotel['id_hotel']); $tr = array(); $tr[] = array( 'id' => 'reference', @@ -459,7 +460,7 @@ class DashProducts extends Module ); $tr[] = array( 'id' => 'location', - 'value' => $objHBI->address, + 'value' => $addressInfo['address1'], 'class' => 'text-center', ); $tr[] = array( @@ -471,7 +472,7 @@ class DashProducts extends Module } } else { $link = $this->context->link->getAdminLink('AdminModules').'&configure=statsdata'; - $body = '
'.$this->l('You must enable the "Save global page views" option from ').'Data mining for statistics'.$this->l(' module in order to display the most viewed room types, or use the Google Analytics module.').'
'; + $body = '
'.$this->l('You must enable the "Save global page views" option from ').'Data mining for statistics'.$this->l(' module in order to display the most viewed room types, or use the QloApps Google Analytics module.').'
'; } return array('header' => $header, 'body' => $body); @@ -542,16 +543,17 @@ class DashProducts extends Module public function getTotalViewed($date_from, $date_to, $limit = 10) { - $gapi = Module::isInstalled('gapi') ? Module::getInstanceByName('gapi') : false; - if (Validate::isLoadedObject($gapi) && $gapi->isConfigured()) { + $objQGA = Module::isEnabled('qlogoogleanalytics') ? Module::getInstanceByName('qlogoogleanalytics') : false; + if (Validate::isLoadedObject($objQGA) && $objQGA->isConfigured()) { $products = array(); // Only works with the default product URL pattern at this time - if ($result = $gapi->requestReportData('ga:pagePath', 'ga:visits', $date_from, $date_to, '-ga:visits', 'ga:pagePath=~/([a-z]{2}/)?([a-z]+/)?[0-9][0-9]*\-.*\.html$', 1, 10)) - foreach ($result as $row) - { - if (preg_match('@/([a-z]{2}/)?([a-z]+/)?([0-9]+)\-.*\.html$@', $row['dimensions']['pagePath'], $matches)) + if ($result = $objQGA->requestReportData('ga:pagePath', 'ga:visits', $date_from, $date_to, '-ga:visits', 'ga:pagePath=~/([a-z]{2}/)?([a-z]+/)?[0-9][0-9]*\-.*\.html$', 1, $limit)) { + foreach ($result as $row) { + if (preg_match('@/([a-z]{2}/)?([a-z]+/)?([0-9]+)\-.*\.html@', $row['dimensions']['pagePath'], $matches)) { $products[] = array('id_object' => (int)$matches[3], 'counter' => $row['metrics']['visits']); + } } + } return $products; } else { @@ -579,14 +581,13 @@ class DashProducts extends Module return array(); } - $pageType = Page::getPageTypeByName('category'); return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS( 'SELECT hbi.`id` AS `id_hotel`, cl.`name` AS `hotel_name`, pv.`counter` AS `views` FROM `'._DB_PREFIX_.'page_viewed` pv LEFT JOIN `'._DB_PREFIX_.'page` p ON (p.`id_page` = pv.`id_page`) LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON (pt.`id_page_type` = p.`id_page_type`) LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cl.`id_category` = p.`id_object`) - LEFT JOIN `'._DB_PREFIX_.'htl_branch_info` hbi ON (hbi.`id_category` = hbi.`id_category`) + LEFT JOIN `'._DB_PREFIX_.'htl_branch_info` hbi ON (hbi.`id_category` = cl.`id_category`) LEFT JOIN `'._DB_PREFIX_.'date_range` dr ON (pv.`id_date_range` = dr.`id_date_range`) WHERE pt.`name` = "'.pSQL('category').'" AND dr.`time_start` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" diff --git a/modules/dashtrends/dashtrends.php b/modules/dashtrends/dashtrends.php index c529b6058..9c512c3aa 100644 --- a/modules/dashtrends/dashtrends.php +++ b/modules/dashtrends/dashtrends.php @@ -79,6 +79,7 @@ class Dashtrends extends Module return $this->display(__FILE__, 'dashboard_zone_two.tpl'); } + // get available data from database for each day within date range protected function getData($date_from, $date_to, $id_hotel) { // We need the following figures to calculate our stats @@ -113,6 +114,7 @@ class Dashtrends extends Module return $tmp_data; } + // interpolate data for missing days within date range protected function refineData($date_from, $date_to, $gross_data) { $refined_data = array( @@ -127,31 +129,30 @@ class Dashtrends extends Module $from = strtotime($date_from.' 00:00:00'); $to = min(time(), strtotime($date_to.' 23:59:59')); for ($date = $from; $date <= $to; $date = strtotime('+1 day', $date)) { + // initialize values for current date first $refined_data['sales'][$date] = 0; - if (isset($gross_data['total_paid_tax_excl'][$date])) { - $refined_data['sales'][$date] += $gross_data['total_paid_tax_excl'][$date]; - } + $refined_data['orders'][$date] = 0; + $refined_data['average_cart_value'][$date] = 0; + $refined_data['visits'][$date] = 0; + $refined_data['conversion_rate'][$date] = 0; + $refined_data['net_profits'][$date] = 0; + // calculate actual values now for current date from available $gross_data to be used to display in line chart + $refined_data['sales'][$date] = isset($gross_data['total_paid_tax_excl'][$date]) ? $gross_data['total_paid_tax_excl'][$date] : 0; $refined_data['orders'][$date] = isset($gross_data['orders'][$date]) ? $gross_data['orders'][$date] : 0; $refined_data['average_cart_value'][$date] = $refined_data['orders'][$date] ? $refined_data['sales'][$date] / $refined_data['orders'][$date] : 0; $refined_data['visits'][$date] = isset($gross_data['visits'][$date]) ? $gross_data['visits'][$date] : 0; $refined_data['conversion_rate'][$date] = $refined_data['visits'][$date] ? $refined_data['orders'][$date] / $refined_data['visits'][$date] : 0; - $refined_data['net_profits'][$date] = 0; - if (isset($gross_data['total_paid_tax_excl'][$date])) { - $refined_data['net_profits'][$date] += $gross_data['total_paid_tax_excl'][$date]; - } - if (isset($gross_data['total_purchases'][$date])) { - $refined_data['net_profits'][$date] -= $gross_data['total_purchases'][$date]; - } - if (isset($gross_data['total_expenses'][$date])) { - $refined_data['net_profits'][$date] -= $gross_data['total_expenses'][$date]; - } + $refined_data['net_profits'][$date] += (isset($gross_data['total_paid_tax_excl'][$date]) ? $gross_data['total_paid_tax_excl'][$date] : 0); + $refined_data['net_profits'][$date] -= (isset($gross_data['total_purchases'][$date]) ? $gross_data['total_purchases'][$date] : 0); + $refined_data['net_profits'][$date] -= (isset($gross_data['total_expenses'][$date]) ? $gross_data['total_expenses'][$date] : 0); } return $refined_data; } + // calculate sum of individual values protected function addupData($data) { $summing = array( @@ -232,7 +233,7 @@ class Dashtrends extends Module 'orders_score' => Tools::displayNumber($this->dashboard_data_sum['orders'], $this->currency), 'cart_value_score' => $cart_value_score, 'visits_score' => Tools::displayNumber($this->dashboard_data_sum['visits'], $this->currency), - 'conversion_rate_score' => round(100 * $this->dashboard_data_sum['conversion_rate'], 2).'%', + 'conversion_rate_score' => sprintf('%0.2f', 100 * $this->dashboard_data_sum['conversion_rate']).'%', 'net_profits_score' => $net_profit_score, ), 'data_trends' => $this->data_trends, @@ -309,7 +310,7 @@ class Dashtrends extends Module $charts = array( 'sales' => $this->l('Sales'), - 'orders' => $this->l('Orders'), + 'orders' => $this->l('Bookings'), 'average_cart_value' => $this->l('Average Cart Value'), 'visits' => $this->l('Visits'), 'conversion_rate' => $this->l('Conversion Rate'), @@ -317,7 +318,7 @@ class Dashtrends extends Module ); $gfx_color = array('#72C3F0','#56CE56','#FF4036','#FF7F0E','#A569DF','#AF8A42'); - $gfx_color_border = array('#11f0fc','#118c11','#9e1010','#af5c13','#681daf','#845c0d'); + $gfx_color_border = $gfx_color; $gfx_color_compare = array('#1777B6','#19900d','#b9140c','#bf6307','#6B399C','#B3591F'); $i = 0; diff --git a/modules/dashtrends/views/templates/hook/dashboard_zone_two.tpl b/modules/dashtrends/views/templates/hook/dashboard_zone_two.tpl index aad61f1db..3eff771d5 100644 --- a/modules/dashtrends/views/templates/hook/dashboard_zone_two.tpl +++ b/modules/dashtrends/views/templates/hook/dashboard_zone_two.tpl @@ -64,7 +64,7 @@
-
{l s='Cart Value' mod='dashtrends'}
+
{l s='Average Cart Value' mod='dashtrends'}
@@ -77,14 +77,14 @@
+ data-toggle="tooltip" data-placement="top" data-original-title="{l s='Conversion Rate is the percentage of visits that resulted in a validated booking.' mod='dashtrends'}" data-placement="bottom" style="background-color: #A569DF;">
{l s='Conversion Rate' mod='dashtrends'}
{l s='Net Profit' mod='dashtrends'}
diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index 0eb8610cd..f8da3c535 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -1124,10 +1124,10 @@ class HotelBookingDetail extends ObjectModel * * @return [boolean] [true if updated otherwise false] */ - public function updateOrderRefundStatus($id_order, $date_from = false, $date_to = false, $id_rooms = array()) + public function updateOrderRefundStatus($id_order, $date_from = false, $date_to = false, $id_rooms = array(), $is_refunded = 1) { $table = 'htl_booking_detail'; - $data = array('is_refunded' => 1); + $data = array('is_refunded' => (int) $is_refunded); if ($id_rooms) { foreach ($id_rooms as $key_rm => $val_rm) { $where = 'id_order='.(int)$id_order.' AND id_room = '.(int)$val_rm['id_room'].' AND `date_from`= \''. diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index 0d18ff40f..e686d2804 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -346,14 +346,40 @@ class hotelreservationsystem extends Module } } - public function hookActionOrderStatusPostUpdate($params) + public function hookActionOrderStatusUpdate($params) { - $objHtlBkDtl = new HotelBookingDetail(); + $objHotelBookingDetail = new HotelBookingDetail(); + $statusesAvailable = $objHotelBookingDetail->getOrderStatusToFreeBookedRoom(); - // Make rooms available for booking if order status is cancelled, refunded or error - if (in_array($params['newOrderStatus']->id, $objHtlBkDtl->getOrderStatusToFreeBookedRoom())) { - if (!$objHtlBkDtl->updateOrderRefundStatus($params['id_order'])) { - $this->context->controller->errors[] = $this->l('Error while making booked rooms available, attached with this order. Please try again !!'); + if (in_array($params['newOrderStatus']->id, $statusesAvailable)) { + // make rooms available for booking if order status is changing to cancelled, refunded or error + if (!$objHotelBookingDetail->updateOrderRefundStatus( + $params['id_order'], + false, + false, + array(), + 1 + )) { + $this->context->controller->errors[] = $this->l('Error while making rooms available attached with this order. Please try again.'); + } + } else { + $objOrder = new Order($params['id_order']); + if (!Validate::isLoadedObject($objOrder)) { + return; + } + + $objOrderStatusCurrent = $objOrder->getCurrentOrderState(); + if (in_array($objOrderStatusCurrent->id, $statusesAvailable)) { + // make rooms unavailable for booking if previous order status was any of cancelled, refunded or error + if (!$objHotelBookingDetail->updateOrderRefundStatus( + $params['id_order'], + false, + false, + array(), + 0 + )) { + $this->context->controller->errors[] = $this->l('Error while making rooms unavailable attached with this order. Please try again.'); + } } } } @@ -514,7 +540,7 @@ class hotelreservationsystem extends Module 'actionObjectProfileAddAfter', 'actionObjectProfileDeleteBefore', 'actionObjectGroupDeleteBefore', - 'actionOrderStatusPostUpdate' + 'actionOrderStatusUpdate', ) ); } diff --git a/modules/pagesnotfound/pagesnotfound.php b/modules/pagesnotfound/pagesnotfound.php index 2c40e5be4..187e07198 100644 --- a/modules/pagesnotfound/pagesnotfound.php +++ b/modules/pagesnotfound/pagesnotfound.php @@ -164,7 +164,7 @@ class PagesNotFound extends Module '; } else { - $this->html .= '
'.$this->l('No "page not found" issue registered for now.').'
'; + $this->html .= '
'.$this->l('No "Page not found" issue registered or database has been cleared for this time period.').'
'; } if (count($pages)) { diff --git a/modules/sekeywords/sekeywords.php b/modules/sekeywords/sekeywords.php index 8843ff70f..8f57b1398 100644 --- a/modules/sekeywords/sekeywords.php +++ b/modules/sekeywords/sekeywords.php @@ -126,9 +126,9 @@ class SEKeywords extends ModuleGraph

 

'.$this->l('How does it work?').'

' - .$this->l('When a visitor comes to your website, the web server notes the URL of the site he/she comes from. This module then parses the URL, and if it finds a reference to a known search engine, it finds the keywords in it.').'
'. - $this->l('This module can recognize all the search engines listed in QloApps\'s Stats/Search Engine page -- and you can add more!').'
'. - $this->l('IMPORTANT NOTE: in September 2013, Google chose to encrypt its searches queries using SSL. This means all the referer-based tools in the World (including this one) cannot identify Google keywords anymore.').' + .$this->l('When a visitor comes to your website, the web server notes the URL of the site he/she came from. This module then parses the URL, and if it finds a reference to a known search engine, it finds the keywords in it.').'
'. + $this->l('This module can recognize all the search engines listed on Stats > Search Engines page -- and you can add more!').'
'. + $this->l('IMPORTANT: In September 2013, Google chose to encrypt its searche queries using SSL. This means all HTTP referer-based tools in the world (including this one) cannot identify Google keywords anymore.').'

'.($total == 1 ? sprintf($this->l('%d keyword matches your query.'), $total) : sprintf($this->l('%d keywords match your query.'), $total)).'

'; @@ -173,7 +173,7 @@ class SEKeywords extends ModuleGraph } $table .= ''; $this->html .= '
'.$this->engine(array('type' => 'pie')).'
- < '.$this->l('CSV Export').' + < '.$this->l('CSV Export').' '.$form.'
'.$table; } else { $this->html .= $form.'

'.$this->l('No keywords').'

'; diff --git a/modules/statsbestcategories/statsbestcategories.php b/modules/statsbestcategories/statsbestcategories.php index fef2b8079..6c2cd75cf 100644 --- a/modules/statsbestcategories/statsbestcategories.php +++ b/modules/statsbestcategories/statsbestcategories.php @@ -56,34 +56,46 @@ class StatsBestCategories extends ModuleGrid $this->columns = array( array( 'id' => 'name', - 'header' => $this->l('Name'), - 'dataIndex' => 'name', + 'header' => $this->l('Hotel name'), + 'dataIndex' => 'hotel_name', 'align' => 'left' ), array( 'id' => 'totalRoomsBooked', - 'header' => $this->l('Total Rooms Booked'), + 'header' => $this->l('Rooms booked'), 'dataIndex' => 'totalRoomsBooked', 'align' => 'center' ), array( 'id' => 'totalPriceSold', - 'header' => $this->l('Total Price'), + 'header' => $this->l('Sales'), 'dataIndex' => 'totalPriceSold', 'align' => 'center' ), array( 'id' => 'totalWholeSalePriceSold', - 'header' => $this->l('Total Margin'), + 'header' => $this->l('Margin'), 'dataIndex' => 'totalWholeSalePriceSold', 'align' => 'center' ), array( 'id' => 'totalPageViewed', - 'header' => $this->l('Total Viewed'), + 'header' => $this->l('Views'), 'dataIndex' => 'totalPageViewed', 'align' => 'center' - ) + ), + array( + 'id' => 'percentageViews', + 'header' => $this->l('Precentage of views'), + 'dataIndex' => 'percentageViews', + 'align' => 'center' + ), + array( + 'id' => 'percentageRoomsBooked', + 'header' => $this->l('Precentage of rooms booked'), + 'dataIndex' => 'percentageRoomsBooked', + 'align' => 'center' + ), ); $this->displayName = $this->l('Best hotels'); @@ -120,16 +132,20 @@ class StatsBestCategories extends ModuleGrid $this->html = '
'.$this->displayName.' -
- '.$this->engine($engine_params).' + '; + if (!(Module::isEnabled('statsdata') && Configuration::get('PS_STATSDATA_PAGESVIEWS'))) { + $link = $this->context->link->getAdminLink('AdminModules').'&configure=statsdata'; + $this->html .= '
'.$this->l('You must enable the "Save global page views" option from ').'Data mining for statistics'.$this->l(' module in order to display the most viewed hotels, or use the QloApps Google Analytics module.').'
'; + } + + $this->html .= $this->engine($engine_params).'
- '.$this->l('CSV Export').' + '.$this->l('CSV Export').'
'; - return $this->html; } @@ -177,113 +193,54 @@ class StatsBestCategories extends ModuleGrid $onlyChildren = 'AND NOT EXISTS (SELECT NULL FROM '._DB_PREFIX_.'category WHERE id_parent = ca.id_category)'; } - // Get best categories - if (version_compare(_PS_VERSION_, '1.6.1.1', '>=')) { - $this->query = ' - SELECT SQL_CALC_FOUND_ROWS ca.`id_category`, CONCAT(parent.name, \' > \', calang.`name`) as name, - IFNULL(SUM(t.`totalQuantitySold`), 0) AS totalQuantitySold, - ROUND(IFNULL(SUM(t.`totalPriceSold`), 0), 2) AS totalPriceSold, - ROUND(IFNULL(SUM(t.`totalWholeSalePriceSold`), 0), 2) AS totalWholeSalePriceSold, - ( - SELECT IFNULL(SUM(pv.`counter`), 0) - FROM `'._DB_PREFIX_.'page` p - LEFT JOIN `'._DB_PREFIX_.'page_viewed` pv ON p.`id_page` = pv.`id_page` - LEFT JOIN `'._DB_PREFIX_.'date_range` dr ON pv.`id_date_range` = dr.`id_date_range` - LEFT JOIN `'._DB_PREFIX_.'product` pr ON CAST(p.`id_object` AS UNSIGNED INTEGER) = pr.`id_product` - LEFT JOIN `'._DB_PREFIX_.'category_product` capr2 ON capr2.`id_product` = pr.`id_product` - WHERE capr.`id_category` = capr2.`id_category` - AND p.`id_page_type` = 1 - AND dr.`time_start` BETWEEN '.$date_between.' - AND dr.`time_end` BETWEEN '.$date_between.' - ) AS totalPageViewed, - ( - SELECT COUNT(id_category) FROM '._DB_PREFIX_.'category WHERE `id_parent` = ca.`id_category` - ) AS hasChildren, + // Get best hotels + $this->query = ' + SELECT hbi.`id`, hbil.`hotel_name` AS hotel_name, ( - SELECT COUNT(`id_room`) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd - LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`) - WHERE `id_hotel` IN (SELECT `id` FROM `'._DB_PREFIX_.'htl_branch_info` hbi WHERE hbi.`id_category` = ca.`id_category`) AND o.`valid` = 1 AND o.`invoice_date` BETWEEN '.$date_between.' - ) AS totalRoomsBooked - FROM `'._DB_PREFIX_.'category` ca - LEFT JOIN `'._DB_PREFIX_.'category_lang` calang ON (ca.`id_category` = calang.`id_category` AND calang.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('calang').') - LEFT JOIN `'._DB_PREFIX_.'category_lang` parent ON (ca.`id_parent` = parent.`id_category` AND parent.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('parent').') - LEFT JOIN `'._DB_PREFIX_.'category_product` capr ON ca.`id_category` = capr.`id_category` - LEFT JOIN ( - SELECT pr.`id_product`, t.`totalQuantitySold`, t.`totalPriceSold`, t.`totalWholeSalePriceSold` - FROM `'._DB_PREFIX_.'product` pr + SELECT IFNULL(SUM(pv.`counter`), 0) + FROM `' . _DB_PREFIX_ . 'page_viewed` pv + LEFT JOIN `' . _DB_PREFIX_ . 'page` p ON pv.`id_page` = p.`id_page` + LEFT JOIN `' . _DB_PREFIX_ . 'page_type` pt ON pt.`id_page_type` = p.`id_page_type` + LEFT JOIN `' . _DB_PREFIX_ . 'date_range` dr ON pv.`id_date_range` = dr.`id_date_range` + WHERE pt.`name` = "category" + AND p.`id_object` = hbi.`id_category` + AND dr.`time_start` BETWEEN '.$date_between.' + AND dr.`time_end` BETWEEN '.$date_between.' + ) AS totalPageViewed, + ( + SELECT COUNT(`id_room`) FROM `' . _DB_PREFIX_ . 'htl_booking_detail` hbd + LEFT JOIN `' . _DB_PREFIX_ . 'orders` o ON (o.`id_order` = hbd.`id_order`) + WHERE hbd.`id_hotel` = hbi.`id` AND o.`valid` = 1 AND o.`invoice_date` BETWEEN '.$date_between.' + ) AS totalRoomsBooked, + IFNULL(SUM(t.`totalQuantitySold`), 0) AS totalQuantitySold, + IFNULL(SUM(t.`totalPriceSold`), 0) AS totalPriceSold, + IFNULL(SUM(t.`totalWholeSalePriceSold`), 0) AS totalWholeSalePriceSold + FROM `' . _DB_PREFIX_ . 'htl_branch_info` hbi + LEFT JOIN `' . _DB_PREFIX_ . 'htl_room_type` hrt ON hrt.`id_hotel` = hbi.`id` + LEFT JOIN `' . _DB_PREFIX_ . 'product` pr ON pr.`id_product` = hrt.`id_product` + LEFT JOIN `' . _DB_PREFIX_ . 'htl_branch_info_lang` hbil ON hbil.`id` = hbi.`id` AND hbil.`id_lang` = '.(int)$id_lang .' LEFT JOIN ( SELECT pr.`id_product`, pa.`wholesale_price`, IFNULL(SUM(cp.`product_quantity`), 0) AS totalQuantitySold, IFNULL(SUM(cp.`product_price` * cp.`product_quantity`), 0) / o.conversion_rate AS totalPriceSold, IFNULL(SUM( - CASE + CASE WHEN cp.`original_wholesale_price` <> "0.000000" THEN cp.`original_wholesale_price` * cp.`product_quantity` - WHEN pa.`wholesale_price` <> "0.000000" - THEN pa.`wholesale_price` * cp.`product_quantity` WHEN pr.`wholesale_price` <> "0.000000" THEN pr.`wholesale_price` * cp.`product_quantity` END - ), 0) / o.conversion_rate AS totalWholeSalePriceSold - FROM `'._DB_PREFIX_.'product` pr - LEFT OUTER JOIN `'._DB_PREFIX_.'order_detail` cp ON pr.`id_product` = cp.`product_id` - LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = cp.`id_order` - LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON pa.`id_product_attribute` = cp.`product_attribute_id` - '.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').' - WHERE o.valid = 1 - AND o.invoice_date BETWEEN '.$date_between.' - GROUP BY pr.`id_product` - ) t ON t.`id_product` = pr.`id_product` - ) t ON t.`id_product` = capr.`id_product` - '.(($categories) ? 'WHERE ca.id_category IN ('.implode(', ', $categories).')' : '').' - '.$onlyChildren.' - GROUP BY ca.`id_category` - HAVING ca.`id_category` != 1'; - } else { - $this->query = ' - SELECT SQL_CALC_FOUND_ROWS ca.`id_category`, CONCAT(parent.name, \' > \', calang.`name`) as name, - IFNULL(SUM(t.`totalQuantitySold`), 0) AS totalQuantitySold, - ROUND(IFNULL(SUM(t.`totalPriceSold`), 0), 2) AS totalPriceSold, - ( - SELECT IFNULL(SUM(pv.`counter`), 0) - FROM `' . _DB_PREFIX_ . 'page` p - LEFT JOIN `' . _DB_PREFIX_ . 'page_viewed` pv ON p.`id_page` = pv.`id_page` - LEFT JOIN `' . _DB_PREFIX_ . 'date_range` dr ON pv.`id_date_range` = dr.`id_date_range` - LEFT JOIN `' . _DB_PREFIX_ . 'product` pr ON CAST(p.`id_object` AS UNSIGNED INTEGER) = pr.`id_product` - LEFT JOIN `' . _DB_PREFIX_ . 'category_product` capr2 ON capr2.`id_product` = pr.`id_product` - WHERE capr.`id_category` = capr2.`id_category` - AND p.`id_page_type` = 1 - AND dr.`time_start` BETWEEN ' . $date_between . ' - AND dr.`time_end` BETWEEN ' . $date_between . ' - ) AS totalPageViewed, - ( - SELECT COUNT(id_category) FROM '._DB_PREFIX_.'category WHERE `id_parent` = ca.`id_category` - ) AS hasChildren - FROM `' . _DB_PREFIX_ . 'category` ca - LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` calang ON (ca.`id_category` = calang.`id_category` AND calang.`id_lang` = ' . (int)$id_lang . Shop::addSqlRestrictionOnLang('calang') . ') - LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` parent ON (ca.`id_parent` = parent.`id_category` AND parent.`id_lang` = ' . (int)$id_lang . Shop::addSqlRestrictionOnLang('parent') . ') - LEFT JOIN `' . _DB_PREFIX_ . 'category_product` capr ON ca.`id_category` = capr.`id_category` - LEFT JOIN ( - SELECT pr.`id_product`, t.`totalQuantitySold`, t.`totalPriceSold` - FROM `' . _DB_PREFIX_ . 'product` pr - LEFT JOIN ( - SELECT pr.`id_product`, - IFNULL(SUM(cp.`product_quantity`), 0) AS totalQuantitySold, - IFNULL(SUM(cp.`product_price` * cp.`product_quantity`), 0) / o.conversion_rate AS totalPriceSold + ), 0) / o.conversion_rate AS totalWholeSalePriceSold FROM `' . _DB_PREFIX_ . 'product` pr LEFT OUTER JOIN `' . _DB_PREFIX_ . 'order_detail` cp ON pr.`id_product` = cp.`product_id` LEFT JOIN `' . _DB_PREFIX_ . 'orders` o ON o.`id_order` = cp.`id_order` - ' . Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o') . ' + LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute` pa ON pa.`id_product_attribute` = cp.`product_attribute_id` + AND o.id_shop IN (1) WHERE o.valid = 1 - AND o.invoice_date BETWEEN ' . $date_between . ' + AND o.invoice_date BETWEEN '.$date_between.' GROUP BY pr.`id_product` - ) t ON t.`id_product` = pr.`id_product` - ) t ON t.`id_product` = capr.`id_product` - ' . (($categories) ? 'WHERE ca.id_category IN (' . implode(', ', $categories) . ')' : '') . ' - '.$onlyChildren.' - GROUP BY ca.`id_category` - HAVING ca.`id_category` != 1'; - } + ) t ON t.`id_product` = hrt.`id_product` + GROUP BY (hbi.`id`)'; if (Validate::IsName($this->_sort)) { $this->query .= ' ORDER BY `'.bqSQL($this->_sort).'`'; @@ -297,19 +254,40 @@ class StatsBestCategories extends ModuleGrid } $values = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->query); - foreach ($values as &$value) { - if ((int)Tools::getIsset('export') == false) { - $parts = explode('>', $value['name']); - $value['name'] = trim($parts[1]); - } + $this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()'); + // get stats total + $sql = 'SELECT IFNULL(SUM(pv.`counter`), 0) + FROM `'._DB_PREFIX_.'page_viewed` pv + LEFT JOIN `'._DB_PREFIX_.'page` p ON pv.`id_page` = p.`id_page` + LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON pt.`id_page_type` = p.`id_page_type` + LEFT JOIN `'._DB_PREFIX_.'date_range` dr ON pv.`id_date_range` = dr.`id_date_range` + WHERE pt.`name` = "category" + AND dr.`time_start` BETWEEN '.$date_between.' + AND dr.`time_end` BETWEEN '.$date_between; + $total_views = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); + + $sql = 'SELECT COUNT(hbd.`id_room`) + FROM `'._DB_PREFIX_.'htl_booking_detail` hbd + LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`) + WHERE o.`valid` = 1 AND o.`invoice_date` BETWEEN '.$date_between; + $total_rooms_booked = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); + + $stats_total = array( + 'views' => $total_views, + 'rooms_booked' => $total_rooms_booked, + ); + + foreach ($values as &$value) { if (isset($value['totalWholeSalePriceSold'])) { $value['totalWholeSalePriceSold'] = Tools::displayPrice($value['totalPriceSold'] - $value['totalWholeSalePriceSold'], $currency); } $value['totalPriceSold'] = Tools::displayPrice($value['totalPriceSold'], $currency); + + $value['percentageViews'] = sprintf('%0.2f', $stats_total['views'] ? ($value['totalPageViewed'] / $stats_total['views']) * 100 : 0).'%'; + $value['percentageRoomsBooked'] = sprintf('%0.2f', $stats_total['rooms_booked'] ? ($value['totalRoomsBooked'] / $stats_total['rooms_booked']) * 100 : 0).'%'; } $this->_values = $values; - $this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()'); } } diff --git a/modules/statsbestcustomers/statsbestcustomers.php b/modules/statsbestcustomers/statsbestcustomers.php index 97217a806..34a161599 100644 --- a/modules/statsbestcustomers/statsbestcustomers.php +++ b/modules/statsbestcustomers/statsbestcustomers.php @@ -57,15 +57,15 @@ class StatsBestCustomers extends ModuleGrid $this->columns = array( array( - 'id' => 'lastname', - 'header' => $this->l('Last Name'), - 'dataIndex' => 'lastname', + 'id' => 'firstname', + 'header' => $this->l('First name'), + 'dataIndex' => 'firstname', 'align' => 'center' ), array( - 'id' => 'firstname', - 'header' => $this->l('First Name'), - 'dataIndex' => 'firstname', + 'id' => 'lastname', + 'header' => $this->l('Last name'), + 'dataIndex' => 'lastname', 'align' => 'center' ), array( @@ -140,7 +140,7 @@ class StatsBestCustomers extends ModuleGrid '.$this->engine($engine_params).' - '.$this->l('CSV Export').' + '.$this->l('CSV Export').' '; return $this->html; @@ -148,8 +148,9 @@ class StatsBestCustomers extends ModuleGrid public function getData() { - $this->query = ' - SELECT SQL_CALC_FOUND_ROWS c.`id_customer`, c.`lastname`, c.`firstname`, c.`email`, + $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); + + $this->query = 'SELECT SQL_CALC_FOUND_ROWS c.`id_customer`, c.`lastname`, c.`firstname`, c.`email`, COUNT(co.`id_connections`) as totalVisits, IFNULL(( SELECT ROUND(SUM(IFNULL(op.`amount`, 0) / cu.conversion_rate), 2) @@ -185,7 +186,12 @@ class StatsBestCustomers extends ModuleGrid $this->query .= ' LIMIT '.(int)$this->_start.', '.(int)$this->_limit; } - $this->_values = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->query); + $values = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->query); + foreach ($values as &$value) { + $value['totalMoneySpent'] = Tools::displayPrice($value['totalMoneySpent'], $currency); + } + + $this->_values = $values; $this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()'); } } diff --git a/modules/statsbestproducts/statsbestproducts.php b/modules/statsbestproducts/statsbestproducts.php index e2e6d1179..39d8c4e35 100644 --- a/modules/statsbestproducts/statsbestproducts.php +++ b/modules/statsbestproducts/statsbestproducts.php @@ -58,19 +58,19 @@ class StatsBestProducts extends ModuleGrid $this->columns = array( array( 'id' => 'name', - 'header' => $this->l('Room Type Name'), + 'header' => $this->l('Room type name'), 'dataIndex' => 'name', - 'align' => 'left' + 'align' => 'center' ), array( 'id' => 'hotel_name', - 'header' => $this->l('Hotel Name'), + 'header' => $this->l('Hotel name'), 'dataIndex' => 'hotel_name', - 'align' => 'left' + 'align' => 'center' ), array( 'id' => 'totalRoomsSold', - 'header' => $this->l('Rooms sold'), + 'header' => $this->l('Rooms booked'), 'dataIndex' => 'totalRoomsSold', 'align' => 'center' ), @@ -138,11 +138,17 @@ class StatsBestProducts extends ModuleGrid $this->csvExport($engine_params); } - return '
'.$this->displayName.'
- '.$this->engine($engine_params).' + $html = '
'.$this->displayName.'
'; + if (!(Module::isEnabled('statsdata') && Configuration::get('PS_STATSDATA_PAGESVIEWS'))) { + $link = $this->context->link->getAdminLink('AdminModules').'&configure=statsdata'; + $html .= '
'.$this->l('You must enable the "Save global page views" option from ').'Data mining for statistics'.$this->l(' module in order to display the most viewed room types, or use the QloApps Google Analytics module.').'
'; + } + $html .= $this->engine($engine_params).' - '.$this->l('CSV Export').' + '.$this->l('CSV Export').' '; + + return $html; } public function getData() @@ -161,24 +167,43 @@ class StatsBestProducts extends ModuleGrid WHERE pa.id_object = p.id_product AND pa.id_page_type = '.(int)Page::getPageTypeByName('product').' AND dr.time_start BETWEEN '.$date_between.' AND dr.time_end BETWEEN '.$date_between.' - ) AS totalPageViewed, - (SELECT COUNT(hbd.`id_room`) FROM '._DB_PREFIX_.'htl_booking_detail hbd WHERE hbd.`id_product` = p.id_product) AS totalRoomsSold, - ROUND(IFNULL(IFNULL((SELECT COUNT(hbd.`id_room`) FROM '._DB_PREFIX_.'htl_booking_detail hbd WHERE hbd.`id_product` = p.id_product), 0) / (1 + LEAST(TO_DAYS('.$array_date_between[1].'), TO_DAYS(NOW())) - GREATEST(TO_DAYS('.$array_date_between[0].'), TO_DAYS(product_shop.date_add))), 0), 2) as averageQuantitySold, - product_shop.active - FROM '._DB_PREFIX_.'product p - '.Shop::addSqlAssociation('product', 'p').' - LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->getLang().' '.Shop::addSqlRestrictionOnLang('pl').') - LEFT JOIN '._DB_PREFIX_.'htl_room_type hrt ON hrt.id_product = p.id_product - LEFT JOIN '._DB_PREFIX_.'htl_branch_info_lang hbil ON (hbil.id = hrt.id_hotel AND hbil.id_lang = '.(int)$this->getLang().') - LEFT JOIN '._DB_PREFIX_.'order_detail od ON od.product_id = p.id_product - LEFT JOIN '._DB_PREFIX_.'orders o ON od.id_order = o.id_order - '.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').' - '.Product::sqlStock('p', 0).' - WHERE o.valid = 1 - AND o.invoice_date BETWEEN '.$date_between.' - GROUP BY od.product_id'; + ) AS totalPageViewed,'; + if (explode(' ',trim($array_date_between[0]))[0] == explode(' ',trim($array_date_between[1]))[0]) { + $this->query .=' (SELECT + SUM(IFNULL(DATEDIFF( + IF ('.$array_date_between[1].' > hbd.`date_to`, hbd.`date_to`, '.$array_date_between[1].'), + IF ('.$array_date_between[0].' < hbd.`date_from`, hbd.`date_from`, '.$array_date_between[0].') + ), 0)) + FROM '._DB_PREFIX_.'htl_booking_detail hbd WHERE hbd.`id_product` = p.id_product AND hbd.date_from <= '.$array_date_between[0].' + AND hbd.date_to > '.$array_date_between[0].') AS totalRoomsSold, + ROUND(IFNULL(IFNULL((SELECT COUNT(hbd.`id_room`) FROM '._DB_PREFIX_.'htl_booking_detail hbd WHERE hbd.`id_product` = p.id_product AND hbd.date_from <= '.$array_date_between[0]. + ' AND hbd.date_to > '.$array_date_between[0].'), 0) / (1 + LEAST(TO_DAYS('.$array_date_between[1].'), TO_DAYS(NOW())) - GREATEST(TO_DAYS('.$array_date_between[0].'), TO_DAYS(product_shop.date_add))), 0), 2) as averageQuantitySold,'; + } else { + $this->query .= '(SELECT + SUM(IFNULL(DATEDIFF( + IF ('.$array_date_between[1].' > hbd.`date_to`, hbd.`date_to`, '.$array_date_between[1].'), + IF ('.$array_date_between[0].' < hbd.`date_from`, hbd.`date_from`, '.$array_date_between[0].') + ), 0)) + FROM '._DB_PREFIX_.'htl_booking_detail hbd WHERE hbd.`id_product` = p.id_product AND hbd.date_from BETWEEN '.$date_between.' + AND hbd.date_to BETWEEN '.$date_between.') AS totalRoomsSold, + ROUND(IFNULL(IFNULL((SELECT COUNT(hbd.`id_room`) FROM '._DB_PREFIX_.'htl_booking_detail hbd WHERE hbd.`id_product` = p.id_product AND hbd.date_from BETWEEN '.$date_between. + ' AND hbd.date_to BETWEEN '.$date_between.'), 0) / (1 + LEAST(TO_DAYS('.$array_date_between[1].'), TO_DAYS(NOW())) - GREATEST(TO_DAYS('.$array_date_between[0].'), TO_DAYS(product_shop.date_add))), 0), 2) as averageQuantitySold,'; + } + $this->query .= 'product_shop.active + FROM '._DB_PREFIX_.'product p + '.Shop::addSqlAssociation('product', 'p').' + LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->getLang().' '.Shop::addSqlRestrictionOnLang('pl').') + LEFT JOIN '._DB_PREFIX_.'htl_room_type hrt ON hrt.id_product = p.id_product + LEFT JOIN '._DB_PREFIX_.'htl_branch_info_lang hbil ON (hbil.id = hrt.id_hotel AND hbil.id_lang = '.(int)$this->getLang().') + LEFT JOIN '._DB_PREFIX_.'order_detail od ON od.product_id = p.id_product + LEFT JOIN '._DB_PREFIX_.'orders o ON od.id_order = o.id_order + '.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').' + '.Product::sqlStock('p', 0).' + WHERE o.valid = 1 + GROUP BY od.product_id'; if (Validate::IsName($this->_sort)) { + $this->query .= ' ORDER BY `'.bqSQL($this->_sort).'`'; if (isset($this->_direction) && Validate::isSortDirection($this->_direction)) { $this->query .= ' '.$this->_direction; @@ -190,6 +215,8 @@ class StatsBestProducts extends ModuleGrid } $values = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->query); + $this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()'); + $dateFrom = date("Y-m-d", strtotime($this->_employee->stats_date_from)); $dateTo = date("Y-m-d", strtotime($this->_employee->stats_date_to)); @@ -212,6 +239,5 @@ class StatsBestProducts extends ModuleGrid unset($value); $this->_values = $values; - $this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()'); } } diff --git a/modules/statsbestvouchers/statsbestvouchers.php b/modules/statsbestvouchers/statsbestvouchers.php index c748d1287..891b3ecfb 100644 --- a/modules/statsbestvouchers/statsbestvouchers.php +++ b/modules/statsbestvouchers/statsbestvouchers.php @@ -58,19 +58,19 @@ class StatsBestVouchers extends ModuleGrid 'id' => 'code', 'header' => $this->l('Code'), 'dataIndex' => 'code', - 'align' => 'left' + 'align' => 'center' ), array( 'id' => 'name', 'header' => $this->l('Name'), 'dataIndex' => 'name', - 'align' => 'left' + 'align' => 'center' ), array( 'id' => 'ca', 'header' => $this->l('Sales'), 'dataIndex' => 'ca', - 'align' => 'right' + 'align' => 'center' ), array( 'id' => 'total', @@ -112,7 +112,7 @@ class StatsBestVouchers extends ModuleGrid '.$this->engine($engine_params).' - '.$this->l('CSV Export').' + '.$this->l('CSV Export').' '; return $this->html; diff --git a/modules/statscatalog/statscatalog.php b/modules/statscatalog/statscatalog.php index c683d4018..3c90654dc 100644 --- a/modules/statscatalog/statscatalog.php +++ b/modules/statscatalog/statscatalog.php @@ -192,13 +192,13 @@ class StatsCatalog extends Module $average_viewed = $total ? ($total_page_viewed / $total) : 0; $conversion = number_format((float)($total_page_viewed ? ($total_booked_rooms / $total_page_viewed) : 0), 2, '.', ''); if ($conversion_reverse = number_format((float)($total_booked_rooms ? ($total_page_viewed / $total_booked_rooms) : 0), 2, '.', '')) { - $conversion .= sprintf($this->l('(1 purchase / %d visits)'), $conversion_reverse); + $conversion .= sprintf($this->l(' (1 purchase / %d visits)'), $conversion_reverse); } $total_nv = $total - $this->getTotalProductViewed(); $html = ' - +
'.$this->displayName.'
@@ -221,17 +221,17 @@ class StatsCatalog extends Module

@@ -241,13 +241,13 @@ class StatsCatalog extends Module if (count($products_nb) && count($products_nb) < 50) { $html .= ' -

'.$this->l('Room type never booked').'
+
'.$this->l('Room types never booked').'
- + '; @@ -268,7 +268,7 @@ class StatsCatalog extends Module diff --git a/modules/statscheckup/statscheckup.php b/modules/statscheckup/statscheckup.php index 545d53d96..f73e4f120 100644 --- a/modules/statscheckup/statscheckup.php +++ b/modules/statscheckup/statscheckup.php @@ -71,6 +71,10 @@ class StatsCheckUp extends Module public function hookAdminStatsModules() { + $this->html = ' +
' + .$this->displayName.' +
'; if (Tools::isSubmit('submitCheckup')) { $confs = array( 'CHECKUP_DESCRIPTIONS_LT', @@ -85,12 +89,12 @@ class StatsCheckUp extends Module foreach ($confs as $confname) { Configuration::updateValue($confname, (int)Tools::getValue($confname)); } - echo '
'.$this->l('Configuration updated').'
'; + $this->html .= $this->displayConfirmation($this->l('Configuration updated.')); } if (Tools::isSubmit('submitCheckupOrder')) { $this->context->cookie->checkup_order = (int)Tools::getValue('submitCheckupOrder'); - echo '
'.$this->l('Configuration updated').'
'; + $this->html .= $this->displayConfirmation($this->l('Configuration updated.')); } if (!isset($this->context->cookie->checkup_order)) { @@ -108,9 +112,9 @@ class StatsCheckUp extends Module $languages = $db->executeS($sql); $array_colors = array( - 0 => ''.$this->l('Bad').'', - 1 => ''.$this->l('Average').'', - 2 => ''.$this->l('Good').'' + 0 => ''.$this->l('Bad').'', + 1 => ''.$this->l('Average').'', + 2 => ''.$this->l('Good').'' ); $token_products = Tools::getAdminToken('AdminProducts'.(int)Tab::getIdFromClassName('AdminProducts').(int)Context::getContext()->employee->id); $divisor = 4; @@ -167,10 +171,7 @@ class StatsCheckUp extends Module 'STOCK' => array('name' => $this->l('Available rooms'), 'text' => $this->l('items')) ); - $this->html = ' -
' - .$this->displayName.' -
+ $this->html .= '
'.$this->l('ID').' '.$this->l('Name').''.$this->l('Edit / View').''.$this->l('Edit / Preview').'
diff --git a/modules/statsequipment/statsequipment.php b/modules/statsequipment/statsequipment.php index a8e146e8d..5465e535a 100644 --- a/modules/statsequipment/statsequipment.php +++ b/modules/statsequipment/statsequipment.php @@ -132,7 +132,7 @@ class StatsEquipment extends ModuleGraph

'.$this->l('Making sure that your website is accessible to as many people as possible').'

- '.$this->l('When managing a website, it is important to keep track of the software used by visitors so as to be sure that the site displays the same way for everyone. Qloapps was built to be compatible with the most recent Web browsers and computer operating systems (OS). However, because you may end up adding advanced features to your website or even modifying the core Qloapps code, these additions may not be accessible to everyone. That is why it is a good idea to keep track of the percentage of users for each type of software before adding or changing something that only a limited number of users will be able to access.').' + '.$this->l('When managing a website, it is important to keep track of the software used by visitors so as to be sure that the site displays the same way for everyone. QloApps was built to be compatible with the most recent Web browsers and computer operating systems (OS). However, because you may end up adding advanced features to your website or even modifying the core QloApps code, these additions may not be accessible to everyone. That is why it is a good idea to keep track of the percentage of users for each type of software before adding or changing something that only a limited number of users will be able to access.').'

@@ -144,7 +144,7 @@ class StatsEquipment extends ModuleGraph

'.$this->l('Indicates the percentage of each web browser used by customers.').'


- '.$this->l('CSV Export').' + '.$this->l('CSV Export').'
@@ -158,7 +158,7 @@ class StatsEquipment extends ModuleGraph

'.$this->l('Indicates the percentage of each operating system used by customers.').'


- '.$this->l('CSV Export').' + '.$this->l('CSV Export').' diff --git a/modules/statsforecast/statsforecast.php b/modules/statsforecast/statsforecast.php index 0f5132af0..a7404f323 100644 --- a/modules/statsforecast/statsforecast.php +++ b/modules/statsforecast/statsforecast.php @@ -168,7 +168,7 @@ class StatsForecast extends Module - + @@ -205,8 +205,8 @@ class StatsForecast extends Module - - + + '; @@ -223,7 +223,7 @@ class StatsForecast extends Module - + @@ -240,12 +240,12 @@ class StatsForecast extends Module - - - - - - + + + + + + @@ -313,7 +313,7 @@ class StatsForecast extends Module @@ -397,7 +397,7 @@ class StatsForecast extends Module

'.$this->l('Payment distribution').'

' - .$this->l('The amounts include taxes, so you can get an estimation of the commission due to the payment method.').' + .$this->l('The amounts in this section include taxes, so you can get an estimation of the commission due to the payment method.').'
@@ -422,19 +422,30 @@ class StatsForecast extends Module
+ + '; - foreach ($ca['payment'] as $payment) { - $this->html .= ' + if (is_array($ca['payment']) && count($ca['payment'])) { + foreach ($ca['payment'] as $payment) { + $this->html .= ' + + '; - } + } + } else { + $this->html .= ' + + + '; + } $this->html .= '
'.$this->l('Visits').' '.$this->l('Registrations').' '.$this->l('Placed orders').''.$this->l('Booked Rooms').''.$this->l('Booked rooms').' '.$this->l('Percentage of registrations').' '.$this->l('Percentage of orders').' '.$this->l('Revenue').''.(int)$row['registrations'].' '.(int)$row['countOrders'].' '.(int)$row['roomBooked'].''.($visits_today ? round(100 * (int)$row['registrations'] / $visits_today, 2).' %' : '-').''.($visits_today ? round(100 * (int)$row['countOrders'] / $visits_today, 2).' %' : '-').''.($visits_today ? sprintf('%0.2f', ($row['registrations'] / $visits_today) * 100).' %' : '--').''.($visits_today ? sprintf('%0.2f', ($row['countOrders'] / $visits_today) * 100).' %' : '--').' '.Tools::displayPrice($row['totalSales'], $currency).'
'.$this->l('Visits').' '.$this->l('Registrations').' '.$this->l('Placed orders').''.$this->l('Booked Rooms').''.$this->l('Booked rooms').' '.$this->l('Percentage of registrations').' '.$this->l('Percentage of orders').' '.$this->l('Revenue').'
'.$this->l('Average').''.(int)($this->t1 / $interval_avg).''.(int)($this->t2 / $interval_avg).''.(int)($this->t3 / $interval_avg).''.(int)($this->t4 / $interval_avg).''.($this->t1 ? round(100 * $this->t2 / $this->t1, 2).' %' : '-').''.($this->t1 ? round(100 * $this->t3 / $this->t1, 2).' %' : '-').''.sprintf('%0.2f', $this->t1 / $interval_avg).''.sprintf('%0.2f', $this->t2 / $interval_avg).''.sprintf('%0.2f', $this->t3 / $interval_avg).''.sprintf('%0.2f', $this->t4 / $interval_avg).''.($this->t1 ? sprintf('%0.2f', ($this->t2 / $this->t1) * 100).' %' : '--').''.($this->t1 ? sprintf('%0.2f', ($this->t3 / $this->t1) * 100).' %' : '--').' '.Tools::displayPrice($this->t8 / $interval_avg, $currency).'

-

'.round(100 * $customers / max(1, $visitors), 2).' %

+

'.sprintf('%0.2f', ($customers / max(1, $visitors)) * 100).' %

'.$this->l('Accounts').'

@@ -321,7 +321,7 @@ class StatsForecast extends Module

-

'.round(100 * $fullcarts / max(1, $customers), 2).' %

+

'.sprintf('%0.2f', ($fullcarts / max(1, $customers)) * 100).' %

'.$this->l('Full carts').'

@@ -329,7 +329,7 @@ class StatsForecast extends Module

-

'.round(100 * $orders / max(1, $fullcarts), 2).' %

+

'.sprintf('%0.2f', ($orders / max(1, $fullcarts)) * 100).' %

'.$this->l('Orders').'

@@ -342,7 +342,7 @@ class StatsForecast extends Module
-

'.round(100 * $orders / max(1, $customers), 2).' %

+

'.sprintf('%0.2f', ($orders / max(1, $customers)) * 100).' %

@@ -357,7 +357,7 @@ class StatsForecast extends Module -

'.round(100 * $orders / max(1, $visitors), 2).' %

+

'.sprintf('%0.2f', ($orders / max(1, $visitors)) * 100).' %

@@ -369,7 +369,7 @@ class StatsForecast extends Module

-

'.round(100 * $carts / max(1, $visitors)).' %

+

'.sprintf('%0.2f', ($carts / max(1, $visitors)) * 100).' %

'.$this->l('Carts').'

@@ -377,7 +377,7 @@ class StatsForecast extends Module

-

'.round(100 * $fullcarts / max(1, $carts)).' %

+

'.sprintf('%0.2f', ($fullcarts / max(1, $carts)) * 100).' %

'.$this->l('Module').' '.$this->l('Orders').' '.$this->l('Sales').''.$this->l('Percentage of orders').''.$this->l('Percentage of sales').' '.$this->l('Average cart value').'
'.$payment['payment_method'].' '.(int)$payment['nb'].' '.Tools::displayPrice($payment['total'], $currency).''.sprintf('%0.2f', ($ca['ventil']['nb'] ? ($payment['nb'] / $ca['ventil']['nb']) * 100 : 0)).'%'.sprintf('%0.2f', ($ca['ventil']['nb'] ? ($payment['total'] / $ca['ventil']['total_incl']) * 100 : 0)).'% '.Tools::displayPrice($payment['total'] / (int)$payment['nb'], $currency).'
'.$this->l('No data available.').'
@@ -451,17 +462,24 @@ class StatsForecast extends Module '; - foreach ($ca['lang'] as $ophone => $amount) { - $percent = (int)($ca['langprev'][$ophone]) ? number_format((100 * $amount / $ca['langprev'][$ophone]) - 100, 1, '.', ' ') : '∞'; - $this->html .= ' - - '.$ophone.' - '.Tools::displayPrice($amount, $currency).' - '.((int)$ca['ventil']['total'] ? number_format((100 * $amount / $ca['ventil']['total']), 1, '.', ' ').'%' : '-').' - '.(($percent > 0 || $percent == '∞') ? '' : ' ').' - '.(($percent > 0 || $percent == '∞') ? '+' : '').$percent.'% - '; - } + if (is_array($ca['lang']) && count($ca['lang'])) { + foreach ($ca['lang'] as $ophone => $amount) { + $percent = (int)($ca['langprev'][$ophone]) ? number_format((100 * $amount / $ca['langprev'][$ophone]) - 100, 1, '.', ' ') : '∞'; + $this->html .= ' + + '.$ophone.' + '.Tools::displayPrice($amount, $currency).' + '.sprintf('%0.2f', ($ca['ventil']['total'] ? ($amount / $ca['ventil']['total']) * 100 : 0)).'% + '.(($percent > 0 || $percent == '∞') ? '' : ' ').' + '.(($percent > 0 || $percent == '∞') ? '+' : '').$percent.'% + '; + } + } else { + $this->html .= ' + + '.$this->l('No data available.').' + '; + } $this->html .= ' @@ -479,16 +497,23 @@ class StatsForecast extends Module '; - foreach ($ca['zones'] as $zone) { - $this->html .= ' - - '.(isset($zone['name']) ? $zone['name'] : $this->l('Undefined')).' - '.(int)($zone['nb']).' - '.Tools::displayPrice($zone['total'], $currency).' - '.($ca['ventil']['nb'] ? number_format((100 * $zone['nb'] / $ca['ventil']['nb']), 1, '.', ' ') : '0').'% - '.((int)$ca['ventil']['total'] ? number_format((100 * $zone['total'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'% - '; - } + if (is_array($ca['zones']) && count($ca['zones'])) { + foreach ($ca['zones'] as $zone) { + $this->html .= ' + + '.(isset($zone['name']) ? $zone['name'] : $this->l('Undefined')).' + '.(int)($zone['nb']).' + '.Tools::displayPrice($zone['total'], $currency).' + '.sprintf('%0.2f', $ca['ventil']['nb'] ? ($zone['nb'] / $ca['ventil']['nb']) * 100 : 0).'% + '.sprintf('%0.2f', $ca['ventil']['total'] ? ($zone['total'] / $ca['ventil']['total']) * 100 : 0).'% + '; + } + } else { + $this->html .= ' + + '.$this->l('No data available.').' + '; + } $this->html .= ' @@ -523,16 +548,23 @@ class StatsForecast extends Module '; - foreach ($ca['currencies'] as $currency_row) { - $this->html .= ' - - '.$currency_row['name'].' - '.(int)($currency_row['nb']).' - '.Tools::displayPrice($currency_row['total'], $currency).' - '.($ca['ventil']['nb'] ? number_format((100 * $currency_row['nb'] / $ca['ventil']['nb']), 1, '.', ' ') : '0').'% - '.((int)$ca['ventil']['total'] ? number_format((100 * $currency_row['total'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'% - '; - } + if (is_array($ca['currencies']) && count($ca['currencies'])) { + foreach ($ca['currencies'] as $currency_row) { + $this->html .= ' + + '.$currency_row['name'].' + '.(int)($currency_row['nb']).' + '.Tools::displayPrice($currency_row['total'], $currency).' + '.sprintf('%0.2f', $ca['ventil']['nb'] ? ($currency_row['nb'] / $ca['ventil']['nb']) * 100 : 0).'% + '.sprintf('%0.2f', $ca['ventil']['total'] ? ($currency_row['total'] / $ca['ventil']['total']) * 100 : 0).'% + '; + } + } else { + $this->html .= ' + + '.$this->l('No data available.').' + '; + } $this->html .= ' @@ -633,7 +665,8 @@ class StatsForecast extends Module ORDER BY total DESC'; $ca['currencies'] = Db::getInstance()->executeS($sql); - $sql = 'SELECT SUM(total_paid_tax_excl / o.conversion_rate) as total, COUNT(*) AS nb + $sql = 'SELECT SUM(total_paid_tax_excl / o.conversion_rate) as total, + SUM(total_paid_tax_incl / o.conversion_rate) as total_incl, COUNT(*) AS nb FROM `'._DB_PREFIX_.'orders` o WHERE o.valid = 1 AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().' diff --git a/modules/statslive/statslive.php b/modules/statslive/statslive.php index 3fcdc5142..f4f4c54a2 100644 --- a/modules/statslive/statslive.php +++ b/modules/statslive/statslive.php @@ -144,10 +144,8 @@ class StatsLive extends Module $("#calendar").remove(); '; if (!Configuration::get('PS_STATSDATA_CUSTOMER_PAGESVIEWS')) { - $this->html .= ' -
'. - $this->l('You must activate the "Save page views for each customer" option in the "Data mining for statistics" (StatsData) module in order to see the pages that your visitors are currently viewing.').' -
'; + $link = $this->context->link->getAdminLink('AdminModules').'&configure=statsdata'; + $this->html .= '
'.$this->l('You must enable the "Save page views for each customer" option from ').'Data mining for statistics'.$this->l(' module in order to see the pages that your visitors are currently viewing.').'
'; } $this->html .= '

'.$this->l('Current online customers').'

'; @@ -195,7 +193,7 @@ class StatsLive extends Module '.$this->l('IP').' '.$this->l('Last activity').' '.$this->l('Current page').' - '.$this->l('Referrer').' + '.$this->l('Referer').' '; diff --git a/modules/statsnewsletter/statsnewsletter.php b/modules/statsnewsletter/statsnewsletter.php index 5875159d6..17105629b 100644 --- a/modules/statsnewsletter/statsnewsletter.php +++ b/modules/statsnewsletter/statsnewsletter.php @@ -93,7 +93,7 @@ class StatsNewsletter extends ModuleGraph
- '.$this->l('CSV Export').' + '.$this->l('CSV Export').'
@@ -125,7 +125,7 @@ class StatsNewsletter extends ModuleGraph protected function getData($layers) { - $this->_titles['main'][0] = $this->l('customers'); + $this->_titles['main'][0] = $this->l('Customers'); $this->_titles['main'][1] = $this->l('Visitors'); $this->_titles['main'][2] = $this->l('Newsletter statistics'); $this->_titles['main'][3] = $this->l('Both'); diff --git a/modules/statsorigin/statsorigin.php b/modules/statsorigin/statsorigin.php index c98158ad1..3d8c4a3b9 100644 --- a/modules/statsorigin/statsorigin.php +++ b/modules/statsorigin/statsorigin.php @@ -90,15 +90,15 @@ class StatsOrigin extends ModuleGraph if (count($websites)) { $this->_html .= '
- '.$this->l('In the tab, we break down the 10 most popular referral websites that bring customers to your online store.').' + '.$this->l('This page lists the 10 most popular referral websites that bring customers to your website.').'

'.$this->l('Guide').'

'.$this->l('What is a referral website?').'

- '.$this->l('The referrer is the URL of the previous webpage from which a link was followed by the visitor.').'
- '.$this->l('A referrer also enables you to know which keywords visitors use in search engines when browsing for your online store.').'

- '.$this->l('A referrer can be:').' + '.$this->l('A referer is the URL of the previous webpage from which a link was followed by a visitor.').'
+ '.$this->l('A referer also enables you to know which keywords visitors use in search engines when searching for your website.').'

+ '.$this->l('A referer can be:').'

- '.$this->l('CSV Export').' + '.$this->l('CSV Export').'
diff --git a/modules/statspersonalinfos/statspersonalinfos.php b/modules/statspersonalinfos/statspersonalinfos.php index 4a3bcff23..1a7513894 100644 --- a/modules/statspersonalinfos/statspersonalinfos.php +++ b/modules/statspersonalinfos/statspersonalinfos.php @@ -120,10 +120,10 @@ class StatsPersonalInfos extends ModuleGraph )).'
-

'.$this->l('Gender distribution allows you to determine the percentage of men and women shoppers on your website.').'

+

'.$this->l('Gender distribution allows you to determine the percentage of men and women customers on your website.').'


- '.$this->l('CSV Export').' + '.$this->l('CSV Export').'
@@ -140,7 +140,7 @@ class StatsPersonalInfos extends ModuleGraph

'.$this->l('Age ranges allow you to better understand target demographics.').'


- '.$this->l('CSV Export').' + '.$this->l('CSV Export').' @@ -154,10 +154,10 @@ class StatsPersonalInfos extends ModuleGraph )).'
-

'.$this->l('Country distribution allows you to analyze which part of the World your customers are booking from.').'

+

'.$this->l('Country distribution allows you to analyze which part of the world your customers are booking from.').'


- '.$this->l('CSV Export').' + '.$this->l('CSV Export').'
@@ -174,7 +174,7 @@ class StatsPersonalInfos extends ModuleGraph

'.$this->l('Currency range allows you to determine which currency your customers are using.').'


- '.$this->l('CSV Export').' + '.$this->l('CSV Export').' @@ -191,7 +191,7 @@ class StatsPersonalInfos extends ModuleGraph

'.$this->l('Language distribution allows you to analyze the browsing language used by your customers.').'


- '.$this->l('CSV Export').' + '.$this->l('CSV Export').' diff --git a/modules/statsproduct/statsproduct.php b/modules/statsproduct/statsproduct.php index 5814d7c41..4b5eb3e4e 100644 --- a/modules/statsproduct/statsproduct.php +++ b/modules/statsproduct/statsproduct.php @@ -46,7 +46,7 @@ class StatsProduct extends ModuleGraph $this->need_instance = 0; parent::__construct(); - + $this->query = array(); $this->displayName = $this->l('Room type details'); $this->description = $this->l('Adds detailed statistics for each room type to the Stats dashboard.'); $this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.7.0.99'); @@ -180,7 +180,7 @@ class StatsProduct extends ModuleGraph

'.$this->l('Number of purchases compared to number of views').'

'.$this->l('After choosing a hotel and selecting a room type, informational graphs will appear.').' @@ -216,13 +216,13 @@ class StatsProduct extends ModuleGraph
- '.$this->l('CSV Export').' + '.$this->l('CSV Export').'
@@ -252,7 +252,7 @@ class StatsProduct extends ModuleGraph '.($has_attribute ? ''.$this->l('Attribute').'' : '').' - '.$this->l('Rooms Booked').' + '.$this->l('Rooms booked').' '.$this->l('Price').' @@ -266,8 +266,8 @@ class StatsProduct extends ModuleGraph $this->html .= ' '.Tools::displayDate($sale['date_add'], null, false).' - '.(int)$sale['id_order'].' - '.(int)$sale['id_customer'].' + #'.(int)$sale['id_order'].' + #'.(int)$sale['id_customer'].' '.($has_attribute ? ''.$sale['product_name'].'' : '').' '.(int)$sale['total_booked'].' '.Tools::displayprice($sale['total'], $currency).' @@ -287,10 +287,10 @@ class StatsProduct extends ModuleGraph - '.$this->l('Room Type name').' + '.$this->l('Room type name').' - '.$this->l('Rooms Booked').' + '.$this->l('Rooms booked').' '.$this->l('Average price').' @@ -321,7 +321,7 @@ class StatsProduct extends ModuleGraph
@@ -341,7 +341,7 @@ class StatsProduct extends ModuleGraph - '.$this->l('Room Type Name').' + '.$this->l('Room type name').' '.$this->l('Available rooms').' @@ -382,7 +382,7 @@ class StatsProduct extends ModuleGraph - '.$this->l('CSV Export').' + '.$this->l('CSV Export').' '; } diff --git a/modules/statsregistrations/statsregistrations.php b/modules/statsregistrations/statsregistrations.php index 494226e05..260330edc 100644 --- a/modules/statsregistrations/statsregistrations.php +++ b/modules/statsregistrations/statsregistrations.php @@ -123,7 +123,7 @@ class StatsRegistrations extends ModuleGraph
@@ -153,7 +153,7 @@ class StatsRegistrations extends ModuleGraph
- '.$this->l('CSV Export').' + '.$this->l('CSV Export').'
@@ -170,7 +170,7 @@ class StatsRegistrations extends ModuleGraph WHERE 1 '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).' AND `date_add` BETWEEN'; - $this->_titles['main'] = $this->l('Number of customer accounts created'); + $this->_titles['main'] = $this->l('Number of customer registrations'); $this->setDateGraph($layers, true); } diff --git a/modules/statssales/statssales.php b/modules/statssales/statssales.php index f70f0c38c..5357537fb 100644 --- a/modules/statssales/statssales.php +++ b/modules/statssales/statssales.php @@ -87,8 +87,8 @@ class StatsSales extends ModuleGraph

'.$this->l('About order statuses').'

- '.$this->l('In your Back Office, you can modify the following order statuses: Awaiting Check Payment, Payment Accepted, Preparation in Progress, Canceled, Refund, Payment Error, Out of Stock, and Awaiting Bank Wire Payment.').'
- '.$this->l('These order statuses cannot be removed from the Back Office; however you have the option to add more.').' + '.$this->l('In your back office, you can modify the following order statuses: Awaiting check payment, Payment accepted, Processing in progress, Canceled, Refunded, Payment error and Awaiting bank wire payment.').'
+ '.$this->l('These order statuses cannot be removed from the back office; however you have the option to add more.').'

@@ -127,7 +127,7 @@ class StatsSales extends ModuleGraph
- '.$this->l('CSV Export').' + '.$this->l('CSV Export').'
@@ -146,7 +146,7 @@ class StatsSales extends ModuleGraph
- '.$this->l('CSV Export').' + '.$this->l('CSV Export').' @@ -164,7 +164,7 @@ class StatsSales extends ModuleGraph
- '.$this->l('CSV Export').' + '.$this->l('CSV Export').'
diff --git a/modules/statssearch/statssearch.php b/modules/statssearch/statssearch.php index 0ebfb1873..a98bb5131 100644 --- a/modules/statssearch/statssearch.php +++ b/modules/statssearch/statssearch.php @@ -130,7 +130,7 @@ class StatsSearch extends ModuleGraph if (count($result)) $this->html .= '
'.$this->engine(array('type' => 'pie')).'
- '.$this->l('CSV Export').' + '.$this->l('CSV Export').' '.$table; else $this->html .= '

'.$this->l('Cannot find any keywords that have been searched for more than once.').'

'; diff --git a/modules/statsvisits/statsvisits.php b/modules/statsvisits/statsvisits.php index ef9a13c59..3442ac1f9 100644 --- a/modules/statsvisits/statsvisits.php +++ b/modules/statsvisits/statsvisits.php @@ -31,7 +31,7 @@ if (!defined('_PS_VERSION_')) { class StatsVisits extends ModuleGraph { private $html = ''; - private $query = ''; + private $query = array(); public function __construct() { @@ -43,7 +43,7 @@ class StatsVisits extends ModuleGraph parent::__construct(); - $this->displayName = $this->l('Visits and Visitors'); + $this->displayName = $this->l('Visits and visitors'); $this->description = $this->l('Adds statistics about your visits and visitors to the Stats dashboard.'); $this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.7.0.99'); } @@ -102,7 +102,7 @@ class StatsVisits extends ModuleGraph

'.$this->l('This information is mostly qualitative. It is up to you to determine the interest of a disjointed visit.').' @@ -110,7 +110,7 @@ class StatsVisits extends ModuleGraph

'.$this->l('A visit corresponds to an internet user coming to your website, and until the end of their session, only one visit is counted.').' - '.$this->l('A visitor is an unknown person who has not registered or logged into your store. A visitor can also be considered a person who has visited your website multiple times.').' + '.$this->l('A visitor is an unknown person who has not registered or logged into your website. A visitor can also be considered a person who has visited your website multiple times.').'
@@ -124,7 +124,7 @@ class StatsVisits extends ModuleGraph
- '.$this->l('CSV Export').' + '.$this->l('CSV Export').' ' : '').'