{* +--------------------------------------------------------------------+ | CiviCRM version 4.3 | +--------------------------------------------------------------------+ | Copyright CiviCRM LLC (c) 2004-2013 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | | CiviCRM is free software; you can copy, modify, and distribute it | | under the terms of the GNU Affero General Public License | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | | | CiviCRM is distributed in the hope that it will be useful, but | | WITHOUT ANY WARRANTY; without even the implied warranty of | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | See the GNU Affero General Public License for more details. | | | | You should have received a copy of the GNU Affero General Public | | License and the CiviCRM Licensing Exception along | | with this program; if not, contact CiviCRM LLC | | at info[AT]civicrm[DOT]org. If you have questions about the | | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} {* this template is used for adding/editing/viewing relationships *} {if $cdType } {include file="CRM/Custom/Form/CustomData.tpl"} {else} {if $action eq 4 } {* action = view *}

{ts}View Relationship{/ts}

{foreach from=$viewRelationship item="row"} {if $isCurrentEmployer} {/if} {if $row.start_date} {/if} {if $row.end_date} {/if} {if $row.description} {/if} {foreach from=$viewNote item="rec"} {if $rec } {/if} {/foreach} {if $row.is_permission_a_b} {if $row.rtype EQ 'a_b' AND $is_contact_id_a} {else} {/if} {/if} {if $row.is_permission_b_a} {if $row.rtype EQ 'a_b' AND $is_contact_id_a} {else} {/if} {/if} {/foreach}
{$row.relation} {$row.name}
{ts}Current Employee?{/ts}{ts}Yes{/ts}
{ts}Start Date{/ts}{$row.start_date|crmDate}
{ts}End Date{/ts}{$row.end_date|crmDate}
{ts}Description{/ts}{$row.description}
{ts}Note{/ts}{$rec}
 '{$displayName}' can view and update information for '{$row.display_name}'
 '{$row.display_name}' can view and update information for '{$displayName}'
 '{$row.display_name}' can view and update information for '{$displayName}'
 '{$displayName}' can view and update information for '{$row.display_name}'
{ts}Status{/ts}{if $row.is_active}{ts}Enabled{/ts} {else} {ts}Disabled{/ts}{/if}
{include file="CRM/Custom/Page/CustomDataView.tpl"}
{/if} {if $action eq 2 | $action eq 1} {* add and update actions *} {* Retrieve the ID for the Employee / Employer relationship type *} {crmAPI var="employmentRelationship" entity="RelationshipType" action="getvalue" version="3" name_a_b="Employee of" return="id"}

{if $action eq 1}{ts}New Relationship{/ts}{else}{ts}Edit Relationship{/ts}{/if}

{if $action eq 1}
{ts}Select the relationship type. Then locate target contact(s) for this relationship by entering a partial name and selecting from the dropdown, or clicking 'Search'. If the target contact does not exist, you can create a new contact.{/ts}
{/if} {if $action EQ 2} {* action = update *} {literal} {/literal}
{$form.relationship_type_id.label}{$form.relationship_type_id.html}
{$form.is_current_employer.html}
{else} {* action = add *} {include file="CRM/Contact/Form/NewContact.tpl" newContactCallback="afterCreateNew()"} {literal} {/literal}
{$form._qf_Relationship_refresh.html} {$form._qf_Relationship_cancel.html}
{if $searchDone } {* Search button clicked *} {if $searchCount || $callAjax} {if $searchRows || $callAjax} {* we got rows to display *}
{ts}Mark Target Contact(s) for this Relationship{/ts}
{ts}Mark the target contact(s) for this relationship if it appears below. Otherwise you may modify the search name above and click Search again.{/ts}
{strip} {if $callAjax}

