function listViewProcess()
 {
     $this->processSearchForm();
     $this->lv->searchColumns = $this->searchForm->searchColumns;
     if ($this->where != "") {
         $this->where .= ' and oqc_product.is_latest !=0';
         //			$this->where .= ' and oqc_product.is_option !=1';
     } else {
         $this->where .= 'oqc_product.is_latest !=0';
         //			$this->where .= ' and oqc_product.is_option !=1';
     }
     if (!$this->headers) {
         return;
     }
     global $sugar_version;
     if (empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false) {
         if (floatval(substr($sugar_version, 0, 3)) > 6.4) {
             $this->lv->setup($this->seed, 'modules/oqc_Product/views/ListView65.tpl', $this->where, $this->params);
         } elseif (floatval(substr($sugar_version, 0, 3)) > 6.3) {
             $this->lv->setup($this->seed, 'modules/oqc_Product/views/ListView64.tpl', $this->where, $this->params);
         } elseif (floatval(substr($sugar_version, 0, 3)) >= 6.0 && floatval(substr($sugar_version, 0, 3)) <= 6.3) {
             $this->lv->setup($this->seed, 'modules/oqc_Product/views/ListView62.tpl', $this->where, $this->params);
         } else {
             $this->lv->setup($this->seed, 'modules/oqc_Product/views/ListView52.tpl', $this->where, $this->params);
         }
         $savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : ' - ' . $_REQUEST['saved_search_select_name'];
         //	echo get_form_header($GLOBALS['mod_strings']['LBL_LIST_FORM_TITLE'] . $savedSearchName, '', false);
         //Quick Search support
         $qsd = new QuickSearchDefaults();
         $sqsJavascript = $qsd->getQSScripts();
         $sqsJavascript .= '<script type="text/javascript" src="include/oqc/QuickSearch/oqcQS.js"></script>';
         echo $sqsJavascript;
         echo $this->lv->display();
     }
 }
function getSVNumberQuicksearch($name, $idName)
{
    global $app_strings;
    $sqsObjects = array('svnumber' => array('method' => 'query', 'modules' => array('oqc_Contract'), 'field_list' => array('svnumber', 'id'), 'populate_list' => array($name, $idName), 'group' => 'or', 'conditions' => array(array('name' => 'svnumber', 'op' => 'like_custom', 'end' => '%', 'value' => '')), 'limit' => '30', 'order' => 'svnumber', 'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']));
    $json = getJSONobj();
    $qsd = new QuickSearchDefaults();
    $sqsJavascript = $qsd->getQSScripts();
    //$sqsJavascript .= '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqsObjects) . ';';
    $sqsJavascript .= '<script type="text/javascript" language="javascript">sqs_objects = {};';
    $sqsJavascript .= '</script>';
    return $sqsJavascript;
}
Example #3
0
 function display()
 {
     if (is_admin($GLOBALS['current_user'])) {
         $json = getJSONobj();
         require_once 'include/QuickSearchDefaults.php';
         $qsd = new QuickSearchDefaults();
         $sqs_objects = array('EditView_reports_to_name' => $qsd->getQSUser());
         $sqs_objects['EditView_reports_to_name']['populate_list'] = array('reports_to_name', 'reports_to_id');
         $quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '; enableQS();</script>';
         $this->ss->assign('REPORTS_TO_JS', $quicksearch_js);
         $this->ss->assign('EDIT_REPORTS_TO', true);
     }
     parent::display();
 }
 function display()
 {
     if (is_admin($GLOBALS['current_user'])) {
         $json = getJSONobj();
         require_once 'include/QuickSearchDefaults.php';
         $qsd = new QuickSearchDefaults();
         $sqs_objects = array('EditView_reports_to_name' => $qsd->getQSUser());
         $sqs_objects['EditView_reports_to_name']['populate_list'] = array('reports_to_name', 'reports_to_id');
         $quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '; enableQS();</script>';
         $this->ss->assign('REPORTS_TO_JS', $quicksearch_js);
         $this->ss->assign('EDIT_REPORTS_TO', true);
     }
     //retrieve employee bean if it is not already in focus
     if (empty($this->bean->id) && !empty($_REQUEST['record'])) {
         $this->bean->retrieve($_REQUEST['record']);
     }
     //populate values for non admin users
     if (!empty($this->bean->id)) {
         global $app_list_strings;
         if (!empty($this->bean->status)) {
             $this->ss->assign('STATUS_READONLY', $app_list_strings['user_status_dom'][$this->bean->status]);
         }
         if (!empty($this->bean->employee_status)) {
             $this->ss->assign('EMPLOYEE_STATUS_READONLY', $app_list_strings['employee_status_dom'][$this->bean->employee_status]);
         }
         if (!empty($this->bean->reports_to_id)) {
             $reportsToUser = get_assigned_user_name($this->bean->reports_to_id);
             $reportsToUserField = "<input type='text' name='reports_to_name' id='reports_to_name' value='{$reportsToUser}' disabled>\n";
             $reportsToUserField .= "<input type='hidden' name='reports_to_id' id='reports_to_id' value='{$this->bean->reports_to_id}'>";
             $this->ss->assign('REPORTS_TO_READONLY', $reportsToUserField);
         }
         if (!empty($this->bean->title)) {
             $this->ss->assign('TITLE_READONLY', $this->bean->title);
         }
         if (!empty($this->bean->department)) {
             $this->ss->assign('DEPT_READONLY', $this->bean->department);
         }
     }
     parent::display();
 }
