Esempio n. 1
0
 function createQuickSearchCode($formName = 'EditView', $vardef)
 {
     require_once 'include/QuickSearchDefaults.php';
     $json = getJSONobj();
     $dynamicParentTypePlaceHolder = "**@**";
     //Placeholder for dynamic parent so smarty tags are not escaped in json encoding.
     $dynamicParentType = '{/literal}{if !empty($fields.parent_type.value)}{$fields.parent_type.value}{else}Accounts{/if}{literal}';
     //Get the parent sqs definition
     $qsd = new QuickSearchDefaults();
     $qsd->setFormName($formName);
     $sqsFieldArray = $qsd->getQSParent($dynamicParentTypePlaceHolder);
     $qsFieldName = $formName . "_" . $vardef['name'];
     //Build the javascript
     $quicksearch_js = '<script language="javascript">';
     $quicksearch_js .= "if(typeof sqs_objects == 'undefined'){var sqs_objects = new Array;}";
     $quicksearch_js .= "sqs_objects['{$qsFieldName}']=" . str_replace($dynamicParentTypePlaceHolder, $dynamicParentType, $json->encode($sqsFieldArray)) . ';';
     return $quicksearch_js .= '</script>';
 }
Esempio n. 2
0
    $ss->assign("RETURN_MODULE", $_REQUEST['return_module']);
}
if (isset($_REQUEST['return_action'])) {
    $ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
}
if (isset($_REQUEST['return_id'])) {
    $ss->assign("RETURN_ID", $_REQUEST['return_id']);
}
// handle Create $module then Cancel
if (empty($_REQUEST['return_id'])) {
    $ss->assign("RETURN_ACTION", 'index');
}
$ss->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']);
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
$qsd->setFormName('wizform');
$sqs_objects = array('parent_name' => $qsd->getQSParent(), 'assigned_user_name' => $qsd->getQSUser(), 'test_name' => getProspectListQSObjects('prospect_list_type_test', 'test_name', 'wiz_step3_test_name_id'), 'unsubscription_name' => getProspectListQSObjects('prospect_list_type_exempt', 'unsubscription_name', 'wiz_step3_unsubscription_name_id'), 'subscription_name' => getProspectListQSObjects('prospect_list_type_default', 'subscription_name', 'wiz_step3_subscription_name_id'));
$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
$ss->assign("JAVASCRIPT", $quicksearch_js);
//set the campaign type based on wizardtype value from request object
$campaign_type = 'newsletter';
if (isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype'] == 1 || $focus->campaign_type == 'NewsLetter') {
    $campaign_type = 'newsletter';
    $ss->assign("CAMPAIGN_DIAGNOSTIC_LINK", diagnose());
} elseif (isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype'] == 2 || $focus->campaign_type == 'Email') {
    $campaign_type = 'email';
    $ss->assign("CAMPAIGN_DIAGNOSTIC_LINK", diagnose());
} else {
    $campaign_type = 'general';
}
//******** CAMPAIGN HEADER AND BUDGET UI DIV Stuff (both divs) **********/
Esempio n. 3
0
 /**
  * Renders the Import form from Smarty and returns HTML
  * @param array $vars request variable global
  * @param object $email Fetched email object
  * @param bool $addToAddressBook
  * @return array
  */
 function getImportForm($vars, $email)
 {
     require_once 'include/json_config.php';
     require_once "include/EditView/EditView2.php";
     require_once "include/TemplateHandler/TemplateHandler.php";
     require_once 'include/QuickSearchDefaults.php';
     $qsd = new QuickSearchDefaults();
     $qsd->setFormName('ImportEditView');
     global $app_strings;
     global $current_user;
     global $app_list_strings;
     $sqs_objects = array('ImportEditView_parent_name' => $qsd->getQSParent());
     $smarty = new Sugar_Smarty();
     $smarty->assign("APP", $app_strings);
     $showAssignTo = false;
     if (!isset($vars['showAssignTo']) || $vars['showAssignTo'] == true) {
         $showAssignTo = true;
     }
     // if
     if ($showAssignTo) {
         if (empty($email->assigned_user_id) && empty($email->id)) {
             $email->assigned_user_id = $current_user->id;
         }
         if (empty($email->assigned_name) && empty($email->id)) {
             $email->assigned_user_name = $current_user->user_name;
         }
         $sqs_objects['ImportEditView_assigned_user_name'] = $qsd->getQSUser();
     }
     $smarty->assign("showAssignedTo", $showAssignTo);
     $showDelete = false;
     if (!isset($vars['showDelete']) || $vars['showDelete'] == true) {
         $showDelete = true;
     }
     $smarty->assign("showDelete", $showDelete);
     $smarty->assign("userId", $email->assigned_user_id);
     $smarty->assign("userName", $email->assigned_user_name);
     $parent_types = $app_list_strings['record_type_display'];
     $smarty->assign('parentOptions', get_select_options_with_id($parent_types, $email->parent_type));
     $quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
     $smarty->assign('SQS', $quicksearch_js);
     $meta = array();
     $meta['html'] = $smarty->fetch("modules/Emails/templates/importRelate.tpl");
     return $meta;
 }
 function createQuickSearchCode($returnAsJavascript = true)
 {
     $sqs_objects = array();
     require_once 'include/QuickSearchDefaults.php';
     $qsd = new QuickSearchDefaults();
     $qsd->setFormName($this->form_name);
     for ($i = 0; $i < $this->numFields; $i++) {
         $name1 = "{$this->form_name}_{$this->name}_collection_{$i}";
         if (!$this->skipModuleQuickSearch && preg_match('/(Campaigns|Teams|Users|Accounts)/si', $this->related_module, $matches)) {
             if ($matches[0] == 'Users') {
                 $sqs_objects[$name1] = $qsd->getQSUser();
             } else {
                 if ($matches[0] == 'Campaigns') {
                     $sqs_objects[$name1] = $qsd->getQSCampaigns();
                 } else {
                     if ($matches[0] == 'Users') {
                         $sqs_objects[$name1] = $qsd->getQSUser();
                     } else {
                         if ($matches[0] == 'Accounts') {
                             $nameKey = "{$this->name}_collection_{$i}";
                             $idKey = "id_{$this->name}_collection_{$i}";
                             //There are billingKey, shippingKey and additionalFields entries you can define in editviewdefs.php
                             //entry to allow quick search to autocomplete fields with a suffix value of the
                             //billing/shippingKey value (i.e. 'billingKey' => 'primary' in Contacts will populate
                             //primary_XXX fields with the Account's billing address values).
                             //addtionalFields are key/value pair of fields to fill from Accounts(key) to Contacts(value)
                             $billingKey = isset($this->displayParams['billingKey']) ? $this->displayParams['billingKey'] : null;
                             $shippingKey = isset($this->displayParams['shippingKey']) ? $this->displayParams['shippingKey'] : null;
                             $additionalFields = isset($this->displayParams['additionalFields']) ? $this->displayParams['additionalFields'] : null;
                             $sqs_objects[$name1] = $qsd->getQSAccount($nameKey, $idKey, $billingKey, $shippingKey, $additionalFields);
                         } else {
                             if ($matches[0] == 'Contacts') {
                                 $sqs_objects[$name1] = $qsd->getQSContact($name1, "id_" . $name1);
                             }
                         }
                     }
                 }
             }
             $temp_array = array('field_list' => array(), 'populate_list' => array());
             foreach ($sqs_objects[$name1]['field_list'] as $k => $v) {
                 if (!in_array($v, array('name', 'id'))) {
                     $sqs_objects[$name1]['primary_field_list'][] = $v;
                     $sqs_objects[$name1]['primary_populate_list'][] = $sqs_objects[$name1]['populate_list'][$k];
                 } else {
                     $temp_array['field_list'][] = $v;
                     $temp_array['populate_list'][] = $sqs_objects[$name1]['populate_list'][$k];
                 }
             }
             $sqs_objects[$name1]['field_list'] = $temp_array['field_list'];
             $sqs_objects[$name1]['populate_list'] = $temp_array['populate_list'];
             if (isset($this->displayParams['collection_field_list'])) {
                 foreach ($this->displayParams['collection_field_list'] as $v) {
                     $sqs_objects[$name1]['populate_list'][] = $v['vardefName'] . "_" . $this->name . "_collection_extra_" . $i;
                     $sqs_objects[$name1]['field_list'][] = $v['vardefName'];
                 }
             }
         } else {
             $sqs_objects[$name1] = $qsd->getQSParent($this->related_module);
             $sqs_objects[$name1]['populate_list'] = array("{$this->vardef['name']}_collection_{$i}", "id_{$this->vardef['name']}_collection_{$i}");
             $sqs_objects[$name1]['field_list'] = array('name', 'id');
             if (isset($this->displayParams['collection_field_list'])) {
                 foreach ($this->displayParams['collection_field_list'] as $v) {
                     $sqs_objects[$name1]['populate_list'][] = $v['vardefName'] . "_" . $this->name . "_collection_extra_" . $i;
                     $sqs_objects[$name1]['field_list'][] = $v['vardefName'];
                 }
             }
             if (isset($this->displayParams['field_to_name_array'])) {
                 foreach ($this->displayParams['field_to_name_array'] as $k => $v) {
                     /*
                      * "primary_populate_list" and "primary_field_list" are used when the field is selected as a primary.
                      * At this time the JS function changePrimary() will copy "primary_populate_list" and "primary_field_list"
                      * into "populate_list" and "field_list" and remove the values from all the others which are secondaries.
                      * "primary_populate_list" and "primary_field_list" contain the fields which has to be populated outside of
                      * the collection field. For example the "Address Information" are populated with the "billing address" of the
                      * selected account in a contact editview.
                      */
                     $sqs_objects[$name1]['primary_populate_list'][] = $v;
                     $sqs_objects[$name1]['primary_field_list'][] = $k;
                 }
             } else {
                 if (isset($field['field_list']) && isset($field['populate_list'])) {
                     $sqs_objects[$name1]['primary_populate_list'] = array_merge($sqs_objects[$name1]['populate_list'], $field['field_list']);
                     $sqs_objects[$name1]['primary_field_list'] = array_merge($sqs_objects[$name1]['field_list'], $field['populate_list']);
                 } else {
                     $sqs_objects[$name1]['primary_populate_list'] = array();
                     $sqs_objects[$name1]['primary_field_list'] = array();
                 }
             }
         }
     }
     $id = "{$this->form_name}_{$this->name}_collection_0";
     if (!empty($sqs_objects) && count($sqs_objects) > 0) {
         foreach ($sqs_objects[$id]['field_list'] as $k => $v) {
             $this->field_to_name_array[$v] = $sqs_objects[$id]['populate_list'][$k];
         }
         if ($returnAsJavascript) {
             $quicksearch_js = '<script language="javascript">';
             $quicksearch_js .= "if(typeof sqs_objects == 'undefined'){var sqs_objects = new Array;}";
             foreach ($sqs_objects as $sqsfield => $sqsfieldArray) {
                 $quicksearch_js .= "sqs_objects['{$sqsfield}']={$this->json->encode($sqsfieldArray)};";
             }
             return $quicksearch_js .= '</script>';
         } else {
             return $sqs_objects;
         }
     }
     return '';
 }
