diff options
author | Mark Wells <mark@freeside.biz> | 2016-04-28 13:14:10 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2016-04-28 13:14:10 -0700 |
commit | ea734eb2f16a632a9c79bf17b6954f8571d85f3f (patch) | |
tree | 5bb9ed976fd919b04c8e2afb81dde26906d47422 | |
parent | e9e5876a8a38456da236f360fd200621029bb153 (diff) | |
parent | d6e587f3c4c71170a7cc58bf6755d616777bc131 (diff) |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
-rw-r--r-- | FS/FS/ConfDefaults.pm | 3 | ||||
-rw-r--r-- | FS/FS/UI/Web.pm | 8 | ||||
-rw-r--r-- | FS/FS/cust_main/Search.pm | 4 | ||||
-rw-r--r-- | bin/queue-bulk_change | 34 |
4 files changed, 49 insertions, 0 deletions
diff --git a/FS/FS/ConfDefaults.pm b/FS/FS/ConfDefaults.pm index b24a300f9..4c37175c3 100644 --- a/FS/FS/ConfDefaults.pm +++ b/FS/FS/ConfDefaults.pm @@ -77,6 +77,9 @@ sub cust_fields_avail { ( 'Cust# | Cust. Status | Name | Company | (bill) Address 1 | (bill) Address 2 | (bill) City | (bill) State | (bill) Zip | (bill) Country | (bill) Latitude | (bill) Longitude | Day phone | Night phone | Mobile phone | Fax number | (service) Address 1 | (service) Address 2 | (service) City | (service) State | (service) Zip | (service) Country | (service) Latitude | (service) Longitude | Invoicing email(s) | Payment Type | Current Balance' => 'custnum | Status | Last, First | Company | (address+coord) | (all phones) | (service address+coord) | Invoicing email(s) | Payment Type | Current Balance', + 'Cust# | Cust. Status | Name | Company | (bill) Address 1 | (bill) Address 2 | (bill) City | (bill) State | (bill) Zip | (bill) Country | (bill) Latitude | (bill) Longitude | Day phone | Night phone | Mobile phone | Fax number | (service) Address 1 | (service) Address 2 | (service) City | (service) State | (service) Zip | (service) Country | (service) Latitude | (service) Longitude | Invoicing email(s) | Payment Type | Current Balance | Advertising Source' => + 'custnum | Status | Last, First | Company | (address+coord) | (all phones) | (service address+coord) | Invoicing email(s) | Payment Type | Current Balance | Advertising Source', + 'Invoicing email(s)' => 'Invoicing email(s)', 'Cust# | Invoicing email(s)' => 'custnum | Invoicing email(s)', diff --git a/FS/FS/UI/Web.pm b/FS/FS/UI/Web.pm index 8f10011e5..f46090463 100644 --- a/FS/FS/UI/Web.pm +++ b/FS/FS/UI/Web.pm @@ -346,6 +346,7 @@ sub cust_header { 'Payment Type' => 'cust_payby', 'Current Balance' => 'current_balance', 'Agent Cust#' => 'agent_custid', + 'Advertising Source' => 'referral', ); $header2method{'Cust#'} = 'display_custnum' if $conf->exists('cust_main-default_agent_custid'); @@ -455,6 +456,9 @@ sub cust_sql_fields { push @extra_fields, FS::cust_main->balance_sql . " AS current_balance"; } + push @extra_fields, 'part_referral.referral AS referral' + if grep { $_ eq 'referral' } @cust_fields; + map("cust_main.$_", @fields), @location_fields, @extra_fields; } @@ -519,6 +523,10 @@ sub join_cust_main { " ON (ship_location.locationnum = $location_table.$locationnum) "; } + if ( !@cust_fields or grep { $_ eq 'referral' } @cust_fields ) { + $sql .= ' LEFT JOIN part_referral ON (cust_main.refnum = part_referral.refnum) '; + } + $sql; } diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm index c8a084c9b..8e6d18571 100644 --- a/FS/FS/cust_main/Search.pm +++ b/FS/FS/cust_main/Search.pm @@ -1013,6 +1013,10 @@ sub search { 'ON (cust_main.'.$pre.'locationnum = '.$pre.'location.locationnum) '; } + # always make referral available in results + # (maybe we should be using FS::UI::Web::join_cust_main instead?) + $addl_from .= ' LEFT JOIN part_referral ON (cust_main.refnum = part_referral.refnum) '; + my $count_query = "SELECT COUNT(*) FROM cust_main $addl_from $extra_sql"; my @select = ( diff --git a/bin/queue-bulk_change b/bin/queue-bulk_change new file mode 100644 index 000000000..4fc22b3aa --- /dev/null +++ b/bin/queue-bulk_change @@ -0,0 +1,34 @@ +#!/usr/bin/perl + +use strict; +#use Getopt::Std; +use FS::UID qw( adminsuidsetup ); +use FS::Record qw( qsearch qsearchs ); +use FS::queue_arg; +use FS::queue; + +my $user = shift or &usage; +adminsuidsetup $user; + +my $from = shift or &usage; +my $to = shift or &usage; + +foreach my $queue_arg ( qsearch('queue_arg', { 'arg' => $from, } ) ) { + + $queue_arg->arg($to); + my $error = $queue_arg->replace; + die $error if $error; + + #not on 3.x my $queue = $queue_arg->queue; + my $queue = qsearchs( 'queue', { 'jobnum' => $queue_arg->jobnum } ); + if ( $queue->status eq 'failed' ) { + $queue->status('new'); + my $error = $queue->replace; + die $error if $error; + } + +} + +sub usage { + die "usage: queue-bulk_chage employee_username from_arg to_arg\n"; +} |