modules/UpgradeWizard/SugarMerge/SearchMerge.php
\SearchMerge
SearchMerge is a class for merging search meta data together. This search meta-data has a listing of fields similar to ListViews
- Parent(s)
- \ListViewMerge < \EditViewMerge
Properties

BOOLEAN
$bestMatch= 'true'
If we should use the best match algorithim
Inherited from: \EditViewMerge::$$bestMatch\ListViewMerge::$$bestMatchtrueDetails- Type
- BOOLEAN
- Inherited_from
- \EditViewMerge::$$bestMatch
- Inherited_from
- \ListViewMerge::$$bestMatch

ARRAY
$customData= 'array()'
this will store the meta data for the custom file
Inherited from: \EditViewMerge::$$customData\ListViewMerge::$$customDataarray()Details- Type
- ARRAY
- Inherited_from
- \EditViewMerge::$$customData
- Inherited_from
- \ListViewMerge::$$customData

ARRAY
$customFields= 'array()'
this will store an associative array contianing all the fields that are used in the custom meta data file
Inherited from: \EditViewMerge::$$customFields\ListViewMerge::$$customFieldsarray()Details- Type
- ARRAY
- Inherited_from
- \EditViewMerge::$$customFields
- Inherited_from
- \ListViewMerge::$$customFields

$customPanelIds= 'array()'
The ids of the panels found in custom metadata fuke
Inherited from: \EditViewMerge::$$customPanelIds\ListViewMerge::$$customPanelIdsarray()Details- Type
- n/a
- Inherited_from
- \EditViewMerge::$$customPanelIds
- Inherited_from
- \ListViewMerge::$$customPanelIds

STRING
$defaultPanel= ''default''
The default panel we place the fields in if we aren't using the best match algorithim
Inherited from: \EditViewMerge::$$defaultPanel\ListViewMerge::$$defaultPanel'default'Details- Type
- STRING
- Inherited_from
- \EditViewMerge::$$defaultPanel
- Inherited_from
- \ListViewMerge::$$defaultPanel

$fieldConversionMapping= 'array(
'Campaigns' => array('created_by_name'=>'date_entered', 'modified_by_name'=>'date_modified'),
'Cases' => array('created_by_name'=>'date_entered', 'modified_by_name'=>'date_modified'),
'Contracts' => array('created_by_name'=>'date_entered', 'modified_by_name'=>'date_modified'),
'Leads' => array('created_by'=>'date_entered'),
'Meetings' => array('created_by_name'=>'date_entered', 'modified_by_name'=>'date_modified'),
'ProspectLists' => array('created_by_name'=>'date_entered', 'modified_by_name'=>'date_modified'),
'Prospects' => array('created_by_name'=>'date_entered', 'modified_by_name'=>'date_modified'),
)'
Special case conversion
Inherited from: \EditViewMerge::$$fieldConversionMapping\ListViewMerge::$$fieldConversionMappingarray(
'Campaigns' => array('created_by_name'=>'date_entered', 'modified_by_name'=>'date_modified'),
'Cases' => array('created_by_name'=>'date_entered', 'modified_by_name'=>'date_modified'),
'Contracts' => array('created_by_name'=>'date_entered', 'modified_by_name'=>'date_modified'),
'Leads' => array('created_by'=>'date_entered'),
'Meetings' => array('created_by_name'=>'date_entered', 'modified_by_name'=>'date_modified'),
'ProspectLists' => array('created_by_name'=>'date_entered', 'modified_by_name'=>'date_modified'),
'Prospects' => array('created_by_name'=>'date_entered', 'modified_by_name'=>'date_modified'),
)Details- Type
- n/a
- Inherited_from
- \EditViewMerge::$$fieldConversionMapping
- Inherited_from
- \ListViewMerge::$$fieldConversionMapping

\FILEPOINTER
$fp= 'NULL'
The file pointer to log to if set to NULL it will use the GLOBALS['log'] if available and log to debug
Inherited from: \EditViewMerge::$$fp\ListViewMerge::$$fpNULLDetails- Type
- \FILEPOINTER
- Inherited_from
- \EditViewMerge::$$fp
- Inherited_from
- \ListViewMerge::$$fp

BOOLEAN
$isMultiPanel= 'true'
If true then it works as though it's a multipanel
Inherited from: \EditViewMerge::$$isMultiPanel\ListViewMerge::$$isMultiPaneltrueDetails- Type
- BOOLEAN
- Inherited_from
- \EditViewMerge::$$isMultiPanel
- Inherited_from
- \ListViewMerge::$$isMultiPanel

INT
$maxCols= '2'
the max number of columns for this view
Inherited from: \EditViewMerge::$$maxCols\ListViewMerge::$$maxCols2Details- Type
- INT
- Inherited_from
- \EditViewMerge::$$maxCols
- Inherited_from
- \ListViewMerge::$$maxCols

