From 0de45ebb1be2c9d07f27c4d38e1ad9f400eef2c2 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 30 Nov 2017 10:32:20 -0500 Subject: [PATCH] Invoice types - parent ordering of invoice types Now the invoice types can be order correctly based on parent they belong to. Only the top level parent show in the drop down for parent selection. --- classes/data/dataInvoiceTypes.php | 13 +++++++++---- models/admin/settings/invoiceTypes.php | 4 ++-- views/admin/settings/invoiceTypes.html | 20 ++++++++++++-------- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/classes/data/dataInvoiceTypes.php b/classes/data/dataInvoiceTypes.php index cb74304..7e3ae96 100644 --- a/classes/data/dataInvoiceTypes.php +++ b/classes/data/dataInvoiceTypes.php @@ -129,13 +129,18 @@ class GlmDataInvoiceTypes extends GlmDataAbstract 'use' => 'a', ), - // Parent + // Parent - for adding, deleting and editing, has selection tabels 'parent' => array( 'field' => 'parent', - 'type' => 'integer', - 'use' => 'a' + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . 'invoice_types', + 'p_field' => 'name', + 'p_orderby' => 'name', + 'p_blank' => true, + 'force_list' => true, + 'required' => false, + 'use' => 'a' ), - // Amount 'amount' => array( 'field' => 'amount', diff --git a/models/admin/settings/invoiceTypes.php b/models/admin/settings/invoiceTypes.php index 39ca9da..12049c8 100644 --- a/models/admin/settings/invoiceTypes.php +++ b/models/admin/settings/invoiceTypes.php @@ -139,7 +139,7 @@ class GlmMembersAdmin_settings_invoiceTypes extends GlmDataInvoiceTypes // Get a current list of members $invoiceTypes = $this->getList(); - echo '
$invoiceTypes: ' . print_r( $invoiceTypes, true ) . '
'; + // echo '
$invoiceTypes: ' . print_r( $invoiceTypes, true ) . '
'; // If we have list entries - even if it's an empty list $success = true; @@ -156,7 +156,7 @@ class GlmMembersAdmin_settings_invoiceTypes extends GlmDataInvoiceTypes // Sort results by higherarchy (Parent/Child and Alpha) $invoiceTypes = $this->sortParentChild($invoiceTypes); - echo '
$invoiceTypes: ' . print_r( $invoiceTypes, true ) . '
'; + // echo '
$invoiceTypes: ' . print_r( $invoiceTypes, true ) . '
'; // If we had a fatal error, redirect to the error page diff --git a/views/admin/settings/invoiceTypes.html b/views/admin/settings/invoiceTypes.html index 0c9bd7b..92334dd 100644 --- a/views/admin/settings/invoiceTypes.html +++ b/views/admin/settings/invoiceTypes.html @@ -21,8 +21,10 @@ @@ -47,7 +49,9 @@ @@ -87,9 +91,9 @@