summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/edit/part_pkg.cgi1
-rw-r--r--httemplate/search/contact.html43
-rw-r--r--httemplate/search/elements/search.html8
3 files changed, 47 insertions, 5 deletions
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index 36747783c..af69f71f9 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -233,7 +233,6 @@
{ field => 'agent_type',
type => 'select-agent_type',
disabled => ! $acl_edit_global,
- #XXX ??? 'element_name' => 'agent_type',
element_etc => 'size="10"',
multiple => '1', #cause edit.html is dum
curr_value_callback => sub {
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>
diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html
index e6309eab8..3fb1e3e74 100644
--- a/httemplate/search/elements/search.html
+++ b/httemplate/search/elements/search.html
@@ -43,7 +43,7 @@ Example:
#listref of column labels, <TH>
#recommended unless 'query' is an SQL query string
- # (if not specified the database column names will be used)
+ # (if not specified the database column names will be used) (XXX this is not currently working either)
'header' => [ '#',
'Item',
{ 'label' => 'Another Item',
@@ -52,7 +52,7 @@ Example:
],
#listref - each item is a literal column name (or method) or coderef
- #if not specified all columns will be shown
+ #if not specified all columns will be shown (XXX this is not currently working?)
'fields' => [
'column',
sub { my $row = shift; $row->column; },
@@ -130,7 +130,7 @@ Example:
'agent_pos' => 3, # optional position (starting from 0) to
# insert an Agent column (query needs to be a
# qsearch hashref and header & fields need to
- # be defined)
+ # be defined)cust_pkg_susp.html
# sort, link & display properties for fields
@@ -141,7 +141,7 @@ Example:
# or a listref of link and method name to append,
# or a listref of link and coderef to run and append
# or a coderef that returns such a listref
- 'links' => [],`
+ 'links' => [],
#listref - each item is the empty string,
# or a string onClick handler for the corresponding link