[freeside-commits] branch master updated. 37ac9c4f5754a1398b7bc354db716be828f04253
Mark Wells
mark at 420.am
Fri Nov 8 16:47:33 PST 2013
The branch, master has been updated
via 37ac9c4f5754a1398b7bc354db716be828f04253 (commit)
from 475fb78f0bbb9e2e37c04645eaf4b8bf8027ea08 (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 37ac9c4f5754a1398b7bc354db716be828f04253
Author: Mark Wells <mark at freeside.biz>
Date: Fri Nov 8 16:47:27 2013 -0800
option to make ship_company field available again, #25782
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);
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi
index d597d0b..8a3d6f9 100755
--- a/httemplate/edit/cust_main.cgi
+++ b/httemplate/edit/cust_main.cgi
@@ -73,6 +73,7 @@
><% mt('same as billing address') |h %>
<DIV CLASS="fsinnerbox">
<TABLE ID="table_ship_location" WIDTH="100%">
+ <& cust_main/before_ship_location.html, $cust_main &>
<& /elements/location.html,
object => $cust_main->ship_location,
prefix => 'ship_',
diff --git a/httemplate/edit/cust_main/before_ship_location.html b/httemplate/edit/cust_main/before_ship_location.html
new file mode 100644
index 0000000..badb5e8
--- /dev/null
+++ b/httemplate/edit/cust_main/before_ship_location.html
@@ -0,0 +1,13 @@
+% if ( length($cust_main->ship_company) or
+% $conf->exists('show_ship_company') ) {
+ <& /elements/tr-input-text.html,
+ label => mt('Company'),
+ field => 'ship_company',
+ curr_value => $cust_main->ship_company,
+ colspan => 6,
+ &>
+% }
+<%init>
+my $cust_main = shift;
+my $conf = FS::Conf->new;
+</%init>
diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html
index 8fe3a9e..294b7ba 100644
--- a/httemplate/view/cust_main/contacts.html
+++ b/httemplate/view/cust_main/contacts.html
@@ -41,7 +41,14 @@
<TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->company |h %></TD>
</TR>
% }
-% } # if $this eq 'bill'
+% } elsif ( $this eq 'ship' ) {
+% if ( $cust_main->ship_company ) { # mostly obsolete these days...
+ <TR>
+ <TD ALIGN="right"><% mt('Company') |h %></TD>
+ <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->ship_company |h %></TD>
+ </TR>
+% }
+% }
% # now the actual address
<TR>
<TD ALIGN="right"><% mt('Address') |h %></TD>
-----------------------------------------------------------------------
Summary of changes:
FS/FS/Conf.pm | 7 +++++++
FS/FS/Template_Mixin.pm | 9 ++++++---
FS/FS/cust_main.pm | 15 +++++++++------
FS/FS/cust_main/Search.pm | 6 +++++-
httemplate/edit/cust_main.cgi | 1 +
.../edit/cust_main/before_ship_location.html | 13 +++++++++++++
httemplate/view/cust_main/contacts.html | 9 ++++++++-
7 files changed, 49 insertions(+), 11 deletions(-)
create mode 100644 httemplate/edit/cust_main/before_ship_location.html
More information about the freeside-commits
mailing list