Update renewal form
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 19 Dec 2018 19:42:37 +0000 (14:42 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 19 Dec 2018 19:42:37 +0000 (14:42 -0500)
For member billing tab add javascript code to disable the submit button
once it is submitted the first time.

index.php
models/admin/member/billing.php
views/admin/billing/renew.html

index 4c26673..750c91c 100644 (file)
--- a/index.php
+++ b/index.php
@@ -3,7 +3,7 @@
  * Plugin Name: GLM Members Billing
  * Plugin URI: http://www.gaslightmedia.com/
  * Description: This is glmAssociate Billing Module
- * Version: 1.0.18
+ * Version: 1.0.19
  * Author: Gaslight Media
  * Author URI: http://www.gaslightmedia.com/
  * License: GPL2
@@ -19,7 +19,7 @@
  * @package glmMembersBillingAddOn
  * @author Chuck Scott <cscott@gaslightmedia.com>
  * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.0.18
+ * @version 1.0.19
  */
 
 /*
@@ -37,7 +37,7 @@
  *  so that we're sure the other add-ons see an up to date
  *  version from this plugin.
  */
-define('GLM_MEMBERS_BILLING_PLUGIN_VERSION', '1.0.18');
+define('GLM_MEMBERS_BILLING_PLUGIN_VERSION', '1.0.19');
 define('GLM_MEMBERS_BILLING_PLUGIN_DB_VERSION', '0.0.26');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
index 2395c8f..b65218f 100644 (file)
@@ -128,6 +128,7 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling
         $accounts           = false;
         $errors             = false;
         $invoiceTypes       = false;
+        $renewalFormSession = false;
 
         // For lockedToMember.
         $lockedToMember = false;
@@ -755,6 +756,7 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling
             'account_status'     => $account_status,
             'accounts'           => $accounts,
             'invoiceTypes'       => $invoiceTypes,
+            'renewalFormSession' => $renewalFormSession,
         );
 
         // Return status, any suggested view, and any data to controller.
index fa09afa..ddc5424 100644 (file)
@@ -13,7 +13,7 @@
         {/foreach}
     {/if}
 
-    <form action="{$thisUrl}?page={$thisPage}" method="post">
+    <form action="{$thisUrl}?page={$thisPage}" method="post" onSubmit="return checkForm(this);">
         <input type="hidden" name="page" value="{$thisPage}" />
         <input type="hidden" name="glm_action" value="billing" />
         <input type="hidden" name="option" value="renewMembership" />
@@ -21,7 +21,6 @@
         <input type="hidden" name="account_id" value="{$account_data.id}" />
         <input type="hidden" id="total_renew_amount" name="total_renew_amount" value="" />
 
-
         {if $member_invoice}
         <div class="glm-billing-field">
             <div class="glm-billing-label glm-required">
 {* Include the Payment Form template *}
 {include file='common/billing/paymentForm.html'}
 
-        <input class="button button-primary" type="submit" value="Submit Membership Renewal">
+        <input class="button button-primary" type="submit" name="renewal_submit" id="renewal_submit" value="Submit Membership Renewal">
 
     </form>
 </div>
 
 <script>
+function checkForm( form )
+{
+    form.renewal_submit.disabled = true;
+    form.renewal_submit.value = 'Processing...';
+    return true;
+}
+
 jQuery(document).ready(function($){
 
     var accounts = [ {foreach $accounts as $m} { label: "{$m.ref_name|unescape:'html'|replace:'"':''}", value: "{$m.ref_name|unescape:'html'|replace:'"':''}", id: '{$m.id}', invoice_type: {$m.invoice_type} }, {/foreach} ];