[freeside-commits] branch FREESIDE_2_3_BRANCH updated. db5d13003d4020d9d2bc78ebc565e748622237f4
Ivan
ivan at 420.am
Wed May 9 15:20:08 PDT 2012
The branch, FREESIDE_2_3_BRANCH has been updated
via db5d13003d4020d9d2bc78ebc565e748622237f4 (commit)
from 4e80826785918c80148c91d3b0e7c8e81e67197e (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 db5d13003d4020d9d2bc78ebc565e748622237f4
Author: Ivan Kohler <ivan at freeside.biz>
Date: Wed May 9 15:20:07 2012 -0700
disable advertising sources, RT#17638
diff --git a/FS/FS/part_referral.pm b/FS/FS/part_referral.pm
index c94c57e..e7dfe06 100644
--- a/FS/FS/part_referral.pm
+++ b/FS/FS/part_referral.pm
@@ -163,10 +163,16 @@ simply using rather than editing advertising sources).
sub all_part_referral {
my $self = shift;
+ my $global = @_ ? shift : '';
+ my $disabled = @_ ? shift : '';
+
+ my $hashref = $disabled ? {} : { 'disabled' => '' };
+ my $and = $disabled ? ' WHERE ' : ' AND ';
qsearch({
'table' => 'part_referral',
- 'extra_sql' => ' WHERE '. $self->acl_agentnum_sql(@_). ' ORDER BY refnum ',
+ 'hashref' => $hashref,
+ 'extra_sql' => $and. $self->acl_agentnum_sql(@_). ' ORDER BY refnum ',
});
}
diff --git a/httemplate/browse/part_referral.html b/httemplate/browse/part_referral.html
index 9cc32c4..c737467 100755
--- a/httemplate/browse/part_referral.html
+++ b/httemplate/browse/part_referral.html
@@ -6,6 +6,13 @@ Where a customer heard about your service. Tracked for informational purposes.
<A HREF="<% $p %>edit/part_referral.html"><I>Add a new advertising source</I></A>
<BR><BR>
+<% $cgi->param('showdisabled')
+ ? do { $cgi->param('showdisabled', 0);
+ '( <a href="'. $cgi->self_url. '">hide disabled advertising sources</a> )'; }
+ : do { $cgi->param('showdisabled', 1);
+ '( <a href="'. $cgi->self_url. '">show disabled advertising sources</a> )'; }
+%>
+
<% include('/elements/table-grid.html') %>
% my $bgcolor1 = '#eeeeee';
% my $bgcolor2 = '#ffffff';
@@ -13,8 +20,12 @@ Where a customer heard about your service. Tracked for informational purposes.
<TR>
<TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=2 ROWSPAN=2>Advertising source</TH>
-% if ( $show_agentnums ) {
+% if ( ! $cgi->param('showdisabled') ) {
+ <TH CLASS="grid" BGCOLOR="#cccccc" ALIGN="center" ROWSPAN=2></TH>
+% }
+
+% if ( $show_agentnums ) {
<TH CLASS="grid" BGCOLOR="#cccccc" ROWSPAN=2>Agent</TH>
% }
@@ -27,7 +38,7 @@ Where a customer heard about your service. Tracked for informational purposes.
</TR>
-%foreach my $part_referral ( FS::part_referral->all_part_referral(1) ) {
+%foreach my $part_referral ( FS::part_referral->all_part_referral(1,!scalar($cgi->param('showdisabled'))) ) {
%
% if ( $bgcolor eq $bgcolor1 ) {
% $bgcolor = $bgcolor2;
@@ -55,6 +66,16 @@ Where a customer heard about your service. Tracked for informational purposes.
% }
<% $part_referral->referral %><% $a ? '</A>' : '' %></TD>
+
+% if ( ! $cgi->param('showdisabled') ) {
+ <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ALIGN="center">
+ <% $part_referral->disabled
+ ? '<FONT COLOR="#FF0000"><B>DISABLED</B></FONT>'
+ : '<FONT COLOR="#00CC00"><B>Active</B></FONT>'
+ %>
+ </TD>
+% }
+
% if ( $show_agentnums ) {
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $part_referral->agentnum ? $part_referral->agent->agent : '(global)' %></TD>
@@ -73,11 +94,11 @@ Where a customer heard about your service. Tracked for informational purposes.
<TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
<TR>
<TD ALIGN="right"><B><% $num_cust %></B></TD>
- <TD ALIGN="left">customers</TD>
+ <TD ALIGN="left"> customers </TD>
</TR>
<TR>
<TD ALIGN="right"><B><% $num_pkg %></B></TD>
- <TD ALIGN="left">packages</TD>
+ <TD ALIGN="left"> packages </TD>
</TR>
</TABLE>
</TD>
@@ -94,7 +115,7 @@ Where a customer heard about your service. Tracked for informational purposes.
% or die dbh->errstr;
<TR>
- <TD BGCOLOR="#dddddd" ALIGN="center" COLSPAN=3><B>Total</B></TD>
+ <TD BGCOLOR="#dddddd" ALIGN="center" COLSPAN=<% 2 + $show_agentnums + ! $cgi->param('showdisabled') %><B>Total</B></TD>
% for my $period ( keys %after ) {
% my @param = ( $today-$after{$period},
% $today+$before{$period},
@@ -108,11 +129,11 @@ Where a customer heard about your service. Tracked for informational purposes.
<TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
<TR>
<TD ALIGN="right"><B><% $num_cust %></B></TD>
- <TD ALIGN="left">customers</TD>
+ <TD ALIGN="left"> customers </TD>
</TR>
<TR>
<TD ALIGN="right"><B><% $num_pkg %></B></TD>
- <TD ALIGN="left">packages</TD>
+ <TD ALIGN="left"> packages </TD>
</TR>
</TABLE>
</TD>
diff --git a/httemplate/edit/part_referral.html b/httemplate/edit/part_referral.html
index daf8773..e9fd794 100755
--- a/httemplate/edit/part_referral.html
+++ b/httemplate/edit/part_referral.html
@@ -3,9 +3,12 @@
'table' => 'part_referral',
'fields' => [ 'referral',
{ field=>'agentnum', type=>'select-agent', },
+ { field=>'disabled', type=>'checkbox', value=>'Y' } ,
],
- 'labels' => { 'referral' => 'Advertising source',
+ 'labels' => { 'refnum' => 'Ad Source',
+ 'referral' => 'Advertising source',
'agentnum' => 'Agent',
+ 'disabled' => 'Disabled',
},
'viewall_dir' => 'browse',
)
-----------------------------------------------------------------------
Summary of changes:
FS/FS/part_referral.pm | 8 ++++++-
httemplate/browse/part_referral.html | 35 +++++++++++++++++++++++++++------
httemplate/edit/part_referral.html | 5 +++-
3 files changed, 39 insertions(+), 9 deletions(-)
More information about the freeside-commits
mailing list