diff options
Diffstat (limited to 'httemplate/search')
-rw-r--r-- | httemplate/search/elements/grouped-search.html | 2 | ||||
-rw-r--r-- | httemplate/search/elements/grouped-search/deposit_slip | 8 | ||||
-rw-r--r-- | httemplate/search/elements/grouped-search/html | 6 | ||||
-rw-r--r-- | httemplate/search/elements/search-deposit_slip.html | 17 | ||||
-rw-r--r-- | httemplate/search/elements/search.html | 9 |
5 files changed, 38 insertions, 4 deletions
diff --git a/httemplate/search/elements/grouped-search.html b/httemplate/search/elements/grouped-search.html index 56fc88d..80a9319 100644 --- a/httemplate/search/elements/grouped-search.html +++ b/httemplate/search/elements/grouped-search.html @@ -42,7 +42,7 @@ </%doc> <%init> my $type = 'html'; -if ($cgi->param('type') =~ /^(html|html-print|xls)$/) { +if ($cgi->param('type') =~ /^(html|html-print|xls|deposit_slip)$/) { $type = $1; } </%init> diff --git a/httemplate/search/elements/grouped-search/deposit_slip b/httemplate/search/elements/grouped-search/deposit_slip new file mode 100644 index 0000000..6e69662 --- /dev/null +++ b/httemplate/search/elements/grouped-search/deposit_slip @@ -0,0 +1,8 @@ +<& /search/elements/search-deposit_slip.html, rows=>\@rows, &>\ +<%init> +my %opt = @_; +my $group_info = $m->comp('core', %opt); +#just the first group +my $query = $group_info->{queries}[0]; +my @rows = $query->qsearch; +</%init> diff --git a/httemplate/search/elements/grouped-search/html b/httemplate/search/elements/grouped-search/html index ae80865..24cf50e 100644 --- a/httemplate/search/elements/grouped-search/html +++ b/httemplate/search/elements/grouped-search/html @@ -114,9 +114,13 @@ my $money = $conf->config('money_char') || '$'; %# download links <P><% emt('Download results:') %> % $cgi->param('type', 'xls'); -<A HREF="<% $cgi->self_url %>"><% emt('Spreadsheet') %></A> | +<A HREF="<% $cgi->self_url %>"><% emt('Spreadsheet') %></A> | % $cgi->param('type', 'html-print'); <A HREF="<% $cgi->self_url %>"><% emt('webpage') %></A> +% if ( ref($query) && $query->{table} eq 'cust_pay' ) { +% $cgi->param('type', 'deposit_slip'); + | <A HREF="<% $cgi->self_url %>"><% emt('deposit slip') %></A> +% } % $cgi->delete('type'); </P> % } diff --git a/httemplate/search/elements/search-deposit_slip.html b/httemplate/search/elements/search-deposit_slip.html new file mode 100644 index 0000000..c7a6cbb --- /dev/null +++ b/httemplate/search/elements/search-deposit_slip.html @@ -0,0 +1,17 @@ +<% $deposit_pdf %>\ +<%init> + +my %args = @_; +my $rows = $args{'rows'}; + +my $deposit_pdf = deposit_slip_pdf( + conf => FS::Conf->new, + cust_pay => $rows, +); + +http_header('Content-Type' => 'application/pdf'); +http_header('Content-Disposition' => "filename=deposit.pdf" ); +http_header('Content-Length' => length($deposit_pdf) ); +http_header('Cache-control' => 'max-age=60' ); + +</%init> diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html index 730a51a..60548e2 100644 --- a/httemplate/search/elements/search.html +++ b/httemplate/search/elements/search.html @@ -198,6 +198,10 @@ Example: % <% include('search-xml.html', rows=>$rows, opt=>\%opt ) %> % +% } elsif ( $type eq 'deposit_slip' ) { +% +<% include('search-deposit_slip.html', rows=>$rows, opt=>\%opt ) %> +% % } else { % <% include('search-html.html', @@ -224,8 +228,9 @@ my $curuser = $FS::CurrentUser::CurrentUser; $m->comp('/elements/handle_uri_query'); -my $type = $cgi->param('_type') =~ /^(csv|\w*\.xls|xml|select|html(-print)?)$/ - ? $1 : 'html' ; +my $type = $cgi->param('_type') + =~ /^(csv|\w*\.xls|xml|select|html(-print)?|deposit_slip)$/ + ? $1 : 'html' ; if ( !$curuser->access_right('Download report data') ) { $opt{'disable_download'} = 1; |