| @@ 80-119 (lines=40) @@ | ||
| 77 | * |
|
| 78 | * @return array indeholdende kundedata til liste |
|
| 79 | */ |
|
| 80 | public function getList($parameter = "") |
|
| 81 | { |
|
| 82 | if ($this->getDBQuery()->checkFilter("search")) { |
|
| 83 | $search = $this->getDBQuery()->getFilter("search"); |
|
| 84 | $this->getDBQuery()->setCondition(" |
|
| 85 | contact.number = '".$search."' OR |
|
| 86 | address.name LIKE '%".$search."%' OR |
|
| 87 | address.address LIKE '%".$search."%' OR |
|
| 88 | address.email LIKE '%".$search."%' OR |
|
| 89 | address.phone = '".$search."'"); |
|
| 90 | } |
|
| 91 | ||
| 92 | $this->getDBQuery()->setSorting("address.name"); |
|
| 93 | ||
| 94 | $i = 0; // til at give arrayet en key |
|
| 95 | ||
| 96 | $db = $this->getDBQuery()->getRecordset("contact.id, contact.number, contact.paymentcondition, address.name, address.email, address.phone, address.address, address.postcode, address.city", "", false); |
|
| 97 | ||
| 98 | $contacts = array(); |
|
| 99 | while ($db->nextRecord()) { |
|
| 100 | // |
|
| 101 | $contacts[$i]['id'] = $db->f("id"); |
|
| 102 | $contacts[$i]['number'] = $db->f("number"); |
|
| 103 | $contacts[$i]['paymentcondition'] = $db->f("paymentcondition"); |
|
| 104 | $contacts[$i]['name'] = $db->f("name"); |
|
| 105 | $contacts[$i]['address'] = $db->f("address"); |
|
| 106 | $contacts[$i]['postcode'] = $db->f("postcode"); |
|
| 107 | $contacts[$i]['city'] = $db->f("city"); |
|
| 108 | $contacts[$i]['phone'] = $db->f("phone"); |
|
| 109 | $contacts[$i]['email'] = $db->f("email"); |
|
| 110 | ||
| 111 | if ($parameter == "use_address") { |
|
| 112 | $address = Intraface_Address::factory("contact", $db->f("id")); |
|
| 113 | $contacts[$i]['address'] = $address->get(); |
|
| 114 | } |
|
| 115 | ||
| 116 | $i++; |
|
| 117 | } |
|
| 118 | return $contacts; |
|
| 119 | } |
|
| 120 | ||
| 121 | /** |
|
| 122 | * Hente det maksimale kundenummer |
|
| @@ 703-742 (lines=40) @@ | ||
| 700 | * |
|
| 701 | * @return array indeholdende kundedata til liste |
|
| 702 | */ |
|
| 703 | public function getList($parameter = "") |
|
| 704 | { |
|
| 705 | if ($this->getDBQuery()->checkFilter("search")) { |
|
| 706 | $search = $this->getDBQuery()->getFilter("search"); |
|
| 707 | $this->getDBQuery()->setCondition(" |
|
| 708 | contact.number = '".$search."' OR |
|
| 709 | address.name LIKE '%".$search."%' OR |
|
| 710 | address.address LIKE '%".$search."%' OR |
|
| 711 | address.email LIKE '%".$search."%' OR |
|
| 712 | address.phone = '".$search."'"); |
|
| 713 | } |
|
| 714 | ||
| 715 | $this->getDBQuery()->setSorting("address.name"); |
|
| 716 | ||
| 717 | $i = 0; // til at give arrayet en key |
|
| 718 | ||
| 719 | $db = $this->getDBQuery()->getRecordset("contact.id, contact.number, contact.paymentcondition, address.name, address.email, address.phone, address.address, address.postcode, address.city", "", false); |
|
| 720 | ||
| 721 | $contacts = array(); |
|
| 722 | while ($db->nextRecord()) { |
|
| 723 | // |
|
| 724 | $contacts[$i]['id'] = $db->f("id"); |
|
| 725 | $contacts[$i]['number'] = $db->f("number"); |
|
| 726 | $contacts[$i]['paymentcondition'] = $db->f("paymentcondition"); |
|
| 727 | $contacts[$i]['name'] = $db->f("name"); |
|
| 728 | $contacts[$i]['address'] = $db->f("address"); |
|
| 729 | $contacts[$i]['postcode'] = $db->f("postcode"); |
|
| 730 | $contacts[$i]['city'] = $db->f("city"); |
|
| 731 | $contacts[$i]['phone'] = $db->f("phone"); |
|
| 732 | $contacts[$i]['email'] = $db->f("email"); |
|
| 733 | ||
| 734 | if ($parameter == "use_address") { |
|
| 735 | $address = Intraface_Address::factory("contact", $db->f("id")); |
|
| 736 | $contacts[$i]['address'] = $address->get(); |
|
| 737 | } |
|
| 738 | ||
| 739 | $i++; |
|
| 740 | } |
|
| 741 | return $contacts; |
|
| 742 | } |
|
| 743 | ||
| 744 | /** |
|
| 745 | * has contact any similar contacts based on phonenumber and email |
|