function get_new_record_form()
{
    if (!ACLController::checkAccess('Press', 'edit', true)) {
        return '';
    }
    global $app_strings;
    global $mod_strings;
    global $currentModule;
    global $current_user;
    $the_form = get_left_form_header($mod_strings['LBL_QUICK_NEW_PRESS']);
    $form = new XTemplate('modules/Press/Forms.html');
    $module_select = empty($_REQUEST['module_select']) ? '' : $_REQUEST['module_select'];
    $form->assign('mod', $mod_strings);
    $form->assign('app', $app_strings);
    $form->assign('module', $currentModule);
    $json = getJSONobj();
    $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'quick_save', 'field_to_name_array' => array('id' => 'assigned_user_id', 'user_name' => 'assigned_user_name'));
    $form->assign('encoded_users_popup_request_data', $json->encode($popup_request_data));
    $form->parse('main');
    $the_form .= $form->text('main');
    require_once 'modules/Press/Press.php';
    $focus = new Press();
    require_once 'include/QuickSearchDefaults.php';
    $qsd = new QuickSearchDefaults();
    $sqs_objects = array('assigned_user_name' => $qsd->getQSUser());
    $quicksearch_js = $qsd->getQSScripts();
    $quicksearch_js .= '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
    echo $quicksearch_js;
    require_once 'include/javascript/javascript.php';
    $javascript = new javascript();
    $javascript->setFormName('quick_save');
    $javascript->setSugarBean($focus);
    $javascript->addRequiredFields('');
    $javascript->addToValidateBinaryDependency('assigned_user_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $app_strings['LBL_ASSIGNED_TO'], 'false', '', 'assigned_user_id');
    $jscript = $javascript->getScript();
    $the_form .= $jscript . get_left_form_footer();
    return $the_form;
}
 function js_setup()
 {
     global $global_json;
     $global_json = getJSONobj();
     require_once 'include/QuickSearchDefaults.php';
     $qsd = new QuickSearchDefaults();
     if (isset($_REQUEST['parent_type'])) {
         $sqs_objects = array('parent_name' => $qsd->getQSParent($_REQUEST['parent_type']));
     } else {
         $sqs_objects = array('parent_name' => $qsd->getQSParent());
     }
     /*
     		if (isset($_REQUEST['parent_type']) && $_REQUEST['parent_type'] != 'Users') 
     $sqs_objects = array('parent_name' => $qsd->getQSParent($_REQUEST['parent_type']));
     		else if (isset($_REQUEST['parent_type']) && $_REQUEST['parent_type'] == 'Users') 
     $sqs_objects = array('parent_name' => $qsd->getQSUser());
     
     		else 
     $sqs_objects = array('parent_name' => $qsd->getQSParent());
     */
     $quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $global_json->encode($sqs_objects) . '</script>';
     return $quicksearch_js;
 }
 /**
  * Applies the Action to the target.
  *
  * @param SugarBean $target
  */
 function fire(&$target)
 {
     require_once 'modules/Home/quicksearchQuery.php';
     require_once 'include/QuickSearchDefaults.php';
     $json = getJSONobj();
     $userName = Parser::evaluate($this . expr, $target) . evaluate();
     $qsd = QuickSearchDefaults::getQuickSearchDefaults();
     $data = $qsd->getQSUser();
     $data['modules'] = array("Users");
     $data['conditions'][0]['value'] = $userName;
     $qs = new quicksearchQuery();
     $result = $qs->query($data);
     $resultBean = $json->decodeReal($result);
     print_r($resultBean);
 }
}
if (isset($_REQUEST['return_id'])) {
    $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
}
// handle Create $module then Cancel
if (empty($_REQUEST['return_id'])) {
    $xtpl->assign("RETURN_ACTION", 'index');
}
if (isset($_REQUEST['campaign_id'])) {
    $xtpl->assign("CAMPAIGN_ID", $_REQUEST['campaign_id']);
}
$xtpl->assign("THEME", $theme);
$xtpl->assign("IMAGE_PATH", $image_path);
$xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']);
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
$sqs_objects = array('assigned_user_name' => $qsd->getQSUser());
$quicksearch_js = $qsd->getQSScripts();
$quicksearch_js .= '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
$xtpl->assign("JAVASCRIPT", get_set_focus_js() . get_validate_record_js() . $quicksearch_js);
if (empty($focus->assigned_user_id) && empty($focus->id)) {
    $focus->assigned_user_id = $current_user->id;
}
if (empty($focus->assigned_name) && empty($focus->id)) {
    $focus->assigned_user_name = $current_user->user_name;
}
$xtpl->assign("ASSIGNED_USER_OPTIONS", get_select_options_with_id(get_user_array(TRUE, "Active", $focus->assigned_user_id), $focus->assigned_user_id));
$xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);
$xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id);
$xtpl->assign("DATE_ENTERED", $focus->date_entered);
$xtpl->assign("DATE_MODIFIED", $focus->date_modified);
Example #9
0
	'form_name' => 'EditView',
	'field_to_name_array' => array(
		'id' => 'assigned_user_id',
		'user_name' => 'assigned_user_name',
		),
	);
$json = getJSONobj();
$xtpl->assign('encoded_assigned_users_popup_request_data', $json->encode($popup_request_data));
if(!empty($focus->assigned_user_name))
    $xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);

$xtpl->assign("assign_user_select", SugarThemeRegistry::current()->getImage('id-ff-select','',null,null,'.png',$mod_strings['LBL_SELECT']));
$xtpl->assign("assign_user_clear", SugarThemeRegistry::current()->getImage('id-ff-clear','',null,null,'.gif',$mod_strings['LBL_ID_FF_CLEAR']));
//Assign qsd script
require_once('include/QuickSearchDefaults.php');
$qsd = QuickSearchDefaults::getQuickSearchDefaults();
$sqs_objects = array( 'EditView_assigned_user_name' => $qsd->getQSUser());
$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '; enableQS();</script>';

$xtpl->assign("CANCEL_SCRIPT", $cancel_script);
$xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
$xtpl->assign("JAVASCRIPT", get_set_focus_js() . $quicksearch_js);

