function case_by_search($name, $where = '', $msi_id = '0') { $seed = new aCase(); if (!$seed->ACLAccess('ListView')) { return array(); } if ($where == '') { $where = $seed->build_generic_where_clause($name); } $response = $seed->get_list("name", $where, 0); $list = $response['list']; $output_list = array(); // create a return array of names and email addresses. foreach ($list as $value) { $output_list[] = get_case_array($value, $msi_id); } return $output_list; }
public function testbuild_generic_where_clause() { $aCase = new aCase(); //test with string $expected = "(cases.name like 'test%' or accounts.name like 'test%')"; $actual = $aCase->build_generic_where_clause('test'); $this->assertSame($expected, $actual); //test with number $expected = "(cases.name like '1%' or accounts.name like '1%' or cases.case_number like '1%')"; $actual = $aCase->build_generic_where_clause(1); $this->assertSame($expected, $actual); }