init
This commit is contained in:
292
modules/Import/Forms.php
Executable file
292
modules/Import/Forms.php
Executable file
@@ -0,0 +1,292 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: Contains a variety of utility functions for the Import module
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns the bean object of the given module
|
||||
*
|
||||
* @param string $module
|
||||
* @return object
|
||||
*/
|
||||
function loadImportBean(
|
||||
$module
|
||||
)
|
||||
{
|
||||
$focus = SugarModule::get($module)->loadBean();
|
||||
if ( $focus ) {
|
||||
if ( !$focus->importable )
|
||||
return false;
|
||||
if ( $module == 'Users' && !is_admin($GLOBALS['current_user']) && !is_admin_for_module($GLOBALS['current_user'],'Users'))
|
||||
return false;
|
||||
if ( $focus->bean_implements('ACL')){
|
||||
if(!ACLController::checkAccess($focus->module_dir, 'import', true)){
|
||||
ACLController::displayNoAccess();
|
||||
sugar_die('');
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $focus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the Smarty template for an error
|
||||
*
|
||||
* @param string $message error message to show
|
||||
* @param string $module what module we were importing into
|
||||
* @param string $action what page we should go back to
|
||||
*/
|
||||
function showImportError(
|
||||
$message,
|
||||
$module,
|
||||
$action = 'Step1'
|
||||
)
|
||||
{
|
||||
$ss = new Sugar_Smarty();
|
||||
|
||||
$ss->assign("MESSAGE",$message);
|
||||
$ss->assign("ACTION",$action);
|
||||
$ss->assign("IMPORT_MODULE",$module);
|
||||
$ss->assign("MOD", $GLOBALS['mod_strings']);
|
||||
$ss->assign("SOURCE","");
|
||||
if ( isset($_REQUEST['source']) )
|
||||
$ss->assign("SOURCE", $_REQUEST['source']);
|
||||
|
||||
echo $ss->fetch('modules/Import/tpls/error.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces PHP error handler in Step4
|
||||
*
|
||||
* @param int $errno
|
||||
* @param string $errstr
|
||||
* @param string $errfile
|
||||
* @param string $errline
|
||||
*/
|
||||
function handleImportErrors(
|
||||
$errno,
|
||||
$errstr,
|
||||
$errfile,
|
||||
$errline
|
||||
)
|
||||
{
|
||||
if ( !defined('E_DEPRECATED') )
|
||||
define('E_DEPRECATED','8192');
|
||||
if ( !defined('E_USER_DEPRECATED') )
|
||||
define('E_USER_DEPRECATED','16384');
|
||||
|
||||
switch ($errno) {
|
||||
case E_USER_ERROR:
|
||||
echo "ERROR: [$errno] $errstr on line $errline in file $errfile<br />\n";
|
||||
exit(1);
|
||||
break;
|
||||
case E_USER_WARNING:
|
||||
case E_WARNING:
|
||||
echo "WARNING: [$errno] $errstr on line $errline in file $errfile<br />\n";
|
||||
break;
|
||||
case E_USER_NOTICE:
|
||||
case E_NOTICE:
|
||||
echo "NOTICE: [$errno] $errstr on line $errline in file $errfile<br />\n";
|
||||
break;
|
||||
case E_STRICT:
|
||||
case E_DEPRECATED:
|
||||
case E_USER_DEPRECATED:
|
||||
// don't worry about these
|
||||
//echo "STRICT ERROR: [$errno] $errstr on line $errline in file $errfile<br />\n";
|
||||
break;
|
||||
default:
|
||||
echo "Unknown error type: [$errno] $errstr on line $errline in file $errfile<br />\n";
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an input control for this fieldname given
|
||||
*
|
||||
* @param string $module
|
||||
* @param string $fieldname
|
||||
* @param string $vardef
|
||||
* @param string $value
|
||||
* @return string html for input element for this control
|
||||
*/
|
||||
function getControl(
|
||||
$module,
|
||||
$fieldname,
|
||||
$vardef = null,
|
||||
$value = ''
|
||||
)
|
||||
{
|
||||
global $current_language, $app_strings, $dictionary, $app_list_strings;
|
||||
|
||||
// use the mod_strings for this module
|
||||
$mod_strings = return_module_language($current_language,$module);
|
||||
|
||||
// set the filename for this control
|
||||
$file = create_cache_directory('modules/Import/') . $module . $fieldname . '.tpl';
|
||||
|
||||
if ( !is_file($file)
|
||||
|| !empty($GLOBALS['sugar_config']['developerMode'])
|
||||
|| !empty($_SESSION['developerMode']) ) {
|
||||
|
||||
if ( !isset($vardef) ) {
|
||||
$focus = loadBean($module);
|
||||
$vardef = $focus->getFieldDefinition($fieldname);
|
||||
}
|
||||
|
||||
// if this is the id relation field, then don't have a pop-up selector.
|
||||
if( $vardef['type'] == 'relate' && $vardef['id_name'] == $vardef['name']) {
|
||||
$vardef['type'] = 'varchar';
|
||||
}
|
||||
|
||||
// create the dropdowns for the parent type fields
|
||||
if ( $vardef['type'] == 'parent_type' ) {
|
||||
$vardef['type'] = 'enum';
|
||||
}
|
||||
|
||||
// remove the special text entry field function 'getEmailAddressWidget'
|
||||
if ( isset($vardef['function'])
|
||||
&& ( $vardef['function'] == 'getEmailAddressWidget'
|
||||
|| $vardef['function']['name'] == 'getEmailAddressWidget' ) )
|
||||
unset($vardef['function']);
|
||||
|
||||
// load SugarFieldHandler to render the field tpl file
|
||||
static $sfh;
|
||||
|
||||
if(!isset($sfh)) {
|
||||
require_once('include/SugarFields/SugarFieldHandler.php');
|
||||
$sfh = new SugarFieldHandler();
|
||||
}
|
||||
|
||||
$displayParams = array();
|
||||
$displayParams['formName'] = 'importstep3';
|
||||
|
||||
$view = 'EditView';
|
||||
|
||||
$contents = $sfh->displaySmarty('fields', $vardef, $view, $displayParams);
|
||||
|
||||
// Remove all the copyright comments
|
||||
$contents = preg_replace('/\{\*[^\}]*?\*\}/', '', $contents);
|
||||
|
||||
// hack to disable one of the js calls in this control
|
||||
if ( isset($vardef['function'])
|
||||
&& ( $vardef['function'] == 'getCurrencyDropDown'
|
||||
|| $vardef['function']['name'] == 'getCurrencyDropDown' ) )
|
||||
$contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}";
|
||||
|
||||
// Save it to the cache file
|
||||
if($fh = @sugar_fopen($file, 'w')) {
|
||||
fputs($fh, $contents);
|
||||
fclose($fh);
|
||||
}
|
||||
}
|
||||
|
||||
// Now render the template we received
|
||||
$ss = new Sugar_Smarty();
|
||||
|
||||
// Create Smarty variables for the Calendar picker widget
|
||||
global $timedate;
|
||||
$time_format = $timedate->get_user_time_format();
|
||||
$date_format = $timedate->get_cal_date_format();
|
||||
$time_separator = ":";
|
||||
$match = array();
|
||||
if(preg_match('/\d+([^\d])\d+([^\d]*)/s', $time_format, $match)) {
|
||||
$time_separator = $match[1];
|
||||
}
|
||||
$t23 = strpos($time_format, '23') !== false ? '%H' : '%I';
|
||||
if(!isset($match[2]) || $match[2] == '') {
|
||||
$ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M");
|
||||
}
|
||||
else {
|
||||
$pm = $match[2] == "pm" ? "%P" : "%p";
|
||||
$ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M" . $pm);
|
||||
}
|
||||
|
||||
// populate the fieldlist from the vardefs
|
||||
$fieldlist = array();
|
||||
if ( !isset($focus) || !($focus instanceof SugarBean) )
|
||||
$focus = loadBean($module);
|
||||
// create the dropdowns for the parent type fields
|
||||
if ( $vardef['type'] == 'parent_type' ) {
|
||||
$focus->field_defs[$vardef['name']]['options'] = $focus->field_defs[$vardef['group']]['options'];
|
||||
}
|
||||
$vardefFields = $focus->getFieldDefinitions();
|
||||
foreach ( $vardefFields as $name => $properties ) {
|
||||
$fieldlist[$name] = $properties;
|
||||
// fill in enums
|
||||
if(isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']]))
|
||||
$fieldlist[$name]['options'] = $app_list_strings[$fieldlist[$name]['options']];
|
||||
// Bug 32626: fall back on checking the mod_strings if not in the app_list_strings
|
||||
elseif(isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']]))
|
||||
$fieldlist[$name]['options'] = $mod_strings[$fieldlist[$name]['options']];
|
||||
// Bug 22730: make sure all enums have the ability to select blank as the default value.
|
||||
if(!isset($fieldlist[$name]['options']['']))
|
||||
$fieldlist[$name]['options'][''] = '';
|
||||
}
|
||||
// fill in function return values
|
||||
if ( !in_array($fieldname,array('email1','email2')) ) {
|
||||
if (!empty($fieldlist[$fieldname]['function']['returns']) && $fieldlist[$fieldname]['function']['returns'] == 'html'){
|
||||
$function = $fieldlist[$fieldname]['function']['name'];
|
||||
// include various functions required in the various vardefs
|
||||
if ( isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include']))
|
||||
require_once($fieldlist[$fieldname]['function']['include']);
|
||||
$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);
|
||||
}
|
||||
}
|
||||
$fieldlist[$fieldname]['value'] = $value;
|
||||
$ss->assign("fields",$fieldlist);
|
||||
$ss->assign("form_name",'importstep3');
|
||||
$ss->assign("bean",$focus);
|
||||
|
||||
// add in any additional strings
|
||||
$ss->assign("MOD", $mod_strings);
|
||||
$ss->assign("APP", $app_strings);
|
||||
return $ss->fetch($file);
|
||||
}
|
||||
124
modules/Import/ImportCacheFiles.php
Executable file
124
modules/Import/ImportCacheFiles.php
Executable file
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: Static class to that is used to get the filenames for the various
|
||||
* cache files used
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
class ImportCacheFiles
|
||||
{
|
||||
/**
|
||||
* Returns the filename for a temporary file
|
||||
*
|
||||
* @param string $type string to prepend to the filename, typically to indicate the file's use
|
||||
* @return string filename
|
||||
*/
|
||||
private static function _createFileName(
|
||||
$type = 'misc'
|
||||
)
|
||||
{
|
||||
global $sugar_config, $current_user;
|
||||
|
||||
if( !is_dir($sugar_config['import_dir']) )
|
||||
create_cache_directory(preg_replace('/^cache\//','',$sugar_config['import_dir']));
|
||||
|
||||
if( !is_writable($sugar_config['import_dir']) )
|
||||
return false;
|
||||
|
||||
return "{$sugar_config['import_dir']}{$type}_{$current_user->id}.csv";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the duplicates filename
|
||||
*
|
||||
* @return string filename
|
||||
*/
|
||||
public static function getDuplicateFileName()
|
||||
{
|
||||
return self::_createFileName("dupes");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the error filename
|
||||
*
|
||||
* @return string filename
|
||||
*/
|
||||
public static function getErrorFileName()
|
||||
{
|
||||
return self::_createFileName("error");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the error records filename
|
||||
*
|
||||
* @return string filename
|
||||
*/
|
||||
public static function getErrorRecordsFileName()
|
||||
{
|
||||
return self::_createFileName("errorrecords");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the status filename
|
||||
*
|
||||
* @return string filename
|
||||
*/
|
||||
public static function getStatusFileName()
|
||||
{
|
||||
return self::_createFileName("status");
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out all cache files in the $sugar_config['import_dir'] directory
|
||||
*/
|
||||
public static function clearCacheFiles()
|
||||
{
|
||||
global $sugar_config;
|
||||
|
||||
if ( is_dir($sugar_config['import_dir']) ) {
|
||||
$files = dir($sugar_config['import_dir']);
|
||||
while (false !== ($file = $files->read())) {
|
||||
if ( !is_dir($file) && stristr($file,'.csv') )
|
||||
unlink($sugar_config['import_dir'].$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
172
modules/Import/ImportDuplicateCheck.php
Executable file
172
modules/Import/ImportDuplicateCheck.php
Executable file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: Handles getting a list of fields to duplicate check and doing the duplicate checks
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
class ImportDuplicateCheck
|
||||
{
|
||||
/**
|
||||
* Private reference to the bean we're dealing with
|
||||
*/
|
||||
private $_focus;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object $focus bean
|
||||
*/
|
||||
public function __construct(
|
||||
&$focus
|
||||
)
|
||||
{
|
||||
$this->_focus = &$focus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of indices for the current module
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function _getIndexVardefs()
|
||||
{
|
||||
$indexes = $this->_focus->getIndices();
|
||||
|
||||
if ( $this->_focus->getFieldDefinition('email1') )
|
||||
$indexes[] = array(
|
||||
'name' => 'special_idx_email1',
|
||||
'type' => 'index',
|
||||
'fields' => array('email1')
|
||||
);
|
||||
if ( $this->_focus->getFieldDefinition('email2') )
|
||||
$indexes[] = array(
|
||||
'name' => 'special_idx_email2',
|
||||
'type' => 'index',
|
||||
'fields' => array('email2')
|
||||
);
|
||||
|
||||
return $indexes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with an element for each index
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDuplicateCheckIndexes()
|
||||
{
|
||||
$super_language_pack = sugarArrayMerge(
|
||||
return_module_language($GLOBALS['current_language'], $this->_focus->module_dir),
|
||||
$GLOBALS['app_strings']
|
||||
);
|
||||
|
||||
$index_array = array();
|
||||
foreach ($this->_getIndexVardefs() as $index){
|
||||
if ($index['type'] == "index"){
|
||||
$labelsArray = array();
|
||||
foreach ($index['fields'] as $field){
|
||||
if ($field == 'deleted') continue;
|
||||
$fieldDef = $this->_focus->getFieldDefinition($field);
|
||||
if ( isset($fieldDef['vname']) && isset($super_language_pack[$fieldDef['vname']]) )
|
||||
$labelsArray[$fieldDef['name']] = $super_language_pack[$fieldDef['vname']];
|
||||
else
|
||||
$labelsArray[$fieldDef['name']] = $fieldDef['name'];
|
||||
}
|
||||
$index_array[$index['name']] = str_replace(":", "",implode(", ",$labelsArray));
|
||||
}
|
||||
}
|
||||
|
||||
return $index_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the given bean is a duplicate based off the given indexes
|
||||
*
|
||||
* @param array $indexlist
|
||||
* @return bool true if this bean is a duplicate or false if it isn't
|
||||
*/
|
||||
public function isADuplicateRecord(
|
||||
$indexlist
|
||||
)
|
||||
{
|
||||
// loop through var def indexes and compare with selected indexes
|
||||
foreach ( $this->_getIndexVardefs() as $index ) {
|
||||
// if we get an index not in the indexlist, loop
|
||||
if ( !in_array($index['name'],$indexlist) )
|
||||
continue;
|
||||
|
||||
// This handles the special case of duplicate email checking
|
||||
if ( $index['name'] == 'special_idx_email1' || $index['name'] == 'special_idx_email2' ) {
|
||||
$emailAddress = new SugarEmailAddress();
|
||||
$email = $index['fields'][0];
|
||||
if ( $emailAddress->getCountEmailAddressByBean(
|
||||
$this->_focus->$email,
|
||||
$this->_focus,
|
||||
($index['name'] == 'special_idx_email1')
|
||||
) > 0 )
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
$index_fields = array('deleted' => '0');
|
||||
foreach($index['fields'] as $field){
|
||||
if ($field == 'deleted')
|
||||
continue;
|
||||
if (!in_array($field,$index_fields))
|
||||
if (strlen($this->_focus->$field) > 0)
|
||||
$index_fields[$field] = $this->_focus->$field;
|
||||
}
|
||||
|
||||
// if there are no valid fields in the index field list, loop
|
||||
if ( count($index_fields) <= 1 )
|
||||
continue;
|
||||
|
||||
$newfocus = loadBean($this->_focus->module_dir);
|
||||
$result = $newfocus->retrieve_by_string_fields($index_fields,true);
|
||||
|
||||
if ( !is_null($result) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
732
modules/Import/ImportFieldSanitize.php
Executable file
732
modules/Import/ImportFieldSanitize.php
Executable file
@@ -0,0 +1,732 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: class for sanitizing field values
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
require_once('modules/Import/ImportFile.php');
|
||||
|
||||
class ImportFieldSanitize
|
||||
{
|
||||
/**
|
||||
* properties set to handle locale formatting
|
||||
*/
|
||||
public $dateformat;
|
||||
public $timeformat;
|
||||
public $timezone;
|
||||
public $currency_symbol;
|
||||
public $default_currency_significant_digits;
|
||||
public $num_grp_sep;
|
||||
public $dec_sep;
|
||||
public $default_locale_name_format;
|
||||
|
||||
/**
|
||||
* array of modules/users_last_import ids pairs that are created in this class
|
||||
* needs to be reset after the row is imported
|
||||
*/
|
||||
public static $createdBeans = array();
|
||||
|
||||
/**
|
||||
* Validate boolean fields
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function bool(
|
||||
$value,
|
||||
$vardef
|
||||
)
|
||||
{
|
||||
$bool_values = array(0=>'0',1=>'no',2=>'off',3=>'n',4=>'yes',5=>'y',6=>'on',7=>'1');
|
||||
$bool_search = array_search($value,$bool_values);
|
||||
if ( $bool_search === false ) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
//Convert all the values to a real bool.
|
||||
$value = (int) ( $bool_search > 3 );
|
||||
}
|
||||
if ( isset($vardef['dbType']) && $vardef['dbType'] == 'varchar' )
|
||||
$value = ( $value ? 'on' : 'off' );
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate currency fields
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function currency(
|
||||
$value,
|
||||
$vardef
|
||||
)
|
||||
{
|
||||
$value = str_replace($this->currency_symbol,"",$value);
|
||||
|
||||
return $this->float($value,$vardef);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate datetimecombo fields
|
||||
*
|
||||
* @see ImportFieldSanitize::datetime()
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function datetimecombo(
|
||||
$value,
|
||||
$vardef
|
||||
)
|
||||
{
|
||||
return $this->datetime($value,$vardef);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate datetime fields
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function datetime(
|
||||
$value,
|
||||
$vardef
|
||||
)
|
||||
{
|
||||
global $timedate;
|
||||
$value = preg_replace('/\s([pm|PM|am|AM]+)/', '\1', $value);
|
||||
$format = $this->dateformat . ' ' . $this->timeformat;
|
||||
|
||||
if ( !$timedate->check_matching_format($value, $format) ) {
|
||||
// see if adding a valid time at the end makes it work
|
||||
list($dateformat,$timeformat) = explode(' ',$format);
|
||||
$value .= ' ' . date($timeformat,0);
|
||||
if ( !$timedate->check_matching_format($value, $format) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$this->isValidTimeDate($value, $format) )
|
||||
return false;
|
||||
|
||||
$value = $timedate->swap_formats(
|
||||
$value, $format, $timedate->get_date_time_format());
|
||||
$value = $timedate->handle_offset(
|
||||
$value, $timedate->get_date_time_format(), false, $GLOBALS['current_user'], $this->timezone);
|
||||
$value = $timedate->swap_formats(
|
||||
$value, $timedate->get_date_time_format(), $timedate->get_db_date_time_format() );
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate date fields
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function date(
|
||||
$value,
|
||||
$vardef
|
||||
)
|
||||
{
|
||||
global $timedate;
|
||||
|
||||
$format = $this->dateformat;
|
||||
|
||||
if ( !$timedate->check_matching_format($value, $format) )
|
||||
return false;
|
||||
|
||||
if ( !$this->isValidTimeDate($value, $format) )
|
||||
return false;
|
||||
|
||||
$value = $timedate->swap_formats(
|
||||
$value, $format, $timedate->get_date_format());
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate email fields
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function email(
|
||||
$value,
|
||||
$vardef
|
||||
)
|
||||
{
|
||||
if ( !empty($value) && !preg_match('/^\w+(?:[\'.\-+]\w+)*@\w+(?:[.\-]\w+)*(?:[.]\w{2,})+$/',$value) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate enum fields
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function enum(
|
||||
$value,
|
||||
$vardef
|
||||
)
|
||||
{
|
||||
global $app_list_strings;
|
||||
|
||||
// Bug 27467 - Trim the value given
|
||||
$value = trim($value);
|
||||
|
||||
if ( isset($app_list_strings[$vardef['options']])
|
||||
&& !isset($app_list_strings[$vardef['options']][$value]) ) {
|
||||
// Bug 23485/23198 - Check to see if the value passed matches the display value
|
||||
if ( in_array($value,$app_list_strings[$vardef['options']]) )
|
||||
$value = array_search($value,$app_list_strings[$vardef['options']]);
|
||||
// Bug 33328 - Check for a matching key in a different case
|
||||
elseif ( in_array(strtolower($value), array_keys(array_change_key_case($app_list_strings[$vardef['options']]))) ) {
|
||||
foreach ( $app_list_strings[$vardef['options']] as $optionkey => $optionvalue )
|
||||
if ( strtolower($value) == strtolower($optionkey) )
|
||||
$value = $optionkey;
|
||||
}
|
||||
// Bug 33328 - Check for a matching value in a different case
|
||||
elseif ( in_array(strtolower($value), array_map('strtolower', $app_list_strings[$vardef['options']])) ) {
|
||||
foreach ( $app_list_strings[$vardef['options']] as $optionkey => $optionvalue )
|
||||
if ( strtolower($value) == strtolower($optionvalue) )
|
||||
$value = $optionkey;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate float fields
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function float(
|
||||
$value,
|
||||
$vardef
|
||||
)
|
||||
{
|
||||
$value = str_replace($this->num_grp_sep,"",$value);
|
||||
$dec_sep = $this->dec_sep;
|
||||
if ( $dec_sep != '.' ) {
|
||||
$value = str_replace($dec_sep,".",$value);
|
||||
}
|
||||
if ( !is_numeric($value) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Split full_name field into first_name and last_name
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @param $focus object bean of the module we're importing into
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function fullname(
|
||||
$value,
|
||||
$vardef,
|
||||
&$focus
|
||||
)
|
||||
{
|
||||
if ( property_exists($focus,'first_name') && property_exists($focus,'last_name') ) {
|
||||
$name_arr = preg_split('/\s+/',$value);
|
||||
|
||||
if ( count($name_arr) == 1) {
|
||||
$focus->last_name = $value;
|
||||
}
|
||||
else {
|
||||
// figure out what comes first, the last name or first name
|
||||
if ( strpos($this->default_locale_name_format,'l') > strpos($this->default_locale_name_format,'f') ) {
|
||||
$focus->first_name = array_shift($name_arr);
|
||||
$focus->last_name = join(' ',$name_arr);
|
||||
}
|
||||
else {
|
||||
$focus->last_name = array_shift($name_arr);
|
||||
$focus->first_name = join(' ',$name_arr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate id fields
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function id(
|
||||
$value,
|
||||
$vardef
|
||||
)
|
||||
{
|
||||
if ( strlen($value) > 36 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate int fields
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function int(
|
||||
$value,
|
||||
$vardef
|
||||
)
|
||||
{
|
||||
$value = str_replace($this->num_grp_sep,"",$value);
|
||||
if (!is_numeric($value) || strstr($value,".")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate multienum fields
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function multienum(
|
||||
$value,
|
||||
$vardef
|
||||
)
|
||||
{
|
||||
if(!empty($value) && is_array($value)) {
|
||||
$enum_list = $value;
|
||||
}
|
||||
else {
|
||||
// If someone was using the old style multienum import technique
|
||||
$value = str_replace("^","",$value);
|
||||
|
||||
// We will need to break it apart to put test it.
|
||||
$enum_list = explode(",",$value);
|
||||
}
|
||||
// parse to see if all the values given are valid
|
||||
foreach ( $enum_list as $enum_value ) {
|
||||
if ( $this->enum($enum_value,$vardef) === false ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$value = encodeMultienumValue($enum_list);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate name fields
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function name(
|
||||
$value,
|
||||
$vardef
|
||||
)
|
||||
{
|
||||
if( isset($vardef['len']) ) {
|
||||
// check for field length
|
||||
$value = sugar_substr($value, $vardef['len']);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate num fields
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function num(
|
||||
$value,
|
||||
$vardef
|
||||
)
|
||||
{
|
||||
return $this->int($value,$vardef);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate parent fields
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @param $focus object bean of the module we're importing into
|
||||
* @param $addRelatedBean bool true if we want to add the related bean if it is not found
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function parent(
|
||||
$value,
|
||||
$vardef,
|
||||
&$focus,
|
||||
$addRelatedBean = true
|
||||
)
|
||||
{
|
||||
global $beanList;
|
||||
|
||||
if ( isset($vardef['type_name']) ) {
|
||||
$moduleName = $vardef['type_name'];
|
||||
if ( isset($focus->$moduleName) && isset($beanList[$focus->$moduleName]) ) {
|
||||
$vardef['module'] = $focus->$moduleName;
|
||||
$vardef['rname'] = 'name';
|
||||
$relatedBean = loadBean($focus->$moduleName);
|
||||
$vardef['table'] = $relatedBean->table_name;
|
||||
return $this->relate($value,$vardef,$focus,$addRelatedBean);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate relate fields
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @param $focus object bean of the module we're importing into
|
||||
* @param $addRelatedBean bool true if we want to add the related bean if it is not found
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function relate(
|
||||
$value,
|
||||
$vardef,
|
||||
&$focus,
|
||||
$addRelatedBean = true
|
||||
)
|
||||
{
|
||||
if ( !isset($vardef['module']) )
|
||||
return false;
|
||||
$newbean = loadBean($vardef['module']);
|
||||
|
||||
// Bug 38885 - If we are relating to the Users table on user_name, there's a good chance
|
||||
// that the related field data is the full_name, rather than the user_name. So to be sure
|
||||
// let's try to lookup the field the relationship is expecting to use (user_name).
|
||||
if ( $vardef['module'] == 'Users' && $vardef['rname'] == 'user_name' ) {
|
||||
$userFocus = new User;
|
||||
$userFocus->retrieve_by_string_fields(
|
||||
array($userFocus->db->concat('users',array('first_name','last_name')) => $value ));
|
||||
if ( !empty($userFocus->id) ) {
|
||||
$value = $userFocus->user_name;
|
||||
}
|
||||
}
|
||||
|
||||
// Bug 32869 - Assumed related field name is 'name' if it is not specified
|
||||
if ( !isset($vardef['rname']) )
|
||||
$vardef['rname'] = 'name';
|
||||
|
||||
// Bug 27046 - Validate field against type as it is in the related field
|
||||
$rvardef = $newbean->getFieldDefinition($vardef['rname']);
|
||||
if ( isset($rvardef['type'])
|
||||
&& method_exists($this,$rvardef['type']) ) {
|
||||
$fieldtype = $rvardef['type'];
|
||||
$returnValue = $this->$fieldtype($value,$rvardef,$focus,$addRelatedBean);
|
||||
if ( !$returnValue )
|
||||
return false;
|
||||
else
|
||||
$value = $returnValue;
|
||||
}
|
||||
|
||||
if ( isset($vardef['id_name']) ) {
|
||||
$idField = $vardef['id_name'];
|
||||
|
||||
// Bug 24075 - clear out id field value if it is invalid
|
||||
if ( isset($focus->$idField) ) {
|
||||
$checkfocus = loadBean($vardef['module']);
|
||||
if ( $checkfocus && is_null($checkfocus->retrieve($focus->$idField)) )
|
||||
$focus->$idField = '';
|
||||
}
|
||||
|
||||
// Bug 38356 - Populate the table entry in the vardef from the bean information in case it's not provided
|
||||
if (!isset($vardef['table'])) {
|
||||
// Set target module table as the default table name
|
||||
$tmpfocus = loadBean($vardef['module']);
|
||||
$vardef['table'] = $tmpfocus->table_name;
|
||||
}
|
||||
|
||||
// be sure that the id isn't already set for this row
|
||||
if ( empty($focus->$idField)
|
||||
&& $idField != $vardef['name']
|
||||
&& !empty($vardef['rname'])
|
||||
&& !empty($vardef['table'])) {
|
||||
// Bug 27562 - Check db_concat_fields first to see if the field name is a concat
|
||||
$relatedFieldDef = $newbean->getFieldDefinition($vardef['rname']);
|
||||
if ( isset($relatedFieldDef['db_concat_fields'])
|
||||
&& is_array($relatedFieldDef['db_concat_fields']) )
|
||||
$fieldname = db_concat($vardef['table'],$relatedFieldDef['db_concat_fields']);
|
||||
else
|
||||
$fieldname = $vardef['rname'];
|
||||
// lookup first record that matches in linked table
|
||||
$query = "SELECT id
|
||||
FROM {$vardef['table']}
|
||||
WHERE {$fieldname} = '" . $focus->db->quote($value) . "'
|
||||
AND deleted != 1";
|
||||
|
||||
$result = $focus->db->limitQuery($query,0,1,true, "Want only a single row");
|
||||
if(!empty($result)){
|
||||
if ( $relaterow = $focus->db->fetchByAssoc($result) )
|
||||
$focus->$idField = $relaterow['id'];
|
||||
elseif ( !$addRelatedBean
|
||||
|| ( $newbean->bean_implements('ACL') && !$newbean->ACLAccess('save') )
|
||||
|| ( in_array($newbean->module_dir,array('Teams','Users')) )
|
||||
)
|
||||
return false;
|
||||
else {
|
||||
// add this as a new record in that bean, then relate
|
||||
if ( isset($relatedFieldDef['db_concat_fields'])
|
||||
&& is_array($relatedFieldDef['db_concat_fields']) ) {
|
||||
$relatedFieldParts = explode(' ',$value);
|
||||
foreach ($relatedFieldDef['db_concat_fields'] as $relatedField)
|
||||
$newbean->$relatedField = array_shift($relatedFieldParts);
|
||||
}
|
||||
else
|
||||
$newbean->$vardef['rname'] = $value;
|
||||
if ( !isset($focus->assigned_user_id) || $focus->assigned_user_id == '' )
|
||||
$newbean->assigned_user_id = $GLOBALS['current_user']->id;
|
||||
else
|
||||
$newbean->assigned_user_id = $focus->assigned_user_id;
|
||||
if ( !isset($focus->modified_user_id) || $focus->modified_user_id == '' )
|
||||
$newbean->modified_user_id = $GLOBALS['current_user']->id;
|
||||
else
|
||||
$newbean->modified_user_id = $focus->modified_user_id;
|
||||
|
||||
// populate fields from the parent bean to the child bean
|
||||
$focus->populateRelatedBean($newbean);
|
||||
|
||||
$newbean->save(false);
|
||||
$focus->$idField = $newbean->id;
|
||||
$this->createdBeans[] = ImportFile::writeRowToLastImport(
|
||||
$focus->module_dir,$newbean->object_name,$newbean->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate sync_to_outlook field
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @param $bad_names array used to return list of bad users/teams in $value
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function synctooutlook(
|
||||
$value,
|
||||
$vardef,
|
||||
&$bad_names
|
||||
)
|
||||
{
|
||||
static $focus_user;
|
||||
|
||||
// cache this object since we'll be reusing it a bunch
|
||||
if ( !($focus_user instanceof User) ) {
|
||||
|
||||
$focus_user = new User();
|
||||
}
|
||||
|
||||
|
||||
if ( !empty($value) && strtolower($value) != "all" ) {
|
||||
$theList = explode(",",$value);
|
||||
$isValid = true;
|
||||
$bad_names = array();
|
||||
foreach ($theList as $eachItem) {
|
||||
if ( $focus_user->retrieve_user_id($eachItem)
|
||||
|| $focus_user->retrieve($eachItem)
|
||||
) {
|
||||
// all good
|
||||
}
|
||||
else {
|
||||
$isValid = false;
|
||||
$bad_names[] = $eachItem;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(!$isValid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate time fields
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function time(
|
||||
$value,
|
||||
$vardef
|
||||
)
|
||||
{
|
||||
global $timedate;
|
||||
|
||||
$format = $this->timeformat;
|
||||
|
||||
if ( !$timedate->check_matching_format($value, $format) )
|
||||
return false;
|
||||
|
||||
if ( !$this->isValidTimeDate($value, $format) )
|
||||
return false;
|
||||
|
||||
$value = $timedate->swap_formats(
|
||||
$value, $format, $timedate->get_time_format());
|
||||
$value = $timedate->handle_offset(
|
||||
$value, $timedate->get_time_format(), false, $GLOBALS['current_user'], $this->timezone);
|
||||
$value = $timedate->handle_offset(
|
||||
$value, $timedate->get_time_format(), true);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate varchar fields
|
||||
*
|
||||
* @param $value string
|
||||
* @param $vardef array
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
public function varchar(
|
||||
$value,
|
||||
$vardef
|
||||
)
|
||||
{
|
||||
return $this->name($value,$vardef);
|
||||
}
|
||||
|
||||
/**
|
||||
* Added to handle Bug 24104, to make sure the date/time value is correct ( i.e. 20/20/2008 doesn't work )
|
||||
*
|
||||
* @param $value string
|
||||
* @param $format string
|
||||
* @return string sanitized and validated value on success, bool false on failure
|
||||
*/
|
||||
private function isValidTimeDate(
|
||||
$value,
|
||||
$format
|
||||
)
|
||||
{
|
||||
global $timedate;
|
||||
|
||||
$dateparts = array();
|
||||
$reg = $timedate->get_regular_expression($format);
|
||||
preg_match('@'.$reg['format'].'@', $value, $dateparts);
|
||||
|
||||
if ( isset($reg['positions']['a'])
|
||||
&& !in_array($dateparts[$reg['positions']['a']], array('am','pm')) )
|
||||
return false;
|
||||
if ( isset($reg['positions']['A'])
|
||||
&& !in_array($dateparts[$reg['positions']['A']], array('AM','PM')) )
|
||||
return false;
|
||||
if ( isset($reg['positions']['h']) && (
|
||||
!is_numeric($dateparts[$reg['positions']['h']])
|
||||
|| $dateparts[$reg['positions']['h']] < 1
|
||||
|| $dateparts[$reg['positions']['h']] > 12 ) )
|
||||
return false;
|
||||
if ( isset($reg['positions']['H']) && (
|
||||
!is_numeric($dateparts[$reg['positions']['H']])
|
||||
|| $dateparts[$reg['positions']['H']] < 0
|
||||
|| $dateparts[$reg['positions']['H']] > 23 ) )
|
||||
return false;
|
||||
if ( isset($reg['positions']['i']) && (
|
||||
!is_numeric($dateparts[$reg['positions']['i']])
|
||||
|| $dateparts[$reg['positions']['i']] < 0
|
||||
|| $dateparts[$reg['positions']['i']] > 59 ) )
|
||||
return false;
|
||||
if ( isset($reg['positions']['s']) && (
|
||||
!is_numeric($dateparts[$reg['positions']['s']])
|
||||
|| $dateparts[$reg['positions']['s']] < 0
|
||||
|| $dateparts[$reg['positions']['s']] > 59 ) )
|
||||
return false;
|
||||
if ( isset($reg['positions']['d']) && (
|
||||
!is_numeric($dateparts[$reg['positions']['d']])
|
||||
|| $dateparts[$reg['positions']['d']] < 1
|
||||
|| $dateparts[$reg['positions']['d']] > 31 ) )
|
||||
return false;
|
||||
if ( isset($reg['positions']['m']) && (
|
||||
!is_numeric($dateparts[$reg['positions']['m']])
|
||||
|| $dateparts[$reg['positions']['m']] < 1
|
||||
|| $dateparts[$reg['positions']['m']] > 12 ) )
|
||||
return false;
|
||||
if ( isset($reg['positions']['Y']) &&
|
||||
!is_numeric($dateparts[$reg['positions']['Y']]) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
326
modules/Import/ImportFile.php
Executable file
326
modules/Import/ImportFile.php
Executable file
@@ -0,0 +1,326 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: Class to handle processing an import file
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
require_once('modules/Import/ImportCacheFiles.php');
|
||||
|
||||
class ImportFile
|
||||
{
|
||||
/**
|
||||
* Delimiter string we are using (i.e. , or ;)
|
||||
*/
|
||||
private $_delimiter;
|
||||
|
||||
/**
|
||||
* Enclosure string we are using (i.e. ' or ")
|
||||
*/
|
||||
private $_enclosure;
|
||||
|
||||
/**
|
||||
* Stores whether or not we are deleting the import file in the destructor
|
||||
*/
|
||||
private $_deleteFile;
|
||||
|
||||
/**
|
||||
* File pointer returned from fopen() call
|
||||
*/
|
||||
private $_fp;
|
||||
|
||||
/**
|
||||
* Filename of file we are importing
|
||||
*/
|
||||
private $_filename;
|
||||
|
||||
/**
|
||||
* Array of the values in the current array we are in
|
||||
*/
|
||||
private $_currentRow;
|
||||
|
||||
/**
|
||||
* Count of rows processed
|
||||
*/
|
||||
private $_rowsCount = 0;
|
||||
|
||||
/**
|
||||
* Count of rows with errors
|
||||
*/
|
||||
private $_errorCount = 0;
|
||||
|
||||
/**
|
||||
* Count of duplicate rows
|
||||
*/
|
||||
private $_dupeCount = 0;
|
||||
|
||||
/**
|
||||
* Count of newly created rows
|
||||
*/
|
||||
private $_createdCount = 0;
|
||||
|
||||
/**
|
||||
* Count of updated rows
|
||||
*/
|
||||
private $_updatedCount = 0;
|
||||
|
||||
/**
|
||||
* True if the current row has already had an error it in, so we don't increase the $_errorCount
|
||||
*/
|
||||
private $_rowCountedForErrors = false;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $filename
|
||||
* @param string $delimiter
|
||||
* @param string $enclosure
|
||||
* @param bool $deleteFile
|
||||
*/
|
||||
public function __construct(
|
||||
$filename,
|
||||
$delimiter = ',',
|
||||
$enclosure = '',
|
||||
$deleteFile = true
|
||||
)
|
||||
{
|
||||
if ( !is_file($filename) || !is_readable($filename) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// turn on auto-detection of line endings to fix bug #10770
|
||||
ini_set('auto_detect_line_endings', '1');
|
||||
|
||||
$this->_fp = sugar_fopen($filename,'r');
|
||||
$this->_filename = $filename;
|
||||
$this->_deleteFile = $deleteFile;
|
||||
$this->_delimiter = ( empty($delimiter) ? ',' : $delimiter );
|
||||
$this->_enclosure = ( empty($enclosure) ? '' : trim($enclosure) );
|
||||
|
||||
// Bug 39494 - Remove the BOM (Byte Order Mark) from the beginning of the import row if it exists
|
||||
$bomCheck = fread($this->_fp, 3);
|
||||
if($bomCheck != pack("CCC",0xef,0xbb,0xbf)) {
|
||||
rewind($this->_fp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
* Deletes $_importFile if $_deleteFile is true
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
if ( $this->_deleteFile && $this->fileExists() ) {
|
||||
fclose($this->_fp);
|
||||
//Make sure the file exists before unlinking
|
||||
if(file_exists($this->_filename)) {
|
||||
unlink($this->_filename);
|
||||
}
|
||||
}
|
||||
|
||||
ini_restore('auto_detect_line_endings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the filename given exists and is readable
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function fileExists()
|
||||
{
|
||||
return !$this->_fp ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the next row from $_importFile
|
||||
*
|
||||
* @return array current row of file
|
||||
*/
|
||||
public function getNextRow()
|
||||
{
|
||||
if (!$this->fileExists())
|
||||
return false;
|
||||
|
||||
// explode on delimiter instead if enclosure is an empty string
|
||||
if ( empty($this->_enclosure) ) {
|
||||
$row = explode($this->_delimiter,rtrim(fgets($this->_fp, 8192),"\r\n"));
|
||||
if ($row !== false && !( count($row) == 1 && trim($row[0]) == '') )
|
||||
$this->_currentRow = $row;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$row = fgetcsv($this->_fp, 8192, $this->_delimiter, $this->_enclosure);
|
||||
if ($row !== false && $row != array(null))
|
||||
$this->_currentRow = $row;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
// Bug 26219 - Convert all line endings to the same style as PHP_EOL
|
||||
foreach ( $this->_currentRow as $key => $value )
|
||||
$this->_currentRow[$key] = str_replace(array("\r\n", "\n", "\r"),PHP_EOL,$value);
|
||||
|
||||
$this->_rowsCount++;
|
||||
$this->_rowCountedForErrors = false;
|
||||
|
||||
return $this->_currentRow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of fields in the current row
|
||||
*
|
||||
* @return int count of fiels in the current row
|
||||
*/
|
||||
public function getFieldCount()
|
||||
{
|
||||
return count($this->_currentRow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the row out to the ImportCacheFiles::getDuplicateFileName() file
|
||||
*/
|
||||
public function markRowAsDuplicate()
|
||||
{
|
||||
$fp = sugar_fopen(ImportCacheFiles::getDuplicateFileName(),'a');
|
||||
if ( empty($this->_enclosure) )
|
||||
fputs($fp,implode($this->_delimiter,$this->_currentRow).PHP_EOL);
|
||||
else
|
||||
fputcsv($fp,$this->_currentRow, $this->_delimiter, $this->_enclosure);
|
||||
fclose($fp);
|
||||
|
||||
$this->_dupeCount++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the row out to the ImportCacheFiles::getErrorFileName() file
|
||||
*
|
||||
* @param $error string
|
||||
* @param $fieldName string
|
||||
* @param $fieldValue mixed
|
||||
*/
|
||||
public function writeError(
|
||||
$error,
|
||||
$fieldName,
|
||||
$fieldValue
|
||||
)
|
||||
{
|
||||
$fp = sugar_fopen(ImportCacheFiles::getErrorFileName(),'a');
|
||||
fputcsv($fp,array($error,$fieldName,$fieldValue,$this->_rowsCount));
|
||||
fclose($fp);
|
||||
|
||||
if ( !$this->_rowCountedForErrors ) {
|
||||
$this->_errorCount++;
|
||||
$this->_rowCountedForErrors = true;
|
||||
$this->writeErrorRecord();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the row out to the ImportCacheFiles::getErrorRecordsFileName() file
|
||||
*/
|
||||
public function writeErrorRecord()
|
||||
{
|
||||
$fp = sugar_fopen(ImportCacheFiles::getErrorRecordsFileName(),'a');
|
||||
if ( empty($this->_enclosure) )
|
||||
fputs($fp,implode($this->_delimiter,$this->_currentRow).PHP_EOL);
|
||||
else
|
||||
fputcsv($fp,$this->_currentRow, $this->_delimiter, $this->_enclosure);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the totals and filename out to the ImportCacheFiles::getStatusFileName() file
|
||||
*/
|
||||
public function writeStatus()
|
||||
{
|
||||
$fp = sugar_fopen(ImportCacheFiles::getStatusFileName(),'a');
|
||||
fputcsv($fp,array($this->_rowsCount,$this->_errorCount,$this->_dupeCount,
|
||||
$this->_createdCount,$this->_updatedCount,$this->_filename));
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add this row to the UsersLastImport table
|
||||
*
|
||||
* @param string $import_module name of the module we are doing the import into
|
||||
* @param string $module name of the bean we are creating for this import
|
||||
* @param string $id id of the recorded created in the $module
|
||||
*/
|
||||
public static function writeRowToLastImport(
|
||||
$import_module,
|
||||
$module,
|
||||
$id
|
||||
)
|
||||
{
|
||||
// cache $last_import instance
|
||||
static $last_import;
|
||||
|
||||
if ( !($last_import instanceof UsersLastImport) )
|
||||
$last_import = new UsersLastImport();
|
||||
|
||||
$last_import->id = null;
|
||||
$last_import->deleted = null;
|
||||
$last_import->assigned_user_id = $GLOBALS['current_user']->id;
|
||||
$last_import->import_module = $import_module;
|
||||
if ( $module == 'Case' ) {
|
||||
$module = 'aCase';
|
||||
}
|
||||
$last_import->bean_type = $module;
|
||||
$last_import->bean_id = $id;
|
||||
return $last_import->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks whether this row created a new record or not
|
||||
*
|
||||
* @param $createdRecord bool true if record is created, false if it is just updated
|
||||
*/
|
||||
public function markRowAsImported(
|
||||
$createdRecord = true
|
||||
)
|
||||
{
|
||||
if ( $createdRecord )
|
||||
++$this->_createdCount;
|
||||
else
|
||||
++$this->_updatedCount;
|
||||
}
|
||||
}
|
||||
205
modules/Import/ImportFileSplitter.php
Executable file
205
modules/Import/ImportFileSplitter.php
Executable file
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: Class to handle splitting a file into seperate parts
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
class ImportFileSplitter
|
||||
{
|
||||
/**
|
||||
* Filename of file we are splitting
|
||||
*/
|
||||
private $_sourceFile;
|
||||
|
||||
/**
|
||||
* Count of files that we split the $_sourceFile into
|
||||
*/
|
||||
private $_fileCount;
|
||||
|
||||
/**
|
||||
* Count of records in $_sourceFile
|
||||
*/
|
||||
private $_recordCount;
|
||||
|
||||
/**
|
||||
* Maximum number of records per file
|
||||
*/
|
||||
private $_recordThreshold;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $source filename we are splitting
|
||||
*/
|
||||
public function __construct(
|
||||
$source = null,
|
||||
$recordThreshold = 1000
|
||||
)
|
||||
{
|
||||
// sanitize crazy values to the default value
|
||||
if ( !is_int($recordThreshold) || $recordThreshold < 1 ){
|
||||
//if this is not an int but is still a
|
||||
//string representation of a number, then cast to an int
|
||||
if(!is_int($recordThreshold) && is_numeric($recordThreshold)){
|
||||
//cast the string to an int
|
||||
$recordThreshold = (int)$recordThreshold;
|
||||
}else{
|
||||
//if not a numeric string, or less than 1, then default to 100
|
||||
$recordThreshold = 100;
|
||||
}
|
||||
}
|
||||
$this->_recordThreshold = $recordThreshold;
|
||||
$this->_sourceFile = $source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the filename given exists and is readable
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function fileExists()
|
||||
{
|
||||
if ( !is_file($this->_sourceFile) || !is_readable($this->_sourceFile)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually split the file into parts
|
||||
*
|
||||
* @param string $delimiter
|
||||
* @param string $enclosure
|
||||
* @param bool $has_header true if file has a header row
|
||||
*/
|
||||
public function splitSourceFile(
|
||||
$delimiter = ',',
|
||||
$enclosure = '"',
|
||||
$has_header = false
|
||||
)
|
||||
{
|
||||
if (!$this->fileExists())
|
||||
return false;
|
||||
$importFile = new ImportFile($this->_sourceFile,$delimiter,$enclosure,false);
|
||||
$filecount = 0;
|
||||
$fw = sugar_fopen("{$this->_sourceFile}-{$filecount}","w");
|
||||
$count = 0;
|
||||
// skip first row if we have a header row
|
||||
if ( $has_header && $importFile->getNextRow() ) {
|
||||
// mark as duplicate to stick header row in the dupes file
|
||||
$importFile->markRowAsDuplicate();
|
||||
// same for error records file
|
||||
$importFile->writeErrorRecord();
|
||||
}
|
||||
while ( $row = $importFile->getNextRow() ) {
|
||||
// after $this->_recordThreshold rows, close this import file and goto the next one
|
||||
if ( $count >= $this->_recordThreshold ) {
|
||||
fclose($fw);
|
||||
$filecount++;
|
||||
$fw = sugar_fopen("{$this->_sourceFile}-{$filecount}","w");
|
||||
$count = 0;
|
||||
}
|
||||
// Bug 25119: Trim the enclosure string to remove any blank spaces that may have been added.
|
||||
$enclosure = trim($enclosure);
|
||||
if(!empty($enclosure)) {
|
||||
foreach($row as $key => $v){
|
||||
$row[$key] =preg_replace("/$enclosure/","$enclosure$enclosure", $v);
|
||||
}
|
||||
}
|
||||
$line = $enclosure.implode($enclosure.$delimiter.$enclosure, $row).$enclosure.PHP_EOL;
|
||||
//Would normally use fputcsv() here. But when enclosure character is used and the field value doesn't include delimiter, enclosure, escape character, "\n", "\r", "\t", or " ", php default function 'fputcsv' will not use enclosure for this string.
|
||||
fputs($fw, $line);
|
||||
$count++;
|
||||
}
|
||||
|
||||
fclose($fw);
|
||||
$this->_fileCount = $filecount;
|
||||
$this->_recordCount = ($filecount * $this->_recordThreshold) + $count;
|
||||
// increment by one to get true count of files created
|
||||
++$this->_fileCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the count of records in the file, if it's been processed with splitSourceFile()
|
||||
*
|
||||
* @return int count of records in the file
|
||||
*/
|
||||
public function getRecordCount()
|
||||
{
|
||||
if ( !isset($this->_recordCount) )
|
||||
return false;
|
||||
|
||||
return $this->_recordCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the count of files created by the split, if it's been processed with splitSourceFile()
|
||||
*
|
||||
* @return int count of files created by the split
|
||||
*/
|
||||
public function getFileCount()
|
||||
{
|
||||
if ( !isset($this->_fileCount) )
|
||||
return false;
|
||||
|
||||
return $this->_fileCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return file name of one of the split files
|
||||
*
|
||||
* @param int $filenumber which split file we want
|
||||
*
|
||||
* @return string filename
|
||||
*/
|
||||
public function getSplitFileName(
|
||||
$filenumber = 0
|
||||
)
|
||||
{
|
||||
if ( $filenumber >= $this->getFileCount())
|
||||
return false;
|
||||
|
||||
return "{$this->_sourceFile}-{$filenumber}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
356
modules/Import/ImportMap.php
Executable file
356
modules/Import/ImportMap.php
Executable file
@@ -0,0 +1,356 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: Bean for import_map table
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
class ImportMap extends SugarBean
|
||||
{
|
||||
/**
|
||||
* Fields in the table
|
||||
*/
|
||||
public $id;
|
||||
public $name;
|
||||
public $module;
|
||||
public $source;
|
||||
public $delimiter;
|
||||
public $enclosure;
|
||||
public $content;
|
||||
public $default_values;
|
||||
public $has_header;
|
||||
public $deleted;
|
||||
public $date_entered;
|
||||
public $date_modified;
|
||||
public $assigned_user_id;
|
||||
public $is_published;
|
||||
|
||||
/**
|
||||
* Set the default settings from Sugarbean
|
||||
*/
|
||||
public $table_name = "import_maps";
|
||||
public $object_name = "ImportMap";
|
||||
public $module_dir = 'Import';
|
||||
public $new_schema = true;
|
||||
public $column_fields = array(
|
||||
"id",
|
||||
"name",
|
||||
"module",
|
||||
"source",
|
||||
"enclosure",
|
||||
"delimiter",
|
||||
"content",
|
||||
"has_header",
|
||||
"deleted",
|
||||
"date_entered",
|
||||
"date_modified",
|
||||
"assigned_user_id",
|
||||
"is_published",
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::SugarBean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with the field mappings
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMapping()
|
||||
{
|
||||
$mapping_arr = array();
|
||||
if ( !empty($this->content) )
|
||||
{
|
||||
$pairs = explode("&",$this->content);
|
||||
foreach ($pairs as $pair){
|
||||
list($name,$value) = explode("=",$pair);
|
||||
$mapping_arr[trim($name)] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $mapping_arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $content with the mapping given
|
||||
*
|
||||
* @param string $mapping_arr
|
||||
*/
|
||||
public function setMapping(
|
||||
$mapping_arr
|
||||
)
|
||||
{
|
||||
$output = array ();
|
||||
foreach ($mapping_arr as $key => $item) {
|
||||
$output[] = "$key=$item";
|
||||
}
|
||||
$this->content = implode("&", $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with the default field values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDefaultValues()
|
||||
{
|
||||
$defa_arr = array();
|
||||
if ( !empty($this->default_values) )
|
||||
{
|
||||
$pairs = explode("&",$this->default_values);
|
||||
foreach ($pairs as $pair){
|
||||
list($name,$value) = explode("=",$pair);
|
||||
$defa_arr[trim($name)] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $defa_arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $default_values with the default values given
|
||||
*
|
||||
* @param string $defa_arr
|
||||
*/
|
||||
public function setDefaultValues(
|
||||
$defa_arr
|
||||
)
|
||||
{
|
||||
$output = array ();
|
||||
foreach ($defa_arr as $key => $item) {
|
||||
$output[] = "$key=$item";
|
||||
}
|
||||
$this->default_values = implode("&", $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarBean::retrieve()
|
||||
*/
|
||||
public function retrieve($id = -1, $encode=true,$deleted=true)
|
||||
{
|
||||
$returnVal = parent::retrieve($id,$encode,$deleted);
|
||||
|
||||
if ( !($returnVal instanceOf $this) ) {
|
||||
return $returnVal;
|
||||
}
|
||||
|
||||
if ( $this->source == 'tab' && $this->delimiter == '' ) {
|
||||
$this->delimiter = "\t";
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save
|
||||
*
|
||||
* @param string $owner_id
|
||||
* @param string $name
|
||||
* @param string $module
|
||||
* @param string $source
|
||||
* @param string $has_header
|
||||
* @param string $delimiter
|
||||
* @param string $enclosure
|
||||
* @return bool
|
||||
*/
|
||||
public function save(
|
||||
$owner_id,
|
||||
$name,
|
||||
$module,
|
||||
$source,
|
||||
$has_header,
|
||||
$delimiter,
|
||||
$enclosure
|
||||
)
|
||||
{
|
||||
$olddefault_values = $this->default_values;
|
||||
$oldcontent = $this->content;
|
||||
|
||||
$this->retrieve_by_string_fields(
|
||||
array(
|
||||
'assigned_user_id'=>$owner_id,
|
||||
'name'=>$name),
|
||||
false
|
||||
);
|
||||
|
||||
// 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 ) $enclosure = ' ';
|
||||
|
||||
$this->assigned_user_id = $owner_id;
|
||||
$this->name = $name;
|
||||
$this->source = $source;
|
||||
$this->module = $module;
|
||||
$this->delimiter = $delimiter;
|
||||
$this->enclosure = $enclosure;
|
||||
$this->has_header = $has_header;
|
||||
$this->deleted = 0;
|
||||
$this->default_values = $olddefault_values;
|
||||
$this->content = $oldcontent;
|
||||
parent::save();
|
||||
|
||||
// Bug 29365 - The enclosure character isn't saved correctly if it's a tab using MssqlManager, so resave it
|
||||
if ( $enclosure == '\\t' && $this->db instanceOf MssqlManager ) {
|
||||
$this->enclosure = $enclosure;
|
||||
parent::save();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the user owns this mapping or is an admin first
|
||||
* If true, then call parent function
|
||||
*
|
||||
* @param $id
|
||||
*/
|
||||
public function mark_deleted(
|
||||
$id
|
||||
)
|
||||
{
|
||||
global $current_user;
|
||||
|
||||
if ( !is_admin($current_user) ) {
|
||||
$other_map = new ImportMap();
|
||||
$other_map->retrieve_by_string_fields(array('id'=> $id), false);
|
||||
|
||||
if ( $other_map->assigned_user_id != $current_user->id )
|
||||
return false;
|
||||
}
|
||||
|
||||
return parent::mark_deleted($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark an import map as published
|
||||
*
|
||||
* @param string $user_id
|
||||
* @param bool $flag true if we are publishing or false if we are unpublishing
|
||||
* @return bool
|
||||
*/
|
||||
public function mark_published(
|
||||
$user_id,
|
||||
$flag
|
||||
)
|
||||
{
|
||||
global $current_user;
|
||||
|
||||
if ( !is_admin($current_user) )
|
||||
return false;
|
||||
|
||||
// check for problems
|
||||
if ($flag) {
|
||||
// if you are trying to publish your map
|
||||
// but there's another published map
|
||||
// by the same name
|
||||
$query_arr = array(
|
||||
'name' =>$this->name,
|
||||
'is_published' =>'yes'
|
||||
);
|
||||
}
|
||||
else {
|
||||
// if you are trying to unpublish a map
|
||||
// but you own an unpublished map by the same name
|
||||
$query_arr = array(
|
||||
'name' => $this->name,
|
||||
'assigned_user_id' => $user_id,
|
||||
'is_published' => 'no'
|
||||
);
|
||||
}
|
||||
$other_map = new ImportMap();
|
||||
$other_map->retrieve_by_string_fields($query_arr, false);
|
||||
|
||||
// if we find this other map, quit
|
||||
if ( isset($other_map->id) )
|
||||
return false;
|
||||
|
||||
// otherwise update the is_published flag
|
||||
$query = "UPDATE $this->table_name
|
||||
SET is_published = '". ($flag?'yes':'no') . "',
|
||||
assigned_user_id = '$user_id'
|
||||
WHERE id = '{$this->id}'";
|
||||
|
||||
$this->db->query($query,true,"Error marking import map published: ");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to retrieve_by_string_fields, but returns multiple objects instead of just one.
|
||||
*
|
||||
* @param array $fields_array
|
||||
* @return array $obj_arr
|
||||
*/
|
||||
public function retrieve_all_by_string_fields(
|
||||
$fields_array
|
||||
)
|
||||
{
|
||||
$query = "SELECT *
|
||||
FROM {$this->table_name}
|
||||
" . $this->get_where($fields_array);
|
||||
|
||||
$result = $this->db->query($query,true," Error: ");
|
||||
$obj_arr = array();
|
||||
|
||||
while ($row = $this->db->fetchByAssoc($result,-1,FALSE) ) {
|
||||
$focus = new ImportMap();
|
||||
|
||||
foreach($this->column_fields as $field) {
|
||||
if(isset($row[$field])) {
|
||||
$focus->$field = $row[$field];
|
||||
}
|
||||
}
|
||||
$focus->fill_in_additional_detail_fields();
|
||||
$obj_arr[]=$focus;
|
||||
}
|
||||
|
||||
return $obj_arr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
128
modules/Import/ImportMapAct.php
Executable file
128
modules/Import/ImportMapAct.php
Executable file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: Holds import setting for ACT! files
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
require_once('modules/Import/ImportMapOther.php');
|
||||
|
||||
class ImportMapAct extends ImportMapOther
|
||||
{
|
||||
/**
|
||||
* String identifier for this import
|
||||
*/
|
||||
public $name = 'act';
|
||||
/**
|
||||
* Field delimiter
|
||||
*/
|
||||
public $delimiter = ',';
|
||||
/**
|
||||
* Field enclosure
|
||||
*/
|
||||
public $enclosure = '"';
|
||||
/**
|
||||
* Do we have a header?
|
||||
*/
|
||||
public $has_header = true;
|
||||
|
||||
/**
|
||||
* Gets the default mapping for a module
|
||||
*
|
||||
* @param string $module
|
||||
* @return array field mappings
|
||||
*/
|
||||
public function getMapping(
|
||||
$module
|
||||
)
|
||||
{
|
||||
$return_array = parent::getMapping($module);
|
||||
switch ($module) {
|
||||
case 'Contacts':
|
||||
case 'Leads':
|
||||
return $return_array + array(
|
||||
"Web Site"=>"website",
|
||||
"Company"=>"account_name",
|
||||
"Name Suffix"=>"salutation",
|
||||
"Address 1"=>"primary_address_street",
|
||||
"Address 2"=>"primary_address_street_2",
|
||||
"Address 3"=>"primary_address_street_3",
|
||||
"City"=>"primary_address_city",
|
||||
"State"=>"primary_address_state",
|
||||
"Zip"=>"primary_address_postalcode",
|
||||
"Country"=>"primary_address_country",
|
||||
"Phone"=>"phone_work",
|
||||
"Phone Ext-"=>"phone_work_ext",
|
||||
"Mobile Phone"=>"phone_mobile",
|
||||
"Alt Phone"=>"phone_other",
|
||||
"Fax"=>"phone_fax",
|
||||
"E-mail Login"=>"email1",
|
||||
"E-mail"=>"email1",
|
||||
"Assistant"=>"assistant",
|
||||
"Asst. Phone"=>"assistant_phone",
|
||||
"Home Address 1"=>"alt_address_street",
|
||||
"Home Address 2"=>"alt_address_street_2",
|
||||
"Home Address 3"=>"alt_address_street_3",
|
||||
"Home Zip"=>"alt_address_postalcode",
|
||||
"Home Country"=>"alt_address_country",
|
||||
"Home Phone"=>"phone_home",
|
||||
);
|
||||
break;
|
||||
case 'Accounts':
|
||||
return $return_array + array(
|
||||
"Revenue"=>"annual_revenue",
|
||||
"Number of Employees"=>"employees",
|
||||
"Address 1"=>"billing_address_street",
|
||||
"City"=>"billing_address_city",
|
||||
"State"=>"billing_address_state",
|
||||
"Zip Code"=>"billing_address_postalcode",
|
||||
"Country"=>"billing_address_country",
|
||||
"Phone"=>"phone_office",
|
||||
"Fax Phone"=>"phone_fax",
|
||||
"Ticker Symbol"=>"ticker_symbol",
|
||||
);
|
||||
break;
|
||||
default:
|
||||
return $return_array;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
61
modules/Import/ImportMapCsv.php
Executable file
61
modules/Import/ImportMapCsv.php
Executable file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: Holds import setting for CSV files
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
require_once('modules/Import/ImportMapOther.php');
|
||||
|
||||
class ImportMapCsv extends ImportMapOther
|
||||
{
|
||||
/**
|
||||
* String identifier for this import
|
||||
*/
|
||||
public $name = 'csv';
|
||||
/**
|
||||
* Field delimiter
|
||||
*/
|
||||
public $delimiter = ',';
|
||||
/**
|
||||
* Field enclosure
|
||||
*/
|
||||
public $enclosure;
|
||||
}
|
||||
?>
|
||||
156
modules/Import/ImportMapOther.php
Executable file
156
modules/Import/ImportMapOther.php
Executable file
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: Holds import setting for standard delimited files
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
class ImportMapOther
|
||||
{
|
||||
/**
|
||||
* String identifier for this import
|
||||
*/
|
||||
public $name = 'other';
|
||||
/**
|
||||
* Field delimiter
|
||||
*/
|
||||
public $delimiter;
|
||||
/**
|
||||
* Field enclosure
|
||||
*/
|
||||
public $enclosure;
|
||||
/**
|
||||
* Do we have a header?
|
||||
*/
|
||||
public $has_header = true;
|
||||
|
||||
/**
|
||||
* Gets the default mapping for a module
|
||||
*
|
||||
* @param string $module
|
||||
* @return array field mappings
|
||||
*/
|
||||
public function getMapping(
|
||||
$module
|
||||
)
|
||||
{
|
||||
switch ($module) {
|
||||
case 'Contacts':
|
||||
case 'Leads':
|
||||
return array(
|
||||
"Salutation"=>"salutation",
|
||||
"Full Name"=>"full_name",
|
||||
"Company"=>"company",
|
||||
"First Name"=>"first_name",
|
||||
"Last Name"=>"last_name",
|
||||
"Title"=>"title",
|
||||
"Department"=>"department",
|
||||
"Birthday"=>"birthdate",
|
||||
"Home Phone"=>"phone_home",
|
||||
"Mobile Phone"=>"phone_mobile",
|
||||
"Business Phone"=>"phone_work",
|
||||
"Other Phone"=>"phone_other",
|
||||
"Business Fax"=>"phone_fax",
|
||||
"E-mail Address"=>"email1",
|
||||
"E-mail 2"=>"email2",
|
||||
"Assistant's Name"=>"assistant",
|
||||
"Assistant's Phone"=>"assistant_phone",
|
||||
"Business Street"=>"primary_address_street",
|
||||
"Business Street 2"=>"primary_address_street_2",
|
||||
"Business Street 3"=>"primary_address_street_3",
|
||||
"Business City"=>"primary_address_city",
|
||||
"Business State"=>"primary_address_state",
|
||||
"Business Postal Code"=>"primary_address_postalcode",
|
||||
"Business Country/Region"=>"primary_address_country",
|
||||
"Home Street"=>"alt_address_street",
|
||||
"Home Street 2"=>"alt_address_street_2",
|
||||
"Home Street 3"=>"alt_address_street_3",
|
||||
"Home City"=>"alt_address_city",
|
||||
"Home State"=>"alt_address_state",
|
||||
"Home Postal Code"=>"alt_address_postalcode",
|
||||
"Home Country/Region"=>"alt_address_country",
|
||||
);
|
||||
break;
|
||||
case 'Accounts':
|
||||
return array(
|
||||
"Company"=>"name",
|
||||
"Business Street"=>"billing_address_street",
|
||||
"Business City"=>"billing_address_city",
|
||||
"Business State"=>"billing_address_state",
|
||||
"Business Country"=>"billing_address_country",
|
||||
"Business Postal Code"=>"billing_address_postalcode",
|
||||
"Business Fax"=>"phone_fax",
|
||||
"Company Main Phone"=>"phone_office",
|
||||
"Web Page"=>"website",
|
||||
);
|
||||
break;
|
||||
case 'Opportunities':
|
||||
return array(
|
||||
"Opportunity Name"=>"name" ,
|
||||
"Type"=>"opportunity_type",
|
||||
"Lead Source"=>"lead_source",
|
||||
"Amount"=>"amount",
|
||||
"Created Date"=>"date_entered",
|
||||
"Close Date"=>"date_closed",
|
||||
"Next Step"=>"next_step",
|
||||
"Stage"=>"sales_stage",
|
||||
"Probability (%)"=>"probability",
|
||||
"Account Name"=>"account_name");
|
||||
break;
|
||||
default:
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of fields that should be ignorred for the module during import
|
||||
*
|
||||
* @param string $module
|
||||
* @return array of fields to ignor
|
||||
*/
|
||||
public function getIgnoredFields(
|
||||
$module
|
||||
)
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
95
modules/Import/ImportMapOutlook.php
Executable file
95
modules/Import/ImportMapOutlook.php
Executable file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: Holds import setting for Outlook files
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
require_once('modules/Import/ImportMapOther.php');
|
||||
|
||||
class ImportMapOutlook extends ImportMapOther
|
||||
{
|
||||
/**
|
||||
* String identifier for this import
|
||||
*/
|
||||
public $name = 'outlook';
|
||||
/**
|
||||
* Field delimiter
|
||||
*/
|
||||
public $delimiter = ',';
|
||||
/**
|
||||
* Field enclosure
|
||||
*/
|
||||
public $enclosure = '"';
|
||||
/**
|
||||
* Do we have a header?
|
||||
*/
|
||||
public $has_header = true;
|
||||
|
||||
/**
|
||||
* Gets the default mapping for a module
|
||||
*
|
||||
* @param string $module
|
||||
* @return array field mappings
|
||||
*/
|
||||
public function getMapping(
|
||||
$module
|
||||
)
|
||||
{
|
||||
$return_array = parent::getMapping($module);
|
||||
switch ($module) {
|
||||
case 'Contacts':
|
||||
case 'Leads':
|
||||
return $return_array + array(
|
||||
"Job Title"=>"title",
|
||||
"Home Country"=>"alt_address_country",
|
||||
"E-mail 2 Address"=>"email2",
|
||||
);
|
||||
break;
|
||||
case 'Accounts':
|
||||
return $return_array;
|
||||
break;
|
||||
default:
|
||||
return $return_array;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
160
modules/Import/ImportMapSalesforce.php
Executable file
160
modules/Import/ImportMapSalesforce.php
Executable file
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: Holds import setting for Salesforce.com files
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
require_once('modules/Import/ImportMapOther.php');
|
||||
|
||||
class ImportMapSalesforce extends ImportMapOther
|
||||
{
|
||||
/**
|
||||
* String identifier for this import
|
||||
*/
|
||||
public $name = 'salesforce';
|
||||
/**
|
||||
* Field delimiter
|
||||
*/
|
||||
public $delimiter = ',';
|
||||
/**
|
||||
* Field enclosure
|
||||
*/
|
||||
public $enclosure = '"';
|
||||
/**
|
||||
* Do we have a header?
|
||||
*/
|
||||
public $has_header = true;
|
||||
|
||||
/**
|
||||
* Gets the default mapping for a module
|
||||
*
|
||||
* @param string $module
|
||||
* @return array field mappings
|
||||
*/
|
||||
public function getMapping(
|
||||
$module
|
||||
)
|
||||
{
|
||||
$return_array = parent::getMapping($module);
|
||||
switch ($module) {
|
||||
case 'Contacts':
|
||||
case 'Leads':
|
||||
return $return_array + array(
|
||||
"Description"=>"description",
|
||||
"Birthdate"=>"birthdate",
|
||||
"Lead Source"=>"lead_source",
|
||||
"Assistant"=>"assistant",
|
||||
"Asst. Phone"=>"assistant_phone",
|
||||
"Mailing Street"=>"primary_address_street",
|
||||
"Mailing Address Line1"=>"primary_address_street_2",
|
||||
"Mailing Address Line2"=>"primary_address_street_3",
|
||||
"Mailing Address Line3"=>"primary_address_street_4",
|
||||
"Mailing City"=>"primary_address_city",
|
||||
"Mailing State"=>"primary_address_state",
|
||||
"Mailing Zip/Postal Code"=>"primary_address_postalcode",
|
||||
"Mailing Country"=>"primary_address_country",
|
||||
"Other Street"=>"alt_address_street",
|
||||
"Other Address Line 1"=>"alt_address_street_2",
|
||||
"Other Address Line 2"=>"alt_address_street_3",
|
||||
"Other Address Line 3"=>"alt_address_street_4",
|
||||
"Other City"=>"alt_address_city",
|
||||
"Other State"=>"alt_address_state",
|
||||
"Other Zip/Postal Code"=>"alt_address_postalcode",
|
||||
"Other Country"=>"alt_address_country",
|
||||
"Phone"=>"phone_work",
|
||||
"Mobile"=>"phone_mobile",
|
||||
"Home Phone"=>"phone_home",
|
||||
"Other Phone"=>"phone_other",
|
||||
"Fax"=>"phone_fax",
|
||||
"Email"=>"email1",
|
||||
"Email Opt Out"=>"email_opt_out",
|
||||
"Do Not Call"=>"do_not_call",
|
||||
"Account Name"=>"account_name",
|
||||
);
|
||||
break;
|
||||
case 'Accounts':
|
||||
return array(
|
||||
"Account Name"=>"name",
|
||||
"Annual Revenue"=>"annual_revenue",
|
||||
"Type"=>"account_type",
|
||||
"Ticker Symbol"=>"ticker_symbol",
|
||||
"Rating"=>"rating",
|
||||
"Industry"=>"industry",
|
||||
"SIC Code"=>"sic_code",
|
||||
"Ownership"=>"ownership",
|
||||
"Employees"=>"employees",
|
||||
"Description"=>"description",
|
||||
"Billing Street"=>"billing_address_street",
|
||||
"Billing Address Line1"=>"billing_address_street_2",
|
||||
"Billing Address Line2"=>"billing_address_street_3",
|
||||
"Billing City"=>"billing_address_city",
|
||||
"Billing State"=>"billing_address_state",
|
||||
"Billing Zip/Postal Code"=>"billing_address_postalcode",
|
||||
"Billing Country"=>"billing_address_country",
|
||||
"Shipping Street"=>"shipping_address_street",
|
||||
"Shipping Address Line1"=>"shipping_address_street_2",
|
||||
"Shipping Address Line2"=>"shipping_address_street_3",
|
||||
"Shipping City"=>"shipping_address_city",
|
||||
"Shipping State"=>"shipping_address_state",
|
||||
"Shipping Zip/Postal Code"=>"shipping_address_postalcode",
|
||||
"Shipping Country"=>"shipping_address_country",
|
||||
"Phone"=>"phone_office",
|
||||
"Fax"=>"phone_fax",
|
||||
"Website"=>"website",
|
||||
);
|
||||
break;
|
||||
default:
|
||||
return $return_array;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ImportMapOther::getIgnoredFields()
|
||||
*/
|
||||
public function getIgnoredFields(
|
||||
$module
|
||||
)
|
||||
{
|
||||
return array_merge(parent::getIgnoredFields($module),array('id'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
63
modules/Import/ImportMapTab.php
Executable file
63
modules/Import/ImportMapTab.php
Executable file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: Holds import setting for TSV (Tab Delimited) files
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
require_once('modules/Import/ImportMapOther.php');
|
||||
|
||||
class ImportMapTab extends ImportMapOther
|
||||
{
|
||||
/**
|
||||
* String identifier for this import
|
||||
*/
|
||||
public $name = 'tab';
|
||||
/**
|
||||
* Field delimiter
|
||||
*/
|
||||
public $delimiter = "\t";
|
||||
/**
|
||||
* Field enclosure
|
||||
*/
|
||||
public $enclosure;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
46
modules/Import/Menu.php
Executable file
46
modules/Import/Menu.php
Executable file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: Menu for the Import module. Just inherits the menu used in
|
||||
* whatever module is being imported into.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
// we now handle the module menu via overriding the view's getMenu() method
|
||||
$module_menu = array();
|
||||
252
modules/Import/UsersLastImport.php
Executable file
252
modules/Import/UsersLastImport.php
Executable file
@@ -0,0 +1,252 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: Bean class for the users_last_import table
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
require_once('modules/Import/Forms.php');
|
||||
|
||||
class UsersLastImport extends SugarBean
|
||||
{
|
||||
/**
|
||||
* Fields in the table
|
||||
*/
|
||||
public $id;
|
||||
public $assigned_user_id;
|
||||
public $import_module;
|
||||
public $bean_type;
|
||||
public $bean_id;
|
||||
public $deleted;
|
||||
|
||||
/**
|
||||
* Set the default settings from Sugarbean
|
||||
*/
|
||||
public $module_dir = 'Import';
|
||||
public $table_name = "users_last_import";
|
||||
public $object_name = "UsersLastImport";
|
||||
public $column_fields = array(
|
||||
"id",
|
||||
"assigned_user_id",
|
||||
"bean_type",
|
||||
"bean_id",
|
||||
"deleted"
|
||||
);
|
||||
public $new_schema = true;
|
||||
public $additional_column_fields = Array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::SugarBean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Extends SugarBean::listviewACLHelper
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function listviewACLHelper()
|
||||
{
|
||||
$array_assign = parent::listviewACLHelper();
|
||||
$is_owner = false;
|
||||
if ( !ACLController::moduleSupportsACL('Accounts')
|
||||
|| ACLController::checkAccess('Accounts', 'view', $is_owner) ) {
|
||||
$array_assign['ACCOUNT'] = 'a';
|
||||
}
|
||||
else {
|
||||
$array_assign['ACCOUNT'] = 'span';
|
||||
}
|
||||
return $array_assign;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all the records for a particular user
|
||||
*
|
||||
* @param string $user_id user id of the user doing the import
|
||||
*/
|
||||
public function mark_deleted_by_user_id(
|
||||
$user_id
|
||||
)
|
||||
{
|
||||
$query = "DELETE FROM $this->table_name
|
||||
WHERE assigned_user_id = '$user_id'";
|
||||
$this->db->query($query,true,"Error marking last imported records deleted: ");
|
||||
}
|
||||
|
||||
/**
|
||||
* Undo a single record
|
||||
*
|
||||
* @param string $id specific users_last_import id to undo
|
||||
*/
|
||||
public function undoById(
|
||||
$id
|
||||
)
|
||||
{
|
||||
global $current_user;
|
||||
|
||||
$query1 = "SELECT bean_id, bean_type
|
||||
FROM users_last_import
|
||||
WHERE assigned_user_id = '$current_user->id'
|
||||
AND id = '$id'
|
||||
AND deleted=0";
|
||||
|
||||
$result1 = $this->db->query($query1);
|
||||
if ( !$result1 )
|
||||
return false;
|
||||
|
||||
while ( $row1 = $this->db->fetchByAssoc($result1))
|
||||
$this->_deleteRecord($row1['bean_id'],$row1['bean_type']);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undo an import
|
||||
*
|
||||
* @param string $module module being imported into
|
||||
*/
|
||||
public function undo(
|
||||
$module
|
||||
)
|
||||
{
|
||||
global $current_user;
|
||||
|
||||
$query1 = "SELECT bean_id, bean_type
|
||||
FROM users_last_import
|
||||
WHERE assigned_user_id = '$current_user->id'
|
||||
AND import_module = '$module'
|
||||
AND deleted=0";
|
||||
|
||||
$result1 = $this->db->query($query1);
|
||||
if ( !$result1 )
|
||||
return false;
|
||||
|
||||
while ( $row1 = $this->db->fetchByAssoc($result1))
|
||||
$this->_deleteRecord($row1['bean_id'],$row1['bean_type']);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a record in a bean
|
||||
*
|
||||
* @param $bean_id
|
||||
* @param $module
|
||||
*/
|
||||
protected function _deleteRecord(
|
||||
$bean_id,
|
||||
$module
|
||||
)
|
||||
{
|
||||
static $focus;
|
||||
|
||||
// load bean
|
||||
if ( !( $focus instanceof $module) ) {
|
||||
require_once($GLOBALS['beanFiles'][$module]);
|
||||
$focus = new $module;
|
||||
}
|
||||
|
||||
$result = $this->db->query(
|
||||
"DELETE FROM {$focus->table_name}
|
||||
WHERE id = '{$bean_id}'"
|
||||
);
|
||||
if (!$result)
|
||||
return false;
|
||||
// Bug 26318: Remove all created e-mail addresses ( from jchi )
|
||||
$result2 = $this->db->query(
|
||||
"SELECT email_address_id
|
||||
FROM email_addr_bean_rel
|
||||
WHERE email_addr_bean_rel.bean_id='{$bean_id}'
|
||||
AND email_addr_bean_rel.bean_module='{$focus->module_dir}'");
|
||||
$this->db->query(
|
||||
"DELETE FROM email_addr_bean_rel
|
||||
WHERE email_addr_bean_rel.bean_id='{$bean_id}'
|
||||
AND email_addr_bean_rel.bean_module='{$focus->module_dir}'"
|
||||
);
|
||||
|
||||
while ( $row2 = $this->db->fetchByAssoc($result2)) {
|
||||
if ( !$this->db->getOne(
|
||||
"SELECT email_address_id
|
||||
FROM email_addr_bean_rel
|
||||
WHERE email_address_id = '{$row2['email_address_id']}'") )
|
||||
$this->db->query(
|
||||
"DELETE FROM email_addresses
|
||||
WHERE id = '{$row2['email_address_id']}'");
|
||||
}
|
||||
|
||||
if ($focus->hasCustomFields())
|
||||
$this->db->query(
|
||||
"DELETE FROM {$focus->table_name}_cstm
|
||||
WHERE id_c = '{$bean_id}'");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of bean types created in the import
|
||||
*
|
||||
* @param string $module module being imported into
|
||||
*/
|
||||
public static function getBeansByImport(
|
||||
$module
|
||||
)
|
||||
{
|
||||
global $current_user;
|
||||
|
||||
$query1 = "SELECT DISTINCT bean_type
|
||||
FROM users_last_import
|
||||
WHERE assigned_user_id = '$current_user->id'
|
||||
AND import_module = '$module'
|
||||
AND deleted=0";
|
||||
|
||||
$result1 = $GLOBALS['db']->query($query1);
|
||||
if ( !$result1 )
|
||||
return array($module);
|
||||
|
||||
$returnarray = array();
|
||||
while ( $row1 = $GLOBALS['db']->fetchByAssoc($result1))
|
||||
$returnarray[] = $row1['bean_type'];
|
||||
|
||||
return $returnarray;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
95
modules/Import/controller.php
Executable file
95
modules/Import/controller.php
Executable file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: Controller for the Import module
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
require_once("modules/Import/Forms.php");
|
||||
|
||||
class ImportController extends SugarController
|
||||
{
|
||||
function action_index()
|
||||
{
|
||||
$this->action_Step1();
|
||||
}
|
||||
|
||||
function action_Step1()
|
||||
{
|
||||
$this->view = 'step1';
|
||||
}
|
||||
|
||||
function action_Step2()
|
||||
{
|
||||
$this->view = 'step2';
|
||||
}
|
||||
|
||||
function action_Step3()
|
||||
{
|
||||
$this->view = 'step3';
|
||||
}
|
||||
|
||||
function action_Step4()
|
||||
{
|
||||
$this->view = 'step4';
|
||||
}
|
||||
|
||||
function action_Last()
|
||||
{
|
||||
$this->view = 'last';
|
||||
}
|
||||
|
||||
function action_Undo()
|
||||
{
|
||||
$this->view = 'undo';
|
||||
}
|
||||
|
||||
function action_Error()
|
||||
{
|
||||
$this->view = 'error';
|
||||
}
|
||||
|
||||
function action_GetControl()
|
||||
{
|
||||
echo getControl($_REQUEST['import_module'],$_REQUEST['field_name']);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
||||
312
modules/Import/language/en_us.lang.php
Executable file
312
modules/Import/language/en_us.lang.php
Executable file
@@ -0,0 +1,312 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: Defines the English language pack for the base application.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
global $timedate;
|
||||
|
||||
$mod_strings = array (
|
||||
'LBL_GOOD_FILE' => 'Import File Read Successfully',
|
||||
'LBL_RECORDS_SKIPPED_DUE_TO_ERROR' => 'Records skipped due to error',
|
||||
'LBL_UPDATE_SUCCESSFULLY' => 'Records updated successfully',
|
||||
'LBL_SUCCESSFULLY_IMPORTED' => 'Records created successfully',
|
||||
'LBL_STEP_4_TITLE' => 'Step 4: Import File',
|
||||
'LBL_STEP_5_TITLE' => 'Step 5: View Results',
|
||||
'LBL_CUSTOM_ENCLOSURE' => 'Fields Qualified By:',
|
||||
'LBL_ERROR_UNABLE_TO_PUBLISH' => 'Unable to publish. There is another published Import map by the same name.',
|
||||
'LBL_ERROR_UNABLE_TO_UNPUBLISH' => 'Unable to un-publish a map owned by another user. You own an Import map by the same name.',
|
||||
'LBL_ERROR_IMPORTS_NOT_SET_UP' => 'Imports aren\'t set up for this module type',
|
||||
'LBL_IMPORT_TYPE' => 'Import Action',
|
||||
'LBL_IMPORT_BUTTON' => 'Create Records',
|
||||
'LBL_UPDATE_BUTTON' => 'Create and Update Records',
|
||||
'LBL_ERROR_INVALID_BOOL'=>'Invalid boolean value',
|
||||
'LBL_NO_ID' => 'ID Required',
|
||||
'LBL_PRE_CHECK_SKIPPED' => 'Pre-Check skipped',
|
||||
'LBL_IMPORT_ERROR' => 'Import errors:',
|
||||
'LBL_ERROR' => 'Error',
|
||||
'LBL_NOLOCALE_NEEDED' => 'No locale conversion needed',
|
||||
'LBL_FIELD_NAME' => 'Field Name',
|
||||
'LBL_VALUE' => 'Value',
|
||||
'LBL_ROW_NUMBER' => 'Row Number',
|
||||
'LBL_NONE' => 'None',
|
||||
'LBL_REQUIRED_VALUE' => 'Required value missing',
|
||||
'LBL_ID_EXISTS_ALREADY' => 'ID already exists in this table',
|
||||
'LBL_ASSIGNED_USER' => 'If the user does not exist use the current user',
|
||||
'LBL_SHOW_HIDDEN' => 'Show fields that are not normally importable',
|
||||
'LBL_UPDATE_RECORDS' => 'Update existing records instead of importing them (No Undo)',
|
||||
'LBL_TEST'=> 'Test Import (do not save or change data)',
|
||||
'LBL_TRUNCATE_TABLE' => 'Empty table before import (delete all records)',
|
||||
'LBL_RELATED_ACCOUNTS' => 'Do not create related accounts',
|
||||
'LBL_NO_DATECHECK' => 'Skip date check (faster but will fail if any date is wrong)',
|
||||
'LBL_NO_EMAILS' => 'Do not send out Email notifications during this import',
|
||||
'LBL_NO_PRECHECK' => 'Native Format mode',
|
||||
'LBL_STRICT_CHECKS' => 'Use strict ruleset (Check Email addresses and phone numbers too)',
|
||||
'LBL_ERROR_SELECTING_RECORD' => 'Error selecting record:',
|
||||
'LBL_ERROR_DELETING_RECORD' => 'Error deleting record:',
|
||||
'LBL_NOT_SET_UP' => 'Import is not set up for this module type',
|
||||
'LBL_ARE_YOU_SURE' => 'Are you sure? This will erase all data in this module.',
|
||||
'LBL_NO_RECORD' => 'No record with this ID to update',
|
||||
'LBL_NOT_SET_UP_FOR_IMPORTS' => 'Import is not set up for this module type',
|
||||
'LBL_DEBUG_MODE' => 'Enable debugging mode',
|
||||
'LBL_ERROR_INVALID_ID' => 'ID given is too long to fit in the field (maximum length is 36 characters)',
|
||||
'LBL_ERROR_INVALID_PHONE' => 'Invalid phone number',
|
||||
'LBL_ERROR_INVALID_NAME' => 'String too long to fit in the field',
|
||||
'LBL_ERROR_INVALID_VARCHAR' => 'String too long to fit in the field',
|
||||
'LBL_ERROR_INVALID_DATE' => 'Invalid date',
|
||||
'LBL_ERROR_INVALID_DATETIME' => 'Invalid datetime',
|
||||
'LBL_ERROR_INVALID_DATETIMECOMBO' => 'Invalid datetime',
|
||||
'LBL_ERROR_INVALID_TIME' => 'Invalid time',
|
||||
'LBL_ERROR_INVALID_INT' => 'Invalid integer value',
|
||||
'LBL_ERROR_INVALID_NUM' => 'Invalid numeric value',
|
||||
'LBL_ERROR_INVALID_TIME' => 'Invalid time',
|
||||
'LBL_ERROR_INVALID_EMAIL'=>'Invalid Email address',
|
||||
'LBL_ERROR_INVALID_BOOL'=>'Invalid value (should be a 1 or 0)',
|
||||
'LBL_ERROR_INVALID_DATE'=>'Invalid date string',
|
||||
'LBL_ERROR_INVALID_USER'=>'Invalid user name or ID',
|
||||
'LBL_ERROR_INVALID_TEAM' => 'Invalid team name or ID',
|
||||
'LBL_ERROR_INVALID_ACCOUNT' => 'Invalid account name or ID',
|
||||
'LBL_ERROR_INVALID_RELATE' => 'Invalid relational field',
|
||||
'LBL_ERROR_INVALID_CURRENCY' => 'Invalid currency value',
|
||||
'LBL_ERROR_INVALID_FLOAT' => 'Invalid floating point number',
|
||||
'LBL_ERROR_NOT_IN_ENUM' => 'Value not in dropDown list. Allowed values are: ',
|
||||
'LBL_NOT_MULTIENUM' => 'Not a MultiEnum',
|
||||
'LBL_IMPORT_MODULE_NO_TYPE' => 'Import is not set up for this module type',
|
||||
'LBL_IMPORT_MODULE_NO_USERS' => 'WARNING: You have no users defined on your system. If you import without adding users first, all records will be owned by the Administrator.',
|
||||
'LBL_IMPORT_MODULE_MAP_ERROR' => 'Unable to publish. There is another published Import Map by the same name.',
|
||||
'LBL_IMPORT_MODULE_MAP_ERROR2' => 'Unable to un-publish a map owned by another user. You own an Import Map by the same name.',
|
||||
'LBL_IMPORT_MODULE_NO_DIRECTORY' => 'The directory ',
|
||||
'LBL_IMPORT_MODULE_NO_DIRECTORY_END' => ' does not exist or is not writable',
|
||||
'LBL_IMPORT_MODULE_ERROR_NO_UPLOAD' => 'File was not uploaded successfully. It may be that the \'upload_max_filesize\' setting in your php.ini file is set to a small number',
|
||||
'LBL_IMPORT_MODULE_ERROR_LARGE_FILE' => 'File is too large. Max:',
|
||||
'LBL_IMPORT_MODULE_ERROR_LARGE_FILE_END' => 'Bytes. Change $sugar_config[\'upload_maxsize\'] in config.php',
|
||||
'LBL_MODULE_NAME' => 'Import',
|
||||
'LBL_TRY_AGAIN' => 'Try Again',
|
||||
'LBL_ERROR' => 'Error:',
|
||||
'ERR_IMPORT_SYSTEM_ADMININSTRATOR' => 'You cannot import a system administrator user',
|
||||
'ERR_MULTIPLE' => 'Multiple columns have been defined with the same field name.',
|
||||
'ERR_MISSING_REQUIRED_FIELDS' => 'Missing required fields:',
|
||||
'ERR_MISSING_MAP_NAME' => 'Missing custom mapping name',
|
||||
'ERR_SELECT_FULL_NAME' => 'You cannot select Full Name when First Name and Last Name are selected.',
|
||||
'ERR_SELECT_FILE' => 'Select a file to upload.',
|
||||
'LBL_SELECT_FILE' => 'Select file:',
|
||||
'LBL_CUSTOM' => 'Custom',
|
||||
'LBL_CUSTOM_CSV' => 'Custom comma delimited file',
|
||||
'LBL_CSV' => 'Comma delimited file',
|
||||
'LBL_TAB' => 'Tab delimited file',
|
||||
'LBL_CUSTOM_DELIMITED' => 'Custom delimited file',
|
||||
'LBL_CUSTOM_DELIMITER' => 'Fields Delimited By:',
|
||||
'LBL_FILE_OPTIONS' => 'File options',
|
||||
'LBL_CUSTOM_TAB' => 'Custom tab delimited file',
|
||||
'LBL_DONT_MAP' => '-- Do not map this field --',
|
||||
'LBL_STEP_1_TITLE' => 'Step 1: Select Data Source and Import Action',
|
||||
'LBL_WHAT_IS' => 'What is the Data Source?',
|
||||
'LBL_MICROSOFT_OUTLOOK' => 'Microsoft Outlook',
|
||||
'LBL_ACT' => 'Act!',
|
||||
'LBL_SALESFORCE' => 'Salesforce.com',
|
||||
'LBL_MY_SAVED' => 'My Saved Mappings:',
|
||||
'LBL_PUBLISH' => 'Publish',
|
||||
'LBL_DELETE' => 'Delete',
|
||||
'LBL_PUBLISHED_SOURCES' => 'Published Mappings:',
|
||||
'LBL_UNPUBLISH' => 'Un-Publish',
|
||||
'LBL_NEXT' => 'Next >',
|
||||
'LBL_BACK' => '< Back',
|
||||
'LBL_STEP_2_TITLE' => 'Step 2: Upload Import File',
|
||||
'LBL_HAS_HEADER' => 'Has Header:',
|
||||
'LBL_NUM_1' => '1.',
|
||||
'LBL_NUM_2' => '2.',
|
||||
'LBL_NUM_3' => '3.',
|
||||
'LBL_NUM_4' => '4.',
|
||||
'LBL_NUM_5' => '5.',
|
||||
'LBL_NUM_6' => '6.',
|
||||
'LBL_NUM_7' => '7.',
|
||||
'LBL_NUM_8' => '8.',
|
||||
'LBL_NUM_9' => '9.',
|
||||
'LBL_NUM_10' => '10.',
|
||||
'LBL_NUM_11' => '11.',
|
||||
'LBL_NUM_12' => '12.',
|
||||
'LBL_NOTES' => 'Notes:',
|
||||
'LBL_NOW_CHOOSE' => 'Now choose that file to import:',
|
||||
'LBL_IMPORT_OUTLOOK_TITLE' => 'Microsoft Outlook 98 and 2000 can export data in the <b>Comma Separated Values</b> format, which can be used to import data into the system. To export your data from Outlook, follow the steps below:',
|
||||
'LBL_OUTLOOK_NUM_1' => 'Start <b>Outlook</b>',
|
||||
'LBL_OUTLOOK_NUM_2' => 'Select the <b>File</b> menu, then the <b>Import and Export ...</b> menu option',
|
||||
'LBL_OUTLOOK_NUM_3' => 'Choose <b>Export to a file</b> and click Next',
|
||||
'LBL_OUTLOOK_NUM_4' => 'Choose <b>Comma Separated Values (Windows)</b> and click <b>Next</b>.<br> Note: You may be prompted to install the export component',
|
||||
'LBL_OUTLOOK_NUM_5' => 'Select the <b>Contacts</b> folder and click <b>Next</b>. You can select different contacts folders if your contacts are stored in multiple folders',
|
||||
'LBL_OUTLOOK_NUM_6' => 'Choose a filename and click <b>Next</b>',
|
||||
'LBL_OUTLOOK_NUM_7' => 'Click <b>Finish</b>',
|
||||
'LBL_IMPORT_SF_TITLE' => 'Salesforce.com can export data in the <b>Comma Separated Values</b> format, which can be used to import data into the system. To export your data from Salesforce.com, follow the steps below:',
|
||||
'LBL_SF_NUM_1' => 'Open your browser, go to http://www.salesforce.com, and login with your email address and password',
|
||||
'LBL_SF_NUM_2' => 'Click on the <b>Reports</b> tab on the top menu',
|
||||
'LBL_SF_NUM_3' => '<b>To export Accounts:</b> Click on the <b>Active Accounts</b> link<br><b>To export Contacts:</b> Click on the <b>Mailing List</b> link',
|
||||
'LBL_SF_NUM_4' => 'On <b>Step 1: Select your report type</b>, select <b>Tabular Report</b> click <b>Next</b>',
|
||||
'LBL_SF_NUM_5' => 'On <b>Step 2: Select the report columns</b>, choose the columns you want to export and click <b>Next</b>',
|
||||
'LBL_SF_NUM_6' => 'On <b>Step 3: Select the information to summarize</b>, just click <b>Next</b>',
|
||||
'LBL_SF_NUM_7' => 'On <b>Step 4: Order the report columns</b>, just click <b>Next</b>',
|
||||
'LBL_SF_NUM_8' => 'On <b>Step 5: Select your report criteria</b>, under <b>Start Date</b>, choose a date far enough in the past to include all your Accounts. You can also export a subset of Accounts using more advanced criteria. When you are done, click <b>Run Report</b>',
|
||||
'LBL_SF_NUM_9' => 'A report will be generated, and the page will display <b>Report Generation Status: Complete.</b> Now click <b>Export to Excel</b>',
|
||||
'LBL_SF_NUM_10' => 'On <b>Export Report:</b>, for <b>Export File Format:</b>, choose <b>Comma Delimited .csv</b>. Click <b>Export</b>.',
|
||||
'LBL_SF_NUM_11' => 'A dialog will pop up for you to save the export file to your computer.',
|
||||
'LBL_IMPORT_ACT_TITLE' => 'Act! can export data in the <b>Comma Separated Values</b> format, which can be used to import data into the system. To export your data from Act!, follow the steps below:',
|
||||
'LBL_ACT_NUM_1' => 'Launch <b>ACT!</b>',
|
||||
'LBL_ACT_NUM_2' => 'Select the <b>File</b> menu, the <b>Data Exchange</b> menu option, then the <b>Export...</b> menu option',
|
||||
'LBL_ACT_NUM_3' => 'Select the file type <b>Text-Delimited</b>',
|
||||
'LBL_ACT_NUM_4' => 'Choose a filename and location for the exported data and click <b>Next</b>',
|
||||
'LBL_ACT_NUM_5' => 'Select <b>Contacts records only</b>',
|
||||
'LBL_ACT_NUM_6' => 'Click the <b>Options...</b> button',
|
||||
'LBL_ACT_NUM_7' => 'Select <b>Comma</b> as the field separator character',
|
||||
'LBL_ACT_NUM_8' => 'Check the <b>Yes, export field names</b> checkbox and click <b>OK</b>',
|
||||
'LBL_ACT_NUM_9' => 'Click <b>Next</b>',
|
||||
'LBL_ACT_NUM_10' => 'Select <b>All Records</b> and then click <b>Finish</b>',
|
||||
'LBL_IMPORT_CUSTOM_TITLE' => 'Many applications allow you to export data into a <b>Comma Delimited text file (.csv)</b> by following these general steps:',
|
||||
'LBL_CUSTOM_NUM_1' => 'Launch the application and open the data file',
|
||||
'LBL_CUSTOM_NUM_2' => 'Select the <b>Save As...</b> or <b>Export...</b> menu option',
|
||||
'LBL_CUSTOM_NUM_3' => 'Save the file in a <b>CSV</b> or <b>Comma Separated Values</b> format',
|
||||
'LBL_IMPORT_TAB_TITLE' => 'Many applications allow you to export data into a <b>Tab Delimited text file (.tsv or .tab)</b> by following these general steps:',
|
||||
'LBL_TAB_NUM_1' => 'Launch the application and open the data file',
|
||||
'LBL_TAB_NUM_2' => 'Select the <b>Save As...</b> or <b>Export...</b> menu option',
|
||||
'LBL_TAB_NUM_3' => 'Save the file in a <b>TSV</b> or <b>Tab Separated Values</b> format',
|
||||
'LBL_STEP_3_TITLE' => 'Step 3: Confirm Fields and Import',
|
||||
'LBL_SELECT_FIELDS_TO_MAP' => 'In the list below, select the fields in the import file that should be imported into each field in the system. When you are finished, click <b>Import Now</b>:',
|
||||
'LBL_DATABASE_FIELD' => 'Database Field',
|
||||
'LBL_HEADER_ROW' => 'Header Row',
|
||||
'LBL_ROW' => 'Row',
|
||||
'LBL_SAVE_AS_CUSTOM' => 'Save as Custom Mapping:',
|
||||
'LBL_SAVE_AS_CUSTOM_NAME' => 'Custom Mapping Name:',
|
||||
'LBL_CONTACTS_NOTE_1' => 'Either Last Name or Full Name must be mapped.',
|
||||
'LBL_CONTACTS_NOTE_2' => 'If Full Name is mapped, then First Name and Last Name are ignored.',
|
||||
'LBL_CONTACTS_NOTE_3' => 'If Full Name is mapped, then the data in Full Name will be split into First Name and Last Name when inserted into the database.',
|
||||
'LBL_CONTACTS_NOTE_4' => 'Fields ending in Address Street 2 and Address Street 3 are concatenated together with the main Address Street Field when inserted into the database.',
|
||||
'LBL_ACCOUNTS_NOTE_1' => 'Fields ending in Address Street 2 and Address Street 3 are concatenated together with the main Address Street Field when inserted into the database.',
|
||||
'LBL_REQUIRED_NOTE' => 'Required Field(s): ',
|
||||
'LBL_IMPORT_NOW' => 'Import Now',
|
||||
'LBL_' => '',
|
||||
'LBL_CANNOT_OPEN' => 'Cannot open the imported file for reading',
|
||||
'LBL_NOT_SAME_NUMBER' => 'There were not the same number of fields per line in your file',
|
||||
'LBL_NO_LINES' => 'There were no lines in your import file',
|
||||
'LBL_FILE_ALREADY_BEEN_OR' => 'The import file has already been processed or does not exist',
|
||||
'LBL_SUCCESS' => 'Success:',
|
||||
'LBL_SUCCESSFULLY' => 'Successfully imported',
|
||||
'LBL_LAST_IMPORT_UNDONE' => 'Your last import was undone',
|
||||
'LBL_NO_IMPORT_TO_UNDO' => 'There was no import to undo.',
|
||||
'LBL_FAIL' => 'Fail:',
|
||||
'LBL_RECORDS_SKIPPED' => 'Records skipped because they were missing one or more required fields',
|
||||
'LBL_IDS_EXISTED_OR_LONGER' => 'Records skipped because the id\'s either existed or were longer than 36 characters',
|
||||
'LBL_RESULTS' => 'Results',
|
||||
'LBL_IMPORT_MORE' => 'Import More',
|
||||
'LBL_FINISHED' => 'Return to ',
|
||||
'LBL_UNDO_LAST_IMPORT' => 'Undo Last Import',
|
||||
'LBL_LAST_IMPORTED'=>'Last Created',
|
||||
'ERR_MULTIPLE_PARENTS' => 'You can only have one Parent ID defined',
|
||||
'LBL_DUPLICATES' => 'Duplicates Found',
|
||||
'LNK_DUPLICATE_LIST' => 'Download List of Duplicates',
|
||||
'LNK_ERROR_LIST' => 'Download List of Errors',
|
||||
'LNK_RECORDS_SKIPPED_DUE_TO_ERROR' => 'Download records that could not be imported.',
|
||||
'LBL_UNIQUE_INDEX' => 'Choose index for duplicate comparison',
|
||||
'LBL_VERIFY_DUPS' => 'Verify duplicate entries against selected indexes.',
|
||||
'LBL_INDEX_USED' => 'Index(es) used:',
|
||||
'LBL_INDEX_NOT_USED' => 'Index(es) not used:',
|
||||
'LBL_IMPORT_MODULE_ERROR_NO_MOVE' => 'File was not successfully uploaded. Check the file permissions in your Sugar installation cache directory.',
|
||||
'LBL_IMPORT_FIELDDEF_ID' => 'Unique ID number',
|
||||
'LBL_IMPORT_FIELDDEF_RELATE' => 'Name or ID',
|
||||
'LBL_IMPORT_FIELDDEF_PHONE' => 'Phone Number',
|
||||
'LBL_IMPORT_FIELDDEF_TEAM_LIST' => 'Team Name or ID',
|
||||
'LBL_IMPORT_FIELDDEF_NAME' => 'Any Text',
|
||||
'LBL_IMPORT_FIELDDEF_VARCHAR' => 'Any Text',
|
||||
'LBL_IMPORT_FIELDDEF_TEXT' => 'Any Text',
|
||||
'LBL_IMPORT_FIELDDEF_TIME' => 'Time',
|
||||
'LBL_IMPORT_FIELDDEF_DATE' => 'Date',
|
||||
'LBL_IMPORT_FIELDDEF_DATETIME' => 'Datetime',
|
||||
'LBL_IMPORT_FIELDDEF_ASSIGNED_USER_NAME' => 'User Name or ID',
|
||||
'LBL_IMPORT_FIELDDEF_BOOL' => '\'0\' or \'1\'',
|
||||
'LBL_IMPORT_FIELDDEF_ENUM' => 'List',
|
||||
'LBL_IMPORT_FIELDDEF_EMAIL' => 'EMail Address',
|
||||
'LBL_IMPORT_FIELDDEF_INT' => 'Numeric (No Decimal)',
|
||||
'LBL_IMPORT_FIELDDEF_DOUBLE' => 'Numeric (No Decimal)',
|
||||
'LBL_IMPORT_FIELDDEF_NUM' => 'Numeric (No Decimal)',
|
||||
'LBL_IMPORT_FIELDDEF_CURRENCY' => 'Numeric (Decimal Allowed)',
|
||||
'LBL_IMPORT_FIELDDEF_FLOAT' => 'Numeric (Decimal Allowed)',
|
||||
'LBL_DATE_FORMAT' => 'Date Format:',
|
||||
'LBL_TIME_FORMAT' => 'Time Format:',
|
||||
'LBL_TIMEZONE' => 'Time Zone:',
|
||||
'LBL_ADD_ROW' => 'Add Field',
|
||||
'LBL_REMOVE_ROW' => 'Remove Field',
|
||||
'LBL_DEFAULT_VALUE' => 'Default Value',
|
||||
'LBL_SHOW_ADVANCED_OPTIONS' => 'Show Advanced Options',
|
||||
'LBL_HIDE_ADVANCED_OPTIONS' => 'Hide Advanced Options',
|
||||
'LBL_SHOW_PREVIEW_COLUMNS' => 'Show Preview Columns',
|
||||
'LBL_HIDE_PREVIEW_COLUMNS' => 'Hide Preview Columns',
|
||||
'LBL_SAVE_MAPPING_AS' => 'Save Mapping As',
|
||||
'LBL_OPTION_ENCLOSURE_QUOTE' => 'Single Quote (\')',
|
||||
'LBL_OPTION_ENCLOSURE_DOUBLEQUOTE' => 'Double Quote (")',
|
||||
'LBL_OPTION_ENCLOSURE_NONE' => 'None',
|
||||
'LBL_OPTION_ENCLOSURE_OTHER' => 'Other:',
|
||||
'LBL_IMPORT_COMPLETE' => 'Import Complete',
|
||||
'LBL_IMPORT_ERROR' => 'Import Errors Occurred',
|
||||
'LBL_IMPORT_RECORDS' => 'Importing Records',
|
||||
'LBL_IMPORT_RECORDS_OF' => 'of',
|
||||
'LBL_IMPORT_RECORDS_TO' => 'to',
|
||||
'LBL_CURRENCY' => 'Currency',
|
||||
'LBL_CURRENCY_SIG_DIGITS' => 'Currency Significant Digits',
|
||||
'LBL_LOCALE_EXAMPLE_NAME_FORMAT' => 'Example',
|
||||
'LBL_NUMBER_GROUPING_SEP' => '1000s separator',
|
||||
'LBL_DECIMAL_SEP' => 'Decimal symbol',
|
||||
'LBL_LOCALE_DEFAULT_NAME_FORMAT' => 'Name Display Format',
|
||||
'LBL_LOCALE_EXAMPLE_NAME_FORMAT' => 'Example',
|
||||
'LBL_LOCALE_NAME_FORMAT_DESC' => '<i>"s" Salutation, "f" First Name, "l" Last Name</i>',
|
||||
'LBL_CHARSET' => 'File Encoding',
|
||||
'LBL_MY_SAVED_HELP' => 'A saved mapping specifies a previously used combination of a specific data source and a set of database fields to map to the fields in the import file.<br>Click <b>Publish</b> to make the mapping available to other users.<br>Click <b>Un-Publish</b> to make the mapping unavailable to other users.',
|
||||
'LBL_MY_PUBLISHED_HELP' => 'A published mapping specifies a previously used combination of a specific data source and a set of database fields to map to the fields in the import file.',
|
||||
'LBL_ENCLOSURE_HELP' => '<p>The <b>qualifier character</b> is used to enclose the intended field content, including any characters that are used as delimiters.<br><br>Example: If the delimiter is a comma (,) and the qualifier is a quotation mark ("),<br><b>"Cupertino, California"</b> is imported into one field in the application and appears as <b>Cupertino, California</b>.<br>If there are no qualifier characters, or if a different character is the qualifier,<br><b>"Cupertino, California"</b> is imported into two adjacent fields as <b>"Cupertino</b> and <b>"California"</b>.<br><br>Note: The import file might not contain any qualifier characters.<br>The default qualifier character for comma- and tab- delimited files created in Excel is a quotation mark.</p>',
|
||||
'LBL_DELIMITER_COMMA_HELP' => 'Select this option if the character that separates the fields in the import file is a <b>comma</b>, or if the file extension is .csv.',
|
||||
'LBL_DELIMITER_TAB_HELP' => 'Select this option if the character that separates the fields in the import file is a <b>TAB</b>, and the file extension is .txt.',
|
||||
'LBL_DELIMITER_CUSTOM_HELP' => 'Select this option if the character that separates the fields in the import file is neither a comma or a TAB, and type the character in the adjacent field.',
|
||||
'LBL_DATABASE_FIELD_HELP' => 'Select a field from list of all fields existing in the database for the module.',
|
||||
'LBL_HEADER_ROW_HELP' => 'These are the field titles in the header row of the import file.',
|
||||
'LBL_DEFAULT_VALUE_HELP' => 'Indicate a value to use for the field in the created or updated record if the field in the import file contains no data.',
|
||||
'LBL_ROW_HELP' => 'This is the data in the first non-header row of the import file.',
|
||||
'LBL_SAVE_MAPPING_HELP' => 'Enter a name for the set of database fields used above for mapping to the fields in the import file fields.<br>The set of fields, including the order of the fields and the data souce selected in Import Step 1, will be saved during the import attempt.<br>The saved mapping can then be selected in Import Step 1 to for another import.',
|
||||
'LBL_IMPORT_FILE_SETTINGS_HELP' => 'Specify the settings in the import file to ensure that the data is imported<br> correctly. These settings will not override your preferences. The records<br> created or updated will contain the settings specified in your My Account page.',
|
||||
'LBL_IMPORT_FILE_SETTINGS' => 'Import File Settings',
|
||||
'LBL_VERIFY_DUPLCATES_HELP' => 'Select the fields in the import file to be used for the duplicate check.<br>If data in the selected fields matches data in fields in existing records, new records will not be created for the rows containing the duplicate field data.<br>The rows containing duplicate field data will be identified in the Import Results.',
|
||||
'LBL_IMPORT_STARTED' => 'Import Started:',
|
||||
'LBL_IMPORT_FILE_SETTINGS' => 'Import File Settings',
|
||||
'LBL_RECORD_CANNOT_BE_UPDATED' => 'The record could not be updated due to a permissions issue',
|
||||
);
|
||||
?>
|
||||
308
modules/Import/language/pl_pl.lang.php
Executable file
308
modules/Import/language/pl_pl.lang.php
Executable file
@@ -0,0 +1,308 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* The contents of this file are subject to the SugarCRM Public License Version
|
||||
* 1.1.3 ("License"); You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* The Original Code is: SugarCRM Open Source
|
||||
* The Initial Developer of the Original Code is SugarCRM, Inc.
|
||||
* Portions created by SugarCRM are Copyright (C) 2004-2005 SugarCRM, Inc.;
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
********************************************************************************/
|
||||
|
||||
/*********************************************************************************
|
||||
* pl_pl.lang.php,v for SugarCRM 4.5.1->>
|
||||
* Translator: Krzysztof Morawski
|
||||
* All Rights Reserved.
|
||||
* Any bugs report welcome: krzysiek<at>kmmgroup<dot>pl
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
global $timedate;
|
||||
|
||||
$mod_strings = array (
|
||||
'LBL_GOOD_FILE' => 'Przeczytano importowane pliki',
|
||||
'LBL_RECORDS_SKIPPED_DUE_TO_ERROR' => 'Ominięto rekordy z powodu błędu',
|
||||
'LBL_UPDATE_SUCCESSFULLY' => 'Z powodzeniem uaktualniono lub stworzono rekordy.',
|
||||
'LBL_SUCCESSFULLY_IMPORTED' => 'Z powodzeniem stworzono rekordy.',
|
||||
'LBL_STEP_4_TITLE' => 'Krok 4: Import plików',
|
||||
'LBL_STEP_5_TITLE' => 'Krok 5: Obejrzyj rezultaty ',
|
||||
'LBL_CUSTOM_ENCLOSURE' => 'Pola zakfalifikowane jako:',
|
||||
'LBL_ERROR_UNABLE_TO_PUBLISH' => 'Nie można opublikować. Został zamapowany inny import o tej samej nazwie.',
|
||||
'LBL_ERROR_UNABLE_TO_UNPUBLISH' => 'Nie można usunąć opublikowanego i zamapowanego przez innego użytkownika pliku. Posiadasz zamapowany import o tej samej nazwie.',
|
||||
'LBL_ERROR_IMPORTS_NOT_SET_UP' => 'Importy nie są skonfigurowane do tego typu modułów.',
|
||||
'LBL_IMPORT_TYPE' => 'Akcje importu',
|
||||
'LBL_IMPORT_BUTTON' => 'Utwórz rekordy',
|
||||
'LBL_UPDATE_BUTTON' => 'Utwórz i aktualizuj rekordy',
|
||||
'LBL_ERROR_INVALID_BOOL'=>'Niewłaściwa wartość boolean',
|
||||
'LBL_NO_ID' => 'Wymagane ID',
|
||||
'LBL_PRE_CHECK_SKIPPED' => 'Pominięto Wstepne sprawdzenie',
|
||||
'LBL_IMPORT_ERROR' => 'Błędy importu:',
|
||||
'LBL_ERROR' => 'Błąd',
|
||||
'LBL_NOLOCALE_NEEDED' => 'Konwersja danych lokalizacyjnych nie jest konieczna',
|
||||
'LBL_FIELD_NAME' => 'Nazwa pola',
|
||||
'LBL_VALUE' => 'Wartość',
|
||||
'LBL_ROW_NUMBER' => 'Numer wiersza',
|
||||
'LBL_NONE' => 'Nic',
|
||||
'LBL_REQUIRED_VALUE' => 'Nie odnaleziono wymaganej wartości',
|
||||
'LBL_ID_EXISTS_ALREADY' => 'Taki ID już istnieje w tej tabeli',
|
||||
'LBL_ASSIGNED_USER' => 'Jeśli ten użytkownik nie istenieje, użyj bieżącego',
|
||||
'LBL_SHOW_HIDDEN' => 'Pokaż pola, które nie są normalnie importowane',
|
||||
'LBL_UPDATE_RECORDS' => 'Uaktualnij istniejące rekordy, zamiast importować je (Cofnięcie operacji nie będzie możliwe)',
|
||||
'LBL_TEST'=> 'Test Importu (nie zapisuje, ani nie zmienia danych)',
|
||||
'LBL_TRUNCATE_TABLE' => 'Opróżnij tabelę przed importem (usuwa wszystkie rekordy)',
|
||||
'LBL_RELATED_ACCOUNTS' => 'Nie twórz powiązanych kont',
|
||||
'LBL_NO_DATECHECK' => 'Przeskocz sprawdzanie danych (szybsze, lecz wysypie się, przy jakimkolwiek blędzie)',
|
||||
'LBL_NO_WORKFLOW' => 'Nie przeprowadzaj prac do wykonania podczas tego importu',
|
||||
'LBL_NO_EMAILS' => 'Nie wysyłaj powiadomień pocztą podczas tego importu',
|
||||
'LBL_NO_PRECHECK' => 'Tryb formatu natywnego',
|
||||
'LBL_STRICT_CHECKS' => 'Użyj tych reguł (Sprawdź również adresy pocztowe i numery telefonów)',
|
||||
'LBL_ERROR_SELECTING_RECORD' => 'Błąd wyboru rekordu:',
|
||||
'LBL_ERROR_DELETING_RECORD' => 'Bład usunięcia rekordu:',
|
||||
'LBL_NOT_SET_UP' => 'Import nie jest ustawiony dla tego typu modułu',
|
||||
'LBL_ARE_YOU_SURE' => 'Jesteś pewien? To wyczyści wszystkie dane w tym module.',
|
||||
'LBL_NO_RECORD' => 'Nie ma rekordów o tym ID do uaktualnienia',
|
||||
'LBL_NOT_SET_UP_FOR_IMPORTS' => 'Import nie jest ustawiony dla tego typu modułu',
|
||||
'LBL_DEBUG_MODE' => 'Włącz tryb debugowania',
|
||||
'LBL_ERROR_INVALID_ID' => 'Podane ID jest zbyt długie, aby pasować do pola (maksymalna długośc to 36 znaków)',
|
||||
'LBL_ERROR_INVALID_PHONE' => 'Niewłaściwy numer telefonu',
|
||||
'LBL_ERROR_INVALID_NAME' => 'String jest zbyt długi, aby pasować do pola',
|
||||
'LBL_ERROR_INVALID_VARCHAR' => 'String jest zbyt długi, aby pasować do pola',
|
||||
'LBL_ERROR_INVALID_DATE' => 'Nieprawidłowy format daty',
|
||||
'LBL_ERROR_INVALID_DATETIME' => 'Nieprawidłowy format daty i czasu',
|
||||
'LBL_ERROR_INVALID_TIME' => 'Nieprawidłowy format czasu',
|
||||
'LBL_ERROR_INVALID_INT' => 'Nieprawidłowa wartość liczbowa',
|
||||
'LBL_ERROR_INVALID_NUM' => 'Nieprawidłowa wartość numeryczna',
|
||||
'LBL_ERROR_INVALID_TIME' => 'Nieprawidłowy format czasu',
|
||||
'LBL_ERROR_INVALID_EMAIL'=>'Niewłaściwy format adresu email',
|
||||
'LBL_ERROR_INVALID_BOOL'=>'Nieprawidłowa wartość (powinno być 1 lub 0)',
|
||||
'LBL_ERROR_INVALID_DATE'=>'Nieprawidłowy format daty',
|
||||
'LBL_ERROR_INVALID_USER'=>'Nieprawidłowa nazwa użytkownika lub ID',
|
||||
'LBL_ERROR_INVALID_TEAM' => 'Nieprawidłowa nazwa zespołu lub ID',
|
||||
'LBL_ERROR_INVALID_ACCOUNT' => 'Nieprawidłowa nazwa klienta lub ID',
|
||||
'LBL_ERROR_INVALID_RELATE' => 'Nieprawidłowe pole zależne',
|
||||
'LBL_ERROR_INVALID_CURRENCY' => 'Nieprawidłowa wartość waluty',
|
||||
'LBL_ERROR_INVALID_FLOAT' => 'Invalid floating point number',
|
||||
'LBL_ERROR_NOT_IN_ENUM' => 'Wartość nie występuje w liście rozwijalnej. Dozwolone wartości to: ',
|
||||
'LBL_NOT_MULTIENUM' => 'Not a MultiEnum',
|
||||
'LBL_IMPORT_MODULE_NO_TYPE' => 'Import nie jest ustawiony dla tego typu modułu',
|
||||
'LBL_IMPORT_MODULE_NO_USERS' => 'UWAGA: Nie posiadasz zdefiniowanych użytkowników w swoim systemie. Jeśli przeprowadzisz najpierw import, bez dodawania użytkowników, wszystkie rekordy będą przydzielone do administratora.',
|
||||
'LBL_IMPORT_MODULE_MAP_ERROR' => 'Nie można opublikować. Jest inny zamapowany import o tej samej nazwie.',
|
||||
'LBL_IMPORT_MODULE_MAP_ERROR2' => 'Nie można usunąć opublikowanego i zamapowanego przez innego użytkownika pliku. Posiadasz zamapowany import o tej samej nazwie.',
|
||||
'LBL_IMPORT_MODULE_NO_DIRECTORY' => 'Folder ',
|
||||
'LBL_IMPORT_MODULE_NO_DIRECTORY_END' => ' nie istnieje lub nie ma odpowiednich praw do zapisu',
|
||||
'LBL_IMPORT_MODULE_ERROR_NO_UPLOAD' => 'Nie udało się wysłać pliku, spróbuj ponownie',
|
||||
'LBL_IMPORT_MODULE_ERROR_LARGE_FILE' => 'Plik jest za duży. Maks.:',
|
||||
'LBL_IMPORT_MODULE_ERROR_LARGE_FILE_END' => 'Bajtów. Zmień wartość $upload_maxsize w pliku config.php',
|
||||
'LBL_MODULE_NAME' => 'Import',
|
||||
'LBL_TRY_AGAIN' => 'Spróbuj ponownie',
|
||||
'LBL_ERROR' => 'Błąd:',
|
||||
'ERR_IMPORT_SYSTEM_ADMININSTRATOR' => 'Nie można zaimportować użytkownika który jest administratorem systemu',
|
||||
'ERR_MULTIPLE' => 'Zdefiniowałeś kilka kolumn jako źródło dla pojedynczej kolumny.',
|
||||
'ERR_MISSING_REQUIRED_FIELDS' => 'Wypełnij wartości w polach wymaganych:',
|
||||
'ERR_MISSING_MAP_NAME' => 'Nie odnaleziono nazwy dla własnego mapowania',
|
||||
'ERR_SELECT_FULL_NAME' => 'Nie możesz wybrać pełnej nazwy kiedy wybrałeś Imię i Nazwisko.',
|
||||
'ERR_SELECT_FILE' => 'Wybierz plik do wysłania.',
|
||||
'LBL_SELECT_FILE' => 'Wybierz plik:',
|
||||
'LBL_CUSTOM' => 'Własny',
|
||||
'LBL_CUSTOM_CSV' => 'Własny plik z wartościami oddzielonymi przecinkiem',
|
||||
'LBL_CSV' => 'Plik z wartościami oddzielonymi przecinkiem',
|
||||
'LBL_TAB' => 'Plik z wartościami oddzielonymi tabulatorem',
|
||||
'LBL_CUSTOM_DELIMITED' => 'Plik z własnym znakiem rozdzielającym',
|
||||
'LBL_CUSTOM_DELIMITER' => 'Własny znak rozdzielający:',
|
||||
'LBL_FILE_OPTIONS' => 'Opcje pliku',
|
||||
'LBL_CUSTOM_TAB' => 'Własny plik z wartościami oddzielonymi tabulatorem',
|
||||
'LBL_DONT_MAP' => '-- Nie mapuj tego pola! --',
|
||||
'LBL_STEP_1_TITLE' => 'Krok 1: Wybierz źródło',
|
||||
'LBL_WHAT_IS' => 'Określ źródło danych:',
|
||||
'LBL_MICROSOFT_OUTLOOK' => 'Microsoft Outlook',
|
||||
'LBL_ACT' => 'Act!',
|
||||
'LBL_ACT_2005' => 'Act! 2005',
|
||||
'LBL_SALESFORCE' => 'Salesforce.com',
|
||||
'LBL_MY_SAVED' => 'Moje zapisane źródła:',
|
||||
'LBL_PUBLISH' => 'publikuj',
|
||||
'LBL_DELETE' => 'kasuj',
|
||||
'LBL_PUBLISHED_SOURCES' => 'Opublikowane źródło:',
|
||||
'LBL_UNPUBLISH' => 'Cofnij publikowanie',
|
||||
'LBL_NEXT' => 'Dalej >',
|
||||
'LBL_BACK' => '< Cofnij',
|
||||
'LBL_STEP_2_TITLE' => 'Krok 2: Wyślij plik do eksportu',
|
||||
'LBL_HAS_HEADER' => 'Posiada Nagłówek:',
|
||||
'LBL_NUM_1' => '1.',
|
||||
'LBL_NUM_2' => '2.',
|
||||
'LBL_NUM_3' => '3.',
|
||||
'LBL_NUM_4' => '4.',
|
||||
'LBL_NUM_5' => '5.',
|
||||
'LBL_NUM_6' => '6.',
|
||||
'LBL_NUM_7' => '7.',
|
||||
'LBL_NUM_8' => '8.',
|
||||
'LBL_NUM_9' => '9.',
|
||||
'LBL_NUM_10' => '10.',
|
||||
'LBL_NUM_11' => '11.',
|
||||
'LBL_NUM_12' => '12.',
|
||||
'LBL_NOTES' => 'Notatki:',
|
||||
'LBL_NOW_CHOOSE' => 'Wybierz plik do importu:',
|
||||
'LBL_IMPORT_OUTLOOK_TITLE' => 'Microsoft Outlook 98, 2000, XP, 2003 potrafi eksportować dane w formacie <b>Wartości oddzielone przecinkiem</b>, który może być użyty do przeniesienia danych. Żeby wyeksportować dane z Outlooka wykonaj następujące kroki:',
|
||||
'LBL_OUTLOOK_NUM_1' => 'Uruchom <b>MS Outlook</b> ',
|
||||
'LBL_OUTLOOK_NUM_2' => 'Z Menu wybierz <b>Plik</b>, <b>Import i Eksport ...</b> ',
|
||||
'LBL_OUTLOOK_NUM_3' => 'Wybierz <b>Eksportuj do pliku</b> kliknij <b>[Dalej]</b> ',
|
||||
'LBL_OUTLOOK_NUM_4' => 'Wybierz <b>Wartości oddzielone przecinkiem (Windows)</b> kliknij <b>[Dalej]</b>.<br> Uwaga: System może upomnieć się o doinstalowanie modułu eksportu. ',
|
||||
'LBL_OUTLOOK_NUM_5' => 'Wybierz folder <b>Kontakty</b> i kliknij <b>[Dalej]</b>. Możesz wybrać dowolny folder w którym przechowujesz kontakty.',
|
||||
'LBL_OUTLOOK_NUM_6' => 'Wybierz Nazwę Pliku i kliknij <b>[Dalej]</b>',
|
||||
'LBL_OUTLOOK_NUM_7' => 'Kliknij <b>[Zakończ]</b>',
|
||||
'LBL_IMPORT_SF_TITLE' => 'Salesforce.com potrafi eksportować do formatu <b>Wartości oddzielone przecinkiem</b>. Żeby wyeksportować dane postępuj zgodnie z poniższą instrukcją:',
|
||||
'LBL_SF_NUM_1' => 'Uruchom przeglądarkę, idź do <b>http://www.salesforce.com</b>, zaloguj się na swoje konto.',
|
||||
'LBL_SF_NUM_2' => 'Kliknij zakładkę <b>Raporty</b> w górnym menu. ',
|
||||
'LBL_SF_NUM_3' => 'Żeby wyeksportować konta kliknij link: <b>Aktywni Klienci</b>. <br>Żeby wyeksportować kontakty kliknij link: <b>Mailing List</b> ',
|
||||
'LBL_SF_NUM_4' => '<b>Krok 1: Wybierz typ raportu</b>, wybierz <b>Tabular Report</b> kliknij <b>Dalej</b>',
|
||||
'LBL_SF_NUM_5' => '<b>Krok 2: Wybierz kolumny raportu </b>, wybierz kolumny jakie chcesz wyeksportować i kliknij <b>Dalej</b>',
|
||||
'LBL_SF_NUM_6' => '<b>Krok 3: Wybierz rodzaj informacji do podsumowania </b>, kliknij <b>Dalej</b>',
|
||||
'LBL_SF_NUM_7' => '<b>Krok 4: Uporządkuj kolumny raportu </b>, kliknij <b>Dalej</b>',
|
||||
'LBL_SF_NUM_8' => '<b>Krok 5: Określ kryteria raportu</b>, Określ dokładne kryteria danych przeznaczonych do eksportu. Możesz w tym celu wykorzystać narzędzia zaawansowanego określania kryteriów. Po zakończeniu kliknij <b>Run Report</b>',
|
||||
'LBL_SF_NUM_9' => 'Raport zostanie wygenerowany; na stronie powinien pojawić się komunikat: <b>Report Generation Status: Complete.</b> kliknij <b>Eksportuj do Excela</b>',
|
||||
'LBL_SF_NUM_10' => '<b>Wyeksportuj Raport:</b>, wybierz format pliku <b>Comma Delimited .csv</b>. Kliknij <b>Export</b>.',
|
||||
'LBL_SF_NUM_11' => 'Pojawi się komunikat monitujący o zapisanie pliku na Twoim komputerze..',
|
||||
'LBL_IMPORT_ACT_TITLE' => 'Act! Potrafi eksportować dane w formacie <b>Wartości oddzielone przecinkiem</b> dane takie możesz zaimportować do SugarSales. Żeby wyeksportować dane z programu ACT! wykonaj poniższe czynności:',
|
||||
'LBL_ACT_NUM_1' => 'Uruchom <b>ACT!</b>',
|
||||
'LBL_ACT_NUM_2' => 'Z menu wybierz <b>Plik</b> <b>Wymiana danych</b>, <b>Eksport...</b>',
|
||||
'LBL_ACT_NUM_3' => 'Wybierz format pliku: <b>Text-Delimited</b>',
|
||||
'LBL_ACT_NUM_4' => 'Wprowadź nazwę pliku i położenie, następnie kliknij <b>[Dalej]</b>',
|
||||
'LBL_ACT_NUM_5' => 'Wybierz <b>Tylko Kontakty</b>',
|
||||
'LBL_ACT_NUM_6' => 'Kliknij <b>Opcje...</b>',
|
||||
'LBL_ACT_NUM_7' => 'Wybierz <b>Przecinek</b> jako znak oddzielający pola',
|
||||
'LBL_ACT_NUM_8' => 'Zaznacz pole wyboru <b>Tak, eksportuj nazwy pól</b>, kliknij <b>[OK]</b>',
|
||||
'LBL_ACT_NUM_9' => 'Kliknij <b>[Dalej]</b>',
|
||||
'LBL_ACT_NUM_10' => 'Wybierz <b>Wszystkie Rekordy</b>, kliknij <b>[Zakończ]</b>',
|
||||
'LBL_IMPORT_CUSTOM_TITLE' => 'Wiele aplikacji pozwala na eksport w formacie <b>Plików tekstowych rozdzielonych przecinkiem (.csv)</b>. Generalnie obsługa eksportu w większości aplikacji składa się z następujących kroków:',
|
||||
'LBL_CUSTOM_NUM_1' => 'Uruchom aplikację, wskaż lub załaduj źródło danych.',
|
||||
'LBL_CUSTOM_NUM_2' => 'Wybierz <b>Zapisz jako...</b> lub <b>Eksport...</b> z menu',
|
||||
'LBL_CUSTOM_NUM_3' => 'Zapisz plik w formacie <b>CSV</b> lub <b>Wartości oddzielone przecinkiem</b> .',
|
||||
'LBL_IMPORT_TAB_TITLE' => 'Wiele programów pozwala na export danych do <b>plików z wartościami oddzielonymi tabulatorem (.tsv or .tab)</b>. Większość aplikacji postępuje tak:',
|
||||
'LBL_TAB_NUM_1' => 'Załaduj aplikację i otwórz plik z danymi',
|
||||
'LBL_TAB_NUM_2' => 'Wybierz <b>Zapisz jako...</b> lub <b>Eksport...</b> z opcji menu',
|
||||
'LBL_TAB_NUM_3' => 'Zapisz plik jako format<b>TSV</b> lub <b>plików z wartościami oddzielonymi tabulatorem</b>',
|
||||
'LBL_STEP_3_TITLE' => 'Krok 3: Zatwierdź pola i zaimportuj.',
|
||||
'LBL_SELECT_FIELDS_TO_MAP' => 'Z poniższej listy wskaż pola, które zamierzasz importować. Kiedy zakończysz kliknij <b>Importuj </b>:',
|
||||
'LBL_DATABASE_FIELD' => 'Pole bazy danych',
|
||||
'LBL_HEADER_ROW' => 'Nagłówek',
|
||||
'LBL_ROW' => 'Wiersz',
|
||||
'LBL_SAVE_AS_CUSTOM' => 'Zapisz jako własne mapowanie:',
|
||||
'LBL_SAVE_AS_CUSTOM_NAME' => 'Custom Mapping Name:',
|
||||
'LBL_CONTACTS_NOTE_1' => 'Jedno z pól Nazwisko lub Pełna Nazwa musi być zmapowane.',
|
||||
'LBL_CONTACTS_NOTE_2' => 'Jeśli zmapowane jest pole Pełna Nazwa, pola Imię i Nazwisko są ignorowane.',
|
||||
'LBL_CONTACTS_NOTE_3' => 'Jeśli zmapowałeś pole Pełna Nazwa, jego zawartość zostanie rozbita na Imię i Nazwisko po zakończeniu importu.',
|
||||
'LBL_CONTACTS_NOTE_4' => 'Ostatnie pola adresu 2 i 3 są łączone w pole Ulica adresu głównego podczas dodawania do bazy.',
|
||||
'LBL_ACCOUNTS_NOTE_1' => 'Ostatnie pola adresu 2 i 3 są łączone w pole Ulica adresu głównego podczas dodawania do bazy.',
|
||||
'LBL_REQUIRED_NOTE' => 'Wymagane pole(a): ',
|
||||
'LBL_IMPORT_NOW' => 'Importuj',
|
||||
'LBL_' => '',
|
||||
'LBL_CANNOT_OPEN' => 'Nie mogę otworzyć pliku do importu.',
|
||||
'LBL_NOT_SAME_NUMBER' => 'Twój plik zawiera niespójną ilość pól w poszczególnych liniach.',
|
||||
'LBL_NO_LINES' => 'Twój plik importu jest pusty.',
|
||||
'LBL_FILE_ALREADY_BEEN_OR' => 'Wskazany przez Ciebie plik nie istnieje lub został już zaimportowany',
|
||||
'LBL_SUCCESS' => 'Sukces:',
|
||||
'LBL_SUCCESSFULLY' => 'Poprawnie zaimportowano dane',
|
||||
'LBL_LAST_IMPORT_UNDONE' => 'Operacja ostatniego importu anulowana',
|
||||
'LBL_NO_IMPORT_TO_UNDO' => 'Nie można cofnąć operacji importu.',
|
||||
'LBL_FAIL' => 'Błąd:',
|
||||
'LBL_RECORDS_SKIPPED' => 'rekord pominięty ze wzgledu na brak lub niespójność danych',
|
||||
'LBL_IDS_EXISTED_OR_LONGER' => 'rekord pominięty. Rekord o identycznym ID istnieje lub jest dłuższy niż 36 znaków',
|
||||
'LBL_RESULTS' => 'Wyniki',
|
||||
'LBL_IMPORT_MORE' => 'Importuj następne',
|
||||
'LBL_FINISHED' => 'Zakończone',
|
||||
'LBL_UNDO_LAST_IMPORT' => 'Cofnij ostatni import',
|
||||
'LBL_LAST_IMPORTED'=>'Ostatnio importowany',
|
||||
'ERR_MULTIPLE_PARENTS' => 'Możesz zdefiniowac tylko jeden ID macierzysty.',
|
||||
'LBL_DUPLICATES' => 'Znaleziono duplikaty',
|
||||
'LBL_DUPLICATE_LIST' => 'Pobierz listę duplikatów',
|
||||
'LBL_ERROR_LIST' =>'Pobierz listę błędów',
|
||||
'LNK_RECORDS_SKIPPED_DUE_TO_ERROR' => 'Kliknij tutaj, aby pobrać pliki, które nie mogą być zaimportowane.',
|
||||
'LBL_UNIQUE_INDEX' => 'Wybierz wskaźnik do porównania duplikatów',
|
||||
'LBL_VERIFY_DUPS' => 'Sprawdź, czy nie ma duplikatów w rekordach o zaznaczonych indeksach',
|
||||
'LBL_INDEX_USED' => 'Index(y) użyte',
|
||||
'LBL_INDEX_NOT_USED' => 'Indeks(y) nieużyte',
|
||||
'LBL_IMPORT_MODULE_ERROR_NO_MOVE' => 'Plik nie został pomyślnie nadpisany. Sprawdź prawa do katalogu pamięci podręcznej instalacji Sugar (cache directory).',
|
||||
'LBL_IMPORT_FIELDDEF_ID' => 'Unikalny numer ID',
|
||||
'LBL_IMPORT_FIELDDEF_RELATE' => 'Nazwa luvID',
|
||||
'LBL_IMPORT_FIELDDEF_PHONE' => 'Numer telefonu',
|
||||
'LBL_IMPORT_FIELDDEF_TEAM_LIST' => 'Nazwa zespołu lub ID',
|
||||
'LBL_IMPORT_FIELDDEF_NAME' => 'Dowolny tekst',
|
||||
'LBL_IMPORT_FIELDDEF_VARCHAR' => 'Dowolny tekst',
|
||||
'LBL_IMPORT_FIELDDEF_TEXT' => 'Dowolny tekst',
|
||||
'LBL_IMPORT_FIELDDEF_TIME' => 'Czas',
|
||||
'LBL_IMPORT_FIELDDEF_DATE' => 'Data',
|
||||
'LBL_IMPORT_FIELDDEF_DATETIME' => 'Data i czas',
|
||||
'LBL_IMPORT_FIELDDEF_ASSIGNED_USER_NAME' => 'Nazwa użytkownika lub ID',
|
||||
'LBL_IMPORT_FIELDDEF_BOOL' => '\'0\' or \'1\'',
|
||||
'LBL_IMPORT_FIELDDEF_ENUM' => 'Lista',
|
||||
'LBL_IMPORT_FIELDDEF_EMAIL' => 'Adres email',
|
||||
'LBL_IMPORT_FIELDDEF_INT' => 'Numericznie (nie dziesiętnie)',
|
||||
'LBL_IMPORT_FIELDDEF_DOUBLE' => 'Numericznie (nie dziesiętnie)',
|
||||
'LBL_IMPORT_FIELDDEF_NUM' => 'Numericznie (nie dziesiętnie)',
|
||||
'LBL_IMPORT_FIELDDEF_CURRENCY' => 'Numericznie (również dziesiętnie)',
|
||||
'LBL_IMPORT_FIELDDEF_FLOAT' => 'Numericznie (również dziesiętnie)',
|
||||
'LBL_DATE_FORMAT' => 'Format daty:',
|
||||
'LBL_TIME_FORMAT' => 'Format czasu:',
|
||||
'LBL_TIMEZONE' => 'Strefa czsasowa:',
|
||||
'LBL_ADD_ROW' => 'Dodaj pole',
|
||||
'LBL_REMOVE_ROW' => 'Usuń pole',
|
||||
'LBL_DEFAULT_VALUE' => 'Domyślna wartość',
|
||||
'LBL_SHOW_ADVANCED_OPTIONS' => 'Pokaż zaawansowane opcje',
|
||||
'LBL_HIDE_ADVANCED_OPTIONS' => 'Ukryj zaawansowane opcje',
|
||||
'LBL_SHOW_PREVIEW_COLUMNS' => 'Pokaż podgląd kolumny',
|
||||
'LBL_HIDE_PREVIEW_COLUMNS' => 'Ukryj podgląd kolumny',
|
||||
'LBL_SAVE_MAPPING_AS' => 'Zachowaj mapowania jako',
|
||||
'LBL_OPTION_ENCLOSURE_QUOTE' => 'Pojedyncze zapytanie (\')',
|
||||
'LBL_OPTION_ENCLOSURE_DOUBLEQUOTE' => 'Podwójne zapytanie (")',
|
||||
'LBL_OPTION_ENCLOSURE_NONE' => 'Nic',
|
||||
'LBL_OPTION_ENCLOSURE_OTHER' => 'Inny:',
|
||||
'LBL_IMPORT_COMPLETE' => 'Import zakończony',
|
||||
'LBL_IMPORT_ERROR' => 'Pojawiły się błędy importu',
|
||||
'LBL_IMPORT_RECORDS' => 'Importowane rekordy',
|
||||
'LBL_IMPORT_RECORDS_OF' => 'z',
|
||||
'LBL_IMPORT_RECORDS_TO' => 'do',
|
||||
'LBL_CURRENCY' => 'Waluta',
|
||||
'LBL_CURRENCY_SIG_DIGITS' => 'Cyfry waluty po przecinku',
|
||||
'LBL_LOCALE_EXAMPLE_NAME_FORMAT' => 'Przykład',
|
||||
'LBL_NUMBER_GROUPING_SEP' => 'Separator tysięcy',
|
||||
'LBL_DECIMAL_SEP' => 'Symbol dziesiętny',
|
||||
'LBL_LOCALE_DEFAULT_NAME_FORMAT' => 'Format wyświetlania nazwy',
|
||||
'LBL_LOCALE_EXAMPLE_NAME_FORMAT' => 'Przykład',
|
||||
'LBL_LOCALE_NAME_FORMAT_DESC' => '<i>"s" pozdrowienie, "f" Imię, "l" Nazwisko</i>',
|
||||
'LBL_CHARSET' => 'Kodowanie pliku',
|
||||
'LBL_MY_SAVED_HELP' => 'Zapisane mapowania określają poprzednio użyte kombinacje danych źródłowych i zestawu pól bazy danych do mapowania na pola w importowanym pliku.<br>Kliknij <b>Opublikuj</b> aby uczynić to mapowanie dostępne dla innych użytkowników.<br>Kliknij <b>Wycofaj z publikacji</b> aby uczynić to mapowanie niedostępne dla innych użytkowników.',
|
||||
'LBL_MY_PUBLISHED_HELP' => 'Opublikowane mapowania określają poprzednio użyte kombinacje danych źródłowych i zestawu pól bazy danych do mapowania na pola w importowanym pliku.',
|
||||
'LBL_ENCLOSURE_HELP' => '<p>The <b>qualifier character</b> is used to enclose the intended field content, including any characters that are used as delimiters.<br><br>Example: If the delimiter is a comma (,) and the qualifier is a quotation mark ("),<br><b>"Cupertino, California"</b> is imported into one field in the application and appears as <b>Cupertino, California</b>.<br>If there are no qualifier characters, or if a different character is the qualifier,<br><b>"Cupertino, California"</b> is imported into two adjacent fields as <b>"Cupertino</b> and <b>Texas"</b>.<br><br>Note: The import file might not contain any qualifier characters.<br>The default qualifier character for comma- and tab- delimited files created in Excel is a quotation mark.</p>',
|
||||
'LBL_DELIMITER_COMMA_HELP' => 'Wybierz tę opcję, jeśli znakiem rozdzielającym pola w pliku importu jest <b>przecinek</b>, lub jeśli roższerzenie pliku to .csv.',
|
||||
'LBL_DELIMITER_TAB_HELP' => 'Wybierz tę opcję, jeśli znakiem rozdzielającym pola w pliku importu jest <b>tabulator</b>, lub jeśli roższerzenie pliku to .txt.',
|
||||
'LBL_DELIMITER_CUSTOM_HELP' => 'Wybierz tę opcję, jeśli znakiem rozdzielającym pola w pliku importu nie jest ani przecinek, ani tabulator, lecz inny znak, który należy podać w polu obok.',
|
||||
'LBL_DATABASE_FIELD_HELP' => 'Wybierz pole z listy wszystkich pól istniejących w bazie danych dla modułu.',
|
||||
'LBL_HEADER_ROW_HELP' => 'Są tam nazwy pól w wierszu nagłówka importowanego pliku.',
|
||||
'LBL_DEFAULT_VALUE_HELP' => 'Wskaż wartość, która zostanie użyta do określenia pola w tworzonym, lub uaktualnianym rekordzie, jeśli pole w pliku importu nie zawiera danych.',
|
||||
'LBL_ROW_HELP' => 'Pierwszy wiersz poniżej nagłówka w importowanym pliku zawiera dane.',
|
||||
'LBL_SAVE_MAPPING_HELP' => 'Wprowadź nazwę dla zestawu pól bazy danych, użytych powyżej dla zamapowania tych pól do pól w pliku importu.<br>Zestaw pól, jak również ich kolejność i źródło danych wybrane w kroku 1 importu, zostanie zachowana, gdy import się rozpocznie.<br>Zapisane mapowania mogą być wybrane w kroku 1 importu i użyte ponownie w innym imporcie.',
|
||||
'LBL_IMPORT_FILE_SETTINGS_HELP' => 'Określ ustawienia w pliku importu, by upewnić się, że dane są importowane <br> poprawnie. Te ustawienia nie będą nadpisywać Twoich preferencji. Rekordy<br> utworzone lub uaktualnione będą zawierać ustawienia określone na stronie Twojego konta.',
|
||||
'LBL_IMPORT_FILE_SETTINGS' => 'Importuj ustawienia pliku',
|
||||
'LBL_VERIFY_DUPLCATES_HELP' => 'Wybierz pola w pliku importu, które będą używane przy sprawdzaniu duplikatów. <br>Jeśli dane w wybranych polach będą pasować do danych w polach w istniejących rekordach, nowe rekordy nie będą utworzone dla wierszy zawierających zduplikowane dane pól.<br>Wiersze zawierające duplikaty zostaną wyświetlone w rezultatach importu.',
|
||||
'LBL_JIGSAW' => 'Jigsaw',
|
||||
'LBL_IMPORT_JIGSAW_TITLE' => 'Wiele aplikacji pozwala eksportować dane do <b>pliku tekstowego warotści rozdzielonuch przecinkami (.csv)</b> po przejściu następujących ogólnych kroków:',
|
||||
'LBL_JIGSAW_NUM_1' => 'Otworz aplikację i załaduj plik danych',
|
||||
'LBL_JIGSAW_NUM_2' => 'Wybierz <b>Zapisz jako...</b> lub <b>Eksport...</b> z opcji menu',
|
||||
'LBL_JIGSAW_NUM_3' => 'Zapisz plik w formacie <b>CSV</b> lub jako plik <b>wartości oddzielonych przecinkiem</b>',
|
||||
'LBL_IMPORT_STARTED' => 'Import rozpoczęty',
|
||||
'LBL_IMPORT_FILE_SETTINGS' => 'Import ustawienia pliku',
|
||||
'LBL_REPORT_CANNOT_BE_UPDATED' => 'Import nie może się rozpocząć z powodu niewłaściwych praw dostępu do plików.',
|
||||
);
|
||||
|
||||
?>
|
||||
58
modules/Import/tpls/error.tpl
Executable file
58
modules/Import/tpls/error.tpl
Executable file
@@ -0,0 +1,58 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
<form name="importerror" method="GET" action="index.php" id="importerror">
|
||||
<input type="hidden" name="module" value="Import">
|
||||
<input type="hidden" name="action" value="{$ACTION}">
|
||||
<input type="hidden" name="import_module" value="{$IMPORT_MODULE}">
|
||||
<input type="hidden" name="source" value="{$SOURCE}">
|
||||
|
||||
<p class="error">{$MESSAGE}</p>
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td align="left">
|
||||
<input title="{$MOD.LBL_TRY_AGAIN}" accessKey="" class="button" type="submit"
|
||||
name="button" value="{$MOD.LBL_TRY_AGAIN}">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
86
modules/Import/tpls/last.tpl
Executable file
86
modules/Import/tpls/last.tpl
Executable file
@@ -0,0 +1,86 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
{$MODULE_TITLE}
|
||||
<span>
|
||||
{$MOD.LBL_SUCCESS}<BR>
|
||||
{if $createdCount > 0}
|
||||
<b>{$createdCount}</b> {$MOD.LBL_SUCCESSFULLY_IMPORTED}<br />
|
||||
{/if}
|
||||
{if $updatedCount > 0}
|
||||
<b>{$updatedCount}</b> {$MOD.LBL_UPDATE_SUCCESSFULLY}<br />
|
||||
{/if}
|
||||
{if $errorCount > 0}
|
||||
<b>{$errorCount}</b> {$MOD.LBL_RECORDS_SKIPPED_DUE_TO_ERROR}<br />
|
||||
<a href="{$errorFile}" target='_blank'>{$MOD.LNK_ERROR_LIST}</a><br />
|
||||
<a href ="{$errorrecordsFile}" target='_blank'>{$MOD.LNK_RECORDS_SKIPPED_DUE_TO_ERROR}</a><br />
|
||||
{/if}
|
||||
{if $dupeCount > 0}
|
||||
<b>{$dupeCount}</b> {$MOD.LBL_DUPLICATES}<br />
|
||||
<a href ="{$dupeFile}" target='_blank'>{$MOD.LNK_DUPLICATE_LIST}</a><br />
|
||||
{/if}
|
||||
|
||||
<form name="importlast" id="importlast" method="POST" action="index.php">
|
||||
<input type="hidden" name="module" value="Import">
|
||||
<input type="hidden" name="action" value="Undo">
|
||||
<input type="hidden" name="import_module" value="{$IMPORT_MODULE}">
|
||||
|
||||
<br />
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td align="left" style="padding-bottom: 2px;">
|
||||
<input title="{$MOD.LBL_UNDO_LAST_IMPORT}" accessKey="" class="button"
|
||||
type="submit" name="undo" id="undo" value=" {$MOD.LBL_UNDO_LAST_IMPORT} ">
|
||||
<input title="{$MOD.LBL_IMPORT_MORE}" accessKey="" class="button" type="submit"
|
||||
name="importmore" id="importmore" value=" {$MOD.LBL_IMPORT_MORE} ">
|
||||
<input title="{$MOD.LBL_FINISHED}{$MODULENAME}" accessKey="" class="button" type="submit"
|
||||
name="finished" id="finished" value=" {$MOD.LBL_IMPORT_COMPLETE} ">
|
||||
{$PROSPECTLISTBUTTON}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
{if $PROSPECTLISTBUTTON != ''}
|
||||
<form name="DetailView">
|
||||
<input type="hidden" name="module" value="Prospects">
|
||||
<input type="hidden" name="record" value="id">
|
||||
</form>
|
||||
{/if}
|
||||
{$JAVASCRIPT}
|
||||
187
modules/Import/tpls/step1.tpl
Executable file
187
modules/Import/tpls/step1.tpl
Executable file
@@ -0,0 +1,187 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
{overlib_includes}
|
||||
{$MODULE_TITLE}
|
||||
{if $ERROR != ''}
|
||||
<span class="error">{$ERROR}</span>
|
||||
{/if}
|
||||
|
||||
<form enctype="multipart/form-data" name="importstep1" method="post" action="index.php" id="importstep1">
|
||||
<input type="hidden" name="module" value="Import">
|
||||
<input type="hidden" name="action" value="Step2">
|
||||
<input type="hidden" name="import_module" value="{$IMPORT_MODULE}">
|
||||
<p>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
|
||||
<tr>
|
||||
<td>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td valign="top" width='50%' scope="row"><table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td align="left" scope="row" colspan="3"><h3>{$MOD.LBL_WHAT_IS} <span class="required">*</span></h3></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" scope="row"><input class="radio" type="radio" name="source" value="csv" checked="checked" />
|
||||
{$MOD.LBL_CSV} {sugar_help text=$MOD.LBL_DELIMITER_COMMA_HELP}</td>
|
||||
</tr>
|
||||
<tr id="customEnclosure">
|
||||
<td scope="row"> {$MOD.LBL_CUSTOM_ENCLOSURE}</td>
|
||||
<td colspan="2" scope="row">
|
||||
<select name="custom_enclosure" id="custom_enclosure">
|
||||
<option value=""" selected="selected">{$MOD.LBL_OPTION_ENCLOSURE_DOUBLEQUOTE}</option>
|
||||
<option value="'">{$MOD.LBL_OPTION_ENCLOSURE_QUOTE}</option>
|
||||
<option value="">{$MOD.LBL_OPTION_ENCLOSURE_NONE}</option>
|
||||
<option value="other">{$MOD.LBL_OPTION_ENCLOSURE_OTHER}</option>
|
||||
</select>
|
||||
<input type="text" name="custom_enclosure_other" style="display: none; width: 5em;" maxlength="1" />
|
||||
{sugar_help text=$MOD.LBL_ENCLOSURE_HELP}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" scope="row"><input class="radio" type="radio" name="source" value="tab" />
|
||||
{$MOD.LBL_TAB} {sugar_help text=$MOD.LBL_DELIMITER_TAB_HELP}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" scope="row"><input class="radio" type="radio" name="source" value="other" />
|
||||
{$MOD.LBL_CUSTOM_DELIMITED} {sugar_help text=$MOD.LBL_DELIMITER_CUSTOM_HELP}</td>
|
||||
</tr>
|
||||
<tr id="customDelimiter" style='display:none'>
|
||||
<td scope="row"> {$MOD.LBL_CUSTOM_DELIMITER} <span class="required">*</span></td>
|
||||
<td colspan="2" scope="row">
|
||||
<input type="text" name="custom_delimiter" value="" style="width: 5em;" maxlength="1" />
|
||||
</td>
|
||||
</tr>
|
||||
{if $show_salesforce}
|
||||
<tr>
|
||||
<td colspan="3" scope="row"><input class="radio" type="radio" name="source" value="salesforce" />
|
||||
{$MOD.LBL_SALESFORCE}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if $show_outlook}
|
||||
<tr>
|
||||
<td colspan="3" scope="row"><input class="radio" type="radio" name="source" value="outlook" />
|
||||
{$MOD.LBL_MICROSOFT_OUTLOOK}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if $show_act}
|
||||
<tr>
|
||||
<td colspan="3" scope="row"><input class="radio" type="radio" name="source" value="act" />
|
||||
{$MOD.LBL_ACT}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{foreach from=$custom_imports key=key item=item name=saved}
|
||||
{if $smarty.foreach.saved.first}
|
||||
<tr>
|
||||
<td scope="row" colspan="3">
|
||||
<h5>{$MOD.LBL_MY_SAVED} {sugar_help text=$MOD.LBL_MY_SAVED_HELP}</h5></td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr>
|
||||
<td scope="row" colspan="2">
|
||||
<input class="radio" type="radio" name="source" value="custom:{$item.IMPORT_ID}"/>
|
||||
{$item.IMPORT_NAME}
|
||||
</td>
|
||||
<td scope="row">
|
||||
{if $is_admin}
|
||||
<input type="button" name="publish" value="{$MOD.LBL_PUBLISH}" class="button"
|
||||
onclick="document.location.href = 'index.php?publish=yes&import_module={$IMPORT_MODULE}&module=Import&action=step1&import_map_id={$item.IMPORT_ID}'">
|
||||
{/if}
|
||||
<input type="button" name="delete" value="{$MOD.LBL_DELETE}" class="button"
|
||||
onclick="document.location.href = 'index.php?import_module={$IMPORT_MODULE}&module=Import&action=step1&delete_map_id={$item.IMPORT_ID}'">
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{foreach from=$published_imports key=key item=item name=published}
|
||||
{if $smarty.foreach.published.first}
|
||||
<tr>
|
||||
<td scope="row" colspan="3">
|
||||
<h5>{$MOD.LBL_PUBLISHED_SOURCES} {sugar_help text=$MOD.LBL_MY_PUBLISHED_HELP}</h5></td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr>
|
||||
<td scope="row" colspan="2">
|
||||
<input class="radio" type="radio" name="source" value="custom:{$item.IMPORT_ID}"/>
|
||||
{$item.IMPORT_NAME}
|
||||
</td>
|
||||
<td scope="row">
|
||||
{if $is_admin}
|
||||
<input type="button" name="publish" value="{$MOD.LBL_UNPUBLISH}" class="button"
|
||||
onclick="document.location.href = 'index.php?publish=no&import_module={$IMPORT_MODULE}&module=Import&action=step1&import_map_id={$item.IMPORT_ID}'">
|
||||
<input type="button" name="delete" value="{$MOD.LBL_DELETE}" class="button"
|
||||
onclick="document.location.href = 'index.php?import_module={$IMPORT_MODULE}&module=Import&action=step1&delete_map_id={$item.IMPORT_ID}'">
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
<tr>
|
||||
<td scope="row" colspan="3">
|
||||
<h3>{$MOD.LBL_IMPORT_TYPE} <span class="required">*</span></h3></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row" colspan="3">
|
||||
<input class="radio" type="radio" name="type" value="import" checked="checked" />
|
||||
{$MOD.LBL_IMPORT_BUTTON}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row" colspan="3">
|
||||
<input class="radio" type="radio" name="type" value="update" />
|
||||
{$MOD.LBL_UPDATE_BUTTON}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td align="left"><input title="{$MOD.LBL_NEXT}" accessKey="" class="button" type="submit" name="button" value=" {$MOD.LBL_NEXT} " id="gonext"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
{$JAVASCRIPT}
|
||||
111
modules/Import/tpls/step2.tpl
Executable file
111
modules/Import/tpls/step2.tpl
Executable file
@@ -0,0 +1,111 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
{$MODULE_TITLE}
|
||||
<form enctype="multipart/form-data" name="importstep2" method="POST" action="index.php" id="importstep2">
|
||||
<input type="hidden" name="module" value="Import">
|
||||
<input type="hidden" name="custom_delimiter" value="{$CUSTOM_DELIMITER}">
|
||||
<input type="hidden" name="custom_enclosure" value="{$CUSTOM_ENCLOSURE}">
|
||||
<input type="hidden" name="type" value="{$TYPE}">
|
||||
<input type="hidden" name="source" value="{$SOURCE}">
|
||||
<input type="hidden" name="source_id" value="{$SOURCE_ID}">
|
||||
<input type="hidden" name="action" value="Step3">
|
||||
<input type="hidden" name="import_module" value="{$IMPORT_MODULE}">
|
||||
{foreach from=$instructions key=key item=item name=instructions}
|
||||
{if $smarty.foreach.instructions.first}
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td align="left"><p>{$INSTRUCTIONS_TITLE}</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<table width="50%">
|
||||
{/if}
|
||||
<tr>
|
||||
<td valign="top"><b>{$item.STEP_NUM}</b></td>
|
||||
<td>{$item.INSTRUCTION_STEP}</td>
|
||||
</tr>
|
||||
{if $smarty.foreach.instructions.last}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{/if}
|
||||
{/foreach}
|
||||
|
||||
<br>
|
||||
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
|
||||
<tr>
|
||||
<td>
|
||||
<table border="0" cellspacing="0" cellpadding="0" width="100%">
|
||||
<tr>
|
||||
<td align="left" scope="row" colspan="4">{$MOD.LBL_SELECT_FILE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row">
|
||||
<input type="hidden" />
|
||||
<input size="60" name="userfile" type="file"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row">
|
||||
{$MOD.LBL_HAS_HEADER} <input class="checkBox" value='on' type="checkbox" name="has_header"{$HAS_HEADER_CHECKED}>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td align="left">
|
||||
<input title="{$MOD.LBL_BACK}" accessKey="" class="button" type="submit" name="button" value=" {$MOD.LBL_BACK} " id="goback">
|
||||
<input title="{$MOD.LBL_NEXT}" accessKey="" class="button" type="submit" name="button" value=" {$MOD.LBL_NEXT} " id="gonext">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
{$JAVASCRIPT}
|
||||
368
modules/Import/tpls/step3.tpl
Executable file
368
modules/Import/tpls/step3.tpl
Executable file
@@ -0,0 +1,368 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
{literal}
|
||||
<style>
|
||||
<!--
|
||||
textarea { width: 20em }
|
||||
-->
|
||||
</style>
|
||||
{/literal}
|
||||
<script type="text/javascript" src="{sugar_getjspath file='include/javascript/sugar_grp_yui_widgets.js'}"></script>
|
||||
{overlib_includes}
|
||||
{$MODULE_TITLE}
|
||||
<form enctype="multipart/form-data" real_id="importstep3" id="importstep3" name="importstep3" method="POST" action="index.php">
|
||||
<input type="hidden" name="module" value="Import">
|
||||
<input type="hidden" name="custom_delimiter" value="{$CUSTOM_DELIMITER}">
|
||||
<input type="hidden" name="custom_enclosure" value="{$CUSTOM_ENCLOSURE}">
|
||||
<input type="hidden" name="import_type" value="{$TYPE}">
|
||||
<input type="hidden" name="source" value="{$SOURCE}">
|
||||
<input type="hidden" name="source_id" value="{$SOURCE_ID}">
|
||||
<input type="hidden" name="action" value="Step3">
|
||||
<input type="hidden" name="import_module" value="{$IMPORT_MODULE}">
|
||||
<input type="hidden" name="to_pdf" value="1">
|
||||
<input type="hidden" name="has_header" value="{$HAS_HEADER}">
|
||||
<input type="hidden" name="tmp_file" value="{$TMP_FILE}">
|
||||
<input type="hidden" name="tmp_file_base" value="{$TMP_FILE}">
|
||||
<input type="hidden" name="firstrow" value="{$FIRSTROW}">
|
||||
<input type="hidden" name="columncount" value ="{$COLUMNCOUNT}">
|
||||
<input type="hidden" name="display_tabs_def">
|
||||
|
||||
<div align="right">
|
||||
<span class="required" align="right">{$APP.LBL_REQUIRED_SYMBOL}</span> {$APP.NTC_REQUIRED}
|
||||
</div>
|
||||
|
||||
<p>
|
||||
{$MOD.LBL_SELECT_FIELDS_TO_MAP}
|
||||
</p>
|
||||
<br />
|
||||
<table border="0" cellpadding="0" width="100%" id="importTable" class="detail view">
|
||||
{foreach from=$rows key=key item=item name=rows}
|
||||
{if $smarty.foreach.rows.first}
|
||||
<tr>
|
||||
<td style="text-align: left;" scope="row">
|
||||
<b>{$MOD.LBL_DATABASE_FIELD}</b>
|
||||
{sugar_help text=$MOD.LBL_DATABASE_FIELD_HELP}
|
||||
</td>
|
||||
{if $HAS_HEADER == 'on'}
|
||||
<td style="text-align: left;" scope="row">
|
||||
<b>{$MOD.LBL_HEADER_ROW}</b>
|
||||
{sugar_help text=$MOD.LBL_HEADER_ROW_HELP}
|
||||
</td>
|
||||
{/if}
|
||||
<td style="text-align: left;" scope="row">
|
||||
<b>{$MOD.LBL_DEFAULT_VALUE}</b>
|
||||
{sugar_help text=$MOD.LBL_DEFAULT_VALUE_HELP}
|
||||
</td>
|
||||
<td style="text-align: left;" scope="row">
|
||||
<b>{$MOD.LBL_ROW} 1</b>
|
||||
{sugar_help text=$MOD.LBL_ROW_HELP}
|
||||
</td>
|
||||
{if $HAS_HEADER != 'on'}
|
||||
<td style="text-align: left;"><b>{$MOD.LBL_ROW} 2</b></td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/if}
|
||||
<tr>
|
||||
<td valign="top" align="left" id="row_{$smarty.foreach.rows.index}_col_0">
|
||||
<select class='fixedwidth' name="colnum_{$smarty.foreach.rows.index}">
|
||||
<option value="-1">{$MOD.LBL_DONT_MAP}</option>
|
||||
{$item.field_choices}
|
||||
</select>
|
||||
</td>
|
||||
{if $HAS_HEADER == 'on'}
|
||||
<td id="row_{$smarty.foreach.rows.index}_header">{$item.cell1}</td>
|
||||
{/if}
|
||||
<td id="defaultvaluepicker_{$smarty.foreach.rows.index}" nowrap="nowrap">
|
||||
{$item.default_field}
|
||||
</td>
|
||||
{if $item.show_remove}
|
||||
<td colspan="2">
|
||||
<input title="{$MOD.LBL_REMOVE_ROW}" accessKey=""
|
||||
id="deleterow_{$smarty.foreach.rows.index}" class="button" type="button"
|
||||
value=" {$MOD.LBL_REMOVE_ROW} ">
|
||||
</td>
|
||||
{else}
|
||||
{if $HAS_HEADER != 'on'}
|
||||
<td id="row_{$smarty.foreach.rows.index}_col_1" scope="row">{$item.cell1}</td>
|
||||
{/if}
|
||||
<td id="row_{$smarty.foreach.rows.index}_col_2" scope="row">{$item.cell2}</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
<tr>
|
||||
<td align="left" colspan="4" style="background: transparent;">
|
||||
<input title="{$MOD.LBL_ADD_ROW}" accessKey="" id="addrow" class="button" type="button"
|
||||
name="button" value=" {$MOD.LBL_ADD_ROW} ">
|
||||
<input title="{$MOD.LBL_SHOW_ADVANCED_OPTIONS}" accessKey="" id="toggleImportOptions" class="button" type="button"
|
||||
name="button" value=" {$MOD.LBL_SHOW_ADVANCED_OPTIONS} ">
|
||||
|
||||
<span scope="row"><strong>{$MOD.LBL_SAVE_MAPPING_AS}</strong></span>
|
||||
<span >
|
||||
<input type="text" name="save_map_as" id="save_map_as" value=""
|
||||
style="width: 20em" maxlength="254">
|
||||
{sugar_help text=$MOD.LBL_SAVE_MAPPING_HELP}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="display: none;" id="importOptions">
|
||||
<td valign="middle" colspan="4">
|
||||
<table border="0" width="100%">
|
||||
<tr>
|
||||
<td valign="top" width="50%">
|
||||
<div>
|
||||
<h4>{$MOD.LBL_IMPORT_FILE_SETTINGS} {sugar_help text=$MOD.LBL_IMPORT_FILE_SETTINGS_HELP}</h4>
|
||||
<table border=0 class="edit view">
|
||||
<tr>
|
||||
<td scope="row"><slot>{$MOD.LBL_CHARSET}</slot></td>
|
||||
<td ><slot><select tabindex='4' name='importlocale_charset'>{$CHARSETOPTIONS}</select></slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row"><slot>{$MOD.LBL_DATE_FORMAT}</slot></td>
|
||||
<td ><slot><select tabindex='4' name='importlocale_dateformat'>{$DATEOPTIONS}</select></slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row"><slot>{$MOD.LBL_TIME_FORMAT}</slot></td>
|
||||
<td ><slot><select tabindex='4' name='importlocale_timeformat'>{$TIMEOPTIONS}</select></slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row"><slot>{$MOD.LBL_TIMEZONE}</slot></td>
|
||||
<td ><slot><select tabindex='4' name='importlocale_timezone'>{$TIMEZONEOPTIONS}</select></slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row"><slot>{$MOD.LBL_CURRENCY}</slot></td>
|
||||
<td ><slot>
|
||||
<select tabindex='4' id='currency_select' name='importlocale_currency' onchange='setSymbolValue(this.selectedIndex);setSigDigits();'>{$CURRENCY}</select>
|
||||
<input type="hidden" id="symbol" value="">
|
||||
</slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row"><slot>
|
||||
{$MOD.LBL_CURRENCY_SIG_DIGITS}:
|
||||
</slot></td>
|
||||
<td ><slot>
|
||||
<select id='sigDigits' onchange='setSigDigits(this.value);' name='importlocale_default_currency_significant_digits'>{$sigDigits}</select>
|
||||
</slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row"><slot>
|
||||
<i>{$MOD.LBL_LOCALE_EXAMPLE_NAME_FORMAT}</i>:
|
||||
</slot></td>
|
||||
<td ><slot>
|
||||
<input type="text" disabled id="sigDigitsExample" name="sigDigitsExample">
|
||||
</slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row"><slot>{$MOD.LBL_NUMBER_GROUPING_SEP}</slot></td>
|
||||
<td ><slot>
|
||||
<input tabindex='4' name='importlocale_num_grp_sep' id='default_number_grouping_seperator'
|
||||
type='text' maxlength='1' size='1' value='{$NUM_GRP_SEP}'
|
||||
onkeydown='setSigDigits();' onkeyup='setSigDigits();'>
|
||||
</slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row"><slot>{$MOD.LBL_DECIMAL_SEP}</slot></td>
|
||||
<td ><slot>
|
||||
<input tabindex='4' name='importlocale_dec_sep' id='default_decimal_seperator'
|
||||
type='text' maxlength='1' size='1' value='{$DEC_SEP}'
|
||||
onkeydown='setSigDigits();' onkeyup='setSigDigits();'>
|
||||
</slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row" valign="top">{$MOD.LBL_LOCALE_DEFAULT_NAME_FORMAT}: </td>
|
||||
<td valign="top">
|
||||
<input onkeyup="setPreview();" onkeydown="setPreview();" id="default_locale_name_format" type="text" tabindex='4' name="importlocale_default_locale_name_format" value="{$default_locale_name_format}">
|
||||
<br />{$MOD.LBL_LOCALE_NAME_FORMAT_DESC}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row" valign="top"><i>{$MOD.LBL_LOCALE_EXAMPLE_NAME_FORMAT}:</i> </td>
|
||||
<td valign="top"><input tabindex='4' id="nameTarget" name="no_value" id=":q" value="" style="border: none;" disabled size="50"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
<td valign="top" width="50%">
|
||||
<div>
|
||||
<h4>{$MOD.LBL_VERIFY_DUPS} {sugar_help text=$MOD.LBL_VERIFY_DUPLCATES_HELP}</h4>
|
||||
{$TAB_CHOOSER}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{$JAVASCRIPT_CHOOSER}
|
||||
|
||||
{if $NOTETEXT != '' || $required_fields != ''}
|
||||
<p>
|
||||
<b>{$MOD.LBL_NOTES}</b>
|
||||
<ul>
|
||||
<li>{$MOD.LBL_REQUIRED_NOTE}{$required_fields}</li>
|
||||
{$NOTETEXT}
|
||||
</ul>
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<br />
|
||||
<table width="100%" cellpadding="2" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td align="left">
|
||||
<input title="{$MOD.LBL_BACK}" accessKey="" id="goback" class="button" type="submit" name="button" value=" {$MOD.LBL_BACK} ">
|
||||
<input title="{$MOD.LBL_IMPORT_NOW}" accessKey="" id="importnow" class="button" type="button" name="button" value=" {$MOD.LBL_IMPORT_NOW} ">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
/**
|
||||
* Singleton to handle processing the import
|
||||
*/
|
||||
ProcessImport = new function()
|
||||
{
|
||||
/*
|
||||
* number of file to process processed
|
||||
*/
|
||||
this.fileCount = 0;
|
||||
|
||||
/*
|
||||
* total files to processs
|
||||
*/
|
||||
this.fileTotal = {/literal}{$FILECOUNT-1}{literal};
|
||||
|
||||
/*
|
||||
* total records to process
|
||||
*/
|
||||
this.recordCount = {/literal}{$RECORDCOUNT}{literal};
|
||||
|
||||
/*
|
||||
* maximum number of records per file
|
||||
*/
|
||||
this.recordThreshold = {/literal}{$RECORDTHRESHOLD}{literal};
|
||||
|
||||
/*
|
||||
* submits the form
|
||||
*/
|
||||
this.submit = function()
|
||||
{
|
||||
document.getElementById("importstep3").tmp_file.value =
|
||||
document.getElementById("importstep3").tmp_file_base.value + '-' + this.fileCount;
|
||||
YAHOO.util.Connect.setForm(document.getElementById("importstep3"));
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'index.php',
|
||||
{
|
||||
success: function(o) {
|
||||
if (o.responseText.replace(/^\s+|\s+$/g, '') != '') {
|
||||
this.failure(o);
|
||||
}
|
||||
else {
|
||||
var locationStr = "index.php?module=Import"
|
||||
+ "&action=Last"
|
||||
+ "&type={/literal}{$TYPE}{literal}"
|
||||
+ "&import_module={/literal}{$IMPORT_MODULE}{literal}";
|
||||
if ( ProcessImport.fileCount >= ProcessImport.fileTotal ) {
|
||||
YAHOO.SUGAR.MessageBox.updateProgress(1,'{/literal}{$MOD.LBL_IMPORT_COMPLETE}{literal}');
|
||||
SUGAR.util.hrefURL(locationStr);
|
||||
}
|
||||
else {
|
||||
document.getElementById("importstep3").save_map_as.value = '';
|
||||
ProcessImport.fileCount++;
|
||||
ProcessImport.submit();
|
||||
}
|
||||
}
|
||||
},
|
||||
failure: function(o) {
|
||||
YAHOO.SUGAR.MessageBox.minWidth = 500;
|
||||
YAHOO.SUGAR.MessageBox.show({
|
||||
type: "alert",
|
||||
title: '{/literal}{$MOD.LBL_IMPORT_ERROR}{literal}',
|
||||
msg: o.responseText,
|
||||
fn: function() { window.location.reload(true); }
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
var move = 0;
|
||||
if ( this.fileTotal > 0 ) {
|
||||
move = this.fileCount/this.fileTotal;
|
||||
}
|
||||
YAHOO.SUGAR.MessageBox.updateProgress( move,
|
||||
"{/literal}{$MOD.LBL_IMPORT_RECORDS}{literal} " + ((this.fileCount * this.recordThreshold) + 1)
|
||||
+ " {/literal}{$MOD.LBL_IMPORT_RECORDS_TO}{literal} " + Math.min(((this.fileCount+1) * this.recordThreshold),this.recordCount)
|
||||
+ " {/literal}{$MOD.LBL_IMPORT_RECORDS_OF}{literal} " + this.recordCount );
|
||||
}
|
||||
|
||||
/*
|
||||
* begins the form submission process
|
||||
*/
|
||||
this.begin = function()
|
||||
{
|
||||
datestarted = '{/literal}{$MOD.LBL_IMPORT_STARTED}{literal} ' +
|
||||
YAHOO.util.Date.format('{/literal}{$datetimeformat}{literal}');
|
||||
YAHOO.SUGAR.MessageBox.show({
|
||||
title: '{/literal}{$STEP4_TITLE}{literal}',
|
||||
msg: datestarted,
|
||||
width: 500,
|
||||
type: "progress",
|
||||
closable:false,
|
||||
animEl: 'importnow'
|
||||
});
|
||||
this.submit();
|
||||
}
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
{/literal}
|
||||
{$JAVASCRIPT}
|
||||
{literal}
|
||||
<script type="text/javascript" language="Javascript">
|
||||
enableQS(false);
|
||||
{/literal}{$getNameJs}{literal}
|
||||
{/literal}{$getNumberJs}{literal}
|
||||
{/literal}{$currencySymbolJs}{literal}
|
||||
setSymbolValue(document.getElementById('currency_select').selectedIndex);
|
||||
setSigDigits();
|
||||
|
||||
{/literal}{$confirmReassignJs}{literal}
|
||||
</script>
|
||||
{/literal}
|
||||
64
modules/Import/tpls/undo.tpl
Executable file
64
modules/Import/tpls/undo.tpl
Executable file
@@ -0,0 +1,64 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
{if $UNDO_SUCCESS}
|
||||
<h2>{$MOD.LBL_SUCCESS} {$MOD.LBL_LAST_IMPORT_UNDONE}</h2>
|
||||
{else}
|
||||
<h2>{$MOD.LBL_FAIL} {$MOD.LBL_NO_IMPORT_TO_UNDO}</h2>
|
||||
{/if}
|
||||
<form enctype="multipart/form-data" name="importundo" method="POST" action="index.php" id="importundo">
|
||||
<input type="hidden" name="module" value="Import">
|
||||
<input type="hidden" name="action" value="Step1">
|
||||
<input type="hidden" name="import_module" value="{$IMPORT_MODULE}">
|
||||
|
||||
<br />
|
||||
<table width="100%" cellpadding="2" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td align="left">
|
||||
<input title="{$MOD.LBL_TRY_AGAIN}" accessKey=""
|
||||
class="button" type="submit" name="button"
|
||||
value=" {$MOD.LBL_TRY_AGAIN} ">
|
||||
<input title="{$MOD.LBL_FINISHED}{$MODULENAME}" accessKey="" class="button" type="submit"
|
||||
name="finished" id="finished" value=" {$MOD.LBL_FINISHED}{$MODULENAME} ">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
{$JAVASCRIPT}
|
||||
236
modules/Import/vardefs.php
Executable file
236
modules/Import/vardefs.php
Executable file
@@ -0,0 +1,236 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
$dictionary['ImportMap'] = array (
|
||||
'table' => 'import_maps',
|
||||
'comment' => 'Import mapping control table',
|
||||
'fields' => array (
|
||||
'id' => array (
|
||||
'name' => 'id',
|
||||
'vname' => 'LBL_ID',
|
||||
'type' => 'id',
|
||||
'required'=>true,
|
||||
'reportable'=>false,
|
||||
'comment' => 'Unique identifier',
|
||||
),
|
||||
'name' => array (
|
||||
'name' => 'name',
|
||||
'vname' => 'LBL_NAME',
|
||||
'type' => 'varchar',
|
||||
'len' => '254',
|
||||
'required'=>true,
|
||||
'comment' => 'Name of import map',
|
||||
),
|
||||
'source' => array (
|
||||
'name' => 'source',
|
||||
'vname' => 'LBL_SOURCE',
|
||||
'type' => 'varchar',
|
||||
'len' => '36',
|
||||
'required'=>true,
|
||||
'comment' => '',
|
||||
),
|
||||
'enclosure' => array (
|
||||
'name' => 'enclosure',
|
||||
'vname' => 'LBL_CUSTOM_ENCLOSURE',
|
||||
'type' => 'varchar',
|
||||
'len' => '1',
|
||||
'required'=>true,
|
||||
'comment' => '',
|
||||
'default' => ' ',
|
||||
),
|
||||
'delimiter' => array (
|
||||
'name' => 'delimiter',
|
||||
'vname' => 'LBL_CUSTOM_DELIMITER',
|
||||
'type' => 'varchar',
|
||||
'len' => '1',
|
||||
'required'=>true,
|
||||
'comment' => '',
|
||||
'default' => ',',
|
||||
),
|
||||
'module' => array (
|
||||
'name' => 'module',
|
||||
'vname' => 'LBL_MODULE',
|
||||
'type' => 'varchar',
|
||||
'len' => '36',
|
||||
'required'=>true,
|
||||
'comment' => 'Module used for import',
|
||||
),
|
||||
'content' => array (
|
||||
'name' => 'content',
|
||||
'vname' => 'LBL_CONTENT',
|
||||
'type' => 'text',
|
||||
'comment' => 'Mappings for all columns',
|
||||
),
|
||||
'default_values' => array (
|
||||
'name' => 'default_values',
|
||||
'vname' => 'LBL_CONTENT',
|
||||
'type' => 'text',
|
||||
'comment' => 'Default Values for all columns',
|
||||
),
|
||||
'has_header' => array (
|
||||
'name' => 'has_header',
|
||||
'vname' => 'LBL_HAS_HEADER',
|
||||
'type' => 'bool',
|
||||
'default' => '1',
|
||||
'required'=>true,
|
||||
'comment' => 'Indicator if source file contains a header row',
|
||||
),
|
||||
'deleted' => array (
|
||||
'name' => 'deleted',
|
||||
'vname' => 'LBL_DELETED',
|
||||
'type' => 'bool',
|
||||
'required'=>false,
|
||||
'reportable'=>false,
|
||||
'comment' => 'Record deletion indicator',
|
||||
),
|
||||
'date_entered' => array (
|
||||
'name' => 'date_entered',
|
||||
'vname' => 'LBL_DATE_ENTERED',
|
||||
'type' => 'datetime',
|
||||
'required'=>true,
|
||||
'comment' => 'Date record created',
|
||||
),
|
||||
'date_modified' => array (
|
||||
'name' => 'date_modified',
|
||||
'vname' => 'LBL_DATE_MODIFIED',
|
||||
'type' => 'datetime',
|
||||
'required'=>true,
|
||||
'comment' => 'Date record last modified',
|
||||
),
|
||||
'assigned_user_id' => array (
|
||||
'name' => 'assigned_user_id',
|
||||
'rname' => 'user_name',
|
||||
'id_name' => 'assigned_user_id',
|
||||
'vname' => 'LBL_ASSIGNED_TO',
|
||||
'type' => 'assigned_user_name',
|
||||
'table' => 'users',
|
||||
'isnull' => 'false',
|
||||
'dbType' => 'id',
|
||||
'reportable'=>false,
|
||||
'comment' => 'Assigned-to user',
|
||||
),
|
||||
'is_published' => array (
|
||||
'name' => 'is_published',
|
||||
'vname' => 'LBL_IS_PUBLISHED',
|
||||
'type' => 'varchar',
|
||||
'len' => '3',
|
||||
'required'=>true,
|
||||
'default'=>'no',
|
||||
'comment' => 'Indicator if mapping is published',
|
||||
),
|
||||
),
|
||||
'indices' => array (
|
||||
array(
|
||||
'name' =>'import_mapspk',
|
||||
'type' =>'primary',
|
||||
'fields'=>array('id')
|
||||
),
|
||||
array(
|
||||
'name' =>'idx_owner_module_name',
|
||||
'type' =>'index',
|
||||
'fields'=>array('assigned_user_id','module','name','deleted')
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$dictionary['UsersLastImport'] = array (
|
||||
'table' => 'users_last_import',
|
||||
'comment' => 'Maintains rows last imported by user',
|
||||
'fields' => array (
|
||||
'id' => array (
|
||||
'name' => 'id',
|
||||
'vname' => 'LBL_ID',
|
||||
'type' => 'id',
|
||||
'required'=>true,
|
||||
'reportable'=>false,
|
||||
'comment' => 'Unique identifier'
|
||||
),
|
||||
'assigned_user_id' => array (
|
||||
'name' => 'assigned_user_id',
|
||||
'rname' => 'user_name',
|
||||
'id_name' => 'assigned_user_id',
|
||||
'vname' => 'LBL_ASSIGNED_TO',
|
||||
'type' => 'assigned_user_name',
|
||||
'table' => 'users',
|
||||
'isnull' => 'false',
|
||||
'dbType' => 'id',
|
||||
'reportable'=>false,
|
||||
'comment' => 'User assigned to this record'
|
||||
),
|
||||
'import_module' => array (
|
||||
'name' => 'import_module',
|
||||
'vname' => 'LBL_BEAN_TYPE',
|
||||
'type' => 'varchar',
|
||||
'len' => '36',
|
||||
'comment' => 'Module for which import occurs'
|
||||
),
|
||||
'bean_type' => array (
|
||||
'name' => 'bean_type',
|
||||
'vname' => 'LBL_BEAN_TYPE',
|
||||
'type' => 'varchar',
|
||||
'len' => '36',
|
||||
'comment' => 'Bean type for which import occurs'
|
||||
),
|
||||
'bean_id' => array (
|
||||
'name' => 'bean_id',
|
||||
'vname' => 'LBL_BEAN_ID',
|
||||
'type' => 'id',
|
||||
'reportable'=>false,
|
||||
'comment' => 'ID of item identified by bean_type'
|
||||
),
|
||||
'deleted' => array (
|
||||
'name' => 'deleted',
|
||||
'vname' => 'LBL_DELETED',
|
||||
'type' => 'bool',
|
||||
'reportable'=>false,
|
||||
'required'=>false,
|
||||
'comment' => 'Record deletion indicator'
|
||||
),
|
||||
),
|
||||
'indices' => array (
|
||||
array(
|
||||
'name' =>'users_last_importpk',
|
||||
'type' =>'primary',
|
||||
'fields'=>array('id')
|
||||
),
|
||||
array(
|
||||
'name' =>'idx_user_id',
|
||||
'type' =>'index',
|
||||
'fields'=>array('assigned_user_id')
|
||||
)
|
||||
)
|
||||
);
|
||||
?>
|
||||
104
modules/Import/views/view.error.php
Executable file
104
modules/Import/views/view.error.php
Executable file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: view handler for error page of the import process
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/MVC/View/SugarView.php');
|
||||
|
||||
class ImportViewError extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::getMenu()
|
||||
*/
|
||||
public function getMenu(
|
||||
$module = null
|
||||
)
|
||||
{
|
||||
global $mod_strings, $current_language;
|
||||
|
||||
if ( empty($module) )
|
||||
$module = $_REQUEST['import_module'];
|
||||
|
||||
$old_mod_strings = $mod_strings;
|
||||
$mod_strings = return_module_language($current_language, $module);
|
||||
$returnMenu = parent::getMenu($module);
|
||||
$mod_strings = $old_mod_strings;
|
||||
|
||||
return $returnMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTab()
|
||||
*/
|
||||
protected function _getModuleTab()
|
||||
{
|
||||
global $app_list_strings, $moduleTabMap;
|
||||
|
||||
// Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions.
|
||||
if ( !empty($_REQUEST['module_tab']) )
|
||||
return $_REQUEST['module_tab'];
|
||||
elseif ( isset($moduleTabMap[$_REQUEST['import_module']]) )
|
||||
return $moduleTabMap[$_REQUEST['import_module']];
|
||||
// Default anonymous pages to be under Home
|
||||
elseif ( !isset($app_list_strings['moduleList'][$_REQUEST['import_module']]) )
|
||||
return 'Home';
|
||||
else
|
||||
return $_REQUEST['import_module'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::display()
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
$this->ss->assign("MOD", $mod_strings);
|
||||
$this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']);
|
||||
$this->ss->assign("ACTION", 'Step1');
|
||||
$this->ss->assign("MESSAGE",$_REQUEST['message']);
|
||||
$this->ss->assign("SOURCE","");
|
||||
if ( isset($_REQUEST['source']) )
|
||||
$this->ss->assign("SOURCE", $_REQUEST['source']);
|
||||
|
||||
$this->ss->display('modules/Import/tpls/error.tpl');
|
||||
}
|
||||
}
|
||||
297
modules/Import/views/view.last.php
Executable file
297
modules/Import/views/view.last.php
Executable file
@@ -0,0 +1,297 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: view handler for last step of the import process
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
require_once('include/MVC/View/SugarView.php');
|
||||
|
||||
require_once('modules/Import/ImportCacheFiles.php');
|
||||
|
||||
|
||||
class ImportViewLast extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::getMenu()
|
||||
*/
|
||||
public function getMenu(
|
||||
$module = null
|
||||
)
|
||||
{
|
||||
global $mod_strings, $current_language;
|
||||
|
||||
if ( empty($module) )
|
||||
$module = $_REQUEST['import_module'];
|
||||
|
||||
$old_mod_strings = $mod_strings;
|
||||
$mod_strings = return_module_language($current_language, $module);
|
||||
$returnMenu = parent::getMenu($module);
|
||||
$mod_strings = $old_mod_strings;
|
||||
|
||||
return $returnMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTab()
|
||||
*/
|
||||
protected function _getModuleTab()
|
||||
{
|
||||
global $app_list_strings, $moduleTabMap;
|
||||
|
||||
// Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions.
|
||||
if ( !empty($_REQUEST['module_tab']) )
|
||||
return $_REQUEST['module_tab'];
|
||||
elseif ( isset($moduleTabMap[$_REQUEST['import_module']]) )
|
||||
return $moduleTabMap[$_REQUEST['import_module']];
|
||||
// Default anonymous pages to be under Home
|
||||
elseif ( !isset($app_list_strings['moduleList'][$_REQUEST['import_module']]) )
|
||||
return 'Home';
|
||||
else
|
||||
return $_REQUEST['import_module'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
"<a href='index.php?module={$_REQUEST['import_module']}&action=index'>".translate('LBL_MODULE_NAME',$_REQUEST['import_module'])."</a>",
|
||||
"<a href='index.php?module=Import&action=Step1&import_module={$_REQUEST['import_module']}'>".$mod_strings['LBL_MODULE_NAME']."</a>",
|
||||
$mod_strings['LBL_RESULTS'],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::display()
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
global $mod_strings, $app_strings, $current_user, $sugar_config, $current_language;
|
||||
|
||||
$this->ss->assign("MOD", $mod_strings);
|
||||
$this->ss->assign("APP", $app_strings);
|
||||
$this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']);
|
||||
$this->ss->assign("TYPE", $_REQUEST['type']);
|
||||
$this->ss->assign("HEADER", $app_strings['LBL_IMPORT']." ". $mod_strings['LBL_MODULE_NAME']);
|
||||
$this->ss->assign("MODULE_TITLE", $this->getModuleTitle());
|
||||
// lookup this module's $mod_strings to get the correct module name
|
||||
$language = (isset($current_language)) ? ($current_language) : ($sugar_config['default_language']);
|
||||
$module_mod_strings =
|
||||
return_module_language($current_language, $_REQUEST['import_module']);
|
||||
$this->ss->assign("MODULENAME",$module_mod_strings['LBL_MODULE_NAME']);
|
||||
|
||||
$this->ss->assign("JAVASCRIPT", $this->_getJS());
|
||||
|
||||
// read status file to get totals for records imported, errors, and duplicates
|
||||
$count = 0;
|
||||
$errorCount = 0;
|
||||
$dupeCount = 0;
|
||||
$createdCount = 0;
|
||||
$updatedCount = 0;
|
||||
$fp = sugar_fopen(ImportCacheFiles::getStatusFileName(),'r');
|
||||
while (( $row = fgetcsv($fp, 8192) ) !== FALSE) {
|
||||
$count += (int) $row[0];
|
||||
$errorCount += (int) $row[1];
|
||||
$dupeCount += (int) $row[2];
|
||||
$createdCount += (int) $row[3];
|
||||
$updatedCount += (int) $row[4];
|
||||
}
|
||||
fclose($fp);
|
||||
|
||||
$this->ss->assign("errorCount",$errorCount);
|
||||
$this->ss->assign("dupeCount",$dupeCount);
|
||||
$this->ss->assign("createdCount",$createdCount);
|
||||
$this->ss->assign("updatedCount",$updatedCount);
|
||||
$this->ss->assign("errorFile",ImportCacheFiles::getErrorFileName());
|
||||
$this->ss->assign("errorrecordsFile",ImportCacheFiles::getErrorRecordsFileName());
|
||||
$this->ss->assign("dupeFile",ImportCacheFiles::getDuplicateFileName());
|
||||
|
||||
// load bean
|
||||
$focus = loadImportBean($_REQUEST['import_module']);
|
||||
if ( !$focus ) {
|
||||
showImportError($mod_strings['LBL_ERROR_IMPORTS_NOT_SET_UP'],$_REQUEST['import_module']);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $focus->object_name == "Prospect" ) {
|
||||
$this->ss->assign("PROSPECTLISTBUTTON",
|
||||
$this->_addToProspectListButton());
|
||||
}
|
||||
else {
|
||||
$this->ss->assign("PROSPECTLISTBUTTON","");
|
||||
}
|
||||
|
||||
$this->ss->display('modules/Import/tpls/last.tpl');
|
||||
|
||||
foreach ( UsersLastImport::getBeansByImport($_REQUEST['import_module']) as $beanname ) {
|
||||
// load bean
|
||||
if ( !( $focus instanceof $beanname ) ) {
|
||||
require_once($GLOBALS['beanFiles'][$beanname]);
|
||||
$focus = new $beanname;
|
||||
}
|
||||
// build listview to show imported records
|
||||
require_once('include/ListView/ListViewFacade.php');
|
||||
$lvf = new ListViewFacade($focus, $focus->module_dir, 0);
|
||||
|
||||
$params = array();
|
||||
if(!empty($_REQUEST['orderBy'])) {
|
||||
$params['orderBy'] = $_REQUEST['orderBy'];
|
||||
$params['overrideOrder'] = true;
|
||||
if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder'];
|
||||
}
|
||||
$beanname = ($focus->object_name == 'Case' ? 'aCase' : $focus->object_name);
|
||||
// add users_last_import joins so we only show records done in this import
|
||||
$params['custom_from'] = ', users_last_import';
|
||||
$params['custom_where'] = " AND users_last_import.assigned_user_id = '{$GLOBALS['current_user']->id}'
|
||||
AND users_last_import.bean_type = '{$beanname}'
|
||||
AND users_last_import.bean_id = {$focus->table_name}.id
|
||||
AND users_last_import.deleted = 0
|
||||
AND {$focus->table_name}.deleted = 0";
|
||||
$where = " {$focus->table_name}.id IN (
|
||||
SELECT users_last_import.bean_id
|
||||
FROM users_last_import
|
||||
WHERE users_last_import.assigned_user_id = '{$GLOBALS['current_user']->id}'
|
||||
AND users_last_import.bean_type = '{$beanname}'
|
||||
AND users_last_import.deleted = 0 )";
|
||||
|
||||
$lbl_last_imported = $mod_strings['LBL_LAST_IMPORTED'];
|
||||
$lvf->lv->mergeduplicates = false;
|
||||
$module_mod_strings = return_module_language($current_language, $focus->module_dir);
|
||||
$lvf->setup('', $where, $params, $module_mod_strings, 0, -1, '', strtoupper($beanname), array(), 'id');
|
||||
$lvf->display($lbl_last_imported.": ".$module_mod_strings['LBL_MODULE_NAME']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns JS used in this view
|
||||
*/
|
||||
private function _getJS()
|
||||
{
|
||||
return <<<EOJAVASCRIPT
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
document.getElementById('importmore').onclick = function(){
|
||||
document.getElementById('importlast').action.value = 'Step1';
|
||||
return true;
|
||||
}
|
||||
|
||||
document.getElementById('finished').onclick = function(){
|
||||
document.getElementById('importlast').module.value = document.getElementById('importlast').import_module.value;
|
||||
document.getElementById('importlast').action.value = 'index';
|
||||
return true;
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
|
||||
EOJAVASCRIPT;
|
||||
}
|
||||
/**
|
||||
* Returns a button to add this list of prospects to a Target List
|
||||
*
|
||||
* @return string html code to display button
|
||||
*/
|
||||
private function _addToProspectListButton()
|
||||
{
|
||||
global $app_strings, $sugar_version, $sugar_config, $current_user;
|
||||
|
||||
$query = "SELECT distinct
|
||||
prospects.id,
|
||||
prospects.assigned_user_id,
|
||||
prospects.first_name,
|
||||
prospects.last_name,
|
||||
prospects.phone_work,
|
||||
prospects.title,
|
||||
email_addresses.email_address email1,
|
||||
users.user_name as assigned_user_name
|
||||
FROM users_last_import,prospects
|
||||
LEFT JOIN users
|
||||
ON prospects.assigned_user_id=users.id
|
||||
LEFT JOIN email_addr_bean_rel on prospects.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module='Prospect' and email_addr_bean_rel.primary_address=1 and email_addr_bean_rel.deleted=0
|
||||
LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id
|
||||
|
||||
WHERE
|
||||
users_last_import.assigned_user_id=
|
||||
'{$current_user->id}'
|
||||
AND users_last_import.bean_type='Prospect'
|
||||
AND users_last_import.bean_id=prospects.id
|
||||
AND users_last_import.deleted=0
|
||||
AND prospects.deleted=0
|
||||
";
|
||||
|
||||
$popup_request_data = array(
|
||||
'call_back_function' => 'set_return_and_save_background',
|
||||
'form_name' => 'DetailView',
|
||||
'field_to_name_array' => array(
|
||||
'id' => 'subpanel_id',
|
||||
),
|
||||
'passthru_data' => array(
|
||||
'child_field' => 'notused',
|
||||
'return_url' => 'notused',
|
||||
'link_field_name' => 'notused',
|
||||
'module_name' => 'notused',
|
||||
'refresh_page'=>'1',
|
||||
'return_type'=>'addtoprospectlist',
|
||||
'parent_module'=>'ProspectLists',
|
||||
'parent_type'=>'ProspectList',
|
||||
'child_id'=>'id',
|
||||
'link_attribute'=>'prospects',
|
||||
'link_type'=>'default', //polymorphic or default
|
||||
)
|
||||
);
|
||||
|
||||
$popup_request_data['passthru_data']['query'] = urlencode($query);
|
||||
|
||||
$json = getJSONobj();
|
||||
$encoded_popup_request_data = $json->encode($popup_request_data);
|
||||
|
||||
return <<<EOHTML
|
||||
<script type="text/javascript" src="include/SubPanel/SubPanelTiles.js?s={$sugar_version}&c={$sugar_config['js_custom_version']}"></script>
|
||||
<input align=right" type="button" name="select_button" id="select_button" class="button"
|
||||
title="{$app_strings['LBL_ADD_TO_PROSPECT_LIST_BUTTON_LABEL']}"
|
||||
accesskey="{$app_strings['LBL_ADD_TO_PROSPECT_LIST_BUTTON_KEY']}"
|
||||
value="{$app_strings['LBL_ADD_TO_PROSPECT_LIST_BUTTON_LABEL']}"
|
||||
onclick='open_popup("ProspectLists",600,400,"",true,true,$encoded_popup_request_data,"Single","true");' />
|
||||
EOHTML;
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
305
modules/Import/views/view.step1.php
Executable file
305
modules/Import/views/view.step1.php
Executable file
@@ -0,0 +1,305 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: view handler for step 1 of the import process
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
require_once('include/MVC/View/SugarView.php');
|
||||
|
||||
|
||||
class ImportViewStep1 extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::getMenu()
|
||||
*/
|
||||
public function getMenu(
|
||||
$module = null
|
||||
)
|
||||
{
|
||||
global $mod_strings, $current_language;
|
||||
|
||||
if ( empty($module) )
|
||||
$module = $_REQUEST['import_module'];
|
||||
|
||||
$old_mod_strings = $mod_strings;
|
||||
$mod_strings = return_module_language($current_language, $module);
|
||||
$returnMenu = parent::getMenu($module);
|
||||
$mod_strings = $old_mod_strings;
|
||||
|
||||
return $returnMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTab()
|
||||
*/
|
||||
protected function _getModuleTab()
|
||||
{
|
||||
global $app_list_strings, $moduleTabMap;
|
||||
|
||||
// Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions.
|
||||
if ( !empty($_REQUEST['module_tab']) )
|
||||
return $_REQUEST['module_tab'];
|
||||
elseif ( isset($moduleTabMap[$_REQUEST['import_module']]) )
|
||||
return $moduleTabMap[$_REQUEST['import_module']];
|
||||
// Default anonymous pages to be under Home
|
||||
elseif ( !isset($app_list_strings['moduleList'][$_REQUEST['import_module']]) )
|
||||
return 'Home';
|
||||
else
|
||||
return $_REQUEST['import_module'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
"<a href='index.php?module={$_REQUEST['import_module']}&action=index'>".translate('LBL_MODULE_NAME',$_REQUEST['import_module'])."</a>",
|
||||
"<a href='index.php?module=Import&action=Step1&import_module={$_REQUEST['import_module']}'>".$mod_strings['LBL_MODULE_NAME']."</a>",
|
||||
$mod_strings['LBL_STEP_1_TITLE'],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::display()
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
global $mod_strings, $app_list_strings, $app_strings, $current_user;
|
||||
global $sugar_config;
|
||||
|
||||
$this->ss->assign("MODULE_TITLE", $this->getModuleTitle());
|
||||
$this->ss->assign("MOD", $mod_strings);
|
||||
$this->ss->assign("APP", $app_strings);
|
||||
$this->ss->assign("DELETE_INLINE_PNG", SugarThemeRegistry::current()->getImage('delete_inline','align="absmiddle" alt="'.$app_strings['LNK_DELETE'].'" border="0"'));
|
||||
$this->ss->assign("PUBLISH_INLINE_PNG", SugarThemeRegistry::current()->getImage('publish_inline','align="absmiddle" alt="'.$mod_strings['LBL_PUBLISH'].'" border="0"'));
|
||||
$this->ss->assign("UNPUBLISH_INLINE_PNG", SugarThemeRegistry::current()->getImage('unpublish_inline','align="absmiddle" alt="'.$mod_strings['LBL_UNPUBLISH'].'" border="0"'));
|
||||
$this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']);
|
||||
$this->ss->assign("JAVASCRIPT", $this->_getJS());
|
||||
|
||||
|
||||
// handle publishing and deleting import maps
|
||||
if (isset($_REQUEST['delete_map_id'])) {
|
||||
$import_map = new ImportMap();
|
||||
$import_map->mark_deleted($_REQUEST['delete_map_id']);
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['publish']) ) {
|
||||
$import_map = new ImportMap();
|
||||
$result = 0;
|
||||
|
||||
$import_map = $import_map->retrieve($_REQUEST['import_map_id'], false);
|
||||
|
||||
if ($_REQUEST['publish'] == 'yes') {
|
||||
$result = $import_map->mark_published($current_user->id,true);
|
||||
if (!$result) {
|
||||
$this->ss->assign("ERROR",$mod_strings['LBL_ERROR_UNABLE_TO_PUBLISH']);
|
||||
}
|
||||
}
|
||||
elseif ( $_REQUEST['publish'] == 'no') {
|
||||
// if you don't own this importmap, you do now!
|
||||
// unless you have a map by the same name
|
||||
$result = $import_map->mark_published($current_user->id,false);
|
||||
if (!$result) {
|
||||
$this->ss->assign("ERROR",$mod_strings['LBL_ERROR_UNABLE_TO_UNPUBLISH']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// load bean
|
||||
$focus = loadImportBean($_REQUEST['import_module']);
|
||||
if ( !$focus ) {
|
||||
showImportError($mod_strings['LBL_ERROR_IMPORTS_NOT_SET_UP'],$_REQUEST['import_module']);
|
||||
return;
|
||||
}
|
||||
|
||||
// trigger showing other software packages
|
||||
$this->ss->assign("show_salesforce",false);
|
||||
$this->ss->assign("show_outlook",false);
|
||||
$this->ss->assign("show_act",false);
|
||||
switch ($_REQUEST['import_module']) {
|
||||
case "Prospects":
|
||||
break;
|
||||
case "Accounts":
|
||||
$this->ss->assign("show_salesforce",true);
|
||||
$this->ss->assign("show_act",true);
|
||||
break;
|
||||
case "Contacts":
|
||||
$this->ss->assign("show_salesforce",true);
|
||||
$this->ss->assign("show_outlook",true);
|
||||
$this->ss->assign("show_act",true);
|
||||
break;
|
||||
default:
|
||||
$this->ss->assign("show_salesforce",true);
|
||||
break;
|
||||
}
|
||||
|
||||
// get user defined import maps
|
||||
$this->ss->assign('is_admin',is_admin($current_user));
|
||||
$import_map_seed = new ImportMap();
|
||||
$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) ) {
|
||||
$custom = array();
|
||||
foreach ( $custom_imports_arr as $import) {
|
||||
$custom[] = array(
|
||||
"IMPORT_NAME" => $import->name,
|
||||
"IMPORT_ID" => $import->id,
|
||||
);
|
||||
}
|
||||
$this->ss->assign('custom_imports',$custom);
|
||||
}
|
||||
|
||||
// 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) ) {
|
||||
$published = array();
|
||||
foreach ( $published_imports_arr as $import) {
|
||||
$published[] = array(
|
||||
"IMPORT_NAME" => $import->name,
|
||||
"IMPORT_ID" => $import->id,
|
||||
);
|
||||
}
|
||||
$this->ss->assign('published_imports',$published);
|
||||
}
|
||||
|
||||
$this->ss->display('modules/Import/tpls/step1.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns JS used in this view
|
||||
*/
|
||||
private function _getJS()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return <<<EOJAVASCRIPT
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
document.getElementById('custom_enclosure').onchange = function()
|
||||
{
|
||||
document.getElementById('importstep1').custom_enclosure_other.style.display = ( this.value == 'other' ? '' : 'none' );
|
||||
}
|
||||
|
||||
document.getElementById('gonext').onclick = function()
|
||||
{
|
||||
clear_all_errors();
|
||||
var sourceSelected = false;
|
||||
var typeSelected = false;
|
||||
var isError = false;
|
||||
var inputs = document.getElementsByTagName('input');
|
||||
for (var i = 0; i < inputs.length; ++i ){
|
||||
if ( !sourceSelected && inputs[i].name == 'source' ){
|
||||
if (inputs[i].checked) {
|
||||
sourceSelected = true;
|
||||
if ( inputs[i].value == 'other' && document.getElementById('importstep1').custom_delimiter.value == '' ) {
|
||||
add_error_style('importstep1','custom_delimiter',"{$mod_strings['ERR_MISSING_REQUIRED_FIELDS']} {$mod_strings['LBL_CUSTOM_DELIMITER']}");
|
||||
isError = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( !typeSelected && inputs[i].name == 'type' ){
|
||||
if (inputs[i].checked) {
|
||||
typeSelected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( !sourceSelected ) {
|
||||
add_error_style('importstep1','source\'][\'' + (document.getElementById('importstep1').source.length - 1) + '',"{$mod_strings['ERR_MISSING_REQUIRED_FIELDS']} {$mod_strings['LBL_WHAT_IS']}");
|
||||
isError = true;
|
||||
}
|
||||
if ( !typeSelected ) {
|
||||
add_error_style('importstep1','type\'][\'1',"{$mod_strings['ERR_MISSING_REQUIRED_FIELDS']} {$mod_strings['LBL_IMPORT_TYPE']}");
|
||||
isError = true;
|
||||
}
|
||||
return !isError;
|
||||
}
|
||||
|
||||
YAHOO.util.Event.onDOMReady(function()
|
||||
{
|
||||
var inputs = document.getElementsByTagName('input');
|
||||
for (var i = 0; i < inputs.length; ++i ){
|
||||
if (inputs[i].name == 'source' ) {
|
||||
inputs[i].onclick = function()
|
||||
{
|
||||
parentRow = this.parentNode.parentNode;
|
||||
switch(this.value) {
|
||||
case 'other':
|
||||
enclosureRow = document.getElementById('customEnclosure').parentNode.removeChild(document.getElementById('customEnclosure'));
|
||||
parentRow.parentNode.insertBefore(enclosureRow, document.getElementById('customDelimiter').nextSibling);
|
||||
document.getElementById('customDelimiter').style.display = '';
|
||||
document.getElementById('customEnclosure').style.display = '';
|
||||
break;
|
||||
case 'tab': case 'csv':
|
||||
enclosureRow = document.getElementById('customEnclosure').parentNode.removeChild(document.getElementById('customEnclosure'));
|
||||
parentRow.parentNode.insertBefore(enclosureRow, parentRow.nextSibling);
|
||||
document.getElementById('customDelimiter').style.display = 'none';
|
||||
document.getElementById('customEnclosure').style.display = '';
|
||||
break;
|
||||
default:
|
||||
document.getElementById('customDelimiter').style.display = 'none';
|
||||
document.getElementById('customEnclosure').style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
-->
|
||||
</script>
|
||||
|
||||
EOJAVASCRIPT;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
238
modules/Import/views/view.step2.php
Executable file
238
modules/Import/views/view.step2.php
Executable file
@@ -0,0 +1,238 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: view handler for step 2 of the import process
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/MVC/View/SugarView.php');
|
||||
|
||||
|
||||
class ImportViewStep2 extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::getMenu()
|
||||
*/
|
||||
public function getMenu(
|
||||
$module = null
|
||||
)
|
||||
{
|
||||
global $mod_strings, $current_language;
|
||||
|
||||
if ( empty($module) )
|
||||
$module = $_REQUEST['import_module'];
|
||||
|
||||
$old_mod_strings = $mod_strings;
|
||||
$mod_strings = return_module_language($current_language, $module);
|
||||
$returnMenu = parent::getMenu($module);
|
||||
$mod_strings = $old_mod_strings;
|
||||
|
||||
return $returnMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTab()
|
||||
*/
|
||||
protected function _getModuleTab()
|
||||
{
|
||||
global $app_list_strings, $moduleTabMap;
|
||||
|
||||
// Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions.
|
||||
if ( !empty($_REQUEST['module_tab']) )
|
||||
return $_REQUEST['module_tab'];
|
||||
elseif ( isset($moduleTabMap[$_REQUEST['import_module']]) )
|
||||
return $moduleTabMap[$_REQUEST['import_module']];
|
||||
// Default anonymous pages to be under Home
|
||||
elseif ( !isset($app_list_strings['moduleList'][$_REQUEST['import_module']]) )
|
||||
return 'Home';
|
||||
else
|
||||
return $_REQUEST['import_module'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
"<a href='index.php?module={$_REQUEST['import_module']}&action=index'>".translate('LBL_MODULE_NAME',$_REQUEST['import_module'])."</a>",
|
||||
"<a href='index.php?module=Import&action=Step1&import_module={$_REQUEST['import_module']}'>".$mod_strings['LBL_MODULE_NAME']."</a>",
|
||||
$mod_strings['LBL_STEP_2_TITLE'],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::display()
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
global $mod_strings, $app_list_strings, $app_strings, $current_user, $import_bean_map;
|
||||
global $import_mod_strings;
|
||||
|
||||
$this->ss->assign("MODULE_TITLE", $this->getModuleTitle());
|
||||
$this->ss->assign("MOD", $mod_strings);
|
||||
$this->ss->assign("APP", $app_strings);
|
||||
$this->ss->assign("IMP", $import_mod_strings);
|
||||
$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'
|
||||
? $_REQUEST['custom_enclosure'] :
|
||||
( !empty($_REQUEST['custom_enclosure_other'])
|
||||
? $_REQUEST['custom_enclosure_other'] : "" ) )));
|
||||
|
||||
$this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']);
|
||||
$this->ss->assign("HEADER", $app_strings['LBL_IMPORT']." ". $mod_strings['LBL_MODULE_NAME']);
|
||||
$this->ss->assign("JAVASCRIPT", $this->_getJS());
|
||||
|
||||
// load bean
|
||||
$focus = loadImportBean($_REQUEST['import_module']);
|
||||
if ( !$focus ) {
|
||||
showImportError($mod_strings['LBL_ERROR_IMPORTS_NOT_SET_UP'],$_REQUEST['import_module']);
|
||||
return;
|
||||
}
|
||||
|
||||
// special for importing from Outlook
|
||||
if ($_REQUEST['source'] == "outlook") {
|
||||
$this->ss->assign("SOURCE", $_REQUEST['source']);
|
||||
$this->ss->assign("SOURCE_NAME","Outlook ");
|
||||
$this->ss->assign("HAS_HEADER_CHECKED"," CHECKED");
|
||||
}
|
||||
// see if the source starts with 'custom'
|
||||
// if so, pull off the id, load that map, and get the name
|
||||
elseif ( strncasecmp("custom:",$_REQUEST['source'],7) == 0) {
|
||||
$id = substr($_REQUEST['source'],7);
|
||||
$import_map_seed = new ImportMap();
|
||||
$import_map_seed->retrieve($id, false);
|
||||
|
||||
$this->ss->assign("SOURCE_ID", $import_map_seed->id);
|
||||
$this->ss->assign("SOURCE_NAME", $import_map_seed->name);
|
||||
$this->ss->assign("SOURCE", $import_map_seed->source);
|
||||
if (isset($import_map_seed->delimiter))
|
||||
$this->ss->assign("CUSTOM_DELIMITER", $import_map_seed->delimiter);
|
||||
if (isset($import_map_seed->enclosure))
|
||||
$this->ss->assign("CUSTOM_ENCLOSURE", htmlentities($import_map_seed->enclosure));
|
||||
if ($import_map_seed->has_header)
|
||||
$this->ss->assign("HAS_HEADER_CHECKED"," CHECKED");
|
||||
}
|
||||
else {
|
||||
$classname = 'ImportMap' . ucfirst($_REQUEST['source']);
|
||||
require("modules/Import/{$classname}.php");
|
||||
$import_map_seed = new $classname;
|
||||
if (isset($import_map_seed->delimiter))
|
||||
$this->ss->assign("CUSTOM_DELIMITER", $import_map_seed->delimiter);
|
||||
if (isset($import_map_seed->enclosure))
|
||||
$this->ss->assign("CUSTOM_ENCLOSURE", htmlentities($import_map_seed->enclosure));
|
||||
if ($import_map_seed->has_header)
|
||||
$this->ss->assign("HAS_HEADER_CHECKED"," CHECKED");
|
||||
$this->ss->assign("SOURCE", $_REQUEST['source']);
|
||||
}
|
||||
|
||||
// add instructions for anything other than custom_delimited
|
||||
if ($_REQUEST['source'] != 'other')
|
||||
{
|
||||
$instructions = array();
|
||||
$lang_key = '';
|
||||
switch($_REQUEST['source']) {
|
||||
case "act":
|
||||
$lang_key = "ACT";
|
||||
break;
|
||||
case "outlook":
|
||||
$lang_key = "OUTLOOK";
|
||||
break;
|
||||
case "salesforce":
|
||||
$lang_key = "SF";
|
||||
break;
|
||||
case "tab":
|
||||
$lang_key = "TAB";
|
||||
break;
|
||||
case "csv":
|
||||
$lang_key = "CUSTOM";
|
||||
break;
|
||||
}
|
||||
if ( $lang_key != '' ) {
|
||||
for ($i = 1; isset($mod_strings["LBL_{$lang_key}_NUM_$i"]);$i++) {
|
||||
$instructions[] = array(
|
||||
"STEP_NUM" => $mod_strings["LBL_NUM_$i"],
|
||||
"INSTRUCTION_STEP" => $mod_strings["LBL_{$lang_key}_NUM_$i"],
|
||||
);
|
||||
}
|
||||
$this->ss->assign("INSTRUCTIONS_TITLE",$mod_strings["LBL_IMPORT_{$lang_key}_TITLE"]);
|
||||
$this->ss->assign("instructions",$instructions);
|
||||
}
|
||||
}
|
||||
|
||||
$this->ss->display('modules/Import/tpls/step2.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns JS used in this view
|
||||
*/
|
||||
private function _getJS()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return <<<EOJAVASCRIPT
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
document.getElementById('goback').onclick = function(){
|
||||
document.getElementById('importstep2').action.value = 'Step1';
|
||||
return true;
|
||||
}
|
||||
|
||||
document.getElementById('gonext').onclick = function(){
|
||||
document.getElementById('importstep2').action.value = 'Step3';
|
||||
clear_all_errors();
|
||||
var isError = false;
|
||||
// be sure we specify a file to upload
|
||||
if (document.getElementById('importstep2').userfile.value == "") {
|
||||
add_error_style(document.getElementById('importstep2').name,'userfile',"{$mod_strings['ERR_MISSING_REQUIRED_FIELDS']} {$mod_strings['ERR_SELECT_FILE']}");
|
||||
isError = true;
|
||||
}
|
||||
return !isError;
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
|
||||
EOJAVASCRIPT;
|
||||
}
|
||||
}
|
||||
765
modules/Import/views/view.step3.php
Executable file
765
modules/Import/views/view.step3.php
Executable file
@@ -0,0 +1,765 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: view handler for step 3 of the import process
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
require_once('include/MVC/View/SugarView.php');
|
||||
require_once('modules/Import/ImportFile.php');
|
||||
require_once('modules/Import/ImportFileSplitter.php');
|
||||
require_once('modules/Import/ImportCacheFiles.php');
|
||||
require_once('modules/Import/ImportDuplicateCheck.php');
|
||||
|
||||
require_once('include/upload_file.php');
|
||||
|
||||
class ImportViewStep3 extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::getMenu()
|
||||
*/
|
||||
public function getMenu(
|
||||
$module = null
|
||||
)
|
||||
{
|
||||
global $mod_strings, $current_language;
|
||||
|
||||
if ( empty($module) )
|
||||
$module = $_REQUEST['import_module'];
|
||||
|
||||
$old_mod_strings = $mod_strings;
|
||||
$mod_strings = return_module_language($current_language, $module);
|
||||
$returnMenu = parent::getMenu($module);
|
||||
$mod_strings = $old_mod_strings;
|
||||
|
||||
return $returnMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTab()
|
||||
*/
|
||||
protected function _getModuleTab()
|
||||
{
|
||||
global $app_list_strings, $moduleTabMap;
|
||||
|
||||
// Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions.
|
||||
if ( !empty($_REQUEST['module_tab']) )
|
||||
return $_REQUEST['module_tab'];
|
||||
elseif ( isset($moduleTabMap[$_REQUEST['import_module']]) )
|
||||
return $moduleTabMap[$_REQUEST['import_module']];
|
||||
// Default anonymous pages to be under Home
|
||||
elseif ( !isset($app_list_strings['moduleList'][$_REQUEST['import_module']]) )
|
||||
return 'Home';
|
||||
else
|
||||
return $_REQUEST['import_module'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTitleParams()
|
||||
*/
|
||||
protected function _getModuleTitleParams()
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
return array(
|
||||
"<a href='index.php?module={$_REQUEST['import_module']}&action=index'>".translate('LBL_MODULE_NAME',$_REQUEST['import_module'])."</a>",
|
||||
"<a href='index.php?module=Import&action=Step1&import_module={$_REQUEST['import_module']}'>".$mod_strings['LBL_MODULE_NAME']."</a>",
|
||||
$mod_strings['LBL_STEP_3_TITLE'],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::display()
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
global $mod_strings, $app_strings, $current_user, $sugar_config, $app_list_strings, $locale;
|
||||
$this->ss->assign("MOD", $mod_strings);
|
||||
$this->ss->assign("APP", $app_strings);
|
||||
$this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']);
|
||||
$has_header = ( isset( $_REQUEST['has_header']) ? 1 : 0 );
|
||||
$sugar_config['import_max_records_per_file'] =
|
||||
( empty($sugar_config['import_max_records_per_file'])
|
||||
? 1000 : $sugar_config['import_max_records_per_file'] );
|
||||
|
||||
// load the bean for the import module
|
||||
$focus = loadImportBean($_REQUEST['import_module']);
|
||||
if ( !$focus ) {
|
||||
showImportError($mod_strings['LBL_ERROR_IMPORTS_NOT_SET_UP'],$_REQUEST['import_module']);
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear out this user's last import
|
||||
$seedUsersLastImport = new UsersLastImport();
|
||||
$seedUsersLastImport->mark_deleted_by_user_id($current_user->id);
|
||||
ImportCacheFiles::clearCacheFiles();
|
||||
|
||||
// attempt to lookup a preexisting field map
|
||||
// use the custom one if specfied to do so in step 1
|
||||
$field_map = array();
|
||||
$default_values = array();
|
||||
$ignored_fields = array();
|
||||
if ( !empty( $_REQUEST['source_id'])) {
|
||||
$mapping_file = new ImportMap();
|
||||
$mapping_file->retrieve( $_REQUEST['source_id'],false);
|
||||
$_REQUEST['source'] = $mapping_file->source;
|
||||
$has_header = $mapping_file->has_header;
|
||||
if (isset($mapping_file->delimiter))
|
||||
$_REQUEST['custom_delimiter'] = $mapping_file->delimiter;
|
||||
if (isset($mapping_file->enclosure))
|
||||
$_REQUEST['custom_enclosure'] = htmlentities($mapping_file->enclosure);
|
||||
$field_map = $mapping_file->getMapping();
|
||||
$default_values = $mapping_file->getDefaultValues();
|
||||
$this->ss->assign("MAPNAME",$mapping_file->name);
|
||||
$this->ss->assign("CHECKMAP",'checked="checked" value="on"');
|
||||
}
|
||||
else {
|
||||
// Try to see if we have a custom mapping we can use
|
||||
// based upon the where the records are coming from
|
||||
// and what module we are importing into
|
||||
$classname = 'ImportMap' . ucfirst($_REQUEST['source']);
|
||||
require("modules/Import/{$classname}.php");
|
||||
$mapping_file = new $classname;
|
||||
if (isset($mapping_file->delimiter))
|
||||
$_REQUEST['custom_delimiter'] = $mapping_file->delimiter;
|
||||
if (isset($mapping_file->enclosure))
|
||||
$_REQUEST['custom_enclosure'] = htmlentities($mapping_file->enclosure);
|
||||
$ignored_fields = $mapping_file->getIgnoredFields($_REQUEST['import_module']);
|
||||
$field_map = $mapping_file->getMapping($_REQUEST['import_module']);
|
||||
}
|
||||
|
||||
$this->ss->assign("CUSTOM_DELIMITER",
|
||||
( !empty($_REQUEST['custom_delimiter']) ? $_REQUEST['custom_delimiter'] : "," ));
|
||||
$this->ss->assign("CUSTOM_ENCLOSURE",
|
||||
( !empty($_REQUEST['custom_enclosure']) ? $_REQUEST['custom_enclosure'] : "" ));
|
||||
|
||||
// handle uploaded file
|
||||
$uploadFile = new UploadFile('userfile');
|
||||
if (isset($_FILES['userfile']) && $uploadFile->confirm_upload())
|
||||
{
|
||||
$uploadFile->final_move('IMPORT_'.$focus->object_name.'_'.$current_user->id);
|
||||
$uploadFileName = $uploadFile->get_upload_path('IMPORT_'.$focus->object_name.'_'.$current_user->id);
|
||||
}
|
||||
else {
|
||||
showImportError($mod_strings['LBL_IMPORT_MODULE_ERROR_NO_UPLOAD'],$_REQUEST['import_module'],'Step2');
|
||||
return;
|
||||
}
|
||||
|
||||
// split file into parts
|
||||
$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
|
||||
);
|
||||
|
||||
// Now parse the file and look for errors
|
||||
$importFile = new ImportFile(
|
||||
$uploadFileName,
|
||||
$_REQUEST['custom_delimiter'],
|
||||
html_entity_decode($_REQUEST['custom_enclosure'],ENT_QUOTES)
|
||||
);
|
||||
|
||||
if ( !$importFile->fileExists() ) {
|
||||
showImportError($mod_strings['LBL_CANNOT_OPEN'],$_REQUEST['import_module'],'Step2');
|
||||
return;
|
||||
}
|
||||
|
||||
// retrieve first 3 rows
|
||||
$rows = array();
|
||||
$system_charset = $locale->default_export_charset;
|
||||
$user_charset = $locale->getExportCharset();
|
||||
$other_charsets = 'UTF-8, UTF-7, ASCII, EUC-JP,SJIS, eucJP-win, SJIS-win, JIS, ISO-2022-JP';
|
||||
$charset_for_import = $user_charset; //We will set the default import charset option by user's preference.
|
||||
$able_to_detect = function_exists('mb_detect_encoding');
|
||||
for ( $i = 0; $i < 3; $i++ ) {
|
||||
$rows[$i] = $importFile->getNextRow();
|
||||
if(!empty($rows[$i]) && $able_to_detect) {
|
||||
foreach($rows[$i] as & $temp_value) {
|
||||
$current_charset = mb_detect_encoding($temp_value, "UTF-8, {$user_charset}, {$system_charset}, {$other_charsets}");
|
||||
if(!empty($current_charset) && $current_charset != "UTF-8") {
|
||||
$temp_value = $locale->translateCharset($temp_value, $current_charset);// we will use utf-8 for displaying the data on the page.
|
||||
$charset_for_import = $current_charset;
|
||||
//set the default import charset option according to the current_charset.
|
||||
//If it is not utf-8, tt may be overwritten by the later one. So the uploaded file should not contain two types of charset($user_charset, $system_charset), and I think this situation will not occur.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$ret_field_count = $importFile->getFieldCount();
|
||||
|
||||
// Bug 14689 - Parse the first data row to make sure it has non-empty data in it
|
||||
$isempty = true;
|
||||
if ( $rows[(int)$has_header] != false ) {
|
||||
foreach ( $rows[(int)$has_header] as $value ) {
|
||||
if ( strlen(trim($value)) > 0 ) {
|
||||
$isempty = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($isempty || $rows[(int)$has_header] == false) {
|
||||
showImportError($mod_strings['LBL_NO_LINES'],$_REQUEST['import_module'],'Step2');
|
||||
return;
|
||||
}
|
||||
|
||||
// save first row to send to step 4
|
||||
$this->ss->assign("FIRSTROW", base64_encode(serialize($rows[0])));
|
||||
|
||||
// Now build template
|
||||
$this->ss->assign("TMP_FILE", $uploadFileName );
|
||||
$this->ss->assign("FILECOUNT", $splitter->getFileCount() );
|
||||
$this->ss->assign("RECORDCOUNT", $splitter->getRecordCount() );
|
||||
$this->ss->assign("RECORDTHRESHOLD", $sugar_config['import_max_records_per_file']);
|
||||
$this->ss->assign("SOURCE", $_REQUEST['source'] );
|
||||
$this->ss->assign("TYPE", $_REQUEST['type'] );
|
||||
$this->ss->assign("DELETE_INLINE_PNG", SugarThemeRegistry::current()->getImage('basic_search','align="absmiddle" alt="'.$app_strings['LNK_DELETE'].'" border="0"'));
|
||||
$this->ss->assign("PUBLISH_INLINE_PNG", SugarThemeRegistry::current()->getImage('advanced_search','align="absmiddle" alt="'.$mod_strings['LBL_PUBLISH'].'" border="0"'));
|
||||
$this->ss->assign("MODULE_TITLE", $this->getModuleTitle());
|
||||
$this->ss->assign("STEP4_TITLE",
|
||||
strip_tags(str_replace("\n","",get_module_title(
|
||||
$mod_strings['LBL_MODULE_NAME'],
|
||||
$mod_strings['LBL_MODULE_NAME']." ".$mod_strings['LBL_STEP_4_TITLE'],
|
||||
false
|
||||
)))
|
||||
);
|
||||
$this->ss->assign("HEADER", $app_strings['LBL_IMPORT']." ". $mod_strings['LBL_MODULE_NAME']);
|
||||
|
||||
// we export it as email_address, but import as email1
|
||||
$field_map['email_address'] = 'email1';
|
||||
|
||||
// build each row; row count is determined by the the number of fields in the import file
|
||||
$columns = array();
|
||||
$mappedFields = array();
|
||||
|
||||
for($field_count = 0; $field_count < $ret_field_count; $field_count++) {
|
||||
// See if we have any field map matches
|
||||
$defaultValue = "";
|
||||
// Bug 31260 - If the data rows have more columns than the header row, then just add a new header column
|
||||
if ( !isset($rows[0][$field_count]) )
|
||||
$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]));
|
||||
if ($has_header && isset( $field_map[$firstrow_name] ) ) {
|
||||
$defaultValue = $field_map[$firstrow_name];
|
||||
}
|
||||
elseif (isset($field_map[$field_count])) {
|
||||
$defaultValue = $field_map[$field_count];
|
||||
}
|
||||
elseif (empty( $_REQUEST['source_id'])) {
|
||||
$defaultValue = trim($rows[0][$field_count]);
|
||||
}
|
||||
|
||||
// build string of options
|
||||
$fields = $focus->get_importable_fields();
|
||||
$options = array();
|
||||
$defaultField = '';
|
||||
foreach ( $fields as $fieldname => $properties ) {
|
||||
// get field name
|
||||
if (!empty ($properties['vname']))
|
||||
$displayname = str_replace(":","",translate($properties['vname'] ,$focus->module_dir));
|
||||
else
|
||||
$displayname = str_replace(":","",translate($properties['name'] ,$focus->module_dir));
|
||||
// see if this is required
|
||||
$req_mark = "";
|
||||
$req_class = "";
|
||||
if ( array_key_exists($fieldname, $focus->get_import_required_fields()) ) {
|
||||
$req_mark = ' ' . $app_strings['LBL_REQUIRED_SYMBOL'];
|
||||
$req_class = ' class="required" ';
|
||||
}
|
||||
// see if we have a match
|
||||
$selected = '';
|
||||
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)) ) {
|
||||
$selected = ' selected="selected" ';
|
||||
$defaultField = $fieldname;
|
||||
$mappedFields[] = $fieldname;
|
||||
}
|
||||
}
|
||||
// get field type information
|
||||
$fieldtype = '';
|
||||
if ( isset($properties['type'])
|
||||
&& isset($mod_strings['LBL_IMPORT_FIELDDEF_' . strtoupper($properties['type'])]) )
|
||||
$fieldtype = ' [' . $mod_strings['LBL_IMPORT_FIELDDEF_' . strtoupper($properties['type'])] . '] ';
|
||||
if ( isset($properties['comment']) )
|
||||
$fieldtype .= ' - ' . $properties['comment'];
|
||||
$options[$displayname.$fieldname] = '<option value="'.$fieldname.'" title="'. $displayname . htmlentities($fieldtype) . '"'
|
||||
. $selected . $req_class . '>' . $displayname . $req_mark . '</option>\n';
|
||||
}
|
||||
|
||||
// get default field value
|
||||
$defaultFieldHTML = '';
|
||||
if ( !empty($defaultField) ) {
|
||||
$defaultFieldHTML = getControl(
|
||||
$_REQUEST['import_module'],
|
||||
$defaultField,
|
||||
$fields[$defaultField],
|
||||
( isset($default_values[$defaultField]) ? $default_values[$defaultField] : '' )
|
||||
);
|
||||
}
|
||||
|
||||
if ( isset($default_values[$defaultField]) )
|
||||
unset($default_values[$defaultField]);
|
||||
|
||||
// Bug 27046 - Sort the column name picker alphabetically
|
||||
ksort($options);
|
||||
|
||||
$columns[] = array(
|
||||
'field_choices' => implode('',$options),
|
||||
'default_field' => $defaultFieldHTML,
|
||||
'cell1' => str_replace(""",'',htmlspecialchars($rows[0][$field_count])),
|
||||
'cell2' => str_replace(""",'',htmlspecialchars($rows[1][$field_count])),
|
||||
'cell3' => str_replace(""",'',htmlspecialchars($rows[2][$field_count])),
|
||||
'show_remove' => false,
|
||||
);
|
||||
}
|
||||
|
||||
// add in extra defaulted fields if they are in the mapping record
|
||||
if ( count($default_values) > 0 ) {
|
||||
foreach ( $default_values as $field_name => $default_value ) {
|
||||
// build string of options
|
||||
$fields = $focus->get_importable_fields();
|
||||
$options = array();
|
||||
$defaultField = '';
|
||||
foreach ( $fields as $fieldname => $properties ) {
|
||||
// get field name
|
||||
if (!empty ($properties['vname']))
|
||||
$displayname = str_replace(":","",translate($properties['vname'] ,$focus->module_dir));
|
||||
else
|
||||
$displayname = str_replace(":","",translate($properties['name'] ,$focus->module_dir));
|
||||
// see if this is required
|
||||
$req_mark = "";
|
||||
$req_class = "";
|
||||
if ( array_key_exists($fieldname, $focus->get_import_required_fields()) ) {
|
||||
$req_mark = ' ' . $app_strings['LBL_REQUIRED_SYMBOL'];
|
||||
$req_class = ' class="required" ';
|
||||
}
|
||||
// see if we have a match
|
||||
$selected = '';
|
||||
if ( strtolower($fieldname) == strtolower($field_name)
|
||||
&& !in_array($fieldname,$mappedFields)
|
||||
&& !in_array($fieldname,$ignored_fields) ) {
|
||||
$selected = ' selected="selected" ';
|
||||
$defaultField = $fieldname;
|
||||
$mappedFields[] = $fieldname;
|
||||
}
|
||||
// get field type information
|
||||
$fieldtype = '';
|
||||
if ( isset($properties['type'])
|
||||
&& isset($mod_strings['LBL_IMPORT_FIELDDEF_' . strtoupper($properties['type'])]) )
|
||||
$fieldtype = ' [' . $mod_strings['LBL_IMPORT_FIELDDEF_' . strtoupper($properties['type'])] . '] ';
|
||||
if ( isset($properties['comment']) )
|
||||
$fieldtype .= ' - ' . $properties['comment'];
|
||||
$options[$displayname.$fieldname] = '<option value="'.$fieldname.'" title="'. $displayname . $fieldtype . '"' . $selected . $req_class . '>'
|
||||
. $displayname . $req_mark . '</option>\n';
|
||||
}
|
||||
|
||||
// get default field value
|
||||
$defaultFieldHTML = '';
|
||||
if ( !empty($defaultField) ) {
|
||||
$defaultFieldHTML = getControl(
|
||||
$_REQUEST['import_module'],
|
||||
$defaultField,
|
||||
$fields[$defaultField],
|
||||
$default_value
|
||||
);
|
||||
}
|
||||
|
||||
// Bug 27046 - Sort the column name picker alphabetically
|
||||
ksort($options);
|
||||
|
||||
$columns[] = array(
|
||||
'field_choices' => implode('',$options),
|
||||
'default_field' => $defaultFieldHTML,
|
||||
'show_remove' => true,
|
||||
);
|
||||
|
||||
$ret_field_count++;
|
||||
}
|
||||
}
|
||||
|
||||
$this->ss->assign("COLUMNCOUNT",$ret_field_count);
|
||||
$this->ss->assign("rows",$columns);
|
||||
|
||||
// get list of valid date/time formats
|
||||
$timeFormat = $current_user->getUserDateTimePreferences();
|
||||
$timeOptions = get_select_options_with_id($sugar_config['time_formats'], $timeFormat['time']);
|
||||
$dateOptions = get_select_options_with_id($sugar_config['date_formats'], $timeFormat['date']);
|
||||
$this->ss->assign('TIMEOPTIONS', $timeOptions);
|
||||
$this->ss->assign('DATEOPTIONS', $dateOptions);
|
||||
$this->ss->assign('datetimeformat', $GLOBALS['timedate']->get_cal_date_time_format());
|
||||
|
||||
// get list of valid timezones
|
||||
require_once('include/timezone/timezones.php');
|
||||
global $timezones;
|
||||
|
||||
$userTZ = $current_user->getPreference('timezone');
|
||||
if(empty($userTZ))
|
||||
$userTZ = lookupTimezone();
|
||||
|
||||
$timezoneOptions = '';
|
||||
ksort($timezones);
|
||||
foreach($timezones as $key => $value) {
|
||||
$selected =($userTZ == $key) ? ' SELECTED="true"' : '';
|
||||
$dst = !empty($value['dstOffset']) ? '(+DST)' : '';
|
||||
$gmtOffset =($value['gmtOffset'] / 60);
|
||||
|
||||
if(!strstr($gmtOffset,'-')) {
|
||||
$gmtOffset = '+'.$gmtOffset;
|
||||
}
|
||||
$timezoneOptions .= "<option value='$key'".$selected.">".str_replace(array('_','North'), array(' ', 'N.'),translate('timezone_dom','',$key)). "(GMT".$gmtOffset.") ".$dst."</option>";
|
||||
}
|
||||
$this->ss->assign('TIMEZONEOPTIONS', $timezoneOptions);
|
||||
|
||||
// get currency preference
|
||||
require_once('modules/Currencies/ListCurrency.php');
|
||||
$currency = new ListCurrency();
|
||||
$cur_id = $locale->getPrecedentPreference('currency', $current_user);
|
||||
if($cur_id) {
|
||||
$selectCurrency = $currency->getSelectOptions($cur_id);
|
||||
$this->ss->assign("CURRENCY", $selectCurrency);
|
||||
} else {
|
||||
$selectCurrency = $currency->getSelectOptions();
|
||||
$this->ss->assign("CURRENCY", $selectCurrency);
|
||||
}
|
||||
|
||||
$currenciesVars = "";
|
||||
$i=0;
|
||||
foreach($locale->currencies as $id => $arrVal) {
|
||||
$currenciesVars .= "currencies[{$i}] = '{$arrVal['symbol']}';\n";
|
||||
$i++;
|
||||
}
|
||||
$currencySymbolsJs = <<<eoq
|
||||
var currencies = new Object;
|
||||
{$currenciesVars}
|
||||
function setSymbolValue(id) {
|
||||
document.getElementById('symbol').value = currencies[id];
|
||||
}
|
||||
eoq;
|
||||
$this->ss->assign('currencySymbolJs', $currencySymbolsJs);
|
||||
|
||||
|
||||
// fill significant digits dropdown
|
||||
$significantDigits = $locale->getPrecedentPreference('default_currency_significant_digits', $current_user);
|
||||
$sigDigits = '';
|
||||
for($i=0; $i<=6; $i++) {
|
||||
if($significantDigits == $i) {
|
||||
$sigDigits .= '<option value="'.$i.'" selected="true">'.$i.'</option>';
|
||||
} else {
|
||||
$sigDigits .= '<option value="'.$i.'">'.$i.'</option>';
|
||||
}
|
||||
}
|
||||
|
||||
$this->ss->assign('sigDigits', $sigDigits);
|
||||
|
||||
$num_grp_sep = $current_user->getPreference('num_grp_sep');
|
||||
$dec_sep = $current_user->getPreference('dec_sep');
|
||||
$this->ss->assign("NUM_GRP_SEP",
|
||||
( empty($num_grp_sep)
|
||||
? $sugar_config['default_number_grouping_seperator'] : $num_grp_sep ));
|
||||
$this->ss->assign("DEC_SEP",
|
||||
( empty($dec_sep)
|
||||
? $sugar_config['default_decimal_seperator'] : $dec_sep ));
|
||||
$this->ss->assign('getNumberJs', $locale->getNumberJs());
|
||||
|
||||
// Name display format
|
||||
$this->ss->assign('default_locale_name_format', $locale->getLocaleFormatMacro($current_user));
|
||||
$this->ss->assign('getNameJs', $locale->getNameJs());
|
||||
|
||||
// Charset
|
||||
$charsetOptions = get_select_options_with_id(
|
||||
$locale->getCharsetSelect(), $charset_for_import);//wdong, bug 25927, here we should use the charset testing results from above.
|
||||
$this->ss->assign('CHARSETOPTIONS', $charsetOptions);
|
||||
|
||||
// handle building index selector
|
||||
global $dictionary, $current_language;
|
||||
|
||||
require_once("include/templates/TemplateGroupChooser.php");
|
||||
|
||||
$chooser_array = array();
|
||||
$chooser_array[0] = array();
|
||||
$idc = new ImportDuplicateCheck($focus);
|
||||
$chooser_array[1] = $idc->getDuplicateCheckIndexes();
|
||||
|
||||
$chooser = new TemplateGroupChooser();
|
||||
$chooser->args['id'] = 'selected_indices';
|
||||
$chooser->args['values_array'] = $chooser_array;
|
||||
$chooser->args['left_name'] = 'choose_index';
|
||||
$chooser->args['right_name'] = 'ignore_index';
|
||||
$chooser->args['left_label'] = $mod_strings['LBL_INDEX_USED'];
|
||||
$chooser->args['right_label'] = $mod_strings['LBL_INDEX_NOT_USED'];
|
||||
$this->ss->assign("TAB_CHOOSER", $chooser->display());
|
||||
|
||||
// show notes
|
||||
if ( $focus instanceof Person )
|
||||
$module_key = "LBL_CONTACTS_NOTE_";
|
||||
elseif ( $focus instanceof Company )
|
||||
$module_key = "LBL_ACCOUNTS_NOTE_";
|
||||
else
|
||||
$module_key = "LBL_".strtoupper($_REQUEST['import_module'])."_NOTE_";
|
||||
$notetext = '';
|
||||
for ($i = 1;isset($mod_strings[$module_key.$i]);$i++) {
|
||||
$notetext .= '<li>' . $mod_strings[$module_key.$i] . '</li>';
|
||||
}
|
||||
$this->ss->assign("NOTETEXT",$notetext);
|
||||
$this->ss->assign("HAS_HEADER",($has_header ? 'on' : 'off' ));
|
||||
|
||||
// get list of required fields
|
||||
$required = array();
|
||||
foreach ( array_keys($focus->get_import_required_fields()) as $name ) {
|
||||
$properties = $focus->getFieldDefinition($name);
|
||||
if (!empty ($properties['vname']))
|
||||
$required[$name] = str_replace(":","",translate($properties['vname'] ,$focus->module_dir));
|
||||
else
|
||||
$required[$name] = str_replace(":","",translate($properties['name'] ,$focus->module_dir));
|
||||
}
|
||||
// include anything needed for quicksearch to work
|
||||
require_once("include/TemplateHandler/TemplateHandler.php");
|
||||
$quicksearch_js = TemplateHandler::createQuickSearchCode($fields,$fields,'importstep3');
|
||||
$this->ss->assign("JAVASCRIPT", $quicksearch_js . "\n" . $this->_getJS($required));
|
||||
|
||||
$this->ss->assign('required_fields',implode(', ',$required));
|
||||
$this->ss->display('modules/Import/tpls/step3.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns JS used in this view
|
||||
*/
|
||||
private function _getJS($required)
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
$print_required_array = "";
|
||||
foreach ($required as $name=>$display) {
|
||||
$print_required_array .= "required['$name'] = '". $display . "';\n";
|
||||
}
|
||||
|
||||
$sqsWaitImage = SugarThemeRegistry::current()->getImageURL('sqsWait.gif');
|
||||
|
||||
return <<<EOJAVASCRIPT
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
document.getElementById('goback').onclick = function(){
|
||||
document.getElementById('importstep3').action.value = 'Step2';
|
||||
document.getElementById('importstep3').to_pdf.value = '0';
|
||||
return true;
|
||||
}
|
||||
|
||||
document.getElementById('importnow').onclick = function(){
|
||||
// get the list of indices chosen
|
||||
var chosen_indices = '';
|
||||
var selectedOptions = document.getElementById('choose_index_td').getElementsByTagName('select')[0].options.length;
|
||||
for (i = 0; i < selectedOptions; i++)
|
||||
{
|
||||
chosen_indices += document.getElementById('choose_index_td').getElementsByTagName('select')[0].options[i].value;
|
||||
if (i != (selectedOptions - 1))
|
||||
chosen_indices += "&";
|
||||
}
|
||||
document.getElementById('importstep3').display_tabs_def.value = chosen_indices;
|
||||
|
||||
// validate form
|
||||
clear_all_errors();
|
||||
var form = document.getElementById('importstep3');
|
||||
var hash = new Object();
|
||||
var required = new Object();
|
||||
$print_required_array
|
||||
var isError = false;
|
||||
for ( i = 0; i < form.length; i++ ) {
|
||||
if ( form.elements[i].name.indexOf("colnum",0) == 0) {
|
||||
if ( form.elements[i].value == "-1") {
|
||||
continue;
|
||||
}
|
||||
if ( hash[ form.elements[i].value ] == 1) {
|
||||
isError = true;
|
||||
add_error_style('importstep3',form.elements[i].name,"{$mod_strings['ERR_MULTIPLE']}");
|
||||
}
|
||||
hash[form.elements[i].value] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// check for required fields
|
||||
for(var field_name in required) {
|
||||
// contacts hack to bypass errors if full_name is set
|
||||
if (field_name == 'last_name' &&
|
||||
hash['full_name'] == 1) {
|
||||
continue;
|
||||
}
|
||||
if ( hash[ field_name ] != 1 ) {
|
||||
isError = true;
|
||||
add_error_style('importstep3',form.colnum_0.name,
|
||||
"{$mod_strings['ERR_MISSING_REQUIRED_FIELDS']} " + required[field_name]);
|
||||
}
|
||||
}
|
||||
|
||||
// return false if we got errors
|
||||
if (isError == true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Move on to next step
|
||||
document.getElementById('importstep3').action.value = 'Step4';
|
||||
ProcessImport.begin();
|
||||
}
|
||||
|
||||
// handle adding new row
|
||||
document.getElementById('addrow').onclick = function(){
|
||||
rownum = document.getElementById('importstep3').columncount.value;
|
||||
newrow = document.createElement("tr");
|
||||
|
||||
column0 = document.getElementById('row_0_col_0').cloneNode(true);
|
||||
column0.id = 'row_' + rownum + '_col_0';
|
||||
for ( i = 0; i < column0.childNodes.length; i++ ) {
|
||||
if ( column0.childNodes[i].name == 'colnum_0' ) {
|
||||
column0.childNodes[i].name = 'colnum_' + rownum;
|
||||
column0.childNodes[i].onchange = function(){
|
||||
var module = document.getElementById('importstep3').import_module.value;
|
||||
var fieldname = this.value;
|
||||
var matches = /colnum_([0-9]+)/i.exec(this.name);
|
||||
var fieldnum = matches[1];
|
||||
if ( fieldname == -1 ) {
|
||||
document.getElementById('defaultvaluepicker_'+fieldnum).innerHTML = '';
|
||||
return;
|
||||
}
|
||||
document.getElementById('defaultvaluepicker_'+fieldnum).innerHTML = '<img src="{$sqsWaitImage}" />'
|
||||
YAHOO.util.Connect.asyncRequest('GET', 'index.php?module=Import&action=GetControl&import_module='+module+'&field_name='+fieldname,
|
||||
{
|
||||
success: function(o)
|
||||
{
|
||||
document.getElementById('defaultvaluepicker_'+fieldnum).innerHTML = o.responseText;
|
||||
SUGAR.util.evalScript(o.responseText);
|
||||
enableQS(true);
|
||||
},
|
||||
failure: function(o) {/*failure handler code*/}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
newrow.appendChild(column0);
|
||||
|
||||
if ( document.getElementById('row_0_header') ) {
|
||||
column1 = document.getElementById('row_0_header').cloneNode(true);
|
||||
column1.innerHTML = ' ';
|
||||
newrow.appendChild(column1);
|
||||
}
|
||||
|
||||
column2 = document.getElementById('defaultvaluepicker_0').cloneNode(true);
|
||||
column2.id = 'defaultvaluepicker_' + rownum;
|
||||
newrow.appendChild(column2);
|
||||
|
||||
column3 = document.createElement('td');
|
||||
column3.className = 'tabDetailViewDL';
|
||||
if ( !document.getElementById('row_0_header') ) {
|
||||
column3.colSpan = 2;
|
||||
}
|
||||
column3.innerHTML = '<input title="{$mod_strings['LBL_REMOVE_ROW']}" accessKey="" id="deleterow_' + rownum + '" class="button" type="button" value=" {$mod_strings['LBL_REMOVE_ROW']} ">';
|
||||
newrow.appendChild(column3);
|
||||
|
||||
document.getElementById('importstep3').columncount.value = parseInt(document.getElementById('importstep3').columncount.value) + 1;
|
||||
|
||||
document.getElementById('row_0_col_0').parentNode.parentNode.insertBefore(newrow,this.parentNode.parentNode);
|
||||
|
||||
document.getElementById('deleterow_' + rownum).onclick = function(){
|
||||
this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);
|
||||
}
|
||||
}
|
||||
|
||||
YAHOO.util.Event.onDOMReady(function(){
|
||||
var selects = document.getElementsByTagName('select');
|
||||
for (var i = 0; i < selects.length; ++i ){
|
||||
if (selects[i].name.indexOf("colnum_") != -1 ) {
|
||||
// fetch the field input control via ajax
|
||||
selects[i].onchange = function(){
|
||||
var module = document.getElementById('importstep3').import_module.value;
|
||||
var fieldname = this.value;
|
||||
var matches = /colnum_([0-9]+)/i.exec(this.name);
|
||||
var fieldnum = matches[1];
|
||||
if ( fieldname == -1 ) {
|
||||
document.getElementById('defaultvaluepicker_'+fieldnum).innerHTML = '';
|
||||
return;
|
||||
}
|
||||
|
||||
document.getElementById('defaultvaluepicker_'+fieldnum).innerHTML = '<img src="{$sqsWaitImage}" />'
|
||||
YAHOO.util.Connect.asyncRequest('GET', 'index.php?module=Import&action=GetControl&import_module='+module+'&field_name='+fieldname,
|
||||
{
|
||||
success: function(o)
|
||||
{
|
||||
document.getElementById('defaultvaluepicker_'+fieldnum).innerHTML = o.responseText;
|
||||
SUGAR.util.evalScript(o.responseText);
|
||||
enableQS(true);
|
||||
},
|
||||
failure: function(o) {/*failure handler code*/}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
var inputs = document.getElementsByTagName('input');
|
||||
for (var i = 0; i < inputs.length; ++i ){
|
||||
if (inputs[i].id.indexOf("deleterow_") != -1 ) {
|
||||
inputs[i].onclick = function(){
|
||||
this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('toggleImportOptions').onclick = function() {
|
||||
if (document.getElementById('importOptions').style.display == 'none'){
|
||||
document.getElementById('importOptions').style.display = '';
|
||||
document.getElementById('toggleImportOptions').value=' {$mod_strings['LBL_HIDE_ADVANCED_OPTIONS']} ';
|
||||
document.getElementById('toggleImportOptions').title='{$mod_strings['LBL_HIDE_ADVANCED_OPTIONS']}';
|
||||
}
|
||||
else {
|
||||
document.getElementById('importOptions').style.display = 'none';
|
||||
document.getElementById('toggleImportOptions').value=' {$mod_strings['LBL_SHOW_ADVANCED_OPTIONS']} ';
|
||||
document.getElementById('toggleImportOptions').title='{$mod_strings['LBL_SHOW_ADVANCED_OPTIONS']}';
|
||||
}
|
||||
}
|
||||
|
||||
-->
|
||||
</script>
|
||||
|
||||
EOJAVASCRIPT;
|
||||
}
|
||||
}
|
||||
623
modules/Import/views/view.step4.php
Executable file
623
modules/Import/views/view.step4.php
Executable file
@@ -0,0 +1,623 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: view handler for step 4 of the import process
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/MVC/View/SugarView.php');
|
||||
require_once('modules/Import/ImportFile.php');
|
||||
require_once('modules/Import/ImportFileSplitter.php');
|
||||
require_once('modules/Import/ImportCacheFiles.php');
|
||||
require_once('modules/Import/ImportFieldSanitize.php');
|
||||
require_once('modules/Import/ImportDuplicateCheck.php');
|
||||
|
||||
class ImportViewStep4 extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::display()
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
global $sugar_config;
|
||||
|
||||
// Increase the max_execution_time since this step can take awhile
|
||||
ini_set("max_execution_time", max($sugar_config['import_max_execution_time'],3600));
|
||||
|
||||
// stop the tracker
|
||||
TrackerManager::getInstance()->pause();
|
||||
|
||||
// use our own error handler
|
||||
set_error_handler('handleImportErrors',E_ALL);
|
||||
|
||||
global $mod_strings, $app_strings, $current_user, $import_bean_map;
|
||||
global $app_list_strings, $timedate;
|
||||
|
||||
$update_only = ( isset($_REQUEST['import_type']) && $_REQUEST['import_type'] == 'update' );
|
||||
$firstrow = unserialize(base64_decode($_REQUEST['firstrow']));
|
||||
|
||||
// All the Look Up Caches are initialized here
|
||||
$enum_lookup_cache=array();
|
||||
|
||||
// Let's try and load the import bean
|
||||
$focus = loadImportBean($_REQUEST['import_module']);
|
||||
if ( !$focus ) {
|
||||
trigger_error($mod_strings['LBL_ERROR_IMPORTS_NOT_SET_UP'],E_USER_ERROR);
|
||||
}
|
||||
|
||||
// setup the importable fields array.
|
||||
$importable_fields = $focus->get_importable_fields();
|
||||
|
||||
// loop through all request variables
|
||||
$importColumns = array();
|
||||
foreach ($_REQUEST as $name => $value) {
|
||||
// only look for var names that start with "fieldNum"
|
||||
if (strncasecmp($name, "colnum_", 7) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// pull out the column position for this field name
|
||||
$pos = substr($name, 7);
|
||||
|
||||
if ( isset($importable_fields[$value]) ) {
|
||||
// now mark that we've seen this field
|
||||
$importColumns[$pos] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// set the default locale settings
|
||||
$ifs = new ImportFieldSanitize();
|
||||
$ifs->dateformat = $_REQUEST['importlocale_dateformat'];
|
||||
$ifs->timeformat = $_REQUEST['importlocale_timeformat'];
|
||||
$ifs->timezone = $_REQUEST['importlocale_timezone'];
|
||||
$currency = new Currency();
|
||||
$currency->retrieve($_REQUEST['importlocale_currency']);
|
||||
$ifs->currency_symbol = $currency->symbol;
|
||||
$ifs->default_currency_significant_digits
|
||||
= $_REQUEST['importlocale_default_currency_significant_digits'];
|
||||
$ifs->num_grp_sep
|
||||
= $_REQUEST['importlocale_num_grp_sep'];
|
||||
$ifs->dec_sep = $_REQUEST['importlocale_dec_sep'];
|
||||
$ifs->default_locale_name_format
|
||||
= $_REQUEST['importlocale_default_locale_name_format'];
|
||||
|
||||
// Check to be sure we are getting an import file that is in the right place
|
||||
if ( realpath(dirname($_REQUEST['tmp_file']).'/') != realpath($sugar_config['upload_dir']) )
|
||||
trigger_error($mod_strings['LBL_CANNOT_OPEN'],E_USER_ERROR);
|
||||
|
||||
// Open the import file
|
||||
$importFile = new ImportFile(
|
||||
$_REQUEST['tmp_file'],
|
||||
$_REQUEST['custom_delimiter'],
|
||||
html_entity_decode($_REQUEST['custom_enclosure'],ENT_QUOTES)
|
||||
);
|
||||
|
||||
if ( !$importFile->fileExists() ) {
|
||||
trigger_error($mod_strings['LBL_CANNOT_OPEN'],E_USER_ERROR);
|
||||
}
|
||||
|
||||
$fieldDefs = $focus->getFieldDefinitions();
|
||||
|
||||
unset($focus);
|
||||
|
||||
while ( $row = $importFile->getNextRow() ) {
|
||||
$focus = loadImportBean($_REQUEST['import_module']);
|
||||
$focus->unPopulateDefaultValues();
|
||||
$focus->save_from_post = false;
|
||||
$focus->team_id = null;
|
||||
$ifs->createdBeans = array();
|
||||
|
||||
$do_save = true;
|
||||
|
||||
for ( $fieldNum = 0; $fieldNum < $_REQUEST['columncount']; $fieldNum++ ) {
|
||||
// loop if this column isn't set
|
||||
if ( !isset($importColumns[$fieldNum]) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// get this field's properties
|
||||
$field = $importColumns[$fieldNum];
|
||||
$fieldDef = $focus->getFieldDefinition($field);
|
||||
$fieldTranslated = translate((isset($fieldDef['vname'])?$fieldDef['vname']:$fieldDef['name']),
|
||||
$_REQUEST['module'])." (".$fieldDef['name'].")";
|
||||
|
||||
// Bug 37241 - Don't re-import over a field we already set during the importing of another field
|
||||
if ( !empty($focus->$field) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// translate strings
|
||||
global $locale;
|
||||
if(empty($locale)) {
|
||||
$locale = new Localization();
|
||||
}
|
||||
if ( isset($row[$fieldNum]) )
|
||||
$rowValue = $locale->translateCharset(
|
||||
strip_tags(trim($row[$fieldNum])),
|
||||
$_REQUEST['importlocale_charset'],
|
||||
$sugar_config['default_charset']
|
||||
);
|
||||
else
|
||||
$rowValue = '';
|
||||
|
||||
// If there is an default value then use it instead
|
||||
if ( !empty($_REQUEST[$field]) ) {
|
||||
if ( is_array($_REQUEST[$field]) )
|
||||
$defaultRowValue = encodeMultienumValue($_REQUEST[$field]);
|
||||
else
|
||||
$defaultRowValue = $_REQUEST[$field];
|
||||
// translate default values to the date/time format for the import file
|
||||
if ( $fieldDef['type'] == 'date'
|
||||
&& $ifs->dateformat != $timedate->get_date_format() )
|
||||
$defaultRowValue = $timedate->swap_formats(
|
||||
$defaultRowValue, $ifs->dateformat, $timedate->get_date_format());
|
||||
if ( $fieldDef['type'] == 'time'
|
||||
&& $ifs->timeformat != $timedate->get_time_format() )
|
||||
$defaultRowValue = $timedate->swap_formats(
|
||||
$defaultRowValue, $ifs->timeformat, $timedate->get_time_format());
|
||||
if ( ($fieldDef['type'] == 'datetime' || $fieldDef['type'] == 'datetimecombo')
|
||||
&& $ifs->dateformat.' '.$ifs->timeformat != $timedate->get_date_time_format() )
|
||||
$defaultRowValue = $timedate->swap_formats(
|
||||
$defaultRowValue, $ifs->dateformat.' '.$ifs->timeformat,
|
||||
$timedate->get_date_time_format());
|
||||
if ( in_array($fieldDef['type'],array('currency','float','int','num'))
|
||||
&& $ifs->num_grp_sep != $current_user->getPreference('num_grp_sep') )
|
||||
$defaultRowValue = str_replace($current_user->getPreference('num_grp_sep'),
|
||||
$ifs->num_grp_sep,$defaultRowValue);
|
||||
if ( in_array($fieldDef['type'],array('currency','float'))
|
||||
&& $ifs->dec_sep != $current_user->getPreference('dec_sep') )
|
||||
$defaultRowValue = str_replace($current_user->getPreference('dec_sep'),
|
||||
$ifs->dec_sep,$defaultRowValue);
|
||||
$currency->retrieve('-99');
|
||||
$user_currency_symbol = $currency->symbol;
|
||||
if ( $fieldDef['type'] == 'currency'
|
||||
&& $ifs->currency_symbol != $user_currency_symbol )
|
||||
$defaultRowValue = str_replace($user_currency_symbol,
|
||||
$ifs->currency_symbol,$defaultRowValue);
|
||||
|
||||
|
||||
if ( empty($rowValue) ) {
|
||||
$rowValue = $defaultRowValue;
|
||||
unset($defaultRowValue);
|
||||
}
|
||||
}
|
||||
|
||||
// Bug 22705 - Don't update the First Name or Last Name value if Full Name is set
|
||||
if ( in_array($field, array('first_name','last_name')) && !empty($focus->full_name) )
|
||||
continue;
|
||||
|
||||
// loop if this value has not been set
|
||||
if ( !isset($rowValue) )
|
||||
continue;
|
||||
|
||||
// If the field is required and blank then error out
|
||||
if ( array_key_exists($field,$focus->get_import_required_fields())
|
||||
&& empty($rowValue)
|
||||
&& $rowValue!='0') {
|
||||
$importFile->writeError(
|
||||
$mod_strings['LBL_REQUIRED_VALUE'],
|
||||
$fieldTranslated,
|
||||
'NULL'
|
||||
);
|
||||
$do_save = false;
|
||||
}
|
||||
|
||||
// Handle the special case "Sync to Outlook"
|
||||
if ( $focus->object_name == "Contacts" && $field == 'sync_contact' ) {
|
||||
$bad_names = array();
|
||||
$returnValue = $ifs->synctooutlook(
|
||||
$rowValue,
|
||||
$fieldDef,
|
||||
$bad_names);
|
||||
// try the default value on fail
|
||||
if ( !$returnValue && !empty($defaultRowValue) )
|
||||
$returnValue = $ifs->synctooutlook(
|
||||
$defaultRowValue,
|
||||
$fieldDef,
|
||||
$bad_names);
|
||||
if ( !$returnValue ) {
|
||||
$importFile->writeError(
|
||||
$mod_strings['LBL_ERROR_SYNC_USERS'],
|
||||
$fieldTranslated,
|
||||
explode(",",$bad_names));
|
||||
$do_save = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle email1 and email2 fields ( these don't have the type of email )
|
||||
if ( $field == 'email1' || $field == 'email2' ) {
|
||||
$returnValue = $ifs->email($rowValue, $fieldDef);
|
||||
// try the default value on fail
|
||||
if ( !$returnValue && !empty($defaultRowValue) )
|
||||
$returnValue = $ifs->email(
|
||||
$defaultRowValue,
|
||||
$fieldDef);
|
||||
if ( $returnValue === FALSE ) {
|
||||
$do_save=0;
|
||||
$importFile->writeError(
|
||||
$mod_strings['LBL_ERROR_INVALID_EMAIL'],
|
||||
$fieldTranslated,
|
||||
$rowValue);
|
||||
}
|
||||
else {
|
||||
$rowValue = $returnValue;
|
||||
// check for current opt_out and invalid email settings for this email address
|
||||
// if we find any, set them now
|
||||
$emailres = $focus->db->query(
|
||||
"SELECT opt_out, invalid_email FROM email_addresses
|
||||
WHERE email_address = '".$focus->db->quote($rowValue)."'");
|
||||
if ( $emailrow = $focus->db->fetchByAssoc($emailres) ) {
|
||||
$focus->email_opt_out = $emailrow['opt_out'];
|
||||
$focus->invalid_email = $emailrow['invalid_email'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle splitting Full Name into First and Last Name parts
|
||||
if ( $field == 'full_name' && !empty($rowValue) ) {
|
||||
$ifs->fullname(
|
||||
$rowValue,
|
||||
$fieldDef,
|
||||
$focus);
|
||||
}
|
||||
|
||||
// to maintain 451 compatiblity
|
||||
if(!isset($fieldDef['module']) && $fieldDef['type']=='relate')
|
||||
$fieldDef['module'] = ucfirst($fieldDef['table']);
|
||||
|
||||
if(isset($fieldDef['custom_type']) && !empty($fieldDef['custom_type']))
|
||||
$fieldDef['type'] = $fieldDef['custom_type'];
|
||||
|
||||
// If the field is empty then there is no need to check the data
|
||||
if( !empty($rowValue) ) {
|
||||
switch ($fieldDef['type']) {
|
||||
case 'enum':
|
||||
case 'multienum':
|
||||
if ( isset($fieldDef['type']) && $fieldDef['type'] == "multienum" )
|
||||
$returnValue = $ifs->multienum($rowValue,$fieldDef);
|
||||
else
|
||||
$returnValue = $ifs->enum($rowValue,$fieldDef);
|
||||
// try the default value on fail
|
||||
if ( !$returnValue && !empty($defaultRowValue) )
|
||||
if ( isset($fieldDef['type']) && $fieldDef['type'] == "multienum" )
|
||||
$returnValue = $ifs->multienum($defaultRowValue,$fieldDef);
|
||||
else
|
||||
$returnValue = $ifs->enum($defaultRowValue,$fieldDef);
|
||||
if ( $returnValue === FALSE ) {
|
||||
$importFile->writeError(
|
||||
$mod_strings['LBL_ERROR_NOT_IN_ENUM']
|
||||
. implode(",",$app_list_strings[$fieldDef['options']]),
|
||||
$fieldTranslated,
|
||||
$rowValue);
|
||||
$do_save = 0;
|
||||
}
|
||||
else
|
||||
$rowValue = $returnValue;
|
||||
|
||||
break;
|
||||
case 'relate':
|
||||
case 'parent':
|
||||
$returnValue = $ifs->relate(
|
||||
$rowValue,
|
||||
$fieldDef,
|
||||
$focus,
|
||||
empty($defaultRowValue));
|
||||
if ( !$returnValue && !empty($defaultRowValue) )
|
||||
$returnValue = $ifs->relate(
|
||||
$defaultRowValue,
|
||||
$fieldDef,
|
||||
$focus);
|
||||
// Bug 33623 - Set the id value found from the above method call as an importColumn
|
||||
if ( $returnValue !== false )
|
||||
$importColumns[] = $fieldDef['id_name'];
|
||||
break;
|
||||
case 'teamset':
|
||||
$returnValue = $ifs->teamset(
|
||||
$rowValue,
|
||||
$fieldDef,
|
||||
$focus);
|
||||
$importColumns[] = 'team_set_id';
|
||||
$importColumns[] = 'team_id';
|
||||
break;
|
||||
case 'fullname':
|
||||
break;
|
||||
default:
|
||||
if ( method_exists('ImportFieldSanitize',$fieldDef['type']) ) {
|
||||
$fieldtype = $fieldDef['type'];
|
||||
$returnValue = $ifs->$fieldtype($rowValue, $fieldDef);
|
||||
// try the default value on fail
|
||||
if ( !$returnValue && !empty($defaultRowValue) )
|
||||
$returnValue = $ifs->$fieldtype(
|
||||
$defaultRowValue,
|
||||
$fieldDef);
|
||||
if ( !$returnValue ) {
|
||||
$do_save=0;
|
||||
$importFile->writeError(
|
||||
$mod_strings['LBL_ERROR_INVALID_'.strtoupper($fieldDef['type'])],
|
||||
$fieldTranslated,
|
||||
$rowValue);
|
||||
}
|
||||
else
|
||||
$rowValue = $returnValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
$focus->$field = $rowValue;
|
||||
unset($defaultRowValue);
|
||||
}
|
||||
|
||||
// Now try to validate flex relate fields
|
||||
if ( isset($focus->field_defs['parent_name'])
|
||||
&& isset($focus->parent_name)
|
||||
&& ($focus->field_defs['parent_name']['type'] == 'parent') ) {
|
||||
// populate values from the picker widget if the import file doesn't have them
|
||||
$parent_idField = $focus->field_defs['parent_name']['id_name'];
|
||||
if ( empty($focus->$parent_idField) && !empty($_REQUEST[$parent_idField]) )
|
||||
$focus->$parent_idField = $_REQUEST[$parent_idField];
|
||||
$parent_typeField = $focus->field_defs['parent_name']['type_name'];
|
||||
if ( empty($focus->$parent_typeField) && !empty($_REQUEST[$parent_typeField]) )
|
||||
$focus->$parent_typeField = $_REQUEST[$parent_typeField];
|
||||
// now validate it
|
||||
$returnValue = $ifs->parent(
|
||||
$focus->parent_name,
|
||||
$focus->field_defs['parent_name'],
|
||||
$focus,
|
||||
empty($_REQUEST['parent_name']));
|
||||
if ( !$returnValue && !empty($_REQUEST['parent_name']) )
|
||||
$returnValue = $ifs->parent(
|
||||
$_REQUEST['parent_name'],
|
||||
$focus->field_defs['parent_name'],
|
||||
$focus);
|
||||
}
|
||||
|
||||
// check to see that the indexes being entered are unique.
|
||||
if (isset($_REQUEST['display_tabs_def']) && $_REQUEST['display_tabs_def'] != ""){
|
||||
$idc = new ImportDuplicateCheck($focus);
|
||||
if ( $idc->isADuplicateRecord(explode('&', $_REQUEST['display_tabs_def'])) ){
|
||||
$importFile->markRowAsDuplicate();
|
||||
$this->_undoCreatedBeans($ifs->createdBeans);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// if the id was specified
|
||||
$newRecord = true;
|
||||
if ( !empty($focus->id) ) {
|
||||
$focus->id = $this->_convertId($focus->id);
|
||||
|
||||
// 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: ");
|
||||
|
||||
$dbrow = $focus->db->fetchByAssoc($result);
|
||||
|
||||
if (isset ($dbrow['id']) && $dbrow['id'] != -1) {
|
||||
// if it exists but was deleted, just remove it
|
||||
if (isset ($dbrow['deleted']) && $dbrow['deleted'] == 1 && $update_only==false) {
|
||||
$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);
|
||||
if ($focus->hasCustomFields()) {
|
||||
$query3 = "DELETE FROM {$focus->table_name}_cstm WHERE id_c='".$focus->db->quote($focus->id)."'";
|
||||
$result2 = $focus->db->query($query3);
|
||||
}
|
||||
$focus->new_with_id = true;
|
||||
}
|
||||
else {
|
||||
if( !$update_only ) {
|
||||
$do_save = 0;
|
||||
$importFile->writeError($mod_strings['LBL_ID_EXISTS_ALREADY'],'ID',$focus->id);
|
||||
$this->_undoCreatedBeans($ifs->createdBeans);
|
||||
continue;
|
||||
}
|
||||
$existing_focus = loadImportBean($_REQUEST['import_module']);
|
||||
$newRecord = false;
|
||||
if ( !( $existing_focus->retrieve($dbrow['id']) instanceOf SugarBean ) ) {
|
||||
$do_save = 0;
|
||||
$importFile->writeError($mod_strings['LBL_RECORD_CANNOT_BE_UPDATED'],'ID',$focus->id);
|
||||
$this->_undoCreatedBeans($ifs->createdBeans);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
$newData = $focus->toArray();
|
||||
foreach ( $newData as $focus_key => $focus_value )
|
||||
if ( in_array($focus_key,$importColumns) )
|
||||
$existing_focus->$focus_key = $focus_value;
|
||||
|
||||
$focus = $existing_focus;
|
||||
}
|
||||
unset($existing_focus);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$focus->new_with_id = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($do_save) {
|
||||
// Populate in any default values to the bean
|
||||
$focus->populateDefaultValues();
|
||||
|
||||
if ( !isset($focus->assigned_user_id) || $focus->assigned_user_id == '' && $newRecord ) {
|
||||
$focus->assigned_user_id = $current_user->id;
|
||||
}
|
||||
if ( !empty($focus->date_modified) )
|
||||
$focus->update_date_modified = false;
|
||||
$focus->optimistic_lock = false;
|
||||
if ( $focus->object_name == "Contacts" && isset($focus->sync_contact) ) {
|
||||
//copy the potential sync list to another varible
|
||||
$list_of_users=$focus->sync_contact;
|
||||
//and set it to false for the save
|
||||
$focus->sync_contact=false;
|
||||
} else if($focus->object_name == "User" && !empty($current_user) && $focus->is_admin && !is_admin($current_user) && is_admin_for_module($current_user, 'Users')) {
|
||||
sugar_die($GLOBALS['mod_strings']['ERR_IMPORT_SYSTEM_ADMININSTRATOR']);
|
||||
}
|
||||
// call any logic needed for the module preSave
|
||||
$focus->beforeImportSave();
|
||||
|
||||
$focus->save(false);
|
||||
|
||||
// call any logic needed for the module postSave
|
||||
$focus->afterImportSave();
|
||||
|
||||
if ( $focus->object_name == "Contacts" && isset($list_of_users) )
|
||||
$focus->process_sync_to_outlook($list_of_users);
|
||||
|
||||
// Update the created/updated counter
|
||||
$importFile->markRowAsImported($newRecord);
|
||||
|
||||
// Add ID to User's Last Import records
|
||||
if ( $newRecord )
|
||||
ImportFile::writeRowToLastImport(
|
||||
$_REQUEST['import_module'],
|
||||
($focus->object_name == 'Case' ? 'aCase' : $focus->object_name),
|
||||
$focus->id);
|
||||
}
|
||||
else
|
||||
$this->_undoCreatedBeans($ifs->createdBeans);
|
||||
}
|
||||
|
||||
// save mapping if requested
|
||||
if ( isset($_REQUEST['save_map_as']) && $_REQUEST['save_map_as'] != '' ) {
|
||||
$mapping_file = new ImportMap();
|
||||
if ( isset($_REQUEST['has_header']) && $_REQUEST['has_header'] == 'on') {
|
||||
$header_to_field = array ();
|
||||
foreach ($importColumns as $pos => $field_name) {
|
||||
if (isset($firstrow[$pos]) && isset($field_name)) {
|
||||
$header_to_field[$firstrow[$pos]] = $field_name;
|
||||
}
|
||||
}
|
||||
$mapping_file->setMapping($header_to_field);
|
||||
}
|
||||
else {
|
||||
$mapping_file->setMapping($importColumns);
|
||||
}
|
||||
|
||||
// save default fields
|
||||
$defaultValues = array();
|
||||
for ( $i = 0; $i < $_REQUEST['columncount']; $i++ )
|
||||
|
||||
if (isset($importColumns[$i]) && !empty($_REQUEST[$importColumns[$i]])) {
|
||||
$field = $importColumns[$i];
|
||||
$fieldDef = $focus->getFieldDefinition($field);
|
||||
if(!empty($fieldDef['custom_type']) && $fieldDef['custom_type'] == 'teamset') {
|
||||
require_once('include/SugarFields/Fields/Teamset/SugarFieldTeamset.php');
|
||||
$sugar_field = new SugarFieldTeamset('Teamset');
|
||||
$teams = $sugar_field->getTeamsFromRequest($field);
|
||||
if(isset($_REQUEST['primary_team_name_collection'])) {
|
||||
$primary_index = $_REQUEST['primary_team_name_collection'];
|
||||
}
|
||||
|
||||
//If primary_index was selected, ensure that the first Array entry is the primary team
|
||||
if(isset($primary_index)) {
|
||||
$count = 0;
|
||||
$new_teams = array();
|
||||
foreach($teams as $id=>$name) {
|
||||
if($primary_index == $count++) {
|
||||
$new_teams[$id] = $name;
|
||||
unset($teams[$id]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($teams as $id=>$name) {
|
||||
$new_teams[$id] = $name;
|
||||
}
|
||||
$teams = $new_teams;
|
||||
} //if
|
||||
|
||||
$json = getJSONobj();
|
||||
$defaultValues[$field] = $json->encode($teams);
|
||||
} else {
|
||||
$defaultValues[$field] = $_REQUEST[$importColumns[$i]];
|
||||
}
|
||||
}
|
||||
|
||||
$mapping_file->setDefaultValues($defaultValues);
|
||||
$result = $mapping_file->save(
|
||||
$current_user->id,
|
||||
$_REQUEST['save_map_as'],
|
||||
$_REQUEST['import_module'],
|
||||
$_REQUEST['source'],
|
||||
( isset($_REQUEST['has_header']) && $_REQUEST['has_header'] == 'on'),
|
||||
$_REQUEST['custom_delimiter'],
|
||||
html_entity_decode($_REQUEST['custom_enclosure'],ENT_QUOTES)
|
||||
);
|
||||
}
|
||||
|
||||
$importFile->writeStatus();
|
||||
}
|
||||
|
||||
/**
|
||||
* If a bean save is not done for some reason, this method will undo any of the beans that were created
|
||||
*
|
||||
* @param array $ids ids of user_last_import records created
|
||||
*/
|
||||
protected function _undoCreatedBeans(
|
||||
array $ids
|
||||
)
|
||||
{
|
||||
$focus = new UsersLastImport();
|
||||
foreach ($ids as $id)
|
||||
$focus->undoById($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* clean id's when being imported
|
||||
*
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
protected function _convertId(
|
||||
$string
|
||||
)
|
||||
{
|
||||
return preg_replace_callback(
|
||||
'|[^A-Za-z0-9\-]|',
|
||||
create_function(
|
||||
// single quotes are essential here,
|
||||
// or alternative escape all $ as \$
|
||||
'$matches',
|
||||
'return ord($matches[0]);'
|
||||
) ,
|
||||
$string);
|
||||
}
|
||||
}
|
||||
131
modules/Import/views/view.undo.php
Executable file
131
modules/Import/views/view.undo.php
Executable file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* 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: view handler for undo step of the import process
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/MVC/View/SugarView.php');
|
||||
|
||||
class ImportViewUndo extends SugarView
|
||||
{
|
||||
/**
|
||||
* @see SugarView::getMenu()
|
||||
*/
|
||||
public function getMenu(
|
||||
$module = null
|
||||
)
|
||||
{
|
||||
global $mod_strings, $current_language;
|
||||
|
||||
if ( empty($module) )
|
||||
$module = $_REQUEST['import_module'];
|
||||
|
||||
$old_mod_strings = $mod_strings;
|
||||
$mod_strings = return_module_language($current_language, $module);
|
||||
$returnMenu = parent::getMenu($module);
|
||||
$mod_strings = $old_mod_strings;
|
||||
|
||||
return $returnMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::_getModuleTab()
|
||||
*/
|
||||
protected function _getModuleTab()
|
||||
{
|
||||
global $app_list_strings, $moduleTabMap;
|
||||
|
||||
// Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions.
|
||||
if ( !empty($_REQUEST['module_tab']) )
|
||||
return $_REQUEST['module_tab'];
|
||||
elseif ( isset($moduleTabMap[$_REQUEST['import_module']]) )
|
||||
return $moduleTabMap[$_REQUEST['import_module']];
|
||||
// Default anonymous pages to be under Home
|
||||
elseif ( !isset($app_list_strings['moduleList'][$_REQUEST['import_module']]) )
|
||||
return 'Home';
|
||||
else
|
||||
return $_REQUEST['import_module'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SugarView::display()
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
global $mod_strings, $current_user, $current_language;
|
||||
|
||||
$this->ss->assign("MOD", $mod_strings);
|
||||
$this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']);
|
||||
// lookup this module's $mod_strings to get the correct module name
|
||||
$old_mod_strings = $mod_strings;
|
||||
$module_mod_strings =
|
||||
return_module_language($current_language, $_REQUEST['import_module']);
|
||||
$this->ss->assign("MODULENAME",$module_mod_strings['LBL_MODULE_NAME']);
|
||||
// reset old ones afterwards
|
||||
$mod_strings = $old_mod_strings;
|
||||
|
||||
|
||||
|
||||
$last_import = new UsersLastImport();
|
||||
$this->ss->assign('UNDO_SUCCESS',$last_import->undo($_REQUEST['import_module']));
|
||||
$this->ss->assign("JAVASCRIPT", $this->_getJS());
|
||||
|
||||
$this->ss->display('modules/Import/tpls/undo.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns JS used in this view
|
||||
*/
|
||||
private function _getJS()
|
||||
{
|
||||
return <<<EOJAVASCRIPT
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
document.getElementById('finished').onclick = function(){
|
||||
document.getElementById('importundo').module.value = document.getElementById('importundo').import_module.value;
|
||||
document.getElementById('importundo').action.value = 'index';
|
||||
return true;
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
|
||||
EOJAVASCRIPT;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user