'type' => 'checkbox',
},
+ {
+ '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',
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 );
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'
};
|| $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')
|| $self->ut_enum('locale', [ '', FS::Locales->locales ])
;
- 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."
@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',
);
$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)
my @hashrefs = (
{ 'company' => { op=>'ILIKE', value=>"%$value%" }, },
+ { 'ship_company' => { op=>'ILIKE', value=>"%$value%" }, },
);
if ( $first && $last ) {
%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
#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);
><% 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_',
--- /dev/null
+% 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>
<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>