]> git.sur5r.net Git - contagged/commitdiff
Make homephone multivalue aware sur5r.net/multivalue
authorJakob Haufe <sur5r@sur5r.net>
Wed, 28 Nov 2012 22:52:47 +0000 (23:52 +0100)
committerJakob Haufe <sur5r@sur5r.net>
Fri, 14 Dec 2012 16:01:51 +0000 (17:01 +0100)
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.

import.php
inc/fields.php
templates/entry_edit.tpl
templates/entry_show.tpl
templates/entry_vcf.tpl
templates/import_entry.tpl
templates/list_csv_entry.tpl

index 0cfa1dc273b1bd225f0cc8a2aaa45aa08552e6bf..d369b1cbb0cce3d903939fa6061d132a214bd66a 100644 (file)
@@ -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){
index 9229e7206462377b19f07ac677a9c8d9b4aed9af..f7e41625e4c9b572dcfafea34189f91d76cf680c 100644 (file)
@@ -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',
index ccda0bb404a9b468310eaf9b0fe088315fe83616..043f531cc5d068d8ad801f61b323a9414a9a1bae 100644 (file)
           <td><textarea name="entry[homestreet]" class="input" rows="2" cols="30">{$entry.homestreet|h}</textarea></td>
         </tr>
 {/if}
-{if $fields.homephone}
+{if $fields._homephone}
+        {foreach from=$entry.homephone|smarty:nodefaults item=homephone}
         <tr>
-          <th>{$lang.homephone}:</th>
-          <td><input type="text" class="input" name="entry[homephone]" value="{$entry.homephone|h}" /></td>
+          <th>{$lang.homephone} {counter name=homephone}:</th>
+          <td><input type="text" class="input" name="entry[homephone][]" value="{$homephone|h}" /></td>
+        </tr>
+        {/foreach}
+        <tr>
+          <th>{$lang.homephone} {counter name=homephone}:</th>
+          <td><input type="text" class="input" name="entry[homephone][]" value="" /></td>
         </tr>
 {/if}
 {if $fields.mobile}
index 1c4da29b327846c59c815912a1bfa4bae6f34b78..4fbe17ba1422ef9e7eb3fe2e4276d79b82ed33cf 100644 (file)
 {if $entry.homephone}
           <tr>
             <th>{$lang.homephone}:</th>
-            <td><a href="callto://{$entry.homephone|escape:phone}">{$entry.homephone|h}</a></td>
+            <td>
+               {foreach from=$entry.homephone item=homephone}
+                <a href="callto://{$homephone|escape:phone}">{$homephone|h}</a><br />
+               {/foreach}
+            </td>
           </tr>
 {/if}
 {if $entry.mobile}
index bd686c3b5c4ff6a0a43c71bcf0e787af531d2457..5ce4e5c8f2d3a946f69d9975b5d93b6c7682e839 100644 (file)
@@ -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}
index 84dc6e527760a81098dbc324a50352cedd8e3634..bde612c47e41d9ef57e73e66b7b4ec5916ac2d9f 100644 (file)
@@ -20,7 +20,9 @@
         <input type="hidden" name="entry[fax]" value="{$entry.fax|h}" />
         <input type="hidden" name="entry[pager]" value="{$entry.pager|h}" />
         <input type="hidden" name="entry[homestreet]" value="{$entry.homestreet|h}" />
-        <input type="hidden" name="entry[homephone]" value="{$entry.homephone|h}" />
+        {foreach from=$entry.homephone item=homephone}
+        <input type="hidden" name="entry[homephone][]" value="{$homephone|h}" />
+        {/foreach}
         <input type="hidden" name="entry[mobile]" value="{$entry.mobile|h}" />
         <input type="hidden" name="entry[url]" value="{$entry.url|h}" />
         <input type="hidden" name="photo" value="{$entry.photo|h}" />
index 6083bd422aeb6db5bcd53db2826c1c73958ddb65..15b07c62fe2175e28e243bc0870d4195e4e40f95 100644 (file)
@@ -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}