assign("MOD", $mod_strings); $xtpl->assign("APP", $app_strings); $xtpl->assign("IMAGE_PATH", $image_path);$xtpl->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']); $xtpl->assign("HEADER", $mod_strings['LBL_ADD_BUSINESSCARD']); $xtpl->assign("MODULE", $_REQUEST['module']); if ($error_msg != '') { $xtpl->assign("ERROR", $error_msg); $xtpl->parse("main.error"); } if(isset($_POST['handle']) && $_POST['handle'] == 'Save'){ require_once('modules/Contacts/Contact.php'); require_once('modules/Contacts/ContactFormBase.php'); $contactForm = new ContactFormBase(); require_once('modules/Accounts/AccountFormBase.php'); $accountForm = new AccountFormBase(); if(!isset($_POST['selectedContact']) && !isset($_POST['ContinueContact'])){ $duplicateContacts = $contactForm->checkForDuplicates('Contacts'); $vtlog->logthis("Duplicate Contact Checking Finished.",'info'); if(isset($duplicateContacts)){ $xtpl->assign('FORMBODY', $contactForm->buildTableForm($duplicateContacts)); $xtpl->parse('main.formnoborder'); $xtpl->parse('main'); $xtpl->out('main'); return; } } if(!isset($_POST['selectedAccount']) && !isset($_POST['ContinueAccount'])){ $duplicateAccounts = $accountForm->checkForDuplicates('Accounts'); $vtlog->logthis("Duplicate Account Checking Finished.",'info'); if(isset($duplicateAccounts)){ $xtpl->assign('FORMBODY', $accountForm->buildTableForm($duplicateAccounts)); $xtpl->parse('main.formnoborder'); $xtpl->parse('main'); $xtpl->out('main'); return; } } if(isset($_POST['selectedContact']) && !empty($_POST['selectedContact'])){ $contact = new Contact(); $contact->retrieve($_POST['selectedContact']); $vtlog->logthis("Selected Contact Successfully Retrieved.",'info'); }else{ $contact= $contactForm->handleSave('Contacts',false, true); } if(isset($_POST['selectedAccount']) && !empty($_POST['selectedAccount'])){ $account = new Account(); $account->retrieve($_POST['selectedAccount']); $vtlog->logthis("Selected Account Successfully Retrieved.",'info'); }else{ $account= $accountForm->handleSave('Accounts',false, true); } require_once('modules/Notes/NoteFormBase.php'); $noteForm = new NoteFormBase(); if(isset($account)) $accountnote= $noteForm->handleSave('AccountNotes',false, true); if(isset($contact)) $contactnote= $noteForm->handleSave('ContactNotes',false, true); if(isset($_POST['appointment']) && $_POST['appointment'] == 'Meeting'){ require_once('modules/Meetings/MeetingFormBase.php'); $meetingForm = new MeetingFormBase(); $meeting= $meetingForm->handleSave('Appointments',false, true); }else{ require_once('modules/Calls/CallFormBase.php'); $callForm = new CallFormBase(); $call= $callForm->handleSave('Appointments',false, true); } if(isset($call)){ if(isset($contact)) $call->set_calls_contact_invitee_relationship($call->id, $contact->id); if(isset($account)){ $call->set_calls_account_relationship($call->id, $account->id); }else if(isset($opportunity)){ $call->set_calls_opportunity_relationship($call->id, $opportunity->id); } } if(isset($meeting)){ if(isset($contact)) $meeting->set_meetings_contact_invitee_relationship($meeting->id, $contact->id); if(isset($account)){ $meeting->set_meetings_account_relationship($meeting->id, $account->id); }else if(isset($opportunity)){ $meeting->set_meetings_opportunity_relationship($meeting->id, $opportunity->id); } } if(isset($account)){ if(isset($contact)){ $account->set_account_contact_relationship($account->id, $contact->id); } if(isset($opportunity)){ $account->set_account_opportunity_relationship($account->id, $opportunity->id); } if(isset($accountnote)){ $account->set_account_note_relationship($account->id, $accountnote->id); } } if(isset($opportunity)){ if(isset($contact)){ $opportunity->set_opportunity_contact_relationship($opportunity->id, $contact->id); } if(isset($accountnote)){ $opportunity->set_opportunity_note_relationship($opportunity->id, $accountnote->id); } } if(isset($contact)){ if(isset($contactnote)){ $contact->set_note_contact_relationship($contact->id, $contactnote->id); } } if(isset($contact)){ if(isset($_POST['selectedContact']) && $_POST['selectedContact'] == $contact->id){ $xtpl->assign('ROWVALUE', "
".$accountForm->getFormBody('Accounts', 'Accounts')." | ${mod_strings['LBL_DESCRIPTION']} |
${mod_strings['LNK_NEW_CALL']} ${mod_strings['LNK_NEW_MEETING']} ".$callForm->getFormBody('Appointments', 'Calls')." | ${mod_strings['LBL_DESCRIPTION']} |