if(!is_file(sugar_cached('jsLanguage/') . $GLOBALS['current_language'] . '.js')) {
    require_once('include/language/jsLanguage.php');
	$jsLanguage = new jsLanguage();
	$jsLanguage->createAppStringsCache($GLOBALS['current_language']);
}
$jsLang = getVersionedScript("cache/jsLanguage/{$GLOBALS['current_language']}.js",  $GLOBALS['sugar_config']['js_lang_version']);
$xtpl->assign("JSLANG", $jsLang);
        $col_arr[1] = $field_def['name'];
        $col_arr[2] = true;
    } else {
        $cols_name = $field_def['vname'];
        $col_arr[0] = $cols_name;
        $col_arr[1] = $field_def['name'];
    }
    if (!in_array($cols_name, $fields)) {
        array_push($fields, $col_arr);
    }
    $count++;
}
$xtpl->assign("WEB_POST_URL", $web_post_url);
//$xtpl->assign("LEAD_SELECT_FIELDS",'MOD.LBL_SELECT_LEAD_FIELDS');
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
$sqs_objects = array('account_name' => $qsd->getQSParent(), 'assigned_user_name' => $qsd->getQSUser(), 'campaign_name' => $qsd->getQSCampaigns());
$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
$xtpl->assign("JAVASCRIPT", $quicksearch_js);
if (empty($focus->assigned_user_id) && empty($focus->id)) {
    $focus->assigned_user_id = $current_user->id;
}
if (empty($focus->assigned_name) && empty($focus->id)) {
    $focus->assigned_user_name = $current_user->user_name;
}
$xtpl->assign("ASSIGNED_USER_OPTIONS", get_select_options_with_id(get_user_array(TRUE, "Active", $focus->assigned_user_id), $focus->assigned_user_id));
$xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);
$xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id);
$xtpl->assign("REDIRECT_URL_DEFAULT", 'http://');
//required fields on Webtolead form
$campaign = new Campaign();
Example #11
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, $formName = 'ImportEditView')
 {
     require_once "include/EditView/EditView2.php";
     require_once "include/TemplateHandler/TemplateHandler.php";
     require_once 'include/QuickSearchDefaults.php';
     $qsd = QuickSearchDefaults::getQuickSearchDefaults();
     $qsd->setFormName($formName);
     global $app_strings;
     global $current_user;
     global $app_list_strings;
     $sqs_objects = array("{$formName}_parent_name" => $qsd->getQSParent());
     $smarty = new Sugar_Smarty();
     $smarty->assign("APP", $app_strings);
     $smarty->assign('formName', $formName);
     $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["{$formName}_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;
 }
Example #12
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>';
 }
Example #13
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");
 }
 function createQuickSearchCode($returnAsJavascript = true)
 {
     $sqs_objects = array();
     require_once 'include/QuickSearchDefaults.php';
     $qsd = QuickSearchDefaults::getQuickSearchDefaults();
     $qsd->setFormName($this->form_name);
     for ($i = 0; $i < $this->numFields; $i++) {
         $name1 = "{$this->form_name}_{$this->name}_collection_{$i}";
         $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 (!empty($this->user_id)) {
             $sqs_objects[$name1]['conditions'][] = array('name' => 'user_id', 'value' => $this->user_id);
         }
         if (!empty($this->customMethod)) {
             $sqs_objects[$name1]['method'] = $this->customMethod;
         }
     }
     $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 '';
 }
