- $display_tel = format_display_number($this->tel, $error_tel);
- $display_fax =format_display_number($this->fax, $error_fax);
- XDB::execute('INSERT INTO profile_phones (uid, link_type, link_id, tel_id, tel_type,
- search_tel, display_tel, pub)
- VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}),
- ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})',
- $jobid, 'hq', $this->id, 0, 'fixed', format_phone_number($this->tel), $display_tel, 'public',
- $jobid, 'hq', $this->id, 1, 'fax', format_phone_number($this->fax), $display_fax, 'public');
+ $phone = new Phone(array('link_type' => 'hq', 'link_id' => $jobid, 'id' => 0,
+ 'type' => 'fixed', 'display' => $this->tel, 'pub' => 'public'));
+ $fax = new Phone(array('link_type' => 'hq', 'link_id' => $jobid, 'id' => 1,
+ 'type' => 'fax', 'display' => $this->fax, 'pub' => 'public'));
+ $address = new Address(array('jobid' => $jobid, 'type' => Address::LINK_COMPANY, 'text' => $this->address));
+ $phone->save();
+ $fax->save();
+ $address->save();