X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fchange_history.html;h=d8f0d1efce0e5b0db1e5516f51157d4dfd51f6eb;hp=fe11b95f22f530cc4b5ebca8c2982e47bc2eec7e;hb=66feacf4ed45aa7b27d48f91c0d8741f0ad9b9de;hpb=da9ab0af53220f6f1cb0e4d31ce7de81dd591783 diff --git a/httemplate/view/cust_main/change_history.html b/httemplate/view/cust_main/change_history.html index fe11b95f2..d8f0d1efc 100644 --- a/httemplate/view/cust_main/change_history.html +++ b/httemplate/view/cust_main/change_history.html @@ -32,6 +32,7 @@ tie my %years, 'Tie::IxHash', tie my %tables, 'Tie::IxHash', 'cust_main' => 'Customer', 'cust_main_invoice' => 'Invoice destination', + 'cust_main_note' => 'Note', 'cust_pkg' => 'Package', #? or just svc_* ? 'cust_svc' => 'svc_acct' => 'Account', @@ -46,6 +47,8 @@ tie my %tables, 'Tie::IxHash', 'phone_device' => 'Phone device', 'cust_pkg_discount' => 'Discount', #? it gets provisioned anyway 'phone_avail' => 'Phone', + 'cust_tag' => 'Tag', + 'contact' => 'Contact', ; my $pkg_join = "JOIN cust_pkg USING ( pkgnum )"; @@ -66,6 +69,7 @@ my %table_join = ( 'radius_usergroup' => $svc_join, 'phone_device' => $svc_join, 'cust_pkg_discount'=> $pkg_join, + 'contact' => "JOIN cust_contact USING ( contactnum )", ); %table_join = (%table_join, map { $_ => $svc_join } @svc_tables); @@ -139,13 +143,16 @@ my $newer_than = int( time - $years * 31556736 ); #60*60*24*365.24 local($FS::Record::nowarn_classload) = 1; +my $extra_sql = ' AND custnum = '. $cust_main->custnum; + my %foundsvcs; foreach my $table ( keys %tables ) { + $extra_sql = ' AND cust_contact.custnum = '. $cust_main->custnum if $table eq 'contact'; my @items = qsearch({ 'table' => "h_$table", 'addl_from' => $table_join{$table}, 'hashref' => { 'history_date' => { op=>'>=', value=>$newer_than }, }, - 'extra_sql' => ' AND custnum = '. $cust_main->custnum, + 'extra_sql' => $extra_sql, }); %foundsvcs = (%foundsvcs, map { $_->svcnum => 1 } @items) if $table =~ /^svc/; @@ -159,10 +166,10 @@ foreach my $table ( keys %tables ) { # but it would spoil database optimizations on this lookup my @svcnumobj = qsearch({ 'select' => 'DISTINCT svcnum', - 'hashref' => { 'custnum' => $cust_main->custnum, - 'history_date' => { op=>'>=', value=>$newer_than } }, + 'hashref' => { 'history_date' => { op=>'>=', value=>$newer_than } }, 'table' => 'h_cust_svc', 'addl_from' => 'JOIN cust_pkg USING (pkgnum)', + 'extra_sql' => ' AND custnum = '. $cust_main->custnum, }); # now grab those svcs explicitly