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', "
  • ".$mod_strings['LBL_EXISTING_CONTACT']." - ".$contact->first_name ." ".$contact->last_name."" ); $xtpl->parse('main.row'); }else{ $xtpl->assign('ROWVALUE', "
  • ".$mod_strings['LBL_CREATED_CONTACT']." - ".$contact->first_name ." ".$contact->last_name."" ); $xtpl->parse('main.row'); } } if(isset($account)){ if(isset($_POST['selectedAccount']) && $_POST['selectedAccount'] == $account->id){ $xtpl->assign('ROWVALUE', "
  • ".$mod_strings['LBL_EXISTING_ACCOUNT']. " - ".$account->name.""); $xtpl->parse('main.row'); }else{ $xtpl->assign('ROWVALUE', "
  • ".$mod_strings['LBL_CREATED_ACCOUNT']. " - ".$account->name.""); $xtpl->parse('main.row'); } } if(isset($call)){ $xtpl->assign('ROWVALUE', "
  • ".$mod_strings['LBL_CREATED_CALL']. " - ".$call->name.""); $xtpl->parse('main.row'); } if(isset($meeting)){ $xtpl->assign('ROWVALUE', "
  • ".$mod_strings['LBL_CREATED_MEETING']. " - ".$meeting->name.""); $xtpl->parse('main.row'); } $xtpl->assign('ROWVALUE'," "); $xtpl->parse('main.row'); $xtpl->assign('ROWVALUE',"{$mod_strings['LBL_ADDMORE_BUSINESSCARD']}"); $xtpl->parse('main.row'); $xtpl->parse('main'); $xtpl->out('main'); } else{ //CONTACT $xtpl->assign('FORMHEADER',get_form_header($mod_strings['LNK_NEW_CONTACT'], '', '')); $xtpl->parse("main.startform"); require_once('modules/Contacts/ContactFormBase.php'); $contactForm = new ContactFormBase(); $xtpl->assign('FORMBODY',$contactForm->getWideFormBody('Contacts', 'Contacts')); $xtpl->assign('FORMFOOTER',get_form_footer()); $xtpl->assign('CLASS', 'evenListRow'); require_once('modules/Notes/NoteFormBase.php'); $noteForm = new NoteFormBase(); $postform = ""; $postform .= ''; $xtpl->assign('POSTFORM',$postform); $xtpl->parse("main.form"); //Account $xtpl->assign('FORMHEADER',get_form_header($mod_strings['LNK_NEW_ACCOUNT'], '', '')); require_once('modules/Accounts/AccountFormBase.php'); $accountForm = new AccountFormBase(); $xtpl->assign('CLASS', 'oddListRow'); $xtpl->assign('FORMBODY',"
    ".$accountForm->getFormBody('Accounts', 'Accounts')."${mod_strings['LBL_DESCRIPTION']}
    "); $xtpl->assign('FORMFOOTER',get_form_footer()); require_once('modules/Notes/NoteFormBase.php'); $noteForm = new NoteFormBase(); $postform = ""; $postform .= ''; $xtpl->assign('POSTFORM',$postform); $xtpl->parse("main.form"); //Appointment $xtpl->assign('FORMHEADER', get_form_header($mod_strings['LNK_NEW_APPOINTMENT'], '', '')); require_once('modules/Calls/CallFormBase.php'); $callForm = new CallFormBase(); $xtpl->assign('FORMBODY', "
    ${mod_strings['LNK_NEW_CALL']} ${mod_strings['LNK_NEW_MEETING']}
    ".$callForm->getFormBody('Appointments', 'Calls')."
    ${mod_strings['LBL_DESCRIPTION']}
    "); $xtpl->assign('FORMFOOTER', get_form_footer()); $xtpl->assign('POSTFORM',''); $xtpl->parse("main.form"); $xtpl->parse("main.save"); $xtpl->parse("main.endform"); $xtpl->parse("main"); $xtpl->out("main"); } ?>