X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main.pm;h=73bdc14621761551a7e97792916fe9866f67cb8c;hb=99037cf94d9d6b5d7c1e512a6dca842706851710;hp=de4d38de9615bbebcce8d9afe4c1300c1d8abedd;hpb=34f91089a0d54fa39d622ec5e03d9e09a50e9f79;p=freeside.git diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index de4d38de9..73bdc1462 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -2166,8 +2166,7 @@ sub bill { # only for figuring next bill date, nothing else, so, reset $sdate again # here $sdate = $cust_pkg->bill || $cust_pkg->setup || $time; - $cust_pkg->last_bill($sdate) - if $cust_pkg->dbdef_table->column('last_bill'); + $cust_pkg->last_bill($sdate); if ( $part_pkg->freq =~ /^\d+$/ ) { $mon += $part_pkg->freq; @@ -4633,13 +4632,14 @@ the error, otherwise returns false. sub charge { my $self = shift; - my ( $amount, $pkg, $comment, $taxclass, $additional ); + my ( $amount, $pkg, $comment, $taxclass, $additional, $classnum ); if ( ref( $_[0] ) ) { $amount = $_[0]->{amount}; $pkg = exists($_[0]->{pkg}) ? $_[0]->{pkg} : 'One-time charge'; $comment = exists($_[0]->{comment}) ? $_[0]->{comment} : '$'. sprintf("%.2f",$amount); $taxclass = exists($_[0]->{taxclass}) ? $_[0]->{taxclass} : ''; + $classnum = exists($_[0]->{classnum}) ? $_[0]->{classnum} : ''; $additional = $_[0]->{additional}; }else{ $amount = shift; @@ -4666,6 +4666,7 @@ sub charge { 'plan' => 'flat', 'freq' => 0, 'disabled' => 'Y', + 'classnum' => $classnum ? $classnum : '', 'taxclass' => $taxclass, } ); @@ -5191,8 +5192,8 @@ sub _money_table_where { my @where = (); push @where, "cust_main.custnum = $table.custnum" unless $opt{'total'}; if ( $table eq 'cust_bill' || $opt{'unapplied_date'} ) { - push @where, "$table._date <= $start" if length($start); - push @where, "$table._date > $end" if length($end); + push @where, "$table._date <= $start" if defined($start) && length($start); + push @where, "$table._date > $end" if defined($end) && length($end); } push @where, @{$opt{'where'}} if $opt{'where'}; my $where = scalar(@where) ? 'WHERE '. join(' AND ', @where ) : ''; @@ -5329,10 +5330,14 @@ sub smart_search { } - } elsif ( $search =~ /^\s*(\d+)\s*$/ ) { # customer # search - # (also try agent_custid) - # (regex needs tweaking if your - # legacy cust numbers have letters) + # custnum search (also try agent_custid), with some tweaking options if your + # legacy cust "numbers" have letters + } elsif ( $search =~ /^\s*(\d+)\s*$/ + || ( $conf->config('cust_main-agent_custid-format') eq 'ww?d+' + && $search =~ /^\s*(\w\w?\d+)\s*$/ + ) + ) + { push @cust_main, qsearch( { 'table' => 'cust_main',