Example #15
0
 /**
  * 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 array $def The vardefs.php definitions
  * @param array $defs2 The Meta-Data file definitions
  * @param string $view
  * @param strign $module
  * @return string
  */
 public function createQuickSearchCode($defs, $defs2, $view = '', $module = '')
 {
     $sqs_objects = array();
     require_once 'include/QuickSearchDefaults.php';
     if (isset($this) && $this instanceof TemplateHandler) {
         $qsd = QuickSearchDefaults::getQuickSearchDefaults($this->getQSDLookup());
     } else {
         $qsd = QuickSearchDefaults::getQuickSearchDefaults(array());
     }
     $qsd->setFormName($view);
     if (preg_match('/^SearchForm_.+/', $view)) {
         if (strpos($view, 'popup_query_form')) {
             $qsd->setFormName('popup_query_form');
             $parsedView = 'advanced';
         } else {
             $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->loadQSObject('Campaigns', 'Campaign', $field['name'], $field['id_name'], $field['id_name']);
                     } 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] == 'Campaigns') {
                                 $sqs_objects[$name . '_' . $parsedView] = $qsd->loadQSObject('Campaigns', 'Campaign', $field['name'], $field['id_name'], $field['id_name']);
                             } 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
         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']];
             if ($view == "ConvertLead") {
                 $field['name'] = $module . $field['name'];
                 if (!empty($field['id_name'])) {
                     $field['id_name'] = $field['name'] . "_" . $field['id_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) && (!isset($field['id_name']) || !preg_match('/_c$/si', $field['id_name'])) && preg_match('/^(Campaigns|Teams|Users|Contacts|Accounts)$/si', $field['module'], $matches)) {
                     if ($matches[0] == 'Campaigns') {
                         $sqs_objects[$name] = $qsd->loadQSObject('Campaigns', 'Campaign', $field['name'], $field['id_name'], $field['id_name']);
                     } else {
                         if ($matches[0] == 'Users') {
                             if ($field['name'] == 'reports_to_name') {
                                 $sqs_objects[$name] = $qsd->getQSUser('reports_to_name', 'reports_to_id');
                             } else {
                                 if ($view == "ConvertLead" || $field['name'] == 'created_by_name' || $field['name'] == 'modified_by_name') {
                                     $sqs_objects[$name] = $qsd->getQSUser($field['name'], $field['id_name']);
                                 } else {
                                     $sqs_objects[$name] = $qsd->getQSUser();
                                 }
                             }
                         } else {
                             if ($matches[0] == 'Campaigns') {
                                 $sqs_objects[$name] = $qsd->loadQSObject('Campaigns', 'Campaign', $field['name'], $field['id_name'], $field['id_name']);
                             } 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 '';
 }
    $xtpl->assign('TABLECLASS', 'tabForm');
    $xtpl->assign('CLASS', 'dataLabel');
    require_once 'modules/Notes/NoteFormBase.php';
    $noteForm = new NoteFormBase();
    $postform = "<div id='contactnotelink'><p><a href='javascript:toggleDisplay(\"contactnote\");addToValidate(\"BusinessCard\", \"ContactNotesname\", \"varchar\", true,\"" . $mod_strings['LBL_NOTE_SUBJECT'] . "\");' class='tabFormLink'>{$mod_strings['LNK_NEW_NOTE']}</a></p></div>";
    $postform .= '<div id="contactnote" style="display:none">' . '<input type=hidden name=CreateContactNote value=0>' . $noteForm->getFormBody('ContactNotes', 'Notes', 'BusinessCard', 85, false) . '</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();
    $sqs_objects = array('display_account_name' => $qsd->getQSParent());
    $sqs_objects['display_account_name']['populate_list'] = array('display_account_name', 'selectedAccount');
    $quicksearch_js = $qsd->getQSScripts();
    $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 .= '<script type=\'text/javascript\' src=\'include/javascript/popup_parent_helper.js?s=' . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . '\'>' . "</script><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[\"ConvertLead\"].selectedAccount.value=\"\";document.forms[\"ConvertLead\"].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', ''));
    $xtpl->assign('FORMFOOTER', get_form_footer());
    require_once 'modules/Notes/NoteFormBase.php';
Example #17
0
 /**
  * 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 array $def The vardefs.php definitions
  * @param array $defs2 The Meta-Data file definitions
  * @param string $view
  * @param strign $module
  * @return string
  */
 public function createQuickSearchCode($defs, $defs2, $view = '', $module = '')
 {
     $sqs_objects = array();
     require_once 'include/QuickSearchDefaults.php';
     if (isset($this) && $this instanceof TemplateHandler) {
         $qsd = QuickSearchDefaults::getQuickSearchDefaults($this->getQSDLookup());
     } else {
         $qsd = QuickSearchDefaults::getQuickSearchDefaults(array());
     }
     $qsd->setFormName($view);
     if (preg_match('/^SearchForm_.+/', $view)) {
         if (strpos($view, 'popup_query_form')) {
             $qsd->setFormName('popup_query_form');
             $parsedView = 'advanced';
         } else {
             $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->loadQSObject('Campaigns', 'Campaign', $field['name'], $field['id_name'], $field['id_name']);
                     } 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] == 'Campaigns') {
                                 $sqs_objects[$name . '_' . $parsedView] = $qsd->loadQSObject('Campaigns', 'Campaign', $field['name'], $field['id_name'], $field['id_name']);
                             } 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
         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']];
             if ($view == "ConvertLead") {
                 $field['name'] = $module . $field['name'];
                 if (isset($field['module']) && isset($field['id_name']) && substr($field['id_name'], -4) == "_ida") {
                     $lc_module = strtolower($field['module']);
                     $ida_suffix = "_" . $lc_module . $lc_module . "_ida";
                     if (preg_match('/' . $ida_suffix . '$/', $field['id_name']) > 0) {
                         $field['id_name'] = $module . $field['id_name'];
                     } else {
                         $field['id_name'] = $field['name'] . "_" . $field['id_name'];
                     }
                 } else {
                     if (!empty($field['id_name'])) {
                         $field['id_name'] = $field['name'] . "_" . $field['id_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) && (!isset($field['id_name']) || !preg_match('/_c$/si', $field['id_name'])) && preg_match('/^(Campaigns|Teams|Users|Contacts|Accounts)$/si', $field['module'], $matches)) {
                     if ($matches[0] == 'Campaigns') {
                         $sqs_objects[$name] = $qsd->loadQSObject('Campaigns', 'Campaign', $field['name'], $field['id_name'], $field['id_name']);
                     } else {
                         if ($matches[0] == 'Users') {
                             if ($field['name'] == 'reports_to_name') {
                                 $sqs_objects[$name] = $qsd->getQSUser('reports_to_name', 'reports_to_id');
                                 // Bug #52994 : QuickSearch for a 1-M User relationship changes assigned to user
                             } elseif ($field['name'] == 'assigned_user_name') {
                                 $sqs_objects[$name] = $qsd->getQSUser('assigned_user_name', 'assigned_user_id');
                             } else {
                                 $sqs_objects[$name] = $qsd->getQSUser($field['name'], $field['id_name']);
                             }
                         } else {
                             if ($matches[0] == 'Campaigns') {
                                 $sqs_objects[$name] = $qsd->loadQSObject('Campaigns', 'Campaign', $field['name'], $field['id_name'], $field['id_name']);
                             } 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
             // Bug 53949 - Captivea (sve) - Partial fix : Append metadata fields that are not already included in $sqs_objects array
             // (for example with hardcoded modules before, metadata arrays are not taken into account in 6.4.x 6.5.x)
             // As QuickSearchDefault methods are called at other places, this will not fix the SQS problem for everywhere, but it fixes it on Editview
             //merge populate_list && field_list with vardef
             if (!empty($field['field_list']) && !empty($field['populate_list'])) {
                 for ($j = 0; $j < count($field['field_list']); $j++) {
                     //search for the same couple (field_list_item,populate_field_item)
                     $field_list_item = $field['field_list'][$j];
                     $field_list_item_alternate = $qsd->form_name . '_' . $field['field_list'][$j];
                     $populate_list_item = $field['populate_list'][$j];
                     $found = false;
                     for ($k = 0; $k < count($sqs_objects[$name]['field_list']); $k++) {
                         if (($field_list_item == $sqs_objects[$name]['populate_list'][$k] || $field_list_item_alternate == $sqs_objects[$name]['populate_list'][$k]) && $populate_list_item == $sqs_objects[$name]['field_list'][$k]) {
                             $found = true;
                             break;
                         }
                     }
                     if (!$found) {
                         $sqs_objects[$name]['field_list'][] = $field['populate_list'][$j];
                         // as in lines 462 and 463
                         $sqs_objects[$name]['populate_list'][] = $field['field_list'][$j];
                     }
                 }
             }
         }
         //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 '';
 }
if (isset($_REQUEST['record'])) {
    $focus->retrieve($_REQUEST['record']);
}
if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
    $focus->id = "";
}
// Prepopulate either side of the relationship if passed in.
safe_map('opportunity_name', $focus);
safe_map('opportunity_id', $focus);
safe_map('contact_name', $focus);
safe_map('contact_id', $focus);
safe_map('contact_role', $focus);
$GLOBALS['log']->info("Contact opportunity relationship");
$json = getJSONobj();
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
$sqs_objects = array('opportunity_name' => $qsd->getQSParent());
$sqs_objects['opportunity_name']['populate_list'] = array('opportunity_name', 'opportunity_id');
$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
echo $quicksearch_js;
$xtpl = new XTemplate('modules/Contacts/ContactOpportunityRelationshipEdit.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
$xtpl->assign("RETURN_URL", "&return_module={$currentModule}&return_action=DetailView&return_id={$focus->id}");
$xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
$xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
$xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
$xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']);
$xtpl->assign("ID", $focus->id);
$xtpl->assign("CONTACT", $contactName = array("NAME" => $focus->contact_name, "ID" => $focus->contact_id));
$xtpl->assign("OPPORTUNITY", $oppName = array("NAME" => $focus->opportunity_name, "ID" => $focus->opportunity_id));
 function createQuickSearchCode($returnAsJavascript = true)
 {
     $sqs_objects = array();
     require_once 'include/QuickSearchDefaults.php';
     $qsd = QuickSearchDefaults::getQuickSearchDefaults();
     $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] == 'Teams') {
                         $sqs_objects[$name1] = $qsd->getQSTeam();
                     } 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 '';
 }
$xtpl->assign('name', $focus->name);
if (isset($_REQUEST['return_module'])) {
    $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
}
if (isset($_REQUEST['return_action'])) {
    $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
}
if (isset($_REQUEST['return_id'])) {
    $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
}
// handle Create $module then Cancel
if (empty($_REQUEST['return_id'])) {
    $xtpl->assign("RETURN_ACTION", 'index');
}
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
/*$sqs_objects = array('assigned_user_name' => $qsd->getQSUser(),
	 'pub' => $qsd->getQSPub(),);*/
$quicksearch_js = $qsd->getQSScripts();
//$quicksearch_js .= '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
$xtpl->assign("JAVASCRIPT", get_set_focus_js() . get_validate_record_js() . $quicksearch_js);
$xtpl->assign("THEME", $theme);
$xtpl->assign("IMAGE_PATH", $image_path);
$xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']);
$xtpl->assign("ID", $focus->id);
$xtpl->assign("NAME", $focus->name);
$xtpl->parse("main");
$xtpl->out("main");
require_once 'include/javascript/javascript.php';
$javascript = new javascript();
$javascript->setFormName('EditView');
Example #21
0
    function getFormBody($prefix, $mod = 'Opportunities', $formname = '')
    {
        if (!ACLController::checkAccess('Opportunities', 'edit', true)) {
            return '';
        }
        if (!empty($mod)) {
            global $current_language;
            $mod_strings = return_module_language($current_language, $mod);
        } else {
            global $mod_strings;
        }
        global $app_strings;
        global $app_list_strings;
        global $theme;
        global $current_user;
        global $sugar_config;
        global $timedate;
        // Unimplemented until jscalendar language files are fixed
        // global $current_language;
        // global $default_language;
        // global $cal_codes;
        $lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
        $lbl_opportunity_name = $mod_strings['LBL_OPPORTUNITY_NAME'];
        $lbl_sales_stage = $mod_strings['LBL_SALES_STAGE'];
        $lbl_date_closed = $mod_strings['LBL_DATE_CLOSED'];
        $lbl_amount = $mod_strings['LBL_AMOUNT'];
        $ntc_date_format = $timedate->get_user_date_format();
        $cal_dateformat = $timedate->get_cal_date_format();
        $user_id = $current_user->id;
        // Unimplemented until jscalendar language files are fixed
        // $cal_lang = (empty($cal_codes[$current_language])) ? $cal_codes[$default_language] : $cal_codes[$current_language];
        $cal_lang = "en";
        $the_form = <<<EOQ
<p>
\t\t\t<input type="hidden" name="{$prefix}record" value="">
\t\t\t<input type="hidden" name="{$prefix}assigned_user_id" value='{$user_id}'>

\t\t{$lbl_opportunity_name}&nbsp;<span class="required">{$lbl_required_symbol}</span><br>
\t\t<input name='{$prefix}name' type="text" value="">
EOQ;
        if ($sugar_config['require_accounts']) {
            ///////////////////////////////////////
            ///
            /// SETUP ACCOUNT POPUP
            $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => "{$prefix}OppSave", 'field_to_name_array' => array('id' => 'account_id', 'name' => 'account_name'));
            $json = getJSONobj();
            $encoded_popup_request_data = $json->encode($popup_request_data);
            //
            ///////////////////////////////////////
            $the_form .= <<<EOQ
\t\t{$mod_strings['LBL_ACCOUNT_NAME']}&nbsp;<span class="required">{$lbl_required_symbol}</span><br>
\t\t<input class='sqsEnabled' autocomplete='off' id='qc_account_name' name='account_name' type='text' value="" size="16"><input id='qc_account_id' name='account_id' type="hidden" value=''>&nbsp;<input title="{$app_strings['LBL_SELECT_BUTTON_TITLE']}" type="button" class="button" value='{$app_strings['LBL_SELECT_BUTTON_LABEL']}' name=btn1
\t\t\tonclick='open_popup("Accounts", 600, 400, "", true, false, {$encoded_popup_request_data});' /><br>
EOQ;
        }
        $jsCalendarImage = SugarThemeRegistry::current()->getImageURL('jscalendar.gif');
        $the_form .= <<<EOQ
\t\t{$lbl_date_closed}&nbsp;<span class="required">{$lbl_required_symbol}</span> <br><span class="dateFormat">{$ntc_date_format}</span><br>
\t\t<input name='{$prefix}date_closed' size='12' maxlength='10' id='{$prefix}jscal_field' type="text" value=""> <!--not_in_theme!--><img src="{$jsCalendarImage}" alt="{$app_strings['LBL_ENTER_DATE']}"  id="jscal_trigger" align="absmiddle"><br>
\t\t{$lbl_sales_stage}&nbsp;<span class="required">{$lbl_required_symbol}</span><br>
\t\t<select name='{$prefix}sales_stage'>
EOQ;
        $the_form .= get_select_options_with_id($app_list_strings['sales_stage_dom'], "");
        $the_form .= <<<EOQ
\t\t</select><br>
\t\t{$lbl_amount}&nbsp;<span class="required">{$lbl_required_symbol}</span><br>
\t\t<input name='{$prefix}amount' type="text"></p>
\t\t<input type='hidden' name='lead_source' value=''>
\t\t<script type="text/javascript">
\t\tCalendar.setup ({
\t\t\tinputField : "{$prefix}jscal_field", daFormat : "{$cal_dateformat}", ifFormat : "{$cal_dateformat}", showsTime : false, button : "jscal_trigger", singleClick : true, step : 1, weekNumbers:false
\t\t});
\t\t</script>
EOQ;
        require_once 'include/QuickSearchDefaults.php';
        $qsd = QuickSearchDefaults::getQuickSearchDefaults();
        $sqs_objects = array('qc_account_name' => $qsd->getQSParent());
        $sqs_objects['qc_account_name']['populate_list'] = array('qc_account_name', 'qc_account_id');
        $quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
        $the_form .= $quicksearch_js;
        $javascript = new javascript();
        $javascript->setFormName($formname);
        $javascript->setSugarBean(new Opportunity());
        $javascript->addRequiredFields($prefix);
        $the_form .= $javascript->getScript();
        return $the_form;
    }
Example #22
0
    $xtpl->assign('RETURN_ACTION', $_REQUEST['return_action']);
} else {
    $xtpl->assign('RETURN_ACTION', 'DetailView');
}
if (isset($_REQUEST['return_id']) && !empty($_REQUEST['return_id'])) {
    $xtpl->assign('RETURN_ID', $_REQUEST['return_id']);
}
// handle Create $module then Cancel
if (empty($_REQUEST['return_id']) && !isset($_REQUEST['type'])) {
    $xtpl->assign('RETURN_ACTION', 'index');
}
$xtpl->assign('PRINT_URL', 'index.php?' . $GLOBALS['request_string']);
///////////////////////////////////////////////////////////////////////////////
////	QUICKSEARCH CODE
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
$sqs_objects = array('EditView_parent_name' => $qsd->getQSParent(), 'EditView_assigned_user_name' => $qsd->getQSUser());
$json = getJSONobj();
$sqs_objects_encoded = $json->encode($sqs_objects);
$quicksearch_js = <<<EOQ
\t\t<script type="text/javascript" language="javascript">sqs_objects = {$sqs_objects_encoded}; var dialog_loaded;
\t\t\tfunction parent_typechangeQS() {
\t\t\t\t//new_module = document.getElementById('parent_type').value;
\t\t\t\tnew_module = document.EditView.parent_type.value;
\t\t\t\tif(new_module == 'Contacts' || new_module == 'Leads' || typeof(disabledModules[new_module]) != 'undefined') {
\t\t\t\t\tsqs_objects['EditView_parent_name']['disable'] = true;
\t\t\t\t\tdocument.getElementById('parent_name').readOnly = true;
\t\t\t\t}
\t\t\t\telse {
\t\t\t\t\tsqs_objects['EditView_parent_name']['disable'] = false;
\t\t\t\t\tdocument.getElementById('parent_name').readOnly = false;
Example #23
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 = QuickSearchDefaults::getQuickSearchDefaults();
     $qsd->setFormName("ConvertLead");
     $this->contact = new Contact();
     /*
      * Setup filter for Account/Contact popup picker
      */
     $filter = '';
     // Check if Lead has an account set
     if (!empty($this->focus->account_name)) {
         $filter .= '&name_advanced=' . urlencode($this->focus->account_name);
     }
     // Check if Lead First name is available
     if (!empty($this->focus->first_name)) {
         $filter .= '&first_name_advanced=' . urlencode($this->focus->first_name);
     }
     // Lead Last Name is always available
     $filter .= '&last_name_advanced=' . urlencode($this->focus->last_name);
     $smarty->assign('initialFilter', $filter);
     $smarty->assign('displayParams', array('initial_filter' => '{$initialFilter}'));
     $relatedFields = $this->contact->get_related_fields();
     $selectFields = array();
     foreach ($this->defs as $moduleName => $mDefs) {
         if (!empty($mDefs[$ev->view]['select']) && !empty($relatedFields[$mDefs[$ev->view]['select']])) {
             $selectFields[$moduleName] = $mDefs[$ev->view]['select'];
             continue;
         }
         foreach ($relatedFields as $fDef) {
             if (!empty($fDef['link']) && !empty($fDef['module']) && $fDef['module'] == $moduleName) {
                 $selectFields[$moduleName] = $fDef['name'];
                 break;
             }
         }
     }
     $smarty->assign('selectFields', $selectFields);
     $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);
     global $mod_strings;
     $smarty->assign('MOD', $mod_strings);
     $smarty->display("modules/Leads/tpls/ConvertLeadHeader.tpl");
     echo "<div class='edit view' style='width:auto;'>";
     global $sugar_config, $app_list_strings, $app_strings;
     $smarty->assign('lead_conv_activity_opt', $sugar_config['lead_conv_activity_opt']);
     //Switch up list depending on copy or move
     if ($sugar_config['lead_conv_activity_opt'] == 'move') {
         $smarty->assign('convertModuleListOptions', get_select_options_with_id(array('None' => $app_strings['LBL_NONE'], 'Contacts' => $app_list_strings["moduleListSingular"]['Contacts']), ''));
     } else {
         if ($sugar_config['lead_conv_activity_opt'] == 'copy') {
             $smarty->assign('convertModuleListOptions', get_select_options_with_id(array('Contacts' => $app_list_strings["moduleListSingular"]['Contacts']), ''));
         }
     }
     foreach ($this->defs as $module => $vdef) {
         if (!isset($beanList[$module])) {
             continue;
         }
         $bean = $beanList[$module];
         $focus = new $bean();
         // skip if we aren't allowed to save this bean
         if (!$focus->ACLAccess('save')) {
             continue;
         }
         $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 (strpos($field, "billing_address") !== false && $focus->field_defs[$field]["type"] == "varchar") {
                                         $tmp_field = str_replace("billing_", "primary_", $field);
                                         $focus->field_defs[$field]["type"] = "text";
                                         if (isset($this->focus->{$tmp_field})) {
                                             $focus->{$field} = $this->focus->{$tmp_field};
                                         }
                                     } else {
                                         if (strpos($field, "shipping_address") !== false && $focus->field_defs[$field]["type"] == "varchar") {
                                             $tmp_field = str_replace("shipping_", "primary_", $field);
                                             if (isset($this->focus->{$tmp_field})) {
                                                 $focus->{$field} = $this->focus->{$tmp_field};
                                             }
                                             $focus->field_defs[$field]["type"] = "text";
                                         } 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();
     // need to re-assign bean as it gets overridden by $ev->display
     $smarty->assign("bean", $this->focus);
     $smarty->display("modules/Leads/tpls/ConvertLeadFooter.tpl");
 }
    $xtpl->assign('TABLECLASS', 'tabForm');
    $xtpl->assign('CLASS', 'dataLabel');
    require_once 'modules/Notes/NoteFormBase.php';
    $noteForm = new NoteFormBase();
    $postform = "<div id='contactnotelink'><p><a href='javascript:toggleDisplay(\"contactnote\");addToValidate(\"BusinessCard\", \"ContactNotesname\", \"varchar\", true,\"" . $mod_strings['LBL_NOTE_SUBJECT'] . "\");' class='tabFormLink'>{$mod_strings['LNK_NEW_NOTE']}</a></p></div>";
    $postform .= '<div id="contactnote" style="display:none">' . '<input type=hidden name=CreateContactNote value=0>' . $noteForm->getFormBody('ContactNotes', 'Notes', 'BusinessCard', 85, false) . '</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();
    $sqs_objects = array('display_account_name' => $qsd->getQSParent());
    $sqs_objects['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[\"ConvertLead\"].selectedAccount.value=\"\";document.forms[\"ConvertLead\"].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();
    $postform = "<div id='accountnotelink'><p><a href='javascript:toggleDisplay(\"accountnote\");'>{$mod_strings['LNK_NEW_NOTE']}</a></p></div>";
Example #25
0
if (isset($_REQUEST['return_module'])) {
    $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';
}
Example #26
0
///////////////////////////////////////////////////////////////////////////////
if ($is_current_admin) {
    $employee_status = '<select tabindex="5" name="employee_status">';
    $employee_status .= get_select_options_with_id($app_list_strings['employee_status_dom'], $focus->employee_status);
    $employee_status .= '</select>';
} else {
    $employee_status = $focus->employee_status;
}
$sugar_smarty->assign('EMPLOYEE_STATUS_OPTIONS', $employee_status);
$sugar_smarty->assign('EMPLOYEE_STATUS_OPTIONS', $employee_status);
$messenger_type = '<select tabindex="5" name="messenger_type">';
$messenger_type .= get_select_options_with_id($app_list_strings['messenger_type_dom'], $focus->messenger_type);
$messenger_type .= '</select>';
$sugar_smarty->assign('MESSENGER_TYPE_OPTIONS', $messenger_type);
$sugar_smarty->assign('MESSENGER_ID', $focus->messenger_id);
$sugar_smarty->assign('CALENDAR_PUBLISH_KEY', $focus->getPreference('calendar_publish_key'));
//$sugar_smarty->parse('main.freebusy');
$sugar_smarty->display('modules/Users/EditView.tpl');
$json = getJSONobj();
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
$sqs_objects = array('EditView_reports_to_name' => $qsd->getQSUser());
$sqs_objects['EditView_reports_to_name']['populate_list'] = array('reports_to_name', 'reports_to_id');
$quicksearch_js = '<script type="text/javascript" language="javascript">
                    sqs_objects = ' . $json->encode($sqs_objects) . '; enableQS();</script>';
echo $quicksearch_js;
$savedSearch = new SavedSearch();
$savedSearchSelects = $json->encode(array($GLOBALS['app_strings']['LBL_SAVED_SEARCH_SHORTCUT'] . '<br>' . $savedSearch->getSelect('Users')));
$str = "<script>\nYAHOO.util.Event.addListener(window, 'load', SUGAR.util.fillShortcuts, {$savedSearchSelects});\n</script>";
//echo $str;
//BUG #16298
Example #27
0
    } else {
        $cancel_script .= "'{$_REQUEST['return_id']}'";
    }
}
//Setup assigned user name
$popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'EditView', 'field_to_name_array' => array('id' => 'assigned_user_id', 'user_name' => 'assigned_user_name'));
$json = getJSONobj();
$xtpl->assign('encoded_assigned_users_popup_request_data', $json->encode($popup_request_data));
if (!empty($focus->assigned_user_name)) {
    $xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);
}
$xtpl->assign("assign_user_select", SugarThemeRegistry::current()->getImage('id-ff-select'));
$xtpl->assign("assign_user_clear", SugarThemeRegistry::current()->getImage('id-ff-clear'));
//Assign qsd script
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
$sqs_objects = array('EditView_assigned_user_name' => $qsd->getQSUser());
$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '; enableQS();</script>';
$xtpl->assign("CANCEL_SCRIPT", $cancel_script);
$xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']);
$xtpl->assign("JAVASCRIPT", get_set_focus_js() . $quicksearch_js);
if (!is_file($GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $GLOBALS['current_language'] . '.js')) {
    require_once 'include/language/jsLanguage.php';
    jsLanguage::createAppStringsCache($GLOBALS['current_language']);
}
$jsLang = '<script type="text/javascript" src="' . $GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $GLOBALS['current_language'] . '.js?s=' . $GLOBALS['sugar_version'] . '&c=' . $GLOBALS['sugar_config']['js_custom_version'] . '&j=' . $GLOBALS['sugar_config']['js_lang_version'] . '"></script>';
$xtpl->assign("JSLANG", $jsLang);
$xtpl->assign("ID", $focus->id);
if (isset($focus->name)) {
    $xtpl->assign("NAME", $focus->name);
} else {
}
if (isset($_REQUEST['return_action'])) {
    $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
}
if (isset($_REQUEST['return_id'])) {
    $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
} else {
    // if no $_REQUEST['return_id'] is set, and we press "Cancel" we get an error.
    // if RETURN_ACTION is "index", we just go back to module's default page.
    $xtpl->assign("RETURN_ACTION", "index");
}
$xtpl->assign("THEME", $theme);
$xtpl->assign("IMAGE_PATH", $image_path);
$xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']);
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
$sqs_objects = array('parent_name' => $qsd->getQSParent(), 'assigned_user_name' => $qsd->getQSUser());
$quicksearch_js = $qsd->getQSScriptsJSONAlreadyDefined();
$quicksearch_js .= '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . ';changeQS();</script>';
// change the parent type of the quicksearch
$xtpl->assign("JAVASCRIPT", get_set_focus_js() . get_validate_record_js() . $quicksearch_js);
$xtpl->assign("ID", $focus->id);
if (isset($json_id) && !empty($json_id)) {
    $xtpl->assign("JSON_ID", $json_id);
    $xtpl->assign('JSON_CONFIG_JAVASCRIPT', $json_config->get_static_json_server(false, true, 'Calls', $json_id));
} else {
    $xtpl->assign("JSON_ID", $focus->id);
    $xtpl->assign('JSON_CONFIG_JAVASCRIPT', $json_config->get_static_json_server(false, true, 'Calls', $focus->id));
}
$xtpl->assign("MODULE_NAME", "Calls");
$xtpl->assign("PARENT_NAME", $focus->parent_name);
require_once 'modules/SavedSearch/SavedSearch.php';
require_once 'include/SearchForm/SearchForm.php';
$header_text = '';
global $app_strings, $mod_strings;
global $app_list_strings;
global $current_language;
$current_module_strings = return_module_language($current_language, 'Products');
global $urlPrefix;
global $currentModule;
global $theme;
global $current_user;
// focus_list is the means of passing data to a ListView.
global $focus_list;
// setup quicksearch
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
// clear the display columns back to default when clear query is called
if (!empty($_REQUEST['clear_query']) && $_REQUEST['clear_query'] == 'true') {
    $current_user->setPreference('ListViewDisplayColumns', array(), 0, $currentModule);
}
$savedDisplayColumns = $current_user->getPreference('ListViewDisplayColumns', $currentModule);
// get user defined display columns
$json = getJSONobj();
$seedProducts = new Products();
// seed bean
$searchForm = new SearchForm('Products', $seedProducts);
// new searchform instance
// setup listview smarty
$lv = new ListViewSmarty();
$displayColumns = array();
// check $_REQUEST if new display columns from post
//require_once('include/logging.php');
require_once 'include/ListView/ListView.php';
require_once 'include/database/PearDatabase.php';
global $app_strings;
global $app_list_strings;
global $current_language;
$current_module_strings = return_module_language($current_language, 'Paper');
global $urlPrefix;
//$log = LoggerManager::getLogger('Product_list');
global $currentModule;
global $theme;
// focus_list is the means of passing data to a ListView.
global $focus_list;
//Goodwill
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
echo $qsd->getQSScripts();
//End Goodwill
if (!isset($where)) {
    $where = "";
}
$seedPaper = new Paper();
require_once 'modules/MySettings/StoreQuery.php';
$storeQuery = new StoreQuery();
/*
if(isset($_REQUEST['query_id']) && !isset($_REQUEST['saveQuery']) && !isset($_REQUEST['deleteQuery']))
{
	$storeQuery->loadFromSavedQuery($currentModule, $_REQUEST['query_id']);
}
*/
if (!isset($_REQUEST['query'])) {