ARRAY
$mergedFields= 'array()'
this will store an associative array contianing all the merged fields
Inherited from: \EditViewMerge::$$mergedFields\ListViewMerge::$$mergedFieldsarray()Details- Type
- ARRAY
- Inherited_from
- \EditViewMerge::$$mergedFields
- Inherited_from
- \ListViewMerge::$$mergedFields

STRING
$module= ''module''
the name of the module to be merged
Inherited from: \EditViewMerge::$$module\ListViewMerge::$$module'module'Details- Type
- STRING
- Inherited_from
- \EditViewMerge::$$module
- Inherited_from
- \ListViewMerge::$$module

ARRAY
$newData= 'array()'
this will store the meta data for the new file
Inherited from: \EditViewMerge::$$newData\ListViewMerge::$$newDataarray()Details- Type
- ARRAY
- Inherited_from
- \EditViewMerge::$$newData
- Inherited_from
- \ListViewMerge::$$newData

ARRAY
$newFields= 'array()'
this will store an associative array contianing all the fields that are used in the new meta data file
Inherited from: \EditViewMerge::$$newFields\ListViewMerge::$$newFieldsarray()Details- Type
- ARRAY
- Inherited_from
- \EditViewMerge::$$newFields
- Inherited_from
- \ListViewMerge::$$newFields

$newPanelIds= 'array()'
The ids of the panels found in original metadata fuke
Inherited from: \EditViewMerge::$$newPanelIds\ListViewMerge::$$newPanelIdsarray()Details- Type
- n/a
- Inherited_from
- \EditViewMerge::$$newPanelIds
- Inherited_from
- \ListViewMerge::$$newPanelIds

ARRAY
$originalData= 'array()'
this will store the meta data for the original file
Inherited from: \EditViewMerge::$$originalData\ListViewMerge::$$originalDataarray()Details- Type
- ARRAY
- Inherited_from
- \EditViewMerge::$$originalData
- Inherited_from
- \ListViewMerge::$$originalData

ARRAY
$originalFields= 'array()'
this will store an associative array contianing all the fields that are used in the original meta data file
Inherited from: \EditViewMerge::$$originalFields\ListViewMerge::$$originalFieldsarray()Details- Type
- ARRAY
- Inherited_from
- \EditViewMerge::$$originalFields
- Inherited_from
- \ListViewMerge::$$originalFields

$originalPanelIds= 'array()'
The ids of the panels found in original metadata fuke
Inherited from: \EditViewMerge::$$originalPanelIds\ListViewMerge::$$originalPanelIdsarray()Details- Type
- n/a
- Inherited_from
- \EditViewMerge::$$originalPanelIds
- Inherited_from
- \ListViewMerge::$$originalPanelIds

STRING
$panelName= ''layout''
The name of the panels section in the meta data
'layout'Details- Type
- STRING

\unknown_type
$scanForMultiPanel= 'true'
Determines if getFields should analyze panels to determine if it is a MultiPanel
Inherited from: \EditViewMerge::$$scanForMultiPanel\ListViewMerge::$$scanForMultiPaneltrueDetails- Type
- \unknown_type
- Inherited_from
- \EditViewMerge::$$scanForMultiPanel
- Inherited_from
- \ListViewMerge::$$scanForMultiPanel

$templateMetaName= ''templateMeta''
The name of the templateMeta data secion in the meta data
Inherited from: \EditViewMerge::$$templateMetaName\ListViewMerge::$$templateMetaName'templateMeta'Details- Type
- n/a
- Inherited_from
- \EditViewMerge::$$templateMetaName
- Inherited_from
- \ListViewMerge::$$templateMetaName

STRING
$varName= ''searchdefs''
The variable name that is used with the file for example in editviewdefs and detailviewdefs it is $viewdefs
'searchdefs'Details- Type
- STRING
Methods

areMatchingValues(
\MULTI $val1, \MULTI $val2
)
:
BOOLEANreturns true if $val1 and $val2 match otherwise it returns false
Inherited from: \EditViewMerge::areMatchingValues()\ListViewMerge::areMatchingValues()| Name | Type | Description |
|---|---|---|
| $val1 | \MULTI |
|
| $val2 | \MULTI |
|
| Type | Description |
|---|---|
| BOOLEAN | - if $val1 and $val2 match |

arrayMerge(
ARRAY $gimp, ARRAY $dom
)
:
ARRAYRecursiveley merges two arrays
Inherited from: \EditViewMerge::arrayMerge()\ListViewMerge::arrayMerge()| Name | Type | Description |
|---|---|---|
| $gimp | ARRAY |
|
| $dom | ARRAY |
|
| Type | Description |
|---|---|
| ARRAY | $merged - the merges array |

