Merge pull request #1516 from cividesk/CRM-13293
[civicrm-core.git] / templates / CRM / Contact / Form / Relationship.tpl
index 47be4f3194a914fbe6d992f6b6a4001f2fdccfcf..40295ddcc5b51fc8fb5b34aabc7720aeecea4fb2 100644 (file)
@@ -77,6 +77,8 @@
   {/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"}
     <h3>{if $action eq 1}{ts}New Relationship{/ts}{else}{ts}Edit Relationship{/ts}{/if}</h3>
     <div class="crm-block crm-form-block crm-relationship-form-block">
             {if $action eq 1}
@@ -552,7 +554,7 @@ function buildRelationFields( relType ) {
     {/literal} {if $action EQ 1} {literal}
     if ( relType ) {
         var relTypeId = relType.split("_");
-        if ( relTypeId[0] == 4 ) {
+        if ( relTypeId[0] == {/literal}{$employmentRelationship}{literal} ) {
             if ( relTypeId[1] == 'a' ) {
                 cj('#addCurrentEmployee').show();
                 cj('#addCurrentEmployer').hide();
@@ -611,11 +613,11 @@ function changeCustomData( cType ) {
    function currentEmployer( )
    {
       var relType = document.getElementById('relationship_type_id').value;
-      if ( relType == '4_a_b' ) {
+      if ( relType == "{/literal}{$employmentRelationship}{literal}" + "_a_b" ) {
            cj('#current_employer').show();
            cj('#employee').show();
            cj('#employer').hide();
-      } else if ( relType == '4_b_a' ) {
+      } else if ( relType == "{/literal}{$employmentRelationship}{literal}" + "_b_a" ) {
      cj('#current_employer').show();
            cj('#employer').show();
            cj('#employee').hide();