X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_main.pm;h=3bffa3a599099fbbc31646c8a07f913888cd1658;hp=a82d8a225862952383a7d8dbc431d5a3a1c3ad31;hb=ddcfe66496c323f1f52fdbd00e8babd43249a609;hpb=280c44682a79e586af941e869e7a78ca8f367cf2 diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index a82d8a225..3bffa3a59 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -3072,14 +3072,15 @@ sub contact_list { # WHERE ... # AND ( - # ( cust_contact.classnum IN (1,2,3) ) - # OR - # ( cust_contact.classnum IS NULL ) - # + # ( + # cust_contact.classnum IN (1,2,3) + # OR + # cust_contact.classnum IS NULL + # ) # AND ( - # ( cust_contact.invoice_dest = 'Y' ) + # cust_contact.invoice_dest = 'Y' # OR - # ( cust_contact.message_dest = 'Y' ) + # cust_contact.message_dest = 'Y' # ) # ) @@ -3105,12 +3106,14 @@ sub contact_list { $search->{extra_sql} .= ' AND ( '; if (@or_classnum) { - $search->{extra_sql} .= join ' OR ', map {" ($_) "} @or_classnum; + $search->{extra_sql} .= ' ( '; + $search->{extra_sql} .= join ' OR ', map {" $_ "} @or_classnum; + $search->{extra_sql} .= ' ) '; $search->{extra_sql} .= ' AND ( ' if @and_dest; } if (@and_dest) { - $search->{extra_sql} .= join ' OR ', map {" ($_) "} @and_dest; + $search->{extra_sql} .= join ' OR ', map {" $_ "} @and_dest; $search->{extra_sql} .= ' ) ' if @or_classnum; } @@ -3919,6 +3922,27 @@ sub name { $name; } +=item batch_payment_payname + +Returns a name string for this customer, either "cust_batch_payment->payname" or "First Last" or "Company, +based on if a company name exists and is the account being used a business account. + +=cut + +sub batch_payment_payname { + my $self = shift; + my $cust_pay_batch = shift; + my $name; + + if ($cust_pay_batch->{Hash}->{payby} eq "CARD") { $name = $cust_pay_batch->payname; } + else { $name = $self->first .' '. $self->last; } + + $name = $self->company + if (($cust_pay_batch->{Hash}->{paytype} eq "Business checking" || $cust_pay_batch->{Hash}->{paytype} eq "Business savings") && $self->company); + + $name; +} + =item service_contact Returns the L object for this customer that has the 'Service'