CRM-15272 fix - Default Soft Credit Type is not respected in backoffice Contribution
authormonishdeb <monish.deb@webaccessglobal.com>
Thu, 11 Sep 2014 13:45:29 +0000 (19:15 +0530)
committermonishdeb <monish.deb@webaccessglobal.com>
Thu, 11 Sep 2014 13:45:29 +0000 (19:15 +0530)
https://issues.civicrm.org/jira/browse/CRM-15272

templates/CRM/Contribute/Form/SoftCredit.tpl

index 71dc72fdeafcaa653d4f221394f14c4047de43be..ddbb120b43e54efbbe9be67ab1f3905ec2ce2044 100644 (file)
       return false;
     });
 
-    $('input[name^="soft_credit_contact["]').change(function(){
-      var rowNum = $(this).prop('id').replace('soft_credit_contact_','');
+    $('input[name^="soft_credit_contact_"]').on('change', function(){
+      var rowNum = $(this).prop('id').replace('soft_credit_contact_id_','');
       var totalAmount = $('#total_amount').val();
       //assign total amount as default soft credit amount
       $('#soft_credit_amount_'+ rowNum).val(totalAmount);
       var thousandMarker = {/literal}{$config->monetaryThousandSeparator|json_encode}{literal};
-      $('#soft_credit_type_'+ rowNum).val($('#sct_default_id').val());
+      $('#soft_credit_type_'+ rowNum).select2('val', $('#sct_default_id').val());
       totalAmount = Number(totalAmount.replace(thousandMarker,''));
       if (rowNum > 1) {
         var scAmount = Number($('#soft_credit_amount_'+ (rowNum - 1)).val().replace(thousandMarker,''));