From 7c208abeb6dae5662c7a32e902ef4da0314a0aef Mon Sep 17 00:00:00 2001 From: xillibit Date: Thu, 27 Nov 2014 18:37:11 +0100 Subject: [PATCH] Add an option in companies list to filter by delete ones --- language/en-GB/en-GB.ini | 1 + src/Cobalt/Helper/CompanyHelper.php | 1 + src/Cobalt/Model/Company.php | 9 +++++++++ src/Cobalt/Model/Deal.php | 2 +- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/language/en-GB/en-GB.ini b/language/en-GB/en-GB.ini index a7ce1a11..c1219caa 100644 --- a/language/en-GB/en-GB.ini +++ b/language/en-GB/en-GB.ini @@ -672,6 +672,7 @@ COBALT_REVENUE_THIS_MONTH = "Revenue this month" COBALT_LOG0 = "Logo" COBALT_ALL_COMPANIES = "all companies" COBALT_CONTACT_DETAILS = "contact details" +COBALT_COMPANIES_UNPUBLISHED="Unpublished" COBALT_COMPANIES_TASKS_TODAY = "companies with tasks due today" COBALT_COMPANIES_TASKS_TOMORROW = "companies with tasks due tomorrow" COBALT_COMPANIES_UPDATED_LAST_MONTH = "companies updated in the last month" diff --git a/src/Cobalt/Helper/CompanyHelper.php b/src/Cobalt/Helper/CompanyHelper.php index 435c6172..78c501a8 100644 --- a/src/Cobalt/Helper/CompanyHelper.php +++ b/src/Cobalt/Helper/CompanyHelper.php @@ -41,6 +41,7 @@ public static function getTypes() { return array( 'all'=>TextHelper::_('COBALT_ALL_COMPANIES'), 'today'=>TextHelper::_('COBALT_COMPANIES_TASKS_TODAY'), + 'unpublished'=>TextHelper::_('COBALT_COMPANIES_UNPUBLISHED'), 'tomorrow'=>TextHelper::_('COBALT_COMPANIES_TASKS_TOMORROW'), 'updated_thirty'=>TextHelper::_('COBALT_COMPANIES_UPDATED_LAST_MONTH'), 'recent'=>TextHelper::_('COBALT_RECENTLY_ADDED'), diff --git a/src/Cobalt/Model/Company.php b/src/Cobalt/Model/Company.php index 590a73cb..751a0ddf 100644 --- a/src/Cobalt/Model/Company.php +++ b/src/Cobalt/Model/Company.php @@ -194,6 +194,11 @@ public function _buildQuery() //filter for type if ($type != null && $type != "all") { + // Filter for get companies with published status of -1 + if($type == 'unpublished') + { + $query->where("c.published='-1'"); + } //filter for companies with tasks due today if ($type == 'today') { @@ -233,6 +238,10 @@ public function _buildQuery() $query->group("c.id"); } + else + { + $query->where("c.published=1"); + } /** company name filter **/ $company_name = $this->getState()->get('Company.'.$view.'_name'); diff --git a/src/Cobalt/Model/Deal.php b/src/Cobalt/Model/Deal.php index f014fae7..22c65b79 100644 --- a/src/Cobalt/Model/Deal.php +++ b/src/Cobalt/Model/Deal.php @@ -772,7 +772,7 @@ public function _buildQuery() } else { - $query->group('d.id, c.name, stat.name, source.name, stage.name, stage.percent, event_cf.association_id, event_cf.event_id, event_cf.association_type, event.id, users.first_name, users.last_name, p.first_name, p.last_name, p.email, p.phone'); + $query->group('d.id, c.name, stat.name, source.name, stage.name, stage.percent, event_cf.association_id, event_cf.event_id, event_cf.association_type, event.id, users.first_name, users.last_name, p.first_name, p.last_name, p.email, p.phone, c.created'); } /**