[freeside-commits] branch FREESIDE_3_BRANCH updated. 62b18c75989a1b00a25079f8f110992aaad81bba
Mitch Jackson
mitch at freeside.biz
Fri Oct 19 14:56:18 PDT 2018
The branch, FREESIDE_3_BRANCH has been updated
via 62b18c75989a1b00a25079f8f110992aaad81bba (commit)
via e1424fa99483e7d5944dcd729f96ee43f7b6c10d (commit)
from 793766b8e51bf0bf4c61cbb0fb613d746db3b4fa (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 62b18c75989a1b00a25079f8f110992aaad81bba
Author: Mitch Jackson <mitch at freeside.biz>
Date: Fri Oct 19 17:54:48 2018 -0400
RT# 31208 Docs $FS::Record::qsearch_qualify_columns
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index 89957cb47..12e2d318f 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -289,6 +289,11 @@ the individual PARAMS_HASHREF queries
#regular FS::TABLE methods
#on it.
+C<$FS::Record::qsearch_qualify_columns> package global is disabled by default.
+When enabled, the WHERE clause generated from the 'hashref' parameter has
+the table name prepended to each column name. WHERE column = 'value' becomes
+WHERE table.coumn = 'value'
+
=cut
my %TYPE = (); #for debugging
commit e1424fa99483e7d5944dcd729f96ee43f7b6c10d
Author: Mitch Jackson <mitch at freeside.biz>
Date: Fri Jun 29 14:01:36 2018 -0500
RT# 31208 Fix Browse Discounts sorting error
diff --git a/httemplate/browse/discount.html b/httemplate/browse/discount.html
index d3cf873d0..5ed43cf0e 100644
--- a/httemplate/browse/discount.html
+++ b/httemplate/browse/discount.html
@@ -1,10 +1,9 @@
<% include( 'elements/browse.html',
'title' => 'Discounts',
'name' => 'discounts',
- 'menubar' => [ 'Add a new discount' =>
- $p.'edit/discount.html',
- ],
- 'query' => { 'table' => 'discount', },
+ 'menubar' => \@menubar,
+ 'query' => \%query,
+ 'order_by_sql' => { description => 'discountnum' },
'count_query' => 'SELECT COUNT(*) FROM discount',
'disableable' => 1,
'disabled_statuspos' => 1,
@@ -13,9 +12,7 @@
'classname',
'description',
],
- 'links' => [ $link,
- $link,
- ],
+ 'links' => \@links
)
%>
<%init>
@@ -23,6 +20,24 @@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
-my $link = [ "${p}edit/discount.html?", 'discountnum' ];
+my @links = (
+ [ "${p}edit/discount.html?", 'discountnum' ],
+ [ "${p}edit/discount_class.html?", 'classnum' ],
+);
+
+# Fixes disableable, because discount and discount_class tables
+# both contain a 'disabled' column
+local $FS::Record::qsearch_qualify_columns = 1;
+
+my %query = (
+ select => 'discount.*, discount_class.*',
+ table => 'discount',
+ addl_from => 'LEFT JOIN discount_class USING(classnum)',
+);
+
+my @menubar = (
+ 'Add a new discount' => $p.'edit/discount.html',
+ 'Discount classes' => $p.'browse/discount_class.html',
+);
</%init>
-----------------------------------------------------------------------
Summary of changes:
FS/FS/Record.pm | 5 +++++
httemplate/browse/discount.html | 31 +++++++++++++++++++++++--------
2 files changed, 28 insertions(+), 8 deletions(-)
More information about the freeside-commits
mailing list