$contact_email = $OfuzEmailFetcher->getEmailAddress($finalres); $idcontact = $do_contact->getContactIdByEmail($contact_email); if ($idcontact === false) { $name_email = $OfuzEmailFetcher->getEmailDisplay($finalres); $regexp = "/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}\$/"; if ($name_email != '') { $name = $name_email; } else { $name = $contact_email; } $do_contact->addNew(); $do_contact->firstname = $name; $do_contact->iduser = $iduser; $do_contact->add(); $idcontact = $do_contact->getInsertId(); $do_contact_email->addNew(); $do_contact_email->idcontact = $idcontact; $do_contact_email->email_address = $contact_email; $do_contact_email->email_type = 'Work'; $do_contact_email->add(); $do_contact->getId($idcontact); $do_contact_view = new ContactView(); $do_contact_view->setUser($iduser); $do_contact_view->addFromContact($do_contact); $do_activity->addNew(); $do_activity->idcontact = $idcontact; $do_activity->when = date("Y-m-d H:i:s"); $do_activity->add(); } // For now add multiple notes for multiple attachment if (is_array($attachment) && count($attachment) > 0) {
$ContactPhone = $_SESSION['do_contact']->getChildContactPhone(); $ContactPhoneAdd = new ContactPhone(); if ($ContactPhone->getNumRows()) { while ($ContactPhone->next()) { $ContactPhoneAdd->addNew(); $ContactPhoneAdd->idcontact = $idcontact_inserted; $ContactPhoneAdd->phone_type = $ContactPhone->phone_type; $ContactPhoneAdd->phone_number = $ContactPhone->phone_number; $ContactPhoneAdd->add(); } } $ContactEmail = $_SESSION['do_contact']->getChildContactEmail(); $ContactEmailAdd = new ContactEmail(); if ($ContactEmail->getNumRows()) { while ($ContactEmail->next()) { $ContactEmailAdd->addNew(); $ContactEmailAdd->idcontact = $idcontact_inserted; $ContactEmailAdd->email_type = $ContactEmail->email_type; $ContactEmailAdd->email_address = $ContactEmail->email_address; $ContactEmailAdd->add(); } } $ContactInstantMessage = $_SESSION['do_contact']->getChildContactInstantMessage(); $ContactInstantMessageAdd = new ContactInstantMessage(); if ($ContactInstantMessage->getNumRows()) { while ($ContactInstantMessage->next()) { $ContactInstantMessageAdd->addNew(); $ContactInstantMessageAdd->idcontact = $idcontact_inserted; $ContactInstantMessageAdd->im_type = $ContactInstantMessage->im_type; $ContactInstantMessageAdd->im_username = $ContactInstantMessage->im_username; $ContactInstantMessageAdd->add();