CRM-18424 fix recur checkbox issue found in QA.
authoreileen <emcnaughton@wikimedia.org>
Tue, 17 May 2016 13:53:16 +0000 (01:53 +1200)
committereileen <emcnaughton@wikimedia.org>
Tue, 17 May 2016 14:08:19 +0000 (02:08 +1200)
On digging into it I found the showHideAutoRenew function was robust enough to be called in both a hide & a show situation.

So, yay, further minor simplification

templates/CRM/Contribute/Form/Contribution/Main.tpl

index 50d1f356d03a79557c5ce0f1c9beec7c08daa2c8..d0406229edaf66b3ea191738004c37cd2e7a375d 100644 (file)
   function toggleRecur( ) {
     var isRecur = cj('input[id="is_recur"]:checked');
     var allowAutoRenew = {/literal}'{$allowAutoRenewMembership}'{literal};
+    if ( allowAutoRenew && cj("#auto_renew") ) {
+      showHideAutoRenew( null );
+    }
     if (isRecur.val() > 0) {
       cj('#recurHelp').show();
       cj('#amount_sum_label').text(ts('Regular amount'));
-      //get back to auto renew settings.
-      if ( allowAutoRenew && cj("#auto_renew") ) {
-        showHideAutoRenew( null );
-      }
     }
     else {
       cj('#recurHelp').hide();
       cj('#amount_sum_label').text(ts('Total amount'));
-      //disabled auto renew settings.
-      if ( allowAutoRenew && cj("#auto_renew") ) {
-        cj("#auto_renew").prop('checked', false );
-        cj('#allow_auto_renew').hide( );
-      }
     }
   }