From 134a25e324f1ab89f896a4cdeaaf6d702ea496ba Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 14 Jun 2024 12:47:26 +0530 Subject: [PATCH] revert changes made for new customer KPI to keep this pr focus only on new flow of banned customer --- .../admin/AdminCustomersController.php | 19 +------------------ controllers/admin/AdminStatsController.php | 7 +------ modules/dashactivity/views/js/dashactivity.js | 5 ----- .../templates/hook/dashboard_zone_one.tpl | 2 +- 4 files changed, 3 insertions(+), 30 deletions(-) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 58527d92f..350e822d1 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -223,21 +223,7 @@ class AdminCustomersControllerCore extends AdminController } $prefix = $this->getCookieFilterPrefix(); - if (Tools::getValue('filterOnlyNewCustomer')) { - if (($dateFrom = Tools::getValue('date_from')) - && ($dateTo = Tools::getValue('date_to')) - && strtotime($dateTo) >= strtotime($dateFrom) - ) { - $this->processResetFilters(); - $this->context->cookie->{'submitFilter'.$this->table} = true; - //Updating the date format of the filter dates to the desired format. - $dateFrom = date('Y-m-d', strtotime($dateFrom)); - $dateTo = date('Y-m-d', strtotime($dateTo)); - $this->context->cookie->{$prefix.$this->table.'Filter_date_add'} = json_encode(array($dateFrom, $dateTo)); - } - - $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers'); - } else if (Tools::getValue('filterOnlyBannedCustomer')) { + if (Tools::getValue('filterOnlyBannedCustomer')) { $this->processResetFilters(); $this->context->cookie->{'submitFilter'.$this->table} = true; $this->context->cookie->{$prefix.$this->table.'Filter_deleted'} = Customer::STATUS_BANNED; @@ -770,9 +756,6 @@ class AdminCustomersControllerCore extends AdminController $helper->color = 'color4'; $helper->title = $this->l('New Customers', null, null, false); $nbDaysNewCustomers = Validate::isUnsignedInt(Configuration::get('PS_KPI_NEW_CUSTOMERS_NB_DAYS')) ? Configuration::get('PS_KPI_NEW_CUSTOMERS_NB_DAYS') : 30; - $date_from = date('Y-m-d', strtotime('-'.$nbDaysNewCustomers.' day')); - $date_to = date('Y-m-d'); - $helper->href = $this->context->link->getAdminLink('AdminCustomers').'&filterOnlyNewCustomer=1&date_from='.$date_from.'&date_to='.$date_to; $helper->subtitle = sprintf($this->l('%d Days', null, null, false), (int) $nbDaysNewCustomers); $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=total_new_customers'; $helper->tooltip = $this->l('The total number of new customers who registered in given period of time.', null, null, false); diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 87d5fdcd5..d7d233e26 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -965,11 +965,6 @@ class AdminStatsControllerCore extends AdminStatsTabController case 'average_lead_time': $dateToday = date('Y-m-d'); $value = Tools::ps_round(AdminStatsController::getAverageLeadTime(), 2); - if ($value && $value <= 1) { - $value .= ' '.$this->l('day'); - } else { - $value .= ' '.$this->l('days'); - } break; case 'average_guest_in_booking': @@ -1897,7 +1892,7 @@ class AdminStatsControllerCore extends AdminStatsTabController public static function getTotalNewCustomers($nbDaysNewCustomers) { - $maxDateAdd = date('Y-m-d', strtotime('-'.$nbDaysNewCustomers.' day')); + $maxDateAdd = date('Y-m-d H:i:s', strtotime('-'.$nbDaysNewCustomers.' day')); $sql = 'SELECT COUNT(c.`id_customer`) FROM `'._DB_PREFIX_.'customer` c WHERE c.`date_add` >= "'.pSQL($maxDateAdd).'" AND c.`deleted` = 0'; diff --git a/modules/dashactivity/views/js/dashactivity.js b/modules/dashactivity/views/js/dashactivity.js index 8343efa89..1bdf4e422 100644 --- a/modules/dashactivity/views/js/dashactivity.js +++ b/modules/dashactivity/views/js/dashactivity.js @@ -58,9 +58,6 @@ $(document).ready(function() { $('#date-start').change(function() { start = Date.parseDate($('#date-start').val(), 'Y-m-d'); end = Date.parseDate($('#date-end').val(), 'Y-m-d'); - var url = $('#dash_filter_new_customers').data('href') + '&date_from='+start.format('Y-m-d')+ '&date_to='+ end.format('Y-m-d'); - $('#dash_filter_new_customers').attr('href', url); - $('#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))); }); @@ -68,8 +65,6 @@ $(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'); - var url = $('#dash_filter_new_customers').data('href') + '&date_from='+start.format('Y-m-d')+ '&date_to='+ end.format('Y-m-d'); - $('#dash_filter_new_customers').attr('href', url); $('#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/dashactivity/views/templates/hook/dashboard_zone_one.tpl b/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl index a0d0a48c8..95cee2cd3 100644 --- a/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl +++ b/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl @@ -121,7 +121,7 @@