Skip to content

Instantly share code, notes, and snippets.

@chadhutchins
Created April 25, 2013 13:26
Show Gist options
  • Save chadhutchins/5459669 to your computer and use it in GitHub Desktop.
Save chadhutchins/5459669 to your computer and use it in GitHub Desktop.
<?php
// ...
// CTCode Customization
// if the field name is ctc_ctcodes_accounts_name
// change the field def and field type to IN
if ($fieldName == 'ctc_ctcodes_accounts_name')
{
$fieldName = 'id';
$type = 'id';
$value = $_REQUEST['ctc_ctcodeaa1actcodes_ida'][$k];
$res = array(
'name' => 'id',
'vname' => 'LBL_ID',
'type' => 'id',
'required' => '1',
'reportable' => '1',
'comment' => 'Unique identifier',
'newField' => 'ctc_ctcodes_id'
);
$fieldDefs['ctc_ctcodes_id'] = array(
'name' => 'ctc_ctcodes_id',
'rname' => 'id',
'type' => 'relate',
'link' => 'ctc_ctcodes_accounts',
'source' => 'non-db',
'join_name' => 'ctc_ctcodes',
'es_custom_link' => ''
);
$fieldNameMap['ctc_ctcodes_id'] = array(
'name' => 'ctc_ctcodes_id',
'rname' => 'id',
'type' => 'id',
'link' => array(
'relationship' => 'accounts_ctc_ctcodes',
'module' => 'ctc_ctcodes'
),
'source' => 'non-db',
'join_name' => 'ctc_ctcodes',
'table' => 'ctc_ctcodes'
);
$searchColumns[strtoupper('ctc_ctcodes_id')] = 'ctc_ctcodes_id';
parent::$RelateFields[$k] = $value;;
}
elseif ($curModule == $module)
{
$res = $fieldDefs[$fieldName];
}
else
{
global $beanFiles, $beanList;
if (!empty($beanFiles[$beanList[$module]]))
{
$this->seed->load_relationships();
require_once($beanFiles[$beanList[$module]]);
$rel_seed = new $beanList[$module]();
$res = $rel_seed->field_defs[$fieldName];
$res['db_field'] = array($rel_seed->table_name . '.' . (@$res['db_field'] ? $res['db_field'] : $res['name']));
$res['type'] = $type;
// ...
<?php
// ...
$finalFields = array_merge($searchFieldsKeysOR, $searchFieldsKeysAND);
if ($_REQUEST['searchFormTab'] != 'basic_search' && !@$this->th->ss->_tpl_vars['esearchHideAdvanced'] && (isset($_REQUEST['entryPoint']) && $_REQUEST['entryPoint'] == 'export' || !isset($_SESSION['ESDisableAddSF']) || isset($_REQUEST['ESAddSearch']) && array_filter($_REQUEST['ESAddSearch']) || isset($_REQUEST['ESAddSearch_upperbound']) && array_filter($_REQUEST['ESAddSearch_upperbound']))) {
require_once('custom/include/AdvancedSearch/AdditionalSearchForm.php');
$_SESSION['ESDisableAddSF'] = !class_exists('AdditionalSearchForm');
if (!$_SESSION['ESDisableAddSF']) {
// CTCode Customization gets called in AdditionalSearchForm::getAdditionalParams() method
$finalFields = array_merge($finalFields, AdditionalSearchForm::getAdditionalParams($this->module, $this->seed->field_defs, $this->searchColumns, $this->seed->field_name_map, is_object($this->lv) ? $this->lv->displayColumns : array()));
}
}
foreach ($finalFields as $kf => $field) {
$arrayPerm = array();
if (is_array($field))
{
$parms = $field;
$field = $field['fieldName'];
}
else
{
// CTCode Customization
$parms = $this->searchFields[$field];
if ($field == 'ctc_ctcodeaa1actcodes_ida')
{
$parms['query_type'] = 'format';
$parms['operator'] = 'subquery';
$parms['subquery'] = 'SELECT ctc_ctcodefe1cccounts_idb FROM ctc_ctcodes_accounts_c
WHERE ctc_ctcodeaa1actcodes_ida IN ({0})';
$parms['db_field'] = array('id');
$parms['type'] = 'relate';
}
}
// CTCode Customization
if ($field == 'ctc_ctcodes_accounts_name' || $field == 'ctc_ctcodes_secondary_code' || ($field == 'ctc_ctcodeaa1actcodes_ida' && is_array(@$parms['value'])))
continue;
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment