oops, fix last minute bug with new configurable customer fields on reports
[freeside.git] / FS / FS / cust_main.pm
index 775523a..5d68ddd 100644 (file)
@@ -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: