From 406e97fe228cd249a8bd0fa58cbfbf33ab805f18 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Wed, 9 May 2012 15:20:06 -0700 Subject: [PATCH] disable advertising sources, RT#17638 --- 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(-) diff --git a/FS/FS/part_referral.pm b/FS/FS/part_referral.pm index c94c57e19..e7dfe067d 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 9cc32c459..c7374673f 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. Add a new advertising source

+<% $cgi->param('showdisabled') + ? do { $cgi->param('showdisabled', 0); + '( hide disabled advertising sources )'; } + : do { $cgi->param('showdisabled', 1); + '( show disabled advertising sources )'; } +%> + <% 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. Advertising source -% if ( $show_agentnums ) { +% if ( ! $cgi->param('showdisabled') ) { + +% } + +% if ( $show_agentnums ) { Agent % } @@ -27,7 +38,7 @@ Where a customer heard about your service. Tracked for informational purposes. -%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 ? '' : '' %> + +% if ( ! $cgi->param('showdisabled') ) { + + <% $part_referral->disabled + ? 'DISABLED' + : 'Active' + %> + +% } + % if ( $show_agentnums ) { <% $part_referral->agentnum ? $part_referral->agent->agent : '(global)' %> @@ -73,11 +94,11 @@ Where a customer heard about your service. Tracked for informational purposes. - + - +
<% $num_cust %>customers customers 
<% $num_pkg %>packages packages 
@@ -94,7 +115,7 @@ Where a customer heard about your service. Tracked for informational purposes. % or die dbh->errstr; - Total + param('showdisabled') %>Total % 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. - + - +
<% $num_cust %>customers customers 
<% $num_pkg %>packages packages 
diff --git a/httemplate/edit/part_referral.html b/httemplate/edit/part_referral.html index daf8773f0..e9fd79452 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', ) -- 2.11.0