From: Jakob Haufe Date: Wed, 28 Nov 2012 22:52:47 +0000 (+0100) Subject: Make homephone multivalue aware X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d818eb7239ada7c2f55b21766b376254f19e2ca6;p=contagged Make homephone multivalue aware This makes it possible to have an arbitrary number of homephone values. CSV export will only use the first one, as before. VCF importer should also correctly recognize multiple TEL;HOME;VOICE fields. --- diff --git a/import.php b/import.php index 0cfa1dc..d369b1c 100644 --- a/import.php +++ b/import.php @@ -100,7 +100,7 @@ function vcard_entry($vcf){ }elseif(empty($entry['homephone']) && my_array_search('HOME',(array) $tel['param']['TYPE']) !== false && my_array_search('VOICE',(array) $tel['param']['TYPE']) !== false){ - $entry['homephone'] = $tel['value'][0][0]; + $entry['homephone'][] = $tel['value'][0][0]; } } foreach((array) $vcf['EMAIL'] as $mail){ diff --git a/inc/fields.php b/inc/fields.php index 9229e72..f7e4162 100644 --- a/inc/fields.php +++ b/inc/fields.php @@ -34,7 +34,7 @@ $FIELDS = array( 'fax' => 'facsimileTelephoneNumber', 'mobile' => 'mobile', // aka. cell phone 'pager' => 'pager', - 'homephone' => 'homePhone', + '_homephone' => 'homePhone', 'homestreet' => 'homePostalAddress', 'photo' => 'jpegPhoto', 'url' => 'labeledURI', diff --git a/templates/entry_edit.tpl b/templates/entry_edit.tpl index ccda0bb..043f531 100644 --- a/templates/entry_edit.tpl +++ b/templates/entry_edit.tpl @@ -165,10 +165,16 @@ {/if} -{if $fields.homephone} +{if $fields._homephone} + {foreach from=$entry.homephone|smarty:nodefaults item=homephone} - {$lang.homephone}: - + {$lang.homephone} {counter name=homephone}: + + + {/foreach} + + {$lang.homephone} {counter name=homephone}: + {/if} {if $fields.mobile} diff --git a/templates/entry_show.tpl b/templates/entry_show.tpl index 1c4da29..4fbe17b 100644 --- a/templates/entry_show.tpl +++ b/templates/entry_show.tpl @@ -106,7 +106,11 @@ {if $entry.homephone} {$lang.homephone}: - {$entry.homephone|h} + + {foreach from=$entry.homephone item=homephone} + {$homephone|h}
+ {/foreach} + {/if} {if $entry.mobile} diff --git a/templates/entry_vcf.tpl b/templates/entry_vcf.tpl index bd686c3..5ce4e5c 100644 --- a/templates/entry_vcf.tpl +++ b/templates/entry_vcf.tpl @@ -5,7 +5,9 @@ FN:{$entry.givenname} {$entry.name} ORG;ENCODING=QUOTED-PRINTABLE:{$entry.organisation|escape:qp};{$entry.office|escape:qp} NOTE;ENCODING=QUOTED-PRINTABLE:{$entry.note|escape:qp} TEL;WORK;VOICE;ENCODING=QUOTED-PRINTABLE:{$entry.phone|escape:qp} -TEL;HOME;VOICE;ENCODING=QUOTED-PRINTABLE:{$entry.homephone|escape:qp} +{foreach from=$entry.homephone item=homephone} +TEL;HOME;VOICE;ENCODING=QUOTED-PRINTABLE:{$homephone|escape:qp} +{/foreach} TEL;CELL;VOICE;ENCODING=QUOTED-PRINTABLE:{$entry.mobile|escape:qp} TEL;WORK;FAX;ENCODING=QUOTED-PRINTABLE:{$entry.fax|escape:qp} TEL;WORK;PAGER;ENCODING=QUOTED-PRINTABLE:{$entry.pager|escape:qp} diff --git a/templates/import_entry.tpl b/templates/import_entry.tpl index 84dc6e5..bde612c 100644 --- a/templates/import_entry.tpl +++ b/templates/import_entry.tpl @@ -20,7 +20,9 @@ - + {foreach from=$entry.homephone item=homephone} + + {/foreach} diff --git a/templates/list_csv_entry.tpl b/templates/list_csv_entry.tpl index 6083bd4..15b07c6 100644 --- a/templates/list_csv_entry.tpl +++ b/templates/list_csv_entry.tpl @@ -1,2 +1,2 @@ -{$entry.name|csv};{$entry.givenname|csv};{$entry.title|csv};{$entry.organization|csv};{$entry.office|csv};{$entry.street|csv};{$entry.zip|csv};{$entry.location|csv};{$entry.country|csv};{$entry.phone|csv};{$entry.fax|csv};{$entry.pager|csv};{$entry.homestreet|csv};{$entry.homephone|csv};{$entry.mobile|csv};{$lang.url|csv};{$entry.note|csv};{$entry.mail[0]|csv};{$entry.mail[1]|csv};{$entry.mail[2]|csv};{$entry.markers|csv} +{$entry.name|csv};{$entry.givenname|csv};{$entry.title|csv};{$entry.organization|csv};{$entry.office|csv};{$entry.street|csv};{$entry.zip|csv};{$entry.location|csv};{$entry.country|csv};{$entry.phone|csv};{$entry.fax|csv};{$entry.pager|csv};{$entry.homestreet|csv};{$entry.homephone[0]|csv};{$entry.mobile|csv};{$lang.url|csv};{$entry.note|csv};{$entry.mail[0]|csv};{$entry.mail[1]|csv};{$entry.mail[2]|csv};{$entry.markers|csv}