Esempio n. 5
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     if (!empty($_REQUEST['handle']) && $_REQUEST['handle'] == 'save') {
         return $this->handleSave();
     }
     global $beanList;
     // get the EditView defs to check if opportunity_name exists, for a check below for populating data
     $opportunityNameInLayout = false;
     $editviewFile = 'modules/Leads/metadata/editviewdefs.php';
     $this->medataDataFile = $editviewFile;
     if (file_exists("custom/{$editviewFile}")) {
         $this->medataDataFile = "custom/{$editviewFile}";
     }
     include $this->medataDataFile;
     foreach ($viewdefs['Leads']['EditView']['panels'] as $panel_index => $section) {
         foreach ($section as $row_array) {
             foreach ($row_array as $cell) {
                 if (isset($cell['name']) && $cell['name'] == 'opportunity_name') {
                     $opportunityNameInLayout = true;
                 }
             }
         }
     }
     $this->medataDataFile = $this->fileName;
     if (file_exists("custom/{$this->fileName}")) {
         $this->medataDataFile = "custom/{$this->fileName}";
     }
     $this->loadDefs();
     $this->getRecord();
     $this->checkForDuplicates($this->focus);
     $smarty = new Sugar_Smarty();
     $ev = new EditView();
     $ev->ss = $smarty;
     $ev->view = "ConvertLead";
     echo $this->getModuleTitle();
     require_once "include/QuickSearchDefaults.php";
     $qsd = new QuickSearchDefaults();
     $qsd->setFormName("ConvertLead");
     $this->contact = new Contact();
     $smarty->assign("contact_def", $this->contact->field_defs);
     $smarty->assign("form_name", "ConvertLead");
     $smarty->assign("form_id", "ConvertLead");
     $smarty->assign("module", "Leads");
     $smarty->assign("view", "convertlead");
     $smarty->assign("bean", $this->focus);
     $smarty->assign("record_id", $this->focus->id);
     $smarty->display("modules/Leads/tpls/ConvertLeadHeader.tpl");
     echo "<div class='edit view' style='width:auto;'>";
     foreach ($this->defs as $module => $vdef) {
         if (!isset($beanList[$module])) {
             continue;
         }
         $bean = $beanList[$module];
         $focus = new $bean();
         $focus->fill_in_additional_detail_fields();
         foreach ($focus->field_defs as $field => $def) {
             if (isset($vdef[$ev->view]['copyData']) && $vdef[$ev->view]['copyData']) {
                 if ($module == "Accounts" && $field == 'name') {
                     $focus->name = $this->focus->account_name;
                 } else {
                     if ($module == "Opportunities" && $field == 'amount') {
                         $focus->amount = unformat_number($this->focus->opportunity_amount);
                     } else {
                         if ($module == "Opportunities" && $field == 'name') {
                             if ($opportunityNameInLayout && !empty($this->focus->opportunity_name)) {
                                 $focus->name = $this->focus->opportunity_name;
                             }
                         } else {
                             if ($field == "id") {
                                 //If it is not a contact, don't copy the ID from the lead
                                 if ($module == "Contacts") {
                                     $focus->{$field} = $this->focus->{$field};
                                 }
                             } else {
                                 if (is_a($focus, "Company") && $field == 'phone_office') {
                                     //Special case where company and person have the same field with a different name
                                     $focus->phone_office = $this->focus->phone_work;
                                 } else {
                                     if (isset($this->focus->{$field})) {
                                         $focus->{$field} = $this->focus->{$field};
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         //Copy over email data
         $ev->setup($module, $focus, $this->medataDataFile, "modules/Leads/tpls/ConvertLead.tpl", false);
         $ev->process();
         echo $ev->display(false);
         echo $this->getValidationJS($module, $focus, $vdef[$ev->view]);
     }
     echo "</div>";
     echo $qsd->getQSScriptsJSONAlreadyDefined();
     $smarty->display("modules/Leads/tpls/ConvertLeadFooter.tpl");
 }
 /**
  * createQuickSearchCode
  * This function creates the $sqs_objects array that will be used by the quicksearch Javascript
  * code.  The $sqs_objects array is wrapped in a $json->encode call.
  *
  * @param $def The vardefs.php definitions
  * @param $defs2 The Meta-Data file definitions
  *
  */
 function createQuickSearchCode($defs, $defs2, $view = '')
 {
     $sqs_objects = array();
     require_once 'include/QuickSearchDefaults.php';
     $qsd = new QuickSearchDefaults();
     $qsd->setFormName($view);
     if (preg_match("/^SearchForm_.+/", $view)) {
         $qsd->setFormName('search_form');
         $parsedView = preg_replace("/^SearchForm_/", "", $view);
         //Loop through the Meta-Data fields to see which ones need quick search support
         foreach ($defs as $f) {
             $field = $f;
             $name = $qsd->form_name . '_' . $field['name'];
             if ($field['type'] == 'relate' && isset($field['module']) && preg_match('/_name$|_c$/si', $name)) {
                 if (preg_match('/^(Campaigns|Teams|Users|Contacts|Accounts)$/si', $field['module'], $matches)) {
                     if ($matches[0] == 'Campaigns') {
                         $sqs_objects[$name . '_' . $parsedView] = $qsd->getQSCampaigns();
                     } else {
                         if ($matches[0] == 'Users') {
                             if (!empty($f['name']) && !empty($f['id_name'])) {
                                 $sqs_objects[$name . '_' . $parsedView] = $qsd->getQSUser($f['name'], $f['id_name']);
                             } else {
                                 $sqs_objects[$name . '_' . $parsedView] = $qsd->getQSUser();
                             }
                         } else {
                             if ($matches[0] == 'Accounts') {
                                 $nameKey = $name;
                                 $idKey = isset($field['id_name']) ? $field['id_name'] : 'account_id';
                                 //There are billingKey, shippingKey and additionalFields entries you can define in editviewdefs.php
                                 //entry to allow quick search to autocomplete fields with a suffix value of the
                                 //billing/shippingKey value (i.e. 'billingKey' => 'primary' in Contacts will populate
                                 //primary_XXX fields with the Account's billing address values).
                                 //addtionalFields are key/value pair of fields to fill from Accounts(key) to Contacts(value)
                                 $billingKey = isset($f['displayParams']['billingKey']) ? $f['displayParams']['billingKey'] : null;
                                 $shippingKey = isset($f['displayParams']['shippingKey']) ? $f['displayParams']['shippingKey'] : null;
                                 $additionalFields = isset($f['displayParams']['additionalFields']) ? $f['displayParams']['additionalFields'] : null;
                                 $sqs_objects[$name . '_' . $parsedView] = $qsd->getQSAccount($nameKey, $idKey, $billingKey, $shippingKey, $additionalFields);
                             } else {
                                 if ($matches[0] == 'Contacts') {
                                     $sqs_objects[$name . '_' . $parsedView] = $qsd->getQSContact($field['name'], $field['id_name']);
                                 }
                             }
                         }
                     }
                 } else {
                     $sqs_objects[$name . '_' . $parsedView] = $qsd->getQSParent($field['module']);
                     if (!isset($field['field_list']) && !isset($field['populate_list'])) {
                         $sqs_objects[$name . '_' . $parsedView]['populate_list'] = array($field['name'], $field['id_name']);
                         $sqs_objects[$name . '_' . $parsedView]['field_list'] = array('name', 'id');
                     } else {
                         $sqs_objects[$name . '_' . $parsedView]['populate_list'] = $field['field_list'];
                         $sqs_objects[$name . '_' . $parsedView]['field_list'] = $field['populate_list'];
                     }
                 }
             } else {
                 if ($field['type'] == 'parent') {
                     $sqs_objects[$name . '_' . $parsedView] = $qsd->getQSParent();
                 }
             }
             //if-else
         }
         //foreach
         //_pp($sqs_objects);
         foreach ($sqs_objects as $name => $field) {
             foreach ($field['populate_list'] as $key => $fieldname) {
                 $sqs_objects[$name]['populate_list'][$key] = $sqs_objects[$name]['populate_list'][$key] . '_' . $parsedView;
             }
         }
     } else {
         //Loop through the Meta-Data fields to see which ones need quick search support
         foreach ($defs2 as $f) {
             if (!isset($defs[$f['name']])) {
                 continue;
             }
             $field = $defs[$f['name']];
             $name = $qsd->form_name . '_' . $field['name'];
             if ($field['type'] == 'relate' && isset($field['module']) && (preg_match('/_name$|_c$/si', $name) || !empty($field['quicksearch']))) {
                 if (!preg_match('/_c$/si', $name) && preg_match('/^(Campaigns|Teams|Users|Contacts|Accounts)$/si', $field['module'], $matches)) {
                     if ($matches[0] == 'Campaigns') {
                         $sqs_objects[$name] = $qsd->getQSCampaigns();
                     } else {
                         if ($matches[0] == 'Users') {
                             if ($field['name'] == 'reports_to_name') {
                                 $sqs_objects[$name] = $qsd->getQSUser('reports_to_name', 'reports_to_id');
                             } else {
                                 $sqs_objects[$name] = $qsd->getQSUser();
                             }
                         } else {
                             if ($matches[0] == 'Accounts') {
                                 $nameKey = $name;
                                 $idKey = isset($field['id_name']) ? $field['id_name'] : 'account_id';
                                 //There are billingKey, shippingKey and additionalFields entries you can define in editviewdefs.php
                                 //entry to allow quick search to autocomplete fields with a suffix value of the
                                 //billing/shippingKey value (i.e. 'billingKey' => 'primary' in Contacts will populate
                                 //primary_XXX fields with the Account's billing address values).
                                 //addtionalFields are key/value pair of fields to fill from Accounts(key) to Contacts(value)
                                 $billingKey = SugarArray::staticGet($f, 'displayParams.billingKey');
                                 $shippingKey = SugarArray::staticGet($f, 'displayParams.shippingKey');
                                 $additionalFields = SugarArray::staticGet($f, 'displayParams.additionalFields');
                                 $sqs_objects[$name] = $qsd->getQSAccount($nameKey, $idKey, $billingKey, $shippingKey, $additionalFields);
                             } else {
                                 if ($matches[0] == 'Contacts') {
                                     $sqs_objects[$name] = $qsd->getQSContact($field['name'], $field['id_name']);
                                     if (preg_match('/_c$/si', $name) || !empty($field['quicksearch'])) {
                                         $sqs_objects[$name]['field_list'] = array('salutation', 'first_name', 'last_name', 'id');
                                     }
                                 }
                             }
                         }
                     }
                 } else {
                     $sqs_objects[$name] = $qsd->getQSParent($field['module']);
                     if (!isset($field['field_list']) && !isset($field['populate_list'])) {
                         $sqs_objects[$name]['populate_list'] = array($field['name'], $field['id_name']);
                         // now handle quicksearches where the column to match is not 'name' but rather specified in 'rname'
                         if (!isset($field['rname'])) {
                             $sqs_objects[$name]['field_list'] = array('name', 'id');
                         } else {
                             $sqs_objects[$name]['field_list'] = array($field['rname'], 'id');
                             $sqs_objects[$name]['order'] = $field['rname'];
                             $sqs_objects[$name]['conditions'] = array(array('name' => $field['rname'], 'op' => 'like_custom', 'end' => '%', 'value' => ''));
                         }
                     } else {
                         $sqs_objects[$name]['populate_list'] = $field['field_list'];
                         $sqs_objects[$name]['field_list'] = $field['populate_list'];
                     }
                 }
             } else {
                 if ($field['type'] == 'parent') {
                     $sqs_objects[$name] = $qsd->getQSParent();
                 }
             }
             //if-else
         }
         //foreach
     }
     //Implement QuickSearch for the field
     if (!empty($sqs_objects) && count($sqs_objects) > 0) {
         $quicksearch_js = '<script language="javascript">';
         $quicksearch_js .= "if(typeof sqs_objects == 'undefined'){var sqs_objects = new Array;}";
         $json = getJSONobj();
         foreach ($sqs_objects as $sqsfield => $sqsfieldArray) {
             $quicksearch_js .= "sqs_objects['{$sqsfield}']={$json->encode($sqsfieldArray)};";
         }
         return $quicksearch_js . '</script>';
     }
     return '';
 }
Esempio n. 7
0
    $xtpl->assign('CLASS', 'dataLabel');
    require_once 'modules/Notes/NoteFormBase.php';
    $noteForm = new NoteFormBase();
    $postform = "<h5 class='dataLabel'><input class='checkbox' type='checkbox' name='newcontactnote' onclick='toggleDisplay(\"contactnote\");'> {$mod_strings['LNK_NEW_NOTE']}</h5>";
    $postform .= '<div id="contactnote" style="display:none">' . $noteForm->getFormBody('ContactNotes', 'Notes', 'BusinessCard', 85) . '</div>';
    $xtpl->assign('POSTFORM', $postform);
    $xtpl->parse("main.form");
    $xtpl->assign('HEADER', $app_strings['LBL_RELATED_RECORDS']);
    $xtpl->parse("main.hrrow");
    $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'BusinessCard', 'field_to_name_array' => array('id' => 'selectedAccount', 'name' => 'display_account_name'));
    $json = getJSONobj();
    $encoded_contact_popup_request_data = $json->encode($popup_request_data);
    //Account
    require_once 'include/QuickSearchDefaults.php';
    $qsd = new QuickSearchDefaults();
    $qsd->setFormName('BusinessCard');
    $sqs_objects = array('BusinessCard_display_account_name' => $qsd->getQSParent());
    $sqs_objects['BusinessCard_display_account_name']['populate_list'] = array('display_account_name', 'selectedAccount');
    $quicksearch_js = '<script type="text/javascript" language="javascript">
                       sqs_objects = ' . $json->encode($sqs_objects) . ';
				       addToValidateBinaryDependency(\'BusinessCard\', \'display_account_name\', \'alpha\', false, \'' . $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $app_strings['LBL_ACCOUNT'] . '\', \'selectedAccount\' );
				   </script>';
    $selectAccountButton = $quicksearch_js;
    $selectAccountButton .= "<div id='newaccountdivlink' style='display:inline' class='dataLabel'>{$mod_strings['LNK_SELECT_ACCOUNT']}:&nbsp;<input class='sqsEnabled' name='display_account_name' id='display_account_name' type=\"text\" value=\"\"><input name='selectedAccount' id='selectedAccount' type=\"hidden\" value=''>&nbsp;<input type='button' title=\"{$app_strings['LBL_SELECT_BUTTON_TITLE']}\" accessKey=\"{$app_strings['LBL_SELECT_BUTTON_KEY']}\" type=\"button\"  class=\"button\" value='{$app_strings['LBL_SELECT_BUTTON_LABEL']}' name=btn1 LANGUAGE=javascript onclick='open_popup(\"Accounts\", 600, 400, \"\", true, false, {$encoded_contact_popup_request_data});'/> <input type='button' title=\"{$app_strings['LBL_CLEAR_BUTTON_TITLE']}\" accessKey=\"{$app_strings['LBL_CLEAR_BUTTON_KEY']}\" type=\"button\"  class=\"button\" value='{$app_strings['LBL_CLEAR_BUTTON_LABEL']}' name=btn1 LANGUAGE=javascript onclick='document.forms[\"BusinessCard\"].selectedAccount.value=\"\";document.forms[\"BusinessCard\"].display_account_name.value=\"\"; '><br><b>{$app_strings['LBL_OR']}</b></div><br><br>";
    $xtpl->assign('FORMHEADER', get_form_header($mod_strings['LNK_NEW_ACCOUNT'], '', ''));
    require_once 'modules/Accounts/AccountFormBase.php';
    $accountForm = new AccountFormBase();
    $xtpl->assign('CLASS', 'evenListRow');
    $xtpl->assign('FORMBODY', $selectAccountButton . "<slot class='dataLabel'><input class='checkbox' type='checkbox' name='newaccount' onclick='document.forms[\"BusinessCard\"].selectedAccount.value=\"\";document.forms[\"BusinessCard\"].display_account_name.value=\"\";toggleDisplay(\"newaccountdiv\");'>&nbsp;" . $mod_strings['LNK_NEW_ACCOUNT'] . "</slot>&nbsp;<div id='newaccountdiv' style='display:none'>" . $accountForm->getWideFormBody('Accounts', 'Accounts', 'BusinessCard', ''));
    require_once 'modules/Notes/NoteFormBase.php';
    $noteForm = new NoteFormBase();