summaryrefslogtreecommitdiff
path: root/httemplate/search
diff options
context:
space:
mode:
authorivan <ivan>2006-04-22 00:58:40 +0000
committerivan <ivan>2006-04-22 00:58:40 +0000
commit1a033848671cad2cbe7687b37fc718b3b2a68b83 (patch)
tree01fc1ca352726cdc5786e0ccaf78515e9326ba84 /httemplate/search
parent303cb4ce4b6ce634e108e3b7a0b43086a5e4f184 (diff)
start of package class web UI (add/edit package classes, package class selection in package def edit)
Diffstat (limited to 'httemplate/search')
-rwxr-xr-xhttemplate/search/cust_pkg.cgi8
-rw-r--r--httemplate/search/elements/search.html57
-rw-r--r--httemplate/search/inventory_class.html89
3 files changed, 50 insertions, 104 deletions
diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi
index 5da4d82fb..a2fb89c12 100755
--- a/httemplate/search/cust_pkg.cgi
+++ b/httemplate/search/cust_pkg.cgi
@@ -19,8 +19,10 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) {
my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
push @where,
- "bill >= $beginning ",
- "bill <= $ending",
+ #"bill >= $beginning ",
+ #"bill <= $ending",
+ "CASE WHEN bill IS NULL THEN 0 ELSE bill END >= $beginning ",
+ "CASE WHEN bill IS NULL THEN 0 ELSE bill END <= $ending",
'( cancel IS NULL OR cancel = 0 )';
} else {
@@ -141,7 +143,7 @@ sub time_or_blank {
'name' => 'packages',
'query' => $sql_query,
'count_query' => $count_query,
- 'redirect' => $link,
+ #'redirect' => $link,
'header' => [ '#',
'Package',
'Status',
diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html
index 7f7243588..6cf574164 100644
--- a/httemplate/search/elements/search.html
+++ b/httemplate/search/elements/search.html
@@ -8,8 +8,12 @@
# 'name' => 'items', #name for the records returned
#
# # some HTML callbacks...
- # 'menubar' => '', #menubar arrayref
- # 'html_init' => '', #after the header/menubar and before the pager
+ # 'menubar' => '', #menubar arrayref
+ # 'html_init' => '', #after the header/menubar and before the pager
+ # 'html_foot' => '', #at the bottom
+ # 'html_posttotal' => '', #at the bottom
+ # # (these three can be strings or coderefs)
+ #
#
# #literal SQL query string or qsearch hashref, required
# 'query' => {
@@ -39,6 +43,10 @@
# # (if not specified the database column names will be used)
# 'header' => [ '#', 'Item' ],
#
+ # 'disable_download' => '', # set true to hide the CSV/Excel download links
+ # 'disable_nonefound' => '', # set true to disable the "No matching Xs found"
+ # # message
+ #
# #listref - each item is a literal column name (or method) or coderef
# #if not specified all columns will be shown
# 'fields' => [
@@ -286,7 +294,13 @@
include( '/elements/menubar.html', @menubar )
)
%>
- <%= defined($opt{'html_init'}) ? $opt{'html_init'} : '' %>
+ <%= defined($opt{'html_init'})
+ ? ( ref($opt{'html_init'})
+ ? &{$opt{'html_init'}}()
+ : $opt{'html_init'}
+ )
+ : ''
+ %>
<% my $pager = include ( '/elements/pager.html',
'offset' => $offset,
'num_rows' => scalar(@$rows),
@@ -295,26 +309,38 @@
);
%>
<% unless ( $total ) { %>
- No matching <%= $opt{'name'} %> found.<BR>
+ <% unless ( $opt{'disable_nonefound'} ) { %>
+ No matching <%= $opt{'name'} %> found.<BR>
+ <% } %>
<% } else { %>
<TABLE>
<TR>
<TD VALIGN="bottom">
- <%= $total %> total <%= $opt{'name'} %><BR>
+ <%= $total %> total <%= $opt{'name'} %>
+ <%= defined($opt{'html_posttotal'})
+ ? ( ref($opt{'html_posttotal'})
+ ? &{$opt{'html_posttotal'}}()
+ : $opt{'html_posttotal'}
+ )
+ : ''
+ %>
+ <BR>
<% if ( $opt{'count_addl'} ) { %>
<% my $n=0; foreach my $count ( @{$opt{'count_addl'}} ) { %>
<%= sprintf( $count, $count_arrayref->[++$n] ) %><BR>
<% } %>
<% } %>
</TD>
- <TD ALIGN="right">
- <% $cgi->param('_type', "$xlsname.xls" ); %>
- Download full results<BR>
- as <A HREF="<%= $cgi->self_url %>">Excel spreadsheet</A><BR>
- <% $cgi->param('_type', 'csv'); %>
- as <A HREF="<%= $cgi->self_url %>">CSV file</A>
- </TD>
+ <% unless ( $opt{'disable_download'} ) { %>
+ <TD ALIGN="right">
+ <% $cgi->param('_type', "$xlsname.xls" ); %>
+ Download full results<BR>
+ as <A HREF="<%= $cgi->self_url %>">Excel spreadsheet</A><BR>
+ <% $cgi->param('_type', 'csv'); %>
+ as <A HREF="<%= $cgi->self_url %>">CSV file</A>
+ </TD>
+ <% } %>
</TR>
<TR>
<TD COLSPAN=2>
@@ -471,6 +497,13 @@
</TABLE>
<% } %>
+ <%= defined($opt{'html_foot'})
+ ? ( ref($opt{'html_foot'})
+ ? &{$opt{'html_foot'}}()
+ : $opt{'html_foot'}
+ )
+ : ''
+ %>
<%= include( '/elements/footer.html' ) %>
<% } %>
<% } %>
diff --git a/httemplate/search/inventory_class.html b/httemplate/search/inventory_class.html
deleted file mode 100644
index 37735f3c9..000000000
--- a/httemplate/search/inventory_class.html
+++ /dev/null
@@ -1,89 +0,0 @@
-<%
-
-tie my %labels, 'Tie::IxHash',
- 'num_avail' => 'Available', # <FONT SIZE="-1"><A HREF="eventually">(upload batch)</A></FONT>',
- 'num_used' => 'In use', #'Used', #'Allocated',
- 'num_total' => 'Total',
-;
-
-my %link = (
- 'num_avail' => ';avail=1',
- 'num_used' => ';avail=1',
- 'num_total' => '',
-);
-
-my %inv_action_link = (
- 'num_avail' => [ 'upload batch',
- $p.'misc/inventory_item-import.html?classnum=',
- 'classnum'
- ],
-);
-
-my $link = [ "${p}edit/inventory_class.html?", 'classnum' ];
-
-%><%= include( 'elements/search.html',
- 'title' => 'Inventory Classes',
- 'name' => 'inventory classes',
- 'menubar' => [ 'Add a new inventory class' =>
- $p.'edit/inventory_class.html',
- ],
- 'query' => { 'table' => 'inventory_class', },
- 'count_query' => 'SELECT COUNT(*) FROM inventory_class',
- 'header' => [ '#', 'Inventory class', 'Inventory' ],
- 'fields' => [ 'classnum',
- 'classname',
- sub {
- #my $inventory_class = shift;
- my $i_c = shift;
-
- my $link =
- $p. 'search/inventory_item.html?'.
- 'classnum='. $i_c->classnum;
-
- my %actioncol = ();
- foreach ( keys %inv_action_link ) {
- my($label, $baseurl, $method) =
- @{ $inv_action_link{$_} };
- my $url = $baseurl. $i_c->$method();
- $actioncol{$_} =
- '<FONT SIZE="-1">'.
- '('.
- '<A HREF="'.$url.'">'.
- $label.
- '</A>'.
- ')'.
- '</FONT>';
- }
-
- my %num = map {
- $_ => $i_c->$_();
- } keys %labels;
-
- [ map {
- [
- {
- 'data' => '<B>'. $num{$_}. '</B>',
- 'align' => 'right',
- },
- {
- 'data' => $labels{$_},
- 'align' => 'left',
- 'link' => ( $num{$_}
- ? $link.$link{$_}
- : ''
- ),
- },
- { 'data' => $actioncol{$_},
- 'align' => 'left',
- },
- ]
- } keys %labels
- ];
- },
- ],
- 'links' => [ $link,
- $link,
- '',
- ],
- )
-%>