From: Steve Sutton Date: Wed, 29 Nov 2017 18:24:57 +0000 (-0500) Subject: Rename files for payment to invoices X-Git-Tag: v1.0.0^2~220 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=60a9c54cbbb46177fae2e197fb99a9e210ae197a;p=WP-Plugins%2Fglm-member-db-billing.git Rename files for payment to invoices Renaming things from paymentTypes to invoiceTypes. --- diff --git a/classes/data/dataInvoiceTypes.php b/classes/data/dataInvoiceTypes.php new file mode 100644 index 0000000..0b7a7d6 --- /dev/null +++ b/classes/data/dataInvoiceTypes.php @@ -0,0 +1,192 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataEvents.php,v 1.0 2011/01/25 19:31:47 cscott Exp $ + */ + +/** + * GlmDataBillingManagement class + * + * PHP version 5 + * + * @category Data + * @package GLM Member DB + * @author Chuck Scott + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott + * Exp $ + */ +class GlmDataPaymentTypes extends GlmDataAbstract +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + /** + * Data Table Name + * + * @var $table + * @access public + */ + public $table; + /** + * Field definitions + * + * 'type' is type of field as defined by the application + * text Regular text field + * pointer Pointer to an entry in another table + * 'filters' is the filter name for a particular filter ID in PHP filter + * functions + * See PHP filter_id() + * + * 'use' is when to use the field + * l = List + * g = Get + * n = New + * i = Insert + * e = Edit + * u = Update + * d = Delete + * a = All + * + * @var $ini + * @access public + */ + public $fields = false; + /** + * MemberInfo DB object + * + * @var $MemberInfo + * @access public + */ + public $MemberInfo; + + /** + * Constructor + * + * @param object $d database connection + * @param array $config Configuration array + * @param bool $limitedEdit Flag to say indicate limited edit requested + * + * @return void + * @access public + */ + public function __construct($wpdb, $config, $limitedEdit = false) + { + + // If this class is not being extended along with existing $wpdb and $config + if (!$this->wpdb) { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + } + + /* + * Table Name + */ + $this->table = GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . 'payment_types'; + + /* + * Table Data Fields + */ + + $this->fields = array ( + + 'id' => array ( + 'field' => 'id', + 'type' => 'integer', + 'view_only' => true, + 'use' => 'a', + ), + + // Default Billing Period + 'name' => array( + 'field' => 'name', + 'type' => 'text', + 'use' => 'a', + ), + + // Default Invoice Date + 'qcode' => array( + 'field' => 'qcode', + 'type' => 'text', + 'use' => 'a', + ), + + // Notification From Email + 'category' => array( + 'field' => 'category', + 'type' => 'text', + 'use' => 'a', + ), + + // Notification Message + 'amount' => array( + 'field' => 'amount', + 'type' => 'text', + 'use' => 'a', + ), + + // Logo for Invioce PDF + 'notes' => array( + 'field' => 'notes', + 'type' => 'text', + 'use' => 'a', + ), + + // Name + 'dynamic_amount' => array( + 'field' => 'dynamic_amount', + 'type' => 'text', + 'use' => 'a', + ), + + ); + + } + + /* + * Entry Post Processing Call-Back Method + * + * Perform post-processing for all result entries. + * + * In this case we're using it to append an array of category + * data to each member result and also sort by member name. + * + * @param array $r Array of field result data for a single entry + * @param string $a Action being performed (l, i, g, ...) + * + * @return object Class object + * + */ + public function entryPostProcessing($r, $a) + { + return $r; + } + +} + +?> diff --git a/classes/data/dataPaymentTypes.php b/classes/data/dataPaymentTypes.php deleted file mode 100644 index 0b7a7d6..0000000 --- a/classes/data/dataPaymentTypes.php +++ /dev/null @@ -1,192 +0,0 @@ - - * @license http://www.gaslightmedia.com Gaslightmedia - * @release SVN: $Id: dataEvents.php,v 1.0 2011/01/25 19:31:47 cscott Exp $ - */ - -/** - * GlmDataBillingManagement class - * - * PHP version 5 - * - * @category Data - * @package GLM Member DB - * @author Chuck Scott - * @license http://www.gaslightmedia.com Gaslightmedia - * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott - * Exp $ - */ -class GlmDataPaymentTypes extends GlmDataAbstract -{ - - /** - * WordPress Database Object - * - * @var $wpdb - * @access public - */ - public $wpdb; - /** - * Plugin Configuration Data - * - * @var $config - * @access public - */ - public $config; - /** - * Data Table Name - * - * @var $table - * @access public - */ - public $table; - /** - * Field definitions - * - * 'type' is type of field as defined by the application - * text Regular text field - * pointer Pointer to an entry in another table - * 'filters' is the filter name for a particular filter ID in PHP filter - * functions - * See PHP filter_id() - * - * 'use' is when to use the field - * l = List - * g = Get - * n = New - * i = Insert - * e = Edit - * u = Update - * d = Delete - * a = All - * - * @var $ini - * @access public - */ - public $fields = false; - /** - * MemberInfo DB object - * - * @var $MemberInfo - * @access public - */ - public $MemberInfo; - - /** - * Constructor - * - * @param object $d database connection - * @param array $config Configuration array - * @param bool $limitedEdit Flag to say indicate limited edit requested - * - * @return void - * @access public - */ - public function __construct($wpdb, $config, $limitedEdit = false) - { - - // If this class is not being extended along with existing $wpdb and $config - if (!$this->wpdb) { - - // Save WordPress Database object - $this->wpdb = $wpdb; - - // Save plugin configuration object - $this->config = $config; - - } - - /* - * Table Name - */ - $this->table = GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . 'payment_types'; - - /* - * Table Data Fields - */ - - $this->fields = array ( - - 'id' => array ( - 'field' => 'id', - 'type' => 'integer', - 'view_only' => true, - 'use' => 'a', - ), - - // Default Billing Period - 'name' => array( - 'field' => 'name', - 'type' => 'text', - 'use' => 'a', - ), - - // Default Invoice Date - 'qcode' => array( - 'field' => 'qcode', - 'type' => 'text', - 'use' => 'a', - ), - - // Notification From Email - 'category' => array( - 'field' => 'category', - 'type' => 'text', - 'use' => 'a', - ), - - // Notification Message - 'amount' => array( - 'field' => 'amount', - 'type' => 'text', - 'use' => 'a', - ), - - // Logo for Invioce PDF - 'notes' => array( - 'field' => 'notes', - 'type' => 'text', - 'use' => 'a', - ), - - // Name - 'dynamic_amount' => array( - 'field' => 'dynamic_amount', - 'type' => 'text', - 'use' => 'a', - ), - - ); - - } - - /* - * Entry Post Processing Call-Back Method - * - * Perform post-processing for all result entries. - * - * In this case we're using it to append an array of category - * data to each member result and also sort by member name. - * - * @param array $r Array of field result data for a single entry - * @param string $a Action being performed (l, i, g, ...) - * - * @return object Class object - * - */ - public function entryPostProcessing($r, $a) - { - return $r; - } - -} - -?> diff --git a/models/admin/settings/invoiceTypes.php b/models/admin/settings/invoiceTypes.php new file mode 100644 index 0000000..1eec3ea --- /dev/null +++ b/models/admin/settings/invoiceTypes.php @@ -0,0 +1,189 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 0.1 + */ + +// Load Member Types data abstract +require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/data/dataPaymentTypes.php'; + +/* + * This class performs the work for the default action of the "Members" menu + * option, which is to display the members dashboard. + * + */ +class GlmMembersAdmin_settings_paymentTypes extends GlmDataPaymentTypes +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + + /* + * Constructor + * + * This contructor sets up this model. At this time that only includes + * storing away the WordPress data object. + * + * @return object Class object + * + */ + public function __construct ($wpdb, $config) + { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + // Run constructor for members data class + parent::__construct(false, false); + + } + + /* + * Perform Model Action + * + * This method does the work for this model and returns any resulting data + * + * @return array Status and data array + * + * 'status' + * + * True if successfull and false if there was a fatal failure. + * + * 'menuItemRedirect' + * + * If not false, provides a menu item the controller should + * execute after this one. Normally if this is used, there would also be a + * modelRedirect value supplied as well. + * + * 'modelRedirect' + * + * If not false, provides an action the controller should execute after + * this one. + * + * 'view' + * + * A suggested view name that the contoller should use instead of the + * default view for this model or false to indicate that the default view + * should be used. + * + * 'data' + * + * Data that the model is returning for use in merging with the view to + * produce output. + * + */ + public function modelAction ($actionData = false) + { + + $success = true; + $havePaymentTypes = false; + $paymentTypes = false; + $error = false; + $enable_members = $this->config['settings']['enable_members']; + + // Check for region id + $id = 0; + if (isset($_REQUEST['id'])) { + $id = $_REQUEST['id']-0; + } + + // If there's an action option + if (isset($_REQUEST['option'])) { + + switch($_REQUEST['option']) { + + case 'addNew': + $this->insertEntry(); + break; + + case 'update': + if ($id > 0) { + $this->updateEntry($id); + } + break; + + case 'delete': + if ($id > 0) { + $this->deleteEntry($id, true); + } + break; + + } + + } + + // Get a current list of members + $paymentTypes = $this->getList('', 'name'); + + // echo '
$paymentTypes: ' . print_r( $paymentTypes, true ) . '
'; + + // If we have list entries - even if it's an empty list + $success = true; + $havePaymentTypes = false; + if ($paymentTypes !== false) { + + $success = true; + + // If we have any entries + if (count($paymentTypes) > 0) { + $havePaymentTypes = true; + } + } + + // If we had a fatal error, redirect to the error page + if ($error) { + return array( + 'status' => $success, + 'menuItemRedirect' => 'error', + 'modelRedirect' => 'index', + 'view' => 'admin/error/index.html', + 'data' => false + ); + } + + // Compile template data + $templateData = array( + 'enable_members' => $enable_members, + 'havePaymentTypes' => $havePaymentTypes, + 'paymentTypes' => $paymentTypes + ); + + // Return status, suggested view, and data to controller + return array( + 'status' => $success, + 'menuItemRedirect' => false, + 'modelRedirect' => false, + 'view' => 'admin/settings/paymentTypes.html', + 'data' => $templateData + ); + + } + + +} + +?> diff --git a/models/admin/settings/paymentTypes.php b/models/admin/settings/paymentTypes.php deleted file mode 100644 index 1eec3ea..0000000 --- a/models/admin/settings/paymentTypes.php +++ /dev/null @@ -1,189 +0,0 @@ - - * @license http://www.gaslightmedia.com Gaslightmedia - * @version 0.1 - */ - -// Load Member Types data abstract -require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/data/dataPaymentTypes.php'; - -/* - * This class performs the work for the default action of the "Members" menu - * option, which is to display the members dashboard. - * - */ -class GlmMembersAdmin_settings_paymentTypes extends GlmDataPaymentTypes -{ - - /** - * WordPress Database Object - * - * @var $wpdb - * @access public - */ - public $wpdb; - /** - * Plugin Configuration Data - * - * @var $config - * @access public - */ - public $config; - - /* - * Constructor - * - * This contructor sets up this model. At this time that only includes - * storing away the WordPress data object. - * - * @return object Class object - * - */ - public function __construct ($wpdb, $config) - { - - // Save WordPress Database object - $this->wpdb = $wpdb; - - // Save plugin configuration object - $this->config = $config; - - // Run constructor for members data class - parent::__construct(false, false); - - } - - /* - * Perform Model Action - * - * This method does the work for this model and returns any resulting data - * - * @return array Status and data array - * - * 'status' - * - * True if successfull and false if there was a fatal failure. - * - * 'menuItemRedirect' - * - * If not false, provides a menu item the controller should - * execute after this one. Normally if this is used, there would also be a - * modelRedirect value supplied as well. - * - * 'modelRedirect' - * - * If not false, provides an action the controller should execute after - * this one. - * - * 'view' - * - * A suggested view name that the contoller should use instead of the - * default view for this model or false to indicate that the default view - * should be used. - * - * 'data' - * - * Data that the model is returning for use in merging with the view to - * produce output. - * - */ - public function modelAction ($actionData = false) - { - - $success = true; - $havePaymentTypes = false; - $paymentTypes = false; - $error = false; - $enable_members = $this->config['settings']['enable_members']; - - // Check for region id - $id = 0; - if (isset($_REQUEST['id'])) { - $id = $_REQUEST['id']-0; - } - - // If there's an action option - if (isset($_REQUEST['option'])) { - - switch($_REQUEST['option']) { - - case 'addNew': - $this->insertEntry(); - break; - - case 'update': - if ($id > 0) { - $this->updateEntry($id); - } - break; - - case 'delete': - if ($id > 0) { - $this->deleteEntry($id, true); - } - break; - - } - - } - - // Get a current list of members - $paymentTypes = $this->getList('', 'name'); - - // echo '
$paymentTypes: ' . print_r( $paymentTypes, true ) . '
'; - - // If we have list entries - even if it's an empty list - $success = true; - $havePaymentTypes = false; - if ($paymentTypes !== false) { - - $success = true; - - // If we have any entries - if (count($paymentTypes) > 0) { - $havePaymentTypes = true; - } - } - - // If we had a fatal error, redirect to the error page - if ($error) { - return array( - 'status' => $success, - 'menuItemRedirect' => 'error', - 'modelRedirect' => 'index', - 'view' => 'admin/error/index.html', - 'data' => false - ); - } - - // Compile template data - $templateData = array( - 'enable_members' => $enable_members, - 'havePaymentTypes' => $havePaymentTypes, - 'paymentTypes' => $paymentTypes - ); - - // Return status, suggested view, and data to controller - return array( - 'status' => $success, - 'menuItemRedirect' => false, - 'modelRedirect' => false, - 'view' => 'admin/settings/paymentTypes.html', - 'data' => $templateData - ); - - } - - -} - -?> diff --git a/views/admin/settings/invoiceTypes.html b/views/admin/settings/invoiceTypes.html new file mode 100644 index 0000000..6644db2 --- /dev/null +++ b/views/admin/settings/invoiceTypes.html @@ -0,0 +1,228 @@ +{include file='admin/settings/header.html'} + + +
Add a Payment Type
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Payment Type Name: + +
Code: + +
Category: + +
Amount:Numbers only (999.99) + +
Dynamic Amount: + + +
Notes: + +
+

* Required

+ Cancel + +
+
+ + +
+
+

Are you sure you want to delete this paymentType?

+

Yes, delete this paymentType

+

Cancel

+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Payment Type Name: + +
Code: + +
Category: + +
Amount: + +
Dynamic Amount: + + +
Notes: + +
+

* Required

+ Cancel + +
+
+ +

PaymentTypes

+ + + + + + + + + + + + {if $havePaymentTypes} + {assign var="i" value="0"} + {foreach $paymentTypes as $t} + {if $i++ is odd by 1} + + {else} + + {/if} + + + + + + {/foreach} + {else} + + {/if} + +
IDPaymentTypeAmount 
{$t.id} + {$t.name} + + {$t.amount} + +
Delete
+
(no paymentTypes listed)
+ + + +{include file='admin/footer.html'} diff --git a/views/admin/settings/paymentTypes.html b/views/admin/settings/paymentTypes.html deleted file mode 100644 index 6644db2..0000000 --- a/views/admin/settings/paymentTypes.html +++ /dev/null @@ -1,228 +0,0 @@ -{include file='admin/settings/header.html'} - - -
Add a Payment Type
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Payment Type Name: - -
Code: - -
Category: - -
Amount:Numbers only (999.99) - -
Dynamic Amount: - - -
Notes: - -
-

* Required

- Cancel - -
-
- - -
-
-

Are you sure you want to delete this paymentType?

-

Yes, delete this paymentType

-

Cancel

-
-
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Payment Type Name: - -
Code: - -
Category: - -
Amount: - -
Dynamic Amount: - - -
Notes: - -
-

* Required

- Cancel - -
-
- -

PaymentTypes

- - - - - - - - - - - - {if $havePaymentTypes} - {assign var="i" value="0"} - {foreach $paymentTypes as $t} - {if $i++ is odd by 1} - - {else} - - {/if} - - - - - - {/foreach} - {else} - - {/if} - -
IDPaymentTypeAmount 
{$t.id} - {$t.name} - - {$t.amount} - -
Delete
-
(no paymentTypes listed)
- - - -{include file='admin/footer.html'}