2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.6 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
26 {* tpl for building Individual related fields *}
27 <script type="text/javascript">
31 var cid = "{$contactId}",
32 viewIndividual = "{crmURL p='civicrm/contact/view' q='reset=1&cid=' h=0}",
33 checkSimilar = {$checkSimilar},
36 if ($('#contact_sub_type *').length == 0) {//if they aren't any subtype we don't offer the option
37 $('#contact_sub_type').parent().hide();
39 if (cid.length || !checkSimilar) {
40 return;//no dupe check if this is a modif or if checkSimilar is disabled (contact_ajax_check_similar in civicrm_setting table)
42 $('#last_name').change(function() {
43 // Close msg if it exists
44 lastnameMsg && lastnameMsg.close && lastnameMsg.close();
45 if (this.value == '') return;
46 CRM.api3('contact', 'get', {
47 sort_name: $('#last_name').val(),
48 contact_type: 'Individual',
49 'return': 'display_name,sort_name,email'
50 }).done(function(data) {
51 var title = data.count == 1 ? {/literal}"{ts escape='js'}Similar Contact Found{/ts}" : "{ts escape='js'}Similar Contacts Found{/ts}"{literal},
52 msg = "<em>{/literal}{ts escape='js'}If the person you were trying to add is listed below, click their name to view or edit their record{/ts}{literal}:</em>";
53 if (data.is_error == 1 || data.count == 0) {
56 msg += '<ul class="matching-contacts-actions">';
57 $.each(data.values, function(i, contact) {
58 contact.email = contact.email || '';
59 msg += '<li><a href="'+viewIndividual+contact.id+'">'+ contact.display_name +'</a> '+contact.email+'</li>';
62 lastnameMsg = CRM.alert(msg, title);
63 $('.matching-contacts-actions a').click(function() {
64 // No confirmation dialog on click
65 $('[data-warn-changes=true]').attr('data-warn-changes', 'false');
73 <table class="form-layout-compressed">
77 {$form.prefix_id.label}<br/>
78 {$form.prefix_id.html}
81 {if $form.formal_title}
83 {$form.formal_title.label}<br/>
84 {$form.formal_title.html}
89 {$form.first_name.label}<br />
90 {$form.first_name.html}
93 {if $form.middle_name}
95 {$form.middle_name.label}<br />
96 {$form.middle_name.html}
101 {$form.last_name.label}<br />
102 {$form.last_name.html}
107 {$form.suffix_id.label}<br/>
108 {$form.suffix_id.html}
115 {$form.employer_id.label} {help id="id-current-employer" file="CRM/Contact/Form/Contact.hlp"}<br />
116 {$form.employer_id.html}
119 {$form.job_title.label}<br />
120 {$form.job_title.html}
123 {$form.nick_name.label}<br />
124 {$form.nick_name.html}
127 {if $buildContactSubType}
128 {$form.contact_sub_type.label}<br />
129 {$form.contact_sub_type.html}