public function save(){ $name = $this->f3->get('POST.name'); $email = $this->f3->get('POST.email'); $comments = $this->f3->get('POST.comments'); $v = new Valitron\Validator(array('Name' => $name,'Email'=>$email,'Comments'=>$comments)); $v->rule('required', ['Name','Email','Comments']); $v->rule('email',[Email]); if ($v->validate()) { $contact = new Contact($this->db); $data = array( 'name' => $name, 'email' => $email, 'comments' => $comments, 'contact_date' => date('Y-m-d H:i:s') ); $contact->insert($data); $response = array( 'status' => true, 'message' => 'Your message saved!' ); }else{ $response = array( 'status' => false, 'errors' => $v->errors() ); } echo json_encode($response); }
public function postContact() { global $smarty, $cookie; session_start(); if ($_SESSION['validate_code'] == strtolower(Tools::getRequest('validate_code'))) { if ($cookie->isLogged()) { $user = new User($cookie->id_user); $_POST['name'] = $user->first_name . ' ' . $user->last_name; $_POST['email'] = $user->email; if (isset($_POST['id_user'])) { unset($_POST['id_user']); } $_POST['id_user'] = $user->id; } $contact = new Contact(); $contact->copyFromPost(); if ($contact->add()) { $vars = array('{name}' => $contact->name, '{subject}' => $contact->subject, '{email}' => $contact->email, '{message}' => $contact->content); Mail::Send('contact', $contact->subject, $vars, Configuration::get('TM_SHOP_EMAIL')); $this->_success = 'Your message has been successfully sent to our team.'; } else { $this->_errors = $contact->_errors; } } else { $this->_errors[] = 'Confirmation code is error!'; } }
static function createDefaultUserPermissionsAllDimension(Contact $user, $dimension_id, $remove_previous = true) { $role_id = $user->getUserType(); $permission_group_id = $user->getPermissionGroupId(); $dimension = Dimensions::getDimensionById($dimension_id); if (!$dimension instanceof Dimension || !$dimension->getDefinesPermissions()) { return; } try { $shtab_permissions = array(); $new_permissions = array(); $role_permissions = self::findAll(array('conditions' => "role_id = '{$role_id}'")); $members = Members::findAll(array('conditions' => 'dimension_id = ' . $dimension_id)); foreach ($members as $member) { $member_id = $member->getId(); if ($remove_previous) { ContactMemberPermissions::delete("permission_group_id = {$permission_group_id} AND member_id = {$member_id}"); } foreach ($role_permissions as $role_perm) { if ($member->canContainObject($role_perm->getObjectTypeId())) { $cmp = new ContactMemberPermission(); $cmp->setPermissionGroupId($permission_group_id); $cmp->setMemberId($member_id); $cmp->setObjectTypeId($role_perm->getObjectTypeId()); $cmp->setCanDelete($role_perm->getCanDelete()); $cmp->setCanWrite($role_perm->getCanWrite()); $cmp->save(); $new_permissions[] = $cmp; $perm = new stdClass(); $perm->m = $member_id; $perm->r = 1; $perm->w = $role_perm->getCanWrite(); $perm->d = $role_perm->getCanDelete(); $perm->o = $role_perm->getObjectTypeId(); $shtab_permissions[] = $perm; } } } if (count($shtab_permissions)) { $cdp = ContactDimensionPermissions::instance()->findOne(array('conditions' => "permission_group_id = '{$permission_group_id}' AND dimension_id = {$dimension_id}")); if (!$cdp instanceof ContactDimensionPermission) { $cdp = new ContactDimensionPermission(); $cdp->setPermissionGroupId($permission_group_id); $cdp->setContactDimensionId($dimension_id); $cdp->setPermissionType('check'); $cdp->save(); } else { if ($cdp->getPermissionType() == 'deny all') { $cdp->setPermissionType('check'); $cdp->save(); } } $stCtrl = new SharingTableController(); $stCtrl->afterPermissionChanged($permission_group_id, $shtab_permissions); } return $new_permissions; } catch (Exception $e) { throw $e; } }
public function contact() { $content = Content::find_by_permalink("contact"); $this->assign("content", $content); $contact = new Contact(); if ($this->post) { $contact->name = $_POST['name']; $contact->emailaddress = $_POST['emailaddress']; $contact->subject = $_POST['subject']; $contact->message = $_POST['message']; $contact->ip = Site::RemoteIP(); if ($this->csrf) { $sent = $contact->send(); if ($sent) { Site::flash("notice", "The email has been sent"); Redirect("contact"); } } else { global $site; $site['flash']['error'] = "Invalid form submission"; } } $this->assign("contact", $contact); $this->title = "Contact Us"; $this->render("contact/contact.tpl"); }
public function sendAction() { if ($this->request->isPost() == true) { $name = $this->request->getPost('name', 'string'); $email = $this->request->getPost('email', 'email'); $comments = $this->request->getPost('comments', 'string'); $name = strip_tags($name); $comments = strip_tags($comments); $contact = new Contact(); $contact->name = $name; $contact->email = $email; $contact->comments = $comments; $contact->created_at = new Phalcon_Db_RawValue('now()'); if ($contact->save() == false) { foreach ($contact->getMessages() as $message) { Phalcon_Flash::error((string) $message, 'alert alert-error'); } return $this->_forward('contact/index'); } else { Phalcon_Flash::success('Thanks, We will contact you in the next few hours', 'alert alert-success'); return $this->_forward('index/index'); } } else { return $this->_forward('contact/index'); } }
/** * save contact enquiry */ public function saveContactUs() { $name = Input::get('name'); $email = Input::get('email'); $phone = Input::get('phone'); $contact_method = Input::get('contact_method'); $enquiry = e(Input::get('enquiry')); $invoice_number = Input::get('invoice_number'); // check for required fields if (empty($name) || empty($email)) { echo "Name and email are required. Please submit the form again"; return; } // save the data in database first $contact = new Contact(); $contact->name = $name; $contact->email = $email; $contact->phone_number = $phone; $contact->contact_method = $contact_method; $contact->enquiry_info = $enquiry; $contact->invoice_number = $invoice_number; $contact->save(); // send email /** * configure the smtp details in app/config/mail.php * and after that uncommet the code below to send emails */ // Mail::send('emails.contact.contact', Input::all('firstname'), // function($message){ // $message->to(Config::get('contact.contact_email')) // ->subject(Config::get('contact.contact_subject')); // } // ); echo "Enquiry Submitted. ThankYou."; }
/** * Handles the sending the message - storing it in the database * * @todo Refactor this to send an email */ public function sendAction() { if ($this->request->isPost() == true) { $forward = 'index/index'; $name = $this->request->getPost('name', 'string'); $email = $this->request->getPost('email', 'email'); $comments = $this->request->getPost('comments', 'string'); $name = strip_tags($name); $comments = strip_tags($comments); $contact = new Contact(); $contact->name = $name; $contact->email = $email; $contact->comments = $comments; $contact->createdAt = new Phalcon_Db_RawValue('now()'); if ($contact->save() == false) { foreach ($contact->getMessages() as $message) { Flash::error((string) $message, 'alert alert-error'); } $forward = 'contact/index'; } else { $message = 'Thank you for your input. If your message requires ' . 'a reply, we will contact you as soon as possible.'; Flash::success($message, 'alert alert-success'); } } else { $forward = 'contact/index'; } return $this->_forward($forward); }
public function indexAction() { $this->view->Title = 'Đặt hàng'; $this->view->headTitle($this->view->Title); $id = $this->getRequest()->getParam("id_product"); $Product = Product::getById($id); if ($this->getRequest()->isPost()) { $request = $this->getRequest()->getParams(); $error = $this->_checkForm($request); if (count($error) == 0) { $Contact = new Contact(); $Contact->merge($request); $Contact->created_date = date("Y-m-d H:i:s"); $Contact->save(); //$_SESSION['msg'] = "Yêu cầu đặt hàng của bạn đã được gửi, xin trân thành cảm ơn!"; My_Plugin_Libs::setSplash('<b>Yêu cầu đặt hàng của bạn đã được gửi, xin trân thành cảm ơn!</b>'); $this->_redirect($this->_helper->url('index', 'contact', 'default')); } if (count($error)) { $this->view->error = $error; } } $this->view->Product = $Product; $this->view->Contact = $Contact; }
public function setUp() { SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('app_strings'); SugarTestHelper::setUp('app_list_strings'); $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); $unid = uniqid(); $contact = new Contact(); $contact->id = 'l_' . $unid; $contact->first_name = 'Greg'; $contact->last_name = 'Brady'; $contact->new_with_id = true; $contact->save(); $this->_contact = $contact; if (file_exists(sugar_cached('modules/unified_search_modules.php'))) { $this->_hasUnifiedSearchModulesConfig = true; copy(sugar_cached('modules/unified_search_modules.php'), sugar_cached('modules/unified_search_modules.php.bak')); unlink(sugar_cached('modules/unified_search_modules.php')); } if (file_exists('custom/modules/unified_search_modules_display.php')) { $this->_hasUnifiedSearchModulesDisplay = true; copy('custom/modules/unified_search_modules_display.php', 'custom/modules/unified_search_modules_display.php.bak'); unlink('custom/modules/unified_search_modules_display.php'); } }
public function setUp() { global $current_user, $currentModule; $mod_strings = return_module_language($GLOBALS['current_language'], "Contacts"); $beanList = array(); $beanFiles = array(); require 'include/modules.php'; $GLOBALS['beanList'] = $beanList; $GLOBALS['beanFiles'] = $beanFiles; $current_user = SugarTestUserUtilities::createAnonymousUser(); $unid = uniqid(); $time = date('Y-m-d H:i:s'); $contact = new Contact(); $contact->id = 'c_' . $unid; $contact->first_name = 'testfirst'; $contact->last_name = 'testlast'; $contact->new_with_id = true; $contact->disable_custom_fields = true; $contact->save(); $this->c = $contact; $beanList = array(); $beanFiles = array(); require 'include/modules.php'; $GLOBALS['beanList'] = $beanList; $GLOBALS['beanFiles'] = $beanFiles; }
public function __construct($arrayAccounts) { // browse through list $collection = array(); if ($arrayAccounts) { foreach ($arrayAccounts as $arrayAccount) { if (empty($arrayAccount['name_value_list']['account_name'])) { $arrayAccount['name_value_list']['account_name'] = ""; } $contact = new Contact(); $contact->setId($arrayAccount['name_value_list']['id']); $contact->setGroup($arrayAccount['name_value_list']['account_name']); $contact->setFirstname(htmlspecialchars_decode($arrayAccount['name_value_list']['first_name'], ENT_QUOTES)); $contact->setLastname($arrayAccount['name_value_list']['last_name']); $contact->setWorkPhone($arrayAccount['name_value_list']['phone_work']); $contact->setWorkMobile($arrayAccount['name_value_list']['phone_mobile']); $contact->sethomePhone(''); $contact->sethomeMobile(''); $collection[$contact->getId()] = $contact; } // Sort accounts by name usort($collection, function ($a, $b) { return strcmp($a->getFirstname(), $b->getFirstname()); }); } // build ArrayObject using collection return parent::__construct($collection); }
public function sendMail($template) { foreach ($this->contacts as $c) { $contact = new Contact($c); $contact->sendMail($template); } }
private function bindValueAndExecuteInsertOrUpdate(PDOStatement $stm, Contact $contact) { $stm->bindValue(':name', $contact->getName(), PDO::PARAM_STR); $stm->bindValue(':photo', $contact->getPhoto(), PDO::PARAM_STR); $stm->bindValue(':email', $contact->getEmail(), PDO::PARAM_STR); return $stm->execute(); }
function maintContact() { $results = ''; if (isset($_POST['save']) and $_POST['save'] == 'Save') { // check the token $badToken = true; if (!isset($_POST['token']) || !isset($_SESSION['token']) || empty($_POST['token']) || $_POST['token'] !== $_SESSION['token']) { $results = array('', 'Sorry, go back and try again. There was a security issue.'); $badToken = true; } else { $badToken = false; unset($_SESSION['token']); // Put the sanitized variables in an associative array // Use the FILTER_FLAG_NO_ENCODE_QUOTES to allow names like O'Connor $item = array('id' => (int) $_POST['id'], 'first_name' => filter_input(INPUT_POST, 'first_name', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES), 'last_name' => filter_input(INPUT_POST, 'last_name', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES), 'position' => filter_input(INPUT_POST, 'position', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES), 'email' => filter_input(INPUT_POST, 'email', FILTER_SANITIZE_STRING), 'phone' => filter_input(INPUT_POST, 'phone', FILTER_SANITIZE_STRING)); // Set up a Contact object based on the posts $contact = new Contact($item); if ($contact->getId()) { $results = $contact->editRecord(); } else { $results = $contact->addRecord(); } } } return $results; }
function inscrire() { $debug = false; $contact = new Contact(); if ($_POST["as"] == '') { // ---- Enregistrement dans "contact" -------- // if ($_POST["email_news"] != '') { $num_contact = $contact->isContact($_POST["email_news"], $debug); unset($val); $val["id"] = $num_contact; $val["email"] = $_POST["email_news"]; $val["newsletter"] = "on"; if ($num_contact <= 0) { $contact->contactAdd($val, $debug); } else { $contact->contactModify($val, $debug); } } // ------------------------------------------- // $erreur = "false"; $message = "Inscription réalisée avec succès"; die('{ "error":' . $erreur . ', "message":"' . $message . '" }'); } }
/** * eventAddFeed * This event is triggered when the note is added in the * contact.php page. * Its the last event and assume that the ContactNoteEditSave has * a primary key from the database table. * This event action prepare all the data so no additional query is needed * in the display table. * @param EventControler */ function eventAddFeed(EventControler $evtcl) { $this->note = $_SESSION['ContactNoteEditSave']->note; $this->iduser = $evtcl->iduser_for_feed; $this->idcontact = $_SESSION['ContactNoteEditSave']->idcontact; $this->idcontact_note = $_SESSION['ContactNoteEditSave']->idcontact_note; $user = new User(); $user->getId($this->iduser); $do_contact = new Contact(); $do_contact->getId($this->idcontact); if ($evtcl->added_by_cont == 'Yes') { $this->added_by = $do_contact->getContactFullName(); } else { $this->added_by = $user->getFullName(); } $this->contact_full_name = $do_contact->getContactFullName(); $this->contact_image_url = $do_contact->getContactPicture(); if (strlen($this->note) > 200) { $this->note = substr($this->note, 0, 200); $this->more = True; } else { $this->more = false; } $user_relation = new ContactSharing(); $user_array = $user_relation->getCoWorkerByContact($this->idcontact); @array_push($user_array, $this->iduser); if (!is_array($user_array) || $user_array === false) { $user_array = array($evtcl->iduser_for_feed); } //print_r($user_array);exit; $this->addFeed($user_array); }
/** * Create a lead and convert it to an existing Account and Contact */ public function testConvertLinkingExistingContact() { // Create records $lead = SugarTestLeadUtilities::createLead(); $account = SugarTestAccountUtilities::createAccount(); $contact = SugarTestContactUtilities::createContact(); // ConvertLead to an existing Contact and Account $_REQUEST = array('module' => 'Leads', 'record' => $lead->id, 'isDuplicate' => 'false', 'action' => 'ConvertLead', 'convert_create_Contacts' => 'false', 'report_to_name' => $contact->name, 'reports_to_id' => $contact->id, 'convert_create_Accounts' => 'false', 'account_name' => $account->name, 'account_id' => $account->id, 'handle' => 'save'); // Call display to trigger conversion $vc = new ViewConvertLead(); $vc->display(); // Refresh Lead $leadId = $lead->id; $lead = new Lead(); $lead->retrieve($leadId); // Refresh Contact $contactId = $contact->id; $contact = new Contact(); $contact->retrieve($contactId); // Check if contact it's linked properly $this->assertEquals($contact->id, $lead->contact_id, 'Contact not linked with Lead successfully.'); // Check if account is linked with lead properly $this->assertEquals($account->id, $lead->account_id, 'Account not linked with Lead successfully.'); // Check if account is linked with contact properly $this->assertEquals($account->id, $contact->account_id, 'Account not linked with Contact successfully.'); // Check Lead Status, should be converted $this->assertEquals('Converted', $lead->status, "Lead status should be 'Converted'."); }
function contact_information() { $contact = new Contact(); $post = new posts(); global $session, $main_db; $admin_mail = $post->get_single_post_by('sender_email'); $sender = isset($admin_mail->post_content) ? $admin_mail->post_content : '*****@*****.**'; if (isset($_POST['user_contact_form'])) { $data['u_name'] = $_POST['u_name']; $data['u_mail'] = $_POST['u_email']; $data['msg_type'] = $_POST['u_msg_type']; $data['comment'] = $_POST['u_comment']; $message = '<h3> A user try to contact you! </h3>'; $message .= '<p> Name : ' . $_POST['u_name'] . ' </p>'; $message .= '<p> Email : ' . $_POST['u_email'] . ' </p>'; $message .= '<p> Message Type: ' . $_POST['u_msg_type'] . ' </p>'; $message .= '<p> Comment : ' . $_POST['u_comment'] . ' </p>'; $contact->send_email($_POST['u_email'], 'User contact Information', $message, $sender); if ($contact->insert_contact($data)) { $session->message("Thank you for your contact! We will touch you very soon! "); safe_redirect(get_home_url()); } else { echo $main_db->last_query; exit; } } }
/** * phpwax comes with some very useful tools built in for small sites. This page demonstrates the WaxForm system * which creates forms for you passed on either existing models or (like in this case) you can create custom * fields. This also shows you how to send the results via an email */ public function contact_me() { $this->form = new WaxForm(); //we create the form as $this so it can be accessed inside the views $this->form->add_element("name", "TextInput", array('validate' => 'required')); //this adds a field to the form called name, with the type of textinput $this->form->add_element("email", "TextInput", array('validate' => 'email')); //this adds the email field $this->form->add_element("telephone", "TextInput"); //telephone field /* this one is slightly different - a textarea & takes another parameter with html attribute names (as textarea needs those to be valid markup!) */ $this->form->add_element("message", "TextareaInput", array("cols" => 30, "rows" => 7)); /* ok, here is the clever form handling... - a call to the save function in this case does not save as there is not a model associated with the form, just custom fields _ the save runs the validation methods for the form and the fields - if it validates we create a new Contact model (see app/model/Contact.php for details) - the data returned from the save is passed in to the send_contact method (this sends the email - again see model for details) - redirect to a simple thank you page (good practice!) */ if ($data = $this->form->save()) { $email = new Contact(); $email->send_contact_form($data); $this->redirect_to("/thanks"); } }
public function setUp() { global $current_user, $currentModule; global $beanList; require 'include/modules.php'; $current_user = SugarTestUserUtilities::createAnonymousUser(); $unid = uniqid(); $time = date('Y-m-d H:i:s'); $contact = new Contact(); $contact->id = 'c_' . $unid; $contact->first_name = 'testfirst'; $contact->last_name = 'testlast'; $contact->new_with_id = true; $contact->disable_custom_fields = true; $contact->save(); $this->contact = $contact; $account = new Account(); $account->id = 'a_' . $unid; $account->first_name = 'testfirst'; $account->last_name = 'testlast'; $account->assigned_user_id = 'SugarUser'; $account->new_with_id = true; $account->disable_custom_fields = true; $account->save(); $this->account = $account; $ac_id = 'ac_' . $unid; $this->ac_id = $ac_id; //Accounts to Contacts $GLOBALS['db']->query("INSERT INTO accounts_contacts (id , contact_id, account_id, date_modified, deleted) values ('{$ac_id}', '{$contact->id}', '{$account->id}', '{$time}', 0)"); $_REQUEST['relate_id'] = $this->contact->id; $_REQUEST['relate_to'] = 'projects_contacts'; }
public function testGetExportValue() { $super = User::getByUsername('super'); Yii::app()->user->userModel = $super; $data = array(); $contactStates = ContactState::getByName('Qualified'); $contact = new Contact(); $contact->owner = $super; $contact->firstName = 'Super'; $contact->lastName = 'Man'; $contact->jobTitle = 'Superhero'; $contact->description = 'Some Description'; $contact->department = 'Red Tape'; $contact->officePhone = '1234567890'; $contact->mobilePhone = '0987654321'; $contact->officeFax = '1222222222'; $contact->state = $contactStates[0]; $this->assertTrue($contact->save()); $adapter = new ContactStateRedBeanModelAttributeValueToExportValueAdapter($contact, 'state'); $adapter->resolveData($data); $compareData = array($contactStates[0]->name); $this->assertEquals($compareData, $data); $data = array(); $adapter->resolveHeaderData($data); $compareData = array($contact->getAttributeLabel('state')); $this->assertEquals($compareData, $data); }
function execute(&$bean) { if ($bean->sales_stage == "completed") { $realty_list = $bean->get_linked_beans("realty_opportunities", "Realty"); if (!empty($bean->contact_id)) { $contact = new Contact(); $contact->retrieve($bean->contact_id); foreach ($realty_list as $realty) { if ($realty->operation == 'rent') { $contact->load_relationship("realty_contacts_rent"); $contact->realty_contacts_rent->add($realty->id); } elseif ($realty->operation == 'buying') { $contact->load_relationship("realty_contacts_buying"); $contact->realty_contacts_buying->add($realty->id); } } } if (!empty($bean->account_id)) { $account = new Account(); $account->retrieve($bean->account_id); foreach ($realty_list as $realty) { if ($realty->operation == 'rent') { $account->load_relationship("realty_accounts_rent"); $account->realty_accounts_rent->add($realty->id); } elseif ($realty->operation == 'buying') { $account->load_relationship("realty_accounts_buying"); $account->realty_accounts_buying->add($realty->id); } } } } }
/** * @param RedBeanModel $model */ public function populateModel(&$model) { assert('$model instanceof ContactWebFormEntry'); parent::populateModel($model); if (empty($this->seedData)) { $this->seedData = ZurmoRandomDataUtil::getRandomDataByModuleAndModelClassNames('ContactWebFormsModule', 'ContactWebFormEntry'); } $contactFormAttributes = array(); $contact = new Contact(); $contact->owner = $model->contactWebForm->defaultOwner; $contact->state = $model->contactWebForm->defaultState; $contact->firstName = $contactFormAttributes['firstName'] = $this->seedData['firstName'][$this->index]; $contact->lastName = $contactFormAttributes['lastName'] = $this->seedData['lastName'][$this->index]; $contact->companyName = $contactFormAttributes['companyName'] = $this->seedData['companyName'][$this->index]; $contact->jobTitle = $contactFormAttributes['jobTitle'] = $this->seedData['jobTitle'][$this->index]; if ($contact->validate()) { $contactWebFormEntryStatus = ContactWebFormEntry::STATUS_SUCCESS; $contactWebFormEntryMessage = ContactWebFormEntry::STATUS_SUCCESS_MESSAGE; $contact->save(); } else { $contactWebFormEntryStatus = ContactWebFormEntry::STATUS_ERROR; $contactWebFormEntryMessage = ContactWebFormEntry::STATUS_ERROR_MESSAGE; $contact = null; } $model->contact = $contact; $model->status = $contactWebFormEntryStatus; $model->message = $contactWebFormEntryMessage; $contactFormAttributes['owner'] = $model->contactWebForm->defaultOwner->id; $contactFormAttributes['state'] = $model->contactWebForm->defaultState->id; $model->serializedData = serialize($contactFormAttributes); }
function update_tilkee_tilk(&$bean, $event, $arguments = null) { if ($event != 'before_save') { return; } global $beanFiles; $tilk_name = '[TILK] '; // Email initialisation if ($bean->contacts_id != '') { require_once $beanFiles['Contact']; $the_contact = new Contact(); $the_contact->retrieve($bean->contacts_id); $bean->contact_email = $the_contact->emailAddress->getPrimaryAddress($the_contact); $bean->name = $tilk_name . $the_contact->name; } if ($bean->leads_id != '') { require_once $beanFiles['Lead']; $the_lead = new Lead(); $the_lead->retrieve($bean->leads_id); $bean->contact_email = $the_lead->emailAddress->getPrimaryAddress($the_lead); $bean->name = $tilk_name . $the_lead->name; } // delete URL if tilk is archived if ($bean->archived == 'true') { $bean->tilk_url = ''; } }
public function setUp() { SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('beanList'); SugarTestHelper::setUp('current_user'); $unid = uniqid(); $time = date('Y-m-d H:i:s'); $contact = new Contact(); $contact->id = 'c_' . $unid; $contact->first_name = 'testfirst'; $contact->last_name = 'testlast'; $contact->new_with_id = true; $contact->disable_custom_fields = true; $contact->save(); $this->contact = $contact; $account = new Account(); $account->id = 'a_' . $unid; $account->first_name = 'testfirst'; $account->last_name = 'testlast'; $account->assigned_user_id = 'SugarUser'; $account->new_with_id = true; $account->disable_custom_fields = true; $account->save(); $this->account = $account; $ac_id = 'ac_' . $unid; $this->ac_id = $ac_id; //Accounts to Contacts $GLOBALS['db']->query("INSERT INTO accounts_contacts (id , contact_id, account_id, date_modified, deleted) values ('{$ac_id}', '{$contact->id}', '{$account->id}', '{$time}', 0)"); $_REQUEST['relate_id'] = $this->contact->id; $_REQUEST['relate_to'] = 'projects_contacts'; }
public function index() { $vars = array('title' => 'Contact', 'description' => '...'); $isPost = $this->request->isPost(); $contact = new Contact(); $errors = array(); $success = false; if ($isPost) { foreach ($contact->getFields() as $key => $value) { try { $contact->{$key} = $this->request->post($key, ''); } catch (Exception $e) { $errors[$key] = $e->getMessage(); } } if (empty($errors)) { $success = $contact->insert(); } } $form = $contact->getForm('insert', ROOT_HTTP . $this->lang->getUserLang() . '/contact/post', $this->request, $isPost, $errors); $vars['form'] = $form; $vars['isPost'] = $isPost; $vars['errors'] = $errors; $vars['success'] = $success; $this->render('contact', $vars); }
public function setUp() { global $current_user, $currentModule; $mod_strings = return_module_language($GLOBALS['current_language'], "Contacts"); $current_user = SugarTestUserUtilities::createAnonymousUser(); $unid = uniqid(); $time = date('Y-m-d H:i:s'); $contact = new Contact(); $contact->id = 'c_' . $unid; $contact->first_name = 'testfirst'; $contact->last_name = 'testlast'; $contact->new_with_id = true; $contact->disable_custom_fields = true; $contact->save(); $this->c = $contact; $account = new Account(); $account->id = 'a_' . $unid; $account->first_name = 'testfirst'; $account->last_name = 'testlast'; $account->assigned_user_id = 'SugarUser'; $account->new_with_id = true; $account->disable_custom_fields = true; $account->save(); $this->a = $account; $ac_id = 'ac_' . $unid; $this->ac_id = $ac_id; $GLOBALS['db']->query("insert into accounts_contacts (id , contact_id, account_id, date_modified, deleted) values ('{$ac_id}', '{$contact->id}', '{$account->id}', '{$time}', 0)"); }
public function addContact(Contact $contact) { if (isset($contact)) { $this->db[$contact->getId()] = $contact; } else { echo "Error: Contact not added. Null parameters.\n"; } }
function Request_sugar() { parent::Basic(); $cont = new Contact(); $cont->retrieve('f0552f45-5d45-b8cd-b32c-521730a146f2'); /*$rabbit = new SugarRabbit(); $rabbit->CreateContact($cont);*/ }
/** * The index handler. * * @access public * @return string The HTML code. */ public function index() { $Contact = new Contact(); $Dealer = new Dealer(); $this->getView()->set('Contacts', $Contact->findList(array(), 'Position asc')); $this->getView()->set('Dealers', $Dealer->findList(array(), 'Position asc')); return $this->getView()->render(); }