From 51984ac3d3da3006809c6866fdecd4ad83610731 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Jul 2001 07:36:04 +0000 Subject: templates!!! --- httemplate/misc/print-invoice.cgi | 55 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 httemplate/misc/print-invoice.cgi (limited to 'httemplate/misc/print-invoice.cgi') diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi new file mode 100755 index 000000000..1d35bc0f2 --- /dev/null +++ b/httemplate/misc/print-invoice.cgi @@ -0,0 +1,55 @@ +<% +# +# $Id: print-invoice.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# just a kludge for now, since this duplicates in a way it shouldn't stuff from +# Bill.pm (like $lpr) ivan@sisd.com 98-jun-16 +# +# $Log: print-invoice.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.4 1999/01/19 05:14:07 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1998/12/23 03:04:24 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:12:47 ivan +# s/CGI::(Request|Base)/CGI.pm/; +# + +use strict; +use vars qw($conf $cgi $lpr $query $invnum $cust_bill $custnum ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl); +use FS::Record qw(qsearchs); +use FS::cust_bill; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$conf = new FS::Conf; +$lpr = $conf->config('lpr'); + +#untaint invnum +($query) = $cgi->keywords; +$query =~ /^(\d*)$/; +$invnum = $1; +$cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); +die "Can't find invoice!\n" unless $cust_bill; + + open(LPR,"|$lpr") or die "Can't open $lpr: $!"; + print LPR $cust_bill->print_text; #( date ) + close LPR + or die $! ? "Error closing $lpr: $!" + : "Exit status $? from $lpr"; + +$custnum = $cust_bill->getfield('custnum'); + +print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum#history"); + +%> -- cgit v1.2.1 From 3d671921441ba8422650b54435a1959ad1d4c71d Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 21 Aug 2001 02:31:57 +0000 Subject: remove $Log$ messages. whew. --- httemplate/misc/print-invoice.cgi | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'httemplate/misc/print-invoice.cgi') diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi index 1d35bc0f2..a6cb05230 100755 --- a/httemplate/misc/print-invoice.cgi +++ b/httemplate/misc/print-invoice.cgi @@ -1,24 +1,5 @@ <% -# -# $Id: print-invoice.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# just a kludge for now, since this duplicates in a way it shouldn't stuff from -# Bill.pm (like $lpr) ivan@sisd.com 98-jun-16 -# -# $Log: print-invoice.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.4 1999/01/19 05:14:07 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.3 1998/12/23 03:04:24 ivan -# $cgi->keywords instead of $cgi->query_string -# -# Revision 1.2 1998/12/17 09:12:47 ivan -# s/CGI::(Request|Base)/CGI.pm/; -# +# use strict; use vars qw($conf $cgi $lpr $query $invnum $cust_bill $custnum ); -- cgit v1.2.1 From 1fd6d8cf5d7854860ef4fd10ed89828e0c04ec39 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 30 Jan 2002 14:18:09 +0000 Subject: remove use Module; and $cgi = new CGI; &cgisuidsetup(); from all templates. should work better under Mason. --- httemplate/misc/print-invoice.cgi | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'httemplate/misc/print-invoice.cgi') diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi index a6cb05230..aec7cb39c 100755 --- a/httemplate/misc/print-invoice.cgi +++ b/httemplate/misc/print-invoice.cgi @@ -1,26 +1,14 @@ + <% -# -use strict; -use vars qw($conf $cgi $lpr $query $invnum $cust_bill $custnum ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl); -use FS::Record qw(qsearchs); -use FS::cust_bill; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; -$lpr = $conf->config('lpr'); +my $conf = new FS::Conf; +my $lpr = $conf->config('lpr'); #untaint invnum -($query) = $cgi->keywords; +my($query) = $cgi->keywords; $query =~ /^(\d*)$/; -$invnum = $1; -$cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); +my $invnum = $1; +my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Can't find invoice!\n" unless $cust_bill; open(LPR,"|$lpr") or die "Can't open $lpr: $!"; @@ -29,7 +17,7 @@ die "Can't find invoice!\n" unless $cust_bill; or die $! ? "Error closing $lpr: $!" : "Exit status $? from $lpr"; -$custnum = $cust_bill->getfield('custnum'); +my $custnum = $cust_bill->getfield('custnum'); print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum#history"); -- cgit v1.2.1 From 22a35047ecdffff80110e06cc08fc84f9ddba9b0 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 10 Feb 2002 13:21:31 +0000 Subject: removed from all files to fix any redirects, whew Mason handler.pl overrides CGI::redirect fixed strict; problems in edit/part_pkg.cgi & edit/process/part_pkg.cgi --- httemplate/misc/print-invoice.cgi | 1 - 1 file changed, 1 deletion(-) (limited to 'httemplate/misc/print-invoice.cgi') diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi index aec7cb39c..a5500bff2 100755 --- a/httemplate/misc/print-invoice.cgi +++ b/httemplate/misc/print-invoice.cgi @@ -1,4 +1,3 @@ - <% my $conf = new FS::Conf; -- cgit v1.2.1 From 23ec9b00410224868d6be1e47a0d72a6c8b3f6f5 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 29 Nov 2003 08:08:36 +0000 Subject: postscript invoice redux --- httemplate/misc/print-invoice.cgi | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'httemplate/misc/print-invoice.cgi') diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi index a5500bff2..8c1240c05 100755 --- a/httemplate/misc/print-invoice.cgi +++ b/httemplate/misc/print-invoice.cgi @@ -11,7 +11,14 @@ my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Can't find invoice!\n" unless $cust_bill; open(LPR,"|$lpr") or die "Can't open $lpr: $!"; - print LPR $cust_bill->print_text; #( date ) + + if ( $conf->exists('invoice_latex') ) { + $cust_bill->print_ps; + #print LPR $cust_bill->print_ps; #( date ) + } else { + print LPR $cust_bill->print_text; #( date ) + } + close LPR or die $! ? "Error closing $lpr: $!" : "Exit status $? from $lpr"; -- cgit v1.2.1 From b3808f960c0351710f7005e7a2729925f57c7f4a Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 15 Dec 2003 08:07:06 +0000 Subject: print_ps returns ths invoice now, do not count on latex printing it, oops --- httemplate/misc/print-invoice.cgi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'httemplate/misc/print-invoice.cgi') diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi index 8c1240c05..0dda68a4e 100755 --- a/httemplate/misc/print-invoice.cgi +++ b/httemplate/misc/print-invoice.cgi @@ -13,8 +13,7 @@ die "Can't find invoice!\n" unless $cust_bill; open(LPR,"|$lpr") or die "Can't open $lpr: $!"; if ( $conf->exists('invoice_latex') ) { - $cust_bill->print_ps; - #print LPR $cust_bill->print_ps; #( date ) + print LPR $cust_bill->print_ps; #( date ) } else { print LPR $cust_bill->print_text; #( date ) } -- cgit v1.2.1 From f4ffa3596c3b8bfc9e862c2a7e8efc68f86207ab Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 12 Feb 2004 06:31:37 +0000 Subject: re-email invoice, closes: bug#526 and have print and email invoice links redirect back to top of customer view page instead of #history tag --- httemplate/misc/print-invoice.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc/print-invoice.cgi') diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi index 0dda68a4e..144f6156a 100755 --- a/httemplate/misc/print-invoice.cgi +++ b/httemplate/misc/print-invoice.cgi @@ -24,6 +24,6 @@ die "Can't find invoice!\n" unless $cust_bill; my $custnum = $cust_bill->getfield('custnum'); -print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum#history"); +print $cgi->redirect("${p}view/cust_main.cgi?$custnum"); %> -- cgit v1.2.1 From c28a4c33a88dfa354436f81a2e213638088adcf1 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 19 May 2005 08:43:27 +0000 Subject: re-email/fax/print links should respect template, also add direct re-send links like the view links and convert view/cust_bill.cgi to proper template --- httemplate/misc/print-invoice.cgi | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'httemplate/misc/print-invoice.cgi') diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi index 144f6156a..5eeef3482 100755 --- a/httemplate/misc/print-invoice.cgi +++ b/httemplate/misc/print-invoice.cgi @@ -5,17 +5,18 @@ my $lpr = $conf->config('lpr'); #untaint invnum my($query) = $cgi->keywords; -$query =~ /^(\d*)$/; -my $invnum = $1; +$query =~ /^((.+)-)?(\d+)$/; +my $template = $2; +my $invnum = $3; my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Can't find invoice!\n" unless $cust_bill; open(LPR,"|$lpr") or die "Can't open $lpr: $!"; if ( $conf->exists('invoice_latex') ) { - print LPR $cust_bill->print_ps; #( date ) + print LPR $cust_bill->print_ps('', $template); #( date ) } else { - print LPR $cust_bill->print_text; #( date ) + print LPR $cust_bill->print_text('', $template); #( date ) } close LPR -- cgit v1.2.1 From 684a478c0f88e5bf6d1d3f32f4618089146b5709 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 2 Jun 2005 09:29:56 +0000 Subject: add ability to search on a date range of invoice events and then reprint or reemail (boy was that a bit more work than i expected), closes: Bug#946 --- httemplate/misc/print-invoice.cgi | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'httemplate/misc/print-invoice.cgi') diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi index 5eeef3482..6a4c2d7f1 100755 --- a/httemplate/misc/print-invoice.cgi +++ b/httemplate/misc/print-invoice.cgi @@ -1,8 +1,5 @@ <% -my $conf = new FS::Conf; -my $lpr = $conf->config('lpr'); - #untaint invnum my($query) = $cgi->keywords; $query =~ /^((.+)-)?(\d+)$/; @@ -11,17 +8,7 @@ my $invnum = $3; my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Can't find invoice!\n" unless $cust_bill; - open(LPR,"|$lpr") or die "Can't open $lpr: $!"; - - if ( $conf->exists('invoice_latex') ) { - print LPR $cust_bill->print_ps('', $template); #( date ) - } else { - print LPR $cust_bill->print_text('', $template); #( date ) - } - - close LPR - or die $! ? "Error closing $lpr: $!" - : "Exit status $? from $lpr"; +$cust_bill->print($template); my $custnum = $cust_bill->getfield('custnum'); -- cgit v1.2.1