2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.4 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
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=parseFloat("{$contactId}");//parseInt is octal by default
32 var contactIndividual = "{crmURL p='civicrm/ajax/rest' q='entity=contact&action=get&json=1&contact_type=Individual&return=display_name,sort_name,email&rowCount=50' h=0}";
33 var viewIndividual = "{crmURL p='civicrm/contact/view' q='reset=1&cid=' h=0}";
34 var editIndividual = "{crmURL p='civicrm/contact/add' q='reset=1&action=update&cid=' h=0}";
35 var checkSimilar = {$checkSimilar};
38 $(document).ready(function() {
39 if (cj('#contact_sub_type *').length == 0) {//if they aren't any subtype we don't offer the option
40 cj('#contact_sub_type').parent().hide();
42 if (!isNaN(cid) || ! checkSimilar) {
43 return;//no dupe check if this is a modif or if checkSimilar is disabled (contact_ajax_check_similar in civicrm_setting table)
45 cj('#last_name').blur(function () {
46 // Close msg if it exists
47 lastnameMsg && lastnameMsg.close && lastnameMsg.close();
48 if (this.value == '') return;
49 cj.getJSON(contactIndividual,{sort_name:cj('#last_name').val()},
51 if (data.is_error == 1 || data.count == 0) {
54 var 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>";
55 if ( data.count == 1 ) {
56 var title = "{/literal}{ts escape='js'}Similar Contact Found{/ts}{literal}";
58 var title = "{/literal}{ts escape='js'}Similar Contacts Found{/ts}{literal}";
60 msg += '<ul class="matching-contacts-actions">';
61 cj.each(data.values, function(i,contact){
62 if ( !(contact.email) ) {
65 msg += '<li><a href="'+viewIndividual+contact.id+'">'+ contact.display_name +'</a> '+contact.email+'</li>';
68 lastnameMsg = CRM.alert(msg, title);
69 cj('.matching-contacts-actions a').click(function(){
70 // No confirmation dialog on click
71 global_formNavigate = true;
81 <table class="form-layout-compressed">
85 {$form.prefix_id.label}<br/>
86 {$form.prefix_id.html}
90 {$form.first_name.label}<br />
91 {$form.first_name.html}
94 {$form.middle_name.label}<br />
95 {$form.middle_name.html}
98 {$form.last_name.label}<br />
99 {$form.last_name.html}
103 {$form.suffix_id.label}<br/>
104 {$form.suffix_id.html}
111 {$form.current_employer.label} {help id="id-current-employer" file="CRM/Contact/Form/Contact.hlp"}<br />
112 {$form.current_employer.html|crmAddClass:twenty}
113 <div id="employer_address" style="display:none;"></div>
116 {$form.job_title.label}<br />
117 {$form.job_title.html}
120 {$form.nick_name.label}<br />
121 {$form.nick_name.html}
124 {if $buildContactSubType}
125 {$form.contact_sub_type.label}<br />
126 {$form.contact_sub_type.html}
132 {include file="CRM/Contact/Form/CurrentEmployer.tpl"}