diff options
author | Ivan Kohler <ivan@freeside.biz> | 2014-10-18 04:11:40 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2014-10-18 04:11:40 -0700 |
commit | 98542f4281bb4506a31a665f46597ada49619dfe (patch) | |
tree | 05a79381a624e679eab352210c2db44135f5445e | |
parent | 519f2393ecc06f548c76a677490add1adb1c1edf (diff) |
byproduct #31593
-rw-r--r-- | httemplate/search/contact.html | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/httemplate/search/contact.html b/httemplate/search/contact.html new file mode 100644 index 000000000..0292fa539 --- /dev/null +++ b/httemplate/search/contact.html @@ -0,0 +1,43 @@ +<& elements/search.html, + title => 'Contacts', + name_singular => 'contact', + query => { select => $select, + table => 'contact', + addl_from => $addl_from, + hashref => \%hash, + extra_sql => $extra_sql, + }, + count_query => "SELECT COUNT(*) FROM contact $extra_sql", #XXX + header => [ 'First', 'Last', 'Title', 'Company', 'Self-service', ], + fields => [ 'first', 'last', 'title', 'company', 'selfservice_access' ], + links => [ '', '', '', $company_link, '', ], +&> +<%init> + +my $select = 'contact.*'; +my %hash = (); +my $addl_from = ''; + +my $company_link = ''; + +if ( $cgi->param('selfservice_access') eq 'Y' ) { + $hash{'selfservice_access'} = 'Y'; +} + +my $extra_sql = ''; +if ( $cgi->param('cust_main') ) { + $select .= ', cust_main.company'; + $addl_from = ' LEFT JOIN cust_main USING ( custnum )'; + $extra_sql = ' custnum IS NOT NULL '; + $company_link = [ $p.'view/cust_main.cgi?', 'custnum' ]; +} elsif ( $cgi->param('prospect_main') ) { + $select .= ', prospect_main.company'; + $addl_from = ' LEFT JOIN prospect_main USING ( prospectnum )'; + $extra_sql = ' prospectnum IS NOT NULL '; + $company_link = [ $p.'view/prospect_main.html?', 'prospectnum' ]; +} + +$extra_sql = (keys(%hash) ? ' AND ' : ' WHERE '). $extra_sql + if $extra_sql; + +</%init> |