make postal invoice fee a per-agent config, RT7240
[freeside.git] / FS / FS / cust_main.pm
index babb50f..61625d8 100644 (file)
@@ -1652,6 +1652,7 @@ sub check {
     || $self->ut_alphan('geocode')
     || $self->ut_floatn('cdr_termination_percentage')
     || $self->ut_floatn('credit_limit')
+    || $self->ut_numbern('billday')
   ;
 
   #barf.  need message catalogs.  i18n.  etc.
@@ -2211,12 +2212,13 @@ Returns all notes (see L<FS::cust_main_note>) for this customer.
 =cut
 
 sub notes {
-  my $self = shift;
-  #order by?
+   my($self,$orderby_classnum) = (shift,shift);
+   my $orderby = "_DATE DESC";
+   $orderby = "CLASSNUM ASC, $orderby" if $orderby_classnum;
   qsearch( 'cust_main_note',
            { 'custnum' => $self->custnum },
           '',
-          'ORDER BY _DATE DESC'
+          "ORDER BY $orderby",
         );
 }
 
@@ -3367,7 +3369,7 @@ sub charge {
 sub charge_postal_fee {
   my $self = shift;
 
-  my $pkgpart = $conf->config('postal_invoice-fee_pkgpart');
+  my $pkgpart = $conf->config('postal_invoice-fee_pkgpart', $self->agentnum);
   return '' unless ($pkgpart && grep { $_ eq 'POST' } $self->invoicing_list);
 
   my $cust_pkg = new FS::cust_pkg ( {
@@ -3854,7 +3856,7 @@ sub statuscolor { shift->cust_statuscolor(@_); }
 
 sub cust_statuscolor {
   my $self = shift;
-  $self->statuscolors->{$self->cust_status};
+  __PACKAGE__->statuscolors->{$self->cust_status};
 }
 
 =item tickets