* All Rights Reserved. * Contributor(s): ______________________________________.. ********************************************************************************/ require_once 'include/JSON.php'; global $app_strings; global $mod_strings; global $app_list_strings; global $current_language; global $currentModule; global $theme; $json = new JSON(JSON_LOOSE_TYPE); $current_module_strings = return_module_language($current_language, 'MergeRecords'); if (!isset($where)) { $where = ""; } $focus = new MergeRecord(); //////////////////////////////////////////////////////////// //get instance of master record and retrieve related record //and items //////////////////////////////////////////////////////////// $focus->merge_module = $_REQUEST['return_module']; $focus->load_merge_bean($focus->merge_module, true, $_REQUEST['record']); //get all available column fields //TO DO: add custom field handling $avail_fields = array(); $sel_fields = array(); $temp_field_array = $focus->merge_bean->field_defs; $bean_data = array(); foreach ($temp_field_array as $field_array) { if (isset($field_array['merge_filter'])) { if (strtolower($field_array['merge_filter']) == 'enabled' or strtolower($field_array['merge_filter']) == 'selected') {
* of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * SugarCRM" logo. If the display of the logo is not reasonably feasible for * technical reasons, the Appropriate Legal Notices must display the words * "Powered by SugarCRM". ********************************************************************************/ /********************************************************************************* * Description: TODO: To be written. * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. * All Rights Reserved. * Contributor(s): ______________________________________.. ********************************************************************************/ $focus = new MergeRecord(); $focus->load_merge_bean($_REQUEST['merge_module'], true, $_REQUEST['record']); foreach ($focus->merge_bean->column_fields as $field) { if (isset($_POST[$field])) { $value = $_POST[$field]; if (is_array($value) && !empty($focus->merge_bean->field_defs[$field]['isMultiSelect'])) { if (empty($value[0])) { unset($value[0]); } $value = encodeMultienumValue($value); } $focus->merge_bean->{$field} = $value; } elseif (isset($focus->merge_bean->field_name_map[$field]['type']) && $focus->merge_bean->field_name_map[$field]['type'] == 'bool') { $focus->merge_bean->{$field} = 0; } }
* Contributor(s): ______________________________________.. ********************************************************************************/ require_once 'XTemplate/xtpl.php'; require_once 'data/Tracker.php'; require_once 'modules/MergeRecords/MergeRecord.php'; require_once 'themes/' . $theme . '/layout_utils.php'; require_once 'log4php/LoggerManager.php'; require_once 'include/ListView/ListView.php'; global $app_strings; global $app_list_strings; global $current_language; global $urlPrefix; global $currentModule; global $theme; $current_module_strings = return_module_language($current_language, 'MergeRecords'); $focus = new MergeRecord(); $focus->load_merge_bean($_REQUEST['merge_module'], true, $_REQUEST['record']); echo "\n<p>\n"; echo get_module_title($mod_strings['LBL_MODULE_NAME'], $current_module_strings['LBL_STEP2_FORM_TITLE'] . ' ' . $focus->merge_bean->name, true); echo "\n</p>\n"; $focus->populate_search_params($_REQUEST); $where_clauses = array(); $where_clauses = $focus->create_where_statement(); $where = $focus->generate_where_statement($where_clauses); $ListView = new ListView(); $ListView->force_mass_update = true; $ListView->show_mass_update_form = false; $ListView->show_export_button = false; $ListView->keep_mass_update_form_open = true; $bean_list_template_path = 'modules/' . $focus->merge_bean->module_dir . '/ListView.html'; $bean_list_template_var = strtoupper($app_list_strings['moduleListSingular'][$focus->merge_module]);
function ConnectorRecord($merge_module = '', $merge_id = '') { parent::MergeRecord($merge_module, $merge_id); }
$merge_ids_array[] = $_REQUEST['record']; } elseif (isset($_REQUEST['remove']) && $_REQUEST['remove'] == '1') { $base_id = $_REQUEST['record']; $removed_id = $_REQUEST['remove_id']; foreach ($_REQUEST['merged_ids'] as $id) { if ($id != $removed_id) { $merge_ids_array[] = $id; } } } else { $base_id = $_REQUEST['record']; foreach ($_REQUEST['mass'] as $id) { $merge_ids_array[] = $id; } } $focus = new MergeRecord(); $focus->load_merge_bean($_REQUEST['merge_module'], true, $base_id); $params = array(); $params[] = "<a href='index.php?module={$focus->merge_bean->module_dir}&action=index'>{$GLOBALS['app_list_strings']['moduleList'][$focus->merge_bean->module_dir]}</a>"; $params[] = "<a href='index.php?module={$focus->merge_bean->module_dir}&action=DetailView&record={$focus->merge_bean->id}'>{$focus->merge_bean->name}</a>"; $params[] = $mod_strings['LBL_MODULE_NAME']; echo getClassicModuleTitle($focus->merge_bean->module_dir, $params, true); $mergeBeanArray = array(); $records = 1; //render a column for each record to merge $merged_ids = ''; $merge_records_names = array(); foreach ($merge_ids_array as $id) { require_once $focus->merge_bean_file_path; $mergeBeanArray[$id] = new $focus->merge_bean_class(); $mergeBeanArray[$id]->retrieve($id);
public function testgenerate_where_statement() { $mergeRecord = new MergeRecord(); $clauses = array("contacts.id='1'", "contacts.name='test'", "contacts.id !=''"); $expected = "contacts.id='1' AND contacts.name='test' AND contacts.id !=''"; $actual = $mergeRecord->generate_where_statement($clauses); $this->assertSame($expected, $actual); //error_reporting(E_ALL); }
function __construct($merge_module = '', $merge_id = '') { parent::__construct($merge_module, $merge_id); }