WIP payment form
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 14 Dec 2018 21:49:30 +0000 (16:49 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 14 Dec 2018 21:49:30 +0000 (16:49 -0500)
Starting to clean up the member only side. If they aren't allowed
billing.
Also need to work on the payment form under members to get it simplified
to what uptra will need.

models/admin/billing/reports.php
setup/adminHooks.php
views/admin/billing/makePayment.html
views/admin/billing/memberBillingSubHeader.html
views/common/billing/paymentForm.html

index e7559a6..f6a656b 100644 (file)
@@ -280,8 +280,9 @@ class GlmMembersAdmin_billing_reports extends GlmDataTransactions
                     )
                 ORDER BY name";
                 // echo '<pre>$sql: ' . print_r( $sql, true ) . '</pre>';
-                $accounts = $this->wpdb->get_results( $sql, ARRAY_A );
-                $paging = false;
+                $accounts      = $this->wpdb->get_results( $sql, ARRAY_A );
+                $totalAccounts = count( $accounts );
+                $paging        = false;
                 break;
             default:
                 break;
index 991d6a8..e023b5f 100644 (file)
  *
  *  Also note that parameters will be in the context of the main admin controller constructor.
   */
-add_filter(
-    'glm-member-db-dashboard-member-widgets',
-    function( $member = null ){
-        return $this->controller( 'dashboard', 'billing', $member );
-    },
-    9,
-    1
-);
-
-/**
- * Setup cron task request to run billingFlagExpiredUsers
- *
- * Run only once per day. Everyday.
- */
-add_filter(
-    'glm_associate_cron_request',
-    function( $cron_task ){
-        $new_cron = array(
-            array(
-                'menu'       => 'ajax',
-                'action'     => 'billingFlagExpiredUsers',
-                'daysOfWeek' => false,
-                'times'      => array( 5 ),
-                'params'     => array()
-            )
+if (isset($this->config['loggedInUser']) && isset($this->config['loggedInUser']['contactUser']) && $this->config['loggedInUser']['contactUser']) {
+    $memberBillingEnabled = $this->config['settings']['member_billing_enabled'];
+    if ( $memberBillingEnabled ) {
+        add_filter(
+            'glm-member-db-dashboard-member-widgets',
+            function( $member = null ){
+                return $this->controller( 'dashboard', 'billing', $member );
+            },
+            9,
+            1
         );
-        return array_merge( $cron_task, $new_cron );
     }
-);
+}
 
-add_filter(
-    'glm_associate_cron_request',
-    function( $cron_task ){
-        $new_cron = array(
-            array(
-                'menu'       => 'ajax',
-                'action'     => 'billingFixActiveUsers',
-                'daysOfWeek' => false,
-                'times'      => array( 6 ),
-                'params'     => array()
-            )
-        );
-        return array_merge( $cron_task, $new_cron );
-    }
-);
+$renewalDayStatic = $this->config['settings']['renewal_day_static'];
+if ( !$renewalDayStatic ) {
+    /**
+     * Setup cron task request to run billingFlagExpiredUsers
+     *
+     * Run only once per day. Everyday.
+     */
+    add_filter(
+        'glm_associate_cron_request',
+        function( $cron_task ){
+            $new_cron = array(
+                array(
+                    'menu'       => 'ajax',
+                    'action'     => 'billingFlagExpiredUsers',
+                    'daysOfWeek' => false,
+                    'times'      => array( 5 ),
+                    'params'     => array()
+                )
+            );
+            return array_merge( $cron_task, $new_cron );
+        }
+    );
 
-/**
- * Setup cron task request to run billingSetupQueue
- *
- * Run only once per day. Everyday.
- */
-add_filter(
-    'glm_associate_cron_request',
-    function( $cron_task ) {
-        $new_cron = array(
-            array(
-                'menu'       => 'ajax',
-                'action'     => 'billingSetupQueue',
-                'daysOfWeek' => false,
-                'times'      => array( 3 ),
-                'params'     => array()
-            )
-        );
-        return array_merge( $cron_task, $new_cron );
-    }
-);
+    add_filter(
+        'glm_associate_cron_request',
+        function( $cron_task ){
+            $new_cron = array(
+                array(
+                    'menu'       => 'ajax',
+                    'action'     => 'billingFixActiveUsers',
+                    'daysOfWeek' => false,
+                    'times'      => array( 6 ),
+                    'params'     => array()
+                )
+            );
+            return array_merge( $cron_task, $new_cron );
+        }
+    );
 
-/**
- * Setup cron task request to run billingRunQueue
- *
- * Run only once per day. Everyday.
- */
-add_filter(
-    'glm_associate_cron_request',
-    function( $cron_task ) {
-        $new_cron = array(
-            array(
-                'menu'       => 'ajax',
-                'action'     => 'billingRunQueue',
-                'daysOfWeek' => false,
-                'times'      => array( 4 ),
-                'params'     => array()
-            )
-        );
-        return array_merge( $cron_task, $new_cron );
-    }
-);
+    /**
+     * Setup cron task request to run billingSetupQueue
+     *
+     * Run only once per day. Everyday.
+     */
+    add_filter(
+        'glm_associate_cron_request',
+        function( $cron_task ) {
+            $new_cron = array(
+                array(
+                    'menu'       => 'ajax',
+                    'action'     => 'billingSetupQueue',
+                    'daysOfWeek' => false,
+                    'times'      => array( 3 ),
+                    'params'     => array()
+                )
+            );
+            return array_merge( $cron_task, $new_cron );
+        }
+    );
+
+    /**
+     * Setup cron task request to run billingRunQueue
+     *
+     * Run only once per day. Everyday.
+     */
+    add_filter(
+        'glm_associate_cron_request',
+        function( $cron_task ) {
+            $new_cron = array(
+                array(
+                    'menu'       => 'ajax',
+                    'action'     => 'billingRunQueue',
+                    'daysOfWeek' => false,
+                    'times'      => array( 4 ),
+                    'params'     => array()
+                )
+            );
+            return array_merge( $cron_task, $new_cron );
+        }
+    );
+}
 
 /**
  * Filter returning the html for the billing field form (contact)
index 38a036a..9c0d945 100644 (file)
@@ -49,6 +49,7 @@
                 </div>
 
 {* Include the Payment Form template *}
+{* Only if payments types are setup *}
 {include file='common/billing/paymentForm.html'}
 
                 <input class="button button-primary" type="submit" value="Make Payment">
index 33439eb..d991ff6 100644 (file)
                         class="">Membership Renewal</a>
                 </li>
             {/if}
-            <li>
-                <a
-                    href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$memberID}&option=makepayment"
-                    class="">Pay Invoices</a>
-            </li>
+            {if isset( $settings.renewal_day_static ) && $settings.renewal_day_static}
+                <li>
+                    <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$memberID}&option=makepaymentadjustment">Make A Payment</a>
+                </li>
+            {else}
+                <li>
+                    <a
+                        href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$memberID}&option=makepayment"
+                        class="">Pay Invoices</a>
+                </li>
+            {/if}
         </ul>
     </div>
 </div>
index e0e0d06..f1911d4 100644 (file)
@@ -2,22 +2,33 @@
     <fieldset>
         <legend>Billing Information</legend>
 
-        <div class="glm-billing-field glm-billing-left-half">
-            <div class="glm-billing-label glm-required">
-                First Name
-            </div>
-            <div class="glm-billing-input">
-                <input type="text" name="billing_fname" value="{$account.fieldData.billing_fname}" required />
+        {if $settings.billing_contact_name_enabled}
+            <div class="glm-billing-field glm-billing">
+                <div class="glm-billing-label glm-required">
+                    Billing Contact Name
+                </div>
+                <div class="glm-billing-input">
+                    <input type="text" name="billing_contact_name" value="{$account.fieldData.billing_contact_name}" required />
+                </div>
             </div>
-        </div>
-        <div class="glm-billing-field glm-billing-right-half">
-            <div class="glm-billing-label glm-required">
-                Last Name
+        {else}
+            <div class="glm-billing-field glm-billing-left-half">
+                <div class="glm-billing-label glm-required">
+                    First Name
+                </div>
+                <div class="glm-billing-input">
+                    <input type="text" name="billing_fname" value="{$account.fieldData.billing_fname}" required />
+                </div>
             </div>
-            <div class="glm-billing-input">
-                <input type="text" name="billing_lname" value="{$account.fieldData.billing_lname}" required />
+            <div class="glm-billing-field glm-billing-right-half">
+                <div class="glm-billing-label glm-required">
+                    Last Name
+                </div>
+                <div class="glm-billing-input">
+                    <input type="text" name="billing_lname" value="{$account.fieldData.billing_lname}" required />
+                </div>
             </div>
-        </div>
+        {/if}
         <div class="glm-billing-field">
             <div class="glm-billing-label glm-required">
                 Address