/** * Test asserts that for group functions order by is alias instead of table.field * * @dataProvider dataProvider * @group 57902 * @return void */ public function testQueryOrderBy($layout_def, $expected) { $layoutManager = new LayoutManager(); $sugarWidgetReportField = new SugarWidgetReportField($layoutManager); $actual = $sugarWidgetReportField->queryOrderBy($layout_def); $this->assertEquals($expected, $actual, 'ORDER BY string is incorrect'); }
/** * Test asserts that for group functions order by is alias instead of table.field * * @dataProvider dataProvider * @group 57902 * @return void */ public function testQueryOrderBy($layout_def, $expected) { $layoutManager = new LayoutManager(); $db = new stdClass(); $db->db = $GLOBALS['db']; $layoutManager->setAttributePtr('reporter', $db); $sugarWidgetReportField = new SugarWidgetReportField($layoutManager); $actual = $sugarWidgetReportField->queryOrderBy($layout_def); $this->assertContains($expected, $actual, 'ORDER BY statement uses wrong field'); }
function queryOrderBy($layout_def) { if (!empty($layout_def['qualifier'])) { $func_name = 'queryOrderBy' . $layout_def['qualifier']; if (method_exists($this, $func_name)) { return $this->{$func_name}($layout_def) . "\n"; } } $order_by = parent::queryOrderBy($layout_def) . "\n"; return $order_by; }
/** * Returns an OrderBy query for multi-select. We treat multi-select the same as a normal field because * the values stored in the database are in the format ^A^,^B^,^C^ though not necessarily in that order. * @param $layout_def * @return string */ public function queryOrderBy($layout_def) { return SugarWidgetReportField::queryOrderBy($layout_def); }
function queryOrderBy($layout_def) { // i guess qualifier and column_function are the same.. if ($this->reporter->db->dbType == 'mssql') { //do nothing if this is for mssql, do not run group by } elseif (!empty($layout_def['qualifier'])) { $func_name = 'queryGroupBy' . $layout_def['qualifier']; if (method_exists($this, $func_name)) { return $this->{$func_name}($layout_def) . "\n"; } } $order_by = parent::queryOrderBy($layout_def) . "\n"; return $order_by; }