Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-20296 - order by even then odd numbers as advertised #10007

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CRM/Report/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -2763,6 +2763,17 @@ public function storeOrderByArray() {

if (!empty($orderByField)) {
$this->_orderByFields[$orderByField['tplField']] = $orderByField;
if ($orderByField['name'] == 'street_number') {
// First order by Even/Odd - list even numbers first, then odd
// numbers. Even numbered addresses are on one side of the
// street and odd numbered addresses are on the other side of
// the street so, when door knocking, it is easier to do streets
// one side at a time.
$orderBys[] = "{$orderByField['dbAlias']} % 2 {$orderBy['order']}";
// Below, add order clause as it normally would be added, so all
// even numbers are listed in numeric order, followed by all odd
// numbers in numeric order.
}
$orderBys[] = "{$orderByField['dbAlias']} {$orderBy['order']}";

// Record any section headers for assignment to the template
Expand Down
2 changes: 1 addition & 1 deletion CRM/Report/Form/Campaign/SurveyDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public function __construct() {
),
'grouping' => 'survey-activity-fields',
),
) + $this->addAddressFields();
) + $this->getAddressColumns();
parent::__construct();
}

Expand Down