mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
Fix bug where user preference for addressbook vCard was not used in some cases
This commit is contained in:
parent
cd9e0cfab5
commit
4fc8903129
@ -73,7 +73,7 @@ class addressbook_export_vcard implements importexport_iface_export_plugin {
|
||||
// vCard opens & closes the resource itself, but this doesn't seem to matter
|
||||
$meta = stream_get_meta_data($_stream);
|
||||
|
||||
$vcard = new addressbook_vcal();
|
||||
$vcard = new addressbook_vcal('addressbook','text/vcard');
|
||||
$vcard->export($this->selection, $meta['uri']);
|
||||
}
|
||||
|
||||
|
@ -157,10 +157,10 @@ class addressbook_hooks
|
||||
|
||||
$settings['vcard_charset'] = array(
|
||||
'type' => 'select',
|
||||
'label' => 'Charset for the vCard export',
|
||||
'label' => 'Charset for the vCard import and export',
|
||||
'name' => 'vcard_charset',
|
||||
'values' => translation::get_installed_charsets(),
|
||||
'help' => 'Which charset should be used for the vCard export.',
|
||||
'help' => 'Which charset should be used for the vCard import and export.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => false,
|
||||
'default'=> 'iso-8859-1',
|
||||
|
@ -111,6 +111,7 @@ class addressbook_import_vcard implements importexport_iface_import_plugin {
|
||||
$this->bocontacts = new addressbook_vcal();
|
||||
|
||||
$charset = $_definition->plugin_options['charset'];
|
||||
if($charset == 'user') $charset = $GLOBALS['egw_info']['user']['preferences']['addressbook']['vcard_charset'];
|
||||
|
||||
// Start counting successes
|
||||
$this->current = 0;
|
||||
@ -155,7 +156,9 @@ class addressbook_import_vcard implements importexport_iface_import_plugin {
|
||||
*/
|
||||
public function _vcard($_vcard, $owner)
|
||||
{
|
||||
$record = $this->bocontacts->vcardtoegw($_vcard,$this->definition->plugin_options['charset']);
|
||||
$charset = $_definition->plugin_options['charset'];
|
||||
if($charset == 'user') $charset = $GLOBALS['egw_info']['user']['preferences']['addressbook']['vcard_charset'];
|
||||
$record = $this->bocontacts->vcardtoegw($_vcard,$charset);
|
||||
|
||||
$record['owner'] = $owner;
|
||||
|
||||
|
@ -61,7 +61,15 @@
|
||||
|
||||
// Check file encoding matches import
|
||||
$sample = file_get_contents($content['file']['tmp_name'],false, null, 0, 1024);
|
||||
$required = $options['charset'] == 'user' || !$options['charset'] ? $GLOBALS['egw_info']['user']['preferences']['common']['csv_charset'] : $options['charset'];
|
||||
if($appname == 'addressbook' && $definition_obj->plugin == 'addressbook_import_vcard')
|
||||
{
|
||||
$preference = $GLOBALS['egw_info']['user']['preferences']['addressbook']['vcard_charset'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$preference = $GLOBALS['egw_info']['user']['preferences']['common']['csv_charset'];
|
||||
}
|
||||
$required = $options['charset'] == 'user' || !$options['charset'] ? $preference : $options['charset'];
|
||||
$encoding = translation::detect_encoding($sample);
|
||||
if($encoding && strtoupper($required) != strtoupper($encoding))
|
||||
{
|
||||
@ -71,7 +79,7 @@
|
||||
);
|
||||
}
|
||||
|
||||
$file = fopen($content['file']['tmp_name'], 'r');
|
||||
$file = fopen($content['file']['tmp_name'], 'rb');
|
||||
$count = 0;
|
||||
|
||||
// Some of the translation, conversion, etc look here
|
||||
|
Loading…
Reference in New Issue
Block a user