diff options
author | ivan <ivan> | 2009-06-30 12:28:38 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-06-30 12:28:38 +0000 |
commit | 0376f47e1ec2ec9b8702a0e6c5146af9c66beb5e (patch) | |
tree | 42f0c773b4f803770c6837353cbe2aefdbdb3223 /httemplate/edit | |
parent | b769174d6b1f1a7372298e05165ca6c21e3a0620 (diff) |
one-time charge "hold for later" / any package future start date, RT#5347
Diffstat (limited to 'httemplate/edit')
-rwxr-xr-x | httemplate/edit/REAL_cust_pkg.cgi | 1 | ||||
-rwxr-xr-x | httemplate/edit/process/REAL_cust_pkg.cgi | 1 | ||||
-rw-r--r-- | httemplate/edit/process/quick-charge.cgi | 4 | ||||
-rw-r--r-- | httemplate/edit/quick-charge.html | 38 |
4 files changed, 44 insertions, 0 deletions
diff --git a/httemplate/edit/REAL_cust_pkg.cgi b/httemplate/edit/REAL_cust_pkg.cgi index a707aca8d..5752c8dd8 100755 --- a/httemplate/edit/REAL_cust_pkg.cgi +++ b/httemplate/edit/REAL_cust_pkg.cgi @@ -46,6 +46,7 @@ <TD BGCOLOR="#ffffff"><% $cust_pkg->otaker %></TD> </TR> + <& .row_edit, cust_pkg=>$cust_pkg, column=>'start_date', label=>'Start' &> <& .row_edit, cust_pkg=>$cust_pkg, column=>'setup', label=>'Setup' &> <& .row_edit, cust_pkg=>$cust_pkg, column=>'last_bill', label=>$last_bill_or_renewed &> <& .row_edit, cust_pkg=>$cust_pkg, column=>'bill', label=>$next_bill_or_prepaid_until &> diff --git a/httemplate/edit/process/REAL_cust_pkg.cgi b/httemplate/edit/process/REAL_cust_pkg.cgi index c99ddc288..d4ba976c4 100755 --- a/httemplate/edit/process/REAL_cust_pkg.cgi +++ b/httemplate/edit/process/REAL_cust_pkg.cgi @@ -19,6 +19,7 @@ die "access denied" my $pkgnum = $cgi->param('pkgnum') or die; my $old = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); my %hash = $old->hash; +$hash{'start_date'} = $cgi->param('start_date') ? str2time($cgi->param('start_date')) : ''; $hash{'setup'} = $cgi->param('setup') ? str2time($cgi->param('setup')) : ''; $hash{'bill'} = $cgi->param('bill') ? str2time($cgi->param('bill')) : ''; $hash{'last_bill'} = diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi index 470cd4b5b..8f0e42471 100644 --- a/httemplate/edit/process/quick-charge.cgi +++ b/httemplate/edit/process/quick-charge.cgi @@ -55,6 +55,10 @@ unless ( $error ) { $error ||= $cust_main->charge( { 'amount' => $amount, 'quantity' => $quantity, + 'start_date' => ( scalar($cgi->param('start_date')) + ? str2time($cgi->param('start_date')) + : '' + ), 'pkg' => scalar($cgi->param('pkg')), 'setuptax' => scalar($cgi->param('setuptax')), 'taxclass' => scalar($cgi->param('taxclass')), diff --git a/httemplate/edit/quick-charge.html b/httemplate/edit/quick-charge.html index 8aca34a0d..ad26bff66 100644 --- a/httemplate/edit/quick-charge.html +++ b/httemplate/edit/quick-charge.html @@ -3,6 +3,11 @@ ) %> +<LINK REL="stylesheet" TYPE="text/css" HREF="../elements/calendar-win2k-2.css" TITLE="win2k-2"> +<SCRIPT TYPE="text/javascript" SRC="../elements/calendar_stripped.js"></SCRIPT> +<SCRIPT TYPE="text/javascript" SRC="../elements/calendar-en.js"></SCRIPT> +<SCRIPT TYPE="text/javascript" SRC="../elements/calendar-setup.js"></SCRIPT> + <% include('/elements/error.html') %> <SCRIPT TYPE="text/javascript"> @@ -79,6 +84,33 @@ function validate_quick_charge () { <% include('/elements/tr-select-pkg_class.html', 'curr_value' => $cgi->param('classnum') ) %> +<TR> + <TD ALIGN="right">Charge date </TD> + <TD> + <INPUT TYPE = "text" + NAME = "start_date" + SIZE = 32 + ID = "start_date_text" + VALUE = "<% $start_date %>" + > + <IMG SRC = "../images/calendar.png" + ID = "start_date_button" + STYLE = "cursor: pointer" + TITLE = "Select date" + > + <FONT SIZE=-1>(leave blank to charge immediately)</FONT> + </TD> +</TR> + +<SCRIPT TYPE="text/javascript"> + Calendar.setup({ + inputField: "start_date_text", + ifFormat: "%m/%d/%Y", + button: "start_date_button", + align: "BR" + }); +</SCRIPT> + <TR> <TD ALIGN="right">Tax exempt </TD> @@ -179,6 +211,12 @@ my $conf = new FS::Conf; $cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum'; my $custnum = $1; +my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); #XXX agent-virt + +my $format = "%m/%d/%Y %T %z (%Z)"; #false laziness w/REAL_cust_pkg.cgi? +my $start_date = $cust_main->next_bill_date; +warn "*** $start_date"; +$start_date = $start_date ? time2str($format, $start_date) : ''; my $amount = ''; if ( $cgi->param('amount') =~ /^\s*\$?\s*(\d+(\.\d{1,2})?)\s*$/ ) { |