buildPanels(
)
:
ARRAYThis builds the array of fields from the merged fields in the right order when building the panels for a list view the most important thing is order so we ensure the fields that came from the custom file keep their order then we add any new fields at the end
| Type | Description |
|---|---|
| ARRAY |

clear(
)
:
voidClears out the values of the arrays so that the same object can be utilized
Inherited from: \EditViewMerge::clear()\ListViewMerge::clear()
getData(
)
:
ARRAYThis will return the meta data of the merged file
Inherited from: \EditViewMerge::getData()\ListViewMerge::getData()| Type | Description |
|---|---|
| ARRAY | - the meta data of the merged file |

getFields(
ARRAY $panels, $multiple
=
true
)
:
ARRAYThis takes in a list of panels and returns an associative array of field names to the meta-data of the field as well as the locations of that field Since searchdefs have the concept of basic and advanced those act as panels for merging
| Name | Type | Description |
|---|---|---|
| $panels | ARRAY |
|
| $multiple |
| Type | Description |
|---|---|
| ARRAY | $fields - an associate array of fields and their meta-data as well as their location |

loadData(
STRING $module, STRING $original_file, STRING $new_file, STRING $custom_file
)
:
voidLoads the meta data of the original, new, and custom file into the variables originalData, newData, and customData respectively it then transforms them into a structure that EditView Merge would understand
| Name | Type | Description |
|---|---|---|
| $module | STRING |
|
| $original_file | STRING |
|
| $new_file | STRING |
|
| $custom_file | STRING |
|

log(
\MULTI $message
)
:
voidLogs the given message if the message is not a string it will export it first. If $this->fp is NULL then it will try to log to the $GLOBALS['log'] if it is available
Inherited from: \EditViewMerge::log()\ListViewMerge::log()| Name | Type | Description |
|---|---|---|
| $message | \MULTI |

merge(
STRING $module, STRING $original_file, STRING $new_file, STRING $custom_file
=
false, BOOLEAN $save
=
true
)
:
BOOLEANpublic function that will merge meta data from an original sugar file that shipped with the product, a customized file, and a new file shipped with an upgrade
| Name | Type | Description |
|---|---|---|
| $module | STRING |
|
| $original_file | STRING |
|
| $new_file | STRING |
|
| $custom_file | STRING |
|
| $save | BOOLEAN |
|
| Type | Description |
|---|---|
| BOOLEAN | - if the merged file was saved if false is passed in for the save parameter it always returns true |

mergeField(
ARRAY $orig, ARRAY $new, ARRAY $custom
)
:
ARRAY
| Name | Type | Description |
|---|---|---|
| $orig | ARRAY |
|
| $new | ARRAY |
|
| $custom | ARRAY |
|
| Type | Description |
|---|---|
| ARRAY | $merged - the merged meta-data |

mergeFields(
)
:
voidMerges the fields together and stores them in $this->mergedFields
Inherited from: \ListViewMerge::mergeFields()
mergeMetaData(
)
:
voidParses out the fields for each files meta data and then calls on mergeFields and setPanels
Inherited from: \EditViewMerge::mergeMetaData()\ListViewMerge::mergeMetaData()
mergeTemplateMeta(
)
:
voidMerge the templateMeta entry for the view defs. Also assume that any changes made in the custom files should have precedence since they must be changed manually, even over new files that may be provided in the upgarde patch.

save(
STRING $to
)
:
BOOLEANThis will save the merged data to a file
| Name | Type | Description |
|---|---|---|
| $to | STRING |
|
| Type | Description |
|---|---|
| BOOLEAN | - success or failure of the save |

setBestMatch(
BOOLEAN $on
=
true
)
:
voidAllows the user to choose to use the best match algorithim or not
Inherited from: \EditViewMerge::setBestMatch()\ListViewMerge::setBestMatch()| Name | Type | Description |
|---|---|---|
| $on | BOOLEAN |

setDefaultPanel(
STRING $name
=
'default'
)
:
voidAllows users to set the name to use as the default panel in the meta data
Inherited from: \EditViewMerge::setDefaultPanel()\ListViewMerge::setDefaultPanel()| Name | Type | Description |
|---|---|---|
| $name | STRING |
|

setLogFile(
STRING $file
)
:
voidopens the file with the 'a' parameter and use it to log messages to
Inherited from: \EditViewMerge::setLogFile()\ListViewMerge::setLogFile()| Name | Type | Description |
|---|---|---|
| $file | STRING |
|

setLogFilePointer(
\FILEPOINTER $fp
)
:
voidAllows the user to set a filepointer that is already open to log to
Inherited from: \EditViewMerge::setLogFilePointer()\ListViewMerge::setLogFilePointer()| Name | Type | Description |
|---|---|---|
| $fp | \FILEPOINTER |