{$form.store_contacts.html} {if $isEmployeeOf || $isEmployerOf} {$form.store_employer.html} {/if} {include file="CRM/common/jsortable.tpl" sourceUrl=$sourceUrl useAjax=1 callBack=1 } {/if} {if $isEmployeeOf} {elseif $isEmployerOf}{/if} {if !$callAjax} {foreach from=$searchRows item=row} {if $isEmployeeOf} {elseif $isEmployerOf}{/if} {/foreach} {else} {/if}
  {ts}Name{/ts}{ts}Current Employer?{/ts}{ts}Current Employee?{/ts}{ts}City{/ts} {ts}State{/ts} {ts}Email{/ts} {ts}Phone{/ts}
{$form.contact_check[$row.id].html} {$row.type} {$row.name}{$form.employee_of[$row.id].html}{$form.employer_of[$row.id].html}{$row.city} {$row.state} {$row.email} {$row.phone}
Loading data from server
{/strip}
{else} {* too many results - we display only 50 *} {if $duplicateRelationship} {capture assign=infoTitle}{ts}Duplicate relationship.{/ts}{/capture} {capture assign=infoMessage}{ts}This relationship already exists.{/ts}{/capture} {else} {capture assign=infoTitle}{ts}Too many matching results.{/ts}{/capture} {capture assign=infoMessage}{ts}Please narrow your search by entering a more complete target contact name.{/ts}{/capture} {/if} {include file="CRM/common/info.tpl"} {/if} {else} {* no valid matches for name + contact_type *} {capture assign=infoTitle}{ts}No matching results for{/ts}{/capture} {capture assign=infoMessage}{ts}Check your spelling, or try fewer letters for the target contact name.{/ts}{/capture} {include file="CRM/common/info.tpl"} {/if} {* end if searchCount *} {else} {/if} {* end if searchDone *} {/if} {* end action = add *}
{if $action EQ 1}
{$form.add_current_employer.label} {$form.add_current_employer.html}
{$form.add_current_employee.label} {$form.add_current_employee.html}
{/if}
{$form.start_date.label} {include file="CRM/common/jcalendar.tpl" elementName=start_date}
{$form.end_date.label} {include file="CRM/common/jcalendar.tpl" elementName=end_date}
{ts}If this relationship has start and/or end dates, specify them here.{/ts}
{$form.description.label} {$form.description.html}
{$form.note.label} {$form.note.html}
{$form.is_permission_a_b.html} {if $action eq 1} '{$sort_name_a}' {ts}can view and update information for selected contact(s){/ts} {else} '{$sort_name_a}' {ts}can view and update information for {/ts} '{$sort_name_b}' {/if} {if $action eq 1} {ts}Selected contact(s) can view and update information for {/ts} '{$sort_name_a}' {else} '{$sort_name_b}' {ts}can view and update information for {/ts} '{$sort_name_a}' {/if}
{$form.is_permission_b_a.html} {if $action eq 1} '{$sort_name_a}' {ts}can view and update information for selected contact(s){/ts} {else} '{$sort_name_a}' {ts}can view and update information for {/ts} '{$sort_name_b}' {/if} {if $action eq 1} {ts}Selected contact(s) can view and update information for {/ts} '{$sort_name_a}' {else} '{$sort_name_b}' {ts}can view and update information for {/ts} '{$sort_name_a}' {/if}
{$form.is_active.label} {$form.is_active.html}
{literal} {/literal}
{* end of save element div *}
{include file="CRM/common/formButtons.tpl" location="bottom"}
{if $action EQ 1}
{$form._qf_Relationship_refresh_savedetails.html} {$form._qf_Relationship_cancel.html}
{/if}
{* close main block div *} {/if} {if $action eq 8}
{ts}Delete Relationship{/ts}
{capture assign=relationshipsString}{$currentRelationships.$id.relation}{ $disableRelationships.$id.relation} {$currentRelationships.$id.name}{ $disableRelationships.$id.name }{/capture} {ts 1=$relationshipsString}Are you sure you want to delete the Relationship '%1'?{/ts}
{include file="CRM/common/formButtons.tpl" location="bottom"}
{/if} {/if} {* close of custom data else*} {if $callAjax} {literal} {/literal} {/if} {if ($action EQ 1) OR ($action EQ 2) } {*include custom data js file*} {include file="CRM/common/customData.tpl"} {literal} {/literal} {/if} {if $action EQ 2} {literal} {/literal} {/if}