X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fphone.php;h=2d85beb4a4652506764646e0d01bfd8f14e764e2;hb=09b461cecabea452483ae3e9e9ed28f43594ec26;hp=46c1a9a73e47de123f0114535841887b1694d13a;hpb=e45ad94e25e672b591a89a7323d89230efdf2645;p=platal.git diff --git a/classes/phone.php b/classes/phone.php index 46c1a9a..2d85beb 100644 --- a/classes/phone.php +++ b/classes/phone.php @@ -105,6 +105,11 @@ class Phone return $this->search; } + public function setId($id) + { + $this->id = $id; + } + /** Returns the unique ID of a phone. * This ID will allow to link it to an address, a user or a job. * The format is address_addressId_phoneId (where phoneId is the id @@ -340,7 +345,7 @@ class Phone $phones = array(); foreach ($data as $item) { $phone = new Phone($item); - $success = (($phone->isEmpty() || $phone->format()) && $success); + $success = (!$phone->error && ($phone->format() || $phone->isEmpty()) && $success); if (!$phone->isEmpty()) { $phones[] = call_user_func(array($phone, $function)); } @@ -399,8 +404,8 @@ class PhoneIterator implements PlIterator $sql = 'SELECT search_tel AS search, display_tel AS display, comment, link_id, tel_type AS type, link_type, tel_id AS id, pid, pub FROM profile_phones - WHERE ' . implode(' AND ', $where) . ' - ORDER BY link_id, tel_id'; + ' . ((count($where) > 0) ? 'WHERE ' . implode(' AND ', $where) : '') . ' + ORDER BY pid, link_id, tel_id'; $this->dbiter = XDB::iterator($sql); }