function lead_by_search($name, $where = '', $msi_id = '0') { $seed_lead = new Lead(); if ($where == '') { $where = $seed_lead->build_generic_where_clause($name); } if (!$seed_lead->ACLAccess('ListView')) { return array(); } $response = $seed_lead->get_list("last_name, first_name", $where, 0); $lead_list = $response['list']; $output_list = array(); // create a return array of names and email addresses. foreach ($lead_list as $lead) { $output_list[] = get_lead_array($lead, $msi_id); } return $output_list; }
public function testbuild_generic_where_clause() { $lead = new Lead(); //test with empty string params $expected = "leads.last_name like '%' or leads.account_name like '%' or leads.first_name like '%' or ea.email_address like '%'"; $actual = $lead->build_generic_where_clause(""); $this->assertSame($expected, $actual); //test with valid string params $expected = "leads.last_name like '%' or leads.account_name like '%' or leads.first_name like '%' or ea.email_address like '%'"; $actual = $lead->build_generic_where_clause("123"); $this->assertSame($expected, $actual); }