summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2013-11-08 16:47:27 -0800
committerMark Wells <mark@freeside.biz>2013-11-08 16:47:27 -0800
commit37ac9c4f5754a1398b7bc354db716be828f04253 (patch)
tree5f2c0c3ce9e549e35a070f3d82e5f0820d307a34 /FS
parent475fb78f0bbb9e2e37c04645eaf4b8bf8027ea08 (diff)
option to make ship_company field available again, #25782
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Conf.pm7
-rw-r--r--FS/FS/Template_Mixin.pm9
-rw-r--r--FS/FS/cust_main.pm15
-rw-r--r--FS/FS/cust_main/Search.pm6
4 files changed, 27 insertions, 10 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index eed84fc..b368c8f 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2040,6 +2040,13 @@ and customer address. Include units.',
},
{
+ 'key' => 'show_ship_company',
+ 'section' => 'UI',
+ 'description' => 'Turns on display/collection of a "service company name" field for customers.',
+ 'type' => 'checkbox',
+ },
+
+ {
'key' => 'show_ss',
'section' => 'UI',
'description' => 'Turns on display/collection of social security numbers in the web interface. Sometimes required by electronic check (ACH) processors.',
diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm
index 840df75..2314c02 100644
--- a/FS/FS/Template_Mixin.pm
+++ b/FS/FS/Template_Mixin.pm
@@ -581,11 +581,14 @@ sub print_generic {
my $countrydefault = $conf->config('countrydefault') || 'US';
foreach ( qw( address1 address2 city state zip country fax) ){
my $method = 'ship_'.$_;
- $invoice_data{"ship_$_"} = _latex_escape($cust_main->$method);
+ $invoice_data{"ship_$_"} = $escape_function->($cust_main->$method);
}
- foreach ( qw( contact company ) ) { #compatibility
- $invoice_data{"ship_$_"} = _latex_escape($cust_main->$_);
+ if ( length($cust_main->ship_company) ) {
+ $invoice_data{'ship_company'} = $escape_function->($cust_main->ship_company);
+ } else {
+ $invoice_data{'ship_company'} = $escape_function->($cust_main->company);
}
+ $invoice_data{'ship_contact'} = $escape_function->($cust_main->contact);
$invoice_data{'ship_country'} = ''
if ( $invoice_data{'ship_country'} eq $countrydefault );
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index d768f84..5126fea 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -1662,7 +1662,7 @@ sub queue_fuzzyfiles_update {
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
- foreach my $field ( 'first', 'last', 'company' ) {
+ foreach my $field ( 'first', 'last', 'company', 'ship_company' ) {
my $queue = new FS::queue {
'job' => 'FS::cust_main::Search::append_fuzzyfiles_fuzzyfield'
};
@@ -1724,6 +1724,7 @@ sub check {
|| $self->ut_snumbern('spouse_birthdate')
|| $self->ut_snumbern('anniversary_date')
|| $self->ut_textn('company')
+ || $self->ut_textn('ship_company')
|| $self->ut_anything('comments')
|| $self->ut_numbern('referral_custnum')
|| $self->ut_textn('stateid')
@@ -1741,11 +1742,13 @@ sub check {
|| $self->ut_currencyn('currency')
;
- my $company = $self->company;
- $company =~ s/^\s+//;
- $company =~ s/\s+$//;
- $company =~ s/\s+/ /g;
- $self->company($company);
+ foreach (qw(company ship_company)) {
+ my $company = $self->get($_);
+ $company =~ s/^\s+//;
+ $company =~ s/\s+$//;
+ $company =~ s/\s+/ /g;
+ $self->set($_, $company);
+ }
#barf. need message catalogs. i18n. etc.
$error .= "Please select an advertising source."
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index 16db712..215fdc2 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -21,6 +21,7 @@ $me = '[FS::cust_main::Search]';
@fuzzyfields = (
'cust_main.first', 'cust_main.last', 'cust_main.company',
+ 'cust_main.ship_company', # if you're using it
'cust_location.address1',
'contact.first', 'contact.last',
);
@@ -321,6 +322,7 @@ sub smart_search {
$sql .= " ( LOWER(cust_main.first) = $q_value
OR LOWER(cust_main.last) = $q_value
OR LOWER(cust_main.company) = $q_value
+ OR LOWER(cust_main.ship_company) = $q_value
";
#address1 (yes, it's a kludge)
@@ -358,6 +360,7 @@ sub smart_search {
my @hashrefs = (
{ 'company' => { op=>'ILIKE', value=>"%$value%" }, },
+ { 'ship_company' => { op=>'ILIKE', value=>"%$value%" }, },
);
if ( $first && $last ) {
@@ -439,7 +442,7 @@ sub smart_search {
%fuzopts
);
}
- foreach my $field ( 'first', 'last', 'company' ) {
+ foreach my $field ( 'first', 'last', 'company', 'ship_company' ) {
push @cust_main, FS::cust_main::Search->fuzzy_search(
{ $field => $value },
%fuzopts
@@ -1193,6 +1196,7 @@ sub append_fuzzyfiles {
#foreach my $fuzzy (@fuzzyfields) {
foreach my $fuzzy ( 'cust_main.first', 'cust_main.last', 'cust_main.company',
'cust_location.address1',
+ 'cust_main.ship_company',
) {
append_fuzzyfiles_fuzzyfield($fuzzy, shift);