mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-09-12 23:23:49 +08:00
Merge next into suite 8
Merge commit 'de4bf25cb3
' into release/8.4.0-beta
# Conflicts:
# public/legacy/data/SugarBean.php
# public/legacy/include/Smarty/plugins/function.sugarvar.php
# public/legacy/include/SugarDateTime.php
# public/legacy/include/database/MysqliManager.php
# public/legacy/modules/Alerts/metadata/listviewdefs.php
# public/legacy/modules/SugarFeed/Dashlets/SugarFeedDashlet/SugarFeedDashlet.php
# public/legacy/modules/Trackers/metadata/SearchFields.php
# public/legacy/modules/Trackers/metadata/listviewdefs.php
# public/legacy/modules/UpgradeWizard/SugarMerge/EditViewMerge.php
# public/legacy/suitecrm_version.php
This commit is contained in:
commit
5aa0daf046
1656 changed files with 8616 additions and 6081 deletions
|
@ -88,6 +88,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
|
||||
require_once('include/parsecsv.lib.php');
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class CsvAutoDetect
|
||||
{
|
||||
protected $_parser = null;
|
||||
|
@ -166,13 +167,13 @@ class CsvAutoDetect
|
|||
$depth = 1;
|
||||
$enclosure = "\"";
|
||||
$delimiter1 = $this->_parser->auto($this->_csv_file, true, null, null, $enclosure);
|
||||
if (strlen($delimiter1) == 1) { // this means parsing ok
|
||||
if (strlen((string) $delimiter1) == 1) { // this means parsing ok
|
||||
$doubleQuoteParsedOK = true;
|
||||
// sometimes it parses ok with either single quote or double quote as enclosure
|
||||
// so we need to make sure the data do not begin and end with the other enclosure
|
||||
foreach ($this->_parser->data as &$row) {
|
||||
foreach ($row as &$data) {
|
||||
$len = strlen($data);
|
||||
$len = strlen((string) $data);
|
||||
// check if it begins and ends with single quotes
|
||||
// if it does, then it double quotes may not be the enclosure
|
||||
if ($len>=2 && $data[0] == "'" && $data[$len-1] == "'") {
|
||||
|
@ -199,11 +200,11 @@ class CsvAutoDetect
|
|||
$depth = 1;
|
||||
$enclosure = "'";
|
||||
$delimiter2 = $this->_parser->auto($this->_csv_file, true, null, null, $enclosure);
|
||||
if (strlen($delimiter2) == 1) { // this means parsing ok
|
||||
if (strlen((string) $delimiter2) == 1) { // this means parsing ok
|
||||
$singleQuoteParsedOK = true;
|
||||
foreach ($this->_parser->data as &$row) {
|
||||
foreach ($row as &$data) {
|
||||
$len = strlen($data);
|
||||
$len = strlen((string) $data);
|
||||
// check if it begins and ends with double quotes
|
||||
// if it does, then it single quotes may not be the enclosure
|
||||
if ($len>=2 && $data[0] == "\"" && $data[$len-1] == "\"") {
|
||||
|
@ -265,7 +266,7 @@ class CsvAutoDetect
|
|||
return false;
|
||||
}
|
||||
|
||||
$total_count = count($this->_parser->data[0]);
|
||||
$total_count = is_countable($this->_parser->data[0]) ? count($this->_parser->data[0]) : 0;
|
||||
if ($total_count == 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -301,13 +302,13 @@ class CsvAutoDetect
|
|||
// check if the CSV item is part of the label or vice versa
|
||||
else {
|
||||
if (isset($defs['vname']) && isset($mod_strings[$defs['vname']])) {
|
||||
if (stripos(trim($mod_strings[$defs['vname']], ':'), $val) !== false || stripos($val, trim($mod_strings[$defs['vname']], ':')) !== false) {
|
||||
if (stripos(trim($mod_strings[$defs['vname']], ':'), (string) $val) !== false || stripos((string) $val, trim($mod_strings[$defs['vname']], ':')) !== false) {
|
||||
$match_count++;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (isset($defs['vname']) && isset($GLOBALS['app_strings'][$defs['vname']])) {
|
||||
if (stripos(trim($GLOBALS['app_strings'][$defs['vname']], ':'), $val) !== false || stripos($val, trim($GLOBALS['app_strings'][$defs['vname']], ':')) !== false) {
|
||||
if (stripos(trim($GLOBALS['app_strings'][$defs['vname']], ':'), (string) $val) !== false || stripos((string) $val, trim($GLOBALS['app_strings'][$defs['vname']], ':')) !== false) {
|
||||
$match_count++;
|
||||
break;
|
||||
}
|
||||
|
@ -346,7 +347,7 @@ class CsvAutoDetect
|
|||
foreach ($this->_parser->data as $row) {
|
||||
foreach ($row as $val) {
|
||||
foreach ($formats as $format=>$regex) {
|
||||
$ret = preg_match($regex, $val);
|
||||
$ret = preg_match($regex, (string) $val);
|
||||
if ($ret) {
|
||||
return $format;
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ function getControl(
|
|||
$contents = $sfh->displaySmarty('fields', $vardef, 'ImportView', $displayParams);
|
||||
|
||||
// Remove all the copyright comments
|
||||
$contents = preg_replace('/\{\*[^\}]*?\*\}/', '', $contents);
|
||||
$contents = preg_replace('/\{\*[^\}]*?\*\}/', '', (string) $contents);
|
||||
|
||||
// hack to disable one of the js calls in this control
|
||||
if (isset($vardef['function'])
|
||||
|
@ -138,10 +138,10 @@ function getControl(
|
|||
$ss->assign('TIME_FORMAT', $time_format);
|
||||
$time_separator = ":";
|
||||
$match = array();
|
||||
if (preg_match('/\d+([^\d])\d+([^\d]*)/s', $time_format, $match)) {
|
||||
if (preg_match('/\d+([^\d])\d+([^\d]*)/s', (string) $time_format, $match)) {
|
||||
$time_separator = $match[1];
|
||||
}
|
||||
$t23 = strpos($time_format, '23') !== false ? '%H' : '%I';
|
||||
$t23 = strpos((string) $time_format, '23') !== false ? '%H' : '%I';
|
||||
if (!isset($match[2]) || $match[2] == '') {
|
||||
$ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M");
|
||||
} else {
|
||||
|
@ -186,8 +186,8 @@ function getControl(
|
|||
}
|
||||
$value = $function($focus, $fieldname, $value, 'EditView');
|
||||
// Bug 22730 - add a hack for the currency type dropdown, since it's built by a function.
|
||||
if (preg_match('/getCurrency.*DropDown/s', $function)) {
|
||||
$value = str_ireplace('</select>', '<option value="">'.$app_strings['LBL_NONE'].'</option></select>', $value);
|
||||
if (preg_match('/getCurrency.*DropDown/s', (string) $function)) {
|
||||
$value = str_ireplace('</select>', '<option value="">'.$app_strings['LBL_NONE'].'</option></select>', (string) $value);
|
||||
}
|
||||
} elseif ($fieldname == 'assigned_user_name' && empty($value)) {
|
||||
$fieldlist['assigned_user_id']['value'] = $GLOBALS['current_user']->id;
|
||||
|
|
|
@ -50,18 +50,19 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportCacheFiles
|
||||
{
|
||||
/**#@+
|
||||
* Cache file names
|
||||
*/
|
||||
const FILE_MISCELLANEOUS = 'misc';
|
||||
const FILE_DUPLICATES = 'dupes';
|
||||
const FILE_DUPLICATES_DISPLAY = 'dupesdisplay';
|
||||
const FILE_ERRORS = 'error';
|
||||
const FILE_ERROR_RECORDS = 'errorrecords';
|
||||
const FILE_ERROR_RECORDS_ONLY = 'errorrecordsonly';
|
||||
const FILE_STATUS = 'status';
|
||||
public const FILE_MISCELLANEOUS = 'misc';
|
||||
public const FILE_DUPLICATES = 'dupes';
|
||||
public const FILE_DUPLICATES_DISPLAY = 'dupesdisplay';
|
||||
public const FILE_ERRORS = 'error';
|
||||
public const FILE_ERROR_RECORDS = 'errorrecords';
|
||||
public const FILE_ERROR_RECORDS_ONLY = 'errorrecordsonly';
|
||||
public const FILE_STATUS = 'status';
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -49,6 +49,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportDuplicateCheck
|
||||
{
|
||||
/**
|
||||
|
@ -160,11 +161,11 @@ class ImportDuplicateCheck
|
|||
if ($tmpField == 'deleted') {
|
||||
continue;
|
||||
}
|
||||
if (strlen($this->_focus->$tmpField) > 0) {
|
||||
if (strlen((string) $this->_focus->$tmpField) > 0) {
|
||||
$index_fields[$tmpField] = $this->_focus->$tmpField;
|
||||
}
|
||||
}
|
||||
} elseif ($field != 'deleted' && strlen($this->_focus->$field) > 0) {
|
||||
} elseif ($field != 'deleted' && strlen((string) $this->_focus->$field) > 0) {
|
||||
$index_fields[$field] = $this->_focus->$field;
|
||||
}
|
||||
|
||||
|
@ -276,7 +277,7 @@ class ImportDuplicateCheck
|
|||
continue;
|
||||
}
|
||||
if (!in_array($field, $index_fields)) {
|
||||
if (isset($this->_focus->$field) && strlen($this->_focus->$field) > 0) {
|
||||
if (isset($this->_focus->$field) && strlen((string) $this->_focus->$field) > 0) {
|
||||
$index_fields[$field] = $this->_focus->$field;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
*/
|
||||
require_once('modules/Import/sources/ImportFile.php');
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportFieldSanitize
|
||||
{
|
||||
/**
|
||||
|
@ -167,7 +168,7 @@ class ImportFieldSanitize
|
|||
$sea = new SugarEmailAddress;
|
||||
}
|
||||
|
||||
if (!empty($value) && !preg_match($sea->regex, $value)) {
|
||||
if (!empty($value) && !preg_match($sea->regex, (string) $value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -279,7 +280,7 @@ class ImportFieldSanitize
|
|||
|
||||
$dateparts = array();
|
||||
$reg = $timedate->get_regular_expression($format);
|
||||
preg_match('@'.$reg['format'].'@', $value, $dateparts);
|
||||
preg_match('@'.$reg['format'].'@', (string) $value, $dateparts);
|
||||
|
||||
if (empty($dateparts)) {
|
||||
return false;
|
||||
|
|
|
@ -49,6 +49,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportFileSplitter
|
||||
{
|
||||
/**
|
||||
|
@ -148,7 +149,7 @@ class ImportFileSplitter
|
|||
$enclosure = trim($enclosure);
|
||||
if (!empty($enclosure)) {
|
||||
foreach ($row as $key => $v) {
|
||||
$row[$key] = str_replace($enclosure, $enclosure.$enclosure, $v);
|
||||
$row[$key] = str_replace($enclosure, $enclosure.$enclosure, (string) $v);
|
||||
}
|
||||
}
|
||||
$line = $enclosure.implode($enclosure.$delimiter.$enclosure, $row).$enclosure.PHP_EOL;
|
||||
|
|
|
@ -48,6 +48,7 @@ require_once('modules/Import/ImportFieldSanitize.php');
|
|||
require_once('modules/Import/ImportDuplicateCheck.php');
|
||||
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class Importer
|
||||
{
|
||||
/**
|
||||
|
@ -230,7 +231,7 @@ class Importer
|
|||
|
||||
// Handle email field, if it's a semi-colon separated export
|
||||
if ($field == 'email_addresses_non_primary' && !empty($rowValue)) {
|
||||
if (strpos($rowValue, ';') !== false) {
|
||||
if (strpos((string) $rowValue, ';') !== false) {
|
||||
$rowValue = explode(';', $rowValue);
|
||||
} else {
|
||||
$rowValue = array($rowValue);
|
||||
|
@ -327,7 +328,7 @@ class Importer
|
|||
|
||||
// check to see that the indexes being entered are unique.
|
||||
if (isset($_REQUEST['enabled_dupes']) && $_REQUEST['enabled_dupes'] != "") {
|
||||
$toDecode = html_entity_decode($_REQUEST['enabled_dupes'], ENT_QUOTES);
|
||||
$toDecode = html_entity_decode((string) $_REQUEST['enabled_dupes'], ENT_QUOTES);
|
||||
$enabled_dupes = json_decode($toDecode);
|
||||
$idc = new ImportDuplicateCheck($focus);
|
||||
|
||||
|
@ -339,7 +340,7 @@ class Importer
|
|||
}
|
||||
//Allow fields to be passed in for dup check as well (used by external adapters)
|
||||
elseif (!empty($_REQUEST['enabled_dup_fields'])) {
|
||||
$toDecode = html_entity_decode($_REQUEST['enabled_dup_fields'], ENT_QUOTES);
|
||||
$toDecode = html_entity_decode((string) $_REQUEST['enabled_dup_fields'], ENT_QUOTES);
|
||||
$enabled_dup_fields = json_decode($toDecode);
|
||||
$idc = new ImportDuplicateCheck($focus);
|
||||
if ($idc->isADuplicateRecordByFields($enabled_dup_fields)) {
|
||||
|
@ -356,8 +357,7 @@ class Importer
|
|||
|
||||
// check if it already exists
|
||||
$query = "SELECT * FROM {$focus->table_name} WHERE id='".$focus->db->quote($focus->id)."'";
|
||||
$result = $focus->db->query($query)
|
||||
or sugar_die("Error selecting sugarbean: ");
|
||||
($result = $focus->db->query($query)) || sugar_die("Error selecting sugarbean: ");
|
||||
|
||||
$dbrow = $focus->db->fetchByAssoc($result);
|
||||
|
||||
|
@ -480,7 +480,7 @@ class Importer
|
|||
global $mod_strings;
|
||||
|
||||
$query2 = "DELETE FROM {$focus->table_name} WHERE id='".$focus->db->quote($focus->id)."'";
|
||||
$result2 = $focus->db->query($query2) or sugar_die($mod_strings['LBL_ERROR_DELETING_RECORD']." ".$focus->id);
|
||||
($result2 = $focus->db->query($query2)) || sugar_die($mod_strings['LBL_ERROR_DELETING_RECORD']." ".$focus->id);
|
||||
if ($focus->hasCustomFields()) {
|
||||
$query3 = "DELETE FROM {$focus->table_name}_cstm WHERE id_c='".$focus->db->quote($focus->id)."'";
|
||||
$result2 = $focus->db->query($query3);
|
||||
|
@ -510,7 +510,7 @@ class Importer
|
|||
if (!empty($focus->date_entered)) {
|
||||
$focus->update_date_entered = true;
|
||||
}
|
||||
|
||||
|
||||
$focus->optimistic_lock = false;
|
||||
if ($focus->object_name == "Contact" && isset($focus->sync_contact)) {
|
||||
//copy the potential sync list to another varible
|
||||
|
@ -536,16 +536,16 @@ class Importer
|
|||
// Bug51192: check if there are any changes in the imported data
|
||||
$hasDataChanges = false;
|
||||
$dataChanges=$focus->db->getAuditDataChanges($focus);
|
||||
|
||||
|
||||
if (!empty($dataChanges)) {
|
||||
foreach ($dataChanges as $field=>$fieldData) {
|
||||
if ($fieldData['data_type'] != 'date' || strtotime($fieldData['before']) != strtotime($fieldData['after'])) {
|
||||
if ($fieldData['data_type'] != 'date' || strtotime($fieldData['before']) !== strtotime($fieldData['after'])) {
|
||||
$hasDataChanges = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if modified_user_id is set, set the flag to false so SugarBEan will not reset it
|
||||
if (isset($focus->modified_user_id) && $focus->modified_user_id && !$hasDataChanges) {
|
||||
$focus->update_modified_by = false;
|
||||
|
@ -578,7 +578,7 @@ class Importer
|
|||
{
|
||||
global $current_user;
|
||||
|
||||
$firstrow = json_decode(html_entity_decode($_REQUEST['firstrow']), true);
|
||||
$firstrow = json_decode(html_entity_decode((string) $_REQUEST['firstrow']), true);
|
||||
$mappingValsArr = $this->importColumns;
|
||||
$mapping_file = BeanFactory::newBean('Import_1');
|
||||
if (isset($_REQUEST['has_header']) && $_REQUEST['has_header'] == 'on') {
|
||||
|
@ -649,7 +649,7 @@ class Importer
|
|||
$_REQUEST['source'],
|
||||
(isset($_REQUEST['has_header']) && $_REQUEST['has_header'] == 'on'),
|
||||
$_REQUEST['custom_delimiter'],
|
||||
html_entity_decode($_REQUEST['custom_enclosure'], ENT_QUOTES)
|
||||
html_entity_decode((string) $_REQUEST['custom_enclosure'], ENT_QUOTES)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -677,16 +677,16 @@ class Importer
|
|||
}
|
||||
|
||||
if (in_array($fieldDef['type'], array('currency','float','int','num')) && $this->ifs->num_grp_sep != $current_user->getPreference('num_grp_sep')) {
|
||||
$defaultRowValue = str_replace($current_user->getPreference('num_grp_sep'), $this->ifs->num_grp_sep, $defaultRowValue);
|
||||
$defaultRowValue = str_replace($current_user->getPreference('num_grp_sep'), $this->ifs->num_grp_sep, (string) $defaultRowValue);
|
||||
}
|
||||
|
||||
if (in_array($fieldDef['type'], array('currency','float')) && $this->ifs->dec_sep != $current_user->getPreference('dec_sep')) {
|
||||
$defaultRowValue = str_replace($current_user->getPreference('dec_sep'), $this->ifs->dec_sep, $defaultRowValue);
|
||||
$defaultRowValue = str_replace($current_user->getPreference('dec_sep'), $this->ifs->dec_sep, (string) $defaultRowValue);
|
||||
}
|
||||
|
||||
$user_currency_symbol = $this->defaultUserCurrency->symbol;
|
||||
if ($fieldDef['type'] == 'currency' && $this->ifs->currency_symbol != $user_currency_symbol) {
|
||||
$defaultRowValue = str_replace($user_currency_symbol, $this->ifs->currency_symbol, $defaultRowValue);
|
||||
$defaultRowValue = str_replace($user_currency_symbol, $this->ifs->currency_symbol, (string) $defaultRowValue);
|
||||
}
|
||||
|
||||
return $defaultRowValue;
|
||||
|
@ -780,7 +780,7 @@ class Importer
|
|||
|
||||
//harvest the dupe index settings
|
||||
if (isset($_REQUEST['enabled_dupes'])) {
|
||||
$toDecode = html_entity_decode($_REQUEST['enabled_dupes'], ENT_QUOTES);
|
||||
$toDecode = html_entity_decode((string) $_REQUEST['enabled_dupes'], ENT_QUOTES);
|
||||
$dupe_ind = json_decode($toDecode);
|
||||
|
||||
foreach ($dupe_ind as $dupe) {
|
||||
|
|
|
@ -51,6 +51,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
|
||||
require_once('modules/Import/Forms.php');
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class UsersLastImport extends SugarBean
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -54,6 +54,7 @@ require_once("include/MVC/Controller/SugarController.php");
|
|||
require_once('modules/Import/sources/ImportFile.php');
|
||||
require_once('modules/Import/views/ImportListView.php');
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportController extends SugarController
|
||||
{
|
||||
/**
|
||||
|
@ -141,17 +142,17 @@ class ImportController extends SugarController
|
|||
$v = new ImportViewConfirm();
|
||||
$fileName = $_REQUEST['importFile'];
|
||||
|
||||
if (isset($fileName) && strpos($fileName, '..') !== false) {
|
||||
if (isset($fileName) && strpos((string) $fileName, '..') !== false) {
|
||||
LoggerManager::getLogger()->security('Directory navigation attack denied');
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($fileName) && !hasValidFileName('import_refresh_mapping_file_name', str_replace('upload://', '', $fileName))) {
|
||||
if (isset($fileName) && !hasValidFileName('import_refresh_mapping_file_name', str_replace('upload://', '', (string) $fileName))) {
|
||||
LoggerManager::getLogger()->fatal('Invalid importFile file name');
|
||||
return;
|
||||
}
|
||||
|
||||
if (strpos($fileName, 'phar://') !== false) {
|
||||
if (strpos((string) $fileName, 'phar://') !== false) {
|
||||
LoggerManager::getLogger()->fatal('Invalid importFile file path');
|
||||
return;
|
||||
}
|
||||
|
@ -163,7 +164,7 @@ class ImportController extends SugarController
|
|||
}
|
||||
|
||||
$enclosure = $_REQUEST['qualif'];
|
||||
$enclosure = html_entity_decode($enclosure, ENT_QUOTES);
|
||||
$enclosure = html_entity_decode((string) $enclosure, ENT_QUOTES);
|
||||
$hasHeader = !empty($_REQUEST['header']);
|
||||
|
||||
$importFile = new ImportFile($fileName, $delim, $enclosure, false);
|
||||
|
|
|
@ -50,6 +50,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
|
||||
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportMap extends SugarBean
|
||||
{
|
||||
/**
|
||||
|
@ -226,7 +227,7 @@ class ImportMap extends SugarBean
|
|||
|
||||
// Bug 23354 - Make sure enclosure gets saved as an empty string if
|
||||
// it is an empty string, instead of as a null
|
||||
if (strlen($enclosure) <= 0) {
|
||||
if (strlen((string) $enclosure) <= 0) {
|
||||
$enclosure = ' ';
|
||||
}
|
||||
|
||||
|
@ -383,7 +384,7 @@ class ImportMap extends SugarBean
|
|||
|
||||
//retrieve user preferences and populate preference array
|
||||
$preference_values_str = $current_user->getPreference('field_values', 'import');
|
||||
$preference_values = json_decode($preference_values_str, true);
|
||||
$preference_values = json_decode((string) $preference_values_str, true);
|
||||
|
||||
foreach ($import_step_fields as $val) {
|
||||
//overwrite preference array with new values from request if the value is different or new
|
||||
|
|
|
@ -50,6 +50,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
|
||||
require_once('modules/Import/maps/ImportMapOther.php');
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportMapAct extends ImportMapOther
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -50,6 +50,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
|
||||
require_once('modules/Import/maps/ImportMapOther.php');
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportMapCsv extends ImportMapOther
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -45,6 +45,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
|
||||
require_once('modules/Import/maps/ImportMapOther.php');
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportMapGoogle extends ImportMapOther
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -48,6 +48,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportMapOther
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -50,6 +50,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
|
||||
require_once('modules/Import/maps/ImportMapOther.php');
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportMapOutlook extends ImportMapOther
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -50,6 +50,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
|
||||
require_once('modules/Import/maps/ImportMapOther.php');
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportMapSalesforce extends ImportMapOther
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -50,6 +50,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
|
||||
require_once('modules/Import/maps/ImportMapOther.php');
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportMapTab extends ImportMapOther
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
require_once('modules/Import/sources/ImportDataSource.php');
|
||||
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ExternalSourceEAPMAdapter extends ImportDataSource
|
||||
{
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ require_once('modules/Import/ImportCacheFiles.php');
|
|||
|
||||
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
abstract class ImportDataSource implements Iterator
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -52,6 +52,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
require_once('modules/Import/CsvAutoDetect.php');
|
||||
require_once('modules/Import/sources/ImportDataSource.php');
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportFile extends ImportDataSource
|
||||
{
|
||||
/**
|
||||
|
@ -236,7 +237,7 @@ class ImportFile extends ImportDataSource
|
|||
|
||||
// Convert all line endings to the same style as PHP_EOL
|
||||
// Use preg_replace instead of str_replace as str_replace may cause extra lines on Windows
|
||||
$this->_currentRow[$key] = preg_replace("[\r\n|\n|\r]", PHP_EOL, $this->_currentRow[$key]);
|
||||
$this->_currentRow[$key] = preg_replace("[\r\n|\n|\r]", PHP_EOL, (string) $this->_currentRow[$key]);
|
||||
}
|
||||
|
||||
$this->_rowsCount++;
|
||||
|
@ -251,7 +252,7 @@ class ImportFile extends ImportDataSource
|
|||
*/
|
||||
public function getFieldCount()
|
||||
{
|
||||
return count($this->_currentRow);
|
||||
return is_countable($this->_currentRow) ? count($this->_currentRow) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -459,7 +460,7 @@ class ImportFile extends ImportDataSource
|
|||
$this->next();
|
||||
}
|
||||
|
||||
while ($this->valid() && $totalItems > count($this->_dataSet)) {
|
||||
while ($this->valid() && $totalItems > (is_countable($this->_dataSet) ? count($this->_dataSet) : 0)) {
|
||||
if ($currentLine >= $this->_offset) {
|
||||
$this->_dataSet[] = $this->_currentRow;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
require_once('include/ListView/ListViewSmarty.php');
|
||||
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportListView
|
||||
{
|
||||
/**
|
||||
|
@ -151,8 +152,8 @@ class ImportListView
|
|||
{
|
||||
$maxColumns = 0;
|
||||
foreach ($this->data as $data) {
|
||||
if (count($data) > $maxColumns) {
|
||||
$maxColumns = count($data);
|
||||
if ((is_countable($data) ? count($data) : 0) > $maxColumns) {
|
||||
$maxColumns = is_countable($data) ? count($data) : 0;
|
||||
}
|
||||
}
|
||||
return $maxColumns;
|
||||
|
|
|
@ -44,6 +44,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
require_once('include/MVC/View/SugarView.php');
|
||||
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportView extends SugarView
|
||||
{
|
||||
protected $currentStep;
|
||||
|
@ -56,7 +57,7 @@ class ImportView extends SugarView
|
|||
|
||||
parent::__construct($bean, $view_object_map);
|
||||
|
||||
if (isset($_REQUEST['button']) && trim($_REQUEST['button']) == htmlentities($mod_strings['LBL_BACK'])) {
|
||||
if (isset($_REQUEST['button']) && trim($_REQUEST['button']) === htmlentities((string) $mod_strings['LBL_BACK'])) {
|
||||
// if the request comes from the "Back" button, decrease the step count
|
||||
$this->currentStep = isset($_REQUEST['current_step']) ? ($_REQUEST['current_step'] - 1) : 1;
|
||||
} else {
|
||||
|
@ -159,7 +160,7 @@ class ImportView extends SugarView
|
|||
global $mod_strings;
|
||||
|
||||
$ins = '';
|
||||
|
||||
|
||||
if ($this->instruction) {
|
||||
$ins_string = $mod_strings[$this->instruction];
|
||||
$ins = '<div class="import_instruction">' . $ins_string . '</div>';
|
||||
|
|
|
@ -56,10 +56,12 @@ require_once('include/upload_file.php');
|
|||
|
||||
class ImportViewConfirm extends ImportView
|
||||
{
|
||||
const SAMPLE_ROW_SIZE = 3;
|
||||
public $ss;
|
||||
public $bean;
|
||||
public const SAMPLE_ROW_SIZE = 3;
|
||||
protected $pageTitleKey = 'LBL_CONFIRM_TITLE';
|
||||
protected $errorScript = "";
|
||||
|
||||
|
||||
/**
|
||||
* @see SugarView::display()
|
||||
*/
|
||||
|
@ -68,6 +70,8 @@ class ImportViewConfirm extends ImportView
|
|||
global $mod_strings, $app_strings, $current_user;
|
||||
global $sugar_config, $locale;
|
||||
|
||||
$error_msgs = [];
|
||||
|
||||
if (isset($_FILES['userfile']['name']) && !hasValidFileName('import_upload_file_name', $_FILES['userfile']['name'])) {
|
||||
LoggerManager::getLogger()->fatal('Invalid import file name');
|
||||
echo $app_strings['LBL_LOGGER_INVALID_FILENAME'];
|
||||
|
@ -103,7 +107,7 @@ class ImportViewConfirm extends ImportView
|
|||
$uploadFile->final_move('IMPORT_'.$this->bean->object_name.'_'.$current_user->id);
|
||||
$uploadFileName = $uploadFile->get_upload_path('IMPORT_'.$this->bean->object_name.'_'.$current_user->id);
|
||||
} elseif (!empty($_REQUEST['tmp_file'])) {
|
||||
$uploadFileName = "upload://".basename($_REQUEST['tmp_file']);
|
||||
$uploadFileName = "upload://".basename((string) $_REQUEST['tmp_file']);
|
||||
} else {
|
||||
$this->_showImportError($mod_strings['LBL_IMPORT_MODULE_ERROR_NO_UPLOAD'], $_REQUEST['import_module'], 'Step2', true, null, true);
|
||||
return;
|
||||
|
@ -119,8 +123,8 @@ class ImportViewConfirm extends ImportView
|
|||
$mimeTypeOk = true;
|
||||
|
||||
//check to see if the file mime type is not a form of text or application octed streramand fire error if not
|
||||
if (isset($_FILES['userfile']['type']) && strpos($_FILES['userfile']['type'], 'octet-stream') === false && strpos($_FILES['userfile']['type'], 'text') === false
|
||||
&& strpos($_FILES['userfile']['type'], 'application/vnd.ms-excel') === false) {
|
||||
if (isset($_FILES['userfile']['type']) && strpos((string) $_FILES['userfile']['type'], 'octet-stream') === false && strpos((string) $_FILES['userfile']['type'], 'text') === false
|
||||
&& strpos((string) $_FILES['userfile']['type'], 'application/vnd.ms-excel') === false) {
|
||||
//this file does not have a known text or application type of mime type, issue the warning
|
||||
$error_msgs[] = $mod_strings['LBL_MIME_TYPE_ERROR_1'];
|
||||
$error_msgs[] = $mod_strings['LBL_MIME_TYPE_ERROR_2'];
|
||||
|
@ -131,7 +135,7 @@ class ImportViewConfirm extends ImportView
|
|||
$this->ss->assign("FILE_NAME", $uploadFileName);
|
||||
|
||||
// Now parse the file and look for errors
|
||||
$importFile = new ImportFile($uploadFileName, $_REQUEST['custom_delimiter'], html_entity_decode($_REQUEST['custom_enclosure'], ENT_QUOTES), false);
|
||||
$importFile = new ImportFile($uploadFileName, $_REQUEST['custom_delimiter'], html_entity_decode((string) $_REQUEST['custom_enclosure'], ENT_QUOTES), false);
|
||||
|
||||
if ($this->shouldAutoDetectProperties($importSource)) {
|
||||
$GLOBALS['log']->debug("Auto detecing csv properties...");
|
||||
|
@ -170,7 +174,7 @@ class ImportViewConfirm extends ImportView
|
|||
$importFileMap = $this->overloadImportFileMapFromRequest($importFileMap);
|
||||
$delimeter = !empty($_REQUEST['custom_delimiter']) ? $_REQUEST['custom_delimiter'] : $delimeter;
|
||||
$enclosure = isset($_REQUEST['custom_enclosure']) ? $_REQUEST['custom_enclosure'] : $enclosure;
|
||||
$enclosure = html_entity_decode($enclosure, ENT_QUOTES);
|
||||
$enclosure = html_entity_decode((string) $enclosure, ENT_QUOTES);
|
||||
$hasHeader = !empty($_REQUEST['has_header']) ? $_REQUEST['has_header'] : $hasHeader;
|
||||
if ($hasHeader == 'on') {
|
||||
$hasHeader = true;
|
||||
|
@ -184,7 +188,7 @@ class ImportViewConfirm extends ImportView
|
|||
$this->ss->assign("IMPORT_ENCLOSURE_OPTIONS", $this->getEnclosureOptions($enclosure));
|
||||
$this->ss->assign("IMPORT_DELIMETER_OPTIONS", $this->getDelimeterOptions($delimeter));
|
||||
$this->ss->assign("CUSTOM_DELIMITER", $delimeter);
|
||||
$this->ss->assign("CUSTOM_ENCLOSURE", htmlentities($enclosure, ENT_QUOTES));
|
||||
$this->ss->assign("CUSTOM_ENCLOSURE", htmlentities((string) $enclosure, ENT_QUOTES));
|
||||
$hasHeaderFlag = $hasHeader ? " CHECKED" : "";
|
||||
$this->ss->assign("HAS_HEADER_CHECKED", $hasHeaderFlag);
|
||||
|
||||
|
@ -234,10 +238,10 @@ class ImportViewConfirm extends ImportView
|
|||
{
|
||||
$results = array();
|
||||
foreach ($GLOBALS['app_list_strings']['import_enclosure_options'] as $k => $v) {
|
||||
$results[htmlentities($k, ENT_QUOTES)] = $v;
|
||||
$results[htmlentities((string) $k, ENT_QUOTES)] = $v;
|
||||
}
|
||||
|
||||
return get_select_options_with_id($results, htmlentities($enclosure, ENT_QUOTES));
|
||||
return get_select_options_with_id($results, htmlentities((string) $enclosure, ENT_QUOTES));
|
||||
}
|
||||
|
||||
private function overloadImportFileMapFromRequest($importFileMap)
|
||||
|
@ -267,8 +271,9 @@ class ImportViewConfirm extends ImportView
|
|||
|
||||
private function getImportMap($importSource)
|
||||
{
|
||||
$import_map_seed = null;
|
||||
if (strncasecmp("custom:", $importSource, 7) == 0) {
|
||||
$id = substr($importSource, 7);
|
||||
$id = substr((string) $importSource, 7);
|
||||
$import_map_seed = BeanFactory::newBean('Import_1');
|
||||
$import_map_seed->retrieve($id, false);
|
||||
|
||||
|
@ -413,8 +418,8 @@ eoq;
|
|||
{
|
||||
$maxColumns = 0;
|
||||
foreach ($sampleSet as $v) {
|
||||
if (count($v) > $maxColumns) {
|
||||
$maxColumns = count($v);
|
||||
if ((is_countable($v) ? count($v) : 0) > $maxColumns) {
|
||||
$maxColumns = is_countable($v) ? count($v) : 0;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
@ -433,7 +438,7 @@ eoq;
|
|||
if (! $importFile->hasHeaderRow(false)) {
|
||||
array_unshift($rows, array_fill(0, 1, ''));
|
||||
}
|
||||
|
||||
|
||||
foreach ($rows as &$row) {
|
||||
if (is_array($row)) {
|
||||
foreach ($row as &$val) {
|
||||
|
@ -452,11 +457,11 @@ eoq;
|
|||
global $mod_strings, $locale;
|
||||
$maxRecordsExceededJS = $maxRecordsExceeded?"true":"false";
|
||||
$importMappingJS = json_encode($importMappingJS);
|
||||
|
||||
|
||||
$currencySymbolJs = $this->setCurrencyOptions($importFileMap);
|
||||
$getNumberJs = $locale->getNumberJs();
|
||||
$getNameJs = $locale->getNameJs();
|
||||
|
||||
|
||||
return <<<EOJAVASCRIPT
|
||||
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ require_once('modules/Import/ImportDuplicateCheck.php');
|
|||
|
||||
require_once('include/upload_file.php');
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportViewDupcheck extends ImportView
|
||||
{
|
||||
protected $pageTitleKey = 'LBL_STEP_DUP_TITLE';
|
||||
|
@ -105,9 +106,9 @@ class ImportViewDupcheck extends ImportView
|
|||
global $mod_strings, $sugar_config;
|
||||
|
||||
$has_header = $_REQUEST['has_header'] == 'on' ? true : false;
|
||||
$uploadFileName = "upload://".basename($_REQUEST['tmp_file']);
|
||||
$uploadFileName = "upload://".basename((string) $_REQUEST['tmp_file']);
|
||||
$splitter = new ImportFileSplitter($uploadFileName, $sugar_config['import_max_records_per_file']);
|
||||
$splitter->splitSourceFile($_REQUEST['custom_delimiter'], html_entity_decode($_REQUEST['custom_enclosure'], ENT_QUOTES), $has_header);
|
||||
$splitter->splitSourceFile($_REQUEST['custom_delimiter'], html_entity_decode((string) $_REQUEST['custom_enclosure'], ENT_QUOTES), $has_header);
|
||||
$count = $splitter->getFileCount()-1;
|
||||
$recCount = $splitter->getRecordCount();
|
||||
|
||||
|
@ -160,8 +161,8 @@ class ImportViewDupcheck extends ImportView
|
|||
|
||||
$dateTimeFormat = $GLOBALS['timedate']->get_cal_date_time_format();
|
||||
$type = (isset($_REQUEST['type'])) ? $_REQUEST['type'] : '';
|
||||
$lblUsed = str_replace(":", "", $mod_strings['LBL_INDEX_USED']);
|
||||
$lblNotUsed = str_replace(":", "", $mod_strings['LBL_INDEX_NOT_USED']);
|
||||
$lblUsed = str_replace(":", "", (string) $mod_strings['LBL_INDEX_USED']);
|
||||
$lblNotUsed = str_replace(":", "", (string) $mod_strings['LBL_INDEX_NOT_USED']);
|
||||
return <<<EOJAVASCRIPT
|
||||
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
|
||||
require_once('include/MVC/View/SugarView.php');
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportViewError extends SugarView
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -52,6 +52,7 @@ require_once('modules/Import/ImportDuplicateCheck.php');
|
|||
|
||||
require_once('include/upload_file.php');
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportViewExtdupcheck extends ImportView
|
||||
{
|
||||
protected $pageTitleKey = 'LBL_STEP_DUP_TITLE';
|
||||
|
|
|
@ -48,6 +48,7 @@ require_once('modules/Import/sources/ImportFile.php');
|
|||
require_once('modules/Import/views/ImportListView.php');
|
||||
require_once('include/ListView/ListViewFacade.php');
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportViewLast extends ImportView
|
||||
{
|
||||
protected $pageTitleKey = 'LBL_STEP_5_TITLE';
|
||||
|
|
|
@ -52,6 +52,7 @@ require_once('include/externalAPI/ExternalAPIFactory.php');
|
|||
require_once('modules/Import/Importer.php');
|
||||
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportViewStep1 extends ImportView
|
||||
{
|
||||
protected $pageTitleKey = 'LBL_STEP_1_TITLE';
|
||||
|
@ -65,14 +66,14 @@ class ImportViewStep1 extends ImportView
|
|||
$this->importModule = 'Administration';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams($browserTitle = false)
|
||||
{
|
||||
global $mod_strings, $app_list_strings;
|
||||
|
||||
|
||||
$iconPath = $this->getModuleTitleIconPath($this->module);
|
||||
$returnArray = array();
|
||||
if (!empty($iconPath) && !$browserTitle) {
|
||||
|
@ -82,7 +83,7 @@ class ImportViewStep1 extends ImportView
|
|||
}
|
||||
$returnArray[] = "<a href='index.php?module=Import&action=Step1&import_module={$_REQUEST['import_module']}'>".$mod_strings['LBL_MODULE_NAME']."</a>";
|
||||
$returnArray[] = $mod_strings['LBL_STEP_1_TITLE'];
|
||||
|
||||
|
||||
return $returnArray;
|
||||
}
|
||||
|
||||
|
@ -124,7 +125,7 @@ class ImportViewStep1 extends ImportView
|
|||
$this->ss->assign("selectExternalSource", $selectExternal);
|
||||
|
||||
$content = $this->ss->fetch('modules/Import/tpls/step1.tpl');
|
||||
|
||||
|
||||
$submitContent = "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td align=\"right\">";
|
||||
$submitContent .= "<input title=\"".$mod_strings['LBL_IMPORT_COMPLETE']."\" onclick=\"SUGAR.importWizard.closeDialog();\" class=\"button\" type=\"submit\" name=\"finished\" value=\" ".$mod_strings['LBL_IMPORT_COMPLETE']." \" id=\"finished\">";
|
||||
$submitContent .= "<input title=\"".$mod_strings['LBL_NEXT']."\" class=\"button primary\" type=\"submit\" name=\"button\" value=\" ".$mod_strings['LBL_NEXT']." \" id=\"gonext\"></td></tr></table>";
|
||||
|
@ -168,7 +169,7 @@ class ImportViewStep1 extends ImportView
|
|||
global $mod_strings;
|
||||
$EXTERNAL_AUTHENTICATED_SOURCES = json_encode($this->getAuthenticatedImportableExternalEAPMs());
|
||||
$selectExternalSource = !empty($_REQUEST['application']) ? $_REQUEST['application'] : '';
|
||||
|
||||
|
||||
$showModuleSelection = ($this->importModule == 'Administration');
|
||||
$importableModulesOptions = array();
|
||||
$importablePersonModules = array();
|
||||
|
@ -179,7 +180,7 @@ class ImportViewStep1 extends ImportView
|
|||
|
||||
|
||||
$PERSON_MODULE_LIST = json_encode($importablePersonModules);
|
||||
|
||||
|
||||
return <<<EOJAVASCRIPT
|
||||
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
require_once('modules/Import/views/ImportView.php');
|
||||
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportViewStep2 extends ImportView
|
||||
{
|
||||
protected $pageTitleKey = 'LBL_STEP_2_TITLE';
|
||||
|
@ -72,10 +73,10 @@ class ImportViewStep2 extends ImportView
|
|||
$this->ss->assign("TYPE", (!empty($_REQUEST['type']) ? $_REQUEST['type'] : "import"));
|
||||
$this->ss->assign("CUSTOM_DELIMITER", (!empty($_REQUEST['custom_delimiter']) ? $_REQUEST['custom_delimiter'] : ","));
|
||||
$this->ss->assign("CUSTOM_ENCLOSURE", htmlentities(
|
||||
(!empty($_REQUEST['custom_enclosure']) && $_REQUEST['custom_enclosure'] != 'other'
|
||||
((string) (!empty($_REQUEST['custom_enclosure']) && $_REQUEST['custom_enclosure'] != 'other'
|
||||
? $_REQUEST['custom_enclosure'] :
|
||||
(!empty($_REQUEST['custom_enclosure_other'])
|
||||
? $_REQUEST['custom_enclosure_other'] : ""))
|
||||
? $_REQUEST['custom_enclosure_other'] : "")))
|
||||
));
|
||||
|
||||
$this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']);
|
||||
|
@ -100,7 +101,7 @@ class ImportViewStep2 extends ImportView
|
|||
$import_map_seed = BeanFactory::newBean('Import_1');
|
||||
$custom_imports_arr = $import_map_seed->retrieve_all_by_string_fields(array('assigned_user_id' => $current_user->id, 'is_published' => 'no','module' => $_REQUEST['import_module']));
|
||||
|
||||
if (count($custom_imports_arr)) {
|
||||
if (is_countable($custom_imports_arr) ? count($custom_imports_arr) : 0) {
|
||||
$custom = array();
|
||||
foreach ($custom_imports_arr as $import) {
|
||||
$custom[] = array( "IMPORT_NAME" => $import->name,"IMPORT_ID" => $import->id);
|
||||
|
@ -110,7 +111,7 @@ class ImportViewStep2 extends ImportView
|
|||
|
||||
// get globally defined import maps
|
||||
$published_imports_arr = $import_map_seed->retrieve_all_by_string_fields(array('is_published' => 'yes', 'module' => $_REQUEST['import_module'],));
|
||||
if (count($published_imports_arr)) {
|
||||
if (is_countable($published_imports_arr) ? count($published_imports_arr) : 0) {
|
||||
$published = array();
|
||||
foreach ($published_imports_arr as $import) {
|
||||
$published[] = array("IMPORT_NAME" => $import->name, "IMPORT_ID" => $import->id);
|
||||
|
|
|
@ -56,6 +56,7 @@ require_once('modules/Import/ImportDuplicateCheck.php');
|
|||
|
||||
require_once('include/upload_file.php');
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportViewStep3 extends ImportView
|
||||
{
|
||||
protected $pageTitleKey = 'LBL_STEP_3_TITLE';
|
||||
|
@ -80,6 +81,7 @@ class ImportViewStep3 extends ImportView
|
|||
$field_map = $mapping_file->set_get_import_wizard_fields();
|
||||
$default_values = array();
|
||||
$ignored_fields = array();
|
||||
$fields = [];
|
||||
|
||||
if (!empty($_REQUEST['source_id'])) {
|
||||
$GLOBALS['log']->fatal("Loading import map properties.");
|
||||
|
@ -91,7 +93,7 @@ class ImportViewStep3 extends ImportView
|
|||
$_REQUEST['custom_delimiter'] = $mapping_file->delimiter;
|
||||
}
|
||||
if (isset($mapping_file->enclosure)) {
|
||||
$_REQUEST['custom_enclosure'] = htmlentities($mapping_file->enclosure);
|
||||
$_REQUEST['custom_enclosure'] = htmlentities((string) $mapping_file->enclosure);
|
||||
}
|
||||
$field_map = $mapping_file->getMapping();
|
||||
//print_r($field_map);die();
|
||||
|
@ -123,13 +125,13 @@ class ImportViewStep3 extends ImportView
|
|||
|
||||
$uploadFileName = $_REQUEST['file_name'];
|
||||
|
||||
if (isset($uploadFileName) && strpos($uploadFileName, '..') !== false) {
|
||||
if (isset($uploadFileName) && strpos((string) $uploadFileName, '..') !== false) {
|
||||
LoggerManager::getLogger()->security('Directory navigation attack denied');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (isset($uploadFileName) && !hasValidFileName('import_upload_file_name', str_replace('upload://', '', $uploadFileName))) {
|
||||
if (isset($uploadFileName) && !hasValidFileName('import_upload_file_name', str_replace('upload://', '', (string) $uploadFileName))) {
|
||||
echo $app_strings['LBL_LOGGER_INVALID_FILENAME'];
|
||||
echo $uploadFileName;
|
||||
LoggerManager::getLogger()->fatal('Invalid import file name');
|
||||
|
@ -137,12 +139,12 @@ class ImportViewStep3 extends ImportView
|
|||
}
|
||||
|
||||
|
||||
if (strpos($uploadFileName, 'phar://') !== false) {
|
||||
if (strpos((string) $uploadFileName, 'phar://') !== false) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Now parse the file and look for errors
|
||||
$importFile = new ImportFile($uploadFileName, $delimiter, html_entity_decode($_REQUEST['custom_enclosure'], ENT_QUOTES), false);
|
||||
$importFile = new ImportFile($uploadFileName, $delimiter, html_entity_decode((string) $_REQUEST['custom_enclosure'], ENT_QUOTES), false);
|
||||
|
||||
if (!$importFile->fileExists()) {
|
||||
$this->_showImportError($mod_strings['LBL_CANNOT_OPEN'], $_REQUEST['import_module'], 'Step2');
|
||||
|
@ -194,7 +196,7 @@ class ImportViewStep3 extends ImportView
|
|||
$this->ss->assign("MODULE_TITLE", $this->getModuleTitle(false));
|
||||
$this->ss->assign(
|
||||
"STEP4_TITLE",
|
||||
strip_tags(str_replace("\n", "", getClassicModuleTitle(
|
||||
strip_tags(str_replace("\n", "", (string) getClassicModuleTitle(
|
||||
$mod_strings['LBL_MODULE_NAME'],
|
||||
array($mod_strings['LBL_MODULE_NAME'],$mod_strings['LBL_STEP_4_TITLE']),
|
||||
false
|
||||
|
@ -224,7 +226,7 @@ class ImportViewStep3 extends ImportView
|
|||
$rows[0][$field_count] = '';
|
||||
}
|
||||
// See if we can match the import row to a field in the list of fields to import
|
||||
$firstrow_name = trim(str_replace(":", "", $rows[0][$field_count]));
|
||||
$firstrow_name = trim(str_replace(":", "", (string) $rows[0][$field_count]));
|
||||
if ($has_header && isset($field_map[$firstrow_name])) {
|
||||
$defaultValue = $field_map[$firstrow_name];
|
||||
} elseif (isset($field_map[$field_count])) {
|
||||
|
@ -243,12 +245,12 @@ class ImportViewStep3 extends ImportView
|
|||
foreach ($fields as $fieldname => $properties) {
|
||||
// get field name
|
||||
if (!empty($moduleStrings['LBL_EXPORT_'.strtoupper($fieldname)])) {
|
||||
$displayname = str_replace(":", "", $moduleStrings['LBL_EXPORT_'.strtoupper($fieldname)]);
|
||||
$displayname = str_replace(":", "", (string) $moduleStrings['LBL_EXPORT_'.strtoupper($fieldname)]);
|
||||
} else {
|
||||
if (!empty($properties['vname'])) {
|
||||
$displayname = str_replace(":", "", translate($properties['vname'], $this->bean->module_dir));
|
||||
$displayname = str_replace(":", "", (string) translate($properties['vname'], $this->bean->module_dir));
|
||||
} else {
|
||||
$displayname = str_replace(":", "", translate($properties['name'], $this->bean->module_dir));
|
||||
$displayname = str_replace(":", "", (string) translate($properties['name'], $this->bean->module_dir));
|
||||
}
|
||||
}
|
||||
// see if this is required
|
||||
|
@ -269,10 +271,10 @@ class ImportViewStep3 extends ImportView
|
|||
} else {
|
||||
if (!empty($defaultValue) && !in_array($fieldname, $mappedFields)
|
||||
&& !in_array($fieldname, $ignored_fields)) {
|
||||
if (strtolower($fieldname) == strtolower($defaultValue)
|
||||
|| strtolower($fieldname) == str_replace(" ", "_", strtolower($defaultValue))
|
||||
|| strtolower($displayname) == strtolower($defaultValue)
|
||||
|| strtolower($displayname) == str_replace(" ", "_", strtolower($defaultValue))) {
|
||||
if (strtolower($fieldname) === strtolower($defaultValue)
|
||||
|| strtolower($fieldname) === str_replace(" ", "_", strtolower($defaultValue))
|
||||
|| strtolower($displayname) === strtolower($defaultValue)
|
||||
|| strtolower($displayname) === str_replace(" ", "_", strtolower($defaultValue))) {
|
||||
$selected = ' selected="selected" ';
|
||||
$defaultField = $fieldname;
|
||||
$mappedFields[] = $fieldname;
|
||||
|
@ -324,7 +326,7 @@ class ImportViewStep3 extends ImportView
|
|||
}
|
||||
|
||||
// add in extra defaulted fields if they are in the mapping record
|
||||
if (count($default_values) > 0) {
|
||||
if ((is_countable($default_values) ? count($default_values) : 0) > 0) {
|
||||
foreach ($default_values as $field_name => $default_value) {
|
||||
// build string of options
|
||||
$fields = $this->bean->get_importable_fields();
|
||||
|
@ -333,9 +335,9 @@ class ImportViewStep3 extends ImportView
|
|||
foreach ($fields as $fieldname => $properties) {
|
||||
// get field name
|
||||
if (!empty($properties['vname'])) {
|
||||
$displayname = str_replace(":", "", translate($properties['vname'], $this->bean->module_dir));
|
||||
$displayname = str_replace(":", "", (string) translate($properties['vname'], $this->bean->module_dir));
|
||||
} else {
|
||||
$displayname = str_replace(":", "", translate($properties['name'], $this->bean->module_dir));
|
||||
$displayname = str_replace(":", "", (string) translate($properties['name'], $this->bean->module_dir));
|
||||
}
|
||||
// see if this is required
|
||||
$req_mark = "";
|
||||
|
@ -346,7 +348,7 @@ class ImportViewStep3 extends ImportView
|
|||
}
|
||||
// see if we have a match
|
||||
$selected = '';
|
||||
if (strtolower($fieldname) == strtolower($field_name)
|
||||
if (strtolower($fieldname) === strtolower($field_name)
|
||||
&& !in_array($fieldname, $mappedFields)
|
||||
&& !in_array($fieldname, $ignored_fields)) {
|
||||
$selected = ' selected="selected" ';
|
||||
|
@ -418,9 +420,9 @@ class ImportViewStep3 extends ImportView
|
|||
foreach (array_keys($this->bean->get_import_required_fields()) as $name) {
|
||||
$properties = $this->bean->getFieldDefinition($name);
|
||||
if (!empty($properties['vname'])) {
|
||||
$required[$name] = str_replace(":", "", translate($properties['vname'], $this->bean->module_dir));
|
||||
$required[$name] = str_replace(":", "", (string) translate($properties['vname'], $this->bean->module_dir));
|
||||
} else {
|
||||
$required[$name] = str_replace(":", "", translate($properties['name'], $this->bean->module_dir));
|
||||
$required[$name] = str_replace(":", "", (string) translate($properties['name'], $this->bean->module_dir));
|
||||
}
|
||||
}
|
||||
// include anything needed for quicksearch to work
|
||||
|
|
|
@ -52,6 +52,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
require_once('include/MVC/View/SugarView.php');
|
||||
require_once('modules/Import/Importer.php');
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportViewStep4 extends SugarView
|
||||
{
|
||||
private $currentStep;
|
||||
|
@ -70,13 +71,13 @@ class ImportViewStep4 extends SugarView
|
|||
global $mod_strings, $sugar_config;
|
||||
|
||||
// Check to be sure we are getting an import file that is in the right place
|
||||
$uploadFile = "upload://".basename($_REQUEST['tmp_file']);
|
||||
$uploadFile = "upload://".basename((string) $_REQUEST['tmp_file']);
|
||||
if (!file_exists($uploadFile)) {
|
||||
trigger_error($mod_strings['LBL_CANNOT_OPEN'], E_USER_ERROR);
|
||||
}
|
||||
|
||||
// Open the import file
|
||||
$importSource = new ImportFile($uploadFile, $_REQUEST['custom_delimiter'], html_entity_decode($_REQUEST['custom_enclosure'], ENT_QUOTES));
|
||||
$importSource = new ImportFile($uploadFile, $_REQUEST['custom_delimiter'], html_entity_decode((string) $_REQUEST['custom_enclosure'], ENT_QUOTES));
|
||||
|
||||
//Ensure we have a valid file.
|
||||
if (!$importSource->fileExists()) {
|
||||
|
|
|
@ -50,6 +50,7 @@ if (!defined('sugarEntry') || !sugarEntry) {
|
|||
|
||||
require_once('modules/Import/views/ImportView.php');
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ImportViewUndo extends ImportView
|
||||
{
|
||||
protected $pageTitleKey = 'LBL_UNDO_LAST_IMPORT';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue