modules/UpgradeWizard/SugarMerge/EditViewMerge.php
\EditViewMerge
This is the base class that all other SugarMerge objects extend
Properties
BOOLEAN
$bestMatch= 'true'
If we should use the best match algorithim
true
Details- Type
- BOOLEAN
ARRAY
$customData= 'array()'
this will store the meta data for the custom file
array()
Details- Type
- ARRAY
ARRAY
$customFields= 'array()'
this will store an associative array contianing all the fields that are used in the custom meta data file
array()
Details- Type
- ARRAY
$customPanelIds= 'array()'
The ids of the panels found in custom metadata fuke
array()
Details- Type
- n/a
STRING
$defaultPanel= ''default''
The default panel we place the fields in if we aren't using the best match algorithim
'default'
Details- Type
- STRING
$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
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'),
)
Details- Type
- n/a
\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
NULL
Details- Type
- \FILEPOINTER
BOOLEAN
$isMultiPanel= 'true'
If true then it works as though it's a multipanel
true
Details- Type
- BOOLEAN
ARRAY
$mergedFields= 'array()'
this will store an associative array contianing all the merged fields
array()
Details- Type
- ARRAY
STRING
$module= ''module''
the name of the module to be merged
'module'
Details- Type
- STRING
ARRAY
$newData= 'array()'
this will store the meta data for the new file
array()
Details- Type
- ARRAY
ARRAY
$newFields= 'array()'
this will store an associative array contianing all the fields that are used in the new meta data file
array()
Details- Type
- ARRAY
$newPanelIds= 'array()'
The ids of the panels found in original metadata fuke
array()
Details- Type
- n/a
ARRAY
$originalData= 'array()'
this will store the meta data for the original file
array()
Details- Type
- ARRAY
ARRAY
$originalFields= 'array()'
this will store an associative array contianing all the fields that are used in the original meta data file
array()
Details- Type
- ARRAY
$originalPanelIds= 'array()'
The ids of the panels found in original metadata fuke
array()
Details- Type
- n/a
STRING
$panelName= ''panels''
The name of the panels section in the meta data
'panels'
Details- Type
- STRING
\unknown_type
$scanForMultiPanel= 'true'
Determines if getFields should analyze panels to determine if it is a MultiPanel
true
Details- Type
- \unknown_type
$templateMetaName= ''templateMeta''
The name of the templateMeta data secion in the meta data
'templateMeta'
Details- Type
- n/a
STRING
$varName= ''viewdefs''
The variable name that is used with the file for example in editviewdefs and detailviewdefs it is $viewdefs
'viewdefs'
Details- Type
- STRING
Methods
areMatchingValues(
\MULTI $val1, \MULTI $val2
)
:
BOOLEAN
returns true if $val1 and $val2 match otherwise it returns false
Name | Type | Description |
---|---|---|
$val1 | \MULTI |
|
$val2 | \MULTI |
|
Type | Description |
---|---|
BOOLEAN | - if $val1 and $val2 match |
arrayMerge(
ARRAY $gimp, ARRAY $dom
)
:
ARRAY
Recursiveley merges two arrays
Name | Type | Description |
---|---|---|
$gimp | ARRAY |
|
$dom | ARRAY |
|
Type | Description |
---|---|
ARRAY | $merged - the merges array |
buildPanels(
)
:
ARRAY
Walks through the merged fields and places them in the appropriate place based on their location parameter as well as the choosen algorithim
Type | Description |
---|---|
ARRAY | $panels - the new panels section for the merged file |
getData(
)
:
ARRAY
This will return the meta data of the merged file
Type | Description |
---|---|
ARRAY | - the meta data of the merged file |
getFields(
ARRAY $panels
)
:
ARRAY
This 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
Name | Type | Description |
---|---|---|
$panels | ARRAY |
|
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
)
:
void
Loads the meta data of the original, new, and custom file into the variables originalData, newData, and customData respectively
Name | Type | Description |
---|---|---|
$module | STRING |
|
$original_file | STRING |
|
$new_file | STRING |
|
$custom_file | STRING |
|
log(
\MULTI $message
)
:
void
Logs 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
Name | Type | Description |
---|---|---|
$message | \MULTI |
merge(
STRING $module, STRING $original_file, STRING $new_file, STRING $custom_file
=
false, BOOLEAN $save
=
true
)
:
BOOLEAN
public 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
Merges the meta data of a single field
Name | Type | Description |
---|---|---|
$orig | ARRAY |
|
$new | ARRAY |
|
$custom | ARRAY |
|
Type | Description |
---|---|
ARRAY | $merged - the merged meta-data |
mergeMetaData(
)
:
void
Parses out the fields for each files meta data and then calls on mergeFields and setPanels
mergeTemplateMeta(
)
:
void
Merge 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
)
:
BOOLEAN
This 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
)
:
void
Allows the user to choose to use the best match algorithim or not
Name | Type | Description |
---|---|---|
$on | BOOLEAN |
setDefaultPanel(
STRING $name
=
'default'
)
:
void
Allows users to set the name to use as the default panel in the meta data
Name | Type | Description |
---|---|---|
$name | STRING |
|
setLogFile(
STRING $file
)
:
void
opens the file with the 'a' parameter and use it to log messages to
Name | Type | Description |
---|---|---|
$file | STRING |
|
setLogFilePointer(
\FILEPOINTER $fp
)
:
void
Allows the user to set a filepointer that is already open to log to
Name | Type | Description |
---|---|---|
$fp | \FILEPOINTER |