mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:49:10 +01:00
updated cvs-import with charset-conversation and automatialy run some string to id conversations
This commit is contained in:
parent
7b3f4277a7
commit
6596f08060
@ -24,18 +24,22 @@
|
|||||||
{
|
{
|
||||||
$GLOBALS['phpgw']->redirect_link('/home.php');
|
$GLOBALS['phpgw']->redirect_link('/home.php');
|
||||||
}
|
}
|
||||||
|
if ($_POST['cancel'])
|
||||||
|
{
|
||||||
|
$GLOBALS['phpgw']->redirect_link('/admin/index.php');
|
||||||
|
}
|
||||||
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('InfoLog - Import CSV-File');
|
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('InfoLog - Import CSV-File');
|
||||||
$GLOBALS['phpgw']->common->phpgw_header();
|
$GLOBALS['phpgw']->common->phpgw_header();
|
||||||
|
|
||||||
$boinfolog = createobject('infolog.boinfolog');
|
$boinfolog = createobject('infolog.boinfolog');
|
||||||
|
|
||||||
$GLOBALS['phpgw']->template->set_file(array('import_t' => 'csv_import.tpl'));
|
$GLOBALS['phpgw']->template->set_file(array('import_t' => 'csv_import.tpl'));
|
||||||
$GLOBALS['phpgw']->template->set_block('import_t','filename');
|
$GLOBALS['phpgw']->template->set_block('import_t','filename','filenamehandle');
|
||||||
$GLOBALS['phpgw']->template->set_block('import_t','fheader');
|
$GLOBALS['phpgw']->template->set_block('import_t','fheader','fheaderhandle');
|
||||||
$GLOBALS['phpgw']->template->set_block('import_t','fields');
|
$GLOBALS['phpgw']->template->set_block('import_t','fields','fieldshandle');
|
||||||
$GLOBALS['phpgw']->template->set_block('import_t','ffooter');
|
$GLOBALS['phpgw']->template->set_block('import_t','ffooter','ffooterhandle');
|
||||||
$GLOBALS['phpgw']->template->set_block('import_t','imported');
|
$GLOBALS['phpgw']->template->set_block('import_t','imported','importedhandle');
|
||||||
$GLOBALS['phpgw']->template->set_block('import_t','import');
|
$GLOBALS['phpgw']->template->set_block('import_t','import','importhandle');
|
||||||
|
|
||||||
|
|
||||||
// $GLOBALS['phpgw']->template->set_var("navbar_bg",$GLOBALS['phpgw_info']["theme"]["navbar_bg"]);
|
// $GLOBALS['phpgw']->template->set_var("navbar_bg",$GLOBALS['phpgw_info']["theme"]["navbar_bg"]);
|
||||||
@ -43,7 +47,7 @@
|
|||||||
|
|
||||||
$csvfile = isset($_POST['csvfile']) ? $_POST['csvfile'] : $_FILES['csvfile']['tmp_name'];
|
$csvfile = isset($_POST['csvfile']) ? $_POST['csvfile'] : $_FILES['csvfile']['tmp_name'];
|
||||||
|
|
||||||
if ($_POST['action'] == 'download' && (!$_POST['fieldsep'] || !$csvfile || !($fp=fopen($csvfile,"r"))))
|
if(($_POST['action'] == 'download' || $_POST['action'] == 'continue') && (!$_POST['fieldsep'] || !$csvfile || !($fp=fopen($csvfile,'rb'))))
|
||||||
{
|
{
|
||||||
$_POST['action'] = '';
|
$_POST['action'] = '';
|
||||||
}
|
}
|
||||||
@ -55,25 +59,6 @@
|
|||||||
$CPre = '|['; $CPreReg = '\|\['; // |{csv-fieldname} is expanded to the value of the csv-field
|
$CPre = '|['; $CPreReg = '\|\['; // |{csv-fieldname} is expanded to the value of the csv-field
|
||||||
$CPos = ']'; $CPosReg = '\]'; // if used together with @ (replacement is eval-ed) value gets autom. quoted
|
$CPos = ']'; $CPosReg = '\]'; // if used together with @ (replacement is eval-ed) value gets autom. quoted
|
||||||
|
|
||||||
function dump_array( $arr )
|
|
||||||
{
|
|
||||||
foreach($arr as $key => $val)
|
|
||||||
{
|
|
||||||
$ret .= ($ret ? ',' : '(') . "'$key' => '$val'";
|
|
||||||
}
|
|
||||||
return $ret.')';
|
|
||||||
}
|
|
||||||
|
|
||||||
function index( $value,$arr )
|
|
||||||
{
|
|
||||||
foreach($arr as $key => $val)
|
|
||||||
{
|
|
||||||
if ($value == $val)
|
|
||||||
return $key;
|
|
||||||
}
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
|
|
||||||
function addr_id( $n_family,$n_given,$org_name )
|
function addr_id( $n_family,$n_given,$org_name )
|
||||||
{ // find in Addressbook, at least n_family AND (n_given OR org_name) have to match
|
{ // find in Addressbook, at least n_family AND (n_given OR org_name) have to match
|
||||||
$contacts = createobject('phpgwapi.contacts');
|
$contacts = createobject('phpgwapi.contacts');
|
||||||
@ -99,7 +84,8 @@ function cat_id($cats)
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$cats = split('[,;]',$cats);
|
// no multiple cat's in InfoLog atm.
|
||||||
|
$cats = array($cats); //split('[,;]',$cats);
|
||||||
|
|
||||||
foreach($cats as $k => $cat)
|
foreach($cats as $k => $cat)
|
||||||
{
|
{
|
||||||
@ -133,13 +119,24 @@ function cat_id($cats)
|
|||||||
return $id_str;
|
return $id_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!is_object($GLOBALS['phpgw']->html))
|
||||||
|
{
|
||||||
|
$GLOBALS['phpgw']->html = CreateObject('phpgwapi.html');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_POST['next']) $_POST['action'] = 'next';
|
||||||
switch ($_POST['action'])
|
switch ($_POST['action'])
|
||||||
{
|
{
|
||||||
case '': // Start, ask Filename
|
case '': // Start, ask Filename
|
||||||
$GLOBALS['phpgw']->template->set_var('lang_csvfile',lang('CSV-Filename'));
|
$GLOBALS['phpgw']->template->set_var('lang_csvfile',lang('CSV-Filename'));
|
||||||
$GLOBALS['phpgw']->template->set_var('lang_fieldsep',lang('Fieldseparator'));
|
$GLOBALS['phpgw']->template->set_var('lang_fieldsep',lang('Fieldseparator'));
|
||||||
|
$GLOBALS['phpgw']->template->set_var('lang_charset',lang('Charset of file'));
|
||||||
|
$GLOBALS['phpgw']->template->set_var('select_charset',
|
||||||
|
$GLOBALS['phpgw']->html->select('charset','',
|
||||||
|
$GLOBALS['phpgw']->translation->get_installed_charsets()+
|
||||||
|
array('utf-8' => 'utf-8 (Unicode)'),True));
|
||||||
$GLOBALS['phpgw']->template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ',');
|
$GLOBALS['phpgw']->template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ',');
|
||||||
$GLOBALS['phpgw']->template->set_var('submit',lang('Download'));
|
$GLOBALS['phpgw']->template->set_var('submit',lang('Import'));
|
||||||
$GLOBALS['phpgw']->template->set_var('csvfile',$csvfile);
|
$GLOBALS['phpgw']->template->set_var('csvfile',$csvfile);
|
||||||
$GLOBALS['phpgw']->template->set_var('enctype','ENCTYPE="multipart/form-data"');
|
$GLOBALS['phpgw']->template->set_var('enctype','ENCTYPE="multipart/form-data"');
|
||||||
$hiddenvars .= '<input type="hidden" name="action" value="download">'."\n";
|
$hiddenvars .= '<input type="hidden" name="action" value="download">'."\n";
|
||||||
@ -147,6 +144,7 @@ function cat_id($cats)
|
|||||||
$GLOBALS['phpgw']->template->parse('rows','filename');
|
$GLOBALS['phpgw']->template->parse('rows','filename');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'continue':
|
||||||
case 'download':
|
case 'download':
|
||||||
$GLOBALS['phpgw']->preferences->read_repository();
|
$GLOBALS['phpgw']->preferences->read_repository();
|
||||||
$defaults = $GLOBALS['phpgw_info']['user']['preferences']['infolog']['cvs_import'];
|
$defaults = $GLOBALS['phpgw_info']['user']['preferences']['infolog']['cvs_import'];
|
||||||
@ -157,31 +155,32 @@ function cat_id($cats)
|
|||||||
$GLOBALS['phpgw']->template->set_var('lang_csv_fieldname',lang('CSV-Fieldname'));
|
$GLOBALS['phpgw']->template->set_var('lang_csv_fieldname',lang('CSV-Fieldname'));
|
||||||
$GLOBALS['phpgw']->template->set_var('lang_info_fieldname',lang('InfoLog-Fieldname'));
|
$GLOBALS['phpgw']->template->set_var('lang_info_fieldname',lang('InfoLog-Fieldname'));
|
||||||
$GLOBALS['phpgw']->template->set_var('lang_translation',lang("Translation").' <a href="#help">'.lang('help').'</a>');
|
$GLOBALS['phpgw']->template->set_var('lang_translation',lang("Translation").' <a href="#help">'.lang('help').'</a>');
|
||||||
$GLOBALS['phpgw']->template->set_var('submit',lang('Import'));
|
$GLOBALS['phpgw']->template->set_var('submit',
|
||||||
|
$GLOBALS['phpgw']->html->submit_button('convert','Import') . ' '.
|
||||||
|
$GLOBALS['phpgw']->html->submit_button('cancel','Cancel'));
|
||||||
$GLOBALS['phpgw']->template->set_var('lang_debug',lang('Test Import (show importable records <u>only</u> in browser)'));
|
$GLOBALS['phpgw']->template->set_var('lang_debug',lang('Test Import (show importable records <u>only</u> in browser)'));
|
||||||
$GLOBALS['phpgw']->template->parse('rows','fheader');
|
$GLOBALS['phpgw']->template->parse('rows','fheader');
|
||||||
$hiddenvars .= '<input type="hidden" name="action" value="import">'."\n".
|
|
||||||
'<input type="hidden" name="fieldsep" value="'.$_POST['fieldsep']."\">\n";
|
|
||||||
|
|
||||||
$info_names = array(
|
$info_names = array(
|
||||||
'type' => 'Type: task,phone,note,confirm,reject,email,fax',
|
'type' => 'Type: char(10) task,phone,note,confirm,reject,email,fax',
|
||||||
'from' => 'From: text(64) free text if no Addressbook-entry assigned',
|
'from' => 'From: text(64) free text if no Addressbook-entry assigned',
|
||||||
'addr' => 'Addr: text(64) phone-nr/email-address',
|
'addr' => 'Addr: text(64) phone-nr/email-address',
|
||||||
'subject' => 'Subject: text(64)',
|
'subject' => 'Subject: text(64)',
|
||||||
'des' => 'Description: text long free text',
|
'des' => 'Description: text long free text',
|
||||||
'owner' => 'Owner: int(11) user-id of owner, if empty current user',
|
'responsible' => 'Responsible: int(11) user-id or user-name',
|
||||||
'responsible' => 'Responsible: int(11) user-id of resp. person',
|
'owner' => 'Owner: int(11) user-id/-name of owner, if empty current user',
|
||||||
'access' => 'Access: public,private',
|
'access' => 'Access: public,private',
|
||||||
'cat' => 'Cathegory: int(11) cathegory-id',
|
'cat' => 'Category: int(11) category-id or -name (new ones got created)',
|
||||||
'datecreated' => 'Date Created: DateTime if empty = Start Date or now',
|
'startdate' => 'Start Date: DateTime: Timestamp or eg. YYYY-MM-DD hh:mm',
|
||||||
'startdate' => 'Start Date: DateTime',
|
|
||||||
'enddate' => 'End Date: DateTime',
|
'enddate' => 'End Date: DateTime',
|
||||||
|
'datecreated' => 'Date Created: DateTime, if empty = Start Date or now',
|
||||||
|
'datemodified'=> 'Date Last Modified: DateTime, if empty = Date Created',
|
||||||
|
'modifier' => 'Modifier: int(11) user-id, if empty current user',
|
||||||
'pri' => 'Priority: urgent,high,normal,low',
|
'pri' => 'Priority: urgent,high,normal,low',
|
||||||
//'time' => 'Time: int(11) time used in min',
|
'time' => 'Time: int(11) time used in min',
|
||||||
//'bill_cat' => 'Billing Cathegory: int(11)',
|
//'bill_cat' => 'Billing Cathegory: int(11)',
|
||||||
'status' => 'Status: offer,ongoing,call,will-call,done,billed',
|
'status' => 'Status: char(10) offer,ongoing,call,will-call,done,billed,xx%',
|
||||||
'confirm' => 'Confirmation: not,accept,finish,both when to confirm',
|
'confirm' => 'Confirmation: char(10) not,accept,finish,both when to confirm',
|
||||||
'cat_id' => 'Categorie id(s), to set use @cat_id(Cat1,Cat2)',
|
|
||||||
'addr_id' => 'Addressbook id, to set use @addr_id(nlast,nfirst,org)'
|
'addr_id' => 'Addressbook id, to set use @addr_id(nlast,nfirst,org)'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -207,6 +206,7 @@ function cat_id($cats)
|
|||||||
$info_name_options .= "<option value=\"$field\">".$GLOBALS['phpgw']->strip_html($name)."\n";
|
$info_name_options .= "<option value=\"$field\">".$GLOBALS['phpgw']->strip_html($name)."\n";
|
||||||
}
|
}
|
||||||
$csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']);
|
$csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']);
|
||||||
|
$csv_fields = $GLOBALS['phpgw']->translation->convert($csv_fields,$_POST['charset']);
|
||||||
$csv_fields[] = 'no CSV 1'; // eg. for static assignments
|
$csv_fields[] = 'no CSV 1'; // eg. for static assignments
|
||||||
$csv_fields[] = 'no CSV 2';
|
$csv_fields[] = 'no CSV 2';
|
||||||
$csv_fields[] = 'no CSV 3';
|
$csv_fields[] = 'no CSV 3';
|
||||||
@ -228,14 +228,25 @@ function cat_id($cats)
|
|||||||
$GLOBALS['phpgw']->template->parse('rows','fields',True);
|
$GLOBALS['phpgw']->template->parse('rows','fields',True);
|
||||||
}
|
}
|
||||||
$GLOBALS['phpgw']->template->set_var('lang_start',lang('Startrecord'));
|
$GLOBALS['phpgw']->template->set_var('lang_start',lang('Startrecord'));
|
||||||
$GLOBALS['phpgw']->template->set_var('start',$start);
|
$GLOBALS['phpgw']->template->set_var('start',get_var('start',array('POST'),1));
|
||||||
$GLOBALS['phpgw']->template->set_var('lang_max',lang('Number of records to read (<=200)'));
|
$msg = ($safe_mode = ini_get('safe_mode') == 'On') ? lang('to many might exceed your execution-time-limit'):
|
||||||
$GLOBALS['phpgw']->template->set_var('max',200);
|
lang('empty for all');
|
||||||
|
$GLOBALS['phpgw']->template->set_var('lang_max',lang('Number of records to read (%1)',$msg));
|
||||||
|
$GLOBALS['phpgw']->template->set_var('max',get_var('max',array('POST'),$safe_mode ? 200 : ''));
|
||||||
|
$GLOBALS['phpgw']->template->set_var('debug',get_var('debug',array('POST'),True)?' checked':'');
|
||||||
$GLOBALS['phpgw']->template->parse('rows','ffooter',True);
|
$GLOBALS['phpgw']->template->parse('rows','ffooter',True);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
$old = $csvfile; $csvfile = $GLOBALS['phpgw_info']['server']['temp_dir'].'/info_log_import_'.basename($csvfile);
|
if ($_POST['action'] == 'download')
|
||||||
rename($old,$csvfile);
|
{
|
||||||
$hiddenvars .= '<input type="hidden" name="csvfile" value="'.$csvfile.'">';
|
$old = $csvfile; $csvfile = $GLOBALS['phpgw_info']['server']['temp_dir'].'/info_log_import_'.basename($csvfile);
|
||||||
|
rename($old,$csvfile);
|
||||||
|
}
|
||||||
|
$hiddenvars = $GLOBALS['phpgw']->html->input_hidden(array(
|
||||||
|
'action' => 'import',
|
||||||
|
'fieldsep'=> $_POST['fieldsep'],
|
||||||
|
'csvfile' => $csvfile,
|
||||||
|
'charset' => $_POST['charset']
|
||||||
|
));
|
||||||
$help_on_trans = "<a name=\"help\"></a><b>How to use Translation's</b><p>".
|
$help_on_trans = "<a name=\"help\"></a><b>How to use Translation's</b><p>".
|
||||||
"Translations enable you to change / adapt the content of each CSV field for your needs. <br>".
|
"Translations enable you to change / adapt the content of each CSV field for your needs. <br>".
|
||||||
"General syntax is: <b>pattern1 ${ASep} replacement1 ${PSep} ... ${PSep} patternN ${ASep} replacementN</b><br>".
|
"General syntax is: <b>pattern1 ${ASep} replacement1 ${PSep} ... ${PSep} patternN ${ASep} replacementN</b><br>".
|
||||||
@ -264,17 +275,33 @@ function cat_id($cats)
|
|||||||
"searches the addressbook for an address and returns the id if it founds an exact match of at least ".
|
"searches the addressbook for an address and returns the id if it founds an exact match of at least ".
|
||||||
"<i>NFamily</i> AND (<i>NGiven</i> OR <i>Company</i>). This is necessary to link your imported InfoLog-entrys ".
|
"<i>NFamily</i> AND (<i>NGiven</i> OR <i>Company</i>). This is necessary to link your imported InfoLog-entrys ".
|
||||||
"with the addressbook.<br>".
|
"with the addressbook.<br>".
|
||||||
"<b>@cat_id(Cat1,...,CatN)</b> returns a (','-separated) list with the cat_id's. If a category isn't found, it ".
|
"<b>@cat_id(Cat-name)</b> returns a numerical cat_id. If a category isn't found, it ".
|
||||||
"will be automaticaly added.<p>".
|
"will be automaticaly added.<p>".
|
||||||
"I hope that helped to understand the features, if not <a href='mailto:RalfBecker@outdoor-training.de'>ask</a>.";
|
"I hope that helped to understand the features, if not <a href='mailto:RalfBecker@outdoor-training.de'>ask</a>.";
|
||||||
|
|
||||||
$GLOBALS['phpgw']->template->set_var('help_on_trans',lang($help_on_trans)); // I don't think anyone will translate this
|
$GLOBALS['phpgw']->template->set_var('help_on_trans',lang($help_on_trans)); // I don't think anyone will translate this
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'next':
|
||||||
|
$_POST['info_fields'] = unserialize(stripslashes($_POST['info_fields']));
|
||||||
|
$_POST['trans'] = unserialize(stripslashes($_POST['trans']));
|
||||||
|
// fall-through
|
||||||
case 'import':
|
case 'import':
|
||||||
|
$hiddenvars = $GLOBALS['phpgw']->html->input_hidden(array(
|
||||||
|
'action' => 'continue',
|
||||||
|
'fieldsep'=> $_POST['fieldsep'],
|
||||||
|
'csvfile' => $csvfile,
|
||||||
|
'charset' => $_POST['charset'],
|
||||||
|
'start' => $_POST['start']+(!$_POST['debug'] ? $_POST['max'] : 0),
|
||||||
|
'max' => $_POST['max'],
|
||||||
|
'debug' => $_POST['debug'],
|
||||||
|
'info_fields' => $_POST['info_fields'],
|
||||||
|
'trans' => $_POST['trans']
|
||||||
|
));
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
$fp=fopen($_POST['csvfile'],'r');
|
$fp=fopen($_POST['csvfile'],'r');
|
||||||
$csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']);
|
$csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']);
|
||||||
|
$csv_fields = $GLOBALS['phpgw']->translation->convert($csv_fields,$_POST['charset']);
|
||||||
$csv_fields[] = 'no CSV 1'; // eg. for static assignments
|
$csv_fields[] = 'no CSV 1'; // eg. for static assignments
|
||||||
$csv_fields[] = 'no CSV 2';
|
$csv_fields[] = 'no CSV 2';
|
||||||
$csv_fields[] = 'no CSV 3';
|
$csv_fields[] = 'no CSV 3';
|
||||||
@ -320,11 +347,26 @@ function cat_id($cats)
|
|||||||
|
|
||||||
$log .= "\t\t<td><b>$info</b></td>\n";
|
$log .= "\t\t<td><b>$info</b></td>\n";
|
||||||
}
|
}
|
||||||
$start = $_POST['start'] < 1 ? 1 : $_POST['start'];
|
if (!in_array('access',$info_fields)) // autocreate public access if not set by user
|
||||||
for ($i = 1; $i < $start && fgetcsv($fp,8000,$_POST['fieldsep']); ++$i) ; // overread lines before our start-record
|
|
||||||
|
|
||||||
for ($anz = 0; $anz < $_POST['max'] && ($fields = fgetcsv($fp,8000,$_POST['fieldsep'])); ++$anz)
|
|
||||||
{
|
{
|
||||||
|
$log .= "\t\t<td><b>access</b></td>\n";
|
||||||
|
}
|
||||||
|
$start = $_POST['start'] < 1 ? 1 : $_POST['start'];
|
||||||
|
|
||||||
|
// ignore empty lines, is_null($fields[0]) is returned on empty lines !!!
|
||||||
|
for($i = 1; $i < $start; ++$i) // overread lines before our start-record
|
||||||
|
{
|
||||||
|
while(($fields = fgetcsv($fp,8000,$_POST['fieldsep'])) && is_null($fields[0])) ;
|
||||||
|
}
|
||||||
|
for($anz = 0; !$_POST['max'] || $anz < $_POST['max']; ++$anz)
|
||||||
|
{
|
||||||
|
while(($fields = fgetcsv($fp,8000,$_POST['fieldsep'])) && is_null($fields[0])) ;
|
||||||
|
if (!$fields)
|
||||||
|
{
|
||||||
|
break; // EOF
|
||||||
|
}
|
||||||
|
$fields = $GLOBALS['phpgw']->translation->convert($fields,$_POST['charset']);
|
||||||
|
|
||||||
$log .= "\t</tr><tr><td>".($start+$anz)."</td>\n";
|
$log .= "\t</tr><tr><td>".($start+$anz)."</td>\n";
|
||||||
|
|
||||||
$values = array();
|
$values = array();
|
||||||
@ -339,14 +381,14 @@ function cat_id($cats)
|
|||||||
{
|
{
|
||||||
if (ereg((string) $pattern,$val))
|
if (ereg((string) $pattern,$val))
|
||||||
{
|
{
|
||||||
// echo "<p>csv_idx='$csv_idx',info='$info',trans_csv=".dump_array($trans_csv).",ereg_replace('$pattern','$replace','$val') = ";
|
// echo "<p>csv_idx='$csv_idx',info='$info',trans_csv=".print_r($trans_csv).",ereg_replace('$pattern','$replace','$val') = ";
|
||||||
$val = ereg_replace((string) $pattern,str_replace($VPre,'\\',$replace),(string) $val);
|
$val = ereg_replace((string) $pattern,str_replace($VPre,'\\',$replace),(string) $val);
|
||||||
// echo "'$val'</p>";
|
// echo "'$val'</p>";
|
||||||
|
|
||||||
$reg = $CPreReg.'([a-zA-Z_0-9]+)'.$CPosReg;
|
$reg = $CPreReg.'([a-zA-Z_0-9]+)'.$CPosReg;
|
||||||
while (ereg($reg,$val,$vars))
|
while (ereg($reg,$val,$vars))
|
||||||
{ // expand all CSV fields
|
{ // expand all CSV fields
|
||||||
$val = str_replace($CPre.$vars[1].$CPos,$val[0] == '@' ? "'".addslashes($fields[index($vars[1],$csv_fields)])."'" : $fields[index($vars[1],$csv_fields)],$val);
|
$val = str_replace($CPre.$vars[1].$CPos,$val[0] == '@' ? "'".addslashes($fields[array_search($vars[1],$csv_fields)])."'" : $fields[array_search($vars[1],$csv_fields)],$val);
|
||||||
}
|
}
|
||||||
if ($val[0] == '@')
|
if ($val[0] == '@')
|
||||||
{
|
{
|
||||||
@ -365,11 +407,44 @@ function cat_id($cats)
|
|||||||
|
|
||||||
$log .= "\t\t<td>$val</td>\n";
|
$log .= "\t\t<td>$val</td>\n";
|
||||||
}
|
}
|
||||||
|
$empty = !count($values);
|
||||||
|
|
||||||
|
// convert the category name to an id
|
||||||
|
if ($values['cat'] && !is_numeric($values['cat']))
|
||||||
|
{
|
||||||
|
$values['cat'] = cat_id($values['cat']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// convert dates to timestamps
|
||||||
|
foreach(array('datecreated','startdate','enddate','datemodified') as $date)
|
||||||
|
{
|
||||||
|
if (isset($values[$date]) && !is_numeric($date))
|
||||||
|
{
|
||||||
|
if (ereg('(.*)\.[0-9]+',$values[$date],$parts)) $values[$date] = $parts[1];
|
||||||
|
$values[$date] = strtotime($values[$date]);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!isset($values['datecreated'])) $values['datecreated'] = $values['startdate'];
|
if (!isset($values['datecreated'])) $values['datecreated'] = $values['startdate'];
|
||||||
|
|
||||||
if (!$_POST['debug'])
|
if (!isset($values['datemodified'])) $values['datemodified'] = $values['datecreated'];
|
||||||
|
|
||||||
|
// convert user-names to user-id's
|
||||||
|
foreach(array('owner','responsible') as $user)
|
||||||
{
|
{
|
||||||
$id = $boinfolog->write($values);
|
if (isset($values[$user]) && !is_numeric($user))
|
||||||
|
{
|
||||||
|
$values[$user] = $GLOBALS['phpgw']->accounts->name2id($values[$user]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!in_array('access',$info_fields))
|
||||||
|
{
|
||||||
|
$values['access'] = 'public'; // public access if not set by user
|
||||||
|
$log .= "\t\t<td>".$values['access']."</td>\n";
|
||||||
|
}
|
||||||
|
if(!$_POST['debug'] && !$empty) // dont import empty contacts
|
||||||
|
{
|
||||||
|
$id = $boinfolog->write($values,True,False);
|
||||||
|
|
||||||
if ($id && $values['addr_id'])
|
if ($id && $values['addr_id'])
|
||||||
{
|
{
|
||||||
$boinfolog->write(array(
|
$boinfolog->write(array(
|
||||||
@ -381,14 +456,18 @@ function cat_id($cats)
|
|||||||
}
|
}
|
||||||
$log .= "\t</tr>\n</table>\n";
|
$log .= "\t</tr>\n</table>\n";
|
||||||
|
|
||||||
$GLOBALS['phpgw']->template->set_var('anz_imported',$_POST['debug'] ?
|
$GLOBALS['phpgw']->template->set_var('anz_imported',($_POST['debug'] ?
|
||||||
lang( '%1 records read (not yet imported, you may go back and uncheck Test Import)',$anz,'<a href="javascript:history.back()">','</a>' ) :
|
lang('%1 records read (not yet imported, you may go %2back%3 and uncheck Test Import)',
|
||||||
lang( '%1 records imported',$anz ));
|
$anz,'','') :
|
||||||
|
lang('%1 records imported',$anz)). ' '.
|
||||||
|
(!$_POST['debug'] && $fields ? $GLOBALS['phpgw']->html->submit_button('next','Import next set') . ' ':'').
|
||||||
|
$GLOBALS['phpgw']->html->submit_button('continue','Back') . ' '.
|
||||||
|
$GLOBALS['phpgw']->html->submit_button('cancel','Cancel'));
|
||||||
$GLOBALS['phpgw']->template->set_var('log',$log);
|
$GLOBALS['phpgw']->template->set_var('log',$log);
|
||||||
$GLOBALS['phpgw']->template->parse('rows','imported');
|
$GLOBALS['phpgw']->template->parse('rows','imported');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$GLOBALS['phpgw']->template->set_var('hiddenvars',$hiddenvars);
|
$GLOBALS['phpgw']->template->set_var('hiddenvars',str_replace('{','{',$hiddenvars));
|
||||||
$GLOBALS['phpgw']->template->pfp('phpgw_body','import');
|
$GLOBALS['phpgw']->template->pfp('phpgw_body','import');
|
||||||
$GLOBALS['phpgw']->common->phpgw_footer();
|
$GLOBALS['phpgw']->common->phpgw_footer();
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@
|
|||||||
$this->so->delete($info_id);
|
$this->so->delete($info_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function write($values,$check_defaults=True)
|
function write($values,$check_defaults=True,$touch_modified=True)
|
||||||
{
|
{
|
||||||
while (list($key,$val) = each($values))
|
while (list($key,$val) = each($values))
|
||||||
{
|
{
|
||||||
@ -227,9 +227,14 @@
|
|||||||
{
|
{
|
||||||
$values['info_from'] = $this->link_id2from($values);
|
$values['info_from'] = $this->link_id2from($values);
|
||||||
}
|
}
|
||||||
$values['info_datemodified'] = time();
|
if ($touch_modified || !$values['info_datemodified'])
|
||||||
$values['info_modifier'] = $this->so->user;
|
{
|
||||||
|
$values['info_datemodified'] = time();
|
||||||
|
}
|
||||||
|
if ($touch_modified || !$values['info_modifier'])
|
||||||
|
{
|
||||||
|
$values['info_modifier'] = $this->so->user;
|
||||||
|
}
|
||||||
return $this->so->write($values);
|
return $this->so->write($values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
%1 records imported infolog de %1 Datensätze importiert
|
%1 records imported infolog de %1 Datensätze importiert
|
||||||
%1 records read (not yet imported, you may go back and uncheck test import) infolog de %1 Datensätze gelesen (noch nicht importiert, sie können %2zurück%3 gehen und Test Import ausschalten)
|
%1 records read (not yet imported, you may go %2back%3 and uncheck test import) infolog de %1 Datensätze gelesen (noch nicht importiert, sie können %2zurück%3 gehen und Test Import ausschalten)
|
||||||
- subprojects from infolog de - Untereinträge von
|
- subprojects from infolog de - Untereinträge von
|
||||||
0% infolog de 0%
|
0% infolog de 0%
|
||||||
10% infolog de 10%
|
10% infolog de 10%
|
||||||
@ -42,6 +42,7 @@ call infolog de anrufen
|
|||||||
cancel infolog de Abbruch
|
cancel infolog de Abbruch
|
||||||
categories infolog de Kategorien
|
categories infolog de Kategorien
|
||||||
category infolog de Kategorie
|
category infolog de Kategorie
|
||||||
|
charset of file infolog de Zeichensatz der Datei
|
||||||
check to set startday infolog de ankreutzen um Startdatum zu setzen
|
check to set startday infolog de ankreutzen um Startdatum zu setzen
|
||||||
click here to create the link infolog de hier klicken um die Verknüpfung zu erzeugen
|
click here to create the link infolog de hier klicken um die Verknüpfung zu erzeugen
|
||||||
click here to start the search infolog de hier klicken um die Suche zu starten
|
click here to start the search infolog de hier klicken um die Suche zu starten
|
||||||
@ -89,6 +90,7 @@ edit infolog de Bearbeiten
|
|||||||
edit or create categories for ingolog infolog de Kategorien für InfoLog bearbeiten oder neu anlegen
|
edit or create categories for ingolog infolog de Kategorien für InfoLog bearbeiten oder neu anlegen
|
||||||
edit the entry infolog de Eintrag bearbeiten
|
edit the entry infolog de Eintrag bearbeiten
|
||||||
edit this entry infolog de diesen Eintrag bearbeiten
|
edit this entry infolog de diesen Eintrag bearbeiten
|
||||||
|
empty for all infolog de leer für alle
|
||||||
enddate infolog de Enddatum
|
enddate infolog de Enddatum
|
||||||
enddate can not be before startdate infolog de Das Enddatum kann nicht vor dem Startdatum liegen
|
enddate can not be before startdate infolog de Das Enddatum kann nicht vor dem Startdatum liegen
|
||||||
enter a custom contact, leave empty if linked entry should be used infolog de benutzerdefinierter Kontakt, leer lassen um die Daten der Verknüpfung zu verwenden
|
enter a custom contact, leave empty if linked entry should be used infolog de benutzerdefinierter Kontakt, leer lassen um die Daten der Verknüpfung zu verwenden
|
||||||
@ -105,6 +107,7 @@ from infolog de Von
|
|||||||
high infolog de hoch
|
high infolog de hoch
|
||||||
id infolog de Id
|
id infolog de Id
|
||||||
import infolog de Import
|
import infolog de Import
|
||||||
|
import next set infolog de Nächsten Satz importieren
|
||||||
info log common de InfoLog
|
info log common de InfoLog
|
||||||
infolog common de InfoLog
|
infolog common de InfoLog
|
||||||
infolog - delete infolog de InfoLog - Löschen
|
infolog - delete infolog de InfoLog - Löschen
|
||||||
@ -142,7 +145,7 @@ normal infolog de normal
|
|||||||
not infolog de nicht
|
not infolog de nicht
|
||||||
not assigned infolog de nicht zugewiesen
|
not assigned infolog de nicht zugewiesen
|
||||||
note infolog de Notiz
|
note infolog de Notiz
|
||||||
number of records to read (<=200) infolog de Anzahl Datensätze lesen (<=200)
|
number of records to read (%1) infolog de Anzahl Datensätze lesen (%1)
|
||||||
number of row for a multiline inputfield or line of a multi-select-box infolog de Anzahl Zeilen für ein Mehrzeiliges Eingabefeld oder eines mehrfachen Auswahlfeldes
|
number of row for a multiline inputfield or line of a multi-select-box infolog de Anzahl Zeilen für ein Mehrzeiliges Eingabefeld oder eines mehrfachen Auswahlfeldes
|
||||||
offer infolog de Angebot
|
offer infolog de Angebot
|
||||||
ongoing infolog de in Arbeit
|
ongoing infolog de in Arbeit
|
||||||
@ -208,6 +211,7 @@ the name used internaly (<= 32 chars), changeing it makes existing data unavaili
|
|||||||
the text displayed to the user infolog de der Text der dem Benutzer angezeigt wird
|
the text displayed to the user infolog de der Text der dem Benutzer angezeigt wird
|
||||||
this is the filter infolog uses when you enter the application. filters limit the entries to show in the actual view. there are filters to show only finished, still open or futures entries of yourself or all users. infolog de Das ist der Filter, den InfoLog benutzt wenn es das erste mal aufgerufen wird. Filter beschränken die aktuelle Anzeige. Es gibt Filter um nur beendete, offene oder zukünftige Einträge von Ihnen oder allen Benutzern anzuzeigen.
|
this is the filter infolog uses when you enter the application. filters limit the entries to show in the actual view. there are filters to show only finished, still open or futures entries of yourself or all users. infolog de Das ist der Filter, den InfoLog benutzt wenn es das erste mal aufgerufen wird. Filter beschränken die aktuelle Anzeige. Es gibt Filter um nur beendete, offene oder zukünftige Einträge von Ihnen oder allen Benutzern anzuzeigen.
|
||||||
til when should the todo or phonecall be finished infolog de bis wann soll der Auftrag oder Anruf erledigt sein
|
til when should the todo or phonecall be finished infolog de bis wann soll der Auftrag oder Anruf erledigt sein
|
||||||
|
to many might exceed your execution-time-limit infolog de zu viel können ihre Laufzeitbeschränkung überschreiten
|
||||||
today infolog de Heute
|
today infolog de Heute
|
||||||
todo infolog de Auftrag
|
todo infolog de Auftrag
|
||||||
translation infolog de Translation
|
translation infolog de Translation
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
%1 records imported infolog en %1 records imported
|
%1 records imported infolog en %1 records imported
|
||||||
%1 records read (not yet imported, you may go back and uncheck test import) infolog en %1 records read (not yet imported, you may go %2back%3 and uncheck Test Import)
|
%1 records read (not yet imported, you may go %2back%3 and uncheck test import) infolog en %1 records read (not yet imported, you may go %2back%3 and uncheck Test Import)
|
||||||
- subprojects from infolog en - Subprojects from
|
- subprojects from infolog en - Subprojects from
|
||||||
0% infolog en 0%
|
0% infolog en 0%
|
||||||
10% infolog en 10%
|
10% infolog en 10%
|
||||||
@ -42,6 +42,7 @@ call infolog en call
|
|||||||
cancel infolog en Cancel
|
cancel infolog en Cancel
|
||||||
categories infolog en Categories
|
categories infolog en Categories
|
||||||
category infolog en Category
|
category infolog en Category
|
||||||
|
charset of file infolog en Charset of file
|
||||||
check to set startday infolog en check to set startday
|
check to set startday infolog en check to set startday
|
||||||
click here to create the link infolog en click here to create the Link
|
click here to create the link infolog en click here to create the Link
|
||||||
click here to start the search infolog en click here to start the search
|
click here to start the search infolog en click here to start the search
|
||||||
@ -89,6 +90,7 @@ edit infolog en Edit
|
|||||||
edit or create categories for ingolog infolog en Edit or create categories for IngoLog
|
edit or create categories for ingolog infolog en Edit or create categories for IngoLog
|
||||||
edit the entry infolog en Edit the entry
|
edit the entry infolog en Edit the entry
|
||||||
edit this entry infolog en Edit this entry
|
edit this entry infolog en Edit this entry
|
||||||
|
empty for all infolog en empty for all
|
||||||
enddate infolog en Enddate
|
enddate infolog en Enddate
|
||||||
enddate can not be before startdate infolog en Enddate can not be before startdate
|
enddate can not be before startdate infolog en Enddate can not be before startdate
|
||||||
enter a custom contact, leave empty if linked entry should be used infolog en enter a custom contact, leave empty if linked entry should be used
|
enter a custom contact, leave empty if linked entry should be used infolog en enter a custom contact, leave empty if linked entry should be used
|
||||||
@ -105,6 +107,7 @@ from infolog en From
|
|||||||
high infolog en high
|
high infolog en high
|
||||||
id infolog en Id
|
id infolog en Id
|
||||||
import infolog en Import
|
import infolog en Import
|
||||||
|
import next set infolog en import next set
|
||||||
info log common en InfoLog
|
info log common en InfoLog
|
||||||
infolog common en InfoLog
|
infolog common en InfoLog
|
||||||
infolog - delete infolog en Info Log - Delete
|
infolog - delete infolog en Info Log - Delete
|
||||||
@ -142,7 +145,7 @@ normal infolog en normal
|
|||||||
not infolog en not
|
not infolog en not
|
||||||
not assigned infolog en not assigned
|
not assigned infolog en not assigned
|
||||||
note infolog en Note
|
note infolog en Note
|
||||||
number of records to read (<=200) infolog en Number of records to read (<=200)
|
number of records to read (%1) infolog en Number of records to read (%1)
|
||||||
number of row for a multiline inputfield or line of a multi-select-box infolog en number of row for a multiline inputfield or line of a multi-select-box
|
number of row for a multiline inputfield or line of a multi-select-box infolog en number of row for a multiline inputfield or line of a multi-select-box
|
||||||
offer infolog en offer
|
offer infolog en offer
|
||||||
ongoing infolog en ongoing
|
ongoing infolog en ongoing
|
||||||
@ -207,6 +210,7 @@ the name used internaly (<= 32 chars), changeing it makes existing data unavaili
|
|||||||
the text displayed to the user infolog en the text displayed to the user
|
the text displayed to the user infolog en the text displayed to the user
|
||||||
this is the filter infolog uses when you enter the application. filters limit the entries to show in the actual view. there are filters to show only finished, still open or futures entries of yourself or all users. infolog en This is the filter InfoLog uses when you enter the application. Filters limit the entries to show in the actual view. There are filters to show only finished, still open or futures entries of yourself or all users.
|
this is the filter infolog uses when you enter the application. filters limit the entries to show in the actual view. there are filters to show only finished, still open or futures entries of yourself or all users. infolog en This is the filter InfoLog uses when you enter the application. Filters limit the entries to show in the actual view. There are filters to show only finished, still open or futures entries of yourself or all users.
|
||||||
til when should the todo or phonecall be finished infolog en til when should the ToDo or Phonecall be finished
|
til when should the todo or phonecall be finished infolog en til when should the ToDo or Phonecall be finished
|
||||||
|
to many might exceed your execution-time-limit infolog en to many might exceed your execution-time-limit
|
||||||
today infolog en Today
|
today infolog en Today
|
||||||
todo infolog en ToDo
|
todo infolog en ToDo
|
||||||
translation infolog en Translation
|
translation infolog en Translation
|
||||||
|
@ -7,6 +7,12 @@
|
|||||||
<td>{lang_fieldsep}</td>
|
<td>{lang_fieldsep}</td>
|
||||||
<td><input name="fieldsep" size=1 value="{fieldsep}"></td>
|
<td><input name="fieldsep" size=1 value="{fieldsep}"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{lang_charset}</td>
|
||||||
|
<td>
|
||||||
|
{select_charset}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr><td> </td>
|
<tr><td> </td>
|
||||||
<td><INPUT NAME="convert" TYPE="submit" VALUE="{submit}"></TD>
|
<td><INPUT NAME="convert" TYPE="submit" VALUE="{submit}"></TD>
|
||||||
</TR>
|
</TR>
|
||||||
@ -30,15 +36,15 @@
|
|||||||
|
|
||||||
<!-- BEGIN ffooter -->
|
<!-- BEGIN ffooter -->
|
||||||
<tr>
|
<tr>
|
||||||
<td rowspan=2 valign="middle"><br><INPUT NAME="convert" TYPE="submit" VALUE="{submit}"></TD>
|
<td rowspan="2" valign="middle" nowrap><br>{submit}</TD>
|
||||||
<td colspan=2><br>
|
<td colspan="2"><br>
|
||||||
{lang_start} <INPUT name="start" type="text" size="5" value="{start}">
|
{lang_start} <INPUT name="start" type="text" size="5" value="{start}">
|
||||||
{lang_max} <INPUT name="max" type="text" size="3" value="{max}"><td>
|
{lang_max} <INPUT name="max" type="text" size="3" value="{max}"><td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><INPUT name="debug" type="checkbox" value="1" checked> {lang_debug}</td>
|
<td colspan="2"><INPUT name="debug" type="checkbox" value="1"{debug}> {lang_debug}</td>
|
||||||
</TR>
|
</TR>
|
||||||
<tr><td colspan=3> <p>
|
<tr><td colspan="3"> <p>
|
||||||
{help_on_trans}
|
{help_on_trans}
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<!-- END ffooter -->
|
<!-- END ffooter -->
|
||||||
|
Loading…
Reference in New Issue
Block a user