From 6412f71a3557249225abf5eb2096ebad1729c585 Mon Sep 17 00:00:00 2001 From: jeff Date: Sat, 1 Sep 2001 21:52:20 +0000 Subject: add cust_credit_bill relating multiple invoices to credits --- httemplate/edit/process/cust_credit_bill.cgi | 56 ++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 httemplate/edit/process/cust_credit_bill.cgi (limited to 'httemplate/edit/process/cust_credit_bill.cgi') diff --git a/httemplate/edit/process/cust_credit_bill.cgi b/httemplate/edit/process/cust_credit_bill.cgi new file mode 100755 index 000000000..f838dff10 --- /dev/null +++ b/httemplate/edit/process/cust_credit_bill.cgi @@ -0,0 +1,56 @@ +<% +# + +use strict; +use vars qw( $cgi $custnum $crednum $new $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup getotaker); +use FS::CGI qw(popurl); +use FS::Record qw(qsearchs fields); +use FS::cust_credit; +use FS::cust_credit_bill; + +$cgi = new CGI; +cgisuidsetup($cgi); + +$cgi->param('crednum') =~ /^(\d*)$/ or die "Illegal crednum!"; +$crednum = $1; + +my $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } ) + or die "No such crednum"; + +my $cust_main = qsearchs('cust_main', { 'custnum' => $cust_credit->custnum } ) + or die "Bogus credit: not attached to customer"; + +my $custnum = $cust_main->custnum; + +if ($cgi->param('invnum') =~ /^Refund$/) { + $new = new FS::cust_refund ( { + 'reason' => $cust_credit->reason, + 'refund' => $cgi->param('amount'), + 'payby' => 'BILL', + '_date' => $cgi->param('_date'), + 'payinfo' => 'Cash', + 'crednum' => $crednum, + } ); +}else{ + $new = new FS::cust_credit_bill ( { + map { + $_, scalar($cgi->param($_)); + #} qw(custnum _date amount invnum) + } fields('cust_credit_bill') + } ); +} + +$error=$new->insert; + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "cust_credit_bill.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); +} + + +%> -- cgit v1.2.1 From 91135a208282b03644cc766ed917b64fe24f374c Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 18 Dec 2001 19:30:31 +0000 Subject: apply payment webinterface --- httemplate/edit/process/cust_credit_bill.cgi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'httemplate/edit/process/cust_credit_bill.cgi') diff --git a/httemplate/edit/process/cust_credit_bill.cgi b/httemplate/edit/process/cust_credit_bill.cgi index f838dff10..e84894b04 100755 --- a/httemplate/edit/process/cust_credit_bill.cgi +++ b/httemplate/edit/process/cust_credit_bill.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $custnum $crednum $new $error ); @@ -10,6 +10,8 @@ use FS::CGI qw(popurl); use FS::Record qw(qsearchs fields); use FS::cust_credit; use FS::cust_credit_bill; +use FS::cust_refund; +use FS::cust_main; $cgi = new CGI; cgisuidsetup($cgi); @@ -34,7 +36,7 @@ if ($cgi->param('invnum') =~ /^Refund$/) { 'payinfo' => 'Cash', 'crednum' => $crednum, } ); -}else{ +} else { $new = new FS::cust_credit_bill ( { map { $_, scalar($cgi->param($_)); -- 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/edit/process/cust_credit_bill.cgi | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'httemplate/edit/process/cust_credit_bill.cgi') diff --git a/httemplate/edit/process/cust_credit_bill.cgi b/httemplate/edit/process/cust_credit_bill.cgi index e84894b04..afe297308 100755 --- a/httemplate/edit/process/cust_credit_bill.cgi +++ b/httemplate/edit/process/cust_credit_bill.cgi @@ -1,23 +1,8 @@ + <% -# - -use strict; -use vars qw( $cgi $custnum $crednum $new $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup getotaker); -use FS::CGI qw(popurl); -use FS::Record qw(qsearchs fields); -use FS::cust_credit; -use FS::cust_credit_bill; -use FS::cust_refund; -use FS::cust_main; - -$cgi = new CGI; -cgisuidsetup($cgi); $cgi->param('crednum') =~ /^(\d*)$/ or die "Illegal crednum!"; -$crednum = $1; +my $crednum = $1; my $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } ) or die "No such crednum"; @@ -27,6 +12,7 @@ my $cust_main = qsearchs('cust_main', { 'custnum' => $cust_credit->custnum } ) my $custnum = $cust_main->custnum; +my $new; if ($cgi->param('invnum') =~ /^Refund$/) { $new = new FS::cust_refund ( { 'reason' => $cust_credit->reason, @@ -45,7 +31,7 @@ if ($cgi->param('invnum') =~ /^Refund$/) { } ); } -$error=$new->insert; +my $error = $new->insert; if ( $error ) { $cgi->param('error', $error); -- 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/edit/process/cust_credit_bill.cgi | 1 - 1 file changed, 1 deletion(-) (limited to 'httemplate/edit/process/cust_credit_bill.cgi') diff --git a/httemplate/edit/process/cust_credit_bill.cgi b/httemplate/edit/process/cust_credit_bill.cgi index afe297308..4879b0eab 100755 --- a/httemplate/edit/process/cust_credit_bill.cgi +++ b/httemplate/edit/process/cust_credit_bill.cgi @@ -1,4 +1,3 @@ - <% $cgi->param('crednum') =~ /^(\d*)$/ or die "Illegal crednum!"; -- cgit v1.2.1 From 0bd54ce52909122fa729e12709f6f155dd39c09c Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 5 Apr 2002 20:52:59 +0000 Subject: don't specify date (not on submitting form) --- httemplate/edit/process/cust_credit_bill.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/edit/process/cust_credit_bill.cgi') diff --git a/httemplate/edit/process/cust_credit_bill.cgi b/httemplate/edit/process/cust_credit_bill.cgi index 4879b0eab..23e2e6ce5 100755 --- a/httemplate/edit/process/cust_credit_bill.cgi +++ b/httemplate/edit/process/cust_credit_bill.cgi @@ -17,7 +17,7 @@ if ($cgi->param('invnum') =~ /^Refund$/) { 'reason' => $cust_credit->reason, 'refund' => $cgi->param('amount'), 'payby' => 'BILL', - '_date' => $cgi->param('_date'), + #'_date' => $cgi->param('_date'), 'payinfo' => 'Cash', 'crednum' => $crednum, } ); -- cgit v1.2.1 From 54c73b7ed85f88ef688f68ef8e1b0961dec14f0c Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 9 Dec 2005 16:58:40 +0000 Subject: fill in reason if empty when applying a credit to a refund --- httemplate/edit/process/cust_credit_bill.cgi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'httemplate/edit/process/cust_credit_bill.cgi') diff --git a/httemplate/edit/process/cust_credit_bill.cgi b/httemplate/edit/process/cust_credit_bill.cgi index 23e2e6ce5..28f892f62 100755 --- a/httemplate/edit/process/cust_credit_bill.cgi +++ b/httemplate/edit/process/cust_credit_bill.cgi @@ -14,11 +14,12 @@ my $custnum = $cust_main->custnum; my $new; if ($cgi->param('invnum') =~ /^Refund$/) { $new = new FS::cust_refund ( { - 'reason' => $cust_credit->reason, + 'reason' => ( $cust_credit->reason || 'refund from credit' ), 'refund' => $cgi->param('amount'), 'payby' => 'BILL', #'_date' => $cgi->param('_date'), - 'payinfo' => 'Cash', + #'payinfo' => 'Cash', + 'payinfo' => 'Refund', 'crednum' => $crednum, } ); } else { -- cgit v1.2.1