Skip to content

Commit

Permalink
Add an option in companies list to filter by delete ones
Browse files Browse the repository at this point in the history
  • Loading branch information
xillibit committed Dec 7, 2014
1 parent 19fc7fe commit edc1b7d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions language/en-GB/en-GB.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/Cobalt/Helper/CompanyHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
12 changes: 10 additions & 2 deletions src/Cobalt/Model/Company.php
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -269,8 +278,7 @@ public function _buildQuery()

//set user state requests
$query
->order($this->getState()->get('Company.filter_order').' '.$this->getState()->get('Company.filter_order_Dir'))
->where("c.published=".$this->published);
->order($this->getState()->get('Company.filter_order').' '.$this->getState()->get('Company.filter_order_Dir'));

return $query;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Cobalt/Model/Deal.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

/**
Expand Down

0 comments on commit edc1b7d

Please sign in to comment.