summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/ConfDefaults.pm3
-rw-r--r--FS/FS/UI/Web.pm8
-rw-r--r--FS/FS/cdr.pm3
-rw-r--r--FS/FS/cust_main/Search.pm4
-rw-r--r--FS/FS/part_pkg/voip_cdr.pm2
-rw-r--r--httemplate/search/cust_event.html10
6 files changed, 26 insertions, 4 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 80af37990..81c4c7b7b 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_x.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 (select refnum, referral from part_referral) AS part_referral_x ON (cust_main.refnum = part_referral_x.refnum) ';
+ }
+
$sql;
}
diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm
index 8ccf7af63..b3cceb4aa 100644
--- a/FS/FS/cdr.pm
+++ b/FS/FS/cdr.pm
@@ -546,6 +546,9 @@ sub parse_number {
my $field = $options{column} || 'dst';
my $intl = $options{international_prefix} || '011';
+ # Still, don't break anyone's CDR rating if they have an empty string in
+ # there. Require an explicit statement that there's no prefix.
+ $intl = '' if lc($intl) eq 'none';
my $countrycode = '';
my $number = $self->$field();
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index a8f9791ef..22b8495bc 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -1059,6 +1059,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 (select refnum, referral from part_referral) AS part_referral_x ON (cust_main.refnum = part_referral_x.refnum) ';
+
my $count_query = "SELECT COUNT(*) FROM cust_main $addl_from $extra_sql";
my @select = (
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm
index c1dd522b8..fa2c02f10 100644
--- a/FS/FS/part_pkg/voip_cdr.pm
+++ b/FS/FS/part_pkg/voip_cdr.pm
@@ -152,7 +152,7 @@ tie my %accountcode_tollfree_field, 'Tie::IxHash',
# 'type' => 'checkbox',
# },
- 'international_prefix' => { 'name' => 'Destination prefix for international CDR records',
+ 'international_prefix' => { 'name' => 'Destination prefix for international CDR records (or "none" for no prefix)',
'default' => '011',
},
diff --git a/httemplate/search/cust_event.html b/httemplate/search/cust_event.html
index 344ceb8f7..8ab0f8fa6 100644
--- a/httemplate/search/cust_event.html
+++ b/httemplate/search/cust_event.html
@@ -181,12 +181,16 @@ $search{'ending'} = $ending;
my $where = ' WHERE '. FS::cust_event->search_sql_where( \%search );
my $join = FS::cust_event->join_sql() .
+ # warning: does not show the true service address for package events.
+ # the query to do that would be painfully slow.
'LEFT JOIN cust_location bill_location '.
'ON (cust_main.bill_locationnum = bill_location.locationnum) '.
'LEFT JOIN cust_location ship_location '.
- 'ON (cust_main.ship_locationnum = ship_location.locationnum)';
- # warning: does not show the true service address for package events.
- # the query to do that would be painfully slow.
+ 'ON (cust_main.ship_locationnum = ship_location.locationnum)'.
+ # include link to referral in case it's in cust-fields
+ # (maybe we should be using FS::UI::Web::join_cust_main instead?)
+ 'LEFT JOIN (select refnum, referral from part_referral) AS part_referral_x '.
+ 'ON (cust_main.refnum = part_referral_x.refnum) ';
my $sql_query = {
'table' => 'cust_event',