]> git.sur5r.net Git - contagged/commitdiff
Make phone multivalue aware multivalue
authorJakob Haufe <sur5r@sur5r.net>
Fri, 14 Dec 2012 16:47:56 +0000 (17:47 +0100)
committerJakob Haufe <sur5r@sur5r.net>
Fri, 14 Dec 2012 16:47:56 +0000 (17:47 +0100)
This makes it possible to have an arbitrary number of (office) phone
values. CSV export will only use the first one, as before.

VCF importer should also correctly recognize multiple TEL;WORK;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
templates/list_entry.tpl

index d369b1cbb0cce3d903939fa6061d132a214bd66a..eac6b0f13d6dd824c150eda8243128d60149d46c 100644 (file)
@@ -87,7 +87,7 @@ function vcard_entry($vcf){
             my_array_search('VOICE',(array) $tel['param']['TYPE']) != false))
            {
         // Work phone
-        $entry['phone'] = $tel['value'][0][0];
+        $entry['phone'][] = $tel['value'][0][0];
       }elseif(empty($entry['fax']) &&
               my_array_search('FAX',(array) $tel['param']['TYPE']) !== false){
         $entry['fax'] = $tel['value'][0][0];
index f7e41625e4c9b572dcfafea34189f91d76cf680c..ec8ed885313eb5f00c5f17933cd0a7e646e0f508 100644 (file)
@@ -30,7 +30,7 @@ $FIELDS = array(
     'street'       => 'postalAddress',
     'zip'          => 'postalCode',
     'location'     => 'l',                           // aka. city
-    'phone'        => 'telephoneNumber',
+    '_phone'       => 'telephoneNumber',
     'fax'          => 'facsimileTelephoneNumber',
     'mobile'       => 'mobile',                      // aka. cell phone
     'pager'        => 'pager',
index 043f531cc5d068d8ad801f61b323a9414a9a1bae..98aeb909f8e067187034b8bafa1aa2d10bdf1e7f 100644 (file)
           </td>
         </tr>
 {/if}
-{if $fields.phone}
+{if $fields._phone}
+        {foreach from=$entry.phone|smarty:nodefaults item=phone}
         <tr>
-          <th>{$lang.phone}:</th>
-          <td><input type="text" class="input" name="entry[phone]" value="{$entry.phone|h}" /></td>
+          <th>{$lang.phone} {counter name=phone}:</th>
+          <td><input type="test" class="input" name="entry[phone][]" value="{$phone|h}" /></td>
+        </tr>
+        {/foreach}
+        <tr>
+          <th>{$lang.phone} {counter name=phone}:</th>
+          <td><input type="text" class="input" name="entry[phone][]" value="" /></td>
         </tr>
 {/if}
 {if $fields.switchboard}
index 4fbe17ba1422ef9e7eb3fe2e4276d79b82ed33cf..f340caac77e858d671ad713c0b3ab13bfb3313e7 100644 (file)
 {if $entry.phone}
           <tr>
             <th>{$lang.phone}:</th>
-            <td><a href="callto://{$entry.phone|escape:phone}">{$entry.phone|h}</a></td>
+            <td>
+              {foreach from=$entry.phone item=phone}
+              <a href="callto://{$phone|escape:phone}">{$phone|h}</a><br />
+              {/foreach}
+            </td>
           </tr>
 {/if}
 {if $entry.switchboard}
index 5ce4e5c8f2d3a946f69d9975b5d93b6c7682e839..1814d532e2cec81c36f568dbcc3d6ed88960ffcb 100644 (file)
@@ -4,7 +4,9 @@ N:{$entry.name};{$entry.givenname};;{$entry.title}
 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}
+{foreach from=$entry.phone item=phone}
+TEL;WORK;VOICE;ENCODING=QUOTED-PRINTABLE:{$phone|escape:qp}
+{/foreach}
 {foreach from=$entry.homephone item=homephone}
 TEL;HOME;VOICE;ENCODING=QUOTED-PRINTABLE:{$homephone|escape:qp}
 {/foreach}
index bde612c47e41d9ef57e73e66b7b4ec5916ac2d9f..be96fd2935593e8a56db471728e26447358fffd5 100644 (file)
@@ -16,7 +16,9 @@
         <input type="hidden" name="entry[location]" value="{$entry.location|h}" />
         <input type="hidden" name="entry[country]" value="{$entry.country|h}" />
         <input type="hidden" name="entry[state]" value="{$entry.state|h}" />
-        <input type="hidden" name="entry[phone]" value="{$entry.phone|h}" />
+        {foreach from=$entry.phone item=phone}
+        <input type="hidden" name="entry[phone][]" value="{$phone|h}" />
+        {/foreach}
         <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}" />
index 15b07c62fe2175e28e243bc0870d4195e4e40f95..c74989c3a7968ef21e00183294393fffe9453d83 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[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}
+{$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[0]|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}
 
index 05bcd7a1102371bbc2391af6b4bdd1b690ccc8f0..6c2b871c4f5db04f609db65d1d280b638f23f587 100644 (file)
@@ -11,7 +11,7 @@
         <a href="index.php?org={$entry.organization|escape:url}">{$entry.organization|h}</a>&nbsp;
     </td>
     <td>
-        <a href="callto://{$entry.phone|escape:phone}">{$entry.phone|h}</a>&nbsp;
+        <a href="callto://{$entry.phone[0]|escape:phone}">{$entry.phone[0]|h}</a>&nbsp;
     </td>
     <td>
         <a href="mailto:{$entry.mail[0]|h}">{$entry.mail[0]|h}</a>&nbsp;