X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main.pm;h=5d68dddb1d9ef40bd7c2093bec24b9b4f4911d6d;hb=b0c95cb531f14d955b246b94c2bd8548eb8f0241;hp=775523a56b7630eb15bb185d529bc30515198a3b;hpb=04cc48bd2a049909af54b9e58afebffe51cdd1b2;p=freeside.git diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 775523a56..5d68dddb1 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -396,7 +396,7 @@ sub insert { } if ( $amount ) { - $error = $self->insert_prepay($amount, $prepay_identifier); + $error = $self->insert_cust_pay_prepay($amount, $prepay_identifier); if ( $error ) { $dbh->rollback if $oldAutoCommit; return "inserting prepayment (transaction rolled back): $error"; @@ -687,7 +687,7 @@ sub insert_cust_pay_prepay { my $cust_pay = new FS::cust_pay { 'custnum' => $self->custnum, - 'paid' => $amount, + 'paid' => sprintf('%.2f', $amount), #'_date' => #date the prepaid card was purchased??? 'payby' => 'PREP', 'payinfo' => $payinfo, @@ -3160,11 +3160,53 @@ Returns a name string for this customer, either "Company (Last, First)" or sub name { my $self = shift; - my $name = $self->get('last'). ', '. $self->first; + my $name = $self->contact; $name = $self->company. " ($name)" if $self->company; $name; } +=item ship_name + +Returns a name string for this (service/shipping) contact, either +"Company (Last, First)" or "Last, First". + +=cut + +sub ship_name { + my $self = shift; + if ( $self->get('ship_last') ) { + my $name = $self->ship_contact; + $name = $self->ship_company. " ($name)" if $self->ship_company; + $name; + } else { + $self->name; + } +} + +=item contact + +Returns this customer's full (billing) contact name only, "Last, First" + +=cut + +sub contact { + my $self = shift; + $self->get('last'). ', '. $self->first; +} + +=item ship_contact + +Returns this customer's full (shipping) contact name only, "Last, First" + +=cut + +sub ship_contact { + my $self = shift; + $self->get('ship_last') + ? $self->get('ship_last'). ', '. $self->ship_first + : $self->contact; +} + =item status Returns a status string for